@liquidcommerce/elements-sdk 2.6.0-beta.7 → 2.6.0-beta.70

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 (224) hide show
  1. package/README.md +83 -2519
  2. package/dist/index.checkout.esm.js +16607 -0
  3. package/dist/index.esm.js +23330 -20416
  4. package/dist/ssr-stub.checkout.esm.js +18 -0
  5. package/dist/ssr-stub.esm.js +270 -0
  6. package/dist/types/auto-initialize/checkout.d.ts +2 -0
  7. package/dist/types/auto-initialize/shared-utils.d.ts +46 -0
  8. package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +15 -2
  9. package/dist/types/clients/builder.d.ts +3 -0
  10. package/dist/types/clients/checkout.d.ts +6 -0
  11. package/dist/types/{elements-client-helper.d.ts → clients/helpers.d.ts} +3 -1
  12. package/dist/types/clients/main.d.ts +3 -0
  13. package/dist/types/constants/core.constant.d.ts +2 -6
  14. package/dist/types/core/api/api-client.service.d.ts +20 -18
  15. package/dist/types/core/api/api-result.d.ts +19 -0
  16. package/dist/types/core/api/auth-client.service.d.ts +40 -13
  17. package/dist/types/core/api/http-client.service.d.ts +0 -1
  18. package/dist/types/core/base-component.service.d.ts +2 -1
  19. package/dist/types/core/client/actions/base-action.service.d.ts +15 -0
  20. package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
  21. package/dist/types/core/client/actions/client-cart-action.service.d.ts +37 -0
  22. package/dist/types/core/client/actions/client-checkout-action.service.d.ts +56 -0
  23. package/dist/types/core/client/actions/client-product-action.service.d.ts +15 -0
  24. package/dist/types/core/client/client-action.service.d.ts +6 -70
  25. package/dist/types/core/client/client-config.service.d.ts +8 -2
  26. package/dist/types/core/command/common-command.service.d.ts +1 -0
  27. package/dist/types/core/google-tag-manager.service.d.ts +2 -1
  28. package/dist/types/core/logger/logger.service.d.ts +1 -1
  29. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +27 -52
  30. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +45 -51
  31. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +9 -4
  32. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +16 -74
  33. package/dist/types/core/pubsub/pubsub.service.d.ts +1 -2
  34. package/dist/types/core/singleton-manager.service.d.ts +12 -8
  35. package/dist/types/core/store/interfaces/cart.interface.d.ts +3 -4
  36. package/dist/types/core/store/interfaces/checkout.interface.d.ts +17 -108
  37. package/dist/types/core/store/interfaces/core.interface.d.ts +12 -2
  38. package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
  39. package/dist/types/core/store/interfaces/product-list.interface.d.ts +30 -0
  40. package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
  41. package/dist/types/core/store/store.constant.d.ts +5 -0
  42. package/dist/types/core/store/store.service.d.ts +1 -0
  43. package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
  44. package/dist/types/enums/core.enum.d.ts +39 -1
  45. package/dist/types/enums/index.d.ts +0 -1
  46. package/dist/types/index.checkout.d.ts +8 -0
  47. package/dist/types/index.checkout.umd.d.ts +4 -0
  48. package/dist/types/index.d.ts +8 -3
  49. package/dist/types/interfaces/api/cart.interface.d.ts +13 -8
  50. package/dist/types/interfaces/api/checkout.interface.d.ts +239 -0
  51. package/dist/types/interfaces/api/index.d.ts +5 -0
  52. package/dist/types/interfaces/api/product-list.interface.d.ts +39 -0
  53. package/dist/types/interfaces/api/product.interface.d.ts +10 -4
  54. package/dist/types/interfaces/client.interface.d.ts +72 -0
  55. package/dist/types/interfaces/component.interface.d.ts +7 -0
  56. package/dist/types/interfaces/config.interface.d.ts +41 -0
  57. package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
  58. package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
  59. package/dist/types/interfaces/configs/checkout.interface.d.ts +2 -1
  60. package/dist/types/interfaces/configs/global.interface.d.ts +5 -3
  61. package/dist/types/interfaces/configs/index.d.ts +1 -0
  62. package/dist/types/interfaces/configs/product-list.interface.d.ts +47 -0
  63. package/dist/types/interfaces/configs/product.interface.d.ts +4 -1
  64. package/dist/types/interfaces/injection.interface.d.ts +47 -0
  65. package/dist/types/modules/address/address.command.d.ts +2 -1
  66. package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
  67. package/dist/types/modules/cart/cart.commands.d.ts +4 -4
  68. package/dist/types/modules/cart/components/cart-body.component.d.ts +2 -1
  69. package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
  70. package/dist/types/modules/checkout/checkout.commands.d.ts +23 -9
  71. package/dist/types/modules/checkout/checkout.component.d.ts +2 -0
  72. package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +2 -2
  73. package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +3 -0
  74. package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
  75. package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
  76. package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +14 -1
  77. package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
  78. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
  79. package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +2 -2
  80. package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
  81. package/dist/types/modules/checkout/constant.d.ts +3 -0
  82. package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
  83. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +1 -0
  84. package/dist/types/modules/product/components/product-description.component.d.ts +1 -0
  85. package/dist/types/modules/product/components/product-image-carousel.component.d.ts +3 -0
  86. package/dist/types/modules/product/components/product-options.component.d.ts +2 -1
  87. package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +3 -0
  88. package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +5 -2
  89. package/dist/types/modules/product/product.commands.d.ts +2 -3
  90. package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
  91. package/dist/types/modules/product-list/components/card-components/index.d.ts +5 -0
  92. package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +9 -0
  93. package/dist/types/modules/product-list/components/card-components/product-button.d.ts +9 -0
  94. package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +13 -0
  95. package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +9 -0
  96. package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +13 -0
  97. package/dist/types/modules/product-list/components/filter-components/index.d.ts +7 -0
  98. package/dist/types/modules/product-list/components/filter-components/product-list-apply-filter-button.d.ts +1 -0
  99. package/dist/types/modules/product-list/components/filter-components/product-list-chip.d.ts +5 -0
  100. package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts +13 -0
  101. package/dist/types/modules/product-list/components/filter-components/product-list-fulfillment-filter.d.ts +14 -0
  102. package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-price-filter.components.d.ts → filter-components/product-list-price-filter.d.ts} +1 -1
  103. package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +7 -0
  104. package/dist/types/modules/product-list/components/index.d.ts +6 -2
  105. package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +2 -1
  106. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +27 -30
  107. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +12 -0
  108. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +55 -36
  109. package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +22 -0
  110. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +49 -0
  111. package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-search.component.d.ts → product-list-search.component.d.ts} +11 -4
  112. package/dist/types/modules/product-list/product-list-filter.utils.d.ts +8 -0
  113. package/dist/types/modules/product-list/product-list.commands.d.ts +23 -8
  114. package/dist/types/modules/product-list/product-list.component.d.ts +10 -45
  115. package/dist/types/modules/product-list/product-list.constants.d.ts +38 -0
  116. package/dist/types/modules/product-list/product-list.interface.d.ts +20 -35
  117. package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
  118. package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
  119. package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
  120. package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
  121. package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
  122. package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
  123. package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
  124. package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
  125. package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -2
  126. package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +1 -0
  127. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +6 -1
  128. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +6 -1
  129. package/dist/types/modules/ui-components/input/index.d.ts +0 -1
  130. package/dist/types/modules/ui-components/input/input.component.d.ts +8 -1
  131. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  132. package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
  133. package/dist/types/modules/ui-components/ui.commands.d.ts +5 -1
  134. package/dist/types/ssr/stub.checkout.d.ts +6 -0
  135. package/dist/types/ssr/stub.d.ts +10 -0
  136. package/dist/types/static/icon/check.icon.d.ts +2 -0
  137. package/dist/types/static/icon/index.d.ts +1 -0
  138. package/dist/types/utils/dom-compat.d.ts +2 -0
  139. package/dist/types/utils/format.d.ts +0 -14
  140. package/dist/types/utils/product-selection.d.ts +16 -0
  141. package/dist/types/utils/product.d.ts +10 -0
  142. package/docs/v1/README.md +210 -0
  143. package/docs/v1/api/actions/address-actions.md +281 -0
  144. package/docs/v1/api/actions/cart-actions.md +337 -0
  145. package/docs/v1/api/actions/checkout-actions.md +427 -0
  146. package/docs/v1/api/actions/product-actions.md +158 -0
  147. package/docs/v1/api/client.md +495 -0
  148. package/docs/v1/api/configuration.md +528 -0
  149. package/docs/v1/api/injection-methods.md +261 -0
  150. package/docs/v1/api/typescript-types.md +398 -0
  151. package/docs/v1/api/ui-helpers.md +200 -0
  152. package/docs/v1/examples/advanced-patterns.md +198 -0
  153. package/docs/v1/examples/checkout-flow.md +91 -0
  154. package/docs/v1/examples/custom-theming.md +63 -0
  155. package/docs/v1/examples/multi-product-page.md +90 -0
  156. package/docs/v1/examples/simple-product-page.md +89 -0
  157. package/docs/v1/getting-started/concepts.md +507 -0
  158. package/docs/v1/getting-started/installation.md +328 -0
  159. package/docs/v1/getting-started/quick-start.md +405 -0
  160. package/docs/v1/guides/address-component.md +431 -0
  161. package/docs/v1/guides/best-practices.md +353 -0
  162. package/docs/v1/guides/cart-component.md +737 -0
  163. package/docs/v1/guides/checkout-component.md +672 -0
  164. package/docs/v1/guides/events.md +926 -0
  165. package/docs/v1/guides/product-component.md +686 -0
  166. package/docs/v1/guides/product-list-component.md +507 -0
  167. package/docs/v1/guides/theming.md +216 -0
  168. package/docs/v1/integration/angular.md +39 -0
  169. package/docs/v1/integration/laravel.md +41 -0
  170. package/docs/v1/integration/nextjs.md +69 -0
  171. package/docs/v1/integration/proxy-setup.md +89 -0
  172. package/docs/v1/integration/react.md +64 -0
  173. package/docs/v1/integration/vanilla-js.md +84 -0
  174. package/docs/v1/integration/vue.md +58 -0
  175. package/docs/v1/reference/browser-support.md +44 -0
  176. package/docs/v1/reference/error-handling.md +70 -0
  177. package/docs/v1/reference/performance.md +54 -0
  178. package/docs/v1/reference/troubleshooting.md +136 -0
  179. package/package.json +31 -27
  180. package/dist/types/elements-builder-client.d.ts +0 -2
  181. package/dist/types/elements-client.d.ts +0 -2
  182. package/dist/types/enums/cloud.enum.d.ts +0 -106
  183. package/dist/types/interfaces/cloud/catalog.interface.d.ts +0 -42
  184. package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -218
  185. package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
  186. package/dist/types/interfaces/cloud/index.d.ts +0 -4
  187. package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
  188. package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
  189. package/dist/types/interfaces/core.interface.d.ts +0 -111
  190. package/dist/types/modules/cart/cart.commands.helper.d.ts +0 -4
  191. package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
  192. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +0 -6
  193. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +0 -1
  194. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +0 -16
  195. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +0 -18
  196. package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
  197. package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
  198. package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
  199. package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
  200. package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
  201. package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
  202. package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
  203. package/dist/types/utils/helper.d.ts +0 -28
  204. package/docs/ACTIONS.md +0 -1300
  205. package/docs/BROWSER_SUPPORT.md +0 -279
  206. package/docs/CONFIGURATION.md +0 -853
  207. package/docs/DOCUMENTATION_INDEX.md +0 -311
  208. package/docs/EVENTS.md +0 -798
  209. package/docs/PROXY.md +0 -228
  210. package/docs/THEMING.md +0 -592
  211. package/docs/TROUBLESHOOTING.md +0 -793
  212. package/umd/elements.js +0 -1
  213. /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
  214. /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
  215. /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
  216. /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
  217. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
  218. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
  219. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
  220. /package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-checkbox-filter.components.d.ts → filter-components/product-list-checkbox-filter.d.ts} +0 -0
  221. /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
  222. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
  223. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
  224. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
