@liquidcommerce/elements-sdk 2.7.0 → 2.7.2

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.
Files changed (81) hide show
  1. package/README.md +83 -2750
  2. package/dist/index.checkout.esm.js +6898 -6837
  3. package/dist/index.esm.js +11463 -10993
  4. package/dist/types/auto-initialize/shared-utils.d.ts +5 -0
  5. package/dist/types/constants/core.constant.d.ts +0 -4
  6. package/dist/types/core/base-component.service.d.ts +2 -1
  7. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +1 -0
  8. package/dist/types/enums/core.enum.d.ts +11 -0
  9. package/dist/types/interfaces/configs/product-list.interface.d.ts +2 -2
  10. package/dist/types/interfaces/core.interface.d.ts +5 -4
  11. package/dist/types/modules/address/address-input.component.d.ts +11 -0
  12. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
  13. package/dist/types/modules/product-list/components/card-components/index.d.ts +3 -0
  14. package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +8 -0
  15. package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +2 -0
  16. package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +13 -0
  17. package/dist/types/modules/product-list/components/card-components/product-title.d.ts +6 -0
  18. package/dist/types/modules/product-list/components/index.d.ts +1 -0
  19. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +5 -1
  20. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +28 -0
  21. package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +10 -2
  22. package/dist/types/modules/product-list/product-list-card.component.d.ts +0 -5
  23. package/dist/types/modules/product-list/product-list.commands.d.ts +11 -2
  24. package/dist/types/modules/product-list/product-list.interface.d.ts +1 -0
  25. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +11 -2
  26. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  27. package/dist/types/utils/dom-compat.d.ts +2 -0
  28. package/docs/gitbook/actions.md +964 -0
  29. package/docs/gitbook/address.md +48 -0
  30. package/docs/gitbook/cart.md +65 -0
  31. package/docs/gitbook/checkout.md +131 -0
  32. package/docs/gitbook/events.md +1765 -0
  33. package/docs/gitbook/overview.md +166 -0
  34. package/docs/gitbook/product.md +64 -0
  35. package/docs/gitbook/quick-start-guide.md +393 -0
  36. package/docs/v1/README.md +210 -0
  37. package/docs/v1/api/actions/address-actions.md +281 -0
  38. package/docs/v1/api/actions/cart-actions.md +337 -0
  39. package/docs/v1/api/actions/checkout-actions.md +387 -0
  40. package/docs/v1/api/actions/product-actions.md +115 -0
  41. package/docs/v1/api/client.md +482 -0
  42. package/docs/v1/api/configuration.md +1 -0
  43. package/docs/v1/api/injection-methods.md +247 -0
  44. package/docs/v1/api/typescript-types.md +1 -0
  45. package/docs/v1/api/ui-helpers.md +200 -0
  46. package/docs/v1/examples/advanced-patterns.md +96 -0
  47. package/docs/v1/examples/checkout-flow.md +91 -0
  48. package/docs/v1/examples/custom-theming.md +63 -0
  49. package/docs/v1/examples/multi-product-page.md +90 -0
  50. package/docs/v1/examples/simple-product-page.md +89 -0
  51. package/docs/v1/getting-started/concepts.md +507 -0
  52. package/docs/v1/getting-started/installation.md +328 -0
  53. package/docs/v1/getting-started/quick-start.md +405 -0
  54. package/docs/v1/guides/address-component.md +431 -0
  55. package/docs/v1/guides/best-practices.md +324 -0
  56. package/docs/v1/guides/cart-component.md +737 -0
  57. package/docs/v1/guides/checkout-component.md +672 -0
  58. package/docs/v1/guides/events.md +926 -0
  59. package/docs/v1/guides/product-component.md +686 -0
  60. package/docs/v1/guides/product-list-component.md +598 -0
  61. package/docs/v1/guides/theming.md +216 -0
  62. package/docs/v1/integration/angular.md +39 -0
  63. package/docs/v1/integration/laravel.md +41 -0
  64. package/docs/v1/integration/nextjs.md +60 -0
  65. package/docs/v1/integration/proxy-setup.md +89 -0
  66. package/docs/v1/integration/react.md +64 -0
  67. package/docs/v1/integration/vanilla-js.md +84 -0
  68. package/docs/v1/integration/vue.md +34 -0
  69. package/docs/v1/reference/browser-support.md +44 -0
  70. package/docs/v1/reference/error-handling.md +70 -0
  71. package/docs/v1/reference/performance.md +54 -0
  72. package/docs/v1/reference/troubleshooting.md +64 -0
  73. package/package.json +1 -1
  74. package/docs/ACTIONS.md +0 -1301
  75. package/docs/BROWSER_SUPPORT.md +0 -279
  76. package/docs/CONFIGURATION.md +0 -997
  77. package/docs/DOCUMENTATION_INDEX.md +0 -319
  78. package/docs/EVENTS.md +0 -798
  79. package/docs/PROXY.md +0 -228
  80. package/docs/THEMING.md +0 -681
  81. package/docs/TROUBLESHOOTING.md +0 -793
