ui.shipaid.com 0.3.53 → 0.3.54
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 +308 -16
- package/dist/widget.iife.js +200 -28
- package/dist/widget.umd.js +200 -28
- package/dist-types/common/shopify/types/ShopifyProduct.d.ts +5 -0
- package/dist-types/widget/src/components/shipaid-cart-confirmation.d.ts +13 -13
- package/dist-types/widget/src/shipaid-widget.d.ts +6 -0
- package/package.json +1 -1
package/dist/widget.es.js
CHANGED
|
@@ -1431,13 +1431,13 @@ const BellIcon = x`
|
|
|
1431
1431
|
</g>
|
|
1432
1432
|
</svg>
|
|
1433
1433
|
`;
|
|
1434
|
-
var __defProp$
|
|
1435
|
-
var __decorateClass$
|
|
1434
|
+
var __defProp$3 = Object.defineProperty;
|
|
1435
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
1436
1436
|
var result = void 0;
|
|
1437
1437
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1438
1438
|
if (decorator = decorators[i2])
|
|
1439
1439
|
result = decorator(target, key, result) || result;
|
|
1440
|
-
if (result) __defProp$
|
|
1440
|
+
if (result) __defProp$3(target, key, result);
|
|
1441
1441
|
return result;
|
|
1442
1442
|
};
|
|
1443
1443
|
const _LearnMorePopup = class _LearnMorePopup extends s$1 {
|
|
@@ -1515,7 +1515,7 @@ const _LearnMorePopup = class _LearnMorePopup extends s$1 {
|
|
|
1515
1515
|
};
|
|
1516
1516
|
_LearnMorePopup.styles = styles$2;
|
|
1517
1517
|
let LearnMorePopup = _LearnMorePopup;
|
|
1518
|
-
__decorateClass$
|
|
1518
|
+
__decorateClass$3([
|
|
1519
1519
|
n$7({ type: Boolean, attribute: true })
|
|
1520
1520
|
], LearnMorePopup.prototype, "active");
|
|
1521
1521
|
if (!customElements.get("shipaid-popup-learn-more")) {
|
|
@@ -1669,13 +1669,13 @@ const styles$1 = i$2`
|
|
|
1669
1669
|
z-index: -1;
|
|
1670
1670
|
}
|
|
1671
1671
|
`;
|
|
1672
|
-
var __defProp$
|
|
1673
|
-
var __decorateClass$
|
|
1672
|
+
var __defProp$2 = Object.defineProperty;
|
|
1673
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
1674
1674
|
var result = void 0;
|
|
1675
1675
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1676
1676
|
if (decorator = decorators[i2])
|
|
1677
1677
|
result = decorator(target, key, result) || result;
|
|
1678
|
-
if (result) __defProp$
|
|
1678
|
+
if (result) __defProp$2(target, key, result);
|
|
1679
1679
|
return result;
|
|
1680
1680
|
};
|
|
1681
1681
|
const _ConfirmationPopup = class _ConfirmationPopup extends s$1 {
|
|
@@ -1721,12 +1721,231 @@ const _ConfirmationPopup = class _ConfirmationPopup extends s$1 {
|
|
|
1721
1721
|
};
|
|
1722
1722
|
_ConfirmationPopup.styles = styles$1;
|
|
1723
1723
|
let ConfirmationPopup = _ConfirmationPopup;
|
|
1724
|
-
__decorateClass$
|
|
1724
|
+
__decorateClass$2([
|
|
1725
1725
|
n$7({ type: Boolean, attribute: true })
|
|
1726
1726
|
], ConfirmationPopup.prototype, "active");
|
|
1727
1727
|
if (!customElements.get("shipaid-popup-confirmation")) {
|
|
1728
1728
|
customElements.define("shipaid-popup-confirmation", ConfirmationPopup);
|
|
1729
1729
|
}
|
|
1730
|
+
var __defProp$1 = Object.defineProperty;
|
|
1731
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
1732
|
+
var result = void 0;
|
|
1733
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1734
|
+
if (decorator = decorators[i2])
|
|
1735
|
+
result = decorator(target, key, result) || result;
|
|
1736
|
+
if (result) __defProp$1(target, key, result);
|
|
1737
|
+
return result;
|
|
1738
|
+
};
|
|
1739
|
+
const _ShipAidCartConfirmation = class _ShipAidCartConfirmation extends s$1 {
|
|
1740
|
+
constructor() {
|
|
1741
|
+
super(...arguments);
|
|
1742
|
+
this.open = false;
|
|
1743
|
+
this.product = null;
|
|
1744
|
+
this.imageUrl = null;
|
|
1745
|
+
this.priceOfVariant = null;
|
|
1746
|
+
this.quantity = 1;
|
|
1747
|
+
this.dontShowAgain = sessionStorage.getItem("shipaid-confirmation-dontshow") === "yes";
|
|
1748
|
+
}
|
|
1749
|
+
handleDismiss() {
|
|
1750
|
+
this.dispatchEvent(new Event("dismiss-shipaid-cart"));
|
|
1751
|
+
}
|
|
1752
|
+
handleDontShowAgain(ev) {
|
|
1753
|
+
if (ev.target.checked) {
|
|
1754
|
+
sessionStorage.setItem("shipaid-confirmation-dontshow", "yes");
|
|
1755
|
+
} else {
|
|
1756
|
+
sessionStorage.removeItem("shipaid-confirmation-dontshow");
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
handleConfirm() {
|
|
1760
|
+
this.dispatchEvent(new Event("confirm-shipaid-cart"));
|
|
1761
|
+
}
|
|
1762
|
+
render() {
|
|
1763
|
+
return x`
|
|
1764
|
+
<div class=${`shipaid-cart-popup ${this.open ? "open" : ""}`}>
|
|
1765
|
+
<div class="popup-heading">
|
|
1766
|
+
<slot name="shipaid-cart-popup-heading">Protect Your Order Instantly</slot>
|
|
1767
|
+
</div>
|
|
1768
|
+
<div class="popup-description">
|
|
1769
|
+
<slot name="shipaid-cart-popup-description">
|
|
1770
|
+
Get total peace of mind! If your package is lost, stolen, or damaged, we’ve got you covered. Quick, hassle-free replacements!
|
|
1771
|
+
</slot>
|
|
1772
|
+
</div>
|
|
1773
|
+
<label class="checkbox-container">
|
|
1774
|
+
<svg width="48" height="48" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
|
|
1775
|
+
<rect x="4" y="4" width="40" height="40" rx="8" stroke-width="2"/>
|
|
1776
|
+
<rect x="4" y="-1" width="40" height="14" rx="8" fill="rgba(255, 255, 255, 0.3)"/>
|
|
1777
|
+
<path d="M14 24L22 32L34 16" stroke="white" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1778
|
+
</svg>
|
|
1779
|
+
ShipAid Delivery Guarantee Included - $${this.priceOfVariant}
|
|
1780
|
+
</label>
|
|
1781
|
+
|
|
1782
|
+
<div class="popup-actions">
|
|
1783
|
+
<button class="btn-secondary-popup" @click=${this.handleDismiss}>
|
|
1784
|
+
<slot name="shipaid-cart-popup-dismiss-button">No, I'll Take the Risk</slot>
|
|
1785
|
+
</button>
|
|
1786
|
+
<button class="btn-primary-popup" @click=${this.handleConfirm}>
|
|
1787
|
+
<slot name="shipaid-cart-popup-confirm-button">Yes, Protect My Order</slot>
|
|
1788
|
+
</button>
|
|
1789
|
+
</div>
|
|
1790
|
+
|
|
1791
|
+
<label class="dont-show-again">
|
|
1792
|
+
<input type="checkbox" @change=${this.handleDontShowAgain} .checked=${this.dontShowAgain} />
|
|
1793
|
+
<p>Don't show this again</p>
|
|
1794
|
+
</label>
|
|
1795
|
+
</div>
|
|
1796
|
+
`;
|
|
1797
|
+
}
|
|
1798
|
+
};
|
|
1799
|
+
_ShipAidCartConfirmation.styles = i$2`
|
|
1800
|
+
:host {
|
|
1801
|
+
--shipaid-popup-background: #ffffff;
|
|
1802
|
+
--shipaid-popup-btn-primary: #2e7cff;
|
|
1803
|
+
--shipaid-popup-btn-primary-hover: #1e40af;
|
|
1804
|
+
--shipaid-popup-btn-secondary: #e5e7eb;
|
|
1805
|
+
--shipaid-popup-btn-secondary-hover: #d1d5db;
|
|
1806
|
+
--shipaid-popup-product-title: #2e7cff;
|
|
1807
|
+
--shipaid-popup-product-container-hover: #dbeafe;
|
|
1808
|
+
--shipaid-svg-fill: #6dc20c;
|
|
1809
|
+
--shipaid-svg-stroke: #388E3C;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
.shipaid-cart-popup {
|
|
1813
|
+
position: fixed;
|
|
1814
|
+
top: 50%;
|
|
1815
|
+
left: 50%;
|
|
1816
|
+
transform: translate(-50%, -50%);
|
|
1817
|
+
width: 420px;
|
|
1818
|
+
background-color: var(--shipaid-popup-background);
|
|
1819
|
+
border-radius: 12px;
|
|
1820
|
+
padding: 24px;
|
|
1821
|
+
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
|
|
1822
|
+
z-index: 1000000000;
|
|
1823
|
+
text-align: center;
|
|
1824
|
+
visibility: hidden;
|
|
1825
|
+
opacity: 0;
|
|
1826
|
+
transition: opacity 250ms ease-in-out, visibility 250ms ease-in-out;
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
.shipaid-cart-popup.open {
|
|
1830
|
+
visibility: visible;
|
|
1831
|
+
opacity: 1;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
.popup-heading {
|
|
1835
|
+
font-size: 2rem;
|
|
1836
|
+
font-weight: bold;
|
|
1837
|
+
margin-bottom: 12px;
|
|
1838
|
+
color: #1f2937;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
.popup-description {
|
|
1842
|
+
font-size: 1.6rem;
|
|
1843
|
+
color: #000;
|
|
1844
|
+
line-height: 1.5;
|
|
1845
|
+
margin-bottom: 16px;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
.checkbox-container {
|
|
1849
|
+
display: flex;
|
|
1850
|
+
align-items: center;
|
|
1851
|
+
justify-content: flex-start;
|
|
1852
|
+
background: #eff6ff;
|
|
1853
|
+
padding: 12px 11px;
|
|
1854
|
+
border-radius: 8px;
|
|
1855
|
+
border: 1px solid var(--shipaid-popup-product-title);
|
|
1856
|
+
margin-bottom: 18px;
|
|
1857
|
+
font-weight: bold;
|
|
1858
|
+
color: var(--shipaid-popup-product-title);
|
|
1859
|
+
font-size: 1.5rem;
|
|
1860
|
+
transition: background 200ms ease-in-out;
|
|
1861
|
+
gap: 1rem;
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
.checkbox-container:hover {
|
|
1865
|
+
background: var(--shipaid-popup-product-container-hover);
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
.popup-actions {
|
|
1869
|
+
display: flex;
|
|
1870
|
+
flex-direction: row;
|
|
1871
|
+
justify-content: space-between;
|
|
1872
|
+
margin-top: 2rem;
|
|
1873
|
+
margin-bottom: 1rem;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
.btn-secondary-popup {
|
|
1877
|
+
background-color: var(--shipaid-popup-btn-secondary);
|
|
1878
|
+
color: #374151;
|
|
1879
|
+
border: none;
|
|
1880
|
+
padding: 12px 18px;
|
|
1881
|
+
border-radius: 6px;
|
|
1882
|
+
font-size: 1.6rem;
|
|
1883
|
+
cursor: pointer;
|
|
1884
|
+
transition: background-color 200ms ease-in-out;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
.btn-secondary-popup:hover {
|
|
1888
|
+
background-color: var(--shipaid-popup-btn-secondary-hover);
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
.btn-primary-popup {
|
|
1892
|
+
background-color: var(--shipaid-popup-btn-primary);
|
|
1893
|
+
color: white;
|
|
1894
|
+
border: none;
|
|
1895
|
+
padding: 12px 18px;
|
|
1896
|
+
border-radius: 6px;
|
|
1897
|
+
font-size: 1.6rem;
|
|
1898
|
+
cursor: pointer;
|
|
1899
|
+
transition: background-color 200ms ease-in-out;
|
|
1900
|
+
font-weight: bold;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
.btn-primary-popup:hover {
|
|
1904
|
+
background-color: var(--shipaid-popup-btn-primary-hover);
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
.dont-show-again {
|
|
1908
|
+
display: flex;
|
|
1909
|
+
align-items: center;
|
|
1910
|
+
justify-content: center;
|
|
1911
|
+
margin-top: 14px;
|
|
1912
|
+
font-size: 1.2rem;
|
|
1913
|
+
color: #777777;
|
|
1914
|
+
cursor: pointer;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
.dont-show-again input {
|
|
1918
|
+
margin-right: 6px;
|
|
1919
|
+
cursor: pointer;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
.checkbox-container svg {
|
|
1923
|
+
width: 24px;
|
|
1924
|
+
height: 24px;
|
|
1925
|
+
fill: var(--shipaid-svg-fill);
|
|
1926
|
+
stroke: var(--shipaid-svg-stroke);
|
|
1927
|
+
}
|
|
1928
|
+
`;
|
|
1929
|
+
let ShipAidCartConfirmation = _ShipAidCartConfirmation;
|
|
1930
|
+
__decorateClass$1([
|
|
1931
|
+
n$7({ type: Boolean, attribute: true })
|
|
1932
|
+
], ShipAidCartConfirmation.prototype, "open");
|
|
1933
|
+
__decorateClass$1([
|
|
1934
|
+
n$7({ type: String, attribute: true })
|
|
1935
|
+
], ShipAidCartConfirmation.prototype, "product");
|
|
1936
|
+
__decorateClass$1([
|
|
1937
|
+
n$7({ type: String, attribute: true })
|
|
1938
|
+
], ShipAidCartConfirmation.prototype, "imageUrl");
|
|
1939
|
+
__decorateClass$1([
|
|
1940
|
+
n$7({ type: String, attribute: true })
|
|
1941
|
+
], ShipAidCartConfirmation.prototype, "priceOfVariant");
|
|
1942
|
+
__decorateClass$1([
|
|
1943
|
+
n$7({ type: String, attribute: true })
|
|
1944
|
+
], ShipAidCartConfirmation.prototype, "quantity");
|
|
1945
|
+
__decorateClass$1([
|
|
1946
|
+
n$7({ type: Boolean })
|
|
1947
|
+
], ShipAidCartConfirmation.prototype, "dontShowAgain");
|
|
1948
|
+
customElements.define("shipaid-cart-confirmation", ShipAidCartConfirmation);
|
|
1730
1949
|
const loading = "Loading ShipAid Widget...";
|
|
1731
1950
|
const title = "Delivery Guarantee";
|
|
1732
1951
|
const description = "in case of Loss, Damage or Theft";
|
|
@@ -2058,6 +2277,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
2058
2277
|
this._storeDomain = ((_a = window.Shopify) == null ? void 0 : _a.shop) ?? ((_c = (_b = window.Shopify) == null ? void 0 : _b.Checkout) == null ? void 0 : _c.apiHost);
|
|
2059
2278
|
this._hasFinishedSetup = false;
|
|
2060
2279
|
this._shouldShowWidget = false;
|
|
2280
|
+
this._isCartVisibleOnScreen = false;
|
|
2061
2281
|
this._hasProtectionInCart = false;
|
|
2062
2282
|
this.hasLoadedStrings = false;
|
|
2063
2283
|
this.fetchInterceptorCleanup = () => {
|
|
@@ -2242,7 +2462,11 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
2242
2462
|
var _a, _b, _c;
|
|
2243
2463
|
const removeWithConfirmation = (_c = (_b = (_a = this._store) == null ? void 0 : _a.widgetConfigurations) == null ? void 0 : _b.widget) == null ? void 0 : _c.removeWithConfirmation;
|
|
2244
2464
|
if (!this._hasProtectionInCart) {
|
|
2245
|
-
|
|
2465
|
+
const triggered = this.triggerShipAidAddToCartConfirm();
|
|
2466
|
+
if (!triggered) {
|
|
2467
|
+
this.addProtection();
|
|
2468
|
+
}
|
|
2469
|
+
return;
|
|
2246
2470
|
}
|
|
2247
2471
|
if (!removeWithConfirmation) {
|
|
2248
2472
|
return this.removeProtection();
|
|
@@ -2354,7 +2578,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
2354
2578
|
let product;
|
|
2355
2579
|
if (this.useCustomStoreFront) {
|
|
2356
2580
|
const result = await this.runStoreFrontQuery(
|
|
2357
|
-
"query searchProducts($query: String!, $first: Int) { search(query: $query, first: $first, types: PRODUCT) { edges { node { ... on Product { id title handle variants(first: 1) { edges { node { id title price { amount } } } } } } } } }",
|
|
2581
|
+
"query searchProducts($query: String!, $first: Int) { search(query: $query, first: $first, types: PRODUCT) { edges { node { ... on Product { id title image { src } handle variants(first: 1) { edges { node { id title price { amount } } } } } } } } }",
|
|
2358
2582
|
{
|
|
2359
2583
|
query: "ShipAid Delivery Guarantee",
|
|
2360
2584
|
first: 1
|
|
@@ -2364,6 +2588,8 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
2364
2588
|
const protectionProductItem = result.search.edges[0];
|
|
2365
2589
|
product = {
|
|
2366
2590
|
id: protectionProductItem.node.id,
|
|
2591
|
+
title: protectionProductItem.node.title,
|
|
2592
|
+
image: protectionProductItem.node.image,
|
|
2367
2593
|
variants: protectionProductItem.node.variants.edges.map((v2) => ({
|
|
2368
2594
|
id: v2.node.id,
|
|
2369
2595
|
price: v2.node.price.amount
|
|
@@ -2588,6 +2814,29 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
2588
2814
|
></shipaid-popup-confirmation>
|
|
2589
2815
|
`;
|
|
2590
2816
|
}
|
|
2817
|
+
confirmShipAidCart() {
|
|
2818
|
+
var _a, _b, _c, _d;
|
|
2819
|
+
return x`
|
|
2820
|
+
<shipaid-cart-confirmation
|
|
2821
|
+
.open=${this._popup === "shipaid-confirm-cart"}
|
|
2822
|
+
.product=${(_a = this._protectionProduct) == null ? void 0 : _a.title}
|
|
2823
|
+
.imageUrl=${(_c = (_b = this._protectionProduct) == null ? void 0 : _b.image) == null ? void 0 : _c.src}
|
|
2824
|
+
.priceOfVariant=${(_d = this._protectionVariant) == null ? void 0 : _d.price}
|
|
2825
|
+
.quantity=${1}
|
|
2826
|
+
@dismiss-shipaid-cart=${() => {
|
|
2827
|
+
this._popup = null;
|
|
2828
|
+
}}
|
|
2829
|
+
@confirm-shipaid-cart=${async () => {
|
|
2830
|
+
await this.addProtection();
|
|
2831
|
+
sessionStorage.setItem(
|
|
2832
|
+
LOCAL_STORAGE_KEY,
|
|
2833
|
+
JSON.stringify({ loaded: true })
|
|
2834
|
+
);
|
|
2835
|
+
this._popup = null;
|
|
2836
|
+
}}
|
|
2837
|
+
></shipaid-cart-confirmation>
|
|
2838
|
+
`;
|
|
2839
|
+
}
|
|
2591
2840
|
renderPopups() {
|
|
2592
2841
|
if (this.persistPopup) {
|
|
2593
2842
|
this._popup = this.shouldPersistPopup();
|
|
@@ -2597,6 +2846,8 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
2597
2846
|
return this.confirmationPopupTemplate();
|
|
2598
2847
|
case "learn-more":
|
|
2599
2848
|
return this.learnMorePopupTemplate();
|
|
2849
|
+
case "shipaid-confirm-cart":
|
|
2850
|
+
return this.confirmShipAidCart();
|
|
2600
2851
|
default:
|
|
2601
2852
|
return null;
|
|
2602
2853
|
}
|
|
@@ -2805,9 +3056,38 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
2805
3056
|
);
|
|
2806
3057
|
await this._handleRefresh(cart);
|
|
2807
3058
|
}
|
|
3059
|
+
runCartPageDetection() {
|
|
3060
|
+
const cart = document.querySelector("button[class*='checkout'], a[href*='checkout']");
|
|
3061
|
+
if (cart) {
|
|
3062
|
+
const observer = new IntersectionObserver((entries) => {
|
|
3063
|
+
entries.forEach((entry) => {
|
|
3064
|
+
if (entry.isIntersecting) {
|
|
3065
|
+
this._isCartVisibleOnScreen = true;
|
|
3066
|
+
} else {
|
|
3067
|
+
this._isCartVisibleOnScreen = false;
|
|
3068
|
+
}
|
|
3069
|
+
});
|
|
3070
|
+
});
|
|
3071
|
+
observer.observe(cart);
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
triggerShipAidAddToCartConfirm() {
|
|
3075
|
+
var _a, _b, _c;
|
|
3076
|
+
const dontShowAgain = Boolean(sessionStorage.getItem("shipaid-confirmation-dontshow"));
|
|
3077
|
+
if (dontShowAgain) return false;
|
|
3078
|
+
const showAddToCartConfirmation = (_c = (_b = (_a = this._store) == null ? void 0 : _a.widgetConfigurations) == null ? void 0 : _b.widget) == null ? void 0 : _c.showAddToCartConfirmation;
|
|
3079
|
+
if (showAddToCartConfirmation) {
|
|
3080
|
+
if (this._isCartVisibleOnScreen) {
|
|
3081
|
+
this._popup = "shipaid-confirm-cart";
|
|
3082
|
+
}
|
|
3083
|
+
return true;
|
|
3084
|
+
}
|
|
3085
|
+
return false;
|
|
3086
|
+
}
|
|
2808
3087
|
render() {
|
|
2809
3088
|
useOnce(this, async () => {
|
|
2810
3089
|
var _a, _b, _c, _d, _e, _f;
|
|
3090
|
+
this.runCartPageDetection();
|
|
2811
3091
|
const linkEl = document.createElement("link");
|
|
2812
3092
|
linkEl.setAttribute(
|
|
2813
3093
|
"href",
|
|
@@ -2868,11 +3148,14 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
2868
3148
|
((_d2 = this._cart) == null ? void 0 : _d2.item_count) && // And that we are actually showing the widget
|
|
2869
3149
|
this._store.widgetShowCart
|
|
2870
3150
|
) {
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
3151
|
+
const triggered = this.triggerShipAidAddToCartConfirm();
|
|
3152
|
+
if (!triggered) {
|
|
3153
|
+
await this.addProtection();
|
|
3154
|
+
sessionStorage.setItem(
|
|
3155
|
+
LOCAL_STORAGE_KEY,
|
|
3156
|
+
JSON.stringify({ loaded: true })
|
|
3157
|
+
);
|
|
3158
|
+
}
|
|
2876
3159
|
}
|
|
2877
3160
|
}, 500);
|
|
2878
3161
|
if (this.disablePolling) return;
|
|
@@ -2904,7 +3187,13 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
2904
3187
|
},
|
|
2905
3188
|
[this._store, this._cart]
|
|
2906
3189
|
);
|
|
2907
|
-
|
|
3190
|
+
useEffect(
|
|
3191
|
+
this,
|
|
3192
|
+
async () => {
|
|
3193
|
+
D(this.renderPopups(), document.body);
|
|
3194
|
+
},
|
|
3195
|
+
[this._popup]
|
|
3196
|
+
);
|
|
2908
3197
|
return x`
|
|
2909
3198
|
<style>
|
|
2910
3199
|
:host {
|
|
@@ -3261,6 +3550,9 @@ __decorateClass([
|
|
|
3261
3550
|
__decorateClass([
|
|
3262
3551
|
t$3()
|
|
3263
3552
|
], ShipAidWidget.prototype, "_shouldShowWidget");
|
|
3553
|
+
__decorateClass([
|
|
3554
|
+
t$3()
|
|
3555
|
+
], ShipAidWidget.prototype, "_isCartVisibleOnScreen");
|
|
3264
3556
|
__decorateClass([
|
|
3265
3557
|
t$3()
|
|
3266
3558
|
], ShipAidWidget.prototype, "_hasProtectionInCart");
|