Skip to content

Commit 0f6feda

Browse files
authored
[Setup] Merge config flags for CommerceExtension and CommerceExtensio… (#467)
* [Setup] Merge config flags for CommerceExtension and CommerceExtensionSplash * Rename the final config
1 parent 3ba5435 commit 0f6feda

File tree

6 files changed

+9
-40
lines changed

6 files changed

+9
-40
lines changed

app/code/Meta/BusinessExtension/Block/Adminhtml/Setup.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,24 +199,14 @@ public function isCommerceExtensionEnabled()
199199
return $storeHasCommercePartnerIntegration || $this->systemConfig->isCommerceExtensionEnabled();
200200
}
201201

202-
/**
203-
* Whether to enable the pre-onboarding Splash page for the new Commerce Extension.
204-
*
205-
* @return bool
206-
*/
207-
public function isCommerceExtensionSplashEnabled()
208-
{
209-
return $this->systemConfig->isCommerceExtensionSplashEnabled();
210-
}
211-
212202
/**
213203
* The expected origin for the Messages received from the FBE iframe/popup.
214204
*
215205
* @return string
216206
*/
217207
public function getPopupOrigin()
218208
{
219-
if (!$this->systemConfig->isCommerceExtensionSplashEnabled()) {
209+
if (!$this->systemConfig->isCommerceExtensionEnabled()) {
220210
return 'https://business.facebook.com';
221211
}
222212

@@ -230,7 +220,7 @@ public function getPopupOrigin()
230220
*/
231221
public function getSplashPageURL()
232222
{
233-
if (!$this->systemConfig->isCommerceExtensionSplashEnabled()) {
223+
if (!$this->systemConfig->isCommerceExtensionEnabled()) {
234224
return 'https://business.facebook.com/fbe-iframe-get-started/?';
235225
}
236226

app/code/Meta/BusinessExtension/Model/System/Config.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ class Config
115115
private const XML_PATH_FACEBOOK_BUSINESS_EXTENSION_ENABLE_COMMERCE_EXTENSION_UI_FLAG =
116116
'facebook/business_extension/commerce_extension';
117117

118-
private const XML_PATH_FACEBOOK_BUSINESS_EXTENSION_ENABLE_COMMERCE_EXTENSION_SPLASH_UI_FLAG =
119-
'facebook/business_extension/commerce_extension_splash';
120-
121118
private const XML_PATH_FACEBOOK_BUSINESS_EXTENSION_ENABLE_COMMERCE_EXTENSION_BASE_URL =
122119
'facebook/internal/extension_base_url';
123120

@@ -330,22 +327,6 @@ public function isCommerceExtensionEnabled($scopeId = null, $scope = ScopeInterf
330327
);
331328
}
332329

333-
/**
334-
* Is commerce extension UI Splash Screen is enabled
335-
*
336-
* @param int|null $scopeId
337-
* @param string $scope
338-
* @return bool
339-
*/
340-
public function isCommerceExtensionSplashEnabled($scopeId = null, $scope = ScopeInterface::SCOPE_STORE): bool
341-
{
342-
return (bool)$this->getConfig(
343-
self::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_ENABLE_COMMERCE_EXTENSION_SPLASH_UI_FLAG,
344-
$scopeId,
345-
$scope
346-
);
347-
}
348-
349330
/**
350331
* The base URL for rendering the Commerce Extension Splash page.
351332
*

app/code/Meta/BusinessExtension/etc/config.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<active>1</active>
88
<onsite>0</onsite>
99
<commerce_extension>0</commerce_extension>
10-
<commerce_extension_splash>0</commerce_extension_splash>
1110
<meta_exception_logging_enabled>1</meta_exception_logging_enabled>
1211
<meta_telemetry_logging_enabled>0</meta_telemetry_logging_enabled>
1312
<client_access_token>195311308289826|52dcd04d6c7ed113121b5eb4be23b4a7</client_access_token>

app/code/Meta/BusinessExtension/view/adminhtml/templates/setup.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
installed: '<?=
3030
$escaper->escapeHtml($block->isFBEInstalled($block->getSelectedStoreId())) ? 'true' : 'false'
3131
?>',
32-
isCommerceEmbeddedExtensionEnabled: <?=$block->isCommerceExtensionEnabled() ? 'true' : 'false'?>,
33-
isCommerceEmbeddedExtensionSplashEnabled: <?=$block->isCommerceExtensionSplashEnabled() ? 'true' : 'false'?>,
32+
isCommerceExtensionEnabled: <?=$block->isCommerceExtensionEnabled() ? 'true' : 'false'?>,
3433
pixelId: '<?= $escaper->escapeHtml($block->fetchPixelId($block->getSelectedStoreId())) ?>',
3534
popupOrigin: '<?= $escaper->escapeHtml($block->getPopupOrigin()) ?>',
3635
postFBEOnboardingSync: '<?= $escaper->escapeHtml($block->fetchPostFBEOnboardingSyncAjaxRoute()) ?>',

app/code/Meta/BusinessExtension/view/adminhtml/web/js/fbe_allinone.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ jQuery(document).ready(function() {
258258
_this.cleanConfigCache();
259259
_this.postFBEOnboardingSync();
260260

261-
if (window.facebookBusinessExtensionConfig.isCommerceEmbeddedExtensionEnabled) {
261+
if (window.facebookBusinessExtensionConfig.isCommerceExtensionEnabled) {
262262
window.location.reload();
263263
} else {
264264
_this.setState({installed: 'true'});
@@ -522,7 +522,7 @@ jQuery(document).ready(function() {
522522
},
523523
render: function render() {
524524
const _this = this;
525-
const isNewSplashPage = window.facebookBusinessExtensionConfig.isCommerceEmbeddedExtensionSplashEnabled;
525+
const isNewSplashPage = window.facebookBusinessExtensionConfig.isCommerceExtensionEnabled;
526526
try {
527527
_this.consoleLog("query params --"+_this.queryParams());
528528
return React.createElement(
@@ -536,7 +536,7 @@ jQuery(document).ready(function() {
536536
height: isNewSplashPage ? undefined : '700px',
537537
minHeight: isNewSplashPage ? '700px' : undefined,
538538
},
539-
scrolling: window.facebookBusinessExtensionConfig.isCommerceEmbeddedExtensionSplashEnabled
539+
scrolling: window.facebookBusinessExtensionConfig.isCommerceExtensionEnabled
540540
? 'no'
541541
: undefined,
542542
}

app/code/Meta/BusinessExtension/view/adminhtml/web/js/lib/fbe.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jQuery(document).ready(function() {
120120
_this.cleanConfigCache();
121121
_this.postFBEOnboardingSync();
122122

123-
if (window.facebookBusinessExtensionConfig.isCommerceEmbeddedExtensionEnabled) {
123+
if (window.facebookBusinessExtensionConfig.isCommerceExtensionEnabled) {
124124
window.location.reload();
125125
} else {
126126
_this.setState({installed: 'true'});
@@ -384,7 +384,7 @@ jQuery(document).ready(function() {
384384
},
385385
render: function render() {
386386
const _this = this;
387-
const isNewSplashPage = window.facebookBusinessExtensionConfig.isCommerceEmbeddedExtensionSplashEnabled;
387+
const isNewSplashPage = window.facebookBusinessExtensionConfig.isCommerceExtensionEnabled;
388388
try {
389389
_this.consoleLog("query params --"+_this.queryParams());
390390
return React.createElement(
@@ -398,7 +398,7 @@ jQuery(document).ready(function() {
398398
height: isNewSplashPage ? undefined : '700px',
399399
minHeight: isNewSplashPage ? '700px' : undefined,
400400
},
401-
scrolling: window.facebookBusinessExtensionConfig.isCommerceEmbeddedExtensionSplashEnabled
401+
scrolling: window.facebookBusinessExtensionConfig.isCommerceExtensionEnabled
402402
? 'no'
403403
: undefined,
404404
}

0 commit comments

Comments
 (0)