Skip to content

Commit c246761

Browse files
sujiezcarterbuceCarter Buce
authored
1.3.1 Fix lint warnings (#724)
* fix lint warnings * add more * Revert fbe_allinone.js back * adding * Set createdAt date during Email Opt-In rule and coupon creation APIs (#723) * set createdAt date during Email Opt-In rule and coupon APIs * set createdAt date during Email Opt-In rule and coupon APIs * fix undefined $storeId error --------- Co-authored-by: Carter Buce <[email protected]> * adding more fixes for CI --------- Co-authored-by: Carter Buce <[email protected]> Co-authored-by: Carter Buce <[email protected]>
1 parent 1dd4414 commit c246761

40 files changed

+677
-599
lines changed

app/code/Meta/BusinessExtension/Block/Adminhtml/System/Config/DeleteConnection.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class DeleteConnection extends Field
3939
private $systemConfig;
4040

4141
/**
42-
* @param Context $context
42+
* @param Context $context
4343
* @param SystemConfig $systemConfig
44-
* @param array $data
44+
* @param array $data
4545
*/
4646
public function __construct(
47-
Context $context,
47+
Context $context,
4848
SystemConfig $systemConfig,
49-
array $data = []
49+
array $data = []
5050
) {
5151
$this->systemConfig = $systemConfig;
5252
parent::__construct($context, $data);
@@ -55,7 +55,7 @@ public function __construct(
5555
/**
5656
* Remove scope label
5757
*
58-
* @param AbstractElement $element
58+
* @param AbstractElement $element
5959
* @return string
6060
*/
6161
public function render(AbstractElement $element)
@@ -90,8 +90,8 @@ public function getCleanCacheAjaxUrl()
9090
/**
9191
* Get element html
9292
*
93-
* @param AbstractElement $element
94-
* @return string
93+
* @param AbstractElement $element
94+
* @return string
9595
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
9696
*/
9797
protected function _getElementHtml(AbstractElement $element)
@@ -108,8 +108,8 @@ protected function _getElementHtml(AbstractElement $element)
108108
public function getButtonHtml()
109109
{
110110
/**
111-
* @var Button $button
112-
*/
111+
* @var Button $button
112+
*/
113113
$button = $this->getLayout()->createBlock(Button::class);
114114
return $button->setData(['id' => 'fb_delete_connection_btn', 'label' => __('Delete Connection')])
115115
->toHtml();

app/code/Meta/BusinessExtension/Block/Adminhtml/System/Config/FBEFieldSet.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ public function render(AbstractElement $element)
7777
$group = $element->getDataByPath('group/group');
7878

7979
switch ($group) {
80-
case 'catalog':
81-
$showSection = $this->systemConfig->isFBECatalogInstalled($storeId);
82-
break;
83-
case 'conversion':
84-
$showSection = $this->systemConfig->isFBEPixelInstalled($storeId);
85-
break;
86-
case 'ads':
87-
$showSection = $this->systemConfig->isFBEAdsInstalled($storeId);
88-
break;
89-
case 'fb_shop':
90-
$showSection = $this->systemConfig->isFBEShopInstalled($storeId);
91-
break;
92-
default:
93-
$showSection = false;
80+
case 'catalog':
81+
$showSection = $this->systemConfig->isFBECatalogInstalled($storeId);
82+
break;
83+
case 'conversion':
84+
$showSection = $this->systemConfig->isFBEPixelInstalled($storeId);
85+
break;
86+
case 'ads':
87+
$showSection = $this->systemConfig->isFBEAdsInstalled($storeId);
88+
break;
89+
case 'fb_shop':
90+
$showSection = $this->systemConfig->isFBEShopInstalled($storeId);
91+
break;
92+
default:
93+
$showSection = false;
9494
}
9595

9696
if ($showSection) {

app/code/Meta/BusinessExtension/Helper/GraphAPIAdapter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,9 @@ public function catalogBatchRequest($catalogId, $requests)
575575
public function graphAPIBatchRequest(array $requests)
576576
{
577577
$response = $this->callApi(
578-
'POST', '', [
578+
'POST',
579+
'',
580+
[
579581
'access_token' => $this->accessToken,
580582
'batch' => json_encode($requests)
581583
]

app/code/Meta/BusinessExtension/Model/Api/SettingsWebhookListenerImpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class SettingsWebhookListenerImpl implements SettingsWebhookListenerInterface
6262
private CollectionFactory $collectionFactory;
6363

6464
/**
65-
* @var Authenticator
65+
* @var Authenticator
6666
*/
6767
private Authenticator $authenticator;
6868

app/code/Meta/BusinessExtension/Model/PersistMetaTelemetryLogsMerger.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ function ($message) {
4242
$decodedMessage['extra_data'] = array_map(
4343
function ($value) {
4444
return is_string($value) ? $value : json_encode($value);
45-
}, $decodedMessage['extra_data']
45+
},
46+
$decodedMessage['extra_data']
4647
);
4748
return $decodedMessage;
48-
}, $messages['persist.meta.telemetry.logs']
49+
},
50+
$messages['persist.meta.telemetry.logs']
4951
);
5052
$mergedLogs = json_encode($telemetryLogs);
5153
return ['persist.meta.telemetry.logs' => [$mergedLogs]];

app/code/Meta/BusinessExtension/view/adminhtml/templates/system/config/delete_connection.phtml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
<?php /* @var $block \Meta\BusinessExtension\Block\Adminhtml\System\Config\DeleteConnection */ ?>
1+
<?php
2+
/**
3+
* @var $block \Meta\BusinessExtension\Block\Adminhtml\System\Config\DeleteConnection
4+
* @var $escaper \Magento\Framework\Escaper
5+
*/
6+
?>
27

38
<script>
49
require([
@@ -21,7 +26,7 @@
2126
return;
2227
}
2328
const params = {};
24-
new Ajax.Request('<?= $block->escapeUrl($block->getAjaxUrl()) ?>', {
29+
new Ajax.Request('<?= $escaper->escapeUrl($block->getAjaxUrl()) ?>', {
2530
parameters: params,
2631
loaderArea: false,
2732
asynchronous: true,
@@ -48,7 +53,7 @@
4853
jQuery('#fb_delete_connection_result_response').text(resultResponse);
4954
responseToggle.show();
5055

51-
new Ajax.Request('<?= $block->escapeUrl($block->getCleanCacheAjaxUrl()) ?>', {
56+
new Ajax.Request('<?= $escaper->escapeUrl($block->getCleanCacheAjaxUrl()) ?>', {
5257
asynchronous: true
5358
});
5459
}
@@ -61,10 +66,10 @@
6166
<?= $block->getButtonHtml() ?>
6267
<span id="fb_delete_connection_result">
6368
<img class="fb-delete-connection-processing" hidden="hidden" alt="Processing" style="margin:0 5px" src=
64-
"<?= $block->escapeUrl($block->getViewFileUrl('images/process_spinner.gif')) ?>"
69+
"<?= $escaper->escapeUrl($block->getViewFileUrl('images/process_spinner.gif')) ?>"
6570
/>
66-
<img class="fb-delete-connection-finished" hidden="hidden" alt="Finished" style="margin:-3px 5px" src=
67-
"<?= $block->escapeUrl($block->getViewFileUrl('images/rule_component_apply.gif')) ?>"
71+
<img class="fb-delete-connection-finished" hidden="hidden" alt="Finished" style="margin:-3px 5px" src=
72+
"<?= $escaper->escapeUrl($block->getViewFileUrl('images/rule_component_apply.gif')) ?>"
6873
/>
6974
<span id="fb_delete_connection_result_text"></span>
7075
<span id="fb_delete_connection_result_response_toggle"

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3307,7 +3307,7 @@
33073307
controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
33083308
coords: null,
33093309
crossOrigin: null,
3310-
data: null, // For `<object />` acts as `src`.
3310+
data: null, // For `<object></object>` acts as `src`.
33113311
dateTime: MUST_USE_ATTRIBUTE,
33123312
'default': HAS_BOOLEAN_VALUE,
33133313
defer: HAS_BOOLEAN_VALUE,
@@ -9366,7 +9366,7 @@
93669366
ReactElement.createFactory = function (type) {
93679367
var factory = ReactElement.createElement.bind(null, type);
93689368
// Expose the type on the factory and the prototype so that it can be
9369-
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
9369+
// easily accessed on elements. E.g. `<Foo></Foo>.type === Foo`.
93709370
// This should not be named `constructor` since this may not be the function
93719371
// that created the element, and it may not even be a constructor.
93729372
// Legacy hook TODO: Warn if this is accessed
@@ -12472,7 +12472,7 @@
1247212472
* render: function() {
1247312473
* return (
1247412474
* <div onClick={this.handleClick}>
12475-
* <CustomComponent ref="custom" />
12475+
* <CustomComponent ref="custom"></CustomComponent>
1247612476
* </div>
1247712477
* );
1247812478
* },

app/code/Meta/Catalog/view/adminhtml/templates/system/config/category_feed.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919

2020
jQuery('#fb_category_upload_btn').click(function () {
2121
const params = {};
22-
console.log("here");
23-
new Ajax.Request('<?= $block->escapeUrl($block->getAjaxUrl()) ?>', {
22+
new Ajax.Request('<?= $escaper->escapeUrl($block->getAjaxUrl()) ?>', {
2423
parameters: params,
2524
loaderArea: false,
2625
asynchronous: true,
Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
<?php
2-
/* @var \Meta\Conversion\Block\Pixel\AddPaymentInfo $block */
2+
/**
3+
* @var \Meta\Conversion\Block\Pixel\AddPaymentInfo $block
4+
* @var $escaper \Magento\Framework\Escaper
5+
*/
36
$trackerUrl = $block->getTrackerUrl();
47
?>
58
<?php if ($block->getFacebookPixelID()) { ?>
69
<script type="text/x-magento-init">
7-
{
8-
"*": {
9-
"Meta_Conversion/js/addPaymentInfo": {
10-
"url" : "<?= $block->escapeUrl($trackerUrl); ?>",
11-
"payload": <?= /* @noEscape */ json_encode([
12-
"eventName" => $block->escapeHtml($block->getEventToObserveName())
13-
]) ?>,
14-
"browserEventData": <?= /* @noEscape */ json_encode([
15-
'fbAgentVersion' => $block->escapeHtml($block->getFacebookAgentVersion()),
16-
'fbPixelId' => $block->escapeHtml($block->getFacebookPixelID()),
17-
'source' => $block->escapeHtml($block->getSource()),
18-
'pluginVersion' => $block->escapeHtml($block->getPluginVersion()),
10+
{
11+
"*": {
12+
"Meta_Conversion/js/addPaymentInfo": {
13+
"url" : "<?= $escaper->escapeUrl($trackerUrl); ?>",
14+
"payload": <?= /* @noEscape */
15+
json_encode([
16+
"eventName" => $escaper->escapeHtml($block->getEventToObserveName())
17+
]) ?>,
18+
"browserEventData": <?= /* @noEscape */
19+
json_encode([
20+
'fbAgentVersion' => $escaper->escapeHtml($block->getFacebookAgentVersion()),
21+
'fbPixelId' => $escaper->escapeHtml($block->getFacebookPixelID()),
22+
'source' => $escaper->escapeHtml($block->getSource()),
23+
'pluginVersion' => $escaper->escapeHtml($block->getPluginVersion()),
1924
'track' => 'track',
2025
'event' => 'AddPaymentInfo',
2126
'payload' => [
22-
'currency' => $block->escapeHtml($block->getCurrency())
27+
'currency' => $escaper->escapeHtml($block->getCurrency())
2328
]
24-
]) ?>
25-
}
29+
]) ?>
2630
}
2731
}
32+
}
2833
</script>
2934
<?php } ?>

app/code/Meta/Conversion/view/frontend/templates/pixel/add_to_cart.phtml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
<?php
2-
/** @var \Meta\Conversion\Block\Pixel\AddToCart $block */
2+
/**
3+
* @var \Meta\Conversion\Block\Pixel\AddToCart $block
4+
* @var $escaper \Magento\Framework\Escaper
5+
*/
36
$trackerUrl = $block->getTrackerUrl();
47
?>
58
<?php if ($block->getFacebookPixelID()): ?>
69
<!-- Added the new component below to track server events -->
710
<script>
811
window.addToCartData =
912
<?= /* @noEscape */ json_encode([
10-
"url" => $block->escapeUrl($trackerUrl),
13+
"url" => $escaper->escapeUrl($trackerUrl),
1114
"eventName" => $block->getEventToObserveName(),
1215
'fbAgentVersion' => $block->getFacebookAgentVersion(),
1316
'fbPixelId' => $block->getFacebookPixelID(),
@@ -36,14 +39,14 @@ $trackerUrl = $block->getTrackerUrl();
3639
// In case product is added from category page get options using added product's id
3740
// Get id of last added product
3841
var productId = data.productIds[data.productIds.length - 1];
39-
var categorySwatchData = $('[data-role=swatch-option-'+productId+']')
42+
var categorySwatchData = $('[data-role=swatch-option-' + productId + ']')
4043
.data('mage-SwatchRenderer');
4144
if (categorySwatchData) {
4245
var simpleProductId = categorySwatchData.getProductId();
4346
} else {
4447
// else check product data from configurable options
4548
var configurableProduct = data.form.data().mageConfigurable;
46-
if(configurableProduct) {
49+
if (configurableProduct) {
4750
var simpleProductId = configurableProduct.simpleProduct;
4851
}
4952
}
@@ -62,10 +65,10 @@ $trackerUrl = $block->getTrackerUrl();
6265
dataType: 'json',
6366
success: function (res) {
6467
var addToCartConfigPixel = {
65-
"url" : window.addToCartData.url,
68+
"url": window.addToCartData.url,
6669
"payload": {
67-
"eventName" : window.addToCartData.eventName,
68-
"productId" : res.productId
70+
"eventName": window.addToCartData.eventName,
71+
"productId": res.productId
6972
},
7073
"browserEventData": {
7174
'fbAgentVersion': window.addToCartData.fbAgentVersion,
@@ -94,4 +97,4 @@ $trackerUrl = $block->getTrackerUrl();
9497
});
9598
});
9699
</script>
97-
<?php endif; ?>
100+
<?php endif; ?>

0 commit comments

Comments
 (0)