@app-brew/brewery 1.0.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.
Files changed (1422) hide show
  1. package/package.json +99 -0
  2. package/src/analytics/src/analytics-provider-v2.ts +288 -0
  3. package/src/analytics/src/analytics-provider-v2.web.ts +36 -0
  4. package/src/analytics/src/analytics-provider.ts +266 -0
  5. package/src/analytics/src/analytics-provider.web.ts +48 -0
  6. package/src/analytics/src/analytics-tracker-v2.ts +96 -0
  7. package/src/analytics/src/anaylytics-tracker.ts +96 -0
  8. package/src/analytics/src/index.ts +6 -0
  9. package/src/analytics/src/user-permission.ts +1 -0
  10. package/src/analytics/src/utils.ts +162 -0
  11. package/src/app-update/src/index.ts +1 -0
  12. package/src/app-update/src/lib/app-update.ts +45 -0
  13. package/src/block-registry/src/common.tsx +439 -0
  14. package/src/block-registry/src/common.web.tsx +46 -0
  15. package/src/block-registry/src/index.ts +1 -0
  16. package/src/block-registry/src/keys.ts +43 -0
  17. package/src/block-registry/src/register.tsx +66 -0
  18. package/src/block-registry/src/register.web.tsx +129 -0
  19. package/src/bottom-sheet/src/block-bottom-sheet.tsx +183 -0
  20. package/src/bottom-sheet/src/block-bottom-sheet.web.tsx +4 -0
  21. package/src/bottom-sheet/src/bottom-sheet.tsx +269 -0
  22. package/src/bottom-sheet/src/bottom-sheet.web.tsx +13 -0
  23. package/src/bottom-sheet/src/index.ts +3 -0
  24. package/src/brewery/babel.config.js +3 -0
  25. package/src/brewery/src/ModalBrewery.tsx +222 -0
  26. package/src/brewery/src/ScreenBrewery.tsx +415 -0
  27. package/src/brewery/src/ScreenContainer.tsx +76 -0
  28. package/src/brewery/src/ScreenContextProvider.tsx +27 -0
  29. package/src/brewery/src/app-init.tsx +507 -0
  30. package/src/brewery/src/common.ts +5 -0
  31. package/src/brewery/src/default-content.tsx +234 -0
  32. package/src/brewery/src/index.ts +8 -0
  33. package/src/brewery/src/lazy-screen.tsx +101 -0
  34. package/src/brewery/src/onboarding-screen.tsx +31 -0
  35. package/src/brewery/src/plp-content.tsx +19 -0
  36. package/src/brewery/src/preview-footer.tsx +83 -0
  37. package/src/brewery/src/profile-screen.tsx +74 -0
  38. package/src/brewery/src/refreshing-screen.tsx +129 -0
  39. package/src/brewery/src/safe-area-container.tsx +1 -0
  40. package/src/brewery/src/screen-content.tsx +89 -0
  41. package/src/brewery/src/secondary-splash-screen.tsx +190 -0
  42. package/src/brewery/src/shell.tsx +509 -0
  43. package/src/brewery/src/tab-bar.tsx +252 -0
  44. package/src/brewery/src/tabbed-brewery.tsx +175 -0
  45. package/src/brewery/src/templates.ts +87 -0
  46. package/src/brewery/src/types.ts +123 -0
  47. package/src/brewery/src/utils/bottombar.tsx +266 -0
  48. package/src/brewery/src/utils/colorUtils.ts +71 -0
  49. package/src/brewery/src/utils/createBottombarVisibility.ts +48 -0
  50. package/src/brewery/src/utils/index.tsx +3 -0
  51. package/src/brewery/src/utils/renderItem.tsx +112 -0
  52. package/src/brewery/src/utils/screens.tsx +270 -0
  53. package/src/brewery/src/utils/tabReload.ts +57 -0
  54. package/src/brewery/test-setup.ts +1 -0
  55. package/src/child-navigator/babel.config.js +3 -0
  56. package/src/child-navigator/src/index.tsx +52 -0
  57. package/src/child-navigator/src/view.tsx +197 -0
  58. package/src/components/babel.config.js +3 -0
  59. package/src/components/src/atoms/badge/index.tsx +85 -0
  60. package/src/components/src/atoms/block-section/index.ts +6 -0
  61. package/src/components/src/atoms/button/index.tsx +112 -0
  62. package/src/components/src/atoms/check-box/index.tsx +57 -0
  63. package/src/components/src/atoms/countdown-timer/index.tsx +48 -0
  64. package/src/components/src/atoms/country-selector/constants.ts +3 -0
  65. package/src/components/src/atoms/country-selector/index.tsx +146 -0
  66. package/src/components/src/atoms/date-picker/calendar-date-picker.tsx +509 -0
  67. package/src/components/src/atoms/date-picker/index.tsx +93 -0
  68. package/src/components/src/atoms/flex/index.tsx +24 -0
  69. package/src/components/src/atoms/header/index.ts +2 -0
  70. package/src/components/src/atoms/header/types.ts +1 -0
  71. package/src/components/src/atoms/icon/index.tsx +31 -0
  72. package/src/components/src/atoms/icon-button/index.tsx +29 -0
  73. package/src/components/src/atoms/image/image1.tsx +8 -0
  74. package/src/components/src/atoms/image/image1.web.tsx +5 -0
  75. package/src/components/src/atoms/image/index.ts +1 -0
  76. package/src/components/src/atoms/image/types.ts +12 -0
  77. package/src/components/src/atoms/input/index.tsx +34 -0
  78. package/src/components/src/atoms/link/index.tsx +60 -0
  79. package/src/components/src/atoms/password-input/index.tsx +89 -0
  80. package/src/components/src/atoms/product-card-button/index.tsx +203 -0
  81. package/src/components/src/atoms/radio-group-input/index.tsx +84 -0
  82. package/src/components/src/atoms/rating-input/index.tsx +47 -0
  83. package/src/components/src/atoms/safe-area-container.tsx +29 -0
  84. package/src/components/src/atoms/section/index.ts +1 -0
  85. package/src/components/src/atoms/section/section.tsx +76 -0
  86. package/src/components/src/atoms/select/index.tsx +100 -0
  87. package/src/components/src/atoms/spacer/index.tsx +26 -0
  88. package/src/components/src/atoms/stars/index.tsx +124 -0
  89. package/src/components/src/atoms/stars/star-filled.png +0 -0
  90. package/src/components/src/atoms/stars/star-unfilled.png +0 -0
  91. package/src/components/src/atoms/text/index.tsx +1 -0
  92. package/src/components/src/atoms/video/index.tsx +242 -0
  93. package/src/components/src/atoms/video/index.web.tsx +144 -0
  94. package/src/components/src/blocks/base-blocks/base-rich-text/index.tsx +49 -0
  95. package/src/components/src/blocks/bundle-list-block/index.tsx +21 -0
  96. package/src/components/src/blocks/divider-block/index.tsx +22 -0
  97. package/src/components/src/blocks/dummy/index.tsx +3 -0
  98. package/src/components/src/blocks/manage-address-form-block/index.tsx +172 -0
  99. package/src/components/src/blocks/otp-signin/hooks.tsx +180 -0
  100. package/src/components/src/blocks/otp-signin/index.tsx +139 -0
  101. package/src/components/src/blocks/otp-verification/hooks.tsx +304 -0
  102. package/src/components/src/blocks/otp-verification/index.tsx +212 -0
  103. package/src/components/src/blocks/prefetch-metafields/index.tsx +16 -0
  104. package/src/components/src/blocks/product-card-block/index.tsx +53 -0
  105. package/src/components/src/blocks/product-card-block-v2/index.tsx +71 -0
  106. package/src/components/src/blocks/product-card-block-v2/index.web.tsx +76 -0
  107. package/src/components/src/blocks/product-recommendations-block/index.tsx +152 -0
  108. package/src/components/src/blocks/product-recommendations-block/index.web.tsx +175 -0
  109. package/src/components/src/blocks/rich-text-block/index.tsx +1 -0
  110. package/src/components/src/blocks/rich-text-block/rich-text.tsx +117 -0
  111. package/src/components/src/blocks/rich-text-block/rich-text.web.tsx +91 -0
  112. package/src/components/src/blocks/social-signin/index.tsx +46 -0
  113. package/src/components/src/blocks/status-bar-block/index.tsx +28 -0
  114. package/src/components/src/blocks/variant-selector-2-block/index.tsx +58 -0
  115. package/src/components/src/blocks/variant-selector-3-block/index.tsx +44 -0
  116. package/src/components/src/declaration.d.ts +4 -0
  117. package/src/components/src/hocs/withMetafield.tsx +109 -0
  118. package/src/components/src/index.ts +13 -0
  119. package/src/components/src/molecules/accordion/index.tsx +8 -0
  120. package/src/components/src/molecules/add-to-cart/index.tsx +471 -0
  121. package/src/components/src/molecules/address/addressCard.tsx +171 -0
  122. package/src/components/src/molecules/address-form/index.tsx +270 -0
  123. package/src/components/src/molecules/announcement-strip/icon.tsx +47 -0
  124. package/src/components/src/molecules/announcement-strip/index.tsx +51 -0
  125. package/src/components/src/molecules/app-bar/buttons/back.tsx +59 -0
  126. package/src/components/src/molecules/app-bar/buttons/cart.tsx +63 -0
  127. package/src/components/src/molecules/app-bar/buttons/index.ts +6 -0
  128. package/src/components/src/molecules/app-bar/buttons/logo.tsx +46 -0
  129. package/src/components/src/molecules/app-bar/buttons/logo.web.tsx +42 -0
  130. package/src/components/src/molecules/app-bar/buttons/profile.tsx +25 -0
  131. package/src/components/src/molecules/app-bar/buttons/search.tsx +23 -0
  132. package/src/components/src/molecules/app-bar/buttons/wishlist.tsx +27 -0
  133. package/src/components/src/molecules/app-bar/expanded-search.tsx +28 -0
  134. package/src/components/src/molecules/app-bar/index.tsx +308 -0
  135. package/src/components/src/molecules/app-bar/index.web.tsx +284 -0
  136. package/src/components/src/molecules/appbar-layout-elements.tsx +71 -0
  137. package/src/components/src/molecules/appbar-template/back.tsx +20 -0
  138. package/src/components/src/molecules/appbar-template/cart.tsx +39 -0
  139. package/src/components/src/molecules/appbar-template/default.tsx +52 -0
  140. package/src/components/src/molecules/appbar-template/index.tsx +93 -0
  141. package/src/components/src/molecules/appbar-template/minimal.tsx +27 -0
  142. package/src/components/src/molecules/appbar-template/tabs.tsx +41 -0
  143. package/src/components/src/molecules/appbar-template/wishlist.tsx +42 -0
  144. package/src/components/src/molecules/appbar-v2/appbar-v2.tsx +497 -0
  145. package/src/components/src/molecules/appbar-v2/appbar-v2.web.tsx +512 -0
  146. package/src/components/src/molecules/appbar-v2/appbar-variants/back.ts +42 -0
  147. package/src/components/src/molecules/appbar-v2/appbar-variants/cart.ts +183 -0
  148. package/src/components/src/molecules/appbar-v2/appbar-variants/default.ts +189 -0
  149. package/src/components/src/molecules/appbar-v2/appbar-variants/minimal.ts +52 -0
  150. package/src/components/src/molecules/appbar-v2/appbar-variants/tabs.ts +170 -0
  151. package/src/components/src/molecules/appbar-v2/appbar-variants/wishlist.ts +180 -0
  152. package/src/components/src/molecules/appbar-v2/appbar-variants.ts +15 -0
  153. package/src/components/src/molecules/appbar-v2/index.ts +2 -0
  154. package/src/components/src/molecules/avatar/index.tsx +43 -0
  155. package/src/components/src/molecules/base-accordion-list/index.tsx +56 -0
  156. package/src/components/src/molecules/bottom-bar/bottom-bar.tsx +11 -0
  157. package/src/components/src/molecules/bottom-bar/bottom-bar.web.tsx +111 -0
  158. package/src/components/src/molecules/bottom-bar/index.tsx +1 -0
  159. package/src/components/src/molecules/bundle-list-item/index.tsx +200 -0
  160. package/src/components/src/molecules/carousel/carousel-item.tsx +206 -0
  161. package/src/components/src/molecules/carousel/eye-close.tsx +19 -0
  162. package/src/components/src/molecules/carousel/horizontal-carousel.tsx +418 -0
  163. package/src/components/src/molecules/carousel/index.tsx +85 -0
  164. package/src/components/src/molecules/carousel/index.web.tsx +111 -0
  165. package/src/components/src/molecules/carousel/indicator.tsx +133 -0
  166. package/src/components/src/molecules/carousel/indicator.web.tsx +77 -0
  167. package/src/components/src/molecules/carousel/rich-subtitle.tsx +27 -0
  168. package/src/components/src/molecules/carousel/rich-subtitle.web.tsx +31 -0
  169. package/src/components/src/molecules/carousel/types.ts +41 -0
  170. package/src/components/src/molecules/carousel/utils.ts +116 -0
  171. package/src/components/src/molecules/carousel/v2.tsx +46 -0
  172. package/src/components/src/molecules/carousel/vertical-carousel.tsx +275 -0
  173. package/src/components/src/molecules/cart-goals/components/amount-saved.tsx +82 -0
  174. package/src/components/src/molecules/cart-goals/components/goal-achieved/label.tsx +56 -0
  175. package/src/components/src/molecules/cart-goals/components/header.tsx +106 -0
  176. package/src/components/src/molecules/cart-goals/components/ineligible-text.tsx +61 -0
  177. package/src/components/src/molecules/cart-goals/components/multi-tier-layout/index.tsx +27 -0
  178. package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-1.tsx +50 -0
  179. package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-10.tsx +53 -0
  180. package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-2.tsx +43 -0
  181. package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-3.tsx +44 -0
  182. package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-4.tsx +53 -0
  183. package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-7.tsx +44 -0
  184. package/src/components/src/molecules/cart-goals/components/multi-tier-layout/types.ts +13 -0
  185. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/CircleWithProgress.tsx +94 -0
  186. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/constants.ts +6 -0
  187. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/index.tsx +28 -0
  188. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-1.tsx +183 -0
  189. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-10.tsx +242 -0
  190. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-2.tsx +160 -0
  191. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-3.tsx +113 -0
  192. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-4-utils.ts +39 -0
  193. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-4.tsx +216 -0
  194. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-7.tsx +113 -0
  195. package/src/components/src/molecules/cart-goals/components/multi-tier-progress/types.ts +18 -0
  196. package/src/components/src/molecules/cart-goals/components/single-tier-progress.tsx +210 -0
  197. package/src/components/src/molecules/cart-goals/components/success-modal/index.tsx +117 -0
  198. package/src/components/src/molecules/cart-goals/haptics.ts +40 -0
  199. package/src/components/src/molecules/cart-goals/index.tsx +2 -0
  200. package/src/components/src/molecules/cart-goals/multi-tier-utils.ts +139 -0
  201. package/src/components/src/molecules/cart-goals/multi-tier.tsx +466 -0
  202. package/src/components/src/molecules/cart-goals/single-tier-utils.ts +45 -0
  203. package/src/components/src/molecules/cart-goals/single-tier.tsx +521 -0
  204. package/src/components/src/molecules/cart-goals/types.ts +105 -0
  205. package/src/components/src/molecules/cart-goals/use-goal-success-modal.tsx +103 -0
  206. package/src/components/src/molecules/cart-goals/use-tier-change.ts +42 -0
  207. package/src/components/src/molecules/cart-goals/utils.ts +153 -0
  208. package/src/components/src/molecules/checkout-bar/index.tsx +155 -0
  209. package/src/components/src/molecules/checkout-bar-v2/cart-custom-attributes-interceptor.tsx +130 -0
  210. package/src/components/src/molecules/checkout-bar-v2/circle.tsx +63 -0
  211. package/src/components/src/molecules/checkout-bar-v2/goals.tsx +391 -0
  212. package/src/components/src/molecules/checkout-bar-v2/goals.web.tsx +374 -0
  213. package/src/components/src/molecules/checkout-bar-v2/index.tsx +267 -0
  214. package/src/components/src/molecules/checkout-bar-v2/index.web.tsx +115 -0
  215. package/src/components/src/molecules/checkout-bar-v2/interceptor.tsx +73 -0
  216. package/src/components/src/molecules/checkout-bar-v2/out-of-stock-modal/index.tsx +216 -0
  217. package/src/components/src/molecules/checkout-bar-v2/out-of-stock-modal/item.tsx +94 -0
  218. package/src/components/src/molecules/checkout-bar-v2/out-of-stock-modal/styles.ts +136 -0
  219. package/src/components/src/molecules/chips-navigation/chip.tsx +83 -0
  220. package/src/components/src/molecules/chips-navigation/horizontal.tsx +140 -0
  221. package/src/components/src/molecules/chips-navigation/horizontal.web.tsx +145 -0
  222. package/src/components/src/molecules/chips-navigation/index.tsx +13 -0
  223. package/src/components/src/molecules/chips-navigation/index.web.ts +13 -0
  224. package/src/components/src/molecules/chips-navigation/utils.ts +35 -0
  225. package/src/components/src/molecules/chips-navigation/vertical.tsx +108 -0
  226. package/src/components/src/molecules/choice-sheet-content/index.tsx +111 -0
  227. package/src/components/src/molecules/confirmation-popup/index.tsx +51 -0
  228. package/src/components/src/molecules/controlled-video/index.tsx +316 -0
  229. package/src/components/src/molecules/currency-selection-prompt/index.tsx +24 -0
  230. package/src/components/src/molecules/currency-selector/index.tsx +244 -0
  231. package/src/components/src/molecules/currency-selector/layout-element.tsx +24 -0
  232. package/src/components/src/molecules/direct-navigation/index.tsx +48 -0
  233. package/src/components/src/molecules/discount-label/index.tsx +55 -0
  234. package/src/components/src/molecules/divider/index.tsx +23 -0
  235. package/src/components/src/molecules/dropdown-picker/index.tsx +217 -0
  236. package/src/components/src/molecules/empty-screen-v2/index.tsx +83 -0
  237. package/src/components/src/molecules/fallback/index.tsx +70 -0
  238. package/src/components/src/molecules/filter/color-filter.tsx +173 -0
  239. package/src/components/src/molecules/filter/index.tsx +244 -0
  240. package/src/components/src/molecules/filter/index.web.tsx +111 -0
  241. package/src/components/src/molecules/filter/selectors.tsx +623 -0
  242. package/src/components/src/molecules/form-input/index.tsx +451 -0
  243. package/src/components/src/molecules/full-screen-loading/index.tsx +20 -0
  244. package/src/components/src/molecules/generic-form/common.tsx +298 -0
  245. package/src/components/src/molecules/generic-form/index.tsx +131 -0
  246. package/src/components/src/molecules/generic-form/types.tsx +30 -0
  247. package/src/components/src/molecules/generic-product-card/card.tsx +5 -0
  248. package/src/components/src/molecules/generic-product-card/card.web.tsx +1 -0
  249. package/src/components/src/molecules/generic-product-card/cardV2.tsx +342 -0
  250. package/src/components/src/molecules/generic-product-card/common.tsx +590 -0
  251. package/src/components/src/molecules/generic-product-card/index.tsx +2 -0
  252. package/src/components/src/molecules/generic-product-card/tags.tsx +178 -0
  253. package/src/components/src/molecules/generic-product-card/types.tsx +219 -0
  254. package/src/components/src/molecules/generic-product-card/wrapper.tsx +39 -0
  255. package/src/components/src/molecules/gift-item-card/index.tsx +44 -0
  256. package/src/components/src/molecules/gift-item-selected-card/index.tsx +28 -0
  257. package/src/components/src/molecules/hidden-block/index.tsx +8 -0
  258. package/src/components/src/molecules/hidden-block/index.web.tsx +81 -0
  259. package/src/components/src/molecules/image-compare/index.tsx +236 -0
  260. package/src/components/src/molecules/image-compare/index.web.tsx +213 -0
  261. package/src/components/src/molecules/image-navigation/index.tsx +32 -0
  262. package/src/components/src/molecules/image-preview/image-preview.tsx +295 -0
  263. package/src/components/src/molecules/image-preview/image-preview.web.tsx +157 -0
  264. package/src/components/src/molecules/image-preview-2/close-icon-button.tsx +11 -0
  265. package/src/components/src/molecules/image-preview-2/constants.ts +2 -0
  266. package/src/components/src/molecules/image-preview-2/footer-item.tsx +52 -0
  267. package/src/components/src/molecules/image-preview-2/footer.tsx +58 -0
  268. package/src/components/src/molecules/image-preview-2/index.tsx +139 -0
  269. package/src/components/src/molecules/image-preview-2/types.ts +72 -0
  270. package/src/components/src/molecules/image-text/index.tsx +139 -0
  271. package/src/components/src/molecules/line-item/index.tsx +45 -0
  272. package/src/components/src/molecules/list-item/index.tsx +758 -0
  273. package/src/components/src/molecules/loader/index.tsx +40 -0
  274. package/src/components/src/molecules/menu/accordion/image-menu-accordion-list.tsx +114 -0
  275. package/src/components/src/molecules/menu/accordion/text-menu-accordion-list.tsx +111 -0
  276. package/src/components/src/molecules/menu/common/horizontal-menu-list.tsx +279 -0
  277. package/src/components/src/molecules/menu/common/menu-accordion.tsx +69 -0
  278. package/src/components/src/molecules/menu/common/menu-grid.tsx +179 -0
  279. package/src/components/src/molecules/menu/common/vertical-menu-list.tsx +197 -0
  280. package/src/components/src/molecules/menu/common/vertical-menu-list.web.tsx +196 -0
  281. package/src/components/src/molecules/menu/expandable-grid/image-menu-expandable-grid.tsx +128 -0
  282. package/src/components/src/molecules/menu/expandable-grid/text-menu-expandable-grid.tsx +107 -0
  283. package/src/components/src/molecules/menu/grid/image-menu-grid.tsx +58 -0
  284. package/src/components/src/molecules/menu/grid/text-menu-grid.tsx +55 -0
  285. package/src/components/src/molecules/menu/index.tsx +38 -0
  286. package/src/components/src/molecules/menu/item/image-menu-item.tsx +226 -0
  287. package/src/components/src/molecules/menu/item/text-menu-item.tsx +174 -0
  288. package/src/components/src/molecules/menu/list/horizontal-image-menu-list.tsx +55 -0
  289. package/src/components/src/molecules/menu/list/horizontal-text-menu-list.tsx +53 -0
  290. package/src/components/src/molecules/menu/list/image-menu-list.tsx +38 -0
  291. package/src/components/src/molecules/menu/list/text-menu-list.tsx +38 -0
  292. package/src/components/src/molecules/menu/list/vertical-image-menu-list.tsx +58 -0
  293. package/src/components/src/molecules/menu/list/vertical-text-menu-list.tsx +52 -0
  294. package/src/components/src/molecules/menu/sub-menu-item.tsx +50 -0
  295. package/src/components/src/molecules/menu/tabs/horizontal-image-menu-tabs.tsx +211 -0
  296. package/src/components/src/molecules/menu/tabs/horizontal-text-menu-tabs.tsx +211 -0
  297. package/src/components/src/molecules/menu/tabs/image-menu-tabs.tsx +52 -0
  298. package/src/components/src/molecules/menu/tabs/text-menu-tabs.tsx +49 -0
  299. package/src/components/src/molecules/menu/tabs/vertical-image-menu-tabs.tsx +224 -0
  300. package/src/components/src/molecules/menu/tabs/vertical-text-menu-tabs.tsx +222 -0
  301. package/src/components/src/molecules/menu/types.ts +580 -0
  302. package/src/components/src/molecules/menu/utils.ts +229 -0
  303. package/src/components/src/molecules/metafield-tag/index.tsx +36 -0
  304. package/src/components/src/molecules/metafield-tag/index.web.tsx +3 -0
  305. package/src/components/src/molecules/metafield-text/index.tsx +47 -0
  306. package/src/components/src/molecules/no-internet-block/index.tsx +43 -0
  307. package/src/components/src/molecules/only-text-navigation.tsx/index.tsx +79 -0
  308. package/src/components/src/molecules/order-item/index.tsx +108 -0
  309. package/src/components/src/molecules/payment-bar/index.tsx +139 -0
  310. package/src/components/src/molecules/pdp-quantity-selector/index.tsx +44 -0
  311. package/src/components/src/molecules/phone-country-input/index.tsx +153 -0
  312. package/src/components/src/molecules/phone-input/index.tsx +287 -0
  313. package/src/components/src/molecules/phone-input/index.web.tsx +21 -0
  314. package/src/components/src/molecules/price-box/index.tsx +54 -0
  315. package/src/components/src/molecules/price-text/index.tsx +40 -0
  316. package/src/components/src/molecules/product-card/index.tsx +162 -0
  317. package/src/components/src/molecules/product-card/wishlist/index.tsx +35 -0
  318. package/src/components/src/molecules/product-card-with-carousel/index.tsx +139 -0
  319. package/src/components/src/molecules/product-collection/GotoLinkButton.tsx +59 -0
  320. package/src/components/src/molecules/product-collection/GotoLinkButton.web.tsx +65 -0
  321. package/src/components/src/molecules/product-collection/index.tsx +458 -0
  322. package/src/components/src/molecules/product-collection/wrapper.tsx +224 -0
  323. package/src/components/src/molecules/product-components/add-to-bundle.tsx +19 -0
  324. package/src/components/src/molecules/product-components/add-to-cart.tsx +708 -0
  325. package/src/components/src/molecules/product-components/add-to-cart.web.tsx +398 -0
  326. package/src/components/src/molecules/product-components/add-to-wishlist-v2.tsx +43 -0
  327. package/src/components/src/molecules/product-components/add-to-wishlist.tsx +42 -0
  328. package/src/components/src/molecules/product-components/avg-ratings.tsx +56 -0
  329. package/src/components/src/molecules/product-components/carousel.tsx +85 -0
  330. package/src/components/src/molecules/product-components/color-swatch.tsx +81 -0
  331. package/src/components/src/molecules/product-components/compare-at-price.tsx +52 -0
  332. package/src/components/src/molecules/product-components/delete-from-wishlist.tsx +39 -0
  333. package/src/components/src/molecules/product-components/discount-label.tsx +109 -0
  334. package/src/components/src/molecules/product-components/goto-button-v2.tsx +42 -0
  335. package/src/components/src/molecules/product-components/hooks/carousel.ts +160 -0
  336. package/src/components/src/molecules/product-components/image.tsx +132 -0
  337. package/src/components/src/molecules/product-components/in-stock.tsx +86 -0
  338. package/src/components/src/molecules/product-components/index.tsx +25 -0
  339. package/src/components/src/molecules/product-components/metafield-rich-text.tsx +61 -0
  340. package/src/components/src/molecules/product-components/metafield-shopify-richtext.tsx +54 -0
  341. package/src/components/src/molecules/product-components/metafield-text.tsx +48 -0
  342. package/src/components/src/molecules/product-components/min-variant-price.tsx +48 -0
  343. package/src/components/src/molecules/product-components/move-to-cart.tsx +35 -0
  344. package/src/components/src/molecules/product-components/notify-me.tsx +93 -0
  345. package/src/components/src/molecules/product-components/open-modal.tsx +35 -0
  346. package/src/components/src/molecules/product-components/overlay.tsx +25 -0
  347. package/src/components/src/molecules/product-components/price.tsx +64 -0
  348. package/src/components/src/molecules/product-components/product-tag-v2.tsx +108 -0
  349. package/src/components/src/molecules/product-components/product-tag.tsx +56 -0
  350. package/src/components/src/molecules/product-components/product-type.tsx +32 -0
  351. package/src/components/src/molecules/product-components/product-variant-options.tsx +69 -0
  352. package/src/components/src/molecules/product-components/product-variant-selector-3.tsx +67 -0
  353. package/src/components/src/molecules/product-components/product-vendor.tsx +36 -0
  354. package/src/components/src/molecules/product-components/quantity-selector.tsx +307 -0
  355. package/src/components/src/molecules/product-components/quantity-selector.web.tsx +332 -0
  356. package/src/components/src/molecules/product-components/ratings-count.tsx +57 -0
  357. package/src/components/src/molecules/product-components/scarcity-counter.tsx +159 -0
  358. package/src/components/src/molecules/product-components/selling-plan-compare-at-price.tsx +43 -0
  359. package/src/components/src/molecules/product-components/selling-plan-discount.tsx +42 -0
  360. package/src/components/src/molecules/product-components/selling-plan-price.tsx +44 -0
  361. package/src/components/src/molecules/product-components/share-icon.tsx +49 -0
  362. package/src/components/src/molecules/product-components/spacer.tsx +18 -0
  363. package/src/components/src/molecules/product-components/star-ratings.tsx +48 -0
  364. package/src/components/src/molecules/product-components/text-tag.tsx +36 -0
  365. package/src/components/src/molecules/product-components/title.tsx +34 -0
  366. package/src/components/src/molecules/product-components/title.web.tsx +34 -0
  367. package/src/components/src/molecules/product-components/types.tsx +7 -0
  368. package/src/components/src/molecules/product-components/upsell-product-price.tsx +82 -0
  369. package/src/components/src/molecules/product-components/utils/add-to-cart.ts +108 -0
  370. package/src/components/src/molecules/product-components/utils/selected-selling-plan.ts +32 -0
  371. package/src/components/src/molecules/product-components/utils/selling-plan-compare-at-price.ts +36 -0
  372. package/src/components/src/molecules/product-components/utils/selling-plan-discount.ts +64 -0
  373. package/src/components/src/molecules/product-components/utils/selling-plan-price.ts +36 -0
  374. package/src/components/src/molecules/product-components/variant-selector.tsx +88 -0
  375. package/src/components/src/molecules/product-components/variant-sku.tsx +35 -0
  376. package/src/components/src/molecules/product-description-with-tags/index.tsx +56 -0
  377. package/src/components/src/molecules/product-group/index.tsx +64 -0
  378. package/src/components/src/molecules/product-group/product-group-list.tsx +64 -0
  379. package/src/components/src/molecules/product-image/index.tsx +143 -0
  380. package/src/components/src/molecules/product-tag/index.tsx +33 -0
  381. package/src/components/src/molecules/product-title/index.tsx +28 -0
  382. package/src/components/src/molecules/product-vendor/index.tsx +18 -0
  383. package/src/components/src/molecules/product-video/index.tsx +80 -0
  384. package/src/components/src/molecules/profile/index.tsx +0 -0
  385. package/src/components/src/molecules/quantity-selector/index.tsx +596 -0
  386. package/src/components/src/molecules/review-label/index.tsx +33 -0
  387. package/src/components/src/molecules/rich-text/index.tsx +1 -0
  388. package/src/components/src/molecules/rich-text/rich-text.tsx +1 -0
  389. package/src/components/src/molecules/rich-text/rich-text.web.tsx +1 -0
  390. package/src/components/src/molecules/search-input/index.tsx +248 -0
  391. package/src/components/src/molecules/sheet-header/index.tsx +55 -0
  392. package/src/components/src/molecules/shipping-address-label/index.tsx +67 -0
  393. package/src/components/src/molecules/simple-image-text/index.tsx +85 -0
  394. package/src/components/src/molecules/single-product-card/index.tsx +27 -0
  395. package/src/components/src/molecules/size-guide/index.tsx +187 -0
  396. package/src/components/src/molecules/skeleton/index.tsx +47 -0
  397. package/src/components/src/molecules/skeleton/index.web.tsx +18 -0
  398. package/src/components/src/molecules/skeleton/product-card.tsx +52 -0
  399. package/src/components/src/molecules/social-sign-in/apple-signin.tsx +88 -0
  400. package/src/components/src/molecules/social-sign-in/apple-signin.web.ts +4 -0
  401. package/src/components/src/molecules/social-sign-in/google-signin.tsx +105 -0
  402. package/src/components/src/molecules/social-sign-in/google-signin.web.ts +3 -0
  403. package/src/components/src/molecules/social-sign-in/social-auth.tsx +83 -0
  404. package/src/components/src/molecules/social-sign-in/social-signin-layout-item.tsx +54 -0
  405. package/src/components/src/molecules/social-sign-in/truecaller-signin.tsx +103 -0
  406. package/src/components/src/molecules/sub-navigations/index.tsx +169 -0
  407. package/src/components/src/molecules/subscription-v2/index.tsx +47 -0
  408. package/src/components/src/molecules/subscription-v2/subscription.tsx +356 -0
  409. package/src/components/src/molecules/subscription-v2/subscriptions-option-modal.tsx +78 -0
  410. package/src/components/src/molecules/switch/index.tsx +72 -0
  411. package/src/components/src/molecules/tab-selector/index.tsx +160 -0
  412. package/src/components/src/molecules/tab-view/index.tsx +2 -0
  413. package/src/components/src/molecules/tab-view/tab-item.tsx +67 -0
  414. package/src/components/src/molecules/tab-view/tab-pane.tsx +13 -0
  415. package/src/components/src/molecules/tab-view/tabs.tsx +64 -0
  416. package/src/components/src/molecules/text-carousel/index.tsx +111 -0
  417. package/src/components/src/molecules/text-label/index.tsx +36 -0
  418. package/src/components/src/molecules/toasts/add-to-cart-toast.tsx +48 -0
  419. package/src/components/src/molecules/toasts/brew-error-toast.tsx +49 -0
  420. package/src/components/src/molecules/toasts/brew-success-toast.tsx +55 -0
  421. package/src/components/src/molecules/toasts/index.tsx +3 -0
  422. package/src/components/src/molecules/trending-pillet/index.tsx +48 -0
  423. package/src/components/src/molecules/variant-item-selector/index.tsx +171 -0
  424. package/src/components/src/molecules/variant-selector-2/index.tsx +669 -0
  425. package/src/components/src/molecules/variant-selector-3/default-color-item.tsx +120 -0
  426. package/src/components/src/molecules/variant-selector-3/default-shopify-color.tsx +167 -0
  427. package/src/components/src/molecules/variant-selector-3/default-variant-image.tsx +82 -0
  428. package/src/components/src/molecules/variant-selector-3/index.tsx +114 -0
  429. package/src/components/src/molecules/variant-selector-3/option-items.tsx +171 -0
  430. package/src/components/src/molecules/variant-selector-3/option-list.tsx +86 -0
  431. package/src/components/src/molecules/variant-selector-3/option.tsx +42 -0
  432. package/src/components/src/molecules/variant-selector-3/utils.ts +131 -0
  433. package/src/components/src/molecules/variant-selector-3/variant-heading.tsx +162 -0
  434. package/src/components/src/molecules/variant-selector-3/variant-options.tsx +201 -0
  435. package/src/components/src/molecules/variant-selector-modal/index.tsx +127 -0
  436. package/src/components/src/molecules/variant-selector-type/index.tsx +235 -0
  437. package/src/components/src/molecules/video-carousel-item/index.tsx +183 -0
  438. package/src/components/src/molecules/video-carousel-item/product-list.tsx +258 -0
  439. package/src/components/src/molecules/video-carousel-item/product-list.web.tsx +197 -0
  440. package/src/components/src/molecules/way-to-reward-card/index.tsx +236 -0
  441. package/src/components/src/molecules/way-to-reward-card/index.web.tsx +188 -0
  442. package/src/components/src/molecules/web-view-auto-height/index.tsx +28 -0
  443. package/src/components/src/molecules/wishlist/add-to-wishlist-v2.tsx +144 -0
  444. package/src/components/src/molecules/wishlist/add-to-wishlist.tsx +136 -0
  445. package/src/components/src/molecules/wishlist/index.ts +1 -0
  446. package/src/components/src/molecules/wishlist/move-to-cart.tsx +57 -0
  447. package/src/components/src/molecules/wishlist/remove-from-wishlist.tsx +40 -0
  448. package/src/components/src/molecules/youtube-video/index.tsx +54 -0
  449. package/src/components/src/molecules/youtube-video/index.web.tsx +44 -0
  450. package/src/components/src/organisms/a1-accordion/index.tsx +93 -0
  451. package/src/components/src/organisms/a1-accordion/index.web.tsx +82 -0
  452. package/src/components/src/organisms/a1-accordion-image/index.tsx +97 -0
  453. package/src/components/src/organisms/a1-collection-image-banner/index.tsx +84 -0
  454. package/src/components/src/organisms/a1-collection-image-banner/index.web.tsx +23 -0
  455. package/src/components/src/organisms/a1-generic-metafield-accordion/index.tsx +90 -0
  456. package/src/components/src/organisms/a1-generic-metafield-accordion/index.web.tsx +10 -0
  457. package/src/components/src/organisms/a1-image-banner/index.tsx +86 -0
  458. package/src/components/src/organisms/a1-image-list/index.tsx +99 -0
  459. package/src/components/src/organisms/a1-product-description-html/index.tsx +137 -0
  460. package/src/components/src/organisms/a1-product-description-html/index.web.tsx +90 -0
  461. package/src/components/src/organisms/a1-product-grid/index.tsx +60 -0
  462. package/src/components/src/organisms/a1-product-list/index.tsx +92 -0
  463. package/src/components/src/organisms/accordion-image/index.tsx +68 -0
  464. package/src/components/src/organisms/add-address/index.tsx +62 -0
  465. package/src/components/src/organisms/add-review/index.tsx +190 -0
  466. package/src/components/src/organisms/add-to-bundle/index.tsx +44 -0
  467. package/src/components/src/organisms/add-to-cart-bar/add-to-card-bar.tsx +115 -0
  468. package/src/components/src/organisms/add-to-cart-bar/index.tsx +1 -0
  469. package/src/components/src/organisms/add-to-cart-bar/v2.tsx +205 -0
  470. package/src/components/src/organisms/add-to-cart-bar/wrapper.tsx +44 -0
  471. package/src/components/src/organisms/add-to-wishlist-bar/index.tsx +96 -0
  472. package/src/components/src/organisms/address-form/index.tsx +511 -0
  473. package/src/components/src/organisms/address-form-input-field/index.tsx +375 -0
  474. package/src/components/src/organisms/address-list/index.tsx +154 -0
  475. package/src/components/src/organisms/announcement-carousel/index.tsx +207 -0
  476. package/src/components/src/organisms/announcement-carousel/index.web.tsx +73 -0
  477. package/src/components/src/organisms/announcement-ticker/index.tsx +247 -0
  478. package/src/components/src/organisms/announcement-ticker/index.web.tsx +169 -0
  479. package/src/components/src/organisms/apply-coupon/index.tsx +395 -0
  480. package/src/components/src/organisms/apply-coupon-v2/applied-coupon-card.tsx +84 -0
  481. package/src/components/src/organisms/apply-coupon-v2/available-coupons.tsx +123 -0
  482. package/src/components/src/organisms/apply-coupon-v2/coupon-svg-bg.tsx +25 -0
  483. package/src/components/src/organisms/apply-coupon-v2/index.tsx +367 -0
  484. package/src/components/src/organisms/blog-list/blog-data.tsx +268 -0
  485. package/src/components/src/organisms/blog-list/blog-item.tsx +70 -0
  486. package/src/components/src/organisms/blog-list/empty-blog-list.tsx +42 -0
  487. package/src/components/src/organisms/blog-list/index.tsx +102 -0
  488. package/src/components/src/organisms/blog-list/index.web.tsx +92 -0
  489. package/src/components/src/organisms/brew-collection-image-banner/index.tsx +96 -0
  490. package/src/components/src/organisms/bundle-bar/index.tsx +128 -0
  491. package/src/components/src/organisms/bundle-filter-bar/index.tsx +114 -0
  492. package/src/components/src/organisms/bundle-items-modal/index.tsx +140 -0
  493. package/src/components/src/organisms/bundle-list/index.tsx +65 -0
  494. package/src/components/src/organisms/buy-now-bar/index.tsx +79 -0
  495. package/src/components/src/organisms/carousel-with-background-blur/carousel.tsx +393 -0
  496. package/src/components/src/organisms/carousel-with-background-blur/carousel.web.tsx +179 -0
  497. package/src/components/src/organisms/carousel-with-background-blur/index.tsx +90 -0
  498. package/src/components/src/organisms/carousel-with-background-blur/index.web.tsx +73 -0
  499. package/src/components/src/organisms/carousel-with-background-blur/indicator.tsx +144 -0
  500. package/src/components/src/organisms/cart-custom-attributes/index.tsx +103 -0
  501. package/src/components/src/organisms/cart-goal/index.tsx +116 -0
  502. package/src/components/src/organisms/cart-goals/index.tsx +2 -0
  503. package/src/components/src/organisms/cart-goals/milestones.tsx +233 -0
  504. package/src/components/src/organisms/cart-goals/progress-bar.tsx +214 -0
  505. package/src/components/src/organisms/cart-list/cart-item.tsx +0 -0
  506. package/src/components/src/organisms/cart-list/empty-cart.tsx +113 -0
  507. package/src/components/src/organisms/cart-list/index.tsx +271 -0
  508. package/src/components/src/organisms/cart-payment-web-view/index.tsx +213 -0
  509. package/src/components/src/organisms/categories-navigation/index.tsx +168 -0
  510. package/src/components/src/organisms/change-address/index.tsx +512 -0
  511. package/src/components/src/organisms/change-address-v2/index.tsx +223 -0
  512. package/src/components/src/organisms/change-password/index.tsx +231 -0
  513. package/src/components/src/organisms/chips-navigation/index.tsx +41 -0
  514. package/src/components/src/organisms/chips-navigation/index.web.tsx +69 -0
  515. package/src/components/src/organisms/chips-navigation-accordion/index.tsx +47 -0
  516. package/src/components/src/organisms/collection-list/index.tsx +74 -0
  517. package/src/components/src/organisms/collection-list-background/index.tsx +99 -0
  518. package/src/components/src/organisms/color-image/index.tsx +79 -0
  519. package/src/components/src/organisms/color-swatch-group/index.tsx +141 -0
  520. package/src/components/src/organisms/confirm-dialog/index.tsx +34 -0
  521. package/src/components/src/organisms/countdown-banner/common.tsx +263 -0
  522. package/src/components/src/organisms/countdown-banner/index.tsx +143 -0
  523. package/src/components/src/organisms/countdown-banner/index.web.tsx +176 -0
  524. package/src/components/src/organisms/countdown-banner/types.tsx +29 -0
  525. package/src/components/src/organisms/currency-selector/index.tsx +39 -0
  526. package/src/components/src/organisms/delete-account/index.tsx +93 -0
  527. package/src/components/src/organisms/delete-account-privacy/index.tsx +39 -0
  528. package/src/components/src/organisms/delivery-details/index.tsx +157 -0
  529. package/src/components/src/organisms/discount-code-input/index.tsx +152 -0
  530. package/src/components/src/organisms/divider-heading/index.tsx +51 -0
  531. package/src/components/src/organisms/edit-address/index.tsx +53 -0
  532. package/src/components/src/organisms/empty-screen/index.tsx +74 -0
  533. package/src/components/src/organisms/empty-screen-v2/index.tsx +26 -0
  534. package/src/components/src/organisms/empty-searches/index.tsx +96 -0
  535. package/src/components/src/organisms/estimated-delivery-date/dates-mapping.ts +23 -0
  536. package/src/components/src/organisms/estimated-delivery-date/index.tsx +141 -0
  537. package/src/components/src/organisms/faqs/defaults.ts +65 -0
  538. package/src/components/src/organisms/faqs/index.tsx +51 -0
  539. package/src/components/src/organisms/faqs/index.web.tsx +64 -0
  540. package/src/components/src/organisms/follow-us/index.tsx +58 -0
  541. package/src/components/src/organisms/forgot-password/index.tsx +228 -0
  542. package/src/components/src/organisms/free-engraving/index.tsx +180 -0
  543. package/src/components/src/organisms/gift-items-list/index.tsx +98 -0
  544. package/src/components/src/organisms/gift-wrap-list/custom-attributes-form.tsx +77 -0
  545. package/src/components/src/organisms/gift-wrap-list/gift-wrap-item.tsx +133 -0
  546. package/src/components/src/organisms/gift-wrap-list/index.tsx +72 -0
  547. package/src/components/src/organisms/goto-button/index.tsx +53 -0
  548. package/src/components/src/organisms/goto-button/index.web.tsx +46 -0
  549. package/src/components/src/organisms/goto-button-v2/index.tsx +58 -0
  550. package/src/components/src/organisms/horizontal-tabs-menu/defaults.ts +797 -0
  551. package/src/components/src/organisms/horizontal-tabs-menu/index.tsx +79 -0
  552. package/src/components/src/organisms/icon-list/index.tsx +150 -0
  553. package/src/components/src/organisms/image-banner/index.tsx +158 -0
  554. package/src/components/src/organisms/image-collage/constants.ts +8 -0
  555. package/src/components/src/organisms/image-collage/index.tsx +147 -0
  556. package/src/components/src/organisms/image-collage/variants.common.ts +415 -0
  557. package/src/components/src/organisms/image-collage/variants.ts +129 -0
  558. package/src/components/src/organisms/image-collage/variants.web.ts +119 -0
  559. package/src/components/src/organisms/image-compare-block/index.tsx +48 -0
  560. package/src/components/src/organisms/image-list/index.tsx +427 -0
  561. package/src/components/src/organisms/image-list/utils.tsx +8 -0
  562. package/src/components/src/organisms/image-list/utils.web.tsx +6 -0
  563. package/src/components/src/organisms/image-list-accordion/index.tsx +47 -0
  564. package/src/components/src/organisms/image-marquee/index.tsx +178 -0
  565. package/src/components/src/organisms/image-marquee/index.web.tsx +190 -0
  566. package/src/components/src/organisms/image-marquee/types.ts +14 -0
  567. package/src/components/src/organisms/image-preview/index.tsx +51 -0
  568. package/src/components/src/organisms/image-video-reel/carouse-item.tsx +348 -0
  569. package/src/components/src/organisms/image-video-reel/carouse-item.web.tsx +318 -0
  570. package/src/components/src/organisms/image-video-reel/index.tsx +359 -0
  571. package/src/components/src/organisms/image-video-reel/indicator.tsx +116 -0
  572. package/src/components/src/organisms/image-video-reel/indicator.web.tsx +80 -0
  573. package/src/components/src/organisms/image-video-reel/types.ts +103 -0
  574. package/src/components/src/organisms/infinite-product-grid/index.tsx +218 -0
  575. package/src/components/src/organisms/infinite-product-grid/index.web.tsx +105 -0
  576. package/src/components/src/organisms/infinite-product-grid-v2/index.tsx +163 -0
  577. package/src/components/src/organisms/judgeme-reviews/index.tsx +129 -0
  578. package/src/components/src/organisms/judgeme-reviews/utils.ts +77 -0
  579. package/src/components/src/organisms/last-order/index.tsx +40 -0
  580. package/src/components/src/organisms/metafield-image-compare-block/hook.tsx +119 -0
  581. package/src/components/src/organisms/metafield-image-compare-block/index.tsx +59 -0
  582. package/src/components/src/organisms/metafield-product-list/index.tsx +114 -0
  583. package/src/components/src/organisms/metafield-rich-text/index.tsx +101 -0
  584. package/src/components/src/organisms/metafield-rich-text/metafield-accordian.tsx +51 -0
  585. package/src/components/src/organisms/metafield-rich-text/metafield-accordian.web.tsx +55 -0
  586. package/src/components/src/organisms/metafield-size-chart-page/index.tsx +86 -0
  587. package/src/components/src/organisms/metafield-tag-block/index.tsx +28 -0
  588. package/src/components/src/organisms/metafield-text/index.tsx +87 -0
  589. package/src/components/src/organisms/metafields-product-group/index.tsx +89 -0
  590. package/src/components/src/organisms/more-menu/index.tsx +64 -0
  591. package/src/components/src/organisms/move-to-wishlist/index.tsx +79 -0
  592. package/src/components/src/organisms/multi-level-menu/index.tsx +54 -0
  593. package/src/components/src/organisms/opinew-reviews/index.tsx +102 -0
  594. package/src/components/src/organisms/opinew-reviews/utils.tsx +55 -0
  595. package/src/components/src/organisms/order-cancel/index.tsx +63 -0
  596. package/src/components/src/organisms/order-details-header/index.tsx +78 -0
  597. package/src/components/src/organisms/order-details-webview/index.tsx +47 -0
  598. package/src/components/src/organisms/order-list/index.tsx +458 -0
  599. package/src/components/src/organisms/order-payment-details/index.tsx +90 -0
  600. package/src/components/src/organisms/order-product-list/index.tsx +79 -0
  601. package/src/components/src/organisms/order-product-list-v2/index.tsx +158 -0
  602. package/src/components/src/organisms/otp-signup/index.tsx +186 -0
  603. package/src/components/src/organisms/past-searches/index.tsx +202 -0
  604. package/src/components/src/organisms/payment-confirmation/index.tsx +177 -0
  605. package/src/components/src/organisms/payment-details/index.tsx +264 -0
  606. package/src/components/src/organisms/payment-success/index.tsx +49 -0
  607. package/src/components/src/organisms/payment-web-view/index.tsx +285 -0
  608. package/src/components/src/organisms/payment-web-view-v4/index.tsx +600 -0
  609. package/src/components/src/organisms/pdp/index.tsx +168 -0
  610. package/src/components/src/organisms/pdp/index.web.tsx +60 -0
  611. package/src/components/src/organisms/pdp-description/index.tsx +104 -0
  612. package/src/components/src/organisms/pdp-description-native/index.tsx +63 -0
  613. package/src/components/src/organisms/pdp-description-native/index.web.tsx +11 -0
  614. package/src/components/src/organisms/pdp-metafield-video/index.tsx +153 -0
  615. package/src/components/src/organisms/popup-modal/index.tsx +129 -0
  616. package/src/components/src/organisms/previously-ordered-products/index.tsx +105 -0
  617. package/src/components/src/organisms/product-discount/common.tsx +123 -0
  618. package/src/components/src/organisms/product-discount/coupon-card.tsx +125 -0
  619. package/src/components/src/organisms/product-discount/defaults.ts +136 -0
  620. package/src/components/src/organisms/product-discount/empty-coupons.tsx +4 -0
  621. package/src/components/src/organisms/product-discount/empty-coupons.web.tsx +11 -0
  622. package/src/components/src/organisms/product-discount/index.tsx +228 -0
  623. package/src/components/src/organisms/product-discount/types.tsx +28 -0
  624. package/src/components/src/organisms/product-grid/index.tsx +86 -0
  625. package/src/components/src/organisms/product-hotspot/animated-circle.tsx +88 -0
  626. package/src/components/src/organisms/product-hotspot/animated-circle.web.tsx +55 -0
  627. package/src/components/src/organisms/product-hotspot/index.tsx +255 -0
  628. package/src/components/src/organisms/product-hotspot/item.tsx +124 -0
  629. package/src/components/src/organisms/product-hotspot/modal-body.tsx +50 -0
  630. package/src/components/src/organisms/product-hotspot/product-card.tsx +111 -0
  631. package/src/components/src/organisms/product-info/index.tsx +421 -0
  632. package/src/components/src/organisms/product-info/wrapper.tsx +15 -0
  633. package/src/components/src/organisms/product-info/wrapper.web.tsx +15 -0
  634. package/src/components/src/organisms/product-list/index.tsx +104 -0
  635. package/src/components/src/organisms/product-list/index.web.tsx +110 -0
  636. package/src/components/src/organisms/product-list/product-list.schema.ts +816 -0
  637. package/src/components/src/organisms/product-refresh/index.tsx +19 -0
  638. package/src/components/src/organisms/product-size-chart-v2/index.tsx +49 -0
  639. package/src/components/src/organisms/product-summary/index.tsx +1 -0
  640. package/src/components/src/organisms/product-summary/product-summary.tsx +253 -0
  641. package/src/components/src/organisms/product-summary/wrapper.tsx +36 -0
  642. package/src/components/src/organisms/profile/index.tsx +238 -0
  643. package/src/components/src/organisms/profile-2/index.tsx +254 -0
  644. package/src/components/src/organisms/profile-edit/constants.ts +74 -0
  645. package/src/components/src/organisms/profile-edit/index.tsx +802 -0
  646. package/src/components/src/organisms/profile-edit/styles.ts +371 -0
  647. package/src/components/src/organisms/profile-edit/types.ts +120 -0
  648. package/src/components/src/organisms/profile-edit/utils.ts +362 -0
  649. package/src/components/src/organisms/profile-menu/index.tsx +65 -0
  650. package/src/components/src/organisms/profile-signed-out/index.tsx +72 -0
  651. package/src/components/src/organisms/profile-signedout-v2/index.tsx +36 -0
  652. package/src/components/src/organisms/profile-signout/index.tsx +65 -0
  653. package/src/components/src/organisms/profile-user-greeting/index.tsx +113 -0
  654. package/src/components/src/organisms/promo-banner/PromoBanner.tsx +0 -0
  655. package/src/components/src/organisms/promo-banner/index.ts +0 -0
  656. package/src/components/src/organisms/promo-block/index.tsx +69 -0
  657. package/src/components/src/organisms/promo-carousel/index.tsx +101 -0
  658. package/src/components/src/organisms/promo-carousel/index.web.tsx +85 -0
  659. package/src/components/src/organisms/push-inbox/index.tsx +392 -0
  660. package/src/components/src/organisms/push-inbox/utils.ts +94 -0
  661. package/src/components/src/organisms/push-notification-prompt-button/index.tsx +45 -0
  662. package/src/components/src/organisms/push-notification-settings-block/index.tsx +119 -0
  663. package/src/components/src/organisms/quantity-selector-block/index.tsx +54 -0
  664. package/src/components/src/organisms/recent-order/addressSelector.tsx +88 -0
  665. package/src/components/src/organisms/recent-order/index.tsx +51 -0
  666. package/src/components/src/organisms/recent-order/paymentDetails.tsx +68 -0
  667. package/src/components/src/organisms/recently-viewed-products/index.tsx +92 -0
  668. package/src/components/src/organisms/recently-viewed-products/index.web.tsx +110 -0
  669. package/src/components/src/organisms/reels/index.tsx +467 -0
  670. package/src/components/src/organisms/reels/index.web.tsx +345 -0
  671. package/src/components/src/organisms/requires-auth/index.tsx +16 -0
  672. package/src/components/src/organisms/reset-password/index.tsx +140 -0
  673. package/src/components/src/organisms/review-bar/index.tsx +39 -0
  674. package/src/components/src/organisms/rewards-history/index.tsx +105 -0
  675. package/src/components/src/organisms/rewards-summary/index.tsx +146 -0
  676. package/src/components/src/organisms/rewards-summary-old/index.tsx +130 -0
  677. package/src/components/src/organisms/search-bar/index.tsx +34 -0
  678. package/src/components/src/organisms/search-product-list/index.tsx +31 -0
  679. package/src/components/src/organisms/search-recommendations/index.tsx +66 -0
  680. package/src/components/src/organisms/search-suggestions/index.tsx +194 -0
  681. package/src/components/src/organisms/search-suggestions-v2/collection-suggestions.tsx +61 -0
  682. package/src/components/src/organisms/search-suggestions-v2/index.tsx +91 -0
  683. package/src/components/src/organisms/search-suggestions-v2/page-suggestions.tsx +85 -0
  684. package/src/components/src/organisms/search-suggestions-v2/product-suggestions.tsx +174 -0
  685. package/src/components/src/organisms/search-suggestions-v2/search-term-suggestions.tsx +62 -0
  686. package/src/components/src/organisms/search-suggestions-v2/suggestion.tsx +100 -0
  687. package/src/components/src/organisms/shipping-address/index.tsx +59 -0
  688. package/src/components/src/organisms/shop-policy/index.tsx +93 -0
  689. package/src/components/src/organisms/shop-policy/index.web.tsx +12 -0
  690. package/src/components/src/organisms/shopify-customer-auth-webview/index.tsx +207 -0
  691. package/src/components/src/organisms/shopify-customer-payment-web-view/index.tsx +603 -0
  692. package/src/components/src/organisms/shopify-reviews/index.tsx +52 -0
  693. package/src/components/src/organisms/shopify-reviews/utils.ts +27 -0
  694. package/src/components/src/organisms/shopify-rich-text-block/index.tsx +60 -0
  695. package/src/components/src/organisms/shopify-store-credits/index.tsx +369 -0
  696. package/src/components/src/organisms/sign-in/index.tsx +242 -0
  697. package/src/components/src/organisms/sign-in-v2/index.tsx +282 -0
  698. package/src/components/src/organisms/sign-in-v3/index.tsx +259 -0
  699. package/src/components/src/organisms/sign-up/index.tsx +251 -0
  700. package/src/components/src/organisms/sign-up-v2/index.tsx +267 -0
  701. package/src/components/src/organisms/signin-modal/continue-as-guest.tsx +46 -0
  702. package/src/components/src/organisms/signin-modal/index.tsx +113 -0
  703. package/src/components/src/organisms/signup-modal/index.tsx +61 -0
  704. package/src/components/src/organisms/simpl-pay-block/index.tsx +84 -0
  705. package/src/components/src/organisms/single-level-navigation/index.tsx +91 -0
  706. package/src/components/src/organisms/snapmint-pay-block/index.tsx +173 -0
  707. package/src/components/src/organisms/spacer/index.tsx +17 -0
  708. package/src/components/src/organisms/subscription/index.tsx +52 -0
  709. package/src/components/src/organisms/subscription/subscription.tsx +226 -0
  710. package/src/components/src/organisms/subscription-selector-dropdown/extra-info.tsx +53 -0
  711. package/src/components/src/organisms/subscription-selector-dropdown/index.tsx +30 -0
  712. package/src/components/src/organisms/subscription-selector-dropdown/more-price-info.tsx +38 -0
  713. package/src/components/src/organisms/subscription-selector-dropdown/one-time-plan.tsx +85 -0
  714. package/src/components/src/organisms/subscription-selector-dropdown/purchase-plans.tsx +60 -0
  715. package/src/components/src/organisms/subscription-selector-dropdown/selling-plan-options.tsx +132 -0
  716. package/src/components/src/organisms/subscription-selector-dropdown/subscription-option-label.tsx +91 -0
  717. package/src/components/src/organisms/subscription-selector-dropdown/subscription.tsx +27 -0
  718. package/src/components/src/organisms/subscription-selector-dropdown/susbcription-plan.tsx +126 -0
  719. package/src/components/src/organisms/tabbed-product-collection/index.tsx +263 -0
  720. package/src/components/src/organisms/tabbed-product-collection/index.web.tsx +270 -0
  721. package/src/components/src/organisms/tag-redirect-product-images/index.tsx +203 -0
  722. package/src/components/src/organisms/tagged-page-size-chart/index.tsx +76 -0
  723. package/src/components/src/organisms/tagged-pdp-content/index.tsx +72 -0
  724. package/src/components/src/organisms/tagged-plp-content/index.tsx +67 -0
  725. package/src/components/src/organisms/tagged-rich-text/index.tsx +58 -0
  726. package/src/components/src/organisms/tagged-rich-text/index.web.tsx +25 -0
  727. package/src/components/src/organisms/tailored-variant-form/index.tsx +497 -0
  728. package/src/components/src/organisms/testimonials/Testimonials.tsx +45 -0
  729. package/src/components/src/organisms/testimonials/index.tsx +45 -0
  730. package/src/components/src/organisms/total-savings/index.tsx +50 -0
  731. package/src/components/src/organisms/trending-products/index.tsx +84 -0
  732. package/src/components/src/organisms/trending-searches/index.tsx +125 -0
  733. package/src/components/src/organisms/two-level-navigation/index.tsx +80 -0
  734. package/src/components/src/organisms/upsell-product-list/index.tsx +247 -0
  735. package/src/components/src/organisms/variant-carousel/index.tsx +121 -0
  736. package/src/components/src/organisms/variant-selector-modal-block/index.tsx +126 -0
  737. package/src/components/src/organisms/variant-selector-subscriptions/index.tsx +106 -0
  738. package/src/components/src/organisms/variantSelector/index.tsx +69 -0
  739. package/src/components/src/organisms/vertical-tabs-menu/defaults.ts +526 -0
  740. package/src/components/src/organisms/vertical-tabs-menu/index.tsx +61 -0
  741. package/src/components/src/organisms/video-banner/index.tsx +140 -0
  742. package/src/components/src/organisms/video-banner/index.web.tsx +123 -0
  743. package/src/components/src/organisms/video-banner-v2/index.tsx +188 -0
  744. package/src/components/src/organisms/video-carousel/index.tsx +404 -0
  745. package/src/components/src/organisms/video-carousel/index.web.tsx +357 -0
  746. package/src/components/src/organisms/video-carousel/video-carousel-item/index.tsx +277 -0
  747. package/src/components/src/organisms/video-carousel/video-carousel-item/product-list.tsx +257 -0
  748. package/src/components/src/organisms/video-carousel/video-carousel-item/product-list.web.tsx +197 -0
  749. package/src/components/src/organisms/video-list/index.tsx +103 -0
  750. package/src/components/src/organisms/view-coupons/discount-amount.tsx +48 -0
  751. package/src/components/src/organisms/view-coupons/index.tsx +137 -0
  752. package/src/components/src/organisms/view-coupons-v2/index.tsx +174 -0
  753. package/src/components/src/organisms/view-coupons-v2/savings-banner.tsx +100 -0
  754. package/src/components/src/organisms/web-view/index.tsx +281 -0
  755. package/src/components/src/organisms/web-view/index.web.tsx +61 -0
  756. package/src/components/src/organisms/wishlist/index.tsx +224 -0
  757. package/src/components/src/organisms/wishlist-v2/index.tsx +95 -0
  758. package/src/components/src/organisms/wishlisted-items/index.tsx +95 -0
  759. package/src/components/src/organisms/youtube-embed/index.tsx +41 -0
  760. package/src/components/src/registry.ts +2 -0
  761. package/src/components/src/style-utils.ts +441 -0
  762. package/src/components/src/utils.ts +252 -0
  763. package/src/components/test-setup.ts +1 -0
  764. package/src/container-registry/babel.config.js +3 -0
  765. package/src/container-registry/src/common.tsx +16 -0
  766. package/src/container-registry/src/index.ts +1 -0
  767. package/src/container-registry/src/register.tsx +27 -0
  768. package/src/container-registry/src/register.web.tsx +16 -0
  769. package/src/container-registry/test-setup.ts +1 -0
  770. package/src/containers/src/a1-tabbed-block-list/index.tsx +115 -0
  771. package/src/containers/src/accordion-container/index.tsx +72 -0
  772. package/src/containers/src/index.ts +0 -0
  773. package/src/containers/src/rules-container/index.tsx +88 -0
  774. package/src/containers/src/tabbed-block-list/index.tsx +81 -0
  775. package/src/containers/src/tabbed-screen-container/index.tsx +51 -0
  776. package/src/containers/test-setup.ts +1 -0
  777. package/src/cookie-manager/src/cookie.ts +16 -0
  778. package/src/cookie-manager/src/cookie.web.ts +5 -0
  779. package/src/cookie-manager/src/index.ts +1 -0
  780. package/src/cookie-manager/test-setup.ts +1 -0
  781. package/src/discount/src/gift.ts +182 -0
  782. package/src/discount/src/index.ts +1 -0
  783. package/src/discount/src/utils.ts +164 -0
  784. package/src/discount/test-setup.ts +1 -0
  785. package/src/enhanced-fetch/src/enhanced-fetch-tests.js +711 -0
  786. package/src/enhanced-fetch/src/index.ts +245 -0
  787. package/src/event-emitter/src/index.ts +38 -0
  788. package/src/firebase/src/index.ts +2 -0
  789. package/src/firebase/src/lib/analytics.ts +33 -0
  790. package/src/firebase/src/lib/analyticsV2.ts +61 -0
  791. package/src/icons/src/declarations.d.ts +6 -0
  792. package/src/icons/src/icon-registry.tsx +81 -0
  793. package/src/icons/src/icon-registry.web.tsx +81 -0
  794. package/src/icons/src/icon-set.tsx +455 -0
  795. package/src/icons/src/index.ts +4 -0
  796. package/src/icons/src/remote-icon.tsx +46 -0
  797. package/src/icons/src/remote-icon.web.tsx +25 -0
  798. package/src/icons/src/remote-image-icon.tsx +66 -0
  799. package/src/icons/src/remote-image-icon.web.tsx +31 -0
  800. package/src/icons/src/svgs/account.tsx +17 -0
  801. package/src/icons/src/svgs/add-to-cart.tsx +49 -0
  802. package/src/icons/src/svgs/address.tsx +26 -0
  803. package/src/icons/src/svgs/afterpay.tsx +110 -0
  804. package/src/icons/src/svgs/apple.tsx +19 -0
  805. package/src/icons/src/svgs/back.tsx +10 -0
  806. package/src/icons/src/svgs/badge.tsx +19 -0
  807. package/src/icons/src/svgs/bag.tsx +27 -0
  808. package/src/icons/src/svgs/cake.tsx +13 -0
  809. package/src/icons/src/svgs/calendar.tsx +20 -0
  810. package/src/icons/src/svgs/cancel.tsx +20 -0
  811. package/src/icons/src/svgs/cart-cancel.tsx +35 -0
  812. package/src/icons/src/svgs/cart.tsx +14 -0
  813. package/src/icons/src/svgs/categories.tsx +13 -0
  814. package/src/icons/src/svgs/checked.tsx +18 -0
  815. package/src/icons/src/svgs/checkedCircle.tsx +26 -0
  816. package/src/icons/src/svgs/chevron-down.tsx +26 -0
  817. package/src/icons/src/svgs/chevron-left.tsx +13 -0
  818. package/src/icons/src/svgs/chevron-right.tsx +19 -0
  819. package/src/icons/src/svgs/chevron-up.tsx +27 -0
  820. package/src/icons/src/svgs/chevron.tsx +35 -0
  821. package/src/icons/src/svgs/circled-arrow.tsx +29 -0
  822. package/src/icons/src/svgs/clear.tsx +35 -0
  823. package/src/icons/src/svgs/clipboard.tsx +23 -0
  824. package/src/icons/src/svgs/close.tsx +26 -0
  825. package/src/icons/src/svgs/collection.tsx +32 -0
  826. package/src/icons/src/svgs/copy.tsx +31 -0
  827. package/src/icons/src/svgs/coupon-icon.tsx +23 -0
  828. package/src/icons/src/svgs/coupon.tsx +35 -0
  829. package/src/icons/src/svgs/crate.tsx +13 -0
  830. package/src/icons/src/svgs/cross.tsx +21 -0
  831. package/src/icons/src/svgs/deals.tsx +26 -0
  832. package/src/icons/src/svgs/discount.tsx +42 -0
  833. package/src/icons/src/svgs/dollar.tsx +33 -0
  834. package/src/icons/src/svgs/error.tsx +35 -0
  835. package/src/icons/src/svgs/eye.tsx +33 -0
  836. package/src/icons/src/svgs/eyeOff.tsx +35 -0
  837. package/src/icons/src/svgs/facebook.tsx +31 -0
  838. package/src/icons/src/svgs/favorite.tsx +79 -0
  839. package/src/icons/src/svgs/filter.tsx +24 -0
  840. package/src/icons/src/svgs/fragrances.tsx +55 -0
  841. package/src/icons/src/svgs/gift.tsx +23 -0
  842. package/src/icons/src/svgs/gifts.tsx +38 -0
  843. package/src/icons/src/svgs/goal-discount-filled.tsx +21 -0
  844. package/src/icons/src/svgs/goal-discount.tsx +24 -0
  845. package/src/icons/src/svgs/goal-locked.tsx +21 -0
  846. package/src/icons/src/svgs/goal-unlocked.tsx +34 -0
  847. package/src/icons/src/svgs/google-colorful.tsx +38 -0
  848. package/src/icons/src/svgs/google.tsx +28 -0
  849. package/src/icons/src/svgs/grooming.tsx +22 -0
  850. package/src/icons/src/svgs/hamburger.tsx +30 -0
  851. package/src/icons/src/svgs/heart.tsx +30 -0
  852. package/src/icons/src/svgs/help.tsx +22 -0
  853. package/src/icons/src/svgs/history.tsx +26 -0
  854. package/src/icons/src/svgs/home.tsx +21 -0
  855. package/src/icons/src/svgs/homes.svg +4 -0
  856. package/src/icons/src/svgs/info.tsx +19 -0
  857. package/src/icons/src/svgs/inline-error-icon.tsx +13 -0
  858. package/src/icons/src/svgs/inline-success-icon-double-checkmarks.tsx +15 -0
  859. package/src/icons/src/svgs/instagram.tsx +17 -0
  860. package/src/icons/src/svgs/lock.tsx +15 -0
  861. package/src/icons/src/svgs/mail.tsx +30 -0
  862. package/src/icons/src/svgs/mins.tsx +21 -0
  863. package/src/icons/src/svgs/minus.tsx +19 -0
  864. package/src/icons/src/svgs/more.tsx +13 -0
  865. package/src/icons/src/svgs/notification-bell.tsx +44 -0
  866. package/src/icons/src/svgs/notifications.tsx +21 -0
  867. package/src/icons/src/svgs/offers.tsx +11 -0
  868. package/src/icons/src/svgs/order-history.tsx +19 -0
  869. package/src/icons/src/svgs/order.tsx +32 -0
  870. package/src/icons/src/svgs/package-check.tsx +30 -0
  871. package/src/icons/src/svgs/pause.tsx +17 -0
  872. package/src/icons/src/svgs/pencil.tsx +17 -0
  873. package/src/icons/src/svgs/percent-circle.tsx +30 -0
  874. package/src/icons/src/svgs/play.tsx +13 -0
  875. package/src/icons/src/svgs/plus.tsx +12 -0
  876. package/src/icons/src/svgs/privacy.tsx +15 -0
  877. package/src/icons/src/svgs/product.tsx +14 -0
  878. package/src/icons/src/svgs/profile-circle.tsx +16 -0
  879. package/src/icons/src/svgs/profile-permission.tsx +17 -0
  880. package/src/icons/src/svgs/profile-tab-icon.tsx +11 -0
  881. package/src/icons/src/svgs/profile.tsx +16 -0
  882. package/src/icons/src/svgs/reward.tsx +22 -0
  883. package/src/icons/src/svgs/rewards.tsx +15 -0
  884. package/src/icons/src/svgs/sad-emoji.tsx +30 -0
  885. package/src/icons/src/svgs/search.tsx +31 -0
  886. package/src/icons/src/svgs/share.tsx +28 -0
  887. package/src/icons/src/svgs/shipping.tsx +20 -0
  888. package/src/icons/src/svgs/signout.tsx +15 -0
  889. package/src/icons/src/svgs/signup.tsx +26 -0
  890. package/src/icons/src/svgs/snap-mint.tsx +49 -0
  891. package/src/icons/src/svgs/sort.tsx +12 -0
  892. package/src/icons/src/svgs/speakerOff.tsx +40 -0
  893. package/src/icons/src/svgs/speakerOn.tsx +20 -0
  894. package/src/icons/src/svgs/stars.tsx +36 -0
  895. package/src/icons/src/svgs/success.tsx +21 -0
  896. package/src/icons/src/svgs/tag.tsx +25 -0
  897. package/src/icons/src/svgs/thumbs-up-outlined.tsx +36 -0
  898. package/src/icons/src/svgs/thumbs-up.tsx +11 -0
  899. package/src/icons/src/svgs/tick.tsx +23 -0
  900. package/src/icons/src/svgs/trash.tsx +21 -0
  901. package/src/icons/src/svgs/trending.tsx +36 -0
  902. package/src/icons/src/svgs/truck.tsx +30 -0
  903. package/src/icons/src/svgs/truecaller.tsx +44 -0
  904. package/src/icons/src/svgs/types.ts +0 -0
  905. package/src/icons/src/svgs/unchecked.tsx +13 -0
  906. package/src/icons/src/svgs/verified.tsx +23 -0
  907. package/src/icons/src/svgs/video-play.tsx +12 -0
  908. package/src/icons/src/svgs/volume-off.tsx +18 -0
  909. package/src/icons/src/svgs/volume.tsx +18 -0
  910. package/src/icons/src/svgs/way.tsx +14 -0
  911. package/src/icons/src/svgs/youtube.tsx +26 -0
  912. package/src/icons/src/utils.ts +53 -0
  913. package/src/icons/test-setup.ts +1 -0
  914. package/src/integrations/appbrew/analytics/app-users.ts +107 -0
  915. package/src/integrations/appbrew/analytics/config.dev.ts +10 -0
  916. package/src/integrations/appbrew/analytics/config.ts +10 -0
  917. package/src/integrations/appbrew/analytics/tracker.ts +136 -0
  918. package/src/integrations/appbrew/analytics/trackerV2.ts +154 -0
  919. package/src/integrations/appbrew/analytics/utils.ts +9 -0
  920. package/src/integrations/appbrew/analytics/webhook-tracker.ts +203 -0
  921. package/src/integrations/appbrew/currency/index.ts +1 -0
  922. package/src/integrations/appbrew/currency/provider.ts +211 -0
  923. package/src/integrations/appbrew/estimated-delivery-date/blocks/estimated-delivery-date.tsx +229 -0
  924. package/src/integrations/appbrew/estimated-delivery-date/index.ts +2 -0
  925. package/src/integrations/appbrew/estimated-delivery-date/provider.ts +45 -0
  926. package/src/integrations/appbrew/native-wishlist/src/index.ts +1 -0
  927. package/src/integrations/appbrew/native-wishlist/src/provider.ts +88 -0
  928. package/src/integrations/appbrew/src/index.ts +7 -0
  929. package/src/integrations/appbrew/src/lib/integrations-appbrew.spec.ts +7 -0
  930. package/src/integrations/appbrew/src/lib/integrations-appbrew.ts +3 -0
  931. package/src/integrations/color-swatch/src/index.ts +7 -0
  932. package/src/integrations/firebase-push/src/index.ts +1 -0
  933. package/src/integrations/firebase-push/src/push.ts +279 -0
  934. package/src/integrations/firebase-push/src/push.web.ts +15 -0
  935. package/src/integrations/gift/src/gift.ts +137 -0
  936. package/src/integrations/gift/src/index.ts +1 -0
  937. package/src/integrations/truefit/src/blocks/index.ts +1 -0
  938. package/src/integrations/truefit/src/blocks/truefit-widget.tsx +136 -0
  939. package/src/integrations/truefit/src/components/TfApp.tsx +159 -0
  940. package/src/integrations/truefit/src/components/TfWidget.tsx +241 -0
  941. package/src/integrations/truefit/src/constants.ts +5 -0
  942. package/src/integrations/truefit/src/index.ts +13 -0
  943. package/src/integrations/truefit/src/managers/authManager.ts +140 -0
  944. package/src/integrations/truefit/src/managers/messageManager.ts +122 -0
  945. package/src/integrations/truefit/src/managers/tokenManager.ts +52 -0
  946. package/src/integrations/truefit/src/orderApi.ts +43 -0
  947. package/src/integrations/truefit/src/register-blocks.ts +5 -0
  948. package/src/integrations/truefit/src/util/useWidgetEvent.ts +29 -0
  949. package/src/integrations/truefit/src/util/widgetEvents.ts +17 -0
  950. package/src/local-storage/src/icon-storage.ts +26 -0
  951. package/src/local-storage/src/index.ts +2 -0
  952. package/src/local-storage/src/storage.ts +56 -0
  953. package/src/local-storage/src/storage.web.ts +75 -0
  954. package/src/module-provider/src/index.ts +1 -0
  955. package/src/module-provider/src/module-provider.tsx +27 -0
  956. package/src/module-provider/src/provider.ts +0 -0
  957. package/src/okendo/src/blocks/components-v2.tsx +342 -0
  958. package/src/okendo/src/blocks/components-v2.types.ts +134 -0
  959. package/src/okendo/src/blocks/components.tsx +569 -0
  960. package/src/okendo/src/blocks/index.tsx +13 -0
  961. package/src/okendo/src/blocks/okendo-star-ratings-v2.tsx +102 -0
  962. package/src/okendo/src/blocks/okendo-star-ratings.tsx +77 -0
  963. package/src/okendo/src/blocks/review-aggregate-v2.tsx +493 -0
  964. package/src/okendo/src/blocks/review-aggregate.tsx +175 -0
  965. package/src/okendo/src/blocks/reviews-v2.tsx +352 -0
  966. package/src/okendo/src/blocks/reviews.tsx +144 -0
  967. package/src/okendo/src/hooks.tsx +489 -0
  968. package/src/okendo/src/index.ts +35 -0
  969. package/src/okendo/src/provider.ts +457 -0
  970. package/src/okendo/src/types.ts +355 -0
  971. package/src/okendo/src/utils.ts +32 -0
  972. package/src/orders-v4/src/icons/chevron-right-order-v4.tsx +18 -0
  973. package/src/orders-v4/src/icons/order-status.tsx +17 -0
  974. package/src/orders-v4/src/icons/payment-method.tsx +18 -0
  975. package/src/orders-v4/src/icons/payment-status.tsx +17 -0
  976. package/src/orders-v4/src/index.ts +7 -0
  977. package/src/orders-v4/src/layout-elements/order-cancel.tsx +60 -0
  978. package/src/orders-v4/src/layout-elements/order-date.tsx +39 -0
  979. package/src/orders-v4/src/layout-elements/order-fulfillment-details.tsx +408 -0
  980. package/src/orders-v4/src/layout-elements/order-number.tsx +35 -0
  981. package/src/orders-v4/src/layout-elements/order-payment-details-v4.tsx +190 -0
  982. package/src/orders-v4/src/layout-elements/order-preorder-date.tsx +16 -0
  983. package/src/orders-v4/src/layout-elements/order-product-compare-at-price.tsx +32 -0
  984. package/src/orders-v4/src/layout-elements/order-product-fulfillment-status.tsx +105 -0
  985. package/src/orders-v4/src/layout-elements/order-product-image-overlay.tsx +55 -0
  986. package/src/orders-v4/src/layout-elements/order-product-image.tsx +29 -0
  987. package/src/orders-v4/src/layout-elements/order-product-link.tsx +24 -0
  988. package/src/orders-v4/src/layout-elements/order-product-price.tsx +37 -0
  989. package/src/orders-v4/src/layout-elements/order-product-quantity.tsx +27 -0
  990. package/src/orders-v4/src/layout-elements/order-product-title.tsx +22 -0
  991. package/src/orders-v4/src/layout-elements/order-product-variant.tsx +24 -0
  992. package/src/orders-v4/src/layout-elements/order-reorder.tsx +97 -0
  993. package/src/orders-v4/src/layout-elements/order-return-and-exchange-v2.tsx +90 -0
  994. package/src/orders-v4/src/layout-elements/order-return-and-exchange.tsx +93 -0
  995. package/src/orders-v4/src/layout-elements/order-status-icon.tsx +14 -0
  996. package/src/orders-v4/src/layout-elements/order-status.tsx +33 -0
  997. package/src/orders-v4/src/layout-elements/order-total.tsx +19 -0
  998. package/src/orders-v4/src/layout-elements/order-track-delivery.tsx +67 -0
  999. package/src/orders-v4/src/layout-elements/order-view-details.tsx +23 -0
  1000. package/src/orders-v4/src/order-custom-attributes-v4.tsx +210 -0
  1001. package/src/orders-v4/src/order-details-footer-v4.tsx +51 -0
  1002. package/src/orders-v4/src/order-details-fulfillment-list.tsx +32 -0
  1003. package/src/orders-v4/src/order-details-header-v4.tsx +69 -0
  1004. package/src/orders-v4/src/order-footer.ts +75 -0
  1005. package/src/orders-v4/src/order-header.ts +75 -0
  1006. package/src/orders-v4/src/order-products-list.ts +68 -0
  1007. package/src/orders-v4/src/orders-list-v4.tsx +131 -0
  1008. package/src/orders-v4/src/register-icons.ts +12 -0
  1009. package/src/orders-v4/src/register-orders-v4-blocks.ts +15 -0
  1010. package/src/orders-v4/src/registry.tsx +115 -0
  1011. package/src/orders-v4/src/types.ts +122 -0
  1012. package/src/orders-v4/src/utils.ts +75 -0
  1013. package/src/orders-v4/test-setup.ts +1 -0
  1014. package/src/orders-v5/src/cancel-order-reason.tsx +282 -0
  1015. package/src/orders-v5/src/icons/package-cancel.tsx +18 -0
  1016. package/src/orders-v5/src/icons/package-success.tsx +18 -0
  1017. package/src/orders-v5/src/icons/package.tsx +17 -0
  1018. package/src/orders-v5/src/icons/shipping-cancel.tsx +19 -0
  1019. package/src/orders-v5/src/icons/shipping-pending.tsx +19 -0
  1020. package/src/orders-v5/src/icons/shipping-success.tsx +18 -0
  1021. package/src/orders-v5/src/icons/shipping.tsx +32 -0
  1022. package/src/orders-v5/src/image.tsx +39 -0
  1023. package/src/orders-v5/src/index.ts +2 -0
  1024. package/src/orders-v5/src/order-details/fulfillment-list/fulfillment-item.tsx +222 -0
  1025. package/src/orders-v5/src/order-details/fulfillment-list/fulfillment-list.tsx +123 -0
  1026. package/src/orders-v5/src/order-details/fulfillment-list/index.tsx +1 -0
  1027. package/src/orders-v5/src/order-details/fulfillment-list/line-item.tsx +213 -0
  1028. package/src/orders-v5/src/order-details/fulfillment-list/star-ratings.tsx +79 -0
  1029. package/src/orders-v5/src/order-details/fulfillment-list/status-indicator.tsx +208 -0
  1030. package/src/orders-v5/src/order-details/fulfillment-list/status.tsx +113 -0
  1031. package/src/orders-v5/src/order-details/header.tsx +280 -0
  1032. package/src/orders-v5/src/order-details/index.tsx +9 -0
  1033. package/src/orders-v5/src/order-details/order-cancel.tsx +323 -0
  1034. package/src/orders-v5/src/order-details/order-custom-attributes.tsx +237 -0
  1035. package/src/orders-v5/src/order-details/order-return-and-exchange.tsx +196 -0
  1036. package/src/orders-v5/src/order-details/order-return-info-text.tsx +114 -0
  1037. package/src/orders-v5/src/order-details/payment-summary.tsx +295 -0
  1038. package/src/orders-v5/src/order-details/reorder.tsx +142 -0
  1039. package/src/orders-v5/src/order-details/shipping-address.tsx +93 -0
  1040. package/src/orders-v5/src/orders-list/index.ts +1 -0
  1041. package/src/orders-v5/src/orders-list/order-item/fulfillment-item.tsx +138 -0
  1042. package/src/orders-v5/src/orders-list/order-item/heading.tsx +160 -0
  1043. package/src/orders-v5/src/orders-list/order-item/item.tsx +168 -0
  1044. package/src/orders-v5/src/orders-list/orders-list.tsx +159 -0
  1045. package/src/orders-v5/src/register-orders-v5-blocks.ts +29 -0
  1046. package/src/orders-v5/src/register-orders-v5-icons.ts +17 -0
  1047. package/src/orders-v5/src/utils.ts +539 -0
  1048. package/src/pdp-components/src/blocks/common/empty-metafield.tsx +66 -0
  1049. package/src/pdp-components/src/blocks/common/placeholder-block.tsx +134 -0
  1050. package/src/pdp-components/src/blocks/index.ts +2 -0
  1051. package/src/pdp-components/src/blocks/pdp-metafield-image/index.tsx +138 -0
  1052. package/src/pdp-components/src/blocks/pdp-metafield-rich-text/index.tsx +190 -0
  1053. package/src/pdp-components/src/index.ts +7 -0
  1054. package/src/plp-components/src/blocks/plp-banner/index.tsx +213 -0
  1055. package/src/plp-components/src/blocks/plp-description/index.tsx +86 -0
  1056. package/src/plp-components/src/blocks/plp-html-text.tsx +172 -0
  1057. package/src/plp-components/src/blocks/plp-image-carousel.tsx +203 -0
  1058. package/src/plp-components/src/blocks/plp-shopify-rich-text/index.tsx +169 -0
  1059. package/src/plp-components/src/blocks/plp-sub-category-navigation/index.tsx +336 -0
  1060. package/src/plp-components/src/blocks/plp-text-sub-category/index.tsx +297 -0
  1061. package/src/plp-components/src/blocks/plp-video/index.tsx +140 -0
  1062. package/src/plp-components/src/blocks/plp-youtube-video.tsx +113 -0
  1063. package/src/plp-components/src/common/empty-metafield.tsx +66 -0
  1064. package/src/plp-components/src/common/placeholder-block.tsx +134 -0
  1065. package/src/plp-components/src/index.ts +21 -0
  1066. package/src/plp-components/test-setup.ts +1 -0
  1067. package/src/post-purchase/hooks.ts +24 -0
  1068. package/src/post-purchase/src/basic-order-item.tsx +143 -0
  1069. package/src/post-purchase/src/cancel-order-reason.tsx +160 -0
  1070. package/src/post-purchase/src/cancel-order.tsx +75 -0
  1071. package/src/post-purchase/src/date.tsx +33 -0
  1072. package/src/post-purchase/src/fulfillment-list.tsx +477 -0
  1073. package/src/post-purchase/src/hooks.ts +1 -0
  1074. package/src/post-purchase/src/index.ts +13 -0
  1075. package/src/post-purchase/src/order-details-header.tsx +64 -0
  1076. package/src/post-purchase/src/order-item.tsx +217 -0
  1077. package/src/post-purchase/src/order-list.tsx +62 -0
  1078. package/src/post-purchase/src/payment-details.tsx +116 -0
  1079. package/src/post-purchase/src/register.ts +17 -0
  1080. package/src/post-purchase/src/shipping-address.tsx +68 -0
  1081. package/src/post-purchase/src/style.ts +30 -0
  1082. package/src/post-purchase/src/types.ts +66 -0
  1083. package/src/post-purchase/src/utils.ts +95 -0
  1084. package/src/post-purchase/test-setup.ts +1 -0
  1085. package/src/react-native-element-dropdown/src/assets/close.png +0 -0
  1086. package/src/react-native-element-dropdown/src/assets/down.png +0 -0
  1087. package/src/react-native-element-dropdown/src/components/Dropdown/index.tsx +686 -0
  1088. package/src/react-native-element-dropdown/src/components/Dropdown/model.ts +73 -0
  1089. package/src/react-native-element-dropdown/src/components/Dropdown/styles.ts +67 -0
  1090. package/src/react-native-element-dropdown/src/components/MultiSelect/index.tsx +812 -0
  1091. package/src/react-native-element-dropdown/src/components/MultiSelect/model.ts +76 -0
  1092. package/src/react-native-element-dropdown/src/components/MultiSelect/styles.ts +103 -0
  1093. package/src/react-native-element-dropdown/src/components/SelectCountry/index.tsx +77 -0
  1094. package/src/react-native-element-dropdown/src/components/SelectCountry/model.ts +7 -0
  1095. package/src/react-native-element-dropdown/src/components/SelectCountry/styles.ts +28 -0
  1096. package/src/react-native-element-dropdown/src/components/TextInput/index.tsx +104 -0
  1097. package/src/react-native-element-dropdown/src/components/TextInput/model.ts +20 -0
  1098. package/src/react-native-element-dropdown/src/components/TextInput/styles.ts +31 -0
  1099. package/src/react-native-element-dropdown/src/index.ts +15 -0
  1100. package/src/react-native-element-dropdown/src/toolkits/index.ts +25 -0
  1101. package/src/react-native-element-dropdown/src/toolkits/model.ts +5 -0
  1102. package/src/react-native-element-dropdown/src/useDeviceOrientation.ts +37 -0
  1103. package/src/react-utils/src/hooks.ts +176 -0
  1104. package/src/react-utils/src/index.ts +1 -0
  1105. package/src/rn-rulepilot/src/index.ts +4 -0
  1106. package/src/rn-rulepilot/src/services/builder.ts +92 -0
  1107. package/src/rn-rulepilot/src/services/evaluator.ts +176 -0
  1108. package/src/rn-rulepilot/src/services/logger.ts +6 -0
  1109. package/src/rn-rulepilot/src/services/mutator.ts +203 -0
  1110. package/src/rn-rulepilot/src/services/object-discovery.ts +52 -0
  1111. package/src/rn-rulepilot/src/services/rule-pilot.ts +172 -0
  1112. package/src/rn-rulepilot/src/services/validator.ts +206 -0
  1113. package/src/rn-rulepilot/src/types/error.ts +14 -0
  1114. package/src/rn-rulepilot/src/types/rule.ts +35 -0
  1115. package/src/rn-rulepilot/test-setup.ts +1 -0
  1116. package/src/shopify/src/cache.ts +134 -0
  1117. package/src/shopify/src/cart-utils.ts +295 -0
  1118. package/src/shopify/src/checkout-utils.ts +124 -0
  1119. package/src/shopify/src/discountv2-transformer.ts +322 -0
  1120. package/src/shopify/src/filter.ts +287 -0
  1121. package/src/shopify/src/index.ts +16 -0
  1122. package/src/shopify/src/lineItemsv2-transformer.ts +225 -0
  1123. package/src/shopify/src/orders.ts +521 -0
  1124. package/src/shopify/src/queries/cart.ts +320 -0
  1125. package/src/shopify/src/queries/catlog-fields.ts +187 -0
  1126. package/src/shopify/src/queries/index.ts +1 -0
  1127. package/src/shopify/src/queries/orders.ts +368 -0
  1128. package/src/shopify/src/queries/query-generators.ts +737 -0
  1129. package/src/shopify/src/queries.ts +474 -0
  1130. package/src/shopify/src/shopify-auth.ts +410 -0
  1131. package/src/shopify/src/shopify-cart.ts +1298 -0
  1132. package/src/shopify/src/shopify-catlog-generic.ts +1168 -0
  1133. package/src/shopify/src/shopify-checkout.ts +385 -0
  1134. package/src/shopify/src/shopify-currency.ts +185 -0
  1135. package/src/shopify/src/shopify-customer-cart.ts +1246 -0
  1136. package/src/shopify/src/shopify-search-v2.ts +1234 -0
  1137. package/src/shopify/src/shopify-search.ts +184 -0
  1138. package/src/shopify/src/transformers.ts +715 -0
  1139. package/src/shopify/src/utils.ts +300 -0
  1140. package/src/shopify-types/src/generated-types/checkout/graphql-operations.ts +8767 -0
  1141. package/src/shopify-types/src/generated-types/customer-accounts/operations.ts +5969 -0
  1142. package/src/shopify-types/src/generated-types/graphql-operations.ts +9559 -0
  1143. package/src/shopify-types/src/index.ts +59 -0
  1144. package/src/shopify-types/src/schema/customerAccountsSchema.json +28093 -0
  1145. package/src/shopify-types/src/types.ts +59 -0
  1146. package/src/shopify-types/test-setup.ts +1 -0
  1147. package/src/state/src/index.ts +22 -0
  1148. package/src/state/src/lib/address.ts +248 -0
  1149. package/src/state/src/lib/analytics/actions/app.ts +30 -0
  1150. package/src/state/src/lib/analytics/actions/cart-wishlist.ts +192 -0
  1151. package/src/state/src/lib/analytics/actions/device.ts +28 -0
  1152. package/src/state/src/lib/analytics/actions/geo.ts +58 -0
  1153. package/src/state/src/lib/analytics/actions/index.ts +9 -0
  1154. package/src/state/src/lib/analytics/actions/order.ts +20 -0
  1155. package/src/state/src/lib/analytics/actions/product-collection.ts +119 -0
  1156. package/src/state/src/lib/analytics/actions/session.ts +74 -0
  1157. package/src/state/src/lib/analytics/actions/user.ts +55 -0
  1158. package/src/state/src/lib/analytics/actions/utm-params.ts +68 -0
  1159. package/src/state/src/lib/analytics/index.ts +147 -0
  1160. package/src/state/src/lib/analytics/utils.ts +173 -0
  1161. package/src/state/src/lib/autofill-client.ts +42 -0
  1162. package/src/state/src/lib/bundle.ts +228 -0
  1163. package/src/state/src/lib/bundleV2.ts +110 -0
  1164. package/src/state/src/lib/cart.ts +1779 -0
  1165. package/src/state/src/lib/checkout.ts +26 -0
  1166. package/src/state/src/lib/collection-metafields.ts +118 -0
  1167. package/src/state/src/lib/collections.ts +636 -0
  1168. package/src/state/src/lib/config.ts +437 -0
  1169. package/src/state/src/lib/constants.ts +30 -0
  1170. package/src/state/src/lib/device.ts +90 -0
  1171. package/src/state/src/lib/discounts.ts +435 -0
  1172. package/src/state/src/lib/estimated-delivery-date.ts +73 -0
  1173. package/src/state/src/lib/filter.ts +343 -0
  1174. package/src/state/src/lib/gift-wrap.ts +184 -0
  1175. package/src/state/src/lib/google-signin.ts +3 -0
  1176. package/src/state/src/lib/google-signin.web.ts +1 -0
  1177. package/src/state/src/lib/hooks/block.ts +136 -0
  1178. package/src/state/src/lib/hooks/cart.ts +233 -0
  1179. package/src/state/src/lib/hooks/common.ts +34 -0
  1180. package/src/state/src/lib/hooks/constants.ts +4 -0
  1181. package/src/state/src/lib/hooks/deeplink.ts +190 -0
  1182. package/src/state/src/lib/hooks/deeplink.web.ts +4 -0
  1183. package/src/state/src/lib/hooks/estimated-delivery-date.ts +5 -0
  1184. package/src/state/src/lib/hooks/filter.ts +37 -0
  1185. package/src/state/src/lib/hooks/hooks.ts +843 -0
  1186. package/src/state/src/lib/hooks/index.ts +29 -0
  1187. package/src/state/src/lib/hooks/localization.ts +213 -0
  1188. package/src/state/src/lib/hooks/metafield.ts +301 -0
  1189. package/src/state/src/lib/hooks/modal.ts +68 -0
  1190. package/src/state/src/lib/hooks/module.ts +31 -0
  1191. package/src/state/src/lib/hooks/order.ts +23 -0
  1192. package/src/state/src/lib/hooks/product.ts +202 -0
  1193. package/src/state/src/lib/hooks/quantity-restriction.ts +51 -0
  1194. package/src/state/src/lib/hooks/reviews.ts +27 -0
  1195. package/src/state/src/lib/hooks/rewards.ts +69 -0
  1196. package/src/state/src/lib/hooks/route.ts +90 -0
  1197. package/src/state/src/lib/hooks/screen.ts +83 -0
  1198. package/src/state/src/lib/hooks/search.ts +209 -0
  1199. package/src/state/src/lib/hooks/settings.ts +20 -0
  1200. package/src/state/src/lib/hooks/shipping-address.ts +5 -0
  1201. package/src/state/src/lib/hooks/shop.ts +5 -0
  1202. package/src/state/src/lib/hooks/shopify-query.ts +40 -0
  1203. package/src/state/src/lib/hooks/sizing.ts +13 -0
  1204. package/src/state/src/lib/hooks/title.ts +61 -0
  1205. package/src/state/src/lib/hooks/variant-selector.ts +493 -0
  1206. package/src/state/src/lib/hooks/video.ts +81 -0
  1207. package/src/state/src/lib/http-client/index.ts +132 -0
  1208. package/src/state/src/lib/integrations/analytics.ts +14 -0
  1209. package/src/state/src/lib/integrations/gift.ts +102 -0
  1210. package/src/state/src/lib/integrations/review.ts +212 -0
  1211. package/src/state/src/lib/kiwi-sizing.ts +62 -0
  1212. package/src/state/src/lib/localization.ts +524 -0
  1213. package/src/state/src/lib/localization.web.ts +154 -0
  1214. package/src/state/src/lib/metafield.ts +305 -0
  1215. package/src/state/src/lib/modal.ts +177 -0
  1216. package/src/state/src/lib/modules.ts +149 -0
  1217. package/src/state/src/lib/offers.ts +0 -0
  1218. package/src/state/src/lib/onboarding.ts +67 -0
  1219. package/src/state/src/lib/order.ts +229 -0
  1220. package/src/state/src/lib/orders.ts +199 -0
  1221. package/src/state/src/lib/products.ts +1072 -0
  1222. package/src/state/src/lib/promotions.ts +73 -0
  1223. package/src/state/src/lib/reward-program.ts +86 -0
  1224. package/src/state/src/lib/rewards.ts +106 -0
  1225. package/src/state/src/lib/route.ts +586 -0
  1226. package/src/state/src/lib/route.web.ts +52 -0
  1227. package/src/state/src/lib/screen.ts +106 -0
  1228. package/src/state/src/lib/search.ts +576 -0
  1229. package/src/state/src/lib/shop.ts +74 -0
  1230. package/src/state/src/lib/sizing-chart.ts +88 -0
  1231. package/src/state/src/lib/splash-platform.ts +59 -0
  1232. package/src/state/src/lib/splash-platform.web.ts +62 -0
  1233. package/src/state/src/lib/splash.ts +497 -0
  1234. package/src/state/src/lib/store.ts +138 -0
  1235. package/src/state/src/lib/subscriptions.ts +589 -0
  1236. package/src/state/src/lib/template.ts +42 -0
  1237. package/src/state/src/lib/types.ts +11 -0
  1238. package/src/state/src/lib/user-notifications.ts +153 -0
  1239. package/src/state/src/lib/user.ts +1721 -0
  1240. package/src/state/src/lib/utils.ts +586 -0
  1241. package/src/state/src/lib/wishlist.ts +290 -0
  1242. package/src/types/src/app-discounts.ts +118 -0
  1243. package/src/types/src/app-themes.ts +7 -0
  1244. package/src/types/src/blocks-definition/account.def.ts +535 -0
  1245. package/src/types/src/blocks-definition/announcement-carousel.def.ts +201 -0
  1246. package/src/types/src/blocks-definition/announcement-strip.def.ts +162 -0
  1247. package/src/types/src/blocks-definition/announcement-ticker.def.ts +290 -0
  1248. package/src/types/src/blocks-definition/app-bar.def.ts +323 -0
  1249. package/src/types/src/blocks-definition/apply-coupon.def.ts +363 -0
  1250. package/src/types/src/blocks-definition/cart-list.def.ts +445 -0
  1251. package/src/types/src/blocks-definition/change-password.def.ts +229 -0
  1252. package/src/types/src/blocks-definition/chips-navigation.def.ts +405 -0
  1253. package/src/types/src/blocks-definition/collection-list.def.ts +415 -0
  1254. package/src/types/src/blocks-definition/common.def.ts +793 -0
  1255. package/src/types/src/blocks-definition/content.def.ts +2051 -0
  1256. package/src/types/src/blocks-definition/countdown-banner.def.ts +537 -0
  1257. package/src/types/src/blocks-definition/empty-block.def.ts +212 -0
  1258. package/src/types/src/blocks-definition/firework.def.ts +128 -0
  1259. package/src/types/src/blocks-definition/image-banner.def.ts +634 -0
  1260. package/src/types/src/blocks-definition/image-collage.def.ts +505 -0
  1261. package/src/types/src/blocks-definition/image-compare.def.ts +412 -0
  1262. package/src/types/src/blocks-definition/image-list.def.ts +654 -0
  1263. package/src/types/src/blocks-definition/image-marquee.def.ts +526 -0
  1264. package/src/types/src/blocks-definition/index.ts +50 -0
  1265. package/src/types/src/blocks-definition/metafield-image-compare.def.ts +394 -0
  1266. package/src/types/src/blocks-definition/micro-contexts/product-card-v2.ts +2481 -0
  1267. package/src/types/src/blocks-definition/past-searches.def.ts +352 -0
  1268. package/src/types/src/blocks-definition/payment-details.def.ts +303 -0
  1269. package/src/types/src/blocks-definition/previously-ordered-products.def.ts +421 -0
  1270. package/src/types/src/blocks-definition/product-card.def.ts +416 -0
  1271. package/src/types/src/blocks-definition/product-grid.def.ts +657 -0
  1272. package/src/types/src/blocks-definition/product-hotspot.def.ts +401 -0
  1273. package/src/types/src/blocks-definition/product-list.def.ts +944 -0
  1274. package/src/types/src/blocks-definition/promo-carousel.def.ts +645 -0
  1275. package/src/types/src/blocks-definition/recent-orders.def.ts +596 -0
  1276. package/src/types/src/blocks-definition/recently-viewed-products.def.ts +412 -0
  1277. package/src/types/src/blocks-definition/rewards-summary.def.ts +627 -0
  1278. package/src/types/src/blocks-definition/rich-text-block.def.ts +303 -0
  1279. package/src/types/src/blocks-definition/search-suggestions.def.ts +228 -0
  1280. package/src/types/src/blocks-definition/sign-in.def.ts +555 -0
  1281. package/src/types/src/blocks-definition/single-level-navigation.def.ts +303 -0
  1282. package/src/types/src/blocks-definition/social-sign-in.def.ts +164 -0
  1283. package/src/types/src/blocks-definition/sort-and-filter.def.ts +881 -0
  1284. package/src/types/src/blocks-definition/tabbed-product-collection.def.ts +665 -0
  1285. package/src/types/src/blocks-definition/text-list.def.ts +280 -0
  1286. package/src/types/src/blocks-definition/two-level-navigation.def.ts +527 -0
  1287. package/src/types/src/blocks-definition/types.ts +33 -0
  1288. package/src/types/src/blocks-definition/video-banner.def.ts +483 -0
  1289. package/src/types/src/blocks-definition/video-carousel.def.ts +611 -0
  1290. package/src/types/src/blocks-definition/video-list.def.ts +280 -0
  1291. package/src/types/src/blocks-definition/view-coupons.def.ts +382 -0
  1292. package/src/types/src/blocks-definition/wishlisted-items.def.ts +530 -0
  1293. package/src/types/src/blocks-definition/youtube-embed.def.ts +154 -0
  1294. package/src/types/src/blocks.ts +3981 -0
  1295. package/src/types/src/category-navigation.ts +16 -0
  1296. package/src/types/src/common.ts +187 -0
  1297. package/src/types/src/config.ts +705 -0
  1298. package/src/types/src/countries.ts +2970 -0
  1299. package/src/types/src/currencies.ts +1217 -0
  1300. package/src/types/src/data.ts +257 -0
  1301. package/src/types/src/feature-flags.ts +59 -0
  1302. package/src/types/src/filter.ts +102 -0
  1303. package/src/types/src/index.ts +35 -0
  1304. package/src/types/src/integrations/analytics.ts +252 -0
  1305. package/src/types/src/integrations/attentive.ts +88 -0
  1306. package/src/types/src/integrations/automated-notifications.ts +87 -0
  1307. package/src/types/src/integrations/cart.ts +81 -0
  1308. package/src/types/src/integrations/edd.ts +35 -0
  1309. package/src/types/src/integrations/gift.ts +130 -0
  1310. package/src/types/src/integrations/index.ts +14 -0
  1311. package/src/types/src/integrations/loyalty-lion.ts +8 -0
  1312. package/src/types/src/integrations/otp-signin.ts +112 -0
  1313. package/src/types/src/integrations/review.ts +50 -0
  1314. package/src/types/src/integrations/rewards-v2.ts +5 -0
  1315. package/src/types/src/integrations/social-signin.ts +12 -0
  1316. package/src/types/src/integrations/subscriptions.ts +175 -0
  1317. package/src/types/src/integrations/wishlist.ts +86 -0
  1318. package/src/types/src/integrations/yotpo-rewards.ts +37 -0
  1319. package/src/types/src/internationalization.ts +170 -0
  1320. package/src/types/src/metafield.ts +5 -0
  1321. package/src/types/src/modules.ts +566 -0
  1322. package/src/types/src/navigation.ts +22 -0
  1323. package/src/types/src/one-link.ts +20 -0
  1324. package/src/types/src/order.ts +102 -0
  1325. package/src/types/src/permissions.ts +9 -0
  1326. package/src/types/src/product-update.ts +32 -0
  1327. package/src/types/src/product.ts +268 -0
  1328. package/src/types/src/push-notifications.ts +11 -0
  1329. package/src/types/src/quantity-selector.ts +5 -0
  1330. package/src/types/src/screen.ts +5 -0
  1331. package/src/types/src/search.ts +137 -0
  1332. package/src/types/src/searchtap.ts +97 -0
  1333. package/src/types/src/settings.ts +54 -0
  1334. package/src/types/src/shop.ts +13 -0
  1335. package/src/types/src/storage.ts +31 -0
  1336. package/src/types/src/style.ts +221 -0
  1337. package/src/types/src/theme.ts +54 -0
  1338. package/src/types/src/utils.ts +153 -0
  1339. package/src/types/src/variant-selector.ts +218 -0
  1340. package/src/ui-builder/src/components/atoms/accordian.tsx +110 -0
  1341. package/src/ui-builder/src/components/atoms/block-section/block-section.tsx +128 -0
  1342. package/src/ui-builder/src/components/atoms/block-section/hook.ts +251 -0
  1343. package/src/ui-builder/src/components/atoms/block-section/index.ts +3 -0
  1344. package/src/ui-builder/src/components/atoms/block-section/nav-button.tsx +101 -0
  1345. package/src/ui-builder/src/components/atoms/block-section/section.tsx +76 -0
  1346. package/src/ui-builder/src/components/atoms/block-section/types.ts +22 -0
  1347. package/src/ui-builder/src/components/atoms/box.tsx +77 -0
  1348. package/src/ui-builder/src/components/atoms/box.web.tsx +68 -0
  1349. package/src/ui-builder/src/components/atoms/button.tsx +260 -0
  1350. package/src/ui-builder/src/components/atoms/flex.tsx +44 -0
  1351. package/src/ui-builder/src/components/atoms/header/header-image.tsx +142 -0
  1352. package/src/ui-builder/src/components/atoms/header/header-link-button.tsx +57 -0
  1353. package/src/ui-builder/src/components/atoms/header/header-text.tsx +49 -0
  1354. package/src/ui-builder/src/components/atoms/header/header.tsx +179 -0
  1355. package/src/ui-builder/src/components/atoms/header/index.ts +2 -0
  1356. package/src/ui-builder/src/components/atoms/header/types.ts +63 -0
  1357. package/src/ui-builder/src/components/atoms/header/utils.ts +28 -0
  1358. package/src/ui-builder/src/components/atoms/helper/button-utils.ts +13 -0
  1359. package/src/ui-builder/src/components/atoms/helper/button-utils.web.ts +8 -0
  1360. package/src/ui-builder/src/components/atoms/html-rich-text.tsx +47 -0
  1361. package/src/ui-builder/src/components/atoms/icon.tsx +12 -0
  1362. package/src/ui-builder/src/components/atoms/image/image1.tsx +359 -0
  1363. package/src/ui-builder/src/components/atoms/image/image1.web.tsx +276 -0
  1364. package/src/ui-builder/src/components/atoms/image/types.ts +12 -0
  1365. package/src/ui-builder/src/components/atoms/image.tsx +33 -0
  1366. package/src/ui-builder/src/components/atoms/index.tsx +17 -0
  1367. package/src/ui-builder/src/components/atoms/link.tsx +34 -0
  1368. package/src/ui-builder/src/components/atoms/list.tsx +24 -0
  1369. package/src/ui-builder/src/components/atoms/native-video.tsx +102 -0
  1370. package/src/ui-builder/src/components/atoms/native-video.web.tsx +44 -0
  1371. package/src/ui-builder/src/components/atoms/rich-text.tsx +147 -0
  1372. package/src/ui-builder/src/components/atoms/spacer.tsx +11 -0
  1373. package/src/ui-builder/src/components/atoms/text.tsx +60 -0
  1374. package/src/ui-builder/src/components/atoms/vertical-list.tsx +177 -0
  1375. package/src/ui-builder/src/components/atoms/youtube-video.tsx +99 -0
  1376. package/src/ui-builder/src/components/blocks/content.tsx +32 -0
  1377. package/src/ui-builder/src/components/index.ts +3 -0
  1378. package/src/ui-builder/src/components/layout-elements/accordion.tsx +27 -0
  1379. package/src/ui-builder/src/components/layout-elements/app-logo.tsx +39 -0
  1380. package/src/ui-builder/src/components/layout-elements/html-rich-text.tsx +16 -0
  1381. package/src/ui-builder/src/components/layout-elements/image.tsx +118 -0
  1382. package/src/ui-builder/src/components/layout-elements/image.web.tsx +62 -0
  1383. package/src/ui-builder/src/components/layout-elements/index.ts +12 -0
  1384. package/src/ui-builder/src/components/layout-elements/link-button.tsx +37 -0
  1385. package/src/ui-builder/src/components/layout-elements/link.tsx +35 -0
  1386. package/src/ui-builder/src/components/layout-elements/list.tsx +16 -0
  1387. package/src/ui-builder/src/components/layout-elements/rich-text.tsx +29 -0
  1388. package/src/ui-builder/src/components/layout-elements/spacer.tsx +10 -0
  1389. package/src/ui-builder/src/components/layout-elements/text.tsx +29 -0
  1390. package/src/ui-builder/src/components/layout-elements/video.tsx +59 -0
  1391. package/src/ui-builder/src/components/molecules/accordion.tsx +120 -0
  1392. package/src/ui-builder/src/components/molecules/rich-text.tsx +132 -0
  1393. package/src/ui-builder/src/components/molecules/rich-text.web.tsx +82 -0
  1394. package/src/ui-builder/src/components/registery.tsx +404 -0
  1395. package/src/ui-builder/src/helper-elements/cta.tsx +79 -0
  1396. package/src/ui-builder/src/helper-elements/faq.tsx +143 -0
  1397. package/src/ui-builder/src/helper-elements/html-rich-text.tsx +59 -0
  1398. package/src/ui-builder/src/helper-elements/index.tsx +76 -0
  1399. package/src/ui-builder/src/helper-elements/link-button.tsx +74 -0
  1400. package/src/ui-builder/src/helper-elements/media-list-accordian.tsx +230 -0
  1401. package/src/ui-builder/src/helper-elements/media-list.tsx +154 -0
  1402. package/src/ui-builder/src/helper-elements/media.tsx +78 -0
  1403. package/src/ui-builder/src/helper-elements/rich-text-accordion.tsx +148 -0
  1404. package/src/ui-builder/src/helper-elements/rich-text-list.tsx +134 -0
  1405. package/src/ui-builder/src/helper-elements/rich-text.tsx +61 -0
  1406. package/src/ui-builder/src/helper-elements/testimonials.tsx +149 -0
  1407. package/src/ui-builder/src/helper-elements/text.tsx +52 -0
  1408. package/src/ui-builder/src/helper-elements/video-list.tsx +137 -0
  1409. package/src/ui-builder/src/helper-elements/video.tsx +44 -0
  1410. package/src/ui-builder/src/helper-elements/youtube-video.tsx +69 -0
  1411. package/src/ui-builder/src/index.ts +42 -0
  1412. package/src/ui-builder/src/style-utils.ts +127 -0
  1413. package/src/ui-builder/src/types.ts +67 -0
  1414. package/src/ui-builder/src/utils.ts +89 -0
  1415. package/src/utils/src/cache.utils.ts +64 -0
  1416. package/src/utils/src/common.utils.ts +47 -0
  1417. package/src/utils/src/http-client.ts +258 -0
  1418. package/src/utils/src/index.ts +5 -0
  1419. package/src/utils/src/slack-client.ts +8 -0
  1420. package/src/utils/src/telemetry-client.ts +69 -0
  1421. package/src/utils.ts +30 -0
  1422. package/tsconfig.paths.json +130 -0
