ui.shipaid.com 0.3.149 → 0.3.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.es.js
CHANGED
|
@@ -2735,7 +2735,7 @@ x`
|
|
|
2735
2735
|
</g>
|
|
2736
2736
|
</svg>
|
|
2737
2737
|
`;
|
|
2738
|
-
|
|
2738
|
+
x`
|
|
2739
2739
|
<svg
|
|
2740
2740
|
width="50.000000pt"
|
|
2741
2741
|
height="50.000000pt"
|
|
@@ -4775,6 +4775,33 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
4775
4775
|
this._cachedCheckoutButtonClasses = button.className;
|
|
4776
4776
|
return button;
|
|
4777
4777
|
}
|
|
4778
|
+
/**
|
|
4779
|
+
* Restore the original checkout button styles/attributes if we modified them
|
|
4780
|
+
* @private
|
|
4781
|
+
*/
|
|
4782
|
+
_restoreCheckoutButtonState() {
|
|
4783
|
+
try {
|
|
4784
|
+
const buttons = [];
|
|
4785
|
+
if (this._cachedCheckoutButton && document.contains(this._cachedCheckoutButton)) {
|
|
4786
|
+
buttons.push(this._cachedCheckoutButton);
|
|
4787
|
+
} else if (this.dataSelector) {
|
|
4788
|
+
this.getElementsBySelector(this.dataSelector).forEach((button) => {
|
|
4789
|
+
buttons.push(button);
|
|
4790
|
+
});
|
|
4791
|
+
}
|
|
4792
|
+
buttons.forEach((button) => {
|
|
4793
|
+
button.removeAttribute("shipaid-hidden");
|
|
4794
|
+
if (button === this._cachedCheckoutButton && this._cachedCheckoutButtonClasses) {
|
|
4795
|
+
button.className = this._cachedCheckoutButtonClasses;
|
|
4796
|
+
}
|
|
4797
|
+
});
|
|
4798
|
+
} catch (error) {
|
|
4799
|
+
console.error("[ShipAid] Error restoring checkout button state:", error);
|
|
4800
|
+
} finally {
|
|
4801
|
+
this._cachedCheckoutButton = null;
|
|
4802
|
+
this._cachedCheckoutButtonClasses = "";
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4778
4805
|
/**
|
|
4779
4806
|
* Calculate cart totals for checkoutButtonTemplate
|
|
4780
4807
|
* @private
|
|
@@ -5314,7 +5341,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
5314
5341
|
}
|
|
5315
5342
|
}
|
|
5316
5343
|
promptTemplate() {
|
|
5317
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
5344
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5318
5345
|
if (this.useShipAidCheckout && this.dataSelector) {
|
|
5319
5346
|
return this.checkoutButtonTemplate();
|
|
5320
5347
|
}
|
|
@@ -5418,31 +5445,6 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
5418
5445
|
${n(
|
|
5419
5446
|
this._state.error,
|
|
5420
5447
|
() => x`<p class="error">${this._state.error}</p>`
|
|
5421
|
-
)}
|
|
5422
|
-
${n(
|
|
5423
|
-
(_h = this._store) == null ? void 0 : _h.useCustomApp,
|
|
5424
|
-
() => x`
|
|
5425
|
-
<div class="prompt-footer">
|
|
5426
|
-
<a
|
|
5427
|
-
class="prompt-footer-badge"
|
|
5428
|
-
@click=${() => {
|
|
5429
|
-
this._openLearnMore("shipaid-widget");
|
|
5430
|
-
}}
|
|
5431
|
-
>
|
|
5432
|
-
<span>${translate("footer.button")}</span>
|
|
5433
|
-
${ShipAidLogoText}
|
|
5434
|
-
<button
|
|
5435
|
-
class="prompt-footer-about"
|
|
5436
|
-
@click=${(event) => {
|
|
5437
|
-
event.stopPropagation();
|
|
5438
|
-
this._openLearnMore("shipaid-widget");
|
|
5439
|
-
}}
|
|
5440
|
-
>
|
|
5441
|
-
i
|
|
5442
|
-
</button>
|
|
5443
|
-
</a>
|
|
5444
|
-
</div>
|
|
5445
|
-
`
|
|
5446
5448
|
)}
|
|
5447
5449
|
</div>
|
|
5448
5450
|
`;
|
|
@@ -5505,6 +5507,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
5505
5507
|
document.removeEventListener(SHIPAID_EVENTS.CART_UPDATED, this._onShipAidInternalCartUpdated);
|
|
5506
5508
|
} catch {
|
|
5507
5509
|
}
|
|
5510
|
+
this._restoreCheckoutButtonState();
|
|
5508
5511
|
}
|
|
5509
5512
|
updated(changedProperties) {
|
|
5510
5513
|
super.updated(changedProperties);
|
|
@@ -5527,6 +5530,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
5527
5530
|
button.removeAttribute("shipaid-hidden");
|
|
5528
5531
|
});
|
|
5529
5532
|
}
|
|
5533
|
+
this._restoreCheckoutButtonState();
|
|
5530
5534
|
}
|
|
5531
5535
|
}
|
|
5532
5536
|
async updateProtection(force = false) {
|
|
@@ -5586,11 +5590,13 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
5586
5590
|
}
|
|
5587
5591
|
if (!(protectionVariant == null ? void 0 : protectionVariant.id)) {
|
|
5588
5592
|
this._shouldShowWidget = false;
|
|
5593
|
+
this._restoreCheckoutButtonState();
|
|
5589
5594
|
logger.error("No matching protection variant found.");
|
|
5590
5595
|
return;
|
|
5591
5596
|
}
|
|
5592
5597
|
if (!((_c = this._protectionVariant) == null ? void 0 : _c.id)) {
|
|
5593
5598
|
this._shouldShowWidget = false;
|
|
5599
|
+
this._restoreCheckoutButtonState();
|
|
5594
5600
|
return;
|
|
5595
5601
|
}
|
|
5596
5602
|
if (this.useShipAidCheckout && this.supportSubscriptions) {
|
|
@@ -5701,18 +5707,21 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
5701
5707
|
logger.error(error.message);
|
|
5702
5708
|
this._hasFinishedSetup = true;
|
|
5703
5709
|
this._shouldShowWidget = false;
|
|
5710
|
+
this._restoreCheckoutButtonState();
|
|
5704
5711
|
return;
|
|
5705
5712
|
}
|
|
5706
5713
|
if (!this.planActive) {
|
|
5707
5714
|
logger.warn("No plan is active for this store - skipping setup.");
|
|
5708
5715
|
this._hasFinishedSetup = true;
|
|
5709
5716
|
this._shouldShowWidget = false;
|
|
5717
|
+
this._restoreCheckoutButtonState();
|
|
5710
5718
|
return;
|
|
5711
5719
|
}
|
|
5712
5720
|
if (!((_b = (_a = this._store) == null ? void 0 : _a.protectionSettings) == null ? void 0 : _b.protectionType)) {
|
|
5713
5721
|
logger.warn("No protection settings for this store - skipping setup.");
|
|
5714
5722
|
this._hasFinishedSetup = true;
|
|
5715
5723
|
this._shouldShowWidget = false;
|
|
5724
|
+
this._restoreCheckoutButtonState();
|
|
5716
5725
|
return;
|
|
5717
5726
|
}
|
|
5718
5727
|
if (!this._protectionProduct) {
|
|
@@ -5721,6 +5730,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
5721
5730
|
);
|
|
5722
5731
|
this._hasFinishedSetup = true;
|
|
5723
5732
|
this._shouldShowWidget = false;
|
|
5733
|
+
this._restoreCheckoutButtonState();
|
|
5724
5734
|
return;
|
|
5725
5735
|
}
|
|
5726
5736
|
this._hasFinishedSetup = true;
|