Skip to content

Commit 9cbfa92

Browse files
authored
Fix FBE UX being inconsistent with the true state of the FBE connection (#235)
* Resolving issue with inconsistent UX caused by FBE uninstall * regenerating fbe_allinone * reverting change to config.xml * Resolving PR comments and reverting changes to composer files * Add return to new function in PersistConfiguration.php * fixing extra white space in fbdeleteasset.php * remove installed flag
1 parent 10ce03a commit 9cbfa92

File tree

6 files changed

+33
-7
lines changed

6 files changed

+33
-7
lines changed

app/code/Meta/BusinessExtension/Controller/Adminhtml/Ajax/Fbdeleteasset.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,15 @@ public function executeForJson()
157157
*/
158158
private function deleteConfigKeys($storeId)
159159
{
160+
$this->systemConfig->saveConfig(
161+
SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_INSTALLED,
162+
false,
163+
$storeId,
164+
);
160165
$this->systemConfig->deleteConfig(
161166
SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_EXTERNAL_BUSINESS_ID,
162167
$storeId
163168
)
164-
->deleteConfig(SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_INSTALLED, $storeId)
165169
->deleteConfig(SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_ACCESS_TOKEN, $storeId)
166170
->deleteConfig(SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_PAGE_ID, $storeId)
167171
->deleteConfig(SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_PAGE_ACCESS_TOKEN, $storeId)

app/code/Meta/BusinessExtension/Controller/Adminhtml/Ajax/Fbpixel.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ public function executeForJson()
7777
$pixelId,
7878
$storeId
7979
);
80-
$this->systemConfig->saveConfig(
81-
SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_INSTALLED,
82-
true,
83-
$storeId
84-
);
8580
$response['success'] = true;
8681
$response['pixelId'] = $pixelId;
8782
if ($oldPixelId && $oldPixelId != $pixelId) {

app/code/Meta/BusinessExtension/Controller/Adminhtml/Ajax/PersistConfiguration.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function executeForJson()
8080

8181
$this->saveExternalBusinessId($externalBusinessId, $storeId)
8282
->saveCatalogId($catalogId, $storeId)
83+
->saveInstalledFlag($storeId)
8384
->completeOnsiteOnboarding($accessToken, $pageId, $storeId);
8485

8586
$response['success'] = true;
@@ -133,6 +134,23 @@ public function saveExternalBusinessId($externalBusinessId, $storeId)
133134
return $this;
134135
}
135136

137+
/**
138+
* Update install flag to true and save
139+
*
140+
* @param int $storeId
141+
* @return $this
142+
*/
143+
public function saveInstalledFlag($storeId)
144+
{
145+
// set installed to true
146+
$this->systemConfig->saveConfig(
147+
SystemConfig::XML_PATH_FACEBOOK_BUSINESS_EXTENSION_INSTALLED,
148+
true,
149+
$storeId,
150+
);
151+
return $this;
152+
}
153+
136154
/**
137155
* Complete onsite onboarding
138156
*

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ jQuery('#store').on('change', function() {
261261
async : false,
262262
data: ajaxParam({
263263
pixelId: pixelId,
264+
storeId: window.facebookBusinessExtensionConfig.storeId,
264265
}),
265266
success: function onSuccess(data, _textStatus, _jqXHR) {
266267
var response = data;
@@ -369,6 +370,7 @@ jQuery('#store').on('change', function() {
369370
catalogId: catalogId,
370371
pageId: pageId,
371372
accessToken: accessToken,
373+
storeId: window.facebookBusinessExtensionConfig.storeId,
372374
}),
373375
success: function onSuccess(data, _textStatus, _jqXHR) {
374376
if(data.success) {
@@ -385,6 +387,9 @@ jQuery('#store').on('change', function() {
385387
jQuery.ajax({
386388
type: 'delete',
387389
url: ajaxify(window.facebookBusinessExtensionConfig.deleteConfigKeys),
390+
data: ajaxParam({
391+
storeId: window.facebookBusinessExtensionConfig.storeId,
392+
}),
388393
success: function onSuccess(data, _textStatus, _jqXHR) {
389394
let msg = '';
390395
if(data.success) {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ jQuery('#store').on('change', function() {
123123
async : false,
124124
data: ajaxParam({
125125
pixelId: pixelId,
126+
storeId: window.facebookBusinessExtensionConfig.storeId,
126127
}),
127128
success: function onSuccess(data, _textStatus, _jqXHR) {
128129
var response = data;
@@ -231,6 +232,7 @@ jQuery('#store').on('change', function() {
231232
catalogId: catalogId,
232233
pageId: pageId,
233234
accessToken: accessToken,
235+
storeId: window.facebookBusinessExtensionConfig.storeId,
234236
}),
235237
success: function onSuccess(data, _textStatus, _jqXHR) {
236238
if(data.success) {
@@ -247,6 +249,9 @@ jQuery('#store').on('change', function() {
247249
jQuery.ajax({
248250
type: 'delete',
249251
url: ajaxify(window.facebookBusinessExtensionConfig.deleteConfigKeys),
252+
data: ajaxParam({
253+
storeId: window.facebookBusinessExtensionConfig.storeId,
254+
}),
250255
success: function onSuccess(data, _textStatus, _jqXHR) {
251256
let msg = '';
252257
if(data.success) {

app/code/Meta/Promotions/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"magento/module-sales-rule": "*",
1111
"magento/module-offline-shipping": "*",
1212
"meta/module-business-extension": "*"
13-
1413
},
1514
"license": "Apache-2.0",
1615
"autoload": {

0 commit comments

Comments
 (0)