@@ -0,0 +1,1779 @@
1
+ import {
2
+ AddressItem,
3
+ AnalyticsEvent,
4
+ AsyncData,
5
+ Country,
6
+ Currency,
7
+ GiftItem,
8
+ GiftLineItem,
9
+ GiftsProvider,
10
+ ICartProvider,
11
+ ItemEvent,
12
+ LineItem,
13
+ LineItemToAdd,
14
+ ProductVariantId,
15
+ ResponseData,
16
+ } from '@gauntlet/types'
17
+ import { AddressSlice } from './address'
18
+ import { ConfigSlice } from './config'
19
+ import { LocalStorage } from '@gauntlet/local-storage'
20
+ import { ModuleSlice } from './modules'
21
+ import { StoreSlice } from './types'
22
+ import { UserSlice } from './user'
23
+ import { ProductSlice } from './products'
24
+ import { AnalyticsSlice } from './analytics'
25
+ import { getAnalyticsProvider } from './integrations/analytics'
26
+ import { useAppStore } from './store'
27
+ import {
28
+ Cart,
29
+ MailingAddress,
30
+ Maybe,
31
+ AttributeInput,
32
+ DiscountAllocationBase,
33
+ } from '@gauntlet/shopify-types'
34
+ import { LocalisationUserInfo, LocalizationSlice } from './localization'
35
+ import { CheckoutSlice } from './checkout'
36
+ import { DiscountSlice } from './discounts'
37
+ import { DiscountV2 } from '@gauntlet/shopify-types'
38
+
39
+ export interface CartState {
40
+ data: {
41
+ lineItems: LineItem[]
42
+ count: number
43
+ webUrl?: string
44
+ id: string | number
45
+ payment?: Cart['payment']
46
+ discount?: any
47
+ note?: string
48
+ eligibleGiftItems: GiftItem[][] // items to be shown in modal eigible for to be added as gift
49
+ giftItemsInCart: GiftLineItem[] // items added in cart as a gift
50
+ discountV2: DiscountV2
51
+ lineItemsV2: LineItemV2
52
+ discountCodes: { applicable: boolean; code: string }[]
53
+ updatedAt?: number
54
+ groupRestrictionsToQuantity: Map<string, number>
55
+ cartAttributes?: Record<string, string>
56
+ discountCodes?: string[]
57
+ }
58
+ status: 'init' | 'idle' | 'loading' | 'error'
59
+ }
60
+
61
+ export interface CartActions {
62
+ get: () => Promise<boolean>
63
+ addItemsToCart: (
64
+ lineItems: LineItemToAdd[]
65
+ ) => Promise<ResponseData<Cart> | undefined>
66
+ createIsolatedCartForCheckout: (
67
+ lineItems: LineItemToAdd[]
68
+ ) => Promise<Cart | undefined>
69
+ updateQuantityForLineItem: (
70
+ variantId: string | number,
71
+ quantity: number
72
+ ) => void
73
+ syncCartPrices: () => Promise<Cart | undefined>
74
+ updateVariantForLineItem: (
75
+ variantId: ProductVariantId,
76
+ lineItem: LineItem
77
+ ) => Promise<any>
78
+ updateQuantityForLineItems: (
79
+ lineItems: Array<{ id: string | number; quantity: number }>,
80
+ giftItemsInCart?: GiftLineItem[]
81
+ ) => Promise<any>
82
+ fetchCart: (props?: { refresh?: boolean }) => Promise<Cart | undefined>
83
+ applyDiscountCode: (code: string) => Promise<Cart | undefined>
84
+ applyDiscountCodeV2: (code: string) => Promise<Cart | undefined>
85
+ removeDiscountCodeV2: (code: string) => Promise<Cart>
86
+ removeDiscountCode: (discountCodes?: string[]) => Promise<Cart>
87
+ removeItemsFromCart: (
88
+ lineItemIds: string[],
89
+ analyticsParams?: ItemEvent,
90
+ giftItemsInCart?: GiftLineItem[]
91
+ ) => Promise<Cart | undefined>
92
+ updateShippingAddress: () => Promise<void>
93
+
94
+ getItemCount: () => number
95
+ updateCart: (cart: Cart, checkForGift: boolean) => void
96
+ applyFreeGifts: (
97
+ cart: Cart,
98
+ couponCode?: string
99
+ ) => Promise<{ isGiftAdded: boolean } | undefined>
100
+ resetCart: () => undefined
101
+ getDiscountCodes: () => Promise<any>
102
+ addGiftItems: (
103
+ newEligibleGiftItemsList: GiftItem[][],
104
+ cart?: Cart
105
+ ) => Promise<void>
106
+ removeGiftItems: (
107
+ cart: Cart,
108
+ existingGiftItemsToRemove: GiftItem[]
109
+ ) => Promise<void>
110
+ removeGiftItemsV2: (
111
+ cart: Cart,
112
+ existingGiftItemsToRemove: GiftItem[]
113
+ ) => Promise<void>
114
+ clearGiftItems: () => void
115
+ setCartStatus: (status: 'init' | 'idle' | 'loading' | 'error') => void
116
+ updateBuyerIdentity: (buyerIdentity: {
117
+ customerAccessToken: string
118
+ email: string
119
+ }) => Promise<void>
120
+ updateCartAttributes: (
121
+ attributes: AttributeInput[]
122
+ ) => Promise<ResponseData<Cart>>
123
+ applyAutoCoupon: (cart: Cart, lastAddedProduct: LineItemToAdd) => void
124
+ updateDummyProductToCart: (lineItems: LineItemToAdd[]) => void
125
+ updateCustomAttributesForLineItems: (
126
+ lineItems: Array<{ id: string; customAttributes: Record<string, string> }>
127
+ ) => Promise<void>
128
+ updateNoteOnCart: (note: string) => Promise<void>
129
+ }
130
+ export interface CartSlice {
131
+ cart: CartState & CartActions
132
+ }
133
+
134
+ const localStorage = LocalStorage.getInstance()
135
+
136
+ export const createCartSlice: StoreSlice<
137
+ CartSlice,
138
+ CartSlice &
139
+ ConfigSlice &
140
+ AddressSlice &
141
+ ModuleSlice &
142
+ UserSlice &
143
+ ProductSlice &
144
+ AnalyticsSlice &
145
+ LocalizationSlice &
146
+ CheckoutSlice &
147
+ DiscountSlice &
148
+ ConfigSlice &
149
+ AddressSlice &
150
+ ModuleSlice &
151
+ UserSlice &
152
+ ProductSlice &
153
+ AnalyticsSlice &
154
+ LocalizationSlice &
155
+ CheckoutSlice &
156
+ DiscountSlice
157
+ > = (set, get) => ({
158
+ cart: {
159
+ status: 'init',
160
+ data: {
161
+ lineItems: [],
162
+ count: 0,
163
+ id: '',
164
+ eligibleGiftItems: [],
165
+ giftItemsInCart: [],
166
+ discountV2: [],
167
+ discountCodes: [],
168
+ lineItemsV2: [],
169
+ groupRestrictionsToQuantity: new Map(),
170
+ },
171
+ get: async () => {
172
+ return true
173
+ },
174
+ addItemsToCart: async (lineItems: LineItemToAdd[]) => {
175
+ try {
176
+ set((store) => {
177
+ store.cart.status = 'loading'
178
+ })
179
+ const customerAccessToken = get().user.getCustomerAccessToken()
180
+ const email = get().user.data.userDetails?.data?.email?.toLowerCase()
181
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
182
+ const cartId =
183
+ (get().cart.data.id as string) ||
184
+ (localStorage.getJson<{ id: string }>('cart')?.id as string)
185
+
186
+ let cartAttributes: AttributeInput[] = [
187
+ {
188
+ key: APPBREW_INSTANCE_ID,
189
+ value: get().analytics.getInstanceId(),
190
+ },
191
+ ]
192
+
193
+ const enableUtmAsCartAttributes =
194
+ get().config.data?.settings?.global?.enableUtmAsCartAttributes
195
+ if (enableUtmAsCartAttributes) {
196
+ try {
197
+ const utmParams = await get().analytics.getEventSourceUtmParams()
198
+ if (utmParams) {
199
+ const utmAttributes = Object.entries(utmParams).map(
200
+ ([key, value]) => ({
201
+ key,
202
+ value: String(value), // Ensure value is a string
203
+ })
204
+ )
205
+ cartAttributes = cartAttributes.concat(utmAttributes)
206
+ }
207
+ } catch (error) {
208
+ console.error('Error getting UTM parameters:', error)
209
+ }
210
+ }
211
+
212
+ setUserAddressFromLocalization()
213
+ const selectedAddress = get().address.selectedAddress
214
+
215
+ const buyerIdentityCountryCode: {
216
+ isoCode?: string
217
+ name?: string
218
+ currency?: Currency
219
+ } = {}
220
+
221
+ const localizationCountry = get().localization.data.selectedCountry
222
+
223
+ if (localizationCountry) {
224
+ buyerIdentityCountryCode.isoCode = localizationCountry.isoCode
225
+ buyerIdentityCountryCode.name = localizationCountry.name
226
+ buyerIdentityCountryCode.currency = localizationCountry.currency
227
+ }
228
+
229
+ let deliveryAddressPreferences = null
230
+ const buyerIdentity = {
231
+ email,
232
+ customerAccessToken,
233
+ countryCode: buyerIdentityCountryCode.isoCode,
234
+ }
235
+ const defaultAddress = get().user.data.userDetails.data?.defaultAddress
236
+
237
+ let addressInput = {
238
+ firstName: defaultAddress?.firstName,
239
+ lastName: defaultAddress?.lastName,
240
+ zip: '',
241
+ city: '',
242
+ province: '',
243
+ address1: '',
244
+ address2: '',
245
+ country: localizationCountry?.name,
246
+ phone: '',
247
+ }
248
+
249
+ if (selectedAddress && selectedAddress?.country) {
250
+ addressInput = {
251
+ firstName: selectedAddress.firstName,
252
+ lastName: selectedAddress.lastName,
253
+ zip: selectedAddress.zip,
254
+ city: selectedAddress.city,
255
+ province: selectedAddress.province,
256
+ address1: selectedAddress.address1,
257
+ address2: selectedAddress.address2,
258
+ country: selectedAddress.country,
259
+ phone: selectedAddress.phone,
260
+ }
261
+ }
262
+ deliveryAddressPreferences = [
263
+ {
264
+ deliveryAddress: addressInput,
265
+ },
266
+ ]
267
+
268
+ if (deliveryAddressPreferences) {
269
+ buyerIdentity['deliveryAddressPreferences'] =
270
+ deliveryAddressPreferences
271
+ }
272
+
273
+ const res = cartId
274
+ ? await cartModule.addItemsToCart(cartId, lineItems)
275
+ : await cartModule.createEmptyCart(
276
+ lineItems,
277
+ buyerIdentity,
278
+ {},
279
+ cartAttributes
280
+ )
281
+ const { status, data, error, warning } = res
282
+
283
+ if (status === 'success') {
284
+ get().analytics.sendCartEvent(
285
+ lineItems.map((item) => {
286
+ const product = data?.lineItems.find(
287
+ (lineItem) => lineItem.variantId === item.variantId
288
+ )
289
+ return {
290
+ productHandle: product?.productHandle,
291
+ quantity: item.quantity,
292
+ variantId: item.variantId,
293
+ }
294
+ }),
295
+ AnalyticsEvent.ADD_TO_CART
296
+ )
297
+ const updateCart = get().cart.updateCart
298
+ updateCart(data, true)
299
+ get().cart.applyAutoCoupon(data, lineItems[lineItems.length - 1])
300
+ } else {
301
+ set((store) => {
302
+ store.cart.status = 'idle'
303
+ })
304
+ console.log('error', { status, error })
305
+ return
306
+ }
307
+ if (warning) {
308
+ return { ...data, warning }
309
+ }
310
+ return data
311
+ } catch (e) {
312
+ console.error(e)
313
+ set((store) => {
314
+ store.cart.status = 'idle'
315
+ })
316
+ return get().cart.fetchCart({ refresh: true })
317
+ }
318
+ },
319
+ createIsolatedCartForCheckout: async (lineItems: LineItemToAdd[]) => {
320
+ try {
321
+ const customerAccessToken = get().user.getCustomerAccessToken()
322
+ const email = get().user.data.userDetails?.data?.email?.toLowerCase()
323
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
324
+
325
+ let cartAttributes: AttributeInput[] = [
326
+ {
327
+ key: APPBREW_INSTANCE_ID,
328
+ value: get().analytics.getInstanceId(),
329
+ },
330
+ ]
331
+
332
+ const enableUtmAsCartAttributes =
333
+ get().config.data?.settings?.global?.enableUtmAsCartAttributes
334
+ if (enableUtmAsCartAttributes) {
335
+ try {
336
+ const utmParams = await get().analytics.getEventSourceUtmParams()
337
+ if (utmParams) {
338
+ const utmAttributes = Object.entries(utmParams).map(
339
+ ([key, value]) => ({
340
+ key,
341
+ value: String(value),
342
+ })
343
+ )
344
+ cartAttributes = cartAttributes.concat(utmAttributes)
345
+ }
346
+ } catch (error) {
347
+ console.error('Error getting UTM parameters:', error)
348
+ }
349
+ }
350
+
351
+ setUserAddressFromLocalization()
352
+ const selectedAddress = get().address.selectedAddress
353
+
354
+ const buyerIdentityCountryCode: {
355
+ isoCode?: string
356
+ name?: string
357
+ currency?: Currency
358
+ } = {}
359
+
360
+ const localizationCountry = get().localization.data.selectedCountry
361
+
362
+ if (localizationCountry) {
363
+ buyerIdentityCountryCode.isoCode = localizationCountry.isoCode
364
+ buyerIdentityCountryCode.name = localizationCountry.name
365
+ buyerIdentityCountryCode.currency = localizationCountry.currency
366
+ }
367
+
368
+ let deliveryAddressPreferences = null
369
+ const buyerIdentity: Record<string, any> = {
370
+ email,
371
+ customerAccessToken,
372
+ countryCode: buyerIdentityCountryCode.isoCode,
373
+ }
374
+ const defaultAddress = get().user.data.userDetails.data?.defaultAddress
375
+
376
+ let addressInput = {
377
+ firstName: defaultAddress?.firstName,
378
+ lastName: defaultAddress?.lastName,
379
+ zip: '',
380
+ city: '',
381
+ province: '',
382
+ address1: '',
383
+ address2: '',
384
+ country: localizationCountry?.name,
385
+ phone: '',
386
+ }
387
+
388
+ if (selectedAddress && selectedAddress?.country) {
389
+ addressInput = {
390
+ firstName: selectedAddress.firstName,
391
+ lastName: selectedAddress.lastName,
392
+ zip: selectedAddress.zip,
393
+ city: selectedAddress.city,
394
+ province: selectedAddress.province,
395
+ address1: selectedAddress.address1,
396
+ address2: selectedAddress.address2,
397
+ country: selectedAddress.country,
398
+ phone: selectedAddress.phone,
399
+ }
400
+ }
401
+ deliveryAddressPreferences = [
402
+ {
403
+ deliveryAddress: addressInput,
404
+ },
405
+ ]
406
+
407
+ if (deliveryAddressPreferences) {
408
+ buyerIdentity['deliveryAddressPreferences'] =
409
+ deliveryAddressPreferences
410
+ }
411
+
412
+ const res = await cartModule.createEmptyCart(
413
+ lineItems,
414
+ buyerIdentity as any,
415
+ {},
416
+ cartAttributes as any
417
+ )
418
+
419
+ const { status, data, error } = res
420
+ if (status === 'success') {
421
+ get().analytics.sendCartEvent(
422
+ lineItems.map((item) => {
423
+ const product = data?.lineItems.find(
424
+ (lineItem) => lineItem.variantId === item.variantId
425
+ )
426
+ return {
427
+ productHandle: product?.productHandle,
428
+ quantity: item.quantity,
429
+ variantId: item.variantId,
430
+ }
431
+ }),
432
+ AnalyticsEvent.ADD_TO_CART
433
+ )
434
+ return data
435
+ } else {
436
+ console.log('error', { status, error })
437
+ return undefined
438
+ }
439
+ } catch (e) {
440
+ console.error(e)
441
+ return undefined
442
+ }
443
+ },
444
+ applyAutoCoupon: async (cart, lastAddedProduct) => {
445
+ const discount = get().discounts.getUpsellDiscount()
446
+ if (!discount) return
447
+ const {
448
+ appliesToProducts,
449
+ appliesToProductVariants,
450
+ appliesToCollections,
451
+ } = discount.customerGets
452
+ const discountCode = discount.discountCode
453
+ const lastProductInCart = cart.lineItems.find(
454
+ (item) => item.variantId === lastAddedProduct.variantId
455
+ )
456
+ if (
457
+ lastProductInCart &&
458
+ (appliesToProductVariants.includes(lastProductInCart.variant.id) ||
459
+ appliesToProducts.includes(lastProductInCart.productId) ||
460
+ // temporary code for aembr
461
+ (discount.enableDiscountV1 &&
462
+ appliesToProducts.includes(lastProductInCart.productHandle)) ||
463
+ appliesToCollections.some((collection) =>
464
+ lastProductInCart.collectionIds.has(collection)
465
+ ))
466
+ ) {
467
+ get().cart.applyDiscountCode(discountCode)
468
+ }
469
+ },
470
+ removeItemsFromCart: async (
471
+ lineItemIds: string[],
472
+ analyticsParams?: ItemEvent,
473
+ giftItemsInCart?: GiftLineItem[]
474
+ ) => {
475
+ set((store) => {
476
+ store.cart.status = 'loading'
477
+ })
478
+ try {
479
+ /**
480
+ * 1. build a lineItemId to lineItem Map
481
+ * 2. iterate the map and build replaceCartCallParams and removeCartCallParams
482
+ * 3. determine if replace or remove is to be done.
483
+ * 4. make network call and update cart
484
+ */
485
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
486
+ let isReplaceRequired = false
487
+ const replaceParams = {
488
+ id: get().cart.data.id,
489
+ lines: [] as Array<Record<string, any>>,
490
+ }
491
+ const lineIds = lineItemIds.filter((lineItemId) => {
492
+ for (const lineItem of get().cart.data.lineItems) {
493
+ if (lineItem.id === lineItemId) {
494
+ return true
495
+ }
496
+ }
497
+ return false
498
+ })
499
+ for (const lineItemId of lineItemIds) {
500
+ const item = get().cart.data.lineItems.find(
501
+ (item) => item.id === lineItemId
502
+ )
503
+ /**
504
+ * if item is a child item
505
+ * TODO: what if parent quantity is more than 1 ??
506
+ */
507
+ if (item?.customAttributes && item?.customAttributes?.['_parentId']) {
508
+ const parentId = item?.customAttributes?.['_parentId']
509
+
510
+ const parentLineItemId = get().cart.data.lineItems.find((item) => {
511
+ return item?.customAttributes?.['_id'] === parentId
512
+ })?.id
513
+
514
+ // if parent id exists and it is not in the list of items to be removed then we replace the parent item with updated custom attributes
515
+ if (parentLineItemId && !lineIds.includes(parentLineItemId))
516
+ isReplaceRequired = true
517
+
518
+ /**
519
+ * To build lineItems param for replace call
520
+ * 1. map through all line items in cart
521
+ * 2. if the line item is not the one that needs to be removed
522
+ * 3. build a new object with updated custom attributes
523
+ * 4. while looping through, if the line item is a parent item, remove the custom attribute of the itemToBeRemoved from parent
524
+ *
525
+ */
526
+ const param = get()
527
+ .cart.data.lineItems.map((lineItem) => {
528
+ if (
529
+ lineItem.customAttributes?.['_id'] !==
530
+ item?.customAttributes?.['_id']
531
+ ) {
532
+ const obj: Record<string, any> = {}
533
+ obj['quantity'] = lineItem.quantity
534
+ obj['variantId'] = lineItem.variantId
535
+ obj['id'] = lineItem.id
536
+
537
+ if (
538
+ item?.customAttributes?.['_parentId'] !==
539
+ lineItem.customAttributes?.['_id']
540
+ ) {
541
+ obj['customAttributes'] = transformCustomAttributesInput(
542
+ lineItem.customAttributes
543
+ )
544
+ } else {
545
+ const keyToBeRemovedFromParentCustomAttr =
546
+ item?.customAttributes?.['_parentAttr']
547
+ const newParentCustomAttributes: Record<string, string> = {}
548
+ if (lineItem.customAttributes) {
549
+ Object.entries(lineItem.customAttributes).forEach(
550
+ ([key, value]) => {
551
+ if (key !== keyToBeRemovedFromParentCustomAttr) {
552
+ newParentCustomAttributes[key] = value
553
+ }
554
+ }
555
+ )
556
+ }
557
+
558
+ obj['customAttributes'] = transformCustomAttributesInput(
559
+ newParentCustomAttributes
560
+ )
561
+ }
562
+ return obj
563
+ }
564
+ })
565
+ .filter((i): i is Record<string, any> => !!i)
566
+ replaceParams.lines = param
567
+ } else {
568
+ // if its a parent item, remove all child items
569
+ const parentId = item?.customAttributes?.['_id']
570
+ if (parentId) {
571
+ for (const lineItem of get().cart.data.lineItems) {
572
+ if (lineItem.customAttributes?.['_parentId'] === parentId) {
573
+ lineIds.push(lineItem.id)
574
+ }
575
+ }
576
+ }
577
+ }
578
+ }
579
+
580
+ const {
581
+ status,
582
+ data: cart,
583
+ error,
584
+ } = isReplaceRequired
585
+ ? await cartModule.replaceCheckoutLineItems(
586
+ replaceParams.id,
587
+ replaceParams.lines,
588
+ get().cart.data.lineItems
589
+ )
590
+ : await cartModule.removeItemsFromCart(
591
+ get().cart.data.id as string,
592
+ lineIds
593
+ )
594
+ if (status !== 'success') {
595
+ set((store) => {
596
+ store.cart.status = 'idle'
597
+ })
598
+ return
599
+ }
600
+ get().analytics.sendCartEvent(
601
+ lineItemIds.map((lineItemId) => {
602
+ const product: any = get().cart.data.lineItems.find(
603
+ (lineItem) => lineItem.id === lineItemId
604
+ )
605
+ return {
606
+ productHandle: product?.productHandle,
607
+ quantity: product?.quantity,
608
+ variantId: product?.variantId,
609
+ }
610
+ }),
611
+ AnalyticsEvent.REMOVE_FROM_CART
612
+ )
613
+ if (giftItemsInCart) {
614
+ cart.giftItemsInCart = giftItemsInCart
615
+ }
616
+ if (!cart.lineItems || cart.lineItems.length === 0)
617
+ return get().cart.resetCart()
618
+ const updateCart = get().cart.updateCart
619
+ updateCart(cart, true)
620
+ return cart
621
+ } catch (e) {
622
+ console.error(e)
623
+ return get().cart.fetchCart({ refresh: true })
624
+ }
625
+ },
626
+ fetchCart: async ({ refresh }) => {
627
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
628
+ const cartId =
629
+ (get().cart.data.id as string) ||
630
+ localStorage.getJson<{ id: string }>('cart')?.id
631
+
632
+ if (cartId === undefined || cartId === '') {
633
+ if (get().cart.status !== 'idle') {
634
+ set((store) => {
635
+ store.cart.status = 'idle'
636
+ })
637
+ }
638
+ return undefined
639
+ } else if (!refresh && get().cart.status === 'idle' && get().cart.data) {
640
+ return undefined
641
+ } else {
642
+ set((store) => {
643
+ store.cart.status = 'loading'
644
+ })
645
+
646
+ try {
647
+ const {
648
+ status,
649
+ data: cart,
650
+ error,
651
+ } = await cartModule.fetchCart(cartId)
652
+ if (status !== 'success') return
653
+ if (cart?.completedAt) {
654
+ get().cart.resetCart()
655
+ return cart
656
+ }
657
+
658
+ cart.giftItemsInCart =
659
+ localStorage.getJson('cart')?.giftItemsInCart || []
660
+ const updateCart = get().cart.updateCart
661
+ updateCart(cart, false)
662
+ return cart
663
+ } catch (e) {
664
+ return get().cart.resetCart()
665
+ }
666
+ }
667
+ },
668
+ syncCartPrices: async () => {
669
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
670
+ const cartId =
671
+ (get().cart.data.id as string) ||
672
+ localStorage.getJson<{ id: string }>('cart')?.id
673
+
674
+ if (cartId === undefined || cartId === '') {
675
+ if (get().cart.status !== 'idle') {
676
+ set((store) => {
677
+ store.cart.status = 'idle'
678
+ })
679
+ }
680
+ return undefined
681
+ } else {
682
+ set((store) => {
683
+ store.cart.status = 'loading'
684
+ })
685
+ try {
686
+ const cartData = useAppStore.getState().cart.data
687
+
688
+ const lineItemsToUpdate: string[] = []
689
+
690
+ for (const lineItem of cartData.lineItemsV2) {
691
+ const variantId = lineItem.merchandise.id
692
+ const price = lineItem?.cost?.amountPerQuantity?.amount
693
+ const merchandisePrice = lineItem?.merchandise?.price?.amount
694
+
695
+ if (price !== merchandisePrice) {
696
+ lineItemsToUpdate.push(variantId)
697
+ }
698
+ }
699
+ const itemsToUpdate = cartData?.lineItems
700
+ ?.filter((item) => lineItemsToUpdate.includes(item.variantId))
701
+ .map((item) => {
702
+ const customAttributes = item?.customAttributes
703
+ ? {
704
+ ...item.customAttributes,
705
+ _priceChange: item.price,
706
+ }
707
+ : { _priceChange: item.price }
708
+ return {
709
+ id: item.id,
710
+ merchandiseId: item.variantId,
711
+ quantity: item.quantity,
712
+ sellingPlanId: item?.sellingPlanId,
713
+ attributes: transformCustomAttributesInput(customAttributes),
714
+ }
715
+ })
716
+
717
+ if (!itemsToUpdate.length) {
718
+ set((store) => {
719
+ store.cart.status = 'idle'
720
+ })
721
+ return undefined
722
+ }
723
+
724
+ const {
725
+ status,
726
+ data: cart,
727
+ error,
728
+ } = await cartModule.syncCartPrices(cartId, itemsToUpdate)
729
+
730
+ if (status !== 'success') {
731
+ set((store) => {
732
+ store.cart.status = 'idle'
733
+ })
734
+ return { status, error }
735
+ }
736
+
737
+ const updateCart = get().cart.updateCart
738
+ updateCart(cart, true)
739
+
740
+ set((store) => {
741
+ store.cart.status = 'idle'
742
+ })
743
+ return cart
744
+ } catch (e) {
745
+ return get().cart.resetCart()
746
+ }
747
+ }
748
+ },
749
+
750
+ updateQuantityForLineItem: async (
751
+ lineItemId: string | number,
752
+ quantity: number
753
+ ) => {
754
+ const lineItem = get().cart.data.lineItems.find(
755
+ (lineItem) => lineItem.id === lineItemId
756
+ )
757
+ const updateItemsInCartParams = [{ id: lineItemId, quantity }]
758
+
759
+ /**
760
+ * Update quantity is called only for parent items
761
+ * if id is defined it indicates a parent/child item
762
+ * increasing quantity of parent should sync quantity for
763
+ * child as well
764
+ */
765
+ const id = lineItem?.customAttributes?.['_id']
766
+ if (id) {
767
+ const lineItems = get().cart.data.lineItems
768
+ for (const lineItem of lineItems) {
769
+ if (lineItem.customAttributes?.['_parentId'] === id) {
770
+ updateItemsInCartParams.push({ id: lineItem.id, quantity })
771
+ }
772
+ }
773
+ }
774
+
775
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
776
+ set((store) => {
777
+ store.cart.status = 'loading'
778
+ })
779
+ const cartId = get().cart.data.id as string
780
+ const {
781
+ status,
782
+ data: cart,
783
+ error,
784
+ warning,
785
+ } = await cartModule.updateItemsInCart(cartId, updateItemsInCartParams)
786
+ if (status !== 'success') {
787
+ set((store) => {
788
+ store.cart.status = 'idle'
789
+ })
790
+ console.log({ status, error })
791
+ return { status, error }
792
+ }
793
+ const product: any = get().cart.data.lineItems.find(
794
+ (lineItem) => lineItem.id === lineItemId
795
+ )
796
+ const quantityChange = quantity - product?.quantity
797
+ get().analytics.sendCartEvent(
798
+ [
799
+ {
800
+ productHandle: product?.productHandle,
801
+ quantity: Math.abs(quantityChange),
802
+ variantId: product?.variantId,
803
+ },
804
+ ],
805
+ quantityChange > 0
806
+ ? AnalyticsEvent.ADD_TO_CART
807
+ : AnalyticsEvent.REMOVE_FROM_CART
808
+ )
809
+ const updateCart = get().cart.updateCart
810
+ updateCart(cart, true)
811
+ set((store) => {
812
+ store.cart.status = 'idle'
813
+ })
814
+ if (warning) {
815
+ return { status, warning }
816
+ }
817
+ return cart
818
+ },
819
+ updateVariantForLineItem: async (
820
+ variantId: ProductVariantId,
821
+ lineItem: LineItem
822
+ ) => {
823
+ const lineItemId = lineItem.id
824
+ const quantity = lineItem.quantity
825
+ const customAttributes = lineItem.customAttributes
826
+ const updateItemsInCartParams = [
827
+ {
828
+ id: lineItemId,
829
+ merchandiseId: variantId,
830
+ quantity,
831
+ attributes: transformCustomAttributesInput(customAttributes),
832
+ },
833
+ ]
834
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
835
+ set((store) => {
836
+ store.cart.status = 'loading'
837
+ })
838
+ const cartId = get().cart.data.id as string
839
+ const {
840
+ status,
841
+ data: cart,
842
+ error,
843
+ warning,
844
+ } = await cartModule.updateItemsInCart(cartId, updateItemsInCartParams)
845
+ if (status !== 'success') {
846
+ console.log({ status, error })
847
+
848
+ set((store) => {
849
+ store.cart.status = 'idle'
850
+ })
851
+ return { status, error }
852
+ }
853
+
854
+ const updateCart = get().cart.updateCart
855
+ updateCart(cart, true)
856
+ set((store) => {
857
+ store.cart.status = 'idle'
858
+ })
859
+
860
+ return {
861
+ status,
862
+ data: cart,
863
+ warning,
864
+ }
865
+ },
866
+ updateQuantityForLineItems: async (
867
+ lineItems: Array<{ id: string | number; quantity: number }>,
868
+ giftItemsInCart?: GiftLineItem[]
869
+ ) => {
870
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
871
+ set((store) => {
872
+ store.cart.status = 'loading'
873
+ })
874
+ const cartId = get().cart.data.id as string
875
+ const {
876
+ status,
877
+ data: cart,
878
+ error,
879
+ warning,
880
+ } = await cartModule.updateItemsInCart(cartId, lineItems)
881
+ if (status !== 'success') {
882
+ set((store) => {
883
+ store.cart.status = 'idle'
884
+ })
885
+ console.error(error)
886
+ return
887
+ }
888
+ // const product: any = get().cart.data.lineItems.find(
889
+ // (lineItem) => lineItem.id === variantId
890
+ // )
891
+ // const quantityChange = quantity - product?.quantity
892
+ // get().analytics.sendCartEvent(
893
+ // [
894
+ // {
895
+ // productHandle: product?.productHandle,
896
+ // quantity: Math.abs(quantityChange),
897
+ // variantId: product?.variantId,
898
+ // },
899
+ // ],
900
+ // quantityChange > 0
901
+ // ? AnalyticsEvent.ADD_TO_CART
902
+ // : AnalyticsEvent.REMOVE_FROM_CART
903
+ // )
904
+ if (giftItemsInCart) {
905
+ cart.giftItemsInCart = giftItemsInCart
906
+ }
907
+ const updateCart = get().cart.updateCart
908
+ updateCart(cart, true)
909
+ set((store) => {
910
+ store.cart.status = 'idle'
911
+ })
912
+ if (warning) {
913
+ return { status, warning }
914
+ }
915
+ return cart
916
+ },
917
+ updateCustomAttributesForLineItems: async (
918
+ lineItems: Array<{ id: string; customAttributes: Record<string, string> }>
919
+ ) => {
920
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
921
+ set((store) => {
922
+ store.cart.status = 'loading'
923
+ })
924
+ const lineItemParams = lineItems.map((lineItem) => ({
925
+ id: lineItem.id,
926
+ attributes: transformCustomAttributesInput(lineItem.customAttributes),
927
+ }))
928
+ const cartId = get().cart.data.id as string
929
+ const {
930
+ status,
931
+ data: cart,
932
+ error,
933
+ warning,
934
+ } = await cartModule.updateItemsInCart(cartId, lineItemParams)
935
+ if (status !== 'success') {
936
+ set((store) => {
937
+ store.cart.status = 'idle'
938
+ })
939
+ console.error(error)
940
+ return { status: 'error', data: null, error }
941
+ }
942
+ const updateCart = get().cart.updateCart
943
+ updateCart(cart, true)
944
+ set((store) => {
945
+ store.cart.status = 'idle'
946
+ })
947
+ return { status: 'success', data: cart, warning }
948
+ },
949
+ applyDiscountCode: async (code: string) => {
950
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
951
+ let cartId = get().cart.data.id
952
+ //this is added for coupon auto apply scenario
953
+ if (!cartId) {
954
+ const { data: c, status, error } = await cartModule.createEmptyCart([])
955
+ if (status !== 'success') return
956
+ set((store) => {
957
+ store.cart.data.id = c.id
958
+ })
959
+ cartId = c.id
960
+ }
961
+
962
+ set((store) => {
963
+ store.cart.status = 'loading'
964
+ })
965
+
966
+ try {
967
+ // adding free gift items to cart first and then applying discount code
968
+ const applyFreeGifts = get().cart.applyFreeGifts
969
+ const initialCart = get().cart.data
970
+
971
+ await applyFreeGifts(initialCart, code)
972
+ } catch (e) {
973
+ console.error('Error while applying free gifts', e)
974
+ }
975
+ try {
976
+ const alreadyAppliedCodes = get()
977
+ .cart.data.discountCodes.filter(
978
+ (discount) => discount.applicable && discount.code
979
+ )
980
+ .map((discount) => discount.code)
981
+ const codes = [code, ...alreadyAppliedCodes]
982
+
983
+ const enableApplyDiscountV2 =
984
+ get().config.data?.settings?.['global']?.['enableApplyCouponsV2'] ??
985
+ false
986
+
987
+ const {
988
+ status,
989
+ data: cart,
990
+ error,
991
+ } = enableApplyDiscountV2
992
+ ? await cartModule.applyDiscountCodeV2(cartId as string, codes)
993
+ : await cartModule.applyDiscountCode(cartId as string, [code])
994
+ if (status !== 'success') {
995
+ set((store) => {
996
+ store.cart.status = 'idle'
997
+ })
998
+ return
999
+ }
1000
+
1001
+ const analytics = getAnalyticsProvider(() => useAppStore.getState())
1002
+ analytics.sendEvent(AnalyticsEvent.APPLY_COUPON, {
1003
+ coupon: cart?.discount?.code,
1004
+ isApplicable: cart?.discount?.isApplicable,
1005
+ })
1006
+
1007
+ const updateCart = get().cart.updateCart
1008
+ updateCart(cart, true)
1009
+
1010
+ return cart
1011
+ } catch (e) {
1012
+ set((store) => {
1013
+ store.cart.status = 'idle'
1014
+ })
1015
+ return undefined
1016
+ }
1017
+ },
1018
+ applyDiscountCodeV2: async (code: string) => {
1019
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
1020
+ let cartId = get().cart.data.id
1021
+ //this is added for coupon auto apply scenario
1022
+ if (!cartId) {
1023
+ const { data: c, status, error } = await cartModule.createEmptyCart([])
1024
+ if (status !== 'success') return
1025
+ set((store) => {
1026
+ store.cart.data.id = c.id
1027
+ })
1028
+ cartId = c.id
1029
+ }
1030
+ set((store) => {
1031
+ store.cart.status = 'loading'
1032
+ })
1033
+
1034
+ try {
1035
+ // adding free gift items to cart first and then applying discount code
1036
+ const applyFreeGifts = get().cart.applyFreeGifts
1037
+ const initialCart = get().cart.data
1038
+
1039
+ await applyFreeGifts(initialCart, code)
1040
+ } catch (e) {
1041
+ console.error('Error while applying free gifts', e)
1042
+ }
1043
+ try {
1044
+ const alreadyAppliedCodes = get()
1045
+ .cart.data.discountCodes.filter(
1046
+ (discount) => discount.applicable && discount.code
1047
+ )
1048
+ .map((discount) => discount.code)
1049
+ const codes = [code, ...alreadyAppliedCodes]
1050
+ const {
1051
+ status,
1052
+ data: cart,
1053
+ error,
1054
+ } = await cartModule.applyDiscountCodeV2(cartId as string, codes)
1055
+
1056
+ if (status !== 'success') return
1057
+
1058
+ //this needs fix for multi coupons
1059
+ const analytics = getAnalyticsProvider(() => useAppStore.getState())
1060
+ analytics.sendEvent(AnalyticsEvent.APPLY_COUPON, {
1061
+ coupon: cart?.discount?.code,
1062
+ isApplicable: cart?.discount?.isApplicable,
1063
+ })
1064
+
1065
+ const updateCart = get().cart.updateCart
1066
+ updateCart(cart, true)
1067
+
1068
+ return cart
1069
+ } catch (e) {
1070
+ set((store) => {
1071
+ store.cart.status = 'idle'
1072
+ })
1073
+ return undefined
1074
+ }
1075
+ },
1076
+ removeDiscountCode: async (discountCodes?: string[]) => {
1077
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
1078
+ set((store) => {
1079
+ store.cart.status = 'loading'
1080
+ })
1081
+ const {
1082
+ status,
1083
+ data: cart,
1084
+ error,
1085
+ } = await cartModule.removeDiscountCode(
1086
+ get().cart.data.id as string,
1087
+ discountCodes
1088
+ )
1089
+ if (status !== 'success') {
1090
+ set((store) => {
1091
+ store.cart.status = 'idle'
1092
+ })
1093
+ console.error('error in remove discount code', error)
1094
+ return
1095
+ }
1096
+ const analytics = getAnalyticsProvider(() => useAppStore.getState())
1097
+ analytics.sendEvent(AnalyticsEvent.REMOVE_COUPON, {
1098
+ coupon: get().cart?.data?.discount?.code,
1099
+ })
1100
+ const updateCart = get().cart.updateCart
1101
+ updateCart(cart, true)
1102
+ return cart
1103
+ },
1104
+ removeDiscountCodeV2: async (code: string) => {
1105
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
1106
+ set((store) => {
1107
+ store.cart.status = 'loading'
1108
+ })
1109
+ const codesToRetain = get()
1110
+ .cart.data.discountCodes.filter(
1111
+ (discount) =>
1112
+ discount.applicable &&
1113
+ discount.code &&
1114
+ discount.code.toLowerCase() !== code.toLowerCase()
1115
+ )
1116
+ .map((discount) => discount.code)
1117
+
1118
+ const {
1119
+ status,
1120
+ data: cart,
1121
+ error,
1122
+ } = await cartModule.removeDiscountCodeV2(
1123
+ get().cart.data.id as string,
1124
+ codesToRetain
1125
+ )
1126
+ if (status !== 'success') return
1127
+ const analytics = getAnalyticsProvider(() => useAppStore.getState())
1128
+ analytics.sendEvent(AnalyticsEvent.REMOVE_COUPON, {
1129
+ coupon: get().cart?.data?.discount?.code,
1130
+ })
1131
+ const updateCart = get().cart.updateCart
1132
+ updateCart(cart, true)
1133
+ return cart
1134
+ },
1135
+ updateShippingAddress: async () => {
1136
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
1137
+ // formData is the selected address data
1138
+ const address = get().address.getFormData()
1139
+
1140
+ const addressReq = {
1141
+ ...address,
1142
+ country: address?.country?.countryName,
1143
+ }
1144
+ const cartId = get().cart.data.id as string
1145
+ const accessToken = localStorage.getJson<{ accessToken: string }>(
1146
+ 'customerAccessToken'
1147
+ )?.accessToken
1148
+
1149
+ if (!cartId) return
1150
+ const {
1151
+ status,
1152
+ data: cart,
1153
+ error,
1154
+ } = await cartModule.updateShippingAddress(addressReq, cartId, {
1155
+ accessToken,
1156
+ countryCode: address?.country?.countryCode,
1157
+ })
1158
+
1159
+ if (status === 'error') {
1160
+ return {
1161
+ status,
1162
+ error,
1163
+ }
1164
+ }
1165
+
1166
+ if (status !== 'success') return
1167
+ if (cart) {
1168
+ get().cart.updateCart(cart, true)
1169
+ const analytics = getAnalyticsProvider(() => useAppStore.getState())
1170
+ await analytics?.sendEvent(AnalyticsEvent.ADD_SHIPPING_INFO)
1171
+ }
1172
+ },
1173
+
1174
+ getItemCount: () => {
1175
+ const items = get().cart.data.lineItems ?? []
1176
+ return calculateItemCount(items)
1177
+ },
1178
+ addGiftItems: async (
1179
+ newEligibleGiftItemsList: GiftItem[][],
1180
+ cart?: Cart
1181
+ ) => {
1182
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
1183
+ const { id, giftItemsInCart } = cart || get().cart.data
1184
+ const updateCart = get().cart.updateCart
1185
+ const itemsToBeAddedToCart: GiftItem[] = []
1186
+ const eligibleGiftItems: GiftItem[][] = []
1187
+ newEligibleGiftItemsList.forEach((newEligibleGiftItems) => {
1188
+ if (newEligibleGiftItems.length == 1) {
1189
+ itemsToBeAddedToCart.push(newEligibleGiftItems[0])
1190
+ } else {
1191
+ eligibleGiftItems.push([...newEligibleGiftItems])
1192
+ }
1193
+ })
1194
+ const { data: updatedCart, status } = await cartModule.addItemsToCart(
1195
+ `${id}`,
1196
+ itemsToBeAddedToCart.map((item) => {
1197
+ return {
1198
+ variantId: item.variantId,
1199
+ quantity: 1,
1200
+ }
1201
+ })
1202
+ )
1203
+ updatedCart.giftItemsInCart = giftItemsInCart.concat(
1204
+ updatedCart.lineItems.reduce(
1205
+ (filtered: GiftLineItem[], lineItem: LineItem) => {
1206
+ for (let index = 0; index < itemsToBeAddedToCart.length; index++) {
1207
+ if (
1208
+ lineItem.variantId === itemsToBeAddedToCart[index].variantId
1209
+ ) {
1210
+ filtered.push({
1211
+ ...lineItem,
1212
+ ruleId: itemsToBeAddedToCart[index].ruleId,
1213
+ })
1214
+ itemsToBeAddedToCart.splice(index, 1)
1215
+ break
1216
+ }
1217
+ }
1218
+ return filtered
1219
+ },
1220
+ []
1221
+ )
1222
+ )
1223
+ updatedCart.eligibleGiftItems = eligibleGiftItems
1224
+ updateCart(updatedCart, false)
1225
+ },
1226
+
1227
+ updateNoteOnCart: async (note: string) => {
1228
+ const cartId = get().cart.data.id as string
1229
+ set((store) => {
1230
+ store.cart.status = 'loading'
1231
+ })
1232
+ try {
1233
+ const appConfig = useAppStore.getState().config.data
1234
+
1235
+ const cartProvider = get().modules.getModule<ICartProvider>('cart')
1236
+
1237
+ const {
1238
+ status,
1239
+ data: cart,
1240
+ error,
1241
+ } = await cartProvider.updateNoteOnCart(cartId, note)
1242
+ if (status === 'success') {
1243
+ get().cart.updateCart(cart, false)
1244
+ } else {
1245
+ set((store) => {
1246
+ store.cart.status = 'idle'
1247
+ })
1248
+ console.error('Failed to update note on cart', error)
1249
+ }
1250
+ } catch (e) {
1251
+ set((store) => {
1252
+ store.cart.status = 'idle'
1253
+ })
1254
+ console.error('Error updating note on cart', e)
1255
+ }
1256
+ },
1257
+ removeGiftItems: async (cart, existingGiftItemsToRemove) => {
1258
+ const removeItemsFromCart = get().cart.removeItemsFromCart
1259
+ const lineItemsToRemove: string[] = []
1260
+ const giftItemsInCart = [...cart.giftItemsInCart]
1261
+ existingGiftItemsToRemove.forEach((existingGiftItem) => {
1262
+ for (let index = 0; index < giftItemsInCart.length; index++) {
1263
+ const giftItemInCart = giftItemsInCart[index]
1264
+ if (existingGiftItem.variantId === giftItemInCart.variantId) {
1265
+ lineItemsToRemove.push(giftItemInCart.id)
1266
+ giftItemsInCart.splice(index, 1)
1267
+ return
1268
+ }
1269
+ }
1270
+ })
1271
+ removeItemsFromCart(lineItemsToRemove, undefined, giftItemsInCart)
1272
+ },
1273
+ // removeGiftItemsV2 allows us to decrease quantity of gift items in cart if the quantity is more than 1
1274
+ // It also allows to remove gift items from cart even if the free gift cart line id does not match with the cart line id
1275
+ removeGiftItemsV2: async (cart, existingGiftItemsToRemove) => {
1276
+ const { removeItemsFromCart, updateQuantityForLineItems, updateCart } =
1277
+ get().cart
1278
+
1279
+ // Create a copy of giftItemsInCart to work with
1280
+ const updatedGiftItemsInCart = cart.giftItemsInCart.slice()
1281
+
1282
+ // Arrays to keep track of items to remove or update
1283
+ const itemsToRemoveFromCart = []
1284
+ const itemsToDecreaseQuantity = []
1285
+
1286
+ // Loop through the list of gift items to remove
1287
+ for (const giftItemToRemove of existingGiftItemsToRemove) {
1288
+ // Find the index of the gift item in the cart
1289
+ const giftItemIndex = updatedGiftItemsInCart.findIndex(
1290
+ (giftItem) => giftItem.variantId === giftItemToRemove.variantId
1291
+ )
1292
+
1293
+ // Skip if the gift item is not found in the cart
1294
+ if (giftItemIndex === -1) continue
1295
+
1296
+ // Remove the gift item from the cart
1297
+ updatedGiftItemsInCart.splice(giftItemIndex, 1)
1298
+
1299
+ // Find the corresponding line item in the cart
1300
+ const lineItem = cart.lineItems?.find(
1301
+ (item) => item.variantId === giftItemToRemove.variantId
1302
+ )
1303
+
1304
+ // Skip if the line item is not found
1305
+ if (!lineItem) continue
1306
+
1307
+ // Determine whether to decrease quantity or remove the line item
1308
+ if (lineItem.quantity > 1) {
1309
+ itemsToDecreaseQuantity.push({
1310
+ id: lineItem.id,
1311
+ quantity: lineItem.quantity - 1,
1312
+ })
1313
+ } else {
1314
+ itemsToRemoveFromCart.push(lineItem.id)
1315
+ }
1316
+ }
1317
+
1318
+ // If there are items to remove, call removeItemsFromCart
1319
+ if (itemsToRemoveFromCart.length > 0) {
1320
+ await removeItemsFromCart(
1321
+ itemsToRemoveFromCart,
1322
+ undefined,
1323
+ updatedGiftItemsInCart
1324
+ )
1325
+ return
1326
+ }
1327
+
1328
+ // If there are items to decrease quantity, call updateQuantityForLineItems
1329
+ if (itemsToDecreaseQuantity.length > 0) {
1330
+ await updateQuantityForLineItems(
1331
+ itemsToDecreaseQuantity,
1332
+ updatedGiftItemsInCart
1333
+ )
1334
+ return
1335
+ }
1336
+
1337
+ // Update the cart with the modified gift items
1338
+ cart.giftItemsInCart = updatedGiftItemsInCart
1339
+ await updateCart(cart, true)
1340
+ },
1341
+ updateCart: (cart: CartData, checkForGift: boolean) => {
1342
+ const globalSettings = get().config.data?.settings?.['global']
1343
+ const enableGroupQuantityRestriction =
1344
+ globalSettings?.enableGroupQuantityRestriction
1345
+ const groupQuantityRestrictions = globalSettings?.groupQuantityRestriction
1346
+
1347
+ cart.giftItemsInCart =
1348
+ cart.giftItemsInCart ?? get().cart.data.giftItemsInCart
1349
+ cart.eligibleGiftItems =
1350
+ cart.eligibleGiftItems ?? get().cart.data.eligibleGiftItems
1351
+
1352
+ // remove gift items from cart which is not present in the cart line items
1353
+ const giftItemsInCart = cart.giftItemsInCart?.filter((giftItem) => {
1354
+ return cart.lineItems?.find(
1355
+ (lineItem) => lineItem.variantId === giftItem.variantId
1356
+ )
1357
+ })
1358
+
1359
+ set((store) => {
1360
+ store.cart.status = 'idle'
1361
+ store.cart.data.lineItems = cart.lineItems
1362
+ store.cart.data.webUrl = cart.webUrl
1363
+ store.cart.data.count = calculateItemCount(cart.lineItems)
1364
+ store.cart.data.id = cart.id
1365
+ store.cart.data.payment = cart.payment
1366
+ store.cart.data.discount = cart.discount
1367
+ store.cart.data.discountCodes = cart.discountCodes || []
1368
+ store.cart.data.eligibleGiftItems = cart.eligibleGiftItems
1369
+ store.cart.data.updatedAt = new Date().getTime()
1370
+ store.cart.data.giftItemsInCart = giftItemsInCart
1371
+ store.cart.data.discountV2 = cart.discountV2
1372
+ store.cart.data.discountCodes = cart.discountCodes
1373
+ store.cart.data.lineItemsV2 = cart.lineItemsV2
1374
+ store.cart.data.note = cart.note
1375
+ store.cart.data.cartAttributes = cart.attributes
1376
+ if (enableGroupQuantityRestriction && groupQuantityRestrictions) {
1377
+ const map = getGroupRestrictionToQuantityMap(
1378
+ cart,
1379
+ groupQuantityRestrictions
1380
+ )
1381
+ store.cart.data.groupRestrictionsToQuantity = map
1382
+ }
1383
+ })
1384
+ for (const lineItem of cart.lineItems) {
1385
+ if (lineItem?.variant?.quantityAvailable) {
1386
+ get().products.updateVariantIdToQuantityAvailable(
1387
+ lineItem.variantId,
1388
+ lineItem.variant.quantityAvailable
1389
+ )
1390
+ }
1391
+ }
1392
+
1393
+ localStorage.set('cart', {
1394
+ id: cart.id,
1395
+ giftItemsInCart: giftItemsInCart,
1396
+ })
1397
+
1398
+ if (checkForGift) {
1399
+ return get().cart.applyFreeGifts(cart)
1400
+ }
1401
+ },
1402
+ applyFreeGifts: async (cart: Cart, couponCode?: string) => {
1403
+ const giftProvider = get().modules.getModule('gift') as GiftsProvider
1404
+
1405
+ cart.giftItemsInCart =
1406
+ cart.giftItemsInCart ?? get().cart.data.giftItemsInCart
1407
+ cart.eligibleGiftItems =
1408
+ cart.eligibleGiftItems ?? get().cart.data.eligibleGiftItems
1409
+
1410
+ if (giftProvider) {
1411
+ const { newEligibleGiftItemsList, existingGiftItemsToRemove } =
1412
+ giftProvider.applyGift(cart, couponCode)
1413
+ if (existingGiftItemsToRemove.length > 0) {
1414
+ if (giftProvider.useGiftV2CartFunctions) {
1415
+ await get().cart.removeGiftItemsV2(cart, existingGiftItemsToRemove)
1416
+ } else {
1417
+ await get().cart.removeGiftItems(cart, existingGiftItemsToRemove)
1418
+ }
1419
+ return
1420
+ }
1421
+ if (newEligibleGiftItemsList.length > 0) {
1422
+ await get().cart.addGiftItems(newEligibleGiftItemsList, cart)
1423
+ return { isGiftAdded: true }
1424
+ }
1425
+ }
1426
+ },
1427
+ resetCart: () => {
1428
+ set((store) => {
1429
+ store.cart.status = 'idle'
1430
+ store.cart.data.lineItems = []
1431
+ store.cart.data.webUrl = ''
1432
+ store.cart.data.count = 0
1433
+ store.cart.data.id = ''
1434
+ store.cart.data.payment = undefined
1435
+ store.cart.data.discount = undefined
1436
+ store.cart.data.eligibleGiftItems = []
1437
+ store.cart.data.giftItemsInCart = []
1438
+ store.cart.data.discountV2 = []
1439
+ store.cart.data.discountCodes = []
1440
+ store.cart.data.lineItemsV2 = []
1441
+ store.cart.data.updatedAt = undefined
1442
+ store.cart.data.groupRestrictionsToQuantity = new Map()
1443
+ store.cart.data.cartAttributes = {}
1444
+ localStorage.set('cart', { id: '' })
1445
+ })
1446
+ },
1447
+ updateCartAttributes: async (attributes) => {
1448
+ const cartId = get().cart.data.id as string
1449
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
1450
+ set((s) => {
1451
+ s.cart.status = 'loading'
1452
+ })
1453
+ const res = await cartModule.updateCartAttributes(cartId, attributes)
1454
+ set((s) => {
1455
+ s.cart.status = 'idle'
1456
+ })
1457
+ if (res.status === 'success') {
1458
+ const updateCart = get().cart.updateCart
1459
+ updateCart(res.data, false)
1460
+ }
1461
+ return res
1462
+ },
1463
+ clearGiftItems: () => {
1464
+ set((store) => {
1465
+ store.cart.data.eligibleGiftItems = []
1466
+ })
1467
+ },
1468
+ setCartStatus: (status) => {
1469
+ set((store) => {
1470
+ store.cart.status = status
1471
+ })
1472
+ },
1473
+ updateBuyerIdentity: async (buyerIdentity) => {
1474
+ const cartModule = get().modules.getModule<ICartProvider>('cart')
1475
+ const cartId =
1476
+ (get().cart.data.id as string) ||
1477
+ (localStorage.getJson<{ id: string }>('cart')?.id as string)
1478
+
1479
+ if (!cartId) return
1480
+ const res = await cartModule.updateBuyerIdentity(cartId, {
1481
+ ...buyerIdentity,
1482
+ email: buyerIdentity.email?.toLowerCase(),
1483
+ customerAccessToken: buyerIdentity.customerAccessToken,
1484
+ })
1485
+ if (res.status === 'success') get().cart.updateCart(res.data, false)
1486
+ if (res.status === 'success') {
1487
+ get().cart.updateCart(res.data, false)
1488
+ }
1489
+ },
1490
+ updateDummyProductToCart: (lineItems: LineItemToAdd[]) => {
1491
+ if (!lineItems.length) return
1492
+ set((store) => {
1493
+ store.cart.status = 'idle'
1494
+ store.cart.data.lineItems = lineItems
1495
+ store.cart.data.webUrl = ''
1496
+ store.cart.data.count = 1
1497
+ store.cart.data.id = ''
1498
+ store.cart.data.payment = {
1499
+ lineItemsSubTotal: lineItems[0].price,
1500
+ subTotal: lineItems[0].price,
1501
+ taxes: '0',
1502
+ total: lineItems[0].price,
1503
+ currencyCode: lineItems[0].currencyCode,
1504
+ taxesIncluded: true,
1505
+ }
1506
+ store.cart.data.discount = undefined
1507
+ store.cart.data.eligibleGiftItems = []
1508
+ store.cart.data.giftItemsInCart = []
1509
+ store.cart.data.updatedAt = undefined
1510
+ store.cart.data.groupRestrictionsToQuantity = new Map()
1511
+ localStorage.set('cart', { id: '' })
1512
+ })
1513
+ },
1514
+ },
1515
+ })
1516
+
1517
+ const APPBREW_INSTANCE_ID = 'appbrew-instance-id'
1518
+ function calculateItemCount(items: LineItem[]) {
1519
+ let count = 0
1520
+ for (const item of items) {
1521
+ count = count + item.quantity
1522
+ }
1523
+ return count
1524
+ }
1525
+
1526
+ interface GetShippingAddressInputParams {
1527
+ selectedCountry: Country | null
1528
+ configDefaultAddress: {
1529
+ country: string
1530
+ city: string
1531
+ province: string
1532
+ }
1533
+ localisationAddress: AsyncData<LocalisationUserInfo>
1534
+ userDefaultAddress: Maybe<MailingAddress>
1535
+ }
1536
+ function getShippingAddress({
1537
+ selectedCountry,
1538
+ configDefaultAddress,
1539
+ localisationAddress,
1540
+ userDefaultAddress,
1541
+ }: GetShippingAddressInputParams): {
1542
+ country: string
1543
+ city: string
1544
+ province: string
1545
+ } {
1546
+ const defaultValues = {
1547
+ country: 'India',
1548
+ city: '',
1549
+ province: '',
1550
+ }
1551
+ const address = {
1552
+ country: selectedCountry?.name ?? defaultValues.country,
1553
+ city: configDefaultAddress?.city ?? defaultValues.city,
1554
+ province: configDefaultAddress?.province ?? defaultValues.province,
1555
+ }
1556
+
1557
+ // if (localisationAddress.status === 'idle') {
1558
+ // address.city = 'abcd' //localisationAddress.data.city
1559
+ // address.province = 'efgh' //localisationAddress.data.province
1560
+ // address.country = '' //localisationAddress.data.country
1561
+ // }
1562
+ if (userDefaultAddress) {
1563
+ if (userDefaultAddress.city) address.city = userDefaultAddress.city
1564
+ if (userDefaultAddress.province)
1565
+ address.province = userDefaultAddress.province
1566
+ if (userDefaultAddress.country) address.country = userDefaultAddress.country
1567
+ }
1568
+ return address
1569
+ }
1570
+
1571
+ function transformCustomAttributesInput(attributes: any) {
1572
+ if (Array.isArray(attributes)) {
1573
+ return attributes
1574
+ } else if (attributes) {
1575
+ return Object.keys(attributes).map((key) => {
1576
+ return {
1577
+ key,
1578
+ value: attributes[key],
1579
+ }
1580
+ })
1581
+ } else {
1582
+ return []
1583
+ }
1584
+ }
1585
+
1586
+ function getGroupRestrictionToQuantityMap(
1587
+ cartData: CartData,
1588
+ groupRestrictions: Record<string, number>
1589
+ ): Map<string, number> {
1590
+ const map = new Map()
1591
+ if (!cartData) return map
1592
+ if (!cartData.lineItems) return map
1593
+ if (cartData.lineItems.length === 0) return map
1594
+
1595
+ cartData.lineItems.forEach((item) => {
1596
+ item.tags.forEach((tag) => {
1597
+ if (Object.prototype.hasOwnProperty.call(groupRestrictions, tag)) {
1598
+ const currentQuantity = map.get(tag) || 0
1599
+ map.set(tag, currentQuantity + item.quantity)
1600
+ }
1601
+ })
1602
+ })
1603
+ return map
1604
+ }
1605
+
1606
+ type Image = {
1607
+ id: string
1608
+ height?: number
1609
+ width?: number
1610
+ url: string
1611
+ }
1612
+ type CustomAttribute = {
1613
+ key: string
1614
+ value: string
1615
+ }
1616
+ type Price = {
1617
+ amount: number
1618
+ currencyCode: string
1619
+ }
1620
+ type CartLineCost = {
1621
+ amountPerQuantity: Price
1622
+ compareAtAmountPerQuantity: Price
1623
+ subtotalAmount: Price
1624
+ totalAmount: Price
1625
+ }
1626
+ type QuantityRule = {
1627
+ increment: number
1628
+ maximum: number | null
1629
+ minimum: number
1630
+ }
1631
+ type SellingPlanAllocationPriceAdjustment = {
1632
+ compareAtPrice: Price
1633
+ perDeliveryPrice: Price
1634
+ price: Price
1635
+ unitPrice: Price
1636
+ }
1637
+ type SellingPlan = {
1638
+ checkoutCharge: {
1639
+ type: 'PERCENTAGE' | 'PRICE'
1640
+ value: Price | { percentage: number }
1641
+ }
1642
+ description: string
1643
+ id: string
1644
+ name: string
1645
+ options: Array<{ name: string; value: string }>
1646
+ priceAdjustments: Array<{
1647
+ adjustmentValue:
1648
+ | { adjustmentAmount: Price }
1649
+ | { price: Price }
1650
+ | { adjustmentPercentage: number }
1651
+ orderCount: number
1652
+ }>
1653
+ recurringDeliveries: boolean
1654
+ }
1655
+ type SellingPlanAllocation = {
1656
+ checkoutChargeAmount: Price
1657
+ priceAdjustments: Array<SellingPlanAllocationPriceAdjustment>
1658
+ remainingBalanceChargeAmount: Price
1659
+ sellingPlan: Array<SellingPlan>
1660
+ }
1661
+
1662
+ export type BaseLineItemV2 = {
1663
+ type: 'BASE' | 'FREE_GIFT' | 'SUBSCRIPTION'
1664
+ id: string
1665
+ attributes: Array<CustomAttribute>
1666
+ cost: CartLineCost
1667
+ discountAllocations: Array<DiscountAllocationBase>
1668
+ quantity: number
1669
+ merchandise: {
1670
+ id: ProductVariantId
1671
+ title: string
1672
+ image: Image
1673
+ availableForSale: boolean
1674
+ currentlyNotInStock: boolean
1675
+ quantityAvailable: number
1676
+ quantityRule: QuantityRule
1677
+ requiresShipping: boolean
1678
+ selectedOptions: Array<{ name: string; value: string }>
1679
+ sku: string
1680
+ taxable: string
1681
+ price: Price
1682
+ compareAtPrice: Price
1683
+ product: {
1684
+ id: string
1685
+ title: string
1686
+ handle: string
1687
+ tags: Set<string>
1688
+ }
1689
+ }
1690
+ sellingPlanAllocations: Array<SellingPlanAllocation> | null
1691
+ }
1692
+ export type LineItemV2 = BaseLineItemV2[] | []
1693
+
1694
+ //Cart type as received by updateCart
1695
+
1696
+ type SelectedOption = {
1697
+ name: string
1698
+ value: string
1699
+ __typename: string
1700
+ }
1701
+
1702
+ type Variant = {
1703
+ id: string
1704
+ selectedOptions: SelectedOption[]
1705
+ quantityAvailable?: number
1706
+ }
1707
+
1708
+ type LineItem = {
1709
+ currencyCode: string
1710
+ id: string
1711
+ productId: string
1712
+ productHandle: string
1713
+ tags: string[]
1714
+ image: string
1715
+ price: string
1716
+ priceAfterDiscount: string
1717
+ quantity: number
1718
+ title: string
1719
+ variantId: string
1720
+ originalPrice: string
1721
+ customAttributes: Record<string, unknown>
1722
+ variant: Variant
1723
+ }
1724
+
1725
+ type Payment = {
1726
+ lineItemsSubTotal: string
1727
+ subTotal: string
1728
+ taxes: string
1729
+ total: string
1730
+ currencyCode: string
1731
+ taxesIncluded: boolean
1732
+ }
1733
+
1734
+ type CartData = {
1735
+ id: string
1736
+ completedAt: string | null
1737
+ order: unknown | null
1738
+ lineItems: LineItem[]
1739
+ webUrl: string
1740
+ payment: Payment
1741
+ discount: Record<string, unknown>
1742
+ giftItemsInCart: unknown[]
1743
+ eligibleGiftItems: unknown[]
1744
+ discountCodes: string[]
1745
+ }
1746
+
1747
+ function setUserAddressFromLocalization() {
1748
+ const state = useAppStore.getState()
1749
+ const addressSlice = state.address
1750
+ const userDetails = state.user.data.userDetails
1751
+ const isMultiCurrencyEnabled =
1752
+ state.config.data?.settings?.['global']?.enableMultiCurrencyV4
1753
+ if (!isMultiCurrencyEnabled) return
1754
+ if (userDetails.status !== 'idle') return
1755
+
1756
+ const country = state.localization.data.selectedCountry
1757
+
1758
+ const addressList = userDetails.data.addresses
1759
+ let localeCountryNotInAddressList = true
1760
+
1761
+ if (country?.name && addressList?.edges?.length) {
1762
+ for (const address of addressList.edges) {
1763
+ if (address.node && address.node.countryCodeV2 === country.isoCode) {
1764
+ localeCountryNotInAddressList = false
1765
+ addressSlice.changeAddress(
1766
+ address.node.id,
1767
+ address.node as Partial<AddressItem>
1768
+ )
1769
+
1770
+ // first match
1771
+ break
1772
+ }
1773
+ }
1774
+ }
1775
+
1776
+ if (localeCountryNotInAddressList) {
1777
+ addressSlice.changeAddress('', undefined)
1778
+ }
1779
+ }