@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.
- package/package.json +99 -0
- package/src/analytics/src/analytics-provider-v2.ts +288 -0
- package/src/analytics/src/analytics-provider-v2.web.ts +36 -0
- package/src/analytics/src/analytics-provider.ts +266 -0
- package/src/analytics/src/analytics-provider.web.ts +48 -0
- package/src/analytics/src/analytics-tracker-v2.ts +96 -0
- package/src/analytics/src/anaylytics-tracker.ts +96 -0
- package/src/analytics/src/index.ts +6 -0
- package/src/analytics/src/user-permission.ts +1 -0
- package/src/analytics/src/utils.ts +162 -0
- package/src/app-update/src/index.ts +1 -0
- package/src/app-update/src/lib/app-update.ts +45 -0
- package/src/block-registry/src/common.tsx +439 -0
- package/src/block-registry/src/common.web.tsx +46 -0
- package/src/block-registry/src/index.ts +1 -0
- package/src/block-registry/src/keys.ts +43 -0
- package/src/block-registry/src/register.tsx +66 -0
- package/src/block-registry/src/register.web.tsx +129 -0
- package/src/bottom-sheet/src/block-bottom-sheet.tsx +183 -0
- package/src/bottom-sheet/src/block-bottom-sheet.web.tsx +4 -0
- package/src/bottom-sheet/src/bottom-sheet.tsx +269 -0
- package/src/bottom-sheet/src/bottom-sheet.web.tsx +13 -0
- package/src/bottom-sheet/src/index.ts +3 -0
- package/src/brewery/babel.config.js +3 -0
- package/src/brewery/src/ModalBrewery.tsx +222 -0
- package/src/brewery/src/ScreenBrewery.tsx +415 -0
- package/src/brewery/src/ScreenContainer.tsx +76 -0
- package/src/brewery/src/ScreenContextProvider.tsx +27 -0
- package/src/brewery/src/app-init.tsx +507 -0
- package/src/brewery/src/common.ts +5 -0
- package/src/brewery/src/default-content.tsx +234 -0
- package/src/brewery/src/index.ts +8 -0
- package/src/brewery/src/lazy-screen.tsx +101 -0
- package/src/brewery/src/onboarding-screen.tsx +31 -0
- package/src/brewery/src/plp-content.tsx +19 -0
- package/src/brewery/src/preview-footer.tsx +83 -0
- package/src/brewery/src/profile-screen.tsx +74 -0
- package/src/brewery/src/refreshing-screen.tsx +129 -0
- package/src/brewery/src/safe-area-container.tsx +1 -0
- package/src/brewery/src/screen-content.tsx +89 -0
- package/src/brewery/src/secondary-splash-screen.tsx +190 -0
- package/src/brewery/src/shell.tsx +509 -0
- package/src/brewery/src/tab-bar.tsx +252 -0
- package/src/brewery/src/tabbed-brewery.tsx +175 -0
- package/src/brewery/src/templates.ts +87 -0
- package/src/brewery/src/types.ts +123 -0
- package/src/brewery/src/utils/bottombar.tsx +266 -0
- package/src/brewery/src/utils/colorUtils.ts +71 -0
- package/src/brewery/src/utils/createBottombarVisibility.ts +48 -0
- package/src/brewery/src/utils/index.tsx +3 -0
- package/src/brewery/src/utils/renderItem.tsx +112 -0
- package/src/brewery/src/utils/screens.tsx +270 -0
- package/src/brewery/src/utils/tabReload.ts +57 -0
- package/src/brewery/test-setup.ts +1 -0
- package/src/child-navigator/babel.config.js +3 -0
- package/src/child-navigator/src/index.tsx +52 -0
- package/src/child-navigator/src/view.tsx +197 -0
- package/src/components/babel.config.js +3 -0
- package/src/components/src/atoms/badge/index.tsx +85 -0
- package/src/components/src/atoms/block-section/index.ts +6 -0
- package/src/components/src/atoms/button/index.tsx +112 -0
- package/src/components/src/atoms/check-box/index.tsx +57 -0
- package/src/components/src/atoms/countdown-timer/index.tsx +48 -0
- package/src/components/src/atoms/country-selector/constants.ts +3 -0
- package/src/components/src/atoms/country-selector/index.tsx +146 -0
- package/src/components/src/atoms/date-picker/calendar-date-picker.tsx +509 -0
- package/src/components/src/atoms/date-picker/index.tsx +93 -0
- package/src/components/src/atoms/flex/index.tsx +24 -0
- package/src/components/src/atoms/header/index.ts +2 -0
- package/src/components/src/atoms/header/types.ts +1 -0
- package/src/components/src/atoms/icon/index.tsx +31 -0
- package/src/components/src/atoms/icon-button/index.tsx +29 -0
- package/src/components/src/atoms/image/image1.tsx +8 -0
- package/src/components/src/atoms/image/image1.web.tsx +5 -0
- package/src/components/src/atoms/image/index.ts +1 -0
- package/src/components/src/atoms/image/types.ts +12 -0
- package/src/components/src/atoms/input/index.tsx +34 -0
- package/src/components/src/atoms/link/index.tsx +60 -0
- package/src/components/src/atoms/password-input/index.tsx +89 -0
- package/src/components/src/atoms/product-card-button/index.tsx +203 -0
- package/src/components/src/atoms/radio-group-input/index.tsx +84 -0
- package/src/components/src/atoms/rating-input/index.tsx +47 -0
- package/src/components/src/atoms/safe-area-container.tsx +29 -0
- package/src/components/src/atoms/section/index.ts +1 -0
- package/src/components/src/atoms/section/section.tsx +76 -0
- package/src/components/src/atoms/select/index.tsx +100 -0
- package/src/components/src/atoms/spacer/index.tsx +26 -0
- package/src/components/src/atoms/stars/index.tsx +124 -0
- package/src/components/src/atoms/stars/star-filled.png +0 -0
- package/src/components/src/atoms/stars/star-unfilled.png +0 -0
- package/src/components/src/atoms/text/index.tsx +1 -0
- package/src/components/src/atoms/video/index.tsx +242 -0
- package/src/components/src/atoms/video/index.web.tsx +144 -0
- package/src/components/src/blocks/base-blocks/base-rich-text/index.tsx +49 -0
- package/src/components/src/blocks/bundle-list-block/index.tsx +21 -0
- package/src/components/src/blocks/divider-block/index.tsx +22 -0
- package/src/components/src/blocks/dummy/index.tsx +3 -0
- package/src/components/src/blocks/manage-address-form-block/index.tsx +172 -0
- package/src/components/src/blocks/otp-signin/hooks.tsx +180 -0
- package/src/components/src/blocks/otp-signin/index.tsx +139 -0
- package/src/components/src/blocks/otp-verification/hooks.tsx +304 -0
- package/src/components/src/blocks/otp-verification/index.tsx +212 -0
- package/src/components/src/blocks/prefetch-metafields/index.tsx +16 -0
- package/src/components/src/blocks/product-card-block/index.tsx +53 -0
- package/src/components/src/blocks/product-card-block-v2/index.tsx +71 -0
- package/src/components/src/blocks/product-card-block-v2/index.web.tsx +76 -0
- package/src/components/src/blocks/product-recommendations-block/index.tsx +152 -0
- package/src/components/src/blocks/product-recommendations-block/index.web.tsx +175 -0
- package/src/components/src/blocks/rich-text-block/index.tsx +1 -0
- package/src/components/src/blocks/rich-text-block/rich-text.tsx +117 -0
- package/src/components/src/blocks/rich-text-block/rich-text.web.tsx +91 -0
- package/src/components/src/blocks/social-signin/index.tsx +46 -0
- package/src/components/src/blocks/status-bar-block/index.tsx +28 -0
- package/src/components/src/blocks/variant-selector-2-block/index.tsx +58 -0
- package/src/components/src/blocks/variant-selector-3-block/index.tsx +44 -0
- package/src/components/src/declaration.d.ts +4 -0
- package/src/components/src/hocs/withMetafield.tsx +109 -0
- package/src/components/src/index.ts +13 -0
- package/src/components/src/molecules/accordion/index.tsx +8 -0
- package/src/components/src/molecules/add-to-cart/index.tsx +471 -0
- package/src/components/src/molecules/address/addressCard.tsx +171 -0
- package/src/components/src/molecules/address-form/index.tsx +270 -0
- package/src/components/src/molecules/announcement-strip/icon.tsx +47 -0
- package/src/components/src/molecules/announcement-strip/index.tsx +51 -0
- package/src/components/src/molecules/app-bar/buttons/back.tsx +59 -0
- package/src/components/src/molecules/app-bar/buttons/cart.tsx +63 -0
- package/src/components/src/molecules/app-bar/buttons/index.ts +6 -0
- package/src/components/src/molecules/app-bar/buttons/logo.tsx +46 -0
- package/src/components/src/molecules/app-bar/buttons/logo.web.tsx +42 -0
- package/src/components/src/molecules/app-bar/buttons/profile.tsx +25 -0
- package/src/components/src/molecules/app-bar/buttons/search.tsx +23 -0
- package/src/components/src/molecules/app-bar/buttons/wishlist.tsx +27 -0
- package/src/components/src/molecules/app-bar/expanded-search.tsx +28 -0
- package/src/components/src/molecules/app-bar/index.tsx +308 -0
- package/src/components/src/molecules/app-bar/index.web.tsx +284 -0
- package/src/components/src/molecules/appbar-layout-elements.tsx +71 -0
- package/src/components/src/molecules/appbar-template/back.tsx +20 -0
- package/src/components/src/molecules/appbar-template/cart.tsx +39 -0
- package/src/components/src/molecules/appbar-template/default.tsx +52 -0
- package/src/components/src/molecules/appbar-template/index.tsx +93 -0
- package/src/components/src/molecules/appbar-template/minimal.tsx +27 -0
- package/src/components/src/molecules/appbar-template/tabs.tsx +41 -0
- package/src/components/src/molecules/appbar-template/wishlist.tsx +42 -0
- package/src/components/src/molecules/appbar-v2/appbar-v2.tsx +497 -0
- package/src/components/src/molecules/appbar-v2/appbar-v2.web.tsx +512 -0
- package/src/components/src/molecules/appbar-v2/appbar-variants/back.ts +42 -0
- package/src/components/src/molecules/appbar-v2/appbar-variants/cart.ts +183 -0
- package/src/components/src/molecules/appbar-v2/appbar-variants/default.ts +189 -0
- package/src/components/src/molecules/appbar-v2/appbar-variants/minimal.ts +52 -0
- package/src/components/src/molecules/appbar-v2/appbar-variants/tabs.ts +170 -0
- package/src/components/src/molecules/appbar-v2/appbar-variants/wishlist.ts +180 -0
- package/src/components/src/molecules/appbar-v2/appbar-variants.ts +15 -0
- package/src/components/src/molecules/appbar-v2/index.ts +2 -0
- package/src/components/src/molecules/avatar/index.tsx +43 -0
- package/src/components/src/molecules/base-accordion-list/index.tsx +56 -0
- package/src/components/src/molecules/bottom-bar/bottom-bar.tsx +11 -0
- package/src/components/src/molecules/bottom-bar/bottom-bar.web.tsx +111 -0
- package/src/components/src/molecules/bottom-bar/index.tsx +1 -0
- package/src/components/src/molecules/bundle-list-item/index.tsx +200 -0
- package/src/components/src/molecules/carousel/carousel-item.tsx +206 -0
- package/src/components/src/molecules/carousel/eye-close.tsx +19 -0
- package/src/components/src/molecules/carousel/horizontal-carousel.tsx +418 -0
- package/src/components/src/molecules/carousel/index.tsx +85 -0
- package/src/components/src/molecules/carousel/index.web.tsx +111 -0
- package/src/components/src/molecules/carousel/indicator.tsx +133 -0
- package/src/components/src/molecules/carousel/indicator.web.tsx +77 -0
- package/src/components/src/molecules/carousel/rich-subtitle.tsx +27 -0
- package/src/components/src/molecules/carousel/rich-subtitle.web.tsx +31 -0
- package/src/components/src/molecules/carousel/types.ts +41 -0
- package/src/components/src/molecules/carousel/utils.ts +116 -0
- package/src/components/src/molecules/carousel/v2.tsx +46 -0
- package/src/components/src/molecules/carousel/vertical-carousel.tsx +275 -0
- package/src/components/src/molecules/cart-goals/components/amount-saved.tsx +82 -0
- package/src/components/src/molecules/cart-goals/components/goal-achieved/label.tsx +56 -0
- package/src/components/src/molecules/cart-goals/components/header.tsx +106 -0
- package/src/components/src/molecules/cart-goals/components/ineligible-text.tsx +61 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-layout/index.tsx +27 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-1.tsx +50 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-10.tsx +53 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-2.tsx +43 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-3.tsx +44 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-4.tsx +53 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-layout/style-7.tsx +44 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-layout/types.ts +13 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/CircleWithProgress.tsx +94 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/constants.ts +6 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/index.tsx +28 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-1.tsx +183 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-10.tsx +242 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-2.tsx +160 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-3.tsx +113 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-4-utils.ts +39 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-4.tsx +216 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/style-7.tsx +113 -0
- package/src/components/src/molecules/cart-goals/components/multi-tier-progress/types.ts +18 -0
- package/src/components/src/molecules/cart-goals/components/single-tier-progress.tsx +210 -0
- package/src/components/src/molecules/cart-goals/components/success-modal/index.tsx +117 -0
- package/src/components/src/molecules/cart-goals/haptics.ts +40 -0
- package/src/components/src/molecules/cart-goals/index.tsx +2 -0
- package/src/components/src/molecules/cart-goals/multi-tier-utils.ts +139 -0
- package/src/components/src/molecules/cart-goals/multi-tier.tsx +466 -0
- package/src/components/src/molecules/cart-goals/single-tier-utils.ts +45 -0
- package/src/components/src/molecules/cart-goals/single-tier.tsx +521 -0
- package/src/components/src/molecules/cart-goals/types.ts +105 -0
- package/src/components/src/molecules/cart-goals/use-goal-success-modal.tsx +103 -0
- package/src/components/src/molecules/cart-goals/use-tier-change.ts +42 -0
- package/src/components/src/molecules/cart-goals/utils.ts +153 -0
- package/src/components/src/molecules/checkout-bar/index.tsx +155 -0
- package/src/components/src/molecules/checkout-bar-v2/cart-custom-attributes-interceptor.tsx +130 -0
- package/src/components/src/molecules/checkout-bar-v2/circle.tsx +63 -0
- package/src/components/src/molecules/checkout-bar-v2/goals.tsx +391 -0
- package/src/components/src/molecules/checkout-bar-v2/goals.web.tsx +374 -0
- package/src/components/src/molecules/checkout-bar-v2/index.tsx +267 -0
- package/src/components/src/molecules/checkout-bar-v2/index.web.tsx +115 -0
- package/src/components/src/molecules/checkout-bar-v2/interceptor.tsx +73 -0
- package/src/components/src/molecules/checkout-bar-v2/out-of-stock-modal/index.tsx +216 -0
- package/src/components/src/molecules/checkout-bar-v2/out-of-stock-modal/item.tsx +94 -0
- package/src/components/src/molecules/checkout-bar-v2/out-of-stock-modal/styles.ts +136 -0
- package/src/components/src/molecules/chips-navigation/chip.tsx +83 -0
- package/src/components/src/molecules/chips-navigation/horizontal.tsx +140 -0
- package/src/components/src/molecules/chips-navigation/horizontal.web.tsx +145 -0
- package/src/components/src/molecules/chips-navigation/index.tsx +13 -0
- package/src/components/src/molecules/chips-navigation/index.web.ts +13 -0
- package/src/components/src/molecules/chips-navigation/utils.ts +35 -0
- package/src/components/src/molecules/chips-navigation/vertical.tsx +108 -0
- package/src/components/src/molecules/choice-sheet-content/index.tsx +111 -0
- package/src/components/src/molecules/confirmation-popup/index.tsx +51 -0
- package/src/components/src/molecules/controlled-video/index.tsx +316 -0
- package/src/components/src/molecules/currency-selection-prompt/index.tsx +24 -0
- package/src/components/src/molecules/currency-selector/index.tsx +244 -0
- package/src/components/src/molecules/currency-selector/layout-element.tsx +24 -0
- package/src/components/src/molecules/direct-navigation/index.tsx +48 -0
- package/src/components/src/molecules/discount-label/index.tsx +55 -0
- package/src/components/src/molecules/divider/index.tsx +23 -0
- package/src/components/src/molecules/dropdown-picker/index.tsx +217 -0
- package/src/components/src/molecules/empty-screen-v2/index.tsx +83 -0
- package/src/components/src/molecules/fallback/index.tsx +70 -0
- package/src/components/src/molecules/filter/color-filter.tsx +173 -0
- package/src/components/src/molecules/filter/index.tsx +244 -0
- package/src/components/src/molecules/filter/index.web.tsx +111 -0
- package/src/components/src/molecules/filter/selectors.tsx +623 -0
- package/src/components/src/molecules/form-input/index.tsx +451 -0
- package/src/components/src/molecules/full-screen-loading/index.tsx +20 -0
- package/src/components/src/molecules/generic-form/common.tsx +298 -0
- package/src/components/src/molecules/generic-form/index.tsx +131 -0
- package/src/components/src/molecules/generic-form/types.tsx +30 -0
- package/src/components/src/molecules/generic-product-card/card.tsx +5 -0
- package/src/components/src/molecules/generic-product-card/card.web.tsx +1 -0
- package/src/components/src/molecules/generic-product-card/cardV2.tsx +342 -0
- package/src/components/src/molecules/generic-product-card/common.tsx +590 -0
- package/src/components/src/molecules/generic-product-card/index.tsx +2 -0
- package/src/components/src/molecules/generic-product-card/tags.tsx +178 -0
- package/src/components/src/molecules/generic-product-card/types.tsx +219 -0
- package/src/components/src/molecules/generic-product-card/wrapper.tsx +39 -0
- package/src/components/src/molecules/gift-item-card/index.tsx +44 -0
- package/src/components/src/molecules/gift-item-selected-card/index.tsx +28 -0
- package/src/components/src/molecules/hidden-block/index.tsx +8 -0
- package/src/components/src/molecules/hidden-block/index.web.tsx +81 -0
- package/src/components/src/molecules/image-compare/index.tsx +236 -0
- package/src/components/src/molecules/image-compare/index.web.tsx +213 -0
- package/src/components/src/molecules/image-navigation/index.tsx +32 -0
- package/src/components/src/molecules/image-preview/image-preview.tsx +295 -0
- package/src/components/src/molecules/image-preview/image-preview.web.tsx +157 -0
- package/src/components/src/molecules/image-preview-2/close-icon-button.tsx +11 -0
- package/src/components/src/molecules/image-preview-2/constants.ts +2 -0
- package/src/components/src/molecules/image-preview-2/footer-item.tsx +52 -0
- package/src/components/src/molecules/image-preview-2/footer.tsx +58 -0
- package/src/components/src/molecules/image-preview-2/index.tsx +139 -0
- package/src/components/src/molecules/image-preview-2/types.ts +72 -0
- package/src/components/src/molecules/image-text/index.tsx +139 -0
- package/src/components/src/molecules/line-item/index.tsx +45 -0
- package/src/components/src/molecules/list-item/index.tsx +758 -0
- package/src/components/src/molecules/loader/index.tsx +40 -0
- package/src/components/src/molecules/menu/accordion/image-menu-accordion-list.tsx +114 -0
- package/src/components/src/molecules/menu/accordion/text-menu-accordion-list.tsx +111 -0
- package/src/components/src/molecules/menu/common/horizontal-menu-list.tsx +279 -0
- package/src/components/src/molecules/menu/common/menu-accordion.tsx +69 -0
- package/src/components/src/molecules/menu/common/menu-grid.tsx +179 -0
- package/src/components/src/molecules/menu/common/vertical-menu-list.tsx +197 -0
- package/src/components/src/molecules/menu/common/vertical-menu-list.web.tsx +196 -0
- package/src/components/src/molecules/menu/expandable-grid/image-menu-expandable-grid.tsx +128 -0
- package/src/components/src/molecules/menu/expandable-grid/text-menu-expandable-grid.tsx +107 -0
- package/src/components/src/molecules/menu/grid/image-menu-grid.tsx +58 -0
- package/src/components/src/molecules/menu/grid/text-menu-grid.tsx +55 -0
- package/src/components/src/molecules/menu/index.tsx +38 -0
- package/src/components/src/molecules/menu/item/image-menu-item.tsx +226 -0
- package/src/components/src/molecules/menu/item/text-menu-item.tsx +174 -0
- package/src/components/src/molecules/menu/list/horizontal-image-menu-list.tsx +55 -0
- package/src/components/src/molecules/menu/list/horizontal-text-menu-list.tsx +53 -0
- package/src/components/src/molecules/menu/list/image-menu-list.tsx +38 -0
- package/src/components/src/molecules/menu/list/text-menu-list.tsx +38 -0
- package/src/components/src/molecules/menu/list/vertical-image-menu-list.tsx +58 -0
- package/src/components/src/molecules/menu/list/vertical-text-menu-list.tsx +52 -0
- package/src/components/src/molecules/menu/sub-menu-item.tsx +50 -0
- package/src/components/src/molecules/menu/tabs/horizontal-image-menu-tabs.tsx +211 -0
- package/src/components/src/molecules/menu/tabs/horizontal-text-menu-tabs.tsx +211 -0
- package/src/components/src/molecules/menu/tabs/image-menu-tabs.tsx +52 -0
- package/src/components/src/molecules/menu/tabs/text-menu-tabs.tsx +49 -0
- package/src/components/src/molecules/menu/tabs/vertical-image-menu-tabs.tsx +224 -0
- package/src/components/src/molecules/menu/tabs/vertical-text-menu-tabs.tsx +222 -0
- package/src/components/src/molecules/menu/types.ts +580 -0
- package/src/components/src/molecules/menu/utils.ts +229 -0
- package/src/components/src/molecules/metafield-tag/index.tsx +36 -0
- package/src/components/src/molecules/metafield-tag/index.web.tsx +3 -0
- package/src/components/src/molecules/metafield-text/index.tsx +47 -0
- package/src/components/src/molecules/no-internet-block/index.tsx +43 -0
- package/src/components/src/molecules/only-text-navigation.tsx/index.tsx +79 -0
- package/src/components/src/molecules/order-item/index.tsx +108 -0
- package/src/components/src/molecules/payment-bar/index.tsx +139 -0
- package/src/components/src/molecules/pdp-quantity-selector/index.tsx +44 -0
- package/src/components/src/molecules/phone-country-input/index.tsx +153 -0
- package/src/components/src/molecules/phone-input/index.tsx +287 -0
- package/src/components/src/molecules/phone-input/index.web.tsx +21 -0
- package/src/components/src/molecules/price-box/index.tsx +54 -0
- package/src/components/src/molecules/price-text/index.tsx +40 -0
- package/src/components/src/molecules/product-card/index.tsx +162 -0
- package/src/components/src/molecules/product-card/wishlist/index.tsx +35 -0
- package/src/components/src/molecules/product-card-with-carousel/index.tsx +139 -0
- package/src/components/src/molecules/product-collection/GotoLinkButton.tsx +59 -0
- package/src/components/src/molecules/product-collection/GotoLinkButton.web.tsx +65 -0
- package/src/components/src/molecules/product-collection/index.tsx +458 -0
- package/src/components/src/molecules/product-collection/wrapper.tsx +224 -0
- package/src/components/src/molecules/product-components/add-to-bundle.tsx +19 -0
- package/src/components/src/molecules/product-components/add-to-cart.tsx +708 -0
- package/src/components/src/molecules/product-components/add-to-cart.web.tsx +398 -0
- package/src/components/src/molecules/product-components/add-to-wishlist-v2.tsx +43 -0
- package/src/components/src/molecules/product-components/add-to-wishlist.tsx +42 -0
- package/src/components/src/molecules/product-components/avg-ratings.tsx +56 -0
- package/src/components/src/molecules/product-components/carousel.tsx +85 -0
- package/src/components/src/molecules/product-components/color-swatch.tsx +81 -0
- package/src/components/src/molecules/product-components/compare-at-price.tsx +52 -0
- package/src/components/src/molecules/product-components/delete-from-wishlist.tsx +39 -0
- package/src/components/src/molecules/product-components/discount-label.tsx +109 -0
- package/src/components/src/molecules/product-components/goto-button-v2.tsx +42 -0
- package/src/components/src/molecules/product-components/hooks/carousel.ts +160 -0
- package/src/components/src/molecules/product-components/image.tsx +132 -0
- package/src/components/src/molecules/product-components/in-stock.tsx +86 -0
- package/src/components/src/molecules/product-components/index.tsx +25 -0
- package/src/components/src/molecules/product-components/metafield-rich-text.tsx +61 -0
- package/src/components/src/molecules/product-components/metafield-shopify-richtext.tsx +54 -0
- package/src/components/src/molecules/product-components/metafield-text.tsx +48 -0
- package/src/components/src/molecules/product-components/min-variant-price.tsx +48 -0
- package/src/components/src/molecules/product-components/move-to-cart.tsx +35 -0
- package/src/components/src/molecules/product-components/notify-me.tsx +93 -0
- package/src/components/src/molecules/product-components/open-modal.tsx +35 -0
- package/src/components/src/molecules/product-components/overlay.tsx +25 -0
- package/src/components/src/molecules/product-components/price.tsx +64 -0
- package/src/components/src/molecules/product-components/product-tag-v2.tsx +108 -0
- package/src/components/src/molecules/product-components/product-tag.tsx +56 -0
- package/src/components/src/molecules/product-components/product-type.tsx +32 -0
- package/src/components/src/molecules/product-components/product-variant-options.tsx +69 -0
- package/src/components/src/molecules/product-components/product-variant-selector-3.tsx +67 -0
- package/src/components/src/molecules/product-components/product-vendor.tsx +36 -0
- package/src/components/src/molecules/product-components/quantity-selector.tsx +307 -0
- package/src/components/src/molecules/product-components/quantity-selector.web.tsx +332 -0
- package/src/components/src/molecules/product-components/ratings-count.tsx +57 -0
- package/src/components/src/molecules/product-components/scarcity-counter.tsx +159 -0
- package/src/components/src/molecules/product-components/selling-plan-compare-at-price.tsx +43 -0
- package/src/components/src/molecules/product-components/selling-plan-discount.tsx +42 -0
- package/src/components/src/molecules/product-components/selling-plan-price.tsx +44 -0
- package/src/components/src/molecules/product-components/share-icon.tsx +49 -0
- package/src/components/src/molecules/product-components/spacer.tsx +18 -0
- package/src/components/src/molecules/product-components/star-ratings.tsx +48 -0
- package/src/components/src/molecules/product-components/text-tag.tsx +36 -0
- package/src/components/src/molecules/product-components/title.tsx +34 -0
- package/src/components/src/molecules/product-components/title.web.tsx +34 -0
- package/src/components/src/molecules/product-components/types.tsx +7 -0
- package/src/components/src/molecules/product-components/upsell-product-price.tsx +82 -0
- package/src/components/src/molecules/product-components/utils/add-to-cart.ts +108 -0
- package/src/components/src/molecules/product-components/utils/selected-selling-plan.ts +32 -0
- package/src/components/src/molecules/product-components/utils/selling-plan-compare-at-price.ts +36 -0
- package/src/components/src/molecules/product-components/utils/selling-plan-discount.ts +64 -0
- package/src/components/src/molecules/product-components/utils/selling-plan-price.ts +36 -0
- package/src/components/src/molecules/product-components/variant-selector.tsx +88 -0
- package/src/components/src/molecules/product-components/variant-sku.tsx +35 -0
- package/src/components/src/molecules/product-description-with-tags/index.tsx +56 -0
- package/src/components/src/molecules/product-group/index.tsx +64 -0
- package/src/components/src/molecules/product-group/product-group-list.tsx +64 -0
- package/src/components/src/molecules/product-image/index.tsx +143 -0
- package/src/components/src/molecules/product-tag/index.tsx +33 -0
- package/src/components/src/molecules/product-title/index.tsx +28 -0
- package/src/components/src/molecules/product-vendor/index.tsx +18 -0
- package/src/components/src/molecules/product-video/index.tsx +80 -0
- package/src/components/src/molecules/profile/index.tsx +0 -0
- package/src/components/src/molecules/quantity-selector/index.tsx +596 -0
- package/src/components/src/molecules/review-label/index.tsx +33 -0
- package/src/components/src/molecules/rich-text/index.tsx +1 -0
- package/src/components/src/molecules/rich-text/rich-text.tsx +1 -0
- package/src/components/src/molecules/rich-text/rich-text.web.tsx +1 -0
- package/src/components/src/molecules/search-input/index.tsx +248 -0
- package/src/components/src/molecules/sheet-header/index.tsx +55 -0
- package/src/components/src/molecules/shipping-address-label/index.tsx +67 -0
- package/src/components/src/molecules/simple-image-text/index.tsx +85 -0
- package/src/components/src/molecules/single-product-card/index.tsx +27 -0
- package/src/components/src/molecules/size-guide/index.tsx +187 -0
- package/src/components/src/molecules/skeleton/index.tsx +47 -0
- package/src/components/src/molecules/skeleton/index.web.tsx +18 -0
- package/src/components/src/molecules/skeleton/product-card.tsx +52 -0
- package/src/components/src/molecules/social-sign-in/apple-signin.tsx +88 -0
- package/src/components/src/molecules/social-sign-in/apple-signin.web.ts +4 -0
- package/src/components/src/molecules/social-sign-in/google-signin.tsx +105 -0
- package/src/components/src/molecules/social-sign-in/google-signin.web.ts +3 -0
- package/src/components/src/molecules/social-sign-in/social-auth.tsx +83 -0
- package/src/components/src/molecules/social-sign-in/social-signin-layout-item.tsx +54 -0
- package/src/components/src/molecules/social-sign-in/truecaller-signin.tsx +103 -0
- package/src/components/src/molecules/sub-navigations/index.tsx +169 -0
- package/src/components/src/molecules/subscription-v2/index.tsx +47 -0
- package/src/components/src/molecules/subscription-v2/subscription.tsx +356 -0
- package/src/components/src/molecules/subscription-v2/subscriptions-option-modal.tsx +78 -0
- package/src/components/src/molecules/switch/index.tsx +72 -0
- package/src/components/src/molecules/tab-selector/index.tsx +160 -0
- package/src/components/src/molecules/tab-view/index.tsx +2 -0
- package/src/components/src/molecules/tab-view/tab-item.tsx +67 -0
- package/src/components/src/molecules/tab-view/tab-pane.tsx +13 -0
- package/src/components/src/molecules/tab-view/tabs.tsx +64 -0
- package/src/components/src/molecules/text-carousel/index.tsx +111 -0
- package/src/components/src/molecules/text-label/index.tsx +36 -0
- package/src/components/src/molecules/toasts/add-to-cart-toast.tsx +48 -0
- package/src/components/src/molecules/toasts/brew-error-toast.tsx +49 -0
- package/src/components/src/molecules/toasts/brew-success-toast.tsx +55 -0
- package/src/components/src/molecules/toasts/index.tsx +3 -0
- package/src/components/src/molecules/trending-pillet/index.tsx +48 -0
- package/src/components/src/molecules/variant-item-selector/index.tsx +171 -0
- package/src/components/src/molecules/variant-selector-2/index.tsx +669 -0
- package/src/components/src/molecules/variant-selector-3/default-color-item.tsx +120 -0
- package/src/components/src/molecules/variant-selector-3/default-shopify-color.tsx +167 -0
- package/src/components/src/molecules/variant-selector-3/default-variant-image.tsx +82 -0
- package/src/components/src/molecules/variant-selector-3/index.tsx +114 -0
- package/src/components/src/molecules/variant-selector-3/option-items.tsx +171 -0
- package/src/components/src/molecules/variant-selector-3/option-list.tsx +86 -0
- package/src/components/src/molecules/variant-selector-3/option.tsx +42 -0
- package/src/components/src/molecules/variant-selector-3/utils.ts +131 -0
- package/src/components/src/molecules/variant-selector-3/variant-heading.tsx +162 -0
- package/src/components/src/molecules/variant-selector-3/variant-options.tsx +201 -0
- package/src/components/src/molecules/variant-selector-modal/index.tsx +127 -0
- package/src/components/src/molecules/variant-selector-type/index.tsx +235 -0
- package/src/components/src/molecules/video-carousel-item/index.tsx +183 -0
- package/src/components/src/molecules/video-carousel-item/product-list.tsx +258 -0
- package/src/components/src/molecules/video-carousel-item/product-list.web.tsx +197 -0
- package/src/components/src/molecules/way-to-reward-card/index.tsx +236 -0
- package/src/components/src/molecules/way-to-reward-card/index.web.tsx +188 -0
- package/src/components/src/molecules/web-view-auto-height/index.tsx +28 -0
- package/src/components/src/molecules/wishlist/add-to-wishlist-v2.tsx +144 -0
- package/src/components/src/molecules/wishlist/add-to-wishlist.tsx +136 -0
- package/src/components/src/molecules/wishlist/index.ts +1 -0
- package/src/components/src/molecules/wishlist/move-to-cart.tsx +57 -0
- package/src/components/src/molecules/wishlist/remove-from-wishlist.tsx +40 -0
- package/src/components/src/molecules/youtube-video/index.tsx +54 -0
- package/src/components/src/molecules/youtube-video/index.web.tsx +44 -0
- package/src/components/src/organisms/a1-accordion/index.tsx +93 -0
- package/src/components/src/organisms/a1-accordion/index.web.tsx +82 -0
- package/src/components/src/organisms/a1-accordion-image/index.tsx +97 -0
- package/src/components/src/organisms/a1-collection-image-banner/index.tsx +84 -0
- package/src/components/src/organisms/a1-collection-image-banner/index.web.tsx +23 -0
- package/src/components/src/organisms/a1-generic-metafield-accordion/index.tsx +90 -0
- package/src/components/src/organisms/a1-generic-metafield-accordion/index.web.tsx +10 -0
- package/src/components/src/organisms/a1-image-banner/index.tsx +86 -0
- package/src/components/src/organisms/a1-image-list/index.tsx +99 -0
- package/src/components/src/organisms/a1-product-description-html/index.tsx +137 -0
- package/src/components/src/organisms/a1-product-description-html/index.web.tsx +90 -0
- package/src/components/src/organisms/a1-product-grid/index.tsx +60 -0
- package/src/components/src/organisms/a1-product-list/index.tsx +92 -0
- package/src/components/src/organisms/accordion-image/index.tsx +68 -0
- package/src/components/src/organisms/add-address/index.tsx +62 -0
- package/src/components/src/organisms/add-review/index.tsx +190 -0
- package/src/components/src/organisms/add-to-bundle/index.tsx +44 -0
- package/src/components/src/organisms/add-to-cart-bar/add-to-card-bar.tsx +115 -0
- package/src/components/src/organisms/add-to-cart-bar/index.tsx +1 -0
- package/src/components/src/organisms/add-to-cart-bar/v2.tsx +205 -0
- package/src/components/src/organisms/add-to-cart-bar/wrapper.tsx +44 -0
- package/src/components/src/organisms/add-to-wishlist-bar/index.tsx +96 -0
- package/src/components/src/organisms/address-form/index.tsx +511 -0
- package/src/components/src/organisms/address-form-input-field/index.tsx +375 -0
- package/src/components/src/organisms/address-list/index.tsx +154 -0
- package/src/components/src/organisms/announcement-carousel/index.tsx +207 -0
- package/src/components/src/organisms/announcement-carousel/index.web.tsx +73 -0
- package/src/components/src/organisms/announcement-ticker/index.tsx +247 -0
- package/src/components/src/organisms/announcement-ticker/index.web.tsx +169 -0
- package/src/components/src/organisms/apply-coupon/index.tsx +395 -0
- package/src/components/src/organisms/apply-coupon-v2/applied-coupon-card.tsx +84 -0
- package/src/components/src/organisms/apply-coupon-v2/available-coupons.tsx +123 -0
- package/src/components/src/organisms/apply-coupon-v2/coupon-svg-bg.tsx +25 -0
- package/src/components/src/organisms/apply-coupon-v2/index.tsx +367 -0
- package/src/components/src/organisms/blog-list/blog-data.tsx +268 -0
- package/src/components/src/organisms/blog-list/blog-item.tsx +70 -0
- package/src/components/src/organisms/blog-list/empty-blog-list.tsx +42 -0
- package/src/components/src/organisms/blog-list/index.tsx +102 -0
- package/src/components/src/organisms/blog-list/index.web.tsx +92 -0
- package/src/components/src/organisms/brew-collection-image-banner/index.tsx +96 -0
- package/src/components/src/organisms/bundle-bar/index.tsx +128 -0
- package/src/components/src/organisms/bundle-filter-bar/index.tsx +114 -0
- package/src/components/src/organisms/bundle-items-modal/index.tsx +140 -0
- package/src/components/src/organisms/bundle-list/index.tsx +65 -0
- package/src/components/src/organisms/buy-now-bar/index.tsx +79 -0
- package/src/components/src/organisms/carousel-with-background-blur/carousel.tsx +393 -0
- package/src/components/src/organisms/carousel-with-background-blur/carousel.web.tsx +179 -0
- package/src/components/src/organisms/carousel-with-background-blur/index.tsx +90 -0
- package/src/components/src/organisms/carousel-with-background-blur/index.web.tsx +73 -0
- package/src/components/src/organisms/carousel-with-background-blur/indicator.tsx +144 -0
- package/src/components/src/organisms/cart-custom-attributes/index.tsx +103 -0
- package/src/components/src/organisms/cart-goal/index.tsx +116 -0
- package/src/components/src/organisms/cart-goals/index.tsx +2 -0
- package/src/components/src/organisms/cart-goals/milestones.tsx +233 -0
- package/src/components/src/organisms/cart-goals/progress-bar.tsx +214 -0
- package/src/components/src/organisms/cart-list/cart-item.tsx +0 -0
- package/src/components/src/organisms/cart-list/empty-cart.tsx +113 -0
- package/src/components/src/organisms/cart-list/index.tsx +271 -0
- package/src/components/src/organisms/cart-payment-web-view/index.tsx +213 -0
- package/src/components/src/organisms/categories-navigation/index.tsx +168 -0
- package/src/components/src/organisms/change-address/index.tsx +512 -0
- package/src/components/src/organisms/change-address-v2/index.tsx +223 -0
- package/src/components/src/organisms/change-password/index.tsx +231 -0
- package/src/components/src/organisms/chips-navigation/index.tsx +41 -0
- package/src/components/src/organisms/chips-navigation/index.web.tsx +69 -0
- package/src/components/src/organisms/chips-navigation-accordion/index.tsx +47 -0
- package/src/components/src/organisms/collection-list/index.tsx +74 -0
- package/src/components/src/organisms/collection-list-background/index.tsx +99 -0
- package/src/components/src/organisms/color-image/index.tsx +79 -0
- package/src/components/src/organisms/color-swatch-group/index.tsx +141 -0
- package/src/components/src/organisms/confirm-dialog/index.tsx +34 -0
- package/src/components/src/organisms/countdown-banner/common.tsx +263 -0
- package/src/components/src/organisms/countdown-banner/index.tsx +143 -0
- package/src/components/src/organisms/countdown-banner/index.web.tsx +176 -0
- package/src/components/src/organisms/countdown-banner/types.tsx +29 -0
- package/src/components/src/organisms/currency-selector/index.tsx +39 -0
- package/src/components/src/organisms/delete-account/index.tsx +93 -0
- package/src/components/src/organisms/delete-account-privacy/index.tsx +39 -0
- package/src/components/src/organisms/delivery-details/index.tsx +157 -0
- package/src/components/src/organisms/discount-code-input/index.tsx +152 -0
- package/src/components/src/organisms/divider-heading/index.tsx +51 -0
- package/src/components/src/organisms/edit-address/index.tsx +53 -0
- package/src/components/src/organisms/empty-screen/index.tsx +74 -0
- package/src/components/src/organisms/empty-screen-v2/index.tsx +26 -0
- package/src/components/src/organisms/empty-searches/index.tsx +96 -0
- package/src/components/src/organisms/estimated-delivery-date/dates-mapping.ts +23 -0
- package/src/components/src/organisms/estimated-delivery-date/index.tsx +141 -0
- package/src/components/src/organisms/faqs/defaults.ts +65 -0
- package/src/components/src/organisms/faqs/index.tsx +51 -0
- package/src/components/src/organisms/faqs/index.web.tsx +64 -0
- package/src/components/src/organisms/follow-us/index.tsx +58 -0
- package/src/components/src/organisms/forgot-password/index.tsx +228 -0
- package/src/components/src/organisms/free-engraving/index.tsx +180 -0
- package/src/components/src/organisms/gift-items-list/index.tsx +98 -0
- package/src/components/src/organisms/gift-wrap-list/custom-attributes-form.tsx +77 -0
- package/src/components/src/organisms/gift-wrap-list/gift-wrap-item.tsx +133 -0
- package/src/components/src/organisms/gift-wrap-list/index.tsx +72 -0
- package/src/components/src/organisms/goto-button/index.tsx +53 -0
- package/src/components/src/organisms/goto-button/index.web.tsx +46 -0
- package/src/components/src/organisms/goto-button-v2/index.tsx +58 -0
- package/src/components/src/organisms/horizontal-tabs-menu/defaults.ts +797 -0
- package/src/components/src/organisms/horizontal-tabs-menu/index.tsx +79 -0
- package/src/components/src/organisms/icon-list/index.tsx +150 -0
- package/src/components/src/organisms/image-banner/index.tsx +158 -0
- package/src/components/src/organisms/image-collage/constants.ts +8 -0
- package/src/components/src/organisms/image-collage/index.tsx +147 -0
- package/src/components/src/organisms/image-collage/variants.common.ts +415 -0
- package/src/components/src/organisms/image-collage/variants.ts +129 -0
- package/src/components/src/organisms/image-collage/variants.web.ts +119 -0
- package/src/components/src/organisms/image-compare-block/index.tsx +48 -0
- package/src/components/src/organisms/image-list/index.tsx +427 -0
- package/src/components/src/organisms/image-list/utils.tsx +8 -0
- package/src/components/src/organisms/image-list/utils.web.tsx +6 -0
- package/src/components/src/organisms/image-list-accordion/index.tsx +47 -0
- package/src/components/src/organisms/image-marquee/index.tsx +178 -0
- package/src/components/src/organisms/image-marquee/index.web.tsx +190 -0
- package/src/components/src/organisms/image-marquee/types.ts +14 -0
- package/src/components/src/organisms/image-preview/index.tsx +51 -0
- package/src/components/src/organisms/image-video-reel/carouse-item.tsx +348 -0
- package/src/components/src/organisms/image-video-reel/carouse-item.web.tsx +318 -0
- package/src/components/src/organisms/image-video-reel/index.tsx +359 -0
- package/src/components/src/organisms/image-video-reel/indicator.tsx +116 -0
- package/src/components/src/organisms/image-video-reel/indicator.web.tsx +80 -0
- package/src/components/src/organisms/image-video-reel/types.ts +103 -0
- package/src/components/src/organisms/infinite-product-grid/index.tsx +218 -0
- package/src/components/src/organisms/infinite-product-grid/index.web.tsx +105 -0
- package/src/components/src/organisms/infinite-product-grid-v2/index.tsx +163 -0
- package/src/components/src/organisms/judgeme-reviews/index.tsx +129 -0
- package/src/components/src/organisms/judgeme-reviews/utils.ts +77 -0
- package/src/components/src/organisms/last-order/index.tsx +40 -0
- package/src/components/src/organisms/metafield-image-compare-block/hook.tsx +119 -0
- package/src/components/src/organisms/metafield-image-compare-block/index.tsx +59 -0
- package/src/components/src/organisms/metafield-product-list/index.tsx +114 -0
- package/src/components/src/organisms/metafield-rich-text/index.tsx +101 -0
- package/src/components/src/organisms/metafield-rich-text/metafield-accordian.tsx +51 -0
- package/src/components/src/organisms/metafield-rich-text/metafield-accordian.web.tsx +55 -0
- package/src/components/src/organisms/metafield-size-chart-page/index.tsx +86 -0
- package/src/components/src/organisms/metafield-tag-block/index.tsx +28 -0
- package/src/components/src/organisms/metafield-text/index.tsx +87 -0
- package/src/components/src/organisms/metafields-product-group/index.tsx +89 -0
- package/src/components/src/organisms/more-menu/index.tsx +64 -0
- package/src/components/src/organisms/move-to-wishlist/index.tsx +79 -0
- package/src/components/src/organisms/multi-level-menu/index.tsx +54 -0
- package/src/components/src/organisms/opinew-reviews/index.tsx +102 -0
- package/src/components/src/organisms/opinew-reviews/utils.tsx +55 -0
- package/src/components/src/organisms/order-cancel/index.tsx +63 -0
- package/src/components/src/organisms/order-details-header/index.tsx +78 -0
- package/src/components/src/organisms/order-details-webview/index.tsx +47 -0
- package/src/components/src/organisms/order-list/index.tsx +458 -0
- package/src/components/src/organisms/order-payment-details/index.tsx +90 -0
- package/src/components/src/organisms/order-product-list/index.tsx +79 -0
- package/src/components/src/organisms/order-product-list-v2/index.tsx +158 -0
- package/src/components/src/organisms/otp-signup/index.tsx +186 -0
- package/src/components/src/organisms/past-searches/index.tsx +202 -0
- package/src/components/src/organisms/payment-confirmation/index.tsx +177 -0
- package/src/components/src/organisms/payment-details/index.tsx +264 -0
- package/src/components/src/organisms/payment-success/index.tsx +49 -0
- package/src/components/src/organisms/payment-web-view/index.tsx +285 -0
- package/src/components/src/organisms/payment-web-view-v4/index.tsx +600 -0
- package/src/components/src/organisms/pdp/index.tsx +168 -0
- package/src/components/src/organisms/pdp/index.web.tsx +60 -0
- package/src/components/src/organisms/pdp-description/index.tsx +104 -0
- package/src/components/src/organisms/pdp-description-native/index.tsx +63 -0
- package/src/components/src/organisms/pdp-description-native/index.web.tsx +11 -0
- package/src/components/src/organisms/pdp-metafield-video/index.tsx +153 -0
- package/src/components/src/organisms/popup-modal/index.tsx +129 -0
- package/src/components/src/organisms/previously-ordered-products/index.tsx +105 -0
- package/src/components/src/organisms/product-discount/common.tsx +123 -0
- package/src/components/src/organisms/product-discount/coupon-card.tsx +125 -0
- package/src/components/src/organisms/product-discount/defaults.ts +136 -0
- package/src/components/src/organisms/product-discount/empty-coupons.tsx +4 -0
- package/src/components/src/organisms/product-discount/empty-coupons.web.tsx +11 -0
- package/src/components/src/organisms/product-discount/index.tsx +228 -0
- package/src/components/src/organisms/product-discount/types.tsx +28 -0
- package/src/components/src/organisms/product-grid/index.tsx +86 -0
- package/src/components/src/organisms/product-hotspot/animated-circle.tsx +88 -0
- package/src/components/src/organisms/product-hotspot/animated-circle.web.tsx +55 -0
- package/src/components/src/organisms/product-hotspot/index.tsx +255 -0
- package/src/components/src/organisms/product-hotspot/item.tsx +124 -0
- package/src/components/src/organisms/product-hotspot/modal-body.tsx +50 -0
- package/src/components/src/organisms/product-hotspot/product-card.tsx +111 -0
- package/src/components/src/organisms/product-info/index.tsx +421 -0
- package/src/components/src/organisms/product-info/wrapper.tsx +15 -0
- package/src/components/src/organisms/product-info/wrapper.web.tsx +15 -0
- package/src/components/src/organisms/product-list/index.tsx +104 -0
- package/src/components/src/organisms/product-list/index.web.tsx +110 -0
- package/src/components/src/organisms/product-list/product-list.schema.ts +816 -0
- package/src/components/src/organisms/product-refresh/index.tsx +19 -0
- package/src/components/src/organisms/product-size-chart-v2/index.tsx +49 -0
- package/src/components/src/organisms/product-summary/index.tsx +1 -0
- package/src/components/src/organisms/product-summary/product-summary.tsx +253 -0
- package/src/components/src/organisms/product-summary/wrapper.tsx +36 -0
- package/src/components/src/organisms/profile/index.tsx +238 -0
- package/src/components/src/organisms/profile-2/index.tsx +254 -0
- package/src/components/src/organisms/profile-edit/constants.ts +74 -0
- package/src/components/src/organisms/profile-edit/index.tsx +802 -0
- package/src/components/src/organisms/profile-edit/styles.ts +371 -0
- package/src/components/src/organisms/profile-edit/types.ts +120 -0
- package/src/components/src/organisms/profile-edit/utils.ts +362 -0
- package/src/components/src/organisms/profile-menu/index.tsx +65 -0
- package/src/components/src/organisms/profile-signed-out/index.tsx +72 -0
- package/src/components/src/organisms/profile-signedout-v2/index.tsx +36 -0
- package/src/components/src/organisms/profile-signout/index.tsx +65 -0
- package/src/components/src/organisms/profile-user-greeting/index.tsx +113 -0
- package/src/components/src/organisms/promo-banner/PromoBanner.tsx +0 -0
- package/src/components/src/organisms/promo-banner/index.ts +0 -0
- package/src/components/src/organisms/promo-block/index.tsx +69 -0
- package/src/components/src/organisms/promo-carousel/index.tsx +101 -0
- package/src/components/src/organisms/promo-carousel/index.web.tsx +85 -0
- package/src/components/src/organisms/push-inbox/index.tsx +392 -0
- package/src/components/src/organisms/push-inbox/utils.ts +94 -0
- package/src/components/src/organisms/push-notification-prompt-button/index.tsx +45 -0
- package/src/components/src/organisms/push-notification-settings-block/index.tsx +119 -0
- package/src/components/src/organisms/quantity-selector-block/index.tsx +54 -0
- package/src/components/src/organisms/recent-order/addressSelector.tsx +88 -0
- package/src/components/src/organisms/recent-order/index.tsx +51 -0
- package/src/components/src/organisms/recent-order/paymentDetails.tsx +68 -0
- package/src/components/src/organisms/recently-viewed-products/index.tsx +92 -0
- package/src/components/src/organisms/recently-viewed-products/index.web.tsx +110 -0
- package/src/components/src/organisms/reels/index.tsx +467 -0
- package/src/components/src/organisms/reels/index.web.tsx +345 -0
- package/src/components/src/organisms/requires-auth/index.tsx +16 -0
- package/src/components/src/organisms/reset-password/index.tsx +140 -0
- package/src/components/src/organisms/review-bar/index.tsx +39 -0
- package/src/components/src/organisms/rewards-history/index.tsx +105 -0
- package/src/components/src/organisms/rewards-summary/index.tsx +146 -0
- package/src/components/src/organisms/rewards-summary-old/index.tsx +130 -0
- package/src/components/src/organisms/search-bar/index.tsx +34 -0
- package/src/components/src/organisms/search-product-list/index.tsx +31 -0
- package/src/components/src/organisms/search-recommendations/index.tsx +66 -0
- package/src/components/src/organisms/search-suggestions/index.tsx +194 -0
- package/src/components/src/organisms/search-suggestions-v2/collection-suggestions.tsx +61 -0
- package/src/components/src/organisms/search-suggestions-v2/index.tsx +91 -0
- package/src/components/src/organisms/search-suggestions-v2/page-suggestions.tsx +85 -0
- package/src/components/src/organisms/search-suggestions-v2/product-suggestions.tsx +174 -0
- package/src/components/src/organisms/search-suggestions-v2/search-term-suggestions.tsx +62 -0
- package/src/components/src/organisms/search-suggestions-v2/suggestion.tsx +100 -0
- package/src/components/src/organisms/shipping-address/index.tsx +59 -0
- package/src/components/src/organisms/shop-policy/index.tsx +93 -0
- package/src/components/src/organisms/shop-policy/index.web.tsx +12 -0
- package/src/components/src/organisms/shopify-customer-auth-webview/index.tsx +207 -0
- package/src/components/src/organisms/shopify-customer-payment-web-view/index.tsx +603 -0
- package/src/components/src/organisms/shopify-reviews/index.tsx +52 -0
- package/src/components/src/organisms/shopify-reviews/utils.ts +27 -0
- package/src/components/src/organisms/shopify-rich-text-block/index.tsx +60 -0
- package/src/components/src/organisms/shopify-store-credits/index.tsx +369 -0
- package/src/components/src/organisms/sign-in/index.tsx +242 -0
- package/src/components/src/organisms/sign-in-v2/index.tsx +282 -0
- package/src/components/src/organisms/sign-in-v3/index.tsx +259 -0
- package/src/components/src/organisms/sign-up/index.tsx +251 -0
- package/src/components/src/organisms/sign-up-v2/index.tsx +267 -0
- package/src/components/src/organisms/signin-modal/continue-as-guest.tsx +46 -0
- package/src/components/src/organisms/signin-modal/index.tsx +113 -0
- package/src/components/src/organisms/signup-modal/index.tsx +61 -0
- package/src/components/src/organisms/simpl-pay-block/index.tsx +84 -0
- package/src/components/src/organisms/single-level-navigation/index.tsx +91 -0
- package/src/components/src/organisms/snapmint-pay-block/index.tsx +173 -0
- package/src/components/src/organisms/spacer/index.tsx +17 -0
- package/src/components/src/organisms/subscription/index.tsx +52 -0
- package/src/components/src/organisms/subscription/subscription.tsx +226 -0
- package/src/components/src/organisms/subscription-selector-dropdown/extra-info.tsx +53 -0
- package/src/components/src/organisms/subscription-selector-dropdown/index.tsx +30 -0
- package/src/components/src/organisms/subscription-selector-dropdown/more-price-info.tsx +38 -0
- package/src/components/src/organisms/subscription-selector-dropdown/one-time-plan.tsx +85 -0
- package/src/components/src/organisms/subscription-selector-dropdown/purchase-plans.tsx +60 -0
- package/src/components/src/organisms/subscription-selector-dropdown/selling-plan-options.tsx +132 -0
- package/src/components/src/organisms/subscription-selector-dropdown/subscription-option-label.tsx +91 -0
- package/src/components/src/organisms/subscription-selector-dropdown/subscription.tsx +27 -0
- package/src/components/src/organisms/subscription-selector-dropdown/susbcription-plan.tsx +126 -0
- package/src/components/src/organisms/tabbed-product-collection/index.tsx +263 -0
- package/src/components/src/organisms/tabbed-product-collection/index.web.tsx +270 -0
- package/src/components/src/organisms/tag-redirect-product-images/index.tsx +203 -0
- package/src/components/src/organisms/tagged-page-size-chart/index.tsx +76 -0
- package/src/components/src/organisms/tagged-pdp-content/index.tsx +72 -0
- package/src/components/src/organisms/tagged-plp-content/index.tsx +67 -0
- package/src/components/src/organisms/tagged-rich-text/index.tsx +58 -0
- package/src/components/src/organisms/tagged-rich-text/index.web.tsx +25 -0
- package/src/components/src/organisms/tailored-variant-form/index.tsx +497 -0
- package/src/components/src/organisms/testimonials/Testimonials.tsx +45 -0
- package/src/components/src/organisms/testimonials/index.tsx +45 -0
- package/src/components/src/organisms/total-savings/index.tsx +50 -0
- package/src/components/src/organisms/trending-products/index.tsx +84 -0
- package/src/components/src/organisms/trending-searches/index.tsx +125 -0
- package/src/components/src/organisms/two-level-navigation/index.tsx +80 -0
- package/src/components/src/organisms/upsell-product-list/index.tsx +247 -0
- package/src/components/src/organisms/variant-carousel/index.tsx +121 -0
- package/src/components/src/organisms/variant-selector-modal-block/index.tsx +126 -0
- package/src/components/src/organisms/variant-selector-subscriptions/index.tsx +106 -0
- package/src/components/src/organisms/variantSelector/index.tsx +69 -0
- package/src/components/src/organisms/vertical-tabs-menu/defaults.ts +526 -0
- package/src/components/src/organisms/vertical-tabs-menu/index.tsx +61 -0
- package/src/components/src/organisms/video-banner/index.tsx +140 -0
- package/src/components/src/organisms/video-banner/index.web.tsx +123 -0
- package/src/components/src/organisms/video-banner-v2/index.tsx +188 -0
- package/src/components/src/organisms/video-carousel/index.tsx +404 -0
- package/src/components/src/organisms/video-carousel/index.web.tsx +357 -0
- package/src/components/src/organisms/video-carousel/video-carousel-item/index.tsx +277 -0
- package/src/components/src/organisms/video-carousel/video-carousel-item/product-list.tsx +257 -0
- package/src/components/src/organisms/video-carousel/video-carousel-item/product-list.web.tsx +197 -0
- package/src/components/src/organisms/video-list/index.tsx +103 -0
- package/src/components/src/organisms/view-coupons/discount-amount.tsx +48 -0
- package/src/components/src/organisms/view-coupons/index.tsx +137 -0
- package/src/components/src/organisms/view-coupons-v2/index.tsx +174 -0
- package/src/components/src/organisms/view-coupons-v2/savings-banner.tsx +100 -0
- package/src/components/src/organisms/web-view/index.tsx +281 -0
- package/src/components/src/organisms/web-view/index.web.tsx +61 -0
- package/src/components/src/organisms/wishlist/index.tsx +224 -0
- package/src/components/src/organisms/wishlist-v2/index.tsx +95 -0
- package/src/components/src/organisms/wishlisted-items/index.tsx +95 -0
- package/src/components/src/organisms/youtube-embed/index.tsx +41 -0
- package/src/components/src/registry.ts +2 -0
- package/src/components/src/style-utils.ts +441 -0
- package/src/components/src/utils.ts +252 -0
- package/src/components/test-setup.ts +1 -0
- package/src/container-registry/babel.config.js +3 -0
- package/src/container-registry/src/common.tsx +16 -0
- package/src/container-registry/src/index.ts +1 -0
- package/src/container-registry/src/register.tsx +27 -0
- package/src/container-registry/src/register.web.tsx +16 -0
- package/src/container-registry/test-setup.ts +1 -0
- package/src/containers/src/a1-tabbed-block-list/index.tsx +115 -0
- package/src/containers/src/accordion-container/index.tsx +72 -0
- package/src/containers/src/index.ts +0 -0
- package/src/containers/src/rules-container/index.tsx +88 -0
- package/src/containers/src/tabbed-block-list/index.tsx +81 -0
- package/src/containers/src/tabbed-screen-container/index.tsx +51 -0
- package/src/containers/test-setup.ts +1 -0
- package/src/cookie-manager/src/cookie.ts +16 -0
- package/src/cookie-manager/src/cookie.web.ts +5 -0
- package/src/cookie-manager/src/index.ts +1 -0
- package/src/cookie-manager/test-setup.ts +1 -0
- package/src/discount/src/gift.ts +182 -0
- package/src/discount/src/index.ts +1 -0
- package/src/discount/src/utils.ts +164 -0
- package/src/discount/test-setup.ts +1 -0
- package/src/enhanced-fetch/src/enhanced-fetch-tests.js +711 -0
- package/src/enhanced-fetch/src/index.ts +245 -0
- package/src/event-emitter/src/index.ts +38 -0
- package/src/firebase/src/index.ts +2 -0
- package/src/firebase/src/lib/analytics.ts +33 -0
- package/src/firebase/src/lib/analyticsV2.ts +61 -0
- package/src/icons/src/declarations.d.ts +6 -0
- package/src/icons/src/icon-registry.tsx +81 -0
- package/src/icons/src/icon-registry.web.tsx +81 -0
- package/src/icons/src/icon-set.tsx +455 -0
- package/src/icons/src/index.ts +4 -0
- package/src/icons/src/remote-icon.tsx +46 -0
- package/src/icons/src/remote-icon.web.tsx +25 -0
- package/src/icons/src/remote-image-icon.tsx +66 -0
- package/src/icons/src/remote-image-icon.web.tsx +31 -0
- package/src/icons/src/svgs/account.tsx +17 -0
- package/src/icons/src/svgs/add-to-cart.tsx +49 -0
- package/src/icons/src/svgs/address.tsx +26 -0
- package/src/icons/src/svgs/afterpay.tsx +110 -0
- package/src/icons/src/svgs/apple.tsx +19 -0
- package/src/icons/src/svgs/back.tsx +10 -0
- package/src/icons/src/svgs/badge.tsx +19 -0
- package/src/icons/src/svgs/bag.tsx +27 -0
- package/src/icons/src/svgs/cake.tsx +13 -0
- package/src/icons/src/svgs/calendar.tsx +20 -0
- package/src/icons/src/svgs/cancel.tsx +20 -0
- package/src/icons/src/svgs/cart-cancel.tsx +35 -0
- package/src/icons/src/svgs/cart.tsx +14 -0
- package/src/icons/src/svgs/categories.tsx +13 -0
- package/src/icons/src/svgs/checked.tsx +18 -0
- package/src/icons/src/svgs/checkedCircle.tsx +26 -0
- package/src/icons/src/svgs/chevron-down.tsx +26 -0
- package/src/icons/src/svgs/chevron-left.tsx +13 -0
- package/src/icons/src/svgs/chevron-right.tsx +19 -0
- package/src/icons/src/svgs/chevron-up.tsx +27 -0
- package/src/icons/src/svgs/chevron.tsx +35 -0
- package/src/icons/src/svgs/circled-arrow.tsx +29 -0
- package/src/icons/src/svgs/clear.tsx +35 -0
- package/src/icons/src/svgs/clipboard.tsx +23 -0
- package/src/icons/src/svgs/close.tsx +26 -0
- package/src/icons/src/svgs/collection.tsx +32 -0
- package/src/icons/src/svgs/copy.tsx +31 -0
- package/src/icons/src/svgs/coupon-icon.tsx +23 -0
- package/src/icons/src/svgs/coupon.tsx +35 -0
- package/src/icons/src/svgs/crate.tsx +13 -0
- package/src/icons/src/svgs/cross.tsx +21 -0
- package/src/icons/src/svgs/deals.tsx +26 -0
- package/src/icons/src/svgs/discount.tsx +42 -0
- package/src/icons/src/svgs/dollar.tsx +33 -0
- package/src/icons/src/svgs/error.tsx +35 -0
- package/src/icons/src/svgs/eye.tsx +33 -0
- package/src/icons/src/svgs/eyeOff.tsx +35 -0
- package/src/icons/src/svgs/facebook.tsx +31 -0
- package/src/icons/src/svgs/favorite.tsx +79 -0
- package/src/icons/src/svgs/filter.tsx +24 -0
- package/src/icons/src/svgs/fragrances.tsx +55 -0
- package/src/icons/src/svgs/gift.tsx +23 -0
- package/src/icons/src/svgs/gifts.tsx +38 -0
- package/src/icons/src/svgs/goal-discount-filled.tsx +21 -0
- package/src/icons/src/svgs/goal-discount.tsx +24 -0
- package/src/icons/src/svgs/goal-locked.tsx +21 -0
- package/src/icons/src/svgs/goal-unlocked.tsx +34 -0
- package/src/icons/src/svgs/google-colorful.tsx +38 -0
- package/src/icons/src/svgs/google.tsx +28 -0
- package/src/icons/src/svgs/grooming.tsx +22 -0
- package/src/icons/src/svgs/hamburger.tsx +30 -0
- package/src/icons/src/svgs/heart.tsx +30 -0
- package/src/icons/src/svgs/help.tsx +22 -0
- package/src/icons/src/svgs/history.tsx +26 -0
- package/src/icons/src/svgs/home.tsx +21 -0
- package/src/icons/src/svgs/homes.svg +4 -0
- package/src/icons/src/svgs/info.tsx +19 -0
- package/src/icons/src/svgs/inline-error-icon.tsx +13 -0
- package/src/icons/src/svgs/inline-success-icon-double-checkmarks.tsx +15 -0
- package/src/icons/src/svgs/instagram.tsx +17 -0
- package/src/icons/src/svgs/lock.tsx +15 -0
- package/src/icons/src/svgs/mail.tsx +30 -0
- package/src/icons/src/svgs/mins.tsx +21 -0
- package/src/icons/src/svgs/minus.tsx +19 -0
- package/src/icons/src/svgs/more.tsx +13 -0
- package/src/icons/src/svgs/notification-bell.tsx +44 -0
- package/src/icons/src/svgs/notifications.tsx +21 -0
- package/src/icons/src/svgs/offers.tsx +11 -0
- package/src/icons/src/svgs/order-history.tsx +19 -0
- package/src/icons/src/svgs/order.tsx +32 -0
- package/src/icons/src/svgs/package-check.tsx +30 -0
- package/src/icons/src/svgs/pause.tsx +17 -0
- package/src/icons/src/svgs/pencil.tsx +17 -0
- package/src/icons/src/svgs/percent-circle.tsx +30 -0
- package/src/icons/src/svgs/play.tsx +13 -0
- package/src/icons/src/svgs/plus.tsx +12 -0
- package/src/icons/src/svgs/privacy.tsx +15 -0
- package/src/icons/src/svgs/product.tsx +14 -0
- package/src/icons/src/svgs/profile-circle.tsx +16 -0
- package/src/icons/src/svgs/profile-permission.tsx +17 -0
- package/src/icons/src/svgs/profile-tab-icon.tsx +11 -0
- package/src/icons/src/svgs/profile.tsx +16 -0
- package/src/icons/src/svgs/reward.tsx +22 -0
- package/src/icons/src/svgs/rewards.tsx +15 -0
- package/src/icons/src/svgs/sad-emoji.tsx +30 -0
- package/src/icons/src/svgs/search.tsx +31 -0
- package/src/icons/src/svgs/share.tsx +28 -0
- package/src/icons/src/svgs/shipping.tsx +20 -0
- package/src/icons/src/svgs/signout.tsx +15 -0
- package/src/icons/src/svgs/signup.tsx +26 -0
- package/src/icons/src/svgs/snap-mint.tsx +49 -0
- package/src/icons/src/svgs/sort.tsx +12 -0
- package/src/icons/src/svgs/speakerOff.tsx +40 -0
- package/src/icons/src/svgs/speakerOn.tsx +20 -0
- package/src/icons/src/svgs/stars.tsx +36 -0
- package/src/icons/src/svgs/success.tsx +21 -0
- package/src/icons/src/svgs/tag.tsx +25 -0
- package/src/icons/src/svgs/thumbs-up-outlined.tsx +36 -0
- package/src/icons/src/svgs/thumbs-up.tsx +11 -0
- package/src/icons/src/svgs/tick.tsx +23 -0
- package/src/icons/src/svgs/trash.tsx +21 -0
- package/src/icons/src/svgs/trending.tsx +36 -0
- package/src/icons/src/svgs/truck.tsx +30 -0
- package/src/icons/src/svgs/truecaller.tsx +44 -0
- package/src/icons/src/svgs/types.ts +0 -0
- package/src/icons/src/svgs/unchecked.tsx +13 -0
- package/src/icons/src/svgs/verified.tsx +23 -0
- package/src/icons/src/svgs/video-play.tsx +12 -0
- package/src/icons/src/svgs/volume-off.tsx +18 -0
- package/src/icons/src/svgs/volume.tsx +18 -0
- package/src/icons/src/svgs/way.tsx +14 -0
- package/src/icons/src/svgs/youtube.tsx +26 -0
- package/src/icons/src/utils.ts +53 -0
- package/src/icons/test-setup.ts +1 -0
- package/src/integrations/appbrew/analytics/app-users.ts +107 -0
- package/src/integrations/appbrew/analytics/config.dev.ts +10 -0
- package/src/integrations/appbrew/analytics/config.ts +10 -0
- package/src/integrations/appbrew/analytics/tracker.ts +136 -0
- package/src/integrations/appbrew/analytics/trackerV2.ts +154 -0
- package/src/integrations/appbrew/analytics/utils.ts +9 -0
- package/src/integrations/appbrew/analytics/webhook-tracker.ts +203 -0
- package/src/integrations/appbrew/currency/index.ts +1 -0
- package/src/integrations/appbrew/currency/provider.ts +211 -0
- package/src/integrations/appbrew/estimated-delivery-date/blocks/estimated-delivery-date.tsx +229 -0
- package/src/integrations/appbrew/estimated-delivery-date/index.ts +2 -0
- package/src/integrations/appbrew/estimated-delivery-date/provider.ts +45 -0
- package/src/integrations/appbrew/native-wishlist/src/index.ts +1 -0
- package/src/integrations/appbrew/native-wishlist/src/provider.ts +88 -0
- package/src/integrations/appbrew/src/index.ts +7 -0
- package/src/integrations/appbrew/src/lib/integrations-appbrew.spec.ts +7 -0
- package/src/integrations/appbrew/src/lib/integrations-appbrew.ts +3 -0
- package/src/integrations/color-swatch/src/index.ts +7 -0
- package/src/integrations/firebase-push/src/index.ts +1 -0
- package/src/integrations/firebase-push/src/push.ts +279 -0
- package/src/integrations/firebase-push/src/push.web.ts +15 -0
- package/src/integrations/gift/src/gift.ts +137 -0
- package/src/integrations/gift/src/index.ts +1 -0
- package/src/integrations/truefit/src/blocks/index.ts +1 -0
- package/src/integrations/truefit/src/blocks/truefit-widget.tsx +136 -0
- package/src/integrations/truefit/src/components/TfApp.tsx +159 -0
- package/src/integrations/truefit/src/components/TfWidget.tsx +241 -0
- package/src/integrations/truefit/src/constants.ts +5 -0
- package/src/integrations/truefit/src/index.ts +13 -0
- package/src/integrations/truefit/src/managers/authManager.ts +140 -0
- package/src/integrations/truefit/src/managers/messageManager.ts +122 -0
- package/src/integrations/truefit/src/managers/tokenManager.ts +52 -0
- package/src/integrations/truefit/src/orderApi.ts +43 -0
- package/src/integrations/truefit/src/register-blocks.ts +5 -0
- package/src/integrations/truefit/src/util/useWidgetEvent.ts +29 -0
- package/src/integrations/truefit/src/util/widgetEvents.ts +17 -0
- package/src/local-storage/src/icon-storage.ts +26 -0
- package/src/local-storage/src/index.ts +2 -0
- package/src/local-storage/src/storage.ts +56 -0
- package/src/local-storage/src/storage.web.ts +75 -0
- package/src/module-provider/src/index.ts +1 -0
- package/src/module-provider/src/module-provider.tsx +27 -0
- package/src/module-provider/src/provider.ts +0 -0
- package/src/okendo/src/blocks/components-v2.tsx +342 -0
- package/src/okendo/src/blocks/components-v2.types.ts +134 -0
- package/src/okendo/src/blocks/components.tsx +569 -0
- package/src/okendo/src/blocks/index.tsx +13 -0
- package/src/okendo/src/blocks/okendo-star-ratings-v2.tsx +102 -0
- package/src/okendo/src/blocks/okendo-star-ratings.tsx +77 -0
- package/src/okendo/src/blocks/review-aggregate-v2.tsx +493 -0
- package/src/okendo/src/blocks/review-aggregate.tsx +175 -0
- package/src/okendo/src/blocks/reviews-v2.tsx +352 -0
- package/src/okendo/src/blocks/reviews.tsx +144 -0
- package/src/okendo/src/hooks.tsx +489 -0
- package/src/okendo/src/index.ts +35 -0
- package/src/okendo/src/provider.ts +457 -0
- package/src/okendo/src/types.ts +355 -0
- package/src/okendo/src/utils.ts +32 -0
- package/src/orders-v4/src/icons/chevron-right-order-v4.tsx +18 -0
- package/src/orders-v4/src/icons/order-status.tsx +17 -0
- package/src/orders-v4/src/icons/payment-method.tsx +18 -0
- package/src/orders-v4/src/icons/payment-status.tsx +17 -0
- package/src/orders-v4/src/index.ts +7 -0
- package/src/orders-v4/src/layout-elements/order-cancel.tsx +60 -0
- package/src/orders-v4/src/layout-elements/order-date.tsx +39 -0
- package/src/orders-v4/src/layout-elements/order-fulfillment-details.tsx +408 -0
- package/src/orders-v4/src/layout-elements/order-number.tsx +35 -0
- package/src/orders-v4/src/layout-elements/order-payment-details-v4.tsx +190 -0
- package/src/orders-v4/src/layout-elements/order-preorder-date.tsx +16 -0
- package/src/orders-v4/src/layout-elements/order-product-compare-at-price.tsx +32 -0
- package/src/orders-v4/src/layout-elements/order-product-fulfillment-status.tsx +105 -0
- package/src/orders-v4/src/layout-elements/order-product-image-overlay.tsx +55 -0
- package/src/orders-v4/src/layout-elements/order-product-image.tsx +29 -0
- package/src/orders-v4/src/layout-elements/order-product-link.tsx +24 -0
- package/src/orders-v4/src/layout-elements/order-product-price.tsx +37 -0
- package/src/orders-v4/src/layout-elements/order-product-quantity.tsx +27 -0
- package/src/orders-v4/src/layout-elements/order-product-title.tsx +22 -0
- package/src/orders-v4/src/layout-elements/order-product-variant.tsx +24 -0
- package/src/orders-v4/src/layout-elements/order-reorder.tsx +97 -0
- package/src/orders-v4/src/layout-elements/order-return-and-exchange-v2.tsx +90 -0
- package/src/orders-v4/src/layout-elements/order-return-and-exchange.tsx +93 -0
- package/src/orders-v4/src/layout-elements/order-status-icon.tsx +14 -0
- package/src/orders-v4/src/layout-elements/order-status.tsx +33 -0
- package/src/orders-v4/src/layout-elements/order-total.tsx +19 -0
- package/src/orders-v4/src/layout-elements/order-track-delivery.tsx +67 -0
- package/src/orders-v4/src/layout-elements/order-view-details.tsx +23 -0
- package/src/orders-v4/src/order-custom-attributes-v4.tsx +210 -0
- package/src/orders-v4/src/order-details-footer-v4.tsx +51 -0
- package/src/orders-v4/src/order-details-fulfillment-list.tsx +32 -0
- package/src/orders-v4/src/order-details-header-v4.tsx +69 -0
- package/src/orders-v4/src/order-footer.ts +75 -0
- package/src/orders-v4/src/order-header.ts +75 -0
- package/src/orders-v4/src/order-products-list.ts +68 -0
- package/src/orders-v4/src/orders-list-v4.tsx +131 -0
- package/src/orders-v4/src/register-icons.ts +12 -0
- package/src/orders-v4/src/register-orders-v4-blocks.ts +15 -0
- package/src/orders-v4/src/registry.tsx +115 -0
- package/src/orders-v4/src/types.ts +122 -0
- package/src/orders-v4/src/utils.ts +75 -0
- package/src/orders-v4/test-setup.ts +1 -0
- package/src/orders-v5/src/cancel-order-reason.tsx +282 -0
- package/src/orders-v5/src/icons/package-cancel.tsx +18 -0
- package/src/orders-v5/src/icons/package-success.tsx +18 -0
- package/src/orders-v5/src/icons/package.tsx +17 -0
- package/src/orders-v5/src/icons/shipping-cancel.tsx +19 -0
- package/src/orders-v5/src/icons/shipping-pending.tsx +19 -0
- package/src/orders-v5/src/icons/shipping-success.tsx +18 -0
- package/src/orders-v5/src/icons/shipping.tsx +32 -0
- package/src/orders-v5/src/image.tsx +39 -0
- package/src/orders-v5/src/index.ts +2 -0
- package/src/orders-v5/src/order-details/fulfillment-list/fulfillment-item.tsx +222 -0
- package/src/orders-v5/src/order-details/fulfillment-list/fulfillment-list.tsx +123 -0
- package/src/orders-v5/src/order-details/fulfillment-list/index.tsx +1 -0
- package/src/orders-v5/src/order-details/fulfillment-list/line-item.tsx +213 -0
- package/src/orders-v5/src/order-details/fulfillment-list/star-ratings.tsx +79 -0
- package/src/orders-v5/src/order-details/fulfillment-list/status-indicator.tsx +208 -0
- package/src/orders-v5/src/order-details/fulfillment-list/status.tsx +113 -0
- package/src/orders-v5/src/order-details/header.tsx +280 -0
- package/src/orders-v5/src/order-details/index.tsx +9 -0
- package/src/orders-v5/src/order-details/order-cancel.tsx +323 -0
- package/src/orders-v5/src/order-details/order-custom-attributes.tsx +237 -0
- package/src/orders-v5/src/order-details/order-return-and-exchange.tsx +196 -0
- package/src/orders-v5/src/order-details/order-return-info-text.tsx +114 -0
- package/src/orders-v5/src/order-details/payment-summary.tsx +295 -0
- package/src/orders-v5/src/order-details/reorder.tsx +142 -0
- package/src/orders-v5/src/order-details/shipping-address.tsx +93 -0
- package/src/orders-v5/src/orders-list/index.ts +1 -0
- package/src/orders-v5/src/orders-list/order-item/fulfillment-item.tsx +138 -0
- package/src/orders-v5/src/orders-list/order-item/heading.tsx +160 -0
- package/src/orders-v5/src/orders-list/order-item/item.tsx +168 -0
- package/src/orders-v5/src/orders-list/orders-list.tsx +159 -0
- package/src/orders-v5/src/register-orders-v5-blocks.ts +29 -0
- package/src/orders-v5/src/register-orders-v5-icons.ts +17 -0
- package/src/orders-v5/src/utils.ts +539 -0
- package/src/pdp-components/src/blocks/common/empty-metafield.tsx +66 -0
- package/src/pdp-components/src/blocks/common/placeholder-block.tsx +134 -0
- package/src/pdp-components/src/blocks/index.ts +2 -0
- package/src/pdp-components/src/blocks/pdp-metafield-image/index.tsx +138 -0
- package/src/pdp-components/src/blocks/pdp-metafield-rich-text/index.tsx +190 -0
- package/src/pdp-components/src/index.ts +7 -0
- package/src/plp-components/src/blocks/plp-banner/index.tsx +213 -0
- package/src/plp-components/src/blocks/plp-description/index.tsx +86 -0
- package/src/plp-components/src/blocks/plp-html-text.tsx +172 -0
- package/src/plp-components/src/blocks/plp-image-carousel.tsx +203 -0
- package/src/plp-components/src/blocks/plp-shopify-rich-text/index.tsx +169 -0
- package/src/plp-components/src/blocks/plp-sub-category-navigation/index.tsx +336 -0
- package/src/plp-components/src/blocks/plp-text-sub-category/index.tsx +297 -0
- package/src/plp-components/src/blocks/plp-video/index.tsx +140 -0
- package/src/plp-components/src/blocks/plp-youtube-video.tsx +113 -0
- package/src/plp-components/src/common/empty-metafield.tsx +66 -0
- package/src/plp-components/src/common/placeholder-block.tsx +134 -0
- package/src/plp-components/src/index.ts +21 -0
- package/src/plp-components/test-setup.ts +1 -0
- package/src/post-purchase/hooks.ts +24 -0
- package/src/post-purchase/src/basic-order-item.tsx +143 -0
- package/src/post-purchase/src/cancel-order-reason.tsx +160 -0
- package/src/post-purchase/src/cancel-order.tsx +75 -0
- package/src/post-purchase/src/date.tsx +33 -0
- package/src/post-purchase/src/fulfillment-list.tsx +477 -0
- package/src/post-purchase/src/hooks.ts +1 -0
- package/src/post-purchase/src/index.ts +13 -0
- package/src/post-purchase/src/order-details-header.tsx +64 -0
- package/src/post-purchase/src/order-item.tsx +217 -0
- package/src/post-purchase/src/order-list.tsx +62 -0
- package/src/post-purchase/src/payment-details.tsx +116 -0
- package/src/post-purchase/src/register.ts +17 -0
- package/src/post-purchase/src/shipping-address.tsx +68 -0
- package/src/post-purchase/src/style.ts +30 -0
- package/src/post-purchase/src/types.ts +66 -0
- package/src/post-purchase/src/utils.ts +95 -0
- package/src/post-purchase/test-setup.ts +1 -0
- package/src/react-native-element-dropdown/src/assets/close.png +0 -0
- package/src/react-native-element-dropdown/src/assets/down.png +0 -0
- package/src/react-native-element-dropdown/src/components/Dropdown/index.tsx +686 -0
- package/src/react-native-element-dropdown/src/components/Dropdown/model.ts +73 -0
- package/src/react-native-element-dropdown/src/components/Dropdown/styles.ts +67 -0
- package/src/react-native-element-dropdown/src/components/MultiSelect/index.tsx +812 -0
- package/src/react-native-element-dropdown/src/components/MultiSelect/model.ts +76 -0
- package/src/react-native-element-dropdown/src/components/MultiSelect/styles.ts +103 -0
- package/src/react-native-element-dropdown/src/components/SelectCountry/index.tsx +77 -0
- package/src/react-native-element-dropdown/src/components/SelectCountry/model.ts +7 -0
- package/src/react-native-element-dropdown/src/components/SelectCountry/styles.ts +28 -0
- package/src/react-native-element-dropdown/src/components/TextInput/index.tsx +104 -0
- package/src/react-native-element-dropdown/src/components/TextInput/model.ts +20 -0
- package/src/react-native-element-dropdown/src/components/TextInput/styles.ts +31 -0
- package/src/react-native-element-dropdown/src/index.ts +15 -0
- package/src/react-native-element-dropdown/src/toolkits/index.ts +25 -0
- package/src/react-native-element-dropdown/src/toolkits/model.ts +5 -0
- package/src/react-native-element-dropdown/src/useDeviceOrientation.ts +37 -0
- package/src/react-utils/src/hooks.ts +176 -0
- package/src/react-utils/src/index.ts +1 -0
- package/src/rn-rulepilot/src/index.ts +4 -0
- package/src/rn-rulepilot/src/services/builder.ts +92 -0
- package/src/rn-rulepilot/src/services/evaluator.ts +176 -0
- package/src/rn-rulepilot/src/services/logger.ts +6 -0
- package/src/rn-rulepilot/src/services/mutator.ts +203 -0
- package/src/rn-rulepilot/src/services/object-discovery.ts +52 -0
- package/src/rn-rulepilot/src/services/rule-pilot.ts +172 -0
- package/src/rn-rulepilot/src/services/validator.ts +206 -0
- package/src/rn-rulepilot/src/types/error.ts +14 -0
- package/src/rn-rulepilot/src/types/rule.ts +35 -0
- package/src/rn-rulepilot/test-setup.ts +1 -0
- package/src/shopify/src/cache.ts +134 -0
- package/src/shopify/src/cart-utils.ts +295 -0
- package/src/shopify/src/checkout-utils.ts +124 -0
- package/src/shopify/src/discountv2-transformer.ts +322 -0
- package/src/shopify/src/filter.ts +287 -0
- package/src/shopify/src/index.ts +16 -0
- package/src/shopify/src/lineItemsv2-transformer.ts +225 -0
- package/src/shopify/src/orders.ts +521 -0
- package/src/shopify/src/queries/cart.ts +320 -0
- package/src/shopify/src/queries/catlog-fields.ts +187 -0
- package/src/shopify/src/queries/index.ts +1 -0
- package/src/shopify/src/queries/orders.ts +368 -0
- package/src/shopify/src/queries/query-generators.ts +737 -0
- package/src/shopify/src/queries.ts +474 -0
- package/src/shopify/src/shopify-auth.ts +410 -0
- package/src/shopify/src/shopify-cart.ts +1298 -0
- package/src/shopify/src/shopify-catlog-generic.ts +1168 -0
- package/src/shopify/src/shopify-checkout.ts +385 -0
- package/src/shopify/src/shopify-currency.ts +185 -0
- package/src/shopify/src/shopify-customer-cart.ts +1246 -0
- package/src/shopify/src/shopify-search-v2.ts +1234 -0
- package/src/shopify/src/shopify-search.ts +184 -0
- package/src/shopify/src/transformers.ts +715 -0
- package/src/shopify/src/utils.ts +300 -0
- package/src/shopify-types/src/generated-types/checkout/graphql-operations.ts +8767 -0
- package/src/shopify-types/src/generated-types/customer-accounts/operations.ts +5969 -0
- package/src/shopify-types/src/generated-types/graphql-operations.ts +9559 -0
- package/src/shopify-types/src/index.ts +59 -0
- package/src/shopify-types/src/schema/customerAccountsSchema.json +28093 -0
- package/src/shopify-types/src/types.ts +59 -0
- package/src/shopify-types/test-setup.ts +1 -0
- package/src/state/src/index.ts +22 -0
- package/src/state/src/lib/address.ts +248 -0
- package/src/state/src/lib/analytics/actions/app.ts +30 -0
- package/src/state/src/lib/analytics/actions/cart-wishlist.ts +192 -0
- package/src/state/src/lib/analytics/actions/device.ts +28 -0
- package/src/state/src/lib/analytics/actions/geo.ts +58 -0
- package/src/state/src/lib/analytics/actions/index.ts +9 -0
- package/src/state/src/lib/analytics/actions/order.ts +20 -0
- package/src/state/src/lib/analytics/actions/product-collection.ts +119 -0
- package/src/state/src/lib/analytics/actions/session.ts +74 -0
- package/src/state/src/lib/analytics/actions/user.ts +55 -0
- package/src/state/src/lib/analytics/actions/utm-params.ts +68 -0
- package/src/state/src/lib/analytics/index.ts +147 -0
- package/src/state/src/lib/analytics/utils.ts +173 -0
- package/src/state/src/lib/autofill-client.ts +42 -0
- package/src/state/src/lib/bundle.ts +228 -0
- package/src/state/src/lib/bundleV2.ts +110 -0
- package/src/state/src/lib/cart.ts +1779 -0
- package/src/state/src/lib/checkout.ts +26 -0
- package/src/state/src/lib/collection-metafields.ts +118 -0
- package/src/state/src/lib/collections.ts +636 -0
- package/src/state/src/lib/config.ts +437 -0
- package/src/state/src/lib/constants.ts +30 -0
- package/src/state/src/lib/device.ts +90 -0
- package/src/state/src/lib/discounts.ts +435 -0
- package/src/state/src/lib/estimated-delivery-date.ts +73 -0
- package/src/state/src/lib/filter.ts +343 -0
- package/src/state/src/lib/gift-wrap.ts +184 -0
- package/src/state/src/lib/google-signin.ts +3 -0
- package/src/state/src/lib/google-signin.web.ts +1 -0
- package/src/state/src/lib/hooks/block.ts +136 -0
- package/src/state/src/lib/hooks/cart.ts +233 -0
- package/src/state/src/lib/hooks/common.ts +34 -0
- package/src/state/src/lib/hooks/constants.ts +4 -0
- package/src/state/src/lib/hooks/deeplink.ts +190 -0
- package/src/state/src/lib/hooks/deeplink.web.ts +4 -0
- package/src/state/src/lib/hooks/estimated-delivery-date.ts +5 -0
- package/src/state/src/lib/hooks/filter.ts +37 -0
- package/src/state/src/lib/hooks/hooks.ts +843 -0
- package/src/state/src/lib/hooks/index.ts +29 -0
- package/src/state/src/lib/hooks/localization.ts +213 -0
- package/src/state/src/lib/hooks/metafield.ts +301 -0
- package/src/state/src/lib/hooks/modal.ts +68 -0
- package/src/state/src/lib/hooks/module.ts +31 -0
- package/src/state/src/lib/hooks/order.ts +23 -0
- package/src/state/src/lib/hooks/product.ts +202 -0
- package/src/state/src/lib/hooks/quantity-restriction.ts +51 -0
- package/src/state/src/lib/hooks/reviews.ts +27 -0
- package/src/state/src/lib/hooks/rewards.ts +69 -0
- package/src/state/src/lib/hooks/route.ts +90 -0
- package/src/state/src/lib/hooks/screen.ts +83 -0
- package/src/state/src/lib/hooks/search.ts +209 -0
- package/src/state/src/lib/hooks/settings.ts +20 -0
- package/src/state/src/lib/hooks/shipping-address.ts +5 -0
- package/src/state/src/lib/hooks/shop.ts +5 -0
- package/src/state/src/lib/hooks/shopify-query.ts +40 -0
- package/src/state/src/lib/hooks/sizing.ts +13 -0
- package/src/state/src/lib/hooks/title.ts +61 -0
- package/src/state/src/lib/hooks/variant-selector.ts +493 -0
- package/src/state/src/lib/hooks/video.ts +81 -0
- package/src/state/src/lib/http-client/index.ts +132 -0
- package/src/state/src/lib/integrations/analytics.ts +14 -0
- package/src/state/src/lib/integrations/gift.ts +102 -0
- package/src/state/src/lib/integrations/review.ts +212 -0
- package/src/state/src/lib/kiwi-sizing.ts +62 -0
- package/src/state/src/lib/localization.ts +524 -0
- package/src/state/src/lib/localization.web.ts +154 -0
- package/src/state/src/lib/metafield.ts +305 -0
- package/src/state/src/lib/modal.ts +177 -0
- package/src/state/src/lib/modules.ts +149 -0
- package/src/state/src/lib/offers.ts +0 -0
- package/src/state/src/lib/onboarding.ts +67 -0
- package/src/state/src/lib/order.ts +229 -0
- package/src/state/src/lib/orders.ts +199 -0
- package/src/state/src/lib/products.ts +1072 -0
- package/src/state/src/lib/promotions.ts +73 -0
- package/src/state/src/lib/reward-program.ts +86 -0
- package/src/state/src/lib/rewards.ts +106 -0
- package/src/state/src/lib/route.ts +586 -0
- package/src/state/src/lib/route.web.ts +52 -0
- package/src/state/src/lib/screen.ts +106 -0
- package/src/state/src/lib/search.ts +576 -0
- package/src/state/src/lib/shop.ts +74 -0
- package/src/state/src/lib/sizing-chart.ts +88 -0
- package/src/state/src/lib/splash-platform.ts +59 -0
- package/src/state/src/lib/splash-platform.web.ts +62 -0
- package/src/state/src/lib/splash.ts +497 -0
- package/src/state/src/lib/store.ts +138 -0
- package/src/state/src/lib/subscriptions.ts +589 -0
- package/src/state/src/lib/template.ts +42 -0
- package/src/state/src/lib/types.ts +11 -0
- package/src/state/src/lib/user-notifications.ts +153 -0
- package/src/state/src/lib/user.ts +1721 -0
- package/src/state/src/lib/utils.ts +586 -0
- package/src/state/src/lib/wishlist.ts +290 -0
- package/src/types/src/app-discounts.ts +118 -0
- package/src/types/src/app-themes.ts +7 -0
- package/src/types/src/blocks-definition/account.def.ts +535 -0
- package/src/types/src/blocks-definition/announcement-carousel.def.ts +201 -0
- package/src/types/src/blocks-definition/announcement-strip.def.ts +162 -0
- package/src/types/src/blocks-definition/announcement-ticker.def.ts +290 -0
- package/src/types/src/blocks-definition/app-bar.def.ts +323 -0
- package/src/types/src/blocks-definition/apply-coupon.def.ts +363 -0
- package/src/types/src/blocks-definition/cart-list.def.ts +445 -0
- package/src/types/src/blocks-definition/change-password.def.ts +229 -0
- package/src/types/src/blocks-definition/chips-navigation.def.ts +405 -0
- package/src/types/src/blocks-definition/collection-list.def.ts +415 -0
- package/src/types/src/blocks-definition/common.def.ts +793 -0
- package/src/types/src/blocks-definition/content.def.ts +2051 -0
- package/src/types/src/blocks-definition/countdown-banner.def.ts +537 -0
- package/src/types/src/blocks-definition/empty-block.def.ts +212 -0
- package/src/types/src/blocks-definition/firework.def.ts +128 -0
- package/src/types/src/blocks-definition/image-banner.def.ts +634 -0
- package/src/types/src/blocks-definition/image-collage.def.ts +505 -0
- package/src/types/src/blocks-definition/image-compare.def.ts +412 -0
- package/src/types/src/blocks-definition/image-list.def.ts +654 -0
- package/src/types/src/blocks-definition/image-marquee.def.ts +526 -0
- package/src/types/src/blocks-definition/index.ts +50 -0
- package/src/types/src/blocks-definition/metafield-image-compare.def.ts +394 -0
- package/src/types/src/blocks-definition/micro-contexts/product-card-v2.ts +2481 -0
- package/src/types/src/blocks-definition/past-searches.def.ts +352 -0
- package/src/types/src/blocks-definition/payment-details.def.ts +303 -0
- package/src/types/src/blocks-definition/previously-ordered-products.def.ts +421 -0
- package/src/types/src/blocks-definition/product-card.def.ts +416 -0
- package/src/types/src/blocks-definition/product-grid.def.ts +657 -0
- package/src/types/src/blocks-definition/product-hotspot.def.ts +401 -0
- package/src/types/src/blocks-definition/product-list.def.ts +944 -0
- package/src/types/src/blocks-definition/promo-carousel.def.ts +645 -0
- package/src/types/src/blocks-definition/recent-orders.def.ts +596 -0
- package/src/types/src/blocks-definition/recently-viewed-products.def.ts +412 -0
- package/src/types/src/blocks-definition/rewards-summary.def.ts +627 -0
- package/src/types/src/blocks-definition/rich-text-block.def.ts +303 -0
- package/src/types/src/blocks-definition/search-suggestions.def.ts +228 -0
- package/src/types/src/blocks-definition/sign-in.def.ts +555 -0
- package/src/types/src/blocks-definition/single-level-navigation.def.ts +303 -0
- package/src/types/src/blocks-definition/social-sign-in.def.ts +164 -0
- package/src/types/src/blocks-definition/sort-and-filter.def.ts +881 -0
- package/src/types/src/blocks-definition/tabbed-product-collection.def.ts +665 -0
- package/src/types/src/blocks-definition/text-list.def.ts +280 -0
- package/src/types/src/blocks-definition/two-level-navigation.def.ts +527 -0
- package/src/types/src/blocks-definition/types.ts +33 -0
- package/src/types/src/blocks-definition/video-banner.def.ts +483 -0
- package/src/types/src/blocks-definition/video-carousel.def.ts +611 -0
- package/src/types/src/blocks-definition/video-list.def.ts +280 -0
- package/src/types/src/blocks-definition/view-coupons.def.ts +382 -0
- package/src/types/src/blocks-definition/wishlisted-items.def.ts +530 -0
- package/src/types/src/blocks-definition/youtube-embed.def.ts +154 -0
- package/src/types/src/blocks.ts +3981 -0
- package/src/types/src/category-navigation.ts +16 -0
- package/src/types/src/common.ts +187 -0
- package/src/types/src/config.ts +705 -0
- package/src/types/src/countries.ts +2970 -0
- package/src/types/src/currencies.ts +1217 -0
- package/src/types/src/data.ts +257 -0
- package/src/types/src/feature-flags.ts +59 -0
- package/src/types/src/filter.ts +102 -0
- package/src/types/src/index.ts +35 -0
- package/src/types/src/integrations/analytics.ts +252 -0
- package/src/types/src/integrations/attentive.ts +88 -0
- package/src/types/src/integrations/automated-notifications.ts +87 -0
- package/src/types/src/integrations/cart.ts +81 -0
- package/src/types/src/integrations/edd.ts +35 -0
- package/src/types/src/integrations/gift.ts +130 -0
- package/src/types/src/integrations/index.ts +14 -0
- package/src/types/src/integrations/loyalty-lion.ts +8 -0
- package/src/types/src/integrations/otp-signin.ts +112 -0
- package/src/types/src/integrations/review.ts +50 -0
- package/src/types/src/integrations/rewards-v2.ts +5 -0
- package/src/types/src/integrations/social-signin.ts +12 -0
- package/src/types/src/integrations/subscriptions.ts +175 -0
- package/src/types/src/integrations/wishlist.ts +86 -0
- package/src/types/src/integrations/yotpo-rewards.ts +37 -0
- package/src/types/src/internationalization.ts +170 -0
- package/src/types/src/metafield.ts +5 -0
- package/src/types/src/modules.ts +566 -0
- package/src/types/src/navigation.ts +22 -0
- package/src/types/src/one-link.ts +20 -0
- package/src/types/src/order.ts +102 -0
- package/src/types/src/permissions.ts +9 -0
- package/src/types/src/product-update.ts +32 -0
- package/src/types/src/product.ts +268 -0
- package/src/types/src/push-notifications.ts +11 -0
- package/src/types/src/quantity-selector.ts +5 -0
- package/src/types/src/screen.ts +5 -0
- package/src/types/src/search.ts +137 -0
- package/src/types/src/searchtap.ts +97 -0
- package/src/types/src/settings.ts +54 -0
- package/src/types/src/shop.ts +13 -0
- package/src/types/src/storage.ts +31 -0
- package/src/types/src/style.ts +221 -0
- package/src/types/src/theme.ts +54 -0
- package/src/types/src/utils.ts +153 -0
- package/src/types/src/variant-selector.ts +218 -0
- package/src/ui-builder/src/components/atoms/accordian.tsx +110 -0
- package/src/ui-builder/src/components/atoms/block-section/block-section.tsx +128 -0
- package/src/ui-builder/src/components/atoms/block-section/hook.ts +251 -0
- package/src/ui-builder/src/components/atoms/block-section/index.ts +3 -0
- package/src/ui-builder/src/components/atoms/block-section/nav-button.tsx +101 -0
- package/src/ui-builder/src/components/atoms/block-section/section.tsx +76 -0
- package/src/ui-builder/src/components/atoms/block-section/types.ts +22 -0
- package/src/ui-builder/src/components/atoms/box.tsx +77 -0
- package/src/ui-builder/src/components/atoms/box.web.tsx +68 -0
- package/src/ui-builder/src/components/atoms/button.tsx +260 -0
- package/src/ui-builder/src/components/atoms/flex.tsx +44 -0
- package/src/ui-builder/src/components/atoms/header/header-image.tsx +142 -0
- package/src/ui-builder/src/components/atoms/header/header-link-button.tsx +57 -0
- package/src/ui-builder/src/components/atoms/header/header-text.tsx +49 -0
- package/src/ui-builder/src/components/atoms/header/header.tsx +179 -0
- package/src/ui-builder/src/components/atoms/header/index.ts +2 -0
- package/src/ui-builder/src/components/atoms/header/types.ts +63 -0
- package/src/ui-builder/src/components/atoms/header/utils.ts +28 -0
- package/src/ui-builder/src/components/atoms/helper/button-utils.ts +13 -0
- package/src/ui-builder/src/components/atoms/helper/button-utils.web.ts +8 -0
- package/src/ui-builder/src/components/atoms/html-rich-text.tsx +47 -0
- package/src/ui-builder/src/components/atoms/icon.tsx +12 -0
- package/src/ui-builder/src/components/atoms/image/image1.tsx +359 -0
- package/src/ui-builder/src/components/atoms/image/image1.web.tsx +276 -0
- package/src/ui-builder/src/components/atoms/image/types.ts +12 -0
- package/src/ui-builder/src/components/atoms/image.tsx +33 -0
- package/src/ui-builder/src/components/atoms/index.tsx +17 -0
- package/src/ui-builder/src/components/atoms/link.tsx +34 -0
- package/src/ui-builder/src/components/atoms/list.tsx +24 -0
- package/src/ui-builder/src/components/atoms/native-video.tsx +102 -0
- package/src/ui-builder/src/components/atoms/native-video.web.tsx +44 -0
- package/src/ui-builder/src/components/atoms/rich-text.tsx +147 -0
- package/src/ui-builder/src/components/atoms/spacer.tsx +11 -0
- package/src/ui-builder/src/components/atoms/text.tsx +60 -0
- package/src/ui-builder/src/components/atoms/vertical-list.tsx +177 -0
- package/src/ui-builder/src/components/atoms/youtube-video.tsx +99 -0
- package/src/ui-builder/src/components/blocks/content.tsx +32 -0
- package/src/ui-builder/src/components/index.ts +3 -0
- package/src/ui-builder/src/components/layout-elements/accordion.tsx +27 -0
- package/src/ui-builder/src/components/layout-elements/app-logo.tsx +39 -0
- package/src/ui-builder/src/components/layout-elements/html-rich-text.tsx +16 -0
- package/src/ui-builder/src/components/layout-elements/image.tsx +118 -0
- package/src/ui-builder/src/components/layout-elements/image.web.tsx +62 -0
- package/src/ui-builder/src/components/layout-elements/index.ts +12 -0
- package/src/ui-builder/src/components/layout-elements/link-button.tsx +37 -0
- package/src/ui-builder/src/components/layout-elements/link.tsx +35 -0
- package/src/ui-builder/src/components/layout-elements/list.tsx +16 -0
- package/src/ui-builder/src/components/layout-elements/rich-text.tsx +29 -0
- package/src/ui-builder/src/components/layout-elements/spacer.tsx +10 -0
- package/src/ui-builder/src/components/layout-elements/text.tsx +29 -0
- package/src/ui-builder/src/components/layout-elements/video.tsx +59 -0
- package/src/ui-builder/src/components/molecules/accordion.tsx +120 -0
- package/src/ui-builder/src/components/molecules/rich-text.tsx +132 -0
- package/src/ui-builder/src/components/molecules/rich-text.web.tsx +82 -0
- package/src/ui-builder/src/components/registery.tsx +404 -0
- package/src/ui-builder/src/helper-elements/cta.tsx +79 -0
- package/src/ui-builder/src/helper-elements/faq.tsx +143 -0
- package/src/ui-builder/src/helper-elements/html-rich-text.tsx +59 -0
- package/src/ui-builder/src/helper-elements/index.tsx +76 -0
- package/src/ui-builder/src/helper-elements/link-button.tsx +74 -0
- package/src/ui-builder/src/helper-elements/media-list-accordian.tsx +230 -0
- package/src/ui-builder/src/helper-elements/media-list.tsx +154 -0
- package/src/ui-builder/src/helper-elements/media.tsx +78 -0
- package/src/ui-builder/src/helper-elements/rich-text-accordion.tsx +148 -0
- package/src/ui-builder/src/helper-elements/rich-text-list.tsx +134 -0
- package/src/ui-builder/src/helper-elements/rich-text.tsx +61 -0
- package/src/ui-builder/src/helper-elements/testimonials.tsx +149 -0
- package/src/ui-builder/src/helper-elements/text.tsx +52 -0
- package/src/ui-builder/src/helper-elements/video-list.tsx +137 -0
- package/src/ui-builder/src/helper-elements/video.tsx +44 -0
- package/src/ui-builder/src/helper-elements/youtube-video.tsx +69 -0
- package/src/ui-builder/src/index.ts +42 -0
- package/src/ui-builder/src/style-utils.ts +127 -0
- package/src/ui-builder/src/types.ts +67 -0
- package/src/ui-builder/src/utils.ts +89 -0
- package/src/utils/src/cache.utils.ts +64 -0
- package/src/utils/src/common.utils.ts +47 -0
- package/src/utils/src/http-client.ts +258 -0
- package/src/utils/src/index.ts +5 -0
- package/src/utils/src/slack-client.ts +8 -0
- package/src/utils/src/telemetry-client.ts +69 -0
- package/src/utils.ts +30 -0
- package/tsconfig.paths.json +130 -0
|
@@ -0,0 +1,1721 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Address,
|
|
3
|
+
CreateCustomerInput,
|
|
4
|
+
Customer,
|
|
5
|
+
MailingAddressInput,
|
|
6
|
+
Order,
|
|
7
|
+
} from '@gauntlet/shopify-types'
|
|
8
|
+
import { LocalStorage } from '@gauntlet/local-storage'
|
|
9
|
+
import { StoreSlice } from './types'
|
|
10
|
+
import { ConfigSlice } from './config'
|
|
11
|
+
import { ModuleSlice } from './modules'
|
|
12
|
+
import {
|
|
13
|
+
AsyncData,
|
|
14
|
+
CheckUserExistsRequest,
|
|
15
|
+
CreateUserRequestForOtpSignIn,
|
|
16
|
+
GenerateOtpRequest,
|
|
17
|
+
ErrorCodes,
|
|
18
|
+
ICheckoutProvider,
|
|
19
|
+
IShopifyAuthProvider,
|
|
20
|
+
LoginCredentialsResponse,
|
|
21
|
+
Rewards,
|
|
22
|
+
SHOPIFY_CUSTOMER_AUTH_TOKEN,
|
|
23
|
+
SocialSigninRequest,
|
|
24
|
+
VerifyOtpApiResponseData,
|
|
25
|
+
VerifyOtpRequest,
|
|
26
|
+
} from '@gauntlet/types'
|
|
27
|
+
import { add } from 'date-fns'
|
|
28
|
+
|
|
29
|
+
import { Platform } from 'react-native'
|
|
30
|
+
import { AnalyticsEvent } from '@gauntlet/types'
|
|
31
|
+
import { getAnalyticsProvider } from './integrations/analytics'
|
|
32
|
+
import Toast from 'react-native-toast-message'
|
|
33
|
+
import { JsonObject } from 'type-fest'
|
|
34
|
+
import { AddressSlice } from './address'
|
|
35
|
+
import { CartSlice } from './cart'
|
|
36
|
+
import EnvConfig from 'react-native-config'
|
|
37
|
+
import { CookieManager } from '@gauntlet/cookie-manager'
|
|
38
|
+
import { SubscriptionSlice } from './subscriptions'
|
|
39
|
+
import { WishlistSlice } from './wishlist'
|
|
40
|
+
import deviceInfoModule from 'react-native-device-info'
|
|
41
|
+
import { googleSignin } from './google-signin'
|
|
42
|
+
import { RouteSlice } from './route'
|
|
43
|
+
import { ProductSlice } from './products'
|
|
44
|
+
import { CollectionSlice } from './collections'
|
|
45
|
+
import { MetafieldSlice } from './metafield'
|
|
46
|
+
import { EVENTS, EventEmitter } from '@gauntlet/event-emitter'
|
|
47
|
+
import { LocalizationSlice } from './localization'
|
|
48
|
+
import { updateUserAddressByCountry } from './hooks'
|
|
49
|
+
|
|
50
|
+
export interface Form<T> {
|
|
51
|
+
valid: boolean
|
|
52
|
+
data: T
|
|
53
|
+
}
|
|
54
|
+
export interface SignInData {
|
|
55
|
+
email: string | undefined
|
|
56
|
+
password: string | undefined
|
|
57
|
+
}
|
|
58
|
+
export interface SignUpData {
|
|
59
|
+
firstName: string | undefined
|
|
60
|
+
lastName: string | undefined
|
|
61
|
+
phone: string | undefined
|
|
62
|
+
email: string | undefined
|
|
63
|
+
password: string | undefined
|
|
64
|
+
acceptsMarketing: boolean | undefined
|
|
65
|
+
}
|
|
66
|
+
export interface RecoverEmailData {
|
|
67
|
+
email: string | undefined
|
|
68
|
+
}
|
|
69
|
+
export interface ChangePasswordData {
|
|
70
|
+
password: string | undefined
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface ResetPasswordData {
|
|
74
|
+
password: string | undefined
|
|
75
|
+
}
|
|
76
|
+
interface OtpVerificationData {
|
|
77
|
+
otp: string
|
|
78
|
+
isVerifyButtonDisabled: boolean
|
|
79
|
+
}
|
|
80
|
+
export interface CustomerAccessToken {
|
|
81
|
+
accessToken: string
|
|
82
|
+
expiresAt: string
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface CheckUserExistsApiResponseData {
|
|
86
|
+
customerExists: boolean
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface ErrorToastMessage {
|
|
90
|
+
error: string
|
|
91
|
+
errors?: any
|
|
92
|
+
errorCode?: string | number
|
|
93
|
+
}
|
|
94
|
+
export interface SuccessToastMessage {
|
|
95
|
+
success: string
|
|
96
|
+
data?: any
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface CustomerAccountsToken {
|
|
100
|
+
access_token: string
|
|
101
|
+
expires_in: number
|
|
102
|
+
id_token: string
|
|
103
|
+
refresh_token: string
|
|
104
|
+
timestamp: string
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export type FulfillmentLog = {
|
|
108
|
+
events: Array<{
|
|
109
|
+
status: string
|
|
110
|
+
message: string
|
|
111
|
+
happenedAt: string
|
|
112
|
+
estimatedDeliveryDate: string
|
|
113
|
+
city: string
|
|
114
|
+
province: string
|
|
115
|
+
zipcode: string
|
|
116
|
+
country: string
|
|
117
|
+
fulfilmentId: string
|
|
118
|
+
awb?: string
|
|
119
|
+
}>
|
|
120
|
+
awb?: string
|
|
121
|
+
status: string
|
|
122
|
+
estimatedDeliveryDate: string
|
|
123
|
+
id: string
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export type Fulfillments = Record<string, FulfillmentLog>
|
|
127
|
+
|
|
128
|
+
export type SignInForm = Form<SignInData>
|
|
129
|
+
export type SignUpForm = Form<SignUpData>
|
|
130
|
+
export type RecoverEmailForm = Form<RecoverEmailData>
|
|
131
|
+
export type ChangePasswordForm = Form<ChangePasswordData>
|
|
132
|
+
export type ResetPasswordForm = Form<ResetPasswordData>
|
|
133
|
+
type OtpVerificationForm = Form<OtpVerificationData>
|
|
134
|
+
export interface UserData {
|
|
135
|
+
customerAccessToken: AsyncData<CustomerAccessToken>
|
|
136
|
+
shippingAddress: AsyncData<Partial<Address>>
|
|
137
|
+
userDetails: AsyncData<Partial<Customer>>
|
|
138
|
+
customerCompanyId: AsyncData<{ companyLocationId: string }>
|
|
139
|
+
}
|
|
140
|
+
export interface UserForms {
|
|
141
|
+
signin: SignInForm
|
|
142
|
+
signup: SignUpForm
|
|
143
|
+
'recover-email': RecoverEmailForm
|
|
144
|
+
'change-password': ChangePasswordForm
|
|
145
|
+
'otp-verification': OtpVerificationForm
|
|
146
|
+
'reset-password': ResetPasswordForm
|
|
147
|
+
}
|
|
148
|
+
export type UserFormType = keyof UserForms
|
|
149
|
+
export type UserState = {
|
|
150
|
+
forms: UserForms
|
|
151
|
+
data: UserData
|
|
152
|
+
}
|
|
153
|
+
export interface UserSlice {
|
|
154
|
+
user: UserState & UserActions
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const initialFormState: UserForms = {
|
|
158
|
+
signin: { valid: false, data: { email: undefined, password: undefined } },
|
|
159
|
+
signup: {
|
|
160
|
+
valid: false,
|
|
161
|
+
data: {
|
|
162
|
+
email: undefined,
|
|
163
|
+
password: undefined,
|
|
164
|
+
firstName: undefined,
|
|
165
|
+
lastName: undefined,
|
|
166
|
+
phone: undefined,
|
|
167
|
+
acceptsMarketing: undefined,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
'recover-email': { valid: false, data: { email: undefined } },
|
|
171
|
+
'change-password': { valid: false, data: { password: undefined } },
|
|
172
|
+
'otp-verification': {
|
|
173
|
+
valid: false,
|
|
174
|
+
data: { otp: '', isVerifyButtonDisabled: false },
|
|
175
|
+
},
|
|
176
|
+
'reset-password': { valid: false, data: { password: undefined } },
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const initialUserState: UserState = {
|
|
180
|
+
forms: initialFormState,
|
|
181
|
+
data: {
|
|
182
|
+
customerAccessToken: { status: 'init' },
|
|
183
|
+
shippingAddress: { status: 'init' },
|
|
184
|
+
userDetails: { status: 'init' },
|
|
185
|
+
customerCompanyId: { status: 'init' },
|
|
186
|
+
},
|
|
187
|
+
}
|
|
188
|
+
export interface UserActions {
|
|
189
|
+
signin: () => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
190
|
+
signout: () => Promise<void>
|
|
191
|
+
signUp: () => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
192
|
+
resetUser: () => void
|
|
193
|
+
socialSignin: (
|
|
194
|
+
request: SocialSigninRequest
|
|
195
|
+
) => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
196
|
+
recoverCustomer: () => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
197
|
+
getCustomerAccessToken: () => string | undefined
|
|
198
|
+
getCustomerAccountsAccessToken: () => string | undefined
|
|
199
|
+
getCustomerCompanyId: () => string | undefined
|
|
200
|
+
getUserDetails: () => Promise<
|
|
201
|
+
| {
|
|
202
|
+
success: string
|
|
203
|
+
customerDetails: Partial<Customer>
|
|
204
|
+
}
|
|
205
|
+
| { error: unknown }
|
|
206
|
+
>
|
|
207
|
+
updateUserDetails: (
|
|
208
|
+
customer: Partial<CreateCustomerInput>
|
|
209
|
+
) => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
210
|
+
updateProfile: (
|
|
211
|
+
payload: Record<string, string | Record<string, string> | undefined>
|
|
212
|
+
) => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
213
|
+
updateDefaultAddress: (
|
|
214
|
+
id: Address['id']
|
|
215
|
+
) => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
216
|
+
createUserAddress: (
|
|
217
|
+
address: MailingAddressInput
|
|
218
|
+
) => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
219
|
+
deleteUserAddress: (
|
|
220
|
+
id: Address['id']
|
|
221
|
+
) => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
222
|
+
updateUserAddress: (
|
|
223
|
+
address: MailingAddressInput,
|
|
224
|
+
id: Address['id']
|
|
225
|
+
) => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
226
|
+
getFormData: (formType: UserFormType) => UserForms[UserFormType]['data']
|
|
227
|
+
getFormValidity: (formType: UserFormType) => UserForms[UserFormType]['valid']
|
|
228
|
+
updateFormData: (
|
|
229
|
+
formType: UserFormType,
|
|
230
|
+
data: UserForms[UserFormType]['data']
|
|
231
|
+
) => void
|
|
232
|
+
updateFormValidity: (formType: UserFormType, flag: boolean) => void
|
|
233
|
+
getLastOrder: () => Promise<AsyncData<Order>>
|
|
234
|
+
changePassword: () => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
235
|
+
isUserAuthenticated: () => boolean
|
|
236
|
+
getCustomerAddresses: () => Promise<ErrorToastMessage | SuccessToastMessage>
|
|
237
|
+
generateOtp: (request: GenerateOtpRequest) => Promise<
|
|
238
|
+
| ErrorToastMessage
|
|
239
|
+
| {
|
|
240
|
+
success?: string
|
|
241
|
+
requestId?: string
|
|
242
|
+
}
|
|
243
|
+
>
|
|
244
|
+
verifyOtp: (
|
|
245
|
+
request: VerifyOtpRequest
|
|
246
|
+
) => Promise<
|
|
247
|
+
SuccessToastMessage | ErrorToastMessage | VerifyOtpApiResponseData
|
|
248
|
+
>
|
|
249
|
+
checkUserExists: (
|
|
250
|
+
request: CheckUserExistsRequest
|
|
251
|
+
) => Promise<ErrorToastMessage | CheckUserExistsApiResponseData>
|
|
252
|
+
otpSignUp: (
|
|
253
|
+
request: CreateUserRequestForOtpSignIn
|
|
254
|
+
) => Promise<SuccessToastMessage | ErrorToastMessage | void>
|
|
255
|
+
updateOrderStatus: (orderId: string, status: string) => void
|
|
256
|
+
signinWithMultipass: (multipassToken: string) => Promise<void>
|
|
257
|
+
initiateSigninForVerifiedUser: ({
|
|
258
|
+
multipassToken,
|
|
259
|
+
email,
|
|
260
|
+
passKey,
|
|
261
|
+
activationUrl,
|
|
262
|
+
provider,
|
|
263
|
+
customerProps,
|
|
264
|
+
}: {
|
|
265
|
+
multipassToken?: string
|
|
266
|
+
email?: string
|
|
267
|
+
passKey?: string
|
|
268
|
+
provider?: string
|
|
269
|
+
activationUrl?: string
|
|
270
|
+
customerProps?: {
|
|
271
|
+
link_existing_account?: boolean
|
|
272
|
+
new_customer?: boolean
|
|
273
|
+
}
|
|
274
|
+
}) => Promise<ErrorToastMessage | void>
|
|
275
|
+
resetPasswordByUrl: (resetUrl: any) => Promise<void>
|
|
276
|
+
updateUserDummyData: () => void
|
|
277
|
+
refreshCustomerAccountToken: () => Promise<void>
|
|
278
|
+
signOutFromShopifyCustomerAccounts: () => Promise<void>
|
|
279
|
+
fetchCustomerAccountsAccessToken: (
|
|
280
|
+
code: string,
|
|
281
|
+
verifier: string
|
|
282
|
+
) => Promise<AsyncData<CustomerAccountsToken>>
|
|
283
|
+
fetchCustomerAccountsCompanyId: (
|
|
284
|
+
token: string
|
|
285
|
+
) => Promise<AsyncData<{ companyLocationId: string }>>
|
|
286
|
+
fetchCustomerAccountsCompanyId: (
|
|
287
|
+
token: string
|
|
288
|
+
) => Promise<AsyncData<{ companyLocationId: string }>>
|
|
289
|
+
getLoginCredentialsFromToken: (
|
|
290
|
+
token: CustomerAccountsToken['access_token']
|
|
291
|
+
) => Promise<AsyncData<LoginCredentialsResponse>>
|
|
292
|
+
signInUsingCustomerAccountToken: (
|
|
293
|
+
token: CustomerAccountsToken['access_token']
|
|
294
|
+
) => Promise<AsyncData<ErrorToastMessage | SuccessToastMessage>>
|
|
295
|
+
}
|
|
296
|
+
const localStorage = LocalStorage.getInstance()
|
|
297
|
+
|
|
298
|
+
export const createUserSlice: StoreSlice<
|
|
299
|
+
UserSlice,
|
|
300
|
+
UserSlice &
|
|
301
|
+
ConfigSlice &
|
|
302
|
+
ModuleSlice &
|
|
303
|
+
AddressSlice &
|
|
304
|
+
CartSlice &
|
|
305
|
+
SubscriptionSlice &
|
|
306
|
+
WishlistSlice &
|
|
307
|
+
RouteSlice &
|
|
308
|
+
ProductSlice &
|
|
309
|
+
CollectionSlice &
|
|
310
|
+
MetafieldSlice &
|
|
311
|
+
LocalizationSlice
|
|
312
|
+
> = (set, get) => ({
|
|
313
|
+
user: {
|
|
314
|
+
...initialUserState,
|
|
315
|
+
getCustomerAccessToken: () => {
|
|
316
|
+
const res = localStorage.getJson(
|
|
317
|
+
'customerAccessToken'
|
|
318
|
+
) as unknown as CustomerAccessToken
|
|
319
|
+
if (res && res.accessToken) return res.accessToken
|
|
320
|
+
return
|
|
321
|
+
},
|
|
322
|
+
getCustomerAccountsAccessToken: () => {
|
|
323
|
+
const res = localStorage.getJson(
|
|
324
|
+
SHOPIFY_CUSTOMER_AUTH_TOKEN
|
|
325
|
+
) as unknown as CustomerAccountsToken
|
|
326
|
+
if (res && res.access_token) return res.access_token
|
|
327
|
+
return
|
|
328
|
+
},
|
|
329
|
+
getCustomerCompanyId: () => {
|
|
330
|
+
const companyLocationId = get().user.data.customerCompanyId
|
|
331
|
+
if (companyLocationId?.status === 'idle' && companyLocationId?.data) {
|
|
332
|
+
return companyLocationId.data.companyLocationId
|
|
333
|
+
} else {
|
|
334
|
+
const id = localStorage.getJson('customerCompanyId') as {
|
|
335
|
+
companyLocationId: string
|
|
336
|
+
}
|
|
337
|
+
if (id) {
|
|
338
|
+
set((store) => {
|
|
339
|
+
store.user.data.customerCompanyId = {
|
|
340
|
+
status: 'idle',
|
|
341
|
+
data: { companyLocationId: id.companyLocationId },
|
|
342
|
+
}
|
|
343
|
+
})
|
|
344
|
+
return id.companyLocationId
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return undefined
|
|
348
|
+
},
|
|
349
|
+
isUserAuthenticated: () => {
|
|
350
|
+
return Boolean(get().user.getCustomerAccessToken())
|
|
351
|
+
},
|
|
352
|
+
getFormData: (formType: UserFormType) => {
|
|
353
|
+
const formData = get().user.forms[formType].data
|
|
354
|
+
return formData
|
|
355
|
+
},
|
|
356
|
+
getFormValidity: () => {
|
|
357
|
+
const { email, password } = get().user.forms['signin'].data
|
|
358
|
+
const emailPattern = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/
|
|
359
|
+
const isEmailValid = email?.match(emailPattern)
|
|
360
|
+
return Boolean(isEmailValid && Boolean(password))
|
|
361
|
+
},
|
|
362
|
+
updateFormData: (
|
|
363
|
+
formType: UserFormType,
|
|
364
|
+
data:
|
|
365
|
+
| SignInData
|
|
366
|
+
| SignUpData
|
|
367
|
+
| RecoverEmailData
|
|
368
|
+
| ChangePasswordData
|
|
369
|
+
| ResetPasswordData
|
|
370
|
+
) => {
|
|
371
|
+
set((store) => {
|
|
372
|
+
store.user.forms[formType].data = data
|
|
373
|
+
})
|
|
374
|
+
},
|
|
375
|
+
updateFormValidity: (formType: UserFormType, valid: boolean) => {
|
|
376
|
+
set((store) => {
|
|
377
|
+
store.user.forms[formType].valid = valid
|
|
378
|
+
})
|
|
379
|
+
},
|
|
380
|
+
signin: async () => {
|
|
381
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
382
|
+
const email = get().user.forms['signin'].data.email
|
|
383
|
+
const password = get().user.forms['signin'].data.password
|
|
384
|
+
if (!email || !password)
|
|
385
|
+
return { error: 'Login credentials are undefined' }
|
|
386
|
+
|
|
387
|
+
const response = await authModule.createCustomerAccessToken({
|
|
388
|
+
email,
|
|
389
|
+
password,
|
|
390
|
+
})
|
|
391
|
+
if (response.status === 'error') {
|
|
392
|
+
return (
|
|
393
|
+
response.error ?? {
|
|
394
|
+
error:
|
|
395
|
+
'Some error occured while shigning in. Response is undefined',
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
}
|
|
399
|
+
const { data } = response
|
|
400
|
+
if (!data.customerAccessTokenCreate)
|
|
401
|
+
return {
|
|
402
|
+
error:
|
|
403
|
+
'Login API response structure mismach, customerAccessTokenCreate is undefined',
|
|
404
|
+
}
|
|
405
|
+
const { customerUserErrors, customerAccessToken } =
|
|
406
|
+
data.customerAccessTokenCreate
|
|
407
|
+
return await onSignInSuccess(
|
|
408
|
+
customerUserErrors,
|
|
409
|
+
customerAccessToken,
|
|
410
|
+
set,
|
|
411
|
+
get,
|
|
412
|
+
'email-password'
|
|
413
|
+
)
|
|
414
|
+
},
|
|
415
|
+
socialSignin: async (request: SocialSigninRequest) => {
|
|
416
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
417
|
+
const { multipassToken, passKey, email } = await fetch(
|
|
418
|
+
`${EnvConfig['APP_SERVICE_URL']}/integrations/social-signin/signin`,
|
|
419
|
+
{
|
|
420
|
+
method: 'post',
|
|
421
|
+
body: JSON.stringify(request),
|
|
422
|
+
headers: {
|
|
423
|
+
'Content-Type': 'application/json',
|
|
424
|
+
},
|
|
425
|
+
}
|
|
426
|
+
)
|
|
427
|
+
.then((res: any) => res.json())
|
|
428
|
+
.catch((err) => {
|
|
429
|
+
Toast.show({
|
|
430
|
+
type: 'error',
|
|
431
|
+
text1: 'Something went wrong',
|
|
432
|
+
})
|
|
433
|
+
})
|
|
434
|
+
|
|
435
|
+
if (multipassToken) {
|
|
436
|
+
return await onSigninWithMultipass(
|
|
437
|
+
multipassToken,
|
|
438
|
+
authModule,
|
|
439
|
+
get,
|
|
440
|
+
set,
|
|
441
|
+
request.provider
|
|
442
|
+
)
|
|
443
|
+
} else {
|
|
444
|
+
return await onSigninWithoutMultipass(
|
|
445
|
+
email,
|
|
446
|
+
passKey,
|
|
447
|
+
authModule,
|
|
448
|
+
get,
|
|
449
|
+
set,
|
|
450
|
+
request.provider
|
|
451
|
+
)
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
signout: async () => {
|
|
455
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
456
|
+
const accessToken = get().user.getCustomerAccessToken()
|
|
457
|
+
const webClientId =
|
|
458
|
+
get().config.data?.integrations?.socialSignin?.googleWebClientId
|
|
459
|
+
if (!accessToken)
|
|
460
|
+
return { status: 'error', error: 'access token not defined' }
|
|
461
|
+
get().user.resetUser()
|
|
462
|
+
get().cart.resetCart()
|
|
463
|
+
get().subscriptions.resetSubscriptions()
|
|
464
|
+
if (webClientId) {
|
|
465
|
+
await googleSignin.signOut()
|
|
466
|
+
}
|
|
467
|
+
const { status, data, error } =
|
|
468
|
+
await authModule.deleteCustomerAccessToken(accessToken)
|
|
469
|
+
await get().user.signOutFromShopifyCustomerAccounts()
|
|
470
|
+
|
|
471
|
+
// we should always reset the user irrespective of the response
|
|
472
|
+
if (status !== 'success') {
|
|
473
|
+
return error ?? { error: 'Logout failed!!' }
|
|
474
|
+
}
|
|
475
|
+
const analytics = getAnalyticsProvider(get)
|
|
476
|
+
analytics.sendEvent(AnalyticsEvent.LOGOUT, {})
|
|
477
|
+
const eventEmitter = EventEmitter.getInstance()
|
|
478
|
+
eventEmitter.publish(EVENTS.SIGNOUT_SUCCESS, {})
|
|
479
|
+
return {
|
|
480
|
+
success: 'Logout successful!',
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
resetUser: () => {
|
|
484
|
+
localStorage.set('customerAccessToken', {})
|
|
485
|
+
localStorage.delete('bearerToken')
|
|
486
|
+
localStorage.delete('addressForm')
|
|
487
|
+
CookieManager.clearAll() // we are deliberately not going to wait for the promise
|
|
488
|
+
set((userSlice) => {
|
|
489
|
+
userSlice.address.updateFormData({})
|
|
490
|
+
userSlice.user.forms = initialFormState
|
|
491
|
+
userSlice.user.data = {
|
|
492
|
+
customerAccessToken: { status: 'init' },
|
|
493
|
+
shippingAddress: { status: 'init' },
|
|
494
|
+
userDetails: { status: 'init' },
|
|
495
|
+
customerCompanyId: { status: 'init' },
|
|
496
|
+
}
|
|
497
|
+
})
|
|
498
|
+
get().wishlist.clear()
|
|
499
|
+
get().userNotifications.resetSlice()
|
|
500
|
+
|
|
501
|
+
// Clear session data for gokwik
|
|
502
|
+
try {
|
|
503
|
+
if (get().modules.isModuleDefined('checkout')) {
|
|
504
|
+
get().modules.getModule<ICheckoutProvider>('checkout').onSignOut()
|
|
505
|
+
}
|
|
506
|
+
} catch (error) {
|
|
507
|
+
console.error('Error in checkout provider onSignOut function', error)
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
signUp: async () => {
|
|
511
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
512
|
+
const formData = { ...get().user.forms['signup'].data }
|
|
513
|
+
const { firstName, lastName, email, phone, password, acceptsMarketing } =
|
|
514
|
+
formData
|
|
515
|
+
|
|
516
|
+
if (!firstName || !lastName || !email || !password)
|
|
517
|
+
return { error: 'signup form data empty for some fields' }
|
|
518
|
+
|
|
519
|
+
const { data, status, error } = await authModule.createCustomer({
|
|
520
|
+
acceptsMarketing: acceptsMarketing ?? false,
|
|
521
|
+
email,
|
|
522
|
+
password,
|
|
523
|
+
firstName,
|
|
524
|
+
lastName,
|
|
525
|
+
phone: phone || null,
|
|
526
|
+
})
|
|
527
|
+
|
|
528
|
+
if (status !== 'success') {
|
|
529
|
+
return (
|
|
530
|
+
{ error: error } ?? {
|
|
531
|
+
error: 'Signup for user failed.',
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
}
|
|
535
|
+
if (!data.customerCreate)
|
|
536
|
+
return { error: 'Response is not proper, customerCreate is undefined.' }
|
|
537
|
+
const { customerUserErrors, customer } = data.customerCreate
|
|
538
|
+
if (customerUserErrors && customerUserErrors.length > 0) {
|
|
539
|
+
const errorCode = customerUserErrors[0].code
|
|
540
|
+
?.toUpperCase()
|
|
541
|
+
?.replace(/\s+/g, '_')
|
|
542
|
+
const customErrorMessage =
|
|
543
|
+
get().config.data?.settings?.messages?.[`AUTH_ERROR_${errorCode}`]
|
|
544
|
+
return { error: customErrorMessage ?? customerUserErrors[0].message }
|
|
545
|
+
}
|
|
546
|
+
const analytics = getAnalyticsProvider(get)
|
|
547
|
+
analytics.sendEvent(AnalyticsEvent.SIGNUP, {
|
|
548
|
+
method: 'email-password',
|
|
549
|
+
})
|
|
550
|
+
set((userSlice) => {
|
|
551
|
+
userSlice.user.data.userDetails = customer
|
|
552
|
+
userSlice.user.forms.signin.data.email = email
|
|
553
|
+
userSlice.user.forms.signin.data.password = password
|
|
554
|
+
})
|
|
555
|
+
|
|
556
|
+
const res = await get().user.signin()
|
|
557
|
+
if (res.error) return res
|
|
558
|
+
return { success: 'Account created successfully' }
|
|
559
|
+
},
|
|
560
|
+
updateUserDetails: async (user: Partial<CreateCustomerInput>) => {
|
|
561
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
562
|
+
const accessToken = get().user.getCustomerAccessToken()
|
|
563
|
+
if (!accessToken)
|
|
564
|
+
return { status: 'error', error: 'access token not defined' }
|
|
565
|
+
const { data, status, error } = await authModule.updateCustomer(
|
|
566
|
+
accessToken,
|
|
567
|
+
user
|
|
568
|
+
)
|
|
569
|
+
if (status !== 'success') {
|
|
570
|
+
return (
|
|
571
|
+
error ?? {
|
|
572
|
+
status: 'error',
|
|
573
|
+
error: 'update user details network call failed.',
|
|
574
|
+
}
|
|
575
|
+
)
|
|
576
|
+
}
|
|
577
|
+
if (!data.customerUpdate)
|
|
578
|
+
return (
|
|
579
|
+
error ?? {
|
|
580
|
+
status: 'error',
|
|
581
|
+
error:
|
|
582
|
+
'data.customerUpdate.customer is undefined in updateuserDetails.',
|
|
583
|
+
}
|
|
584
|
+
)
|
|
585
|
+
const { customer: userDetails } = data.customerUpdate
|
|
586
|
+
set((userSlice) => {
|
|
587
|
+
if (userDetails?.firstName)
|
|
588
|
+
userSlice.user.data.userDetails.data.firstName = userDetails.firstName
|
|
589
|
+
if (userDetails?.lastName)
|
|
590
|
+
userSlice.user.data.userDetails.data.lastName = userDetails.lastName
|
|
591
|
+
if (userDetails?.phone)
|
|
592
|
+
userSlice.user.data.userDetails.data.phone = userDetails.phone
|
|
593
|
+
})
|
|
594
|
+
return {
|
|
595
|
+
status: 'success',
|
|
596
|
+
success: 'User details updated successfully',
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
updateProfile: async (
|
|
600
|
+
payload: Record<string, string | Record<string, string> | undefined>
|
|
601
|
+
): Promise<ErrorToastMessage | SuccessToastMessage> => {
|
|
602
|
+
const accessToken = get().user.getCustomerAccessToken()
|
|
603
|
+
const userDetails = get().user.data.userDetails as {
|
|
604
|
+
data?: { id?: string }
|
|
605
|
+
}
|
|
606
|
+
const customerId = userDetails?.data?.id
|
|
607
|
+
if (!accessToken) return { error: 'access token not defined' }
|
|
608
|
+
if (!customerId) return { error: 'customer id not found' }
|
|
609
|
+
try {
|
|
610
|
+
const response = await fetch(
|
|
611
|
+
`${EnvConfig['APP_SERVICE_URL']}/integrations/shopify/customers`,
|
|
612
|
+
{
|
|
613
|
+
method: 'PATCH',
|
|
614
|
+
body: JSON.stringify(payload),
|
|
615
|
+
headers: {
|
|
616
|
+
'x-customer-access-token': accessToken,
|
|
617
|
+
'x-app-id': EnvConfig['APP_ID'],
|
|
618
|
+
'Content-Type': 'application/json',
|
|
619
|
+
},
|
|
620
|
+
}
|
|
621
|
+
)
|
|
622
|
+
const data = await response.json()
|
|
623
|
+
if (!response.ok) {
|
|
624
|
+
const { message, errors, errorCode } = data
|
|
625
|
+
if (errorCode == ErrorCodes.VALIDATION_ERROR) {
|
|
626
|
+
if (Array.isArray(errors) && errors.length > 0) {
|
|
627
|
+
return { error: 'Some fields are invalid', errors }
|
|
628
|
+
}
|
|
629
|
+
return { error: message ?? 'Some fields are invalid' }
|
|
630
|
+
}
|
|
631
|
+
return {
|
|
632
|
+
error: message ?? 'Failed to update profile',
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
await get().user.getUserDetails()
|
|
636
|
+
return { success: 'Profile updated successfully' }
|
|
637
|
+
} catch (err) {
|
|
638
|
+
return {
|
|
639
|
+
error:
|
|
640
|
+
err instanceof Error ? err.message : 'Failed to update profile',
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
getUserDetails: async () => {
|
|
645
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
646
|
+
let accessToken = get().user.getCustomerAccessToken()
|
|
647
|
+
function onGetUserDetailsError(error: any) {
|
|
648
|
+
set((store) => {
|
|
649
|
+
store.user.data.userDetails.status = 'error'
|
|
650
|
+
})
|
|
651
|
+
get().user.resetUser()
|
|
652
|
+
return { error }
|
|
653
|
+
}
|
|
654
|
+
if (!accessToken) {
|
|
655
|
+
return { error: 'Access token is not defined, cannot get user details' }
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
set((store) => {
|
|
659
|
+
store.user.data.userDetails.status = 'loading'
|
|
660
|
+
})
|
|
661
|
+
|
|
662
|
+
const profileFields = (get().config?.data?.integrations?.[
|
|
663
|
+
'customer-rich-profile'
|
|
664
|
+
]?.profileFields ?? []) as Array<{ key: string; hidden?: boolean }>
|
|
665
|
+
const visibleProfileFields = profileFields.filter(
|
|
666
|
+
(f) => f.hidden !== true
|
|
667
|
+
)
|
|
668
|
+
const metafieldIdentifiers = visibleProfileFields.map((f) => ({
|
|
669
|
+
namespace: 'custom' as const,
|
|
670
|
+
key: f.key,
|
|
671
|
+
}))
|
|
672
|
+
|
|
673
|
+
const { status, data, error } = await authModule.getCustomerDetails(
|
|
674
|
+
accessToken,
|
|
675
|
+
metafieldIdentifiers
|
|
676
|
+
)
|
|
677
|
+
if (status !== 'success') {
|
|
678
|
+
return onGetUserDetailsError(
|
|
679
|
+
error ? { error } : { error: 'Fetching user details failed' }
|
|
680
|
+
)
|
|
681
|
+
}
|
|
682
|
+
if (!data.customer) {
|
|
683
|
+
return onGetUserDetailsError(
|
|
684
|
+
'Customer details not found, data.customer is undefined'
|
|
685
|
+
)
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
const { customer: customerDetails } = data
|
|
689
|
+
const { defaultAddress } = customerDetails
|
|
690
|
+
|
|
691
|
+
set((userSlice) => {
|
|
692
|
+
const address = customerDetails.addresses.edges[0]
|
|
693
|
+
userSlice.address.updateFormData({
|
|
694
|
+
email: customerDetails.email,
|
|
695
|
+
firstName: customerDetails.firstName,
|
|
696
|
+
lastName: customerDetails.lastName,
|
|
697
|
+
phone: customerDetails.phone,
|
|
698
|
+
zip: address?.zip,
|
|
699
|
+
city: address?.city,
|
|
700
|
+
country: address?.country,
|
|
701
|
+
province: address?.province,
|
|
702
|
+
address1: address?.address1,
|
|
703
|
+
address2: address?.address2,
|
|
704
|
+
})
|
|
705
|
+
userSlice.user.data.userDetails.status = 'idle'
|
|
706
|
+
userSlice.user.data.userDetails.data = {
|
|
707
|
+
...customerDetails,
|
|
708
|
+
orders: mapUserOrders(customerDetails),
|
|
709
|
+
}
|
|
710
|
+
})
|
|
711
|
+
if (defaultAddress) {
|
|
712
|
+
const {
|
|
713
|
+
country,
|
|
714
|
+
zip,
|
|
715
|
+
province,
|
|
716
|
+
city,
|
|
717
|
+
address1,
|
|
718
|
+
address2,
|
|
719
|
+
phone,
|
|
720
|
+
countryCodeV2,
|
|
721
|
+
} = defaultAddress
|
|
722
|
+
localStorage.set('addressForm', {
|
|
723
|
+
country: { countryName: country, countryCode: countryCodeV2 },
|
|
724
|
+
zip,
|
|
725
|
+
province,
|
|
726
|
+
city,
|
|
727
|
+
address1,
|
|
728
|
+
address2,
|
|
729
|
+
email: customerDetails?.email,
|
|
730
|
+
firstName: customerDetails?.firstName,
|
|
731
|
+
lastName: customerDetails?.lastName,
|
|
732
|
+
phone: phone ?? customerDetails?.phone,
|
|
733
|
+
})
|
|
734
|
+
set((userSlice) => {
|
|
735
|
+
userSlice.user.data.shippingAddress.status = 'idle'
|
|
736
|
+
userSlice.user.data.shippingAddress.data = defaultAddress
|
|
737
|
+
})
|
|
738
|
+
}
|
|
739
|
+
const {
|
|
740
|
+
status: tokenStatus,
|
|
741
|
+
data: tokenData,
|
|
742
|
+
error: tokenError,
|
|
743
|
+
} = await authModule.renewCustomerAccessToken(accessToken)
|
|
744
|
+
if (tokenStatus === 'success') {
|
|
745
|
+
accessToken =
|
|
746
|
+
tokenData.customerAccessTokenRenew?.customerAccessToken?.accessToken
|
|
747
|
+
if (accessToken)
|
|
748
|
+
localStorage.set(
|
|
749
|
+
'customerAccessToken',
|
|
750
|
+
tokenData.customerAccessTokenRenew.customerAccessToken
|
|
751
|
+
)
|
|
752
|
+
}
|
|
753
|
+
if (tokenStatus !== 'success') {
|
|
754
|
+
return onGetUserDetailsError(
|
|
755
|
+
tokenError
|
|
756
|
+
? { error: tokenError }
|
|
757
|
+
: { error: 'Refresh Token could not be renewed' }
|
|
758
|
+
)
|
|
759
|
+
}
|
|
760
|
+
return { success: 'User details fetched and updated', customerDetails }
|
|
761
|
+
},
|
|
762
|
+
createUserAddress: async (address: MailingAddressInput) => {
|
|
763
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
764
|
+
const accessToken = get().user.getCustomerAccessToken()
|
|
765
|
+
if (!accessToken) {
|
|
766
|
+
return { status: 'error', error: 'access token not defined' }
|
|
767
|
+
}
|
|
768
|
+
const { countryCodeV2, ...rest } = address
|
|
769
|
+
const { status, data, error } = await authModule.createCustomerAddress(
|
|
770
|
+
rest,
|
|
771
|
+
accessToken
|
|
772
|
+
)
|
|
773
|
+
if (status !== 'success')
|
|
774
|
+
return {
|
|
775
|
+
status: 'error',
|
|
776
|
+
error: error ?? 'createUserAddress network request failed',
|
|
777
|
+
}
|
|
778
|
+
if (
|
|
779
|
+
data.customerAddressCreate &&
|
|
780
|
+
data.customerAddressCreate.customerUserErrors.length !== 0
|
|
781
|
+
) {
|
|
782
|
+
return {
|
|
783
|
+
status: 'error',
|
|
784
|
+
error:
|
|
785
|
+
data.customerAddressCreate.customerUserErrors[0]?.message ??
|
|
786
|
+
'Field error',
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
await get().user.getCustomerAddresses()
|
|
790
|
+
|
|
791
|
+
get().address.createAddress(address)
|
|
792
|
+
const isMultiCurrencyEnabled =
|
|
793
|
+
get().config.data?.settings?.['global']?.enableMultiCurrencyV4
|
|
794
|
+
const localizationCountryName =
|
|
795
|
+
get().localization.data.selectedCountry?.name
|
|
796
|
+
|
|
797
|
+
if (
|
|
798
|
+
isMultiCurrencyEnabled &&
|
|
799
|
+
address.country === localizationCountryName
|
|
800
|
+
) {
|
|
801
|
+
get().cart.updateShippingAddress()
|
|
802
|
+
// if we allow user to update address with country that is different than the localization country, new cart will show prices in the address country currency rather than the localization country currency. So we are not allowing user to select address with different country
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
return {
|
|
806
|
+
success: 'Address is added successfully.',
|
|
807
|
+
id: data.customerAddressCreate?.customerAddress?.id,
|
|
808
|
+
}
|
|
809
|
+
},
|
|
810
|
+
getCustomerAddresses: async () => {
|
|
811
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
812
|
+
const accessToken = get().user.getCustomerAccessToken()
|
|
813
|
+
if (!accessToken)
|
|
814
|
+
return {
|
|
815
|
+
status: 'error',
|
|
816
|
+
error: 'access token not defined in getCustomerAddresses',
|
|
817
|
+
}
|
|
818
|
+
const { status, data, error } = await authModule.getCustomerAddresses(
|
|
819
|
+
accessToken
|
|
820
|
+
)
|
|
821
|
+
if (status !== 'success')
|
|
822
|
+
return error ?? { error: 'getCustomerAddresses network request failed' }
|
|
823
|
+
const addresses = data?.customer?.addresses?.edges
|
|
824
|
+
set((userSlice) => {
|
|
825
|
+
userSlice.user.data.userDetails.data.addresses.edges = addresses
|
|
826
|
+
})
|
|
827
|
+
return { success: 'Address list is updated successfully.' }
|
|
828
|
+
},
|
|
829
|
+
deleteUserAddress: async (addressId: string) => {
|
|
830
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
831
|
+
const accessToken = get().user.getCustomerAccessToken()
|
|
832
|
+
if (!accessToken)
|
|
833
|
+
return {
|
|
834
|
+
status: 'error',
|
|
835
|
+
error: 'access token not defined in deleteUserAddress',
|
|
836
|
+
}
|
|
837
|
+
const { status, data, error } = await authModule.deleteCustomerAddress(
|
|
838
|
+
accessToken,
|
|
839
|
+
addressId
|
|
840
|
+
)
|
|
841
|
+
if (status !== 'success')
|
|
842
|
+
return error ?? { error: 'deleteUserAddress network request failed' }
|
|
843
|
+
if (
|
|
844
|
+
data.customerAddressDelete &&
|
|
845
|
+
data.customerAddressDelete.customerUserErrors.length !== 0
|
|
846
|
+
) {
|
|
847
|
+
return {
|
|
848
|
+
status: 'error',
|
|
849
|
+
error:
|
|
850
|
+
data.customerAddressDelete.customerUserErrors[0]?.message ??
|
|
851
|
+
'Field error',
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
await get().user.getCustomerAddresses()
|
|
855
|
+
return {
|
|
856
|
+
success: 'Address is deleted successfully.',
|
|
857
|
+
id: data.customerAddressDelete?.deletedCustomerAddressId,
|
|
858
|
+
}
|
|
859
|
+
},
|
|
860
|
+
updateUserAddress: async (
|
|
861
|
+
address: MailingAddressInput,
|
|
862
|
+
addressId: string
|
|
863
|
+
) => {
|
|
864
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
865
|
+
const accessToken = get().user.getCustomerAccessToken()
|
|
866
|
+
if (!accessToken)
|
|
867
|
+
return {
|
|
868
|
+
status: 'error',
|
|
869
|
+
error: 'access token not defined in deleteUserAddress',
|
|
870
|
+
}
|
|
871
|
+
const { countryCodeV2, ...rest } = address
|
|
872
|
+
const { status, data, error } = await authModule.updateCustomerAddress(
|
|
873
|
+
rest,
|
|
874
|
+
accessToken,
|
|
875
|
+
addressId
|
|
876
|
+
)
|
|
877
|
+
if (status !== 'success') {
|
|
878
|
+
return {
|
|
879
|
+
error: 'updateUserAddress network request failed',
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
if (
|
|
884
|
+
data.customerAddressUpdate &&
|
|
885
|
+
data.customerAddressUpdate.customerUserErrors?.length !== 0
|
|
886
|
+
) {
|
|
887
|
+
return {
|
|
888
|
+
status: 'error',
|
|
889
|
+
error:
|
|
890
|
+
data.customerAddressUpdate.customerUserErrors[0]?.message ??
|
|
891
|
+
'Field error',
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
await get().user.getCustomerAddresses()
|
|
896
|
+
return { success: 'Address is updated successfully.' }
|
|
897
|
+
},
|
|
898
|
+
updateDefaultAddress: async (addressId: string) => {
|
|
899
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
900
|
+
const accessToken = get().user.getCustomerAccessToken()
|
|
901
|
+
if (!accessToken)
|
|
902
|
+
return {
|
|
903
|
+
status: 'error',
|
|
904
|
+
error: 'access token not defined in deleteUserAddress',
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
const { status, data, error } = await authModule.updateDefaultAddress(
|
|
908
|
+
accessToken,
|
|
909
|
+
addressId
|
|
910
|
+
)
|
|
911
|
+
if (status !== 'success')
|
|
912
|
+
return (
|
|
913
|
+
error ?? {
|
|
914
|
+
status: 'error',
|
|
915
|
+
error: 'updateUserAddress network request failed',
|
|
916
|
+
}
|
|
917
|
+
)
|
|
918
|
+
},
|
|
919
|
+
async getLastOrder() {
|
|
920
|
+
const module = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
921
|
+
const token = get().user.getCustomerAccessToken()
|
|
922
|
+
if (!token)
|
|
923
|
+
return {
|
|
924
|
+
status: 'error',
|
|
925
|
+
error: {
|
|
926
|
+
message: 'User not signed in',
|
|
927
|
+
code: 'UNIDENTIFIED_USER',
|
|
928
|
+
rootCause:
|
|
929
|
+
'Tried to fetch orders when customerAccessToken was not defined ',
|
|
930
|
+
},
|
|
931
|
+
}
|
|
932
|
+
const res = await module.getLastOrder(token)
|
|
933
|
+
if (res.error)
|
|
934
|
+
return {
|
|
935
|
+
status: 'error',
|
|
936
|
+
error: {
|
|
937
|
+
message: "Couldn't fetch order details",
|
|
938
|
+
code: res.error.name,
|
|
939
|
+
rootCause: res.error.message,
|
|
940
|
+
},
|
|
941
|
+
}
|
|
942
|
+
if (res.data) {
|
|
943
|
+
return { status: 'idle', data: mapUserOrders(res.data.customer)[0] }
|
|
944
|
+
}
|
|
945
|
+
return {
|
|
946
|
+
status: 'error',
|
|
947
|
+
error: {
|
|
948
|
+
message: 'Something wrong happened',
|
|
949
|
+
code: 'UNKOWN_ERROR',
|
|
950
|
+
rootCause: 'Both data and error were undefined',
|
|
951
|
+
},
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
recoverCustomer: async () => {
|
|
955
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
956
|
+
const recoverEmail = get().user.forms['recover-email'].data.email
|
|
957
|
+
if (!recoverEmail) return { status: 'error', error: 'Invalid Email' }
|
|
958
|
+
|
|
959
|
+
const { data, status, error } = await authModule.recoverCustomer(
|
|
960
|
+
recoverEmail
|
|
961
|
+
)
|
|
962
|
+
if (status !== 'success') {
|
|
963
|
+
return {
|
|
964
|
+
status: 'error',
|
|
965
|
+
error: error ?? 'Unable to send email, recover email failed.',
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
if (!data.customerRecover)
|
|
969
|
+
return {
|
|
970
|
+
status: 'error',
|
|
971
|
+
error:
|
|
972
|
+
'Unable to send email, recover email failed. customerRecover is undefined',
|
|
973
|
+
}
|
|
974
|
+
const { customerUserErrors } = data.customerRecover
|
|
975
|
+
if (customerUserErrors && customerUserErrors.length > 0) {
|
|
976
|
+
return { error: customerUserErrors[0].message }
|
|
977
|
+
}
|
|
978
|
+
return { success: 'We have sent a reset link to your email address.' }
|
|
979
|
+
},
|
|
980
|
+
changePassword: async () => {
|
|
981
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
982
|
+
const newPassword = get().user.forms['change-password'].data.password
|
|
983
|
+
const token = get().user.getCustomerAccessToken()
|
|
984
|
+
if (!token)
|
|
985
|
+
return {
|
|
986
|
+
status: 'error',
|
|
987
|
+
error: {
|
|
988
|
+
message: 'User not signed in',
|
|
989
|
+
code: 'UNIDENTIFIED_USER',
|
|
990
|
+
rootCause:
|
|
991
|
+
'Tried to update password when customerAccessToken was not defined ',
|
|
992
|
+
},
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
const { data, status, error } = await authModule.updateCustomer(token, {
|
|
996
|
+
password: newPassword,
|
|
997
|
+
})
|
|
998
|
+
if (status !== 'success') {
|
|
999
|
+
return (
|
|
1000
|
+
error ?? {
|
|
1001
|
+
status: 'error',
|
|
1002
|
+
error: 'changePassword network request failed',
|
|
1003
|
+
}
|
|
1004
|
+
)
|
|
1005
|
+
}
|
|
1006
|
+
if (!data.customerUpdate || !data.customerUpdate.customer) {
|
|
1007
|
+
get().user.resetUser()
|
|
1008
|
+
return {
|
|
1009
|
+
status: 'error',
|
|
1010
|
+
error:
|
|
1011
|
+
'changePassword network request failed, customerUpdate or customer is undefined',
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
const { customerUserErrors, customer, customerAccessToken } =
|
|
1016
|
+
data.customerUpdate
|
|
1017
|
+
if (customerUserErrors && customerUserErrors.length > 0)
|
|
1018
|
+
return { error: customerUserErrors[0].message }
|
|
1019
|
+
|
|
1020
|
+
set((userSlice) => {
|
|
1021
|
+
userSlice.user.data.customerAccessToken = customerAccessToken
|
|
1022
|
+
})
|
|
1023
|
+
localStorage.set('customerAccessToken', customerAccessToken)
|
|
1024
|
+
return { success: 'Password changed successfully' }
|
|
1025
|
+
},
|
|
1026
|
+
generateOtp: async (request: GenerateOtpRequest) => {
|
|
1027
|
+
try {
|
|
1028
|
+
const response = await fetch(
|
|
1029
|
+
`${EnvConfig['APP_SERVICE_URL']}/integrations/otp-signin/generate-otp`,
|
|
1030
|
+
{
|
|
1031
|
+
method: 'POST',
|
|
1032
|
+
body: JSON.stringify(request),
|
|
1033
|
+
headers: {
|
|
1034
|
+
'x-app-id': EnvConfig['APP_ID'],
|
|
1035
|
+
'x-app-version': deviceInfoModule.getVersion(),
|
|
1036
|
+
'x-app-platform': Platform.OS,
|
|
1037
|
+
'Content-Type': 'application/json',
|
|
1038
|
+
},
|
|
1039
|
+
}
|
|
1040
|
+
)
|
|
1041
|
+
|
|
1042
|
+
const responseData = await response.json()
|
|
1043
|
+
if (!response.ok) {
|
|
1044
|
+
const { message, errorCode } = responseData
|
|
1045
|
+
return {
|
|
1046
|
+
error: message,
|
|
1047
|
+
errorCode,
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
const { isSuccess, message, requestId } = responseData
|
|
1051
|
+
if (isSuccess) {
|
|
1052
|
+
return {
|
|
1053
|
+
success: message,
|
|
1054
|
+
requestId,
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
return responseData
|
|
1058
|
+
} catch (err) {
|
|
1059
|
+
console.error(err)
|
|
1060
|
+
return { error: 'Unable to connect to server!' }
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
verifyOtp: async (request: VerifyOtpRequest) => {
|
|
1064
|
+
try {
|
|
1065
|
+
const response = await fetch(
|
|
1066
|
+
`${EnvConfig['APP_SERVICE_URL']}/integrations/otp-signin/verify-otp`,
|
|
1067
|
+
{
|
|
1068
|
+
method: 'POST',
|
|
1069
|
+
body: JSON.stringify(request),
|
|
1070
|
+
headers: {
|
|
1071
|
+
'x-app-id': EnvConfig['APP_ID'],
|
|
1072
|
+
'x-app-version': deviceInfoModule.getVersion(),
|
|
1073
|
+
'x-app-platform': Platform.OS,
|
|
1074
|
+
'Content-Type': 'application/json',
|
|
1075
|
+
},
|
|
1076
|
+
}
|
|
1077
|
+
)
|
|
1078
|
+
|
|
1079
|
+
const responseData = await response.json()
|
|
1080
|
+
if (!response.ok) {
|
|
1081
|
+
const { message, errorCode } = responseData
|
|
1082
|
+
return {
|
|
1083
|
+
error: message,
|
|
1084
|
+
errorCode,
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
try {
|
|
1088
|
+
if (get().modules.isModuleDefined('checkout')) {
|
|
1089
|
+
get()
|
|
1090
|
+
.modules.getModule<ICheckoutProvider>('checkout')
|
|
1091
|
+
.onOtpVerify?.(responseData)
|
|
1092
|
+
}
|
|
1093
|
+
} catch (err) {
|
|
1094
|
+
console.error('Error in checkout onOtpVerify function', err)
|
|
1095
|
+
}
|
|
1096
|
+
return responseData
|
|
1097
|
+
} catch (err) {
|
|
1098
|
+
console.error(err)
|
|
1099
|
+
return { error: 'Unable to connect to server!' }
|
|
1100
|
+
}
|
|
1101
|
+
},
|
|
1102
|
+
checkUserExists: async (request: CheckUserExistsRequest) => {
|
|
1103
|
+
try {
|
|
1104
|
+
const response = await fetch(
|
|
1105
|
+
`${EnvConfig['APP_SERVICE_URL']}/integrations/otp-signin/check-user-exists`,
|
|
1106
|
+
{
|
|
1107
|
+
method: 'POST',
|
|
1108
|
+
body: JSON.stringify(request),
|
|
1109
|
+
headers: {
|
|
1110
|
+
'x-app-id': EnvConfig['APP_ID'],
|
|
1111
|
+
'x-app-version': deviceInfoModule.getVersion(),
|
|
1112
|
+
'x-app-platform': Platform.OS,
|
|
1113
|
+
'Content-Type': 'application/json',
|
|
1114
|
+
},
|
|
1115
|
+
}
|
|
1116
|
+
)
|
|
1117
|
+
const responseData = await response.json()
|
|
1118
|
+
if (!response.ok) {
|
|
1119
|
+
const { message, errorCode } = responseData
|
|
1120
|
+
return {
|
|
1121
|
+
error: message,
|
|
1122
|
+
errorCode,
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
return responseData
|
|
1126
|
+
} catch (err) {
|
|
1127
|
+
console.error(err)
|
|
1128
|
+
return { error: 'Unable to connect to server!' }
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
otpSignUp: async (request: CreateUserRequestForOtpSignIn) => {
|
|
1132
|
+
try {
|
|
1133
|
+
const response = await fetch(
|
|
1134
|
+
`${EnvConfig['APP_SERVICE_URL']}/integrations/otp-signin/create-user`,
|
|
1135
|
+
{
|
|
1136
|
+
method: 'POST',
|
|
1137
|
+
body: JSON.stringify(request),
|
|
1138
|
+
headers: {
|
|
1139
|
+
'x-app-id': EnvConfig['APP_ID'],
|
|
1140
|
+
'x-app-version': deviceInfoModule.getVersion(),
|
|
1141
|
+
'x-app-platform': Platform.OS,
|
|
1142
|
+
'Content-Type': 'application/json',
|
|
1143
|
+
},
|
|
1144
|
+
}
|
|
1145
|
+
)
|
|
1146
|
+
|
|
1147
|
+
const responseData = await response.json()
|
|
1148
|
+
if (!response.ok) {
|
|
1149
|
+
const { message, errorCode } = responseData
|
|
1150
|
+
return {
|
|
1151
|
+
error: message,
|
|
1152
|
+
errorCode,
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
const { multipassToken, email, passKey, activationUrl } = responseData
|
|
1156
|
+
return get().user.initiateSigninForVerifiedUser({
|
|
1157
|
+
email,
|
|
1158
|
+
multipassToken,
|
|
1159
|
+
passKey,
|
|
1160
|
+
activationUrl,
|
|
1161
|
+
provider: 'otp-signin',
|
|
1162
|
+
customerProps: { new_customer: true },
|
|
1163
|
+
})
|
|
1164
|
+
} catch (err) {
|
|
1165
|
+
console.error(err)
|
|
1166
|
+
return { error: 'Unable to connect to server!' }
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
updateOrderStatus: (orderId: string, status: string) => {
|
|
1170
|
+
set((store) => {
|
|
1171
|
+
const userDetails = store.user.data.userDetails
|
|
1172
|
+
if (userDetails.status !== 'idle') return
|
|
1173
|
+
const user = userDetails.data
|
|
1174
|
+
const order = user.orders?.find((order) => order.id === orderId)
|
|
1175
|
+
if (order) {
|
|
1176
|
+
order.fulfillmentStatus = status as any
|
|
1177
|
+
}
|
|
1178
|
+
})
|
|
1179
|
+
},
|
|
1180
|
+
signinWithMultipass: async (multipassToken: string) => {
|
|
1181
|
+
if (multipassToken) {
|
|
1182
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
1183
|
+
const { data, status, error } =
|
|
1184
|
+
await authModule.createCustomerAccessTokenUsingMultipass(
|
|
1185
|
+
multipassToken
|
|
1186
|
+
)
|
|
1187
|
+
if (status === 'error' && error) {
|
|
1188
|
+
return error
|
|
1189
|
+
}
|
|
1190
|
+
const { customerUserErrors, customerAccessToken } =
|
|
1191
|
+
data.customerAccessTokenCreateWithMultipass
|
|
1192
|
+
return await onSignInSuccess(
|
|
1193
|
+
customerUserErrors,
|
|
1194
|
+
customerAccessToken,
|
|
1195
|
+
set,
|
|
1196
|
+
get
|
|
1197
|
+
)
|
|
1198
|
+
}
|
|
1199
|
+
},
|
|
1200
|
+
initiateSigninForVerifiedUser: async ({
|
|
1201
|
+
multipassToken,
|
|
1202
|
+
email,
|
|
1203
|
+
passKey,
|
|
1204
|
+
activationUrl,
|
|
1205
|
+
provider,
|
|
1206
|
+
customerProps,
|
|
1207
|
+
}: {
|
|
1208
|
+
multipassToken?: string
|
|
1209
|
+
email?: string
|
|
1210
|
+
passKey?: string
|
|
1211
|
+
activationUrl?: string
|
|
1212
|
+
provider?: string
|
|
1213
|
+
customerProps?: {
|
|
1214
|
+
link_existing_account?: boolean
|
|
1215
|
+
new_customer?: boolean
|
|
1216
|
+
}
|
|
1217
|
+
}) => {
|
|
1218
|
+
if (multipassToken) {
|
|
1219
|
+
return await onSigninWithMultipass(
|
|
1220
|
+
multipassToken,
|
|
1221
|
+
get().modules.getModule<IShopifyAuthProvider>('auth'),
|
|
1222
|
+
get,
|
|
1223
|
+
set,
|
|
1224
|
+
provider,
|
|
1225
|
+
customerProps
|
|
1226
|
+
)
|
|
1227
|
+
}
|
|
1228
|
+
if (activationUrl && passKey) {
|
|
1229
|
+
return await onSigninWithActivationUrl(
|
|
1230
|
+
activationUrl,
|
|
1231
|
+
passKey,
|
|
1232
|
+
get().modules.getModule<IShopifyAuthProvider>('auth'),
|
|
1233
|
+
get,
|
|
1234
|
+
set,
|
|
1235
|
+
provider,
|
|
1236
|
+
customerProps
|
|
1237
|
+
)
|
|
1238
|
+
}
|
|
1239
|
+
if (email && passKey) {
|
|
1240
|
+
return await onSigninWithoutMultipass(
|
|
1241
|
+
email,
|
|
1242
|
+
passKey,
|
|
1243
|
+
get().modules.getModule<IShopifyAuthProvider>('auth'),
|
|
1244
|
+
get,
|
|
1245
|
+
set,
|
|
1246
|
+
provider,
|
|
1247
|
+
customerProps
|
|
1248
|
+
)
|
|
1249
|
+
}
|
|
1250
|
+
return { error: 'No credentials provided for sign in.' }
|
|
1251
|
+
},
|
|
1252
|
+
resetPasswordByUrl: async (resetUrl: any) => {
|
|
1253
|
+
const newPassword = get().user.forms['reset-password'].data.password
|
|
1254
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
1255
|
+
const { data, status, error } = await authModule.resetPasswordByUrl(
|
|
1256
|
+
newPassword,
|
|
1257
|
+
resetUrl
|
|
1258
|
+
)
|
|
1259
|
+
if (status === 'error' && error) {
|
|
1260
|
+
return error
|
|
1261
|
+
}
|
|
1262
|
+
if (!data.customerResetByUrl) {
|
|
1263
|
+
return error ?? { error: 'Reset password failed' }
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
return { success: 'Sign in using new password' }
|
|
1267
|
+
},
|
|
1268
|
+
updateUserDummyData: () => {
|
|
1269
|
+
localStorage.set('customerAccessToken', {
|
|
1270
|
+
accessToken: '1234567',
|
|
1271
|
+
expiresAt: add(new Date(), { days: 1 }),
|
|
1272
|
+
})
|
|
1273
|
+
set((userSlice) => {
|
|
1274
|
+
userSlice.address.updateFormData({
|
|
1275
|
+
email: 'John.Doe@yahoo.com',
|
|
1276
|
+
firstName: 'John',
|
|
1277
|
+
lastName: 'Doe',
|
|
1278
|
+
phone: '415-555-8976',
|
|
1279
|
+
zip: '94105',
|
|
1280
|
+
city: 'San Francisco',
|
|
1281
|
+
country: {
|
|
1282
|
+
countryCallingCode: '1',
|
|
1283
|
+
countryName: 'United States',
|
|
1284
|
+
countryCode: 'US',
|
|
1285
|
+
},
|
|
1286
|
+
province: 'California',
|
|
1287
|
+
address1: '123 Market Street',
|
|
1288
|
+
address2: 'Suite 400',
|
|
1289
|
+
})
|
|
1290
|
+
userSlice.user.data.userDetails.status = 'idle'
|
|
1291
|
+
userSlice.user.data.userDetails.data = {
|
|
1292
|
+
firstName: 'John',
|
|
1293
|
+
lastName: 'Doe',
|
|
1294
|
+
email: 'John.Doe@yahoo.co',
|
|
1295
|
+
displayName: 'John Doe',
|
|
1296
|
+
phone: '9667122352',
|
|
1297
|
+
}
|
|
1298
|
+
})
|
|
1299
|
+
},
|
|
1300
|
+
//customer accounts actions
|
|
1301
|
+
refreshCustomerAccountToken: async () => {
|
|
1302
|
+
const customerAccountsToken = localStorage.getJson(
|
|
1303
|
+
SHOPIFY_CUSTOMER_AUTH_TOKEN
|
|
1304
|
+
) as CustomerAccountsToken
|
|
1305
|
+
if (!customerAccountsToken) return
|
|
1306
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
1307
|
+
const res = await authModule.refreshCustomerAccountToken()
|
|
1308
|
+
if (res.status === 'error') {
|
|
1309
|
+
console.error('Error refreshing customer account token', res.error)
|
|
1310
|
+
return
|
|
1311
|
+
}
|
|
1312
|
+
if (res?.status !== 'idle') {
|
|
1313
|
+
console.error(
|
|
1314
|
+
'Error refreshing customer account token status',
|
|
1315
|
+
res.status
|
|
1316
|
+
)
|
|
1317
|
+
return
|
|
1318
|
+
}
|
|
1319
|
+
const { access_token, expires_in, refresh_token } = res.data
|
|
1320
|
+
localStorage.set(
|
|
1321
|
+
SHOPIFY_CUSTOMER_AUTH_TOKEN,
|
|
1322
|
+
JSON.stringify({
|
|
1323
|
+
access_token,
|
|
1324
|
+
expires_in,
|
|
1325
|
+
refresh_token,
|
|
1326
|
+
timestamp: Date.now(),
|
|
1327
|
+
})
|
|
1328
|
+
)
|
|
1329
|
+
console.debug('Token refreshed successfully')
|
|
1330
|
+
},
|
|
1331
|
+
signOutFromShopifyCustomerAccounts: async () => {
|
|
1332
|
+
if (!get().user.getCustomerAccountsAccessToken()) return
|
|
1333
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
1334
|
+
localStorage.delete(SHOPIFY_CUSTOMER_AUTH_TOKEN)
|
|
1335
|
+
localStorage.delete('customerCompanyId')
|
|
1336
|
+
await authModule.signOutFromShopifyCustomerAccounts()
|
|
1337
|
+
await get().config.resetStore()
|
|
1338
|
+
},
|
|
1339
|
+
fetchCustomerAccountsAccessToken: async (code, verifier) => {
|
|
1340
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
1341
|
+
const res = await authModule.fetchCustomerAccountsAccessToken(
|
|
1342
|
+
code,
|
|
1343
|
+
verifier
|
|
1344
|
+
)
|
|
1345
|
+
if (res.status === 'error') {
|
|
1346
|
+
return {
|
|
1347
|
+
status: 'error',
|
|
1348
|
+
error: {
|
|
1349
|
+
message: 'Failed to fetch customer accounts access token',
|
|
1350
|
+
code: `${res.error}`,
|
|
1351
|
+
rootCause: 'Fetch customer accounts access token API failed.',
|
|
1352
|
+
},
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
if (res.status !== 'idle') {
|
|
1356
|
+
return {
|
|
1357
|
+
status: 'error',
|
|
1358
|
+
error: {
|
|
1359
|
+
message: 'Unknown error occurred',
|
|
1360
|
+
code: 'UNKNOWN_ERROR',
|
|
1361
|
+
rootCause: `Fetch customer accounts access token API failed.- ${res.status}`,
|
|
1362
|
+
},
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
const tokenData = res.data
|
|
1366
|
+
setCustomerAccountsAccessToken(tokenData)
|
|
1367
|
+
await get().user.fetchCustomerAccountsCompanyId(tokenData.access_token)
|
|
1368
|
+
return {
|
|
1369
|
+
status: 'idle',
|
|
1370
|
+
success: 'Customer accounts access token obtained successfully',
|
|
1371
|
+
data: tokenData,
|
|
1372
|
+
}
|
|
1373
|
+
},
|
|
1374
|
+
fetchCustomerAccountsCompanyId: async (token: string) => {
|
|
1375
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
1376
|
+
const { status, data } = await authModule.getCompanyLocationId(token)
|
|
1377
|
+
if (!data) {
|
|
1378
|
+
return {
|
|
1379
|
+
status: 'error',
|
|
1380
|
+
error: {
|
|
1381
|
+
message: 'Failed to obtain company location id',
|
|
1382
|
+
code: `${status}`,
|
|
1383
|
+
rootCause: 'Obtain company location id API failed.',
|
|
1384
|
+
},
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
const companyLocationId =
|
|
1388
|
+
data?.customer?.companyContacts?.edges?.[0]?.node?.company?.locations
|
|
1389
|
+
?.edges?.[0]?.node?.id
|
|
1390
|
+
if (!companyLocationId) {
|
|
1391
|
+
return {
|
|
1392
|
+
status: 'error',
|
|
1393
|
+
error: {
|
|
1394
|
+
message: 'Failed to fetch company location id',
|
|
1395
|
+
code: `${status}`,
|
|
1396
|
+
rootCause: 'Obtain company location id response incorect.',
|
|
1397
|
+
},
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
set((userSlice) => {
|
|
1401
|
+
userSlice.user.data.customerCompanyId = {
|
|
1402
|
+
status: 'idle',
|
|
1403
|
+
data: { companyLocationId },
|
|
1404
|
+
}
|
|
1405
|
+
})
|
|
1406
|
+
localStorage.set('customerCompanyId', {
|
|
1407
|
+
companyLocationId,
|
|
1408
|
+
})
|
|
1409
|
+
await get().config.resetStore()
|
|
1410
|
+
return {
|
|
1411
|
+
status: 'idle',
|
|
1412
|
+
success: 'Company location id obtained successfully',
|
|
1413
|
+
data: { companyLocationId },
|
|
1414
|
+
}
|
|
1415
|
+
},
|
|
1416
|
+
getLoginCredentialsFromToken: async (token) => {
|
|
1417
|
+
const authModule = get().modules.getModule<IShopifyAuthProvider>('auth')
|
|
1418
|
+
const res = await authModule.getLoginCredentialsFromToken(token)
|
|
1419
|
+
if (res.status === 'error') {
|
|
1420
|
+
return {
|
|
1421
|
+
status: 'error',
|
|
1422
|
+
error: {
|
|
1423
|
+
message: 'Failed to fetch login credentials',
|
|
1424
|
+
code: `${res.error}`,
|
|
1425
|
+
rootCause: 'Fetch login credentials API failed.',
|
|
1426
|
+
},
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
if (res.status !== 'idle') {
|
|
1430
|
+
return {
|
|
1431
|
+
status: 'error',
|
|
1432
|
+
error: {
|
|
1433
|
+
message: 'Unknown error occurred',
|
|
1434
|
+
code: 'UNKNOWN_ERROR',
|
|
1435
|
+
rootCause: `Fetch login credentials API failed.- ${res.status}`,
|
|
1436
|
+
},
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
return { status: 'idle', data: res.data }
|
|
1440
|
+
},
|
|
1441
|
+
signInUsingCustomerAccountToken: async (token) => {
|
|
1442
|
+
if (!token) {
|
|
1443
|
+
return {
|
|
1444
|
+
status: 'error',
|
|
1445
|
+
error: {
|
|
1446
|
+
message: 'Token is not defined',
|
|
1447
|
+
code: 'TOKEN_UNDEFINED',
|
|
1448
|
+
},
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
const loginCredentialsRes = await get().user.getLoginCredentialsFromToken(
|
|
1452
|
+
token
|
|
1453
|
+
)
|
|
1454
|
+
|
|
1455
|
+
if (loginCredentialsRes.status === 'error') {
|
|
1456
|
+
return {
|
|
1457
|
+
status: 'error',
|
|
1458
|
+
error: {
|
|
1459
|
+
message: loginCredentialsRes.error?.message || 'Invalid token',
|
|
1460
|
+
code: 'INVALID_TOKEN',
|
|
1461
|
+
},
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
if (loginCredentialsRes.status !== 'idle') {
|
|
1466
|
+
return {
|
|
1467
|
+
status: 'error',
|
|
1468
|
+
error: {
|
|
1469
|
+
message:
|
|
1470
|
+
'Unknown error occurred during sign in using customer account',
|
|
1471
|
+
code: 'UNKNOWN_ERROR',
|
|
1472
|
+
},
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
const loginCredentials = loginCredentialsRes.data
|
|
1476
|
+
const isSignedIn = await get().user.initiateSigninForVerifiedUser({
|
|
1477
|
+
email: loginCredentials?.email,
|
|
1478
|
+
passKey: loginCredentials?.passKey,
|
|
1479
|
+
multipassToken: loginCredentials?.multipassToken,
|
|
1480
|
+
activationUrl: loginCredentials?.activationUrl,
|
|
1481
|
+
})
|
|
1482
|
+
|
|
1483
|
+
if (isSignedIn?.error) {
|
|
1484
|
+
return {
|
|
1485
|
+
status: 'error',
|
|
1486
|
+
error: {
|
|
1487
|
+
message:
|
|
1488
|
+
typeof isSignedIn.error === 'string'
|
|
1489
|
+
? isSignedIn.error
|
|
1490
|
+
: 'Sign in failed',
|
|
1491
|
+
code: 'SIGN_IN_FAILED',
|
|
1492
|
+
},
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
return {
|
|
1496
|
+
status: 'idle',
|
|
1497
|
+
data: {
|
|
1498
|
+
success: 'Sign in successful',
|
|
1499
|
+
},
|
|
1500
|
+
}
|
|
1501
|
+
},
|
|
1502
|
+
},
|
|
1503
|
+
})
|
|
1504
|
+
|
|
1505
|
+
async function onSignInSuccess(
|
|
1506
|
+
customerUserErrors: Array<any>,
|
|
1507
|
+
customerAccessToken: CustomerAccessToken,
|
|
1508
|
+
set: any,
|
|
1509
|
+
get: any,
|
|
1510
|
+
provider?: string,
|
|
1511
|
+
customerProps?: {
|
|
1512
|
+
link_existing_account?: boolean
|
|
1513
|
+
new_customer?: boolean
|
|
1514
|
+
}
|
|
1515
|
+
) {
|
|
1516
|
+
if (customerUserErrors.length > 0) {
|
|
1517
|
+
const errorCode = customerUserErrors[0].code
|
|
1518
|
+
?.toUpperCase()
|
|
1519
|
+
?.replace(/\s+/g, '_')
|
|
1520
|
+
const customErrorMessage =
|
|
1521
|
+
get().config.data?.settings?.messages?.[`AUTH_ERROR_${errorCode}`]
|
|
1522
|
+
return { error: customErrorMessage ?? customerUserErrors[0].message }
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
if (!customerAccessToken || !customerAccessToken.accessToken)
|
|
1526
|
+
return {
|
|
1527
|
+
error: 'Access token is undefined',
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
try {
|
|
1531
|
+
if (get()?.modules?.isModuleDefined('checkout')) {
|
|
1532
|
+
get()?.modules?.getModule('checkout')?.onSignIn()
|
|
1533
|
+
}
|
|
1534
|
+
} catch (err) {
|
|
1535
|
+
console.error('Error in checkout onSignIn function', err)
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
localStorage.set(
|
|
1539
|
+
'customerAccessToken',
|
|
1540
|
+
customerAccessToken as unknown as JsonObject
|
|
1541
|
+
)
|
|
1542
|
+
set((userSlice: any) => {
|
|
1543
|
+
userSlice.user.data.customerAccessToken = {
|
|
1544
|
+
status: 'idle',
|
|
1545
|
+
data: customerAccessToken,
|
|
1546
|
+
}
|
|
1547
|
+
})
|
|
1548
|
+
const { customerDetails } = await get().user.getUserDetails()
|
|
1549
|
+
|
|
1550
|
+
await updateUserAddressByCountry({ userDetails: customerDetails })
|
|
1551
|
+
const analytics = getAnalyticsProvider(get)
|
|
1552
|
+
try {
|
|
1553
|
+
const rewards = get().modules.getModule<Rewards>('rewards')
|
|
1554
|
+
rewards &&
|
|
1555
|
+
rewards.onSignin &&
|
|
1556
|
+
rewards.onSignin(customerAccessToken.accessToken, customerDetails.email)
|
|
1557
|
+
} catch (err) {
|
|
1558
|
+
console.error(err)
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
const analyticsPayload: any = { method: provider }
|
|
1562
|
+
if (customerProps?.new_customer) {
|
|
1563
|
+
analyticsPayload['new_customer'] = 'true'
|
|
1564
|
+
analytics.sendEvent(AnalyticsEvent.SIGNUP, analyticsPayload)
|
|
1565
|
+
}
|
|
1566
|
+
if (customerProps?.link_existing_account) {
|
|
1567
|
+
analyticsPayload['link_existing_account'] = 'true'
|
|
1568
|
+
}
|
|
1569
|
+
analytics.sendEvent(AnalyticsEvent.LOGIN, analyticsPayload)
|
|
1570
|
+
|
|
1571
|
+
const eventEmitter = EventEmitter.getInstance()
|
|
1572
|
+
eventEmitter.publish(EVENTS.SIGNIN_SUCCESS, {
|
|
1573
|
+
customerDetails: customerDetails,
|
|
1574
|
+
customerAccessToken: customerAccessToken.accessToken,
|
|
1575
|
+
acceptsMarketing: customerDetails.acceptsMarketing,
|
|
1576
|
+
})
|
|
1577
|
+
|
|
1578
|
+
return { success: 'Sign in successfully' }
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
async function onSigninWithMultipass(
|
|
1582
|
+
multipassToken: string,
|
|
1583
|
+
authModule: IShopifyAuthProvider,
|
|
1584
|
+
get: any,
|
|
1585
|
+
set: any,
|
|
1586
|
+
provider?: string,
|
|
1587
|
+
customerProps?: {
|
|
1588
|
+
link_existing_account?: boolean
|
|
1589
|
+
new_customer?: boolean
|
|
1590
|
+
}
|
|
1591
|
+
) {
|
|
1592
|
+
const { data, status, error } =
|
|
1593
|
+
await authModule.createCustomerAccessTokenUsingMultipass(multipassToken)
|
|
1594
|
+
if (status === 'error' && error) {
|
|
1595
|
+
return error
|
|
1596
|
+
}
|
|
1597
|
+
const { customerUserErrors, customerAccessToken } =
|
|
1598
|
+
data.customerAccessTokenCreateWithMultipass
|
|
1599
|
+
return await onSignInSuccess(
|
|
1600
|
+
customerUserErrors,
|
|
1601
|
+
customerAccessToken,
|
|
1602
|
+
set,
|
|
1603
|
+
get,
|
|
1604
|
+
provider,
|
|
1605
|
+
customerProps
|
|
1606
|
+
)
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
async function onSigninWithoutMultipass(
|
|
1610
|
+
email: string,
|
|
1611
|
+
passKey: string,
|
|
1612
|
+
authModule: IShopifyAuthProvider,
|
|
1613
|
+
get: any,
|
|
1614
|
+
set: any,
|
|
1615
|
+
provider?: string,
|
|
1616
|
+
customerProps?: {
|
|
1617
|
+
link_existing_account?: boolean
|
|
1618
|
+
new_customer?: boolean
|
|
1619
|
+
}
|
|
1620
|
+
) {
|
|
1621
|
+
const { data, status, error } = await authModule.createCustomerAccessToken({
|
|
1622
|
+
email,
|
|
1623
|
+
password: passKey,
|
|
1624
|
+
})
|
|
1625
|
+
if (status === 'error' && error) {
|
|
1626
|
+
return error
|
|
1627
|
+
}
|
|
1628
|
+
const { customerUserErrors, customerAccessToken } =
|
|
1629
|
+
data.customerAccessTokenCreate
|
|
1630
|
+
return await onSignInSuccess(
|
|
1631
|
+
customerUserErrors,
|
|
1632
|
+
customerAccessToken,
|
|
1633
|
+
set,
|
|
1634
|
+
get,
|
|
1635
|
+
provider,
|
|
1636
|
+
customerProps
|
|
1637
|
+
)
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
async function onSigninWithActivationUrl(
|
|
1641
|
+
activationUrl: string,
|
|
1642
|
+
passKey: string,
|
|
1643
|
+
authModule: IShopifyAuthProvider,
|
|
1644
|
+
get: any,
|
|
1645
|
+
set: any,
|
|
1646
|
+
provider?: string,
|
|
1647
|
+
customerProps?: {
|
|
1648
|
+
link_existing_account?: boolean
|
|
1649
|
+
new_customer?: boolean
|
|
1650
|
+
}
|
|
1651
|
+
) {
|
|
1652
|
+
const { data, status, error } =
|
|
1653
|
+
await authModule.createCustomerAccessTokenUsingActivationUrl(
|
|
1654
|
+
activationUrl,
|
|
1655
|
+
passKey
|
|
1656
|
+
)
|
|
1657
|
+
if (status === 'error' && error) {
|
|
1658
|
+
return error
|
|
1659
|
+
}
|
|
1660
|
+
const { customerUserErrors, customerAccessToken } = data.customerActivateByUrl
|
|
1661
|
+
return await onSignInSuccess(
|
|
1662
|
+
customerUserErrors,
|
|
1663
|
+
customerAccessToken,
|
|
1664
|
+
set,
|
|
1665
|
+
get,
|
|
1666
|
+
provider,
|
|
1667
|
+
customerProps
|
|
1668
|
+
)
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
function mapUserOrders(customer: any): Order[] {
|
|
1672
|
+
if (!customer.orders?.edges) return []
|
|
1673
|
+
return (
|
|
1674
|
+
customer.orders?.edges?.map((order: any) => {
|
|
1675
|
+
return {
|
|
1676
|
+
id: order.node.id,
|
|
1677
|
+
number: order.node.orderNumber,
|
|
1678
|
+
name: order.node.name,
|
|
1679
|
+
currency: order.node.currencyCode,
|
|
1680
|
+
subTotal: order.node.currentSubtotalPrice.amount,
|
|
1681
|
+
total: order.node.totalPrice.amount,
|
|
1682
|
+
fulfillments: null,
|
|
1683
|
+
fulfillmentStatus: order.node.fulfillmentStatus,
|
|
1684
|
+
refundedAmount: order.node?.totalRefunded?.amount,
|
|
1685
|
+
cancelReason: order.node.cancelReason,
|
|
1686
|
+
canceledAt: order.node.canceledAt,
|
|
1687
|
+
lineItems:
|
|
1688
|
+
order.node.lineItems.edges.map((item: any) => {
|
|
1689
|
+
if (!item.node.variant)
|
|
1690
|
+
return {
|
|
1691
|
+
productId: null,
|
|
1692
|
+
quantity: item.node.currentQuantity,
|
|
1693
|
+
orderedQuantity: item.node.quantity,
|
|
1694
|
+
price: item.node.discountedTotalPrice.amount,
|
|
1695
|
+
title: `${item.node.title}`,
|
|
1696
|
+
originalPrice: item.node.originalTotalPrice.amount,
|
|
1697
|
+
}
|
|
1698
|
+
return {
|
|
1699
|
+
id: item.node.variant.id,
|
|
1700
|
+
productId: item?.node?.variant?.product?.id ?? null,
|
|
1701
|
+
variantId: item.node.variant.title,
|
|
1702
|
+
quantity: item.node.currentQuantity,
|
|
1703
|
+
orderedQuantity: item.node.quantity,
|
|
1704
|
+
price: item.node.discountedTotalPrice.amount,
|
|
1705
|
+
title: `${item.node.title} - ${item.node.variant.title}`,
|
|
1706
|
+
image: item.node.variant.image?.src, // figure out
|
|
1707
|
+
originalPrice: item.node.originalTotalPrice.amount,
|
|
1708
|
+
productHandle: item?.node?.variant?.product?.handle ?? null,
|
|
1709
|
+
}
|
|
1710
|
+
}) || [],
|
|
1711
|
+
}
|
|
1712
|
+
}) || []
|
|
1713
|
+
)
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
function setCustomerAccountsAccessToken(token: CustomerAccountsToken) {
|
|
1717
|
+
localStorage.set(
|
|
1718
|
+
SHOPIFY_CUSTOMER_AUTH_TOKEN,
|
|
1719
|
+
JSON.stringify({ ...token, timestamp: Date.now() })
|
|
1720
|
+
)
|
|
1721
|
+
}
|