ui.shipaid.com 0.3.121 → 0.3.123
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-v2.es.js +3018 -0
- package/dist/widget-v2.iife.js +648 -0
- package/dist/widget-v2.umd.js +649 -0
- package/dist/widget.es.js +71 -46
- package/dist/widget.iife.js +57 -57
- package/dist/widget.umd.js +18 -18
- package/dist-types/widget/src/entry-bootstrap.d.ts +1 -0
- package/dist-types/widget/src/entry-v2.d.ts +1 -0
- package/dist-types/widget/src/shipaid-widget-v2.d.ts +59 -0
- package/dist-types/widget/src/shipaid-widget.d.ts +2 -2
- package/dist-types/widget/types/widget.d.ts +6 -3
- package/package.json +6 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './shipaid-widget';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './shipaid-widget-v2';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LitElement, nothing } from 'lit';
|
|
2
|
+
import type { ShopifyCart, ShopifyProductVariant } from '../types/shopify';
|
|
3
|
+
import './components/shipaid-learn-more-carousel';
|
|
4
|
+
export declare class ShipAidWidgetV2 extends LitElement {
|
|
5
|
+
env: string;
|
|
6
|
+
lang: string;
|
|
7
|
+
previewGreenShipAid: boolean;
|
|
8
|
+
dataSelector: string;
|
|
9
|
+
isClone: boolean;
|
|
10
|
+
private _store?;
|
|
11
|
+
private _cart?;
|
|
12
|
+
private _protectionProduct?;
|
|
13
|
+
private _protectionVariant?;
|
|
14
|
+
private _hasFinishedSetup;
|
|
15
|
+
private _hasProtectionInCart;
|
|
16
|
+
private _originalCheckoutButton;
|
|
17
|
+
private _observer;
|
|
18
|
+
private _remountTimer;
|
|
19
|
+
private _aboutToUnload;
|
|
20
|
+
itemsSelector: string;
|
|
21
|
+
private _itemsObserver;
|
|
22
|
+
private _itemsTargetEl;
|
|
23
|
+
private _itemsDebounceTimer;
|
|
24
|
+
private _onShipAidCartEvent;
|
|
25
|
+
private _apiEndpoint;
|
|
26
|
+
private _fetch;
|
|
27
|
+
connectedCallback(): Promise<void>;
|
|
28
|
+
private _ensureLearnMoreCarousel;
|
|
29
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
30
|
+
private _ensureBaseStyles;
|
|
31
|
+
private _applyButtonStylesFrom;
|
|
32
|
+
private _hideProtectionRowsByHref;
|
|
33
|
+
private _mountNearCheckoutButton;
|
|
34
|
+
private _startObserver;
|
|
35
|
+
disconnectedCallback(): void;
|
|
36
|
+
private _observeCartItems;
|
|
37
|
+
private _fetchShipAidData;
|
|
38
|
+
private _fetchCart;
|
|
39
|
+
private _fetchProduct;
|
|
40
|
+
hasProtection(): boolean;
|
|
41
|
+
updateCart(cart?: ShopifyCart): Promise<void>;
|
|
42
|
+
calculateProtectionTotal(cart?: ShopifyCart): Promise<number>;
|
|
43
|
+
getProtectionVariantForFee(protectionFee: number): ShopifyProductVariant | undefined;
|
|
44
|
+
calculateProtectionFeeForCartPlusAmountCents(amountCents: number): Promise<{
|
|
45
|
+
fee: number;
|
|
46
|
+
variant: ShopifyProductVariant | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
addProtection(): Promise<void>;
|
|
49
|
+
removeProtection(): Promise<void>;
|
|
50
|
+
private _currencyFormat;
|
|
51
|
+
updateProtection(): Promise<void>;
|
|
52
|
+
private proceedToCheckout;
|
|
53
|
+
render(): import("lit").TemplateResult<1> | typeof nothing;
|
|
54
|
+
}
|
|
55
|
+
declare global {
|
|
56
|
+
interface HTMLElementTagNameMap {
|
|
57
|
+
'shipaid-widget-v2': ShipAidWidgetV2;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -115,8 +115,8 @@ export declare class ShipAidWidget extends LitElement {
|
|
|
115
115
|
private _findSellingPlanByName;
|
|
116
116
|
/** Fetches store info from the ShipAid public API. */
|
|
117
117
|
private _fetchSellingPlanFromVariant;
|
|
118
|
-
private
|
|
119
|
-
private
|
|
118
|
+
private _getProductFieldFromCookie;
|
|
119
|
+
private _storeProductFieldInCookie;
|
|
120
120
|
private _fetchProductJSON;
|
|
121
121
|
/** Fetch current cart from the Shopify ajax API */
|
|
122
122
|
private _fetchCart;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
export declare enum
|
|
2
|
-
LOADED = "shipaid
|
|
3
|
-
|
|
1
|
+
export declare enum Event_Triggers {
|
|
2
|
+
LOADED = "shipaid:widget:loaded",
|
|
3
|
+
CART_UPDATED = "shipaid:cart:updated"
|
|
4
|
+
}
|
|
5
|
+
export declare enum Event_Listeners {
|
|
6
|
+
CART_UPDATE = "shipaid:cart:update"
|
|
4
7
|
}
|
|
5
8
|
export interface State {
|
|
6
9
|
loading: boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui.shipaid.com",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.123",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/widget.umd.js",
|
|
7
7
|
"unpkg": "dist/widget.iife.js",
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"develop": "vite",
|
|
19
|
+
"develop:v2": "vite -c vite.config.v2.ts",
|
|
19
20
|
"build": "tsc && node build",
|
|
21
|
+
"build:v2": "tsc && node build.v2.js",
|
|
22
|
+
"build:all": "tsc && node build.all.js",
|
|
23
|
+
"prepublishOnly": "npm run build:all",
|
|
20
24
|
"lint": "eslint . --ext=ts --fix",
|
|
21
25
|
"test": "vitest"
|
|
22
26
|
},
|
|
@@ -46,4 +50,4 @@
|
|
|
46
50
|
"vite": "^5.4.10",
|
|
47
51
|
"vitest": "^2.1.4"
|
|
48
52
|
}
|
|
49
|
-
}
|
|
53
|
+
}
|