@@ -0,0 +1,48 @@
1
+ # Address
2
+
3
+ The Address component sets the delivery location used for availability, pricing, and fulfillment options.
4
+
5
+ ## How it works
6
+ - Address is embedded in the Product component by default
7
+ - If a user adds to cart without an address, the SDK prompts automatically
8
+ - The address is reused across product, cart, and checkout
9
+
10
+ ## Standalone address component
11
+ ```js
12
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
13
+ await client.injectAddressElement('address', {
14
+ onAddressSet: (address) => {
15
+ console.log('Address set:', address);
16
+ }
17
+ });
18
+ ```
19
+
20
+ ## Address actions
21
+ ```js
22
+ await window.elements.actions.address.setAddressByPlacesId('ChIJOwg_06VPwokRYv534QaPC8g');
23
+
24
+ await window.elements.actions.address.setAddressManually(
25
+ {
26
+ one: '123 Main Street',
27
+ two: 'Apt 4',
28
+ city: 'New York',
29
+ state: 'NY',
30
+ zip: '10001'
31
+ },
32
+ { latitude: 40.7128, longitude: -74.0060 }
33
+ );
34
+
35
+ const address = window.elements.actions.address.getDetails();
36
+ await window.elements.actions.address.clear();
37
+ ```
38
+
39
+ ## Address events (examples)
40
+ ```js
41
+ window.addEventListener('lce:actions.address_updated', (event) => {
42
+ const { formattedAddress } = event.detail.data;
43
+ });
44
+
45
+ window.addEventListener('lce:actions.address_failed', (event) => {
46
+ const { error } = event.detail.data;
47
+ });
48
+ ```
@@ -0,0 +1,65 @@
1
+ # Cart
2
+
3
+ The Cart component is a slide-out drawer that manages items, quantities, promo codes, and checkout.
4
+
5
+ ## What you get
6
+ - Drawer UI with item list and totals
7
+ - Grouped items by retailer
8
+ - Quantity updates and removals
9
+ - Promo code support
10
+ - Cart persistence across sessions and tabs
11
+ - Checkout entry point
12
+
13
+ ## Show a cart button (CDN)
14
+ ```html
15
+ <script
16
+ defer
17
+ data-liquid-commerce-elements
18
+ data-token="YOUR_API_KEY"
19
+ data-env="production"
20
+ data-cart-badge-button="header-cart"
21
+ type="text/javascript"
22
+ src="https://assets-elements.liquidcommerce.us/all/elements.js"
23
+ ></script>
24
+
25
+ <div id="header-cart"></div>
26
+ ```
27
+
28
+ ## Cart UI helpers (programmatic)
29
+ ```js
30
+ window.elements.ui.cartButton('header-cart', true);
31
+ window.elements.ui.floatingCartButton(true);
32
+ window.elements.ui.cartSubtotal('cart-total');
33
+ window.elements.ui.cartItemsCount('items-count', { hideZero: true });
34
+ ```
35
+
36
+ ## Cart actions
37
+ ```js
38
+ window.elements.actions.cart.openCart();
39
+ window.elements.actions.cart.closeCart();
40
+ window.elements.actions.cart.toggleCart();
41
+
42
+ await window.elements.actions.cart.addProduct([
43
+ { identifier: '00619947000020', fulfillmentType: 'shipping', quantity: 1 }
44
+ ], true);
45
+
46
+ await window.elements.actions.cart.applyPromoCode('SUMMER20');
47
+ await window.elements.actions.cart.removePromoCode();
48
+ await window.elements.actions.cart.resetCart();
49
+
50
+ const cart = window.elements.actions.cart.getDetails();
51
+ ```
52
+
53
+ ## Address behavior
54
+ If no address is set, add-to-cart automatically opens the address prompt, then retries the add.
55
+
56
+ ## Cart events (examples)
57
+ ```js
58
+ window.addEventListener('lce:actions.cart_item_added', (event) => {
59
+ const { identifiers, itemsAdded } = event.detail.data;
60
+ });
61
+
62
+ window.addEventListener('lce:actions.cart_updated', (event) => {
63
+ const { subtotal, itemsCount } = event.detail.data;
64
+ });
65
+ ```
@@ -0,0 +1,131 @@
1
+ # Checkout
2
+
3
+ The Checkout component provides a complete purchase flow with customer info, payment (Stripe), and confirmation.
4
+
5
+ ## What you get
6
+ - Customer, billing, and shipping info
7
+ - Gift and marketing preferences
8
+ - Promo codes and gift cards
9
+ - Order summary and totals
10
+ - Hosted checkout or drawer checkout
11
+
12
+ ## Default: drawer checkout
13
+ Checkout opens automatically from the cart drawer. No setup required.
14
+
15
+ ## Hosted checkout (inject)
16
+ ```js
17
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
18
+ await client.injectCheckoutElement({
19
+ containerId: 'checkout',
20
+ checkoutId: 'optional_checkout_id',
21
+ hideHeader: false
22
+ });
23
+ ```
24
+
25
+ ## Hosted checkout (URL param)
26
+ Hosted checkout uses two things together:
27
+ 1) `data-checkout-url` on the main script (so the cart can redirect to your hosted checkout page).
28
+ 2) `data-checkout-param` on the hosted page (so it can read the checkout ID from the URL).
29
+
30
+ Hosted page example:
31
+ ```html
32
+ <script
33
+ defer
34
+ data-liquid-commerce-elements
35
+ data-token="YOUR_API_KEY"
36
+ data-env="production"
37
+ data-checkout-param="lce_checkout"
38
+ type="text/javascript"
39
+ src="https://assets-elements.liquidcommerce.us/all/elements.js"
40
+ ></script>
41
+
42
+ <div data-lce-checkout></div>
43
+ ```
44
+
45
+ Main script example (cart redirects here):
46
+ ```html
47
+ <script
48
+ defer
49
+ data-liquid-commerce-elements
50
+ data-token="YOUR_API_KEY"
51
+ data-env="production"
52
+ data-checkout-url="https://yoursite.com/checkout?lce_checkout={token}"
53
+ data-checkout-param="lce_checkout"
54
+ type="text/javascript"
55
+ src="https://assets-elements.liquidcommerce.us/all/elements.js"
56
+ ></script>
57
+ ```
58
+ ## Hosted checkout UI controls
59
+ Use these attributes on the hosted checkout page to customize the UI:
60
+
61
+ - `hide-header` on the checkout container
62
+ Hides the SDK header so you can render your own.
63
+
64
+ ```html
65
+ <div data-lce-checkout hide-header></div>
66
+ ```
67
+
68
+ - `data-lce-exit-checkout` on any element
69
+ Lets you build your own “Exit checkout” button or link.
70
+
71
+ ```html
72
+ <button data-lce-exit-checkout>Exit checkout</button>
73
+ ```
74
+
75
+ ## Checkout-only build
76
+ If a page only needs hosted checkout, use the checkout-only script. It supports the same hosted-checkout attributes but ships ~50% less JavaScript for faster load time.
77
+
78
+ ```html
79
+ <script
80
+ defer
81
+ data-liquid-commerce-elements
82
+ data-token="YOUR_API_KEY"
83
+ data-env="production"
84
+ type="text/javascript"
85
+ src="https://assets-elements.liquidcommerce.us/checkout/elements.js"
86
+ ></script>
87
+ ```
88
+
89
+ ## Checkout actions
90
+ ```js
91
+ window.elements.actions.checkout.openCheckout();
92
+ window.elements.actions.checkout.closeCheckout();
93
+ window.elements.actions.checkout.toggleCheckout();
94
+ window.elements.actions.checkout.exitCheckout();
95
+
96
+ await window.elements.actions.checkout.addProduct([
97
+ { identifier: '00619947000020', fulfillmentType: 'shipping', quantity: 1 }
98
+ ], true);
99
+
100
+ await window.elements.actions.checkout.applyPromoCode('WELCOME10');
101
+ await window.elements.actions.checkout.removePromoCode();
102
+
103
+ await window.elements.actions.checkout.applyGiftCard('GIFT-1234-5678');
104
+ await window.elements.actions.checkout.removeGiftCard('GIFT-1234-5678');
105
+
106
+ await window.elements.actions.checkout.toggleIsGift(true);
107
+ await window.elements.actions.checkout.toggleBillingSameAsShipping(false);
108
+ await window.elements.actions.checkout.toggleMarketingPreferences('canEmail', true);
109
+
110
+ window.elements.actions.checkout.updateCustomerInfo({
111
+ firstName: 'John',
112
+ lastName: 'Doe',
113
+ email: 'john@example.com'
114
+ });
115
+
116
+ window.elements.actions.checkout.updateBillingInfo({
117
+ firstName: 'John',
118
+ lastName: 'Doe',
119
+ addressOne: '789 Elm St',
120
+ city: 'Chicago',
121
+ state: 'IL',
122
+ zipCode: '60601'
123
+ });
124
+ ```
125
+
126
+ ## Checkout events (examples)
127
+ ```js
128
+ window.addEventListener('lce:actions.checkout_submit_completed', (event) => {
129
+ const { orderId, total } = event.detail.data;
130
+ });
131
+ ```