@liquidcommerce/elements-sdk 2.4.4 → 2.5.0
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/README.md +28 -0
- package/dist/index.esm.js +11198 -9788
- package/dist/types/constants/core.constant.d.ts +32 -0
- package/dist/types/constants/index.d.ts +0 -1
- package/dist/types/{modules/api-client → core}/api-client.service.d.ts +4 -2
- package/dist/types/core/auth.service.d.ts +21 -0
- package/dist/types/core/base-component.service.d.ts +4 -3
- package/dist/types/core/client/client-action.service.d.ts +4 -2
- package/dist/types/core/client/client-config.service.d.ts +1 -0
- package/dist/types/core/command/base-command.service.d.ts +5 -3
- package/dist/types/core/command/command.service.d.ts +2 -0
- package/dist/types/core/google-tag-manager.service.d.ts +1 -2
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +4 -1
- package/dist/types/core/pubsub/pubsub.service.d.ts +1 -1
- package/dist/types/core/sdk-error-handler.d.ts +1 -0
- package/dist/types/core/store/interfaces/core.interface.d.ts +4 -2
- package/dist/types/core/store/store.constant.d.ts +5 -1
- package/dist/types/core/store/store.service.d.ts +3 -1
- package/dist/types/core/utils.d.ts +0 -4
- package/dist/types/elements-base-client.d.ts +3 -3
- package/dist/types/enums/core.enum.d.ts +10 -0
- package/dist/types/enums/index.d.ts +0 -1
- package/dist/types/interfaces/cloud/catalog.interface.d.ts +43 -0
- package/dist/types/interfaces/cloud/index.d.ts +1 -0
- package/dist/types/interfaces/configs/product.interface.d.ts +2 -0
- package/dist/types/interfaces/core.interface.d.ts +13 -0
- package/dist/types/modules/cart/cart.commands.d.ts +1 -2
- package/dist/types/modules/cart/cart.commands.helper.d.ts +3 -2
- package/dist/types/modules/checkout/checkout.commands.d.ts +1 -2
- package/dist/types/modules/checkout/checkout.commands.helper.d.ts +1 -1
- package/dist/types/modules/product/components/components.d.ts +1 -1
- package/dist/types/modules/product/components/index.d.ts +1 -2
- package/dist/types/modules/product/product.commands.d.ts +2 -3
- package/dist/types/modules/product/utils/helpers.d.ts +1 -1
- package/dist/types/modules/product/utils/retailer-hours.d.ts +1 -1
- package/dist/types/modules/product-list/components/index.d.ts +3 -0
- package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +7 -0
- package/dist/types/modules/product-list/components/product-list-card.component.d.ts +36 -0
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +21 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +15 -0
- package/dist/types/modules/product-list/product-list.component.d.ts +76 -0
- package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +0 -2
- package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +1 -0
- package/dist/types/modules/theme-provider/styles/product-list/product-list.style.d.ts +1 -0
- package/dist/types/modules/theme-provider/styles/ui/loading.style.d.ts +1 -0
- package/dist/types/modules/ui-components/alert/alert.component.d.ts +1 -1
- package/dist/types/modules/ui-components/purchase-min-alert/helpers.d.ts +1 -1
- package/dist/types/modules/ui-components/ui.commands.d.ts +1 -1
- package/docs/ACTIONS.md +27 -0
- package/docs/TROUBLESHOOTING.md +21 -0
- package/package.json +12 -9
- package/umd/elements.js +1 -1
- package/dist/types/constants/z-index.constant.d.ts +0 -24
- package/dist/types/core/pubsub/index.d.ts +0 -2
- package/dist/types/core/pubsub/interfaces/index.d.ts +0 -5
- package/dist/types/core/store/index.d.ts +0 -2
- package/dist/types/core/store/interfaces/index.d.ts +0 -5
- package/dist/types/enums/debug.enum.d.ts +0 -6
- package/dist/types/modules/address/index.d.ts +0 -4
- package/dist/types/modules/api-client/api-client.interface.d.ts +0 -21
- package/dist/types/modules/api-client/index.d.ts +0 -2
- package/dist/types/modules/cart/index.d.ts +0 -1
- package/dist/types/modules/checkout/index.d.ts +0 -1
- package/dist/types/modules/product/constant.d.ts +0 -2
- package/dist/types/modules/product/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/index.d.ts +0 -2
- package/dist/types/modules/ui-components/loading/index.d.ts +0 -1
- /package/dist/types/modules/{ui-components/loading → product/components}/product-loading.component.d.ts +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
|
|
2
|
+
import type { ProductListCardVariantType, ProductListFilterType } from '@/interfaces/core.interface';
|
|
3
|
+
export interface IProductListComponentParams {
|
|
4
|
+
cardVariant: ProductListCardVariantType;
|
|
5
|
+
rows: number;
|
|
6
|
+
columns: number;
|
|
7
|
+
fillCard: boolean;
|
|
8
|
+
filters: ProductListFilterType[];
|
|
9
|
+
productUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IProductListFilters {
|
|
12
|
+
personalized: boolean;
|
|
13
|
+
preOrder: boolean;
|
|
14
|
+
deliveryOptions: 'all' | 'shipping' | 'onDemand';
|
|
15
|
+
}
|
|
16
|
+
export declare class ProductListComponent extends BaseComponent<IProductListComponentParams> {
|
|
17
|
+
private products;
|
|
18
|
+
private retailers;
|
|
19
|
+
private pagination;
|
|
20
|
+
private currentFilters;
|
|
21
|
+
private cardsContainer;
|
|
22
|
+
private filtersContainer;
|
|
23
|
+
private sentinelElement;
|
|
24
|
+
private personalizedSwitch;
|
|
25
|
+
private preOrderSwitch;
|
|
26
|
+
private deliveryRadios;
|
|
27
|
+
private deliveryRadioLabels;
|
|
28
|
+
private loadingState;
|
|
29
|
+
private scrollObserver;
|
|
30
|
+
private initializationPromise;
|
|
31
|
+
get hostClasses(): string[];
|
|
32
|
+
constructor();
|
|
33
|
+
protected connected(): Promise<void>;
|
|
34
|
+
disconnectedCallback(): void;
|
|
35
|
+
private initializeComponent;
|
|
36
|
+
protected template(): HTMLElement[];
|
|
37
|
+
private setLoadingState;
|
|
38
|
+
private renderCurrentState;
|
|
39
|
+
private loadInitialProducts;
|
|
40
|
+
private loadMoreProducts;
|
|
41
|
+
private mergeRetailers;
|
|
42
|
+
private updatePagination;
|
|
43
|
+
private buildApiParams;
|
|
44
|
+
private buildFiltersFromState;
|
|
45
|
+
private syncFiltersFromResponse;
|
|
46
|
+
private onFilterChange;
|
|
47
|
+
private resetPagination;
|
|
48
|
+
private updateFiltersUI;
|
|
49
|
+
private updatePersonalizedSwitch;
|
|
50
|
+
private updatePreOrderSwitch;
|
|
51
|
+
private updateDeliveryOptions;
|
|
52
|
+
private updateRadioLabel;
|
|
53
|
+
private isPersonalizationDisabled;
|
|
54
|
+
private isPreOrderDisabled;
|
|
55
|
+
private isSameDayDeliveryDisabled;
|
|
56
|
+
private createCardsContainer;
|
|
57
|
+
private renderLoadingState;
|
|
58
|
+
private renderProducts;
|
|
59
|
+
private appendNewProducts;
|
|
60
|
+
private createProductCard;
|
|
61
|
+
private createFiltersContainer;
|
|
62
|
+
private storeFilterElementReferences;
|
|
63
|
+
private setupInfiniteScroll;
|
|
64
|
+
private createScrollSentinel;
|
|
65
|
+
private updateSentinel;
|
|
66
|
+
private updateSentinelContent;
|
|
67
|
+
private showSentinelError;
|
|
68
|
+
private createLoadingElement;
|
|
69
|
+
private createErrorElement;
|
|
70
|
+
private createInfoElement;
|
|
71
|
+
private showErrorState;
|
|
72
|
+
private clearCardsContainer;
|
|
73
|
+
private cleanupScrollObserver;
|
|
74
|
+
onStoreWatch(changes: IOnStoreChanged[]): Promise<void>;
|
|
75
|
+
private doCleanup;
|
|
76
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { type ComponentType } from '@/enums';
|
|
2
|
-
export declare const mainComponents: ComponentType[];
|
|
3
2
|
export declare const productGroupComponents: ComponentType[];
|
|
4
3
|
export declare const addressGroupComponents: ComponentType[];
|
|
5
4
|
export declare const cartGroupComponents: ComponentType[];
|
|
6
5
|
export declare const checkoutGroupComponents: ComponentType[];
|
|
7
|
-
export declare const isMainComponent: (componentType: ComponentType) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './product-list.style';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getProductListStyles: () => string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
|
|
2
|
-
import type { StorePaths } from '@/core/store';
|
|
2
|
+
import type { StorePaths } from '@/core/store/interfaces/core.interface';
|
|
3
3
|
export interface IAlertComponentParams {
|
|
4
4
|
errorStorePath: StorePaths;
|
|
5
5
|
fromEvents?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IRetailerFulfillmentStore } from '@/core/store';
|
|
1
|
+
import type { IRetailerFulfillmentStore } from '@/core/store/interfaces/cart.interface';
|
|
2
2
|
export declare const shouldShowMinimumPurchaseAlert: (fulfillment: IRetailerFulfillmentStore, isPack?: boolean) => boolean;
|
|
3
3
|
export declare const getMinimumPurchaseMessage: (fulfillment: IRetailerFulfillmentStore, isPack?: boolean) => {
|
|
4
4
|
message: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '@/core/command/base-command.service';
|
|
2
|
-
import type { IDrawerContentConfig } from '@/core/store';
|
|
2
|
+
import type { IDrawerContentConfig } from '@/core/store/interfaces/core.interface';
|
|
3
3
|
export declare class UICommands extends BaseCommand {
|
|
4
4
|
static getInstance(): UICommands;
|
|
5
5
|
openDrawer(contentType: IDrawerContentConfig['type'], data?: Record<string, any>): void;
|
package/docs/ACTIONS.md
CHANGED
|
@@ -212,6 +212,33 @@ if (address) {
|
|
|
212
212
|
actions.address.clear();
|
|
213
213
|
```
|
|
214
214
|
|
|
215
|
+
**Complete Reset Behavior:**
|
|
216
|
+
The `actions.address.clear()` action performs a comprehensive reset of the user's address and shopping session:
|
|
217
|
+
|
|
218
|
+
**What gets cleared:**
|
|
219
|
+
- ✅ **Address Data**: All saved address information (street, city, state, zip, coordinates, Places ID)
|
|
220
|
+
- ✅ **Cart Contents**: Complete cart reset (removes all items, totals, promo codes, retailers)
|
|
221
|
+
- ✅ **Local Storage**: Completely removes the localStorage entry and its value
|
|
222
|
+
- ✅ **Database**: Deletes the persisted store from the server database
|
|
223
|
+
- ✅ **Checkout State**: Resets any pending checkout information
|
|
224
|
+
|
|
225
|
+
**Why the cart is reset:**
|
|
226
|
+
When an address is cleared, the cart must be reset because:
|
|
227
|
+
- Cart items have location-specific pricing and availability
|
|
228
|
+
- Fulfillment options are tied to specific addresses
|
|
229
|
+
- Delivery fees and shipping costs depend on location
|
|
230
|
+
- Without a valid address, cart operations would fail or show incorrect data
|
|
231
|
+
|
|
232
|
+
**Events fired:**
|
|
233
|
+
- `lce:actions.address_cleared` - Address successfully cleared
|
|
234
|
+
- `lce:actions.cart_reset` - Cart successfully reset
|
|
235
|
+
|
|
236
|
+
**Use cases:**
|
|
237
|
+
- Guest checkout option (clear previous user's data)
|
|
238
|
+
- Location change (start fresh with new address)
|
|
239
|
+
- Privacy compliance (complete data removal)
|
|
240
|
+
- Testing/development (reset to clean state)
|
|
241
|
+
|
|
215
242
|
**Real Business Uses:**
|
|
216
243
|
- **One-Click Address**: Let customers select from saved Google Places
|
|
217
244
|
- **Custom Address Forms**: Build your own address input forms with full control
|
package/docs/TROUBLESHOOTING.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Common issues and solutions for the LiquidCommerce Elements SDK.
|
|
4
4
|
|
|
5
|
+
## Address Management Issues
|
|
6
|
+
|
|
7
|
+
### Address Clear Behavior
|
|
8
|
+
|
|
9
|
+
**Question:** What happens when I call `actions.address.clear()`?
|
|
10
|
+
|
|
11
|
+
**Answer:** The `actions.address.clear()` action performs a comprehensive reset:
|
|
12
|
+
|
|
13
|
+
- ✅ **Address Data**: Removes all saved address information
|
|
14
|
+
- ✅ **Cart Contents**: Completely resets the cart (removes all items, totals, promo codes)
|
|
15
|
+
- ✅ **Local Storage**: Completely removes the localStorage entry and its value
|
|
16
|
+
- ✅ **Database**: Deletes the persisted store from the server database
|
|
17
|
+
- ✅ **Checkout State**: Resets any pending checkout information
|
|
18
|
+
|
|
19
|
+
**Why does it reset the cart?**
|
|
20
|
+
Cart items have location-specific pricing, availability, and fulfillment options. Without a valid address, cart operations would fail or show incorrect data. The reset ensures data integrity.
|
|
21
|
+
|
|
22
|
+
**Events fired:**
|
|
23
|
+
- `lce:actions.address_cleared` - Address successfully cleared
|
|
24
|
+
- `lce:actions.cart_reset` - Cart successfully reset
|
|
25
|
+
|
|
5
26
|
## SDK Initialization Issues
|
|
6
27
|
|
|
7
28
|
### SDK Not Loading
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "LiquidCommerce Elements SDK",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "LiquidCommerce Team",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.5.0",
|
|
7
7
|
"homepage": "https://docs.liquidcommerce.co/elements-sdk",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -71,23 +71,23 @@
|
|
|
71
71
|
"embeddable commerce"
|
|
72
72
|
],
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@biomejs/biome": "2.
|
|
74
|
+
"@biomejs/biome": "2.3.3",
|
|
75
75
|
"@commitlint/cli": "^20.1.0",
|
|
76
76
|
"@commitlint/config-conventional": "^20.0.0",
|
|
77
|
-
"@rollup/plugin-alias": "^
|
|
78
|
-
"@rollup/plugin-commonjs": "^
|
|
77
|
+
"@rollup/plugin-alias": "^6.0.0",
|
|
78
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
79
79
|
"@rollup/plugin-json": "^6.1.0",
|
|
80
80
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
81
|
-
"@rollup/plugin-replace": "^6.0.
|
|
81
|
+
"@rollup/plugin-replace": "^6.0.3",
|
|
82
82
|
"@rollup/plugin-terser": "^0.4.4",
|
|
83
83
|
"@semantic-release/changelog": "^6.0.3",
|
|
84
84
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
85
85
|
"@semantic-release/git": "^10.0.1",
|
|
86
|
-
"@semantic-release/github": "^12.0.
|
|
86
|
+
"@semantic-release/github": "^12.0.1",
|
|
87
87
|
"@semantic-release/npm": "^13.1.1",
|
|
88
88
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
89
89
|
"@types/core-js": "^2.5.8",
|
|
90
|
-
"@types/node": "^24.
|
|
90
|
+
"@types/node": "^24.10.0",
|
|
91
91
|
"conventional-changelog-cli": "^5.0.0",
|
|
92
92
|
"husky": "^9.1.7",
|
|
93
93
|
"process": "^0.11.10",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"typescript": "^5.9.3"
|
|
100
100
|
},
|
|
101
101
|
"engines": {
|
|
102
|
-
"node": ">=
|
|
102
|
+
"node": ">=22"
|
|
103
103
|
},
|
|
104
104
|
"pnpm": {
|
|
105
105
|
"peerDependencyRules": {
|
|
@@ -108,6 +108,9 @@
|
|
|
108
108
|
"onlyBuiltDependencies": [
|
|
109
109
|
"@biomejs/biome",
|
|
110
110
|
"javascript-obfuscator"
|
|
111
|
-
]
|
|
111
|
+
],
|
|
112
|
+
"overrides": {
|
|
113
|
+
"@conventional-changelog/git-client@<2.0.0": ">=2.0.0"
|
|
114
|
+
}
|
|
112
115
|
}
|
|
113
116
|
}
|