@liquidcommerce/elements-sdk 2.7.35 → 2.7.37
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/index.checkout.esm.js +8130 -7693
- package/dist/index.esm.js +13069 -12612
- package/dist/ssr-stub.esm.js +1 -0
- package/dist/types/clients/helpers.d.ts +2 -0
- package/dist/types/core/client/actions/client-checkout-action.service.d.ts +8 -2
- package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +5 -0
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +2 -1
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +1 -0
- package/dist/types/enums/core.enum.d.ts +1 -0
- package/dist/types/interfaces/configs/cart.interface.d.ts +1 -0
- package/dist/types/modules/cart/cart.commands.d.ts +5 -1
- package/dist/types/modules/cart/components/cart-fulfillment.component.d.ts +1 -1
- package/dist/types/modules/checkout/checkout.commands.d.ts +26 -1
- package/dist/types/modules/checkout/components/checkout-order-summary.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/checkout-payment.component.d.ts +4 -0
- package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +3 -0
- package/dist/types/modules/checkout/customer-prefill.d.ts +2 -0
- package/dist/types/modules/product/components/product-retailers-popup.component.d.ts +1 -0
- package/dist/types/modules/product/product.commands.d.ts +1 -1
- package/dist/types/modules/product-list/product-list.commands.d.ts +1 -1
- package/docs/v1/api/actions/checkout-actions.md +58 -1
- package/docs/v1/api/configuration.md +2 -0
- package/docs/v1/api/typescript-types.md +57 -0
- package/docs/v1/examples/custom-theming.md +13 -0
- package/docs/v1/guides/accessibility.md +42 -8
- package/docs/v1/guides/cart-component.md +43 -0
- package/docs/v1/guides/checkout-component.md +57 -0
- package/docs/v1/guides/events.md +30 -0
- package/docs/v1/guides/theming.md +13 -0
- package/package.json +9 -9
|
@@ -668,3 +668,60 @@ checkout: {
|
|
|
668
668
|
- [Actions API](../api/actions/checkout-actions.md) - Checkout actions reference
|
|
669
669
|
- [Events](./events.md) - All available events
|
|
670
670
|
- [Theming](./theming.md) - Customize appearance
|
|
671
|
+
|
|
672
|
+
### Preparing complete account delivery details
|
|
673
|
+
|
|
674
|
+
After `lce:actions.checkout_loaded`, call
|
|
675
|
+
`await elements.actions.checkout.updateCustomerInfo(fields, { saveIfValid: true })`
|
|
676
|
+
to validate and prepare complete account details, then show their editable summary.
|
|
677
|
+
Supply names, email, a US phone number, and a real `birthDate` in `MM/DD/YYYY` format
|
|
678
|
+
(age 21+, year 1930 or later). A shipping street must already be selected.
|
|
679
|
+
Omitted apartment and delivery instructions retain their existing checkout values.
|
|
680
|
+
Partial or invalid details stay in the form; backend validation failures reject the
|
|
681
|
+
promise, show the checkout error, and keep details editable. The host should handle that rejection.
|
|
682
|
+
|
|
683
|
+
The option skips gifts, saved forms, in-flight saves, and customer forms the shopper
|
|
684
|
+
has edited during the current checkout. It does not overwrite those forms. Edits or
|
|
685
|
+
address/checkout changes during preparation prevent a stale response from closing
|
|
686
|
+
the form. Without the option, this action only prefills fields, as before.
|
|
687
|
+
|
|
688
|
+
Apple Pay and Google Pay selection displays **Continue with Apple Pay** or
|
|
689
|
+
**Continue with Google Pay**. This opens the wallet to save a payment method; the
|
|
690
|
+
shopper still reviews and places the order afterward. It is not express checkout.
|
|
691
|
+
|
|
692
|
+
After wallet cancellation, the same Continue action remains available. If authorization
|
|
693
|
+
succeeded but saving the method failed, **Retry saving Apple Pay/Google Pay** reuses
|
|
694
|
+
the existing authorization rather than opening the wallet again.
|
|
695
|
+
|
|
696
|
+
### Saved account marketing preferences
|
|
697
|
+
|
|
698
|
+
```ts
|
|
699
|
+
setSavedMarketingPreferences(preferences: { canEmail?: boolean; canSms?: boolean }): Promise<void>
|
|
700
|
+
clearSavedMarketingPreferences(): void
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
Call `actions.checkout.setSavedMarketingPreferences()` with known recorded account
|
|
704
|
+
choices, including `false`, before checkout loads. Only boolean values are used;
|
|
705
|
+
missing/null/unrecognized values remain unknown. The first checkout prepare uses
|
|
706
|
+
saved values instead of tenant defaults. Each channel's prompt is hidden only
|
|
707
|
+
after the server confirms that saved choice. Unknown channels retain their normal
|
|
708
|
+
checkout prompts. The actions are available in both full and checkout-only clients.
|
|
709
|
+
|
|
710
|
+
Calling the setter during an active checkout prepares untouched channels and
|
|
711
|
+
preserves shopper checkbox edits. Backend failure rejects the promise, displays
|
|
712
|
+
an error, and leaves prompts available; the host should catch the rejection.
|
|
713
|
+
The same call can retry. Applying values does not call a subscription service.
|
|
714
|
+
It supplies the account's recorded choices to this checkout.
|
|
715
|
+
|
|
716
|
+
Saved choices persist across cart resets in the same SDK session. Call
|
|
717
|
+
`clearSavedMarketingPreferences()` on sign-out, account change, and host cleanup.
|
|
718
|
+
Clearing reveals the prompts and restores configured guest defaults. It invalidates
|
|
719
|
+
stale responses while draining outstanding preference requests; checkout completion
|
|
720
|
+
prepares the current choices before submitting the checkout token. A load already
|
|
721
|
+
in progress still finishes and reconciles the current account's values. Bind a new
|
|
722
|
+
account only to its own checkout; the host remains responsible for account/cart
|
|
723
|
+
ownership and for reloading checkout when identity changes.
|
|
724
|
+
|
|
725
|
+
Order completion waits for queued preference work. It cannot race a late saved
|
|
726
|
+
opt-out or proceed with an unconfirmed saved choice. If applying a known choice
|
|
727
|
+
fails, the shopper can retry or explicitly choose the visible channel preference.
|
package/docs/v1/guides/events.md
CHANGED
|
@@ -226,6 +226,36 @@ window.addEventListener('lce:actions.address_failed', (event) => {
|
|
|
226
226
|
|
|
227
227
|
## Cart Events
|
|
228
228
|
|
|
229
|
+
### `lce:actions.cart_shop_retailer`
|
|
230
|
+
|
|
231
|
+
A shopper activated **Shop {retailer}** from an unmet cart fulfillment minimum. Opt in with
|
|
232
|
+
`customTheme.cart.layout.showShopRetailerButton: true` (default `false`). The cart command
|
|
233
|
+
revalidates the fulfillment, its current retailer and items, fulfillment type, and remaining
|
|
234
|
+
minimum before emitting. Unsupported, empty, stale or already-satisfied fulfillments emit nothing.
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
interface ICartShopRetailerEventData {
|
|
238
|
+
retailerId: string;
|
|
239
|
+
fulfillmentId: string;
|
|
240
|
+
fulfillmentType: 'onDemand' | 'shipping';
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Listen with the exported constant; the usual event envelope is `{ data, metadata }`:
|
|
245
|
+
|
|
246
|
+
```javascript
|
|
247
|
+
window.addEventListener(`lce:actions.${ELEMENTS_ACTIONS_EVENT.CART_SHOP_RETAILER}`, (event) => {
|
|
248
|
+
const { retailerId, fulfillmentId, fulfillmentType } = event.detail.data;
|
|
249
|
+
// Revalidate against client.actions.cart.getDetails(), then close the drawer
|
|
250
|
+
// and route to your catalog scoped to this retailer and fulfillment type.
|
|
251
|
+
});
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
The SDK leaves the drawer open and does not navigate. The host handles routing and derives
|
|
255
|
+
retailer names, totals and minimums from current cart details. The event is also sent to `lce:actions`.
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
229
259
|
### `lce:actions.cart_loaded`
|
|
230
260
|
|
|
231
261
|
Fires when the cart is fully loaded or synced.
|
|
@@ -138,6 +138,7 @@ customTheme: {
|
|
|
138
138
|
backgroundColor: '#ffffff'
|
|
139
139
|
},
|
|
140
140
|
layout: {
|
|
141
|
+
showShopRetailerButton: false, // Enable only with a cart_shop_retailer event handler
|
|
141
142
|
showQuantityCounter: true,
|
|
142
143
|
quantityCounterStyle: 'outlined',
|
|
143
144
|
drawerHeaderText: 'Your Shopping Cart',
|
|
@@ -227,3 +228,15 @@ const client = await Elements('YOUR_API_KEY', {
|
|
|
227
228
|
|
|
228
229
|
- [Configuration Reference](../api/configuration.md)
|
|
229
230
|
- [Component Guides](../guides/)
|
|
231
|
+
|
|
232
|
+
### Shop the same retailer
|
|
233
|
+
|
|
234
|
+
Set `customTheme.cart.layout.showShopRetailerButton: true` to show a native **Shop {retailer}**
|
|
235
|
+
button beside each unmet order-minimum warning (below it on mobile). The default is `false`,
|
|
236
|
+
including when the server theme predates this option. It only appears for a current, nonempty
|
|
237
|
+
`onDemand` or `shipping` fulfillment with a positive amount remaining and valid retailer ownership.
|
|
238
|
+
|
|
239
|
+
Handle `ELEMENTS_ACTIONS_EVENT.CART_SHOP_RETAILER` (`lce:actions.cart_shop_retailer`) to close the
|
|
240
|
+
cart and open your retailer-filtered catalog. The SDK emits identifiers only and performs no
|
|
241
|
+
navigation. Revalidate them against `client.actions.cart.getDetails()` before navigating; see
|
|
242
|
+
[Events](./events.md) for the payload.
|
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.7.
|
|
6
|
+
"version": "2.7.37",
|
|
7
7
|
"homepage": "https://docs.liquidcommerce.co/elements-sdk",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -109,10 +109,10 @@
|
|
|
109
109
|
"theming"
|
|
110
110
|
],
|
|
111
111
|
"devDependencies": {
|
|
112
|
-
"@biomejs/biome": "^2.5.
|
|
113
|
-
"@commitlint/cli": "^21.2.
|
|
114
|
-
"@commitlint/config-conventional": "^21.2.
|
|
115
|
-
"@playwright/test": "1.
|
|
112
|
+
"@biomejs/biome": "^2.5.14",
|
|
113
|
+
"@commitlint/cli": "^21.2.3",
|
|
114
|
+
"@commitlint/config-conventional": "^21.2.3",
|
|
115
|
+
"@playwright/test": "1.63.0",
|
|
116
116
|
"@rollup/plugin-alias": "^6.0.0",
|
|
117
117
|
"@rollup/plugin-commonjs": "^29.0.3",
|
|
118
118
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -126,18 +126,18 @@
|
|
|
126
126
|
"@semantic-release/npm": "^13.1.5",
|
|
127
127
|
"@semantic-release/release-notes-generator": "^14.1.1",
|
|
128
128
|
"@types/core-js": "^2.5.8",
|
|
129
|
-
"@types/node": "^26.
|
|
129
|
+
"@types/node": "^26.6.2",
|
|
130
130
|
"conventional-changelog": "8.1.3",
|
|
131
131
|
"husky": "^9.1.7",
|
|
132
|
-
"jsdom": "
|
|
132
|
+
"jsdom": "30.1.0",
|
|
133
133
|
"process": "^0.11.10",
|
|
134
|
-
"rollup": "^4.63.
|
|
134
|
+
"rollup": "^4.63.4",
|
|
135
135
|
"rollup-obfuscator": "^4.1.1",
|
|
136
136
|
"rollup-plugin-typescript2": "^0.37.0",
|
|
137
137
|
"semantic-release": "^25.0.9",
|
|
138
138
|
"ts-node": "^10.9.2",
|
|
139
139
|
"typescript": "6.0.3",
|
|
140
|
-
"vitest": "
|
|
140
|
+
"vitest": "5.0.1"
|
|
141
141
|
},
|
|
142
142
|
"engines": {
|
|
143
143
|
"node": ">=22"
|