@@ -0,0 +1,507 @@
1
+ # Product List Component
2
+
3
+ The Product List component provides a filterable, searchable product catalog with infinite scroll for building category pages and search results.
4
+
5
+ ## Overview
6
+
7
+ The Product List component:
8
+ - Displays products in a responsive grid
9
+ - Supports infinite scroll pagination
10
+ - Provides search functionality
11
+ - Offers advanced filtering options
12
+ - Links to product detail pages
13
+ - Shows real-time availability
14
+ - Supports add-to-cart from list view
15
+
16
+ ## Basic Usage
17
+
18
+ ### Declarative Setup
19
+
20
+ Use data attributes to configure the product list:
21
+
22
+ ```html
23
+ <script
24
+ defer
25
+ data-liquid-commerce-elements
26
+ data-token="YOUR_API_KEY"
27
+ data-env="production"
28
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
29
+ ></script>
30
+
31
+ <div
32
+ data-liquid-commerce-elements-products-list="my-collection-slug"
33
+ data-rows="3"
34
+ data-columns="4"
35
+ data-filters="price,brands,categories"
36
+ data-product-url="/product/{identifier}"
37
+ ></div>
38
+ ```
39
+
40
+ **Attributes:**
41
+ - `data-liquid-commerce-elements-products-list`: Product list container; value is the collection slug
42
+ - `data-rows`: Number of rows to display (default: 3)
43
+ - `data-columns`: Number of columns (default: 4)
44
+ - `data-filters`: Comma-separated filter types
45
+ - `data-product-url`: URL pattern for product detail pages (optional)
46
+
47
+ The `{identifier}` placeholder in `data-product-url` is replaced with the product's identifier.
48
+
49
+ ### With Search and Filters
50
+
51
+ Separate containers for search and filters:
52
+
53
+ ```html
54
+ <!-- Search container -->
55
+ <div data-liquid-commerce-elements-products-list-search="my-collection-slug"></div>
56
+
57
+ <!-- Filters container -->
58
+ <div data-liquid-commerce-elements-products-list-filters="my-collection-slug" data-filters="price,brands,fulfillment"></div>
59
+
60
+ <!-- Product list -->
61
+ <div
62
+ data-liquid-commerce-elements-products-list="my-collection-slug"
63
+ data-rows="4"
64
+ data-columns="3"
65
+ data-product-url="/products/{identifier}"
66
+ ></div>
67
+ ```
68
+
69
+ ### Programmatic Setup
70
+
71
+ Use JavaScript for dynamic configuration:
72
+
73
+ ```javascript
74
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
75
+
76
+ // Inject product list
77
+ await client.injectProductList({
78
+ containerId: 'products',
79
+ slug: 'my-collection-slug',
80
+ rows: 3,
81
+ columns: 4,
82
+ filters: ['price', 'brands', 'categories', 'fulfillment'],
83
+ productUrl: '/product/{identifier}'
84
+ });
85
+
86
+ // Inject search (optional)
87
+ await client.injectProductListSearch({
88
+ containerId: 'search',
89
+ slug: 'my-collection-slug'
90
+ });
91
+
92
+ // Inject filters (optional)
93
+ await client.injectProductListFilters({
94
+ containerId: 'filters',
95
+ slug: 'my-collection-slug',
96
+ filters: ['price', 'brands']
97
+ });
98
+ ```
99
+
100
+ ## Available Filters
101
+
102
+ The following filter type values can be used in the `filters` array:
103
+
104
+ | Filter Value | Description |
105
+ |----------------|------------------------------------------|
106
+ | `'price'` | Price range slider with min/max values |
107
+ | `'brands'` | Checkboxes for available brands |
108
+ | `'categories'` | Category selection checkboxes |
109
+ | `'fulfillment'`| Shipping vs. on-demand delivery toggle |
110
+ | `'engraving'` | Filter by personalization support |
111
+ | `'sizes'` | Filter by product size/volume |
112
+ | `'flavor'` | Filter by flavor profile |
113
+ | `'region'` | Filter by region of origin |
114
+ | `'variety'` | Filter by product variety |
115
+ | `'vintage'` | Filter by vintage year |
116
+ | `'country'` | Filter by country of origin |
117
+ | `'appellation'`| Filter by appellation |
118
+ | `'materials'` | Filter by materials |
119
+
120
+ ```javascript
121
+ // Example: use multiple filters
122
+ filters: ['price', 'brands', 'categories', 'fulfillment', 'sizes']
123
+ ```
124
+
125
+ ## Search Functionality
126
+
127
+ ### Search Box
128
+
129
+ The search component provides full-text search across:
130
+ - Product names
131
+ - Descriptions
132
+ - Brand names
133
+ - Categories
134
+ - SKUs/UPCs
135
+
136
+ ### Search Behavior
137
+
138
+ - Real-time search as user types (debounced)
139
+ - Minimum 2 characters to trigger search
140
+ - Highlights matching terms in results
141
+ - Shows result count
142
+ - "Clear search" button appears when active
143
+
144
+ ### Programmatic Search
145
+
146
+ Search is controlled through the injected search component. Use `injectProductListSearch()` to add a search box that automatically filters the associated product list.
147
+
148
+ ## Grid Layout
149
+
150
+ ### Responsive Grid
151
+
152
+ The grid automatically adjusts for screen sizes:
153
+
154
+ **Desktop** (> 1024px):
155
+ - Uses configured columns (e.g., 4 columns)
156
+
157
+ **Tablet** (768px - 1024px):
158
+ - Reduces to 3 or 2 columns
159
+
160
+ **Mobile** (< 768px):
161
+ - Single column or 2 columns depending on space
162
+
163
+ ### Configuring Layout
164
+
165
+ ```javascript
166
+ await client.injectProductList({
167
+ containerId: 'products',
168
+ slug: 'my-collection',
169
+ rows: 5, // Number of rows per page
170
+ columns: 4 // Columns in grid (desktop)
171
+ });
172
+ ```
173
+
174
+ Total products per page = rows × columns (e.g., 5 × 4 = 20 products)
175
+
176
+ ## Infinite Scroll
177
+
178
+ ### How It Works
179
+
180
+ 1. Initial products load (rows × columns)
181
+ 2. User scrolls to bottom
182
+ 3. Next page loads automatically
183
+ 4. Appends to existing products
184
+ 5. Continues until all products shown
185
+
186
+ ### Loading States
187
+
188
+ Shows loading indicator:
189
+ - On initial load
190
+ - When loading next page
191
+ - When applying filters
192
+ - When searching
193
+
194
+ ### End of Results
195
+
196
+ When all products are shown:
197
+ - Infinite scroll stops
198
+ - Shows "No more products" message
199
+ - Scroll to top button may appear
200
+
201
+ ## Product Cards
202
+
203
+ Each product card shows:
204
+
205
+ - Product image
206
+ - Product name
207
+ - Brand
208
+ - Price (or price range for multiple sizes)
209
+ - Rating (if available)
210
+ - "Quick View" or "View Details" button
211
+ - "Add to Cart" button (optional)
212
+ - Availability indicator
213
+
214
+ ### Card Interaction
215
+
216
+ **Click on card:** Navigate to product detail page (if `productUrl` configured)
217
+
218
+ **Quick Add:** Add product to cart directly from list view (if enabled)
219
+
220
+ **Click on image:** Open image in lightbox or navigate to product page
221
+
222
+ ## Customization
223
+
224
+ ### Theme Configuration
225
+
226
+ Product list theming is applied per-list using the collection slug as a key:
227
+
228
+ ```javascript
229
+ const client = await Elements('YOUR_API_KEY', {
230
+ env: 'production',
231
+ customTheme: {
232
+ productList: {
233
+ theme: {
234
+ backgroundColor: '#ffffff'
235
+ },
236
+ layout: {
237
+ lists: {
238
+ 'my-collection-slug': {
239
+ productCard: {
240
+ style: 'card', // 'card' or 'ghost'
241
+ cornerRadius: '8px',
242
+ showPrice: true,
243
+ showSizes: true,
244
+ showRetailerName: true,
245
+ showFulfillmentOptions: true,
246
+ enableShippingFulfillment: true,
247
+ enableOnDemandFulfillment: true,
248
+ enablePersonalization: true,
249
+ showQuantityCounter: true,
250
+ enablePreCart: true,
251
+ showCollectionTags: false
252
+ },
253
+ presentationMode: 'drawer', // 'drawer' or 'modal'
254
+ rows: 4,
255
+ columns: 3
256
+ }
257
+ }
258
+ }
259
+ }
260
+ }
261
+ });
262
+ ```
263
+
264
+ See [Configuration Reference](../api/configuration.md#product-list-theme) for the complete list of options.
265
+
266
+ ## Use Cases
267
+
268
+ ### Category Page
269
+
270
+ ```html
271
+ <!DOCTYPE html>
272
+ <html>
273
+ <head>
274
+ <title>Whiskey Collection</title>
275
+ <script
276
+ defer
277
+ data-liquid-commerce-elements
278
+ data-token="YOUR_API_KEY"
279
+ data-env="production"
280
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
281
+ ></script>
282
+ </head>
283
+ <body>
284
+ <h1>Whiskey Collection</h1>
285
+
286
+ <!-- Search -->
287
+ <div data-liquid-commerce-elements-products-list-search="whiskey-collection"></div>
288
+
289
+ <div class="catalog">
290
+ <!-- Filters sidebar -->
291
+ <aside>
292
+ <div data-liquid-commerce-elements-products-list-filters="whiskey-collection" data-filters="price,brands,sizes"></div>
293
+ </aside>
294
+
295
+ <!-- Product grid -->
296
+ <main>
297
+ <div
298
+ data-liquid-commerce-elements-products-list="whiskey-collection"
299
+ data-rows="4"
300
+ data-columns="3"
301
+ data-product-url="/whiskey/{identifier}"
302
+ ></div>
303
+ </main>
304
+ </div>
305
+ </body>
306
+ </html>
307
+ ```
308
+
309
+ ### Search Results Page
310
+
311
+ ```javascript
312
+ import { Elements } from '@liquidcommerce/elements-sdk';
313
+
314
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
315
+
316
+ // Inject product list with search
317
+ await client.injectProductList({
318
+ containerId: 'search-results',
319
+ slug: 'all-products',
320
+ rows: 5,
321
+ columns: 4,
322
+ filters: ['price', 'brands', 'categories']
323
+ });
324
+
325
+ await client.injectProductListSearch({
326
+ containerId: 'search-box',
327
+ slug: 'all-products'
328
+ });
329
+ ```
330
+
331
+ ### Custom Product URL Patterns
332
+
333
+ Different URL patterns for different product types:
334
+
335
+ ```javascript
336
+ // Get product type from data
337
+ const productType = getProductTypeFromData();
338
+
339
+ let urlPattern;
340
+ switch (productType) {
341
+ case 'whiskey':
342
+ urlPattern = '/spirits/whiskey/{identifier}';
343
+ break;
344
+ case 'wine':
345
+ urlPattern = '/wine/{identifier}';
346
+ break;
347
+ default:
348
+ urlPattern = '/products/{identifier}';
349
+ }
350
+
351
+ await client.injectProductList({
352
+ containerId: 'products',
353
+ slug: 'all-products',
354
+ rows: 3,
355
+ columns: 4,
356
+ productUrl: urlPattern
357
+ });
358
+ ```
359
+
360
+ ## Events
361
+
362
+ While product list events are primarily internal, you can listen for cart events when users add products:
363
+
364
+ ```javascript
365
+ window.addEventListener('lce:actions.cart_item_added', (event) => {
366
+ const { itemId, quantity } = event.detail.data;
367
+ console.log(`Product added from list: ${itemId}`);
368
+ });
369
+ ```
370
+
371
+ ## Accessibility
372
+
373
+ The product list component includes:
374
+
375
+ - Keyboard navigation support
376
+ - Screen reader labels
377
+ - ARIA attributes for filters and search
378
+ - Focus management
379
+ - High contrast support
380
+
381
+ ### Keyboard Shortcuts
382
+
383
+ - `Tab`: Navigate between products and filters
384
+ - `Enter/Space`: Select product or toggle filter
385
+ - `Escape`: Clear search or close filters
386
+ - `Arrow keys`: Navigate grid (when focused)
387
+
388
+ ## Performance
389
+
390
+ ### Optimization Features
391
+
392
+ - **Image lazy loading**: Images load as they enter viewport
393
+ - **Virtual scrolling**: Only renders visible products
394
+ - **Debounced search**: Reduces API calls during typing
395
+ - **Filter caching**: Caches filter results
396
+ - **Progressive loading**: Loads in batches
397
+
398
+ ### Large Catalogs
399
+
400
+ For catalogs with thousands of products:
401
+
402
+ ```javascript
403
+ await client.injectProductList({
404
+ containerId: 'products',
405
+ slug: 'all-products',
406
+ rows: 3,
407
+ columns: 4,
408
+ filters: ['price', 'brands'], // Limit filters to most useful
409
+ // More rows = larger pages = fewer API calls
410
+ });
411
+ ```
412
+
413
+ ## Best Practices
414
+
415
+ ### Provide Clear Navigation
416
+
417
+ ```html
418
+ <nav class="breadcrumb">
419
+ <a href="/">Home</a> &gt;
420
+ <a href="/products">Products</a> &gt;
421
+ <span>Whiskey</span>
422
+ </nav>
423
+ ```
424
+
425
+ ### Show Result Counts
426
+
427
+ The product list component automatically displays the number of results. You can also track cart additions from the list using standard cart events:
428
+
429
+ ```javascript
430
+ window.addEventListener('lce:actions.cart_item_added', (event) => {
431
+ console.log('Item added from product list:', event.detail.data);
432
+ });
433
+ ```
434
+
435
+ ### Mobile-First Design
436
+
437
+ Ensure filters work well on mobile:
438
+
439
+ ```css
440
+ @media (max-width: 768px) {
441
+ .filters-sidebar {
442
+ position: fixed;
443
+ bottom: 0;
444
+ left: 0;
445
+ right: 0;
446
+ transform: translateY(100%);
447
+ transition: transform 0.3s;
448
+ }
449
+
450
+ .filters-sidebar.open {
451
+ transform: translateY(0);
452
+ }
453
+ }
454
+ ```
455
+
456
+ ### Default to Relevant Filters
457
+
458
+ For category pages, pre-select relevant filters:
459
+
460
+ ```javascript
461
+ // On whiskey category page
462
+ await client.injectProductList({
463
+ containerId: 'products',
464
+ slug: 'whiskey-collection',
465
+ rows: 4,
466
+ columns: 3,
467
+ filters: ['price', 'brands', 'sizes'] // Most relevant for whiskey
468
+ });
469
+ ```
470
+
471
+ ## Troubleshooting
472
+
473
+ ### Products Not Loading
474
+
475
+ 1. Check browser console for errors
476
+ 2. Verify API key is correct
477
+ 3. Ensure container ID exists
478
+ 4. Check network tab for API responses
479
+ 5. Verify products exist in catalog
480
+
481
+ ### Filters Not Working
482
+
483
+ 1. Ensure filter types are spelled correctly
484
+ 2. Check that products have filterable attributes
485
+ 3. Verify theme config allows filters
486
+ 4. Look for JavaScript errors
487
+
488
+ ### Infinite Scroll Not Triggering
489
+
490
+ 1. Check container has finite height
491
+ 2. Verify scroll event listeners are attached
492
+ 3. Ensure there are more products to load
493
+ 4. Check console for errors
494
+
495
+ ### Search Not Finding Products
496
+
497
+ 1. Verify minimum character count is met (2 chars)
498
+ 2. Check search is not case-sensitive (it shouldn't be)
499
+ 3. Ensure products have searchable text fields
500
+ 4. Look for API errors in network tab
501
+
502
+ ## See Also
503
+
504
+ - [Product Component](./product-component.md) - Individual product display
505
+ - [Cart Component](./cart-component.md) - Add products to cart
506
+ - [Theming](./theming.md) - Customize appearance
507
+ - [Events](./events.md) - Available events
@@ -0,0 +1,216 @@
1
+ # Theming Guide
2
+
3
+ Customize the appearance of Elements SDK components to match your brand.
4
+
5
+ ## Overview
6
+
7
+ The SDK provides extensive theming capabilities through the `customTheme` configuration option. Themes are structured hierarchically:
8
+
9
+ - **Global**: Colors, fonts, and styles that apply to all components
10
+ - **Component-specific**: Overrides for individual components
11
+
12
+ ## Global Theme Configuration
13
+
14
+ ### Colors
15
+
16
+ ```javascript
17
+ const client = await Elements('YOUR_API_KEY', {
18
+ env: 'production',
19
+ customTheme: {
20
+ global: {
21
+ theme: {
22
+ primaryColor: '#007bff',
23
+ accentColor: '#28a745',
24
+ defaultTextColor: '#333333',
25
+ selectedTextColor: '#007bff',
26
+ linkTextColor: '#0056b3',
27
+ errorColor: '#dc3545',
28
+ warningColor: '#ffc107',
29
+ successColor: '#28a745',
30
+ drawerBackgroundColor: '#ffffff'
31
+ }
32
+ }
33
+ }
34
+ });
35
+ ```
36
+
37
+ ### Typography
38
+
39
+ ```javascript
40
+ customTheme: {
41
+ global: {
42
+ theme: {
43
+ headingFont: {
44
+ name: 'Poppins',
45
+ weights: [400, 600, 700]
46
+ },
47
+ paragraphFont: {
48
+ name: 'Inter',
49
+ weights: [400, 500]
50
+ }
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ ### Border Radius
57
+
58
+ ```javascript
59
+ customTheme: {
60
+ global: {
61
+ theme: {
62
+ buttonCornerRadius: '8px',
63
+ cardCornerRadius: '12px'
64
+ }
65
+ }
66
+ }
67
+ ```
68
+
69
+ ### Global Layout Options
70
+
71
+ ```javascript
72
+ customTheme: {
73
+ global: {
74
+ layout: {
75
+ enablePersonalization: true,
76
+ personalizationText: 'Add Engraving',
77
+ personalizationCardStyle: 'outlined', // or 'filled'
78
+ allowPromoCodes: true,
79
+ inputFieldStyle: 'outlined', // or 'filled'
80
+ showPoweredBy: true,
81
+ poweredByMode: 'light' // or 'dark'
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ ## Component Themes
88
+
89
+ ### Product Component
90
+
91
+ ```javascript
92
+ customTheme: {
93
+ product: {
94
+ theme: {
95
+ backgroundColor: '#ffffff'
96
+ },
97
+ layout: {
98
+ showImages: true,
99
+ showOnlyMainImage: false,
100
+ showTitle: true,
101
+ showDescription: true,
102
+ showQuantityCounter: true,
103
+ quantityCounterStyle: 'outlined',
104
+ fulfillmentDisplay: 'carousel',
105
+ enableShippingFulfillment: true,
106
+ enableOnDemandFulfillment: true,
107
+ addToCartButtonText: 'Add to Cart',
108
+ addToCartButtonShowTotalPrice: true,
109
+ buyNowButtonText: 'Buy Now',
110
+ prioritizeEngraving: false,
111
+ noAvailabilityText: 'Not available in your area'
112
+ }
113
+ }
114
+ }
115
+ ```
116
+
117
+ ### Cart Component
118
+
119
+ ```javascript
120
+ customTheme: {
121
+ cart: {
122
+ theme: {
123
+ backgroundColor: '#ffffff'
124
+ },
125
+ layout: {
126
+ showQuantityCounter: true,
127
+ quantityCounterStyle: 'outlined',
128
+ drawerHeaderText: 'Your Shopping Cart',
129
+ goToCheckoutButtonText: 'Proceed to Checkout'
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ ### Checkout Component
136
+
137
+ ```javascript
138
+ customTheme: {
139
+ checkout: {
140
+ theme: {
141
+ backgroundColor: '#ffffff'
142
+ },
143
+ layout: {
144
+ emailOptIn: {
145
+ show: true,
146
+ checked: false,
147
+ text: 'Subscribe to our newsletter for updates and offers.'
148
+ },
149
+ smsOptIn: {
150
+ show: true,
151
+ checked: false,
152
+ text: 'Receive SMS updates about your order and exclusive deals.'
153
+ },
154
+ allowGiftCards: true,
155
+ legalMessage: 'By placing your order, you agree to our Terms of Service and Privacy Policy.',
156
+ continueShoppingUrl: 'https://yoursite.com/shop',
157
+ exitUrl: 'https://yoursite.com',
158
+ thankYouButtonText: 'Continue Shopping',
159
+ drawerHeaderText: 'Checkout',
160
+ placeOrderButtonText: 'Place Order',
161
+ checkoutCompleted: {
162
+ customLogo: 'https://yoursite.com/logo.png',
163
+ customText: 'Thank you for your purchase! Your order has been received.'
164
+ }
165
+ }
166
+ }
167
+ }
168
+ }
169
+ ```
170
+
171
+ ## Complete Example
172
+
173
+ ```javascript
174
+ const client = await Elements('YOUR_API_KEY', {
175
+ env: 'production',
176
+ customTheme: {
177
+ global: {
178
+ theme: {
179
+ primaryColor: '#007bff',
180
+ accentColor: '#28a745',
181
+ buttonCornerRadius: '8px',
182
+ cardCornerRadius: '12px',
183
+ headingFont: {
184
+ name: 'Poppins',
185
+ weights: [400, 600, 700]
186
+ },
187
+ paragraphFont: {
188
+ name: 'Inter',
189
+ weights: [400, 500]
190
+ }
191
+ },
192
+ layout: {
193
+ allowPromoCodes: true,
194
+ inputFieldStyle: 'outlined',
195
+ showPoweredBy: false
196
+ }
197
+ },
198
+ product: {
199
+ layout: {
200
+ addToCartButtonText: 'Add to Bag',
201
+ fulfillmentDisplay: 'popup'
202
+ }
203
+ },
204
+ cart: {
205
+ layout: {
206
+ checkoutButtonText: 'Checkout Now'
207
+ }
208
+ }
209
+ }
210
+ });
211
+ ```
212
+
213
+ ## See Also
214
+
215
+ - [Configuration Reference](../api/configuration.md)
216
+ - [Component Guides](../guides/)