@anker-in/campaign-ui 0.1.10 → 0.2.10-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/chat/action.js +1 -1
- package/dist/cjs/components/chat/action.js.map +1 -1
- package/dist/cjs/components/chat/button.d.ts +1 -1
- package/dist/cjs/components/chat/button.js +1 -1
- package/dist/cjs/components/chat/button.js.map +1 -1
- package/dist/cjs/components/chat/index.js +1 -1
- package/dist/cjs/components/chat/index.js.map +2 -2
- package/dist/cjs/components/chat/{Messages.d.ts → messages.d.ts} +1 -1
- package/dist/cjs/components/chat/messages.js +1 -1
- package/dist/cjs/components/chat/messages.js.map +2 -2
- package/dist/cjs/components/chat/props.js +1 -1
- package/dist/cjs/components/chat/props.js.map +2 -2
- package/dist/cjs/components/chat/response.js +1 -1
- package/dist/cjs/components/chat/response.js.map +2 -2
- package/dist/cjs/components/chat/suggestions.d.ts +1 -1
- package/dist/cjs/components/chat/suggestions.js.map +1 -1
- package/dist/cjs/components/credits/context/const.d.ts +81 -0
- package/dist/cjs/components/credits/context/const.js +2 -0
- package/dist/cjs/components/credits/context/const.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useActivities.d.ts +12 -0
- package/dist/cjs/components/credits/context/hooks/useActivities.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useActivities.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useAddressValidate.d.ts +34 -0
- package/dist/cjs/components/credits/context/hooks/useAddressValidate.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useAddressValidate.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useAlpcFetch.d.ts +23 -0
- package/dist/cjs/components/credits/context/hooks/useAlpcFetch.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useAlpcFetch.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useClickOutside.d.ts +3 -0
- package/dist/cjs/components/credits/context/hooks/useClickOutside.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useClickOutside.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useCopy.d.ts +5 -0
- package/dist/cjs/components/credits/context/hooks/useCopy.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useCopy.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useCountries.d.ts +8 -0
- package/dist/cjs/components/credits/context/hooks/useCountries.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useCountries.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useFirstPurchaseFinished.d.ts +1 -0
- package/dist/cjs/components/credits/context/hooks/useFirstPurchaseFinished.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useFirstPurchaseFinished.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useMyRewards.d.ts +14 -0
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useReceiptUploaded.d.ts +2 -0
- package/dist/cjs/components/credits/context/hooks/useReceiptUploaded.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useReceiptUploaded.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.d.ts +14 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.d.ts +17 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.d.ts +16 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.d.ts +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.d.ts +1 -0
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useSubscribed.d.ts +1 -0
- package/dist/cjs/components/credits/context/hooks/useSubscribed.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useSubscribed.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useSubscriptions.d.ts +5 -0
- package/dist/cjs/components/credits/context/hooks/useSubscriptions.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useSubscriptions.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useUploadReceipt.d.ts +14 -0
- package/dist/cjs/components/credits/context/hooks/useUploadReceipt.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useUploadReceipt.js.map +7 -0
- package/dist/cjs/components/credits/context/provider.d.ts +49 -0
- package/dist/cjs/components/credits/context/provider.js +2 -0
- package/dist/cjs/components/credits/context/provider.js.map +7 -0
- package/dist/cjs/components/credits/context/response.d.ts +63 -0
- package/dist/cjs/components/credits/context/response.js +2 -0
- package/dist/cjs/components/credits/context/response.js.map +7 -0
- package/dist/cjs/components/credits/context/utils.d.ts +25 -0
- package/dist/cjs/components/credits/context/utils.js +2 -0
- package/dist/cjs/components/credits/context/utils.js.map +7 -0
- package/dist/cjs/components/credits/creditsBanner/index.d.ts +23 -0
- package/dist/cjs/components/credits/creditsBanner/index.js +2 -0
- package/dist/cjs/components/credits/creditsBanner/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.d.ts +19 -0
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +2 -0
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsBenefits/iconInfo.d.ts +2 -0
- package/dist/cjs/components/credits/creditsBenefits/iconInfo.js +2 -0
- package/dist/cjs/components/credits/creditsBenefits/iconInfo.js.map +7 -0
- package/dist/cjs/components/credits/creditsBenefits/index.d.ts +12 -0
- package/dist/cjs/components/credits/creditsBenefits/index.js +4 -0
- package/dist/cjs/components/credits/creditsBenefits/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.d.ts +15 -0
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +2 -0
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsCash/index.d.ts +13 -0
- package/dist/cjs/components/credits/creditsCash/index.js +2 -0
- package/dist/cjs/components/credits/creditsCash/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsCash/type.d.ts +47 -0
- package/dist/cjs/components/credits/creditsCash/type.js +2 -0
- package/dist/cjs/components/credits/creditsCash/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.d.ts +13 -0
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js +2 -0
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsFaq/index.d.ts +16 -0
- package/dist/cjs/components/credits/creditsFaq/index.js +2 -0
- package/dist/cjs/components/credits/creditsFaq/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +20 -0
- package/dist/cjs/components/credits/creditsInfoCard/index.js +2 -0
- package/dist/cjs/components/credits/creditsInfoCard/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.d.ts +14 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/FormItem.d.ts +6 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/FormItem.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/FormItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/Input.d.ts +13 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/Input.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/Input.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.d.ts +15 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/type.d.ts +26 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/type.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +9 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +20 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.d.ts +8 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +11 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +8 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +13 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +11 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.d.ts +9 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/index.d.ts +13 -0
- package/dist/cjs/components/credits/creditsRedeemList/index.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +77 -0
- package/dist/cjs/components/credits/creditsRedeemList/type.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +60 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.d.ts +96 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js.map +7 -0
- package/dist/cjs/components/credits/index.d.ts +10 -0
- package/dist/cjs/components/credits/index.js +2 -0
- package/dist/cjs/components/credits/index.js.map +7 -0
- package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +29 -0
- package/dist/cjs/components/credits/modal/MyRewardsModal.js +2 -0
- package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/activitiesModal.d.ts +29 -0
- package/dist/cjs/components/credits/modal/activitiesModal.js +2 -0
- package/dist/cjs/components/credits/modal/activitiesModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.d.ts +24 -0
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +2 -0
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/loadingDots.d.ts +5 -0
- package/dist/cjs/components/credits/modal/loadingDots.js +2 -0
- package/dist/cjs/components/credits/modal/loadingDots.js.map +7 -0
- package/dist/cjs/components/credits/modal/modalContainer.d.ts +15 -0
- package/dist/cjs/components/credits/modal/modalContainer.js +2 -0
- package/dist/cjs/components/credits/modal/modalContainer.js.map +7 -0
- package/dist/cjs/components/credits/modal/rulesModal.d.ts +7 -0
- package/dist/cjs/components/credits/modal/rulesModal.js +2 -0
- package/dist/cjs/components/credits/modal/rulesModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/tip.d.ts +5 -0
- package/dist/cjs/components/credits/modal/tip.js +2 -0
- package/dist/cjs/components/credits/modal/tip.js.map +7 -0
- package/dist/cjs/components/credits/type.d.ts +55 -0
- package/dist/cjs/components/credits/type.js +2 -0
- package/dist/cjs/components/credits/type.js.map +7 -0
- package/dist/cjs/components/index.d.ts +3 -2
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +3 -3
- package/dist/cjs/debug-env.d.ts +7 -0
- package/dist/cjs/helpers/fetcher.js +1 -1
- package/dist/cjs/helpers/fetcher.js.map +2 -2
- package/dist/cjs/helpers/index.d.ts +2 -2
- package/dist/cjs/helpers/index.js +1 -1
- package/dist/cjs/helpers/index.js.map +2 -2
- package/dist/cjs/helpers/track.d.ts +15 -0
- package/dist/cjs/helpers/track.js +2 -0
- package/dist/cjs/helpers/track.js.map +7 -0
- package/dist/cjs/index.css +2 -0
- package/dist/cjs/index.css.map +7 -0
- package/dist/cjs/index.d.ts +7 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/shopify/context/ShopifyProvider.d.ts +10 -0
- package/dist/cjs/shopify/fetchers/create-cart.d.ts +13 -0
- package/dist/cjs/shopify/fetchers/get-products-by-handles.d.ts +7 -0
- package/dist/cjs/shopify/fetchers/index.d.ts +2 -0
- package/dist/cjs/shopify/fragments/article.d.ts +2 -0
- package/dist/cjs/shopify/fragments/blog.d.ts +1 -0
- package/dist/cjs/shopify/fragments/cart.d.ts +1 -0
- package/dist/cjs/shopify/fragments/collection.d.ts +1 -0
- package/dist/cjs/shopify/fragments/image.d.ts +1 -0
- package/dist/cjs/shopify/fragments/index.d.ts +11 -0
- package/dist/cjs/shopify/fragments/metafields.d.ts +2 -0
- package/dist/cjs/shopify/fragments/page-info.d.ts +1 -0
- package/dist/cjs/shopify/fragments/page.d.ts +1 -0
- package/dist/cjs/shopify/fragments/product.d.ts +1 -0
- package/dist/cjs/shopify/fragments/seo.d.ts +1 -0
- package/dist/cjs/shopify/fragments/variant.d.ts +1 -0
- package/dist/cjs/shopify/gql/fragment-masking.d.ts +15 -0
- package/dist/cjs/shopify/gql/gql.d.ts +87 -0
- package/dist/cjs/shopify/gql/graphql.d.ts +7669 -0
- package/dist/cjs/shopify/gql/index.d.ts +3 -0
- package/dist/cjs/shopify/hooks/index.d.ts +2 -0
- package/dist/cjs/shopify/hooks/useCreateCart.d.ts +2 -0
- package/dist/cjs/shopify/hooks/useProductsByHandles.d.ts +4 -0
- package/dist/cjs/shopify/mutations/create-cart.d.ts +1 -0
- package/dist/cjs/shopify/queries/get-product-by-handles.d.ts +1 -0
- package/dist/cjs/shopify/queries/index.d.ts +1 -0
- package/dist/cjs/shopify/src/index.d.ts +5 -0
- package/dist/cjs/shopify/tsup.config.d.ts +2 -0
- package/dist/cjs/shopify/types/article.d.ts +48 -0
- package/dist/cjs/shopify/types/cart.d.ts +173 -0
- package/dist/cjs/shopify/types/checkout.d.ts +42 -0
- package/dist/cjs/shopify/types/collection.d.ts +122 -0
- package/dist/cjs/shopify/types/common.d.ts +42 -0
- package/dist/cjs/shopify/types/config.d.ts +12 -0
- package/dist/cjs/shopify/types/customer.d.ts +30 -0
- package/dist/cjs/shopify/types/fetcher.d.ts +38 -0
- package/dist/cjs/shopify/types/index.d.ts +10 -0
- package/dist/cjs/shopify/types/page.d.ts +33 -0
- package/dist/cjs/shopify/types/product.d.ts +174 -0
- package/dist/cjs/shopify/types/search.d.ts +54 -0
- package/dist/cjs/shopify/types/site.d.ts +33 -0
- package/dist/cjs/shopify/types/type-helper.d.ts +5 -0
- package/dist/cjs/shopify/utils/colors.d.ts +3 -0
- package/dist/cjs/shopify/utils/const.d.ts +76 -0
- package/dist/cjs/shopify/utils/cookie.d.ts +15 -0
- package/dist/cjs/shopify/utils/errors.d.ts +38 -0
- package/dist/cjs/shopify/utils/fetch-graphql-api.d.ts +19 -0
- package/dist/cjs/shopify/utils/handle-fetch-response.d.ts +5 -0
- package/dist/cjs/shopify/utils/helper.d.ts +28 -0
- package/dist/cjs/shopify/utils/normalize/cart.d.ts +7 -0
- package/dist/cjs/shopify/utils/normalize/customer.d.ts +3 -0
- package/dist/cjs/shopify/utils/normalize/index.d.ts +2 -0
- package/dist/cjs/shopify/utils/normalize/metafield.d.ts +5 -0
- package/dist/cjs/shopify/utils/normalize/product.d.ts +16 -0
- package/dist/cjs/shopify/utils/store.d.ts +2 -0
- package/dist/cjs/shopify/utils/type-helper.d.ts +5 -0
- package/dist/cjs/stories/chat.stories.d.ts +1 -1
- package/dist/esm/components/chat/action.js +1 -1
- package/dist/esm/components/chat/action.js.map +1 -1
- package/dist/esm/components/chat/button.d.ts +1 -1
- package/dist/esm/components/chat/button.js +1 -1
- package/dist/esm/components/chat/button.js.map +1 -1
- package/dist/esm/components/chat/index.js +1 -1
- package/dist/esm/components/chat/index.js.map +2 -2
- package/dist/esm/components/chat/{Messages.d.ts → messages.d.ts} +1 -1
- package/dist/esm/components/chat/messages.js +1 -1
- package/dist/esm/components/chat/messages.js.map +2 -2
- package/dist/esm/components/chat/props.js +0 -1
- package/dist/esm/components/chat/props.js.map +3 -3
- package/dist/esm/components/chat/response.js +1 -1
- package/dist/esm/components/chat/response.js.map +2 -2
- package/dist/esm/components/chat/suggestions.d.ts +1 -1
- package/dist/esm/components/chat/suggestions.js.map +1 -1
- package/dist/esm/components/credits/context/const.d.ts +81 -0
- package/dist/esm/components/credits/context/const.js +2 -0
- package/dist/esm/components/credits/context/const.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useActivities.d.ts +12 -0
- package/dist/esm/components/credits/context/hooks/useActivities.js +2 -0
- package/dist/esm/components/credits/context/hooks/useActivities.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useAddressValidate.d.ts +34 -0
- package/dist/esm/components/credits/context/hooks/useAddressValidate.js +2 -0
- package/dist/esm/components/credits/context/hooks/useAddressValidate.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useAlpcFetch.d.ts +23 -0
- package/dist/esm/components/credits/context/hooks/useAlpcFetch.js +2 -0
- package/dist/esm/components/credits/context/hooks/useAlpcFetch.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useClickOutside.d.ts +3 -0
- package/dist/esm/components/credits/context/hooks/useClickOutside.js +2 -0
- package/dist/esm/components/credits/context/hooks/useClickOutside.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useCopy.d.ts +5 -0
- package/dist/esm/components/credits/context/hooks/useCopy.js +2 -0
- package/dist/esm/components/credits/context/hooks/useCopy.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useCountries.d.ts +8 -0
- package/dist/esm/components/credits/context/hooks/useCountries.js +2 -0
- package/dist/esm/components/credits/context/hooks/useCountries.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useFirstPurchaseFinished.d.ts +1 -0
- package/dist/esm/components/credits/context/hooks/useFirstPurchaseFinished.js +2 -0
- package/dist/esm/components/credits/context/hooks/useFirstPurchaseFinished.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useMyRewards.d.ts +14 -0
- package/dist/esm/components/credits/context/hooks/useMyRewards.js +2 -0
- package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useReceiptUploaded.d.ts +2 -0
- package/dist/esm/components/credits/context/hooks/useReceiptUploaded.js +2 -0
- package/dist/esm/components/credits/context/hooks/useReceiptUploaded.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.d.ts +14 -0
- package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.d.ts +17 -0
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.d.ts +16 -0
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemableList.d.ts +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.d.ts +1 -0
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js +2 -0
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useSubscribed.d.ts +1 -0
- package/dist/esm/components/credits/context/hooks/useSubscribed.js +2 -0
- package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useSubscriptions.d.ts +5 -0
- package/dist/esm/components/credits/context/hooks/useSubscriptions.js +2 -0
- package/dist/esm/components/credits/context/hooks/useSubscriptions.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useUploadReceipt.d.ts +14 -0
- package/dist/esm/components/credits/context/hooks/useUploadReceipt.js +2 -0
- package/dist/esm/components/credits/context/hooks/useUploadReceipt.js.map +7 -0
- package/dist/esm/components/credits/context/provider.d.ts +49 -0
- package/dist/esm/components/credits/context/provider.js +2 -0
- package/dist/esm/components/credits/context/provider.js.map +7 -0
- package/dist/esm/components/credits/context/response.d.ts +63 -0
- package/dist/esm/components/credits/context/response.js +1 -0
- package/dist/esm/components/credits/context/utils.d.ts +25 -0
- package/dist/esm/components/credits/context/utils.js +2 -0
- package/dist/esm/components/credits/context/utils.js.map +7 -0
- package/dist/esm/components/credits/creditsBanner/index.d.ts +23 -0
- package/dist/esm/components/credits/creditsBanner/index.js +2 -0
- package/dist/esm/components/credits/creditsBanner/index.js.map +7 -0
- package/dist/esm/components/credits/creditsBenefits/benefitItem.d.ts +19 -0
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js +2 -0
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +7 -0
- package/dist/esm/components/credits/creditsBenefits/iconInfo.d.ts +2 -0
- package/dist/esm/components/credits/creditsBenefits/iconInfo.js +2 -0
- package/dist/esm/components/credits/creditsBenefits/iconInfo.js.map +7 -0
- package/dist/esm/components/credits/creditsBenefits/index.d.ts +12 -0
- package/dist/esm/components/credits/creditsBenefits/index.js +4 -0
- package/dist/esm/components/credits/creditsBenefits/index.js.map +7 -0
- package/dist/esm/components/credits/creditsCash/RedeemableItem.d.ts +15 -0
- package/dist/esm/components/credits/creditsCash/RedeemableItem.js +2 -0
- package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +7 -0
- package/dist/esm/components/credits/creditsCash/index.d.ts +13 -0
- package/dist/esm/components/credits/creditsCash/index.js +2 -0
- package/dist/esm/components/credits/creditsCash/index.js.map +7 -0
- package/dist/esm/components/credits/creditsCash/type.d.ts +47 -0
- package/dist/esm/components/credits/creditsCash/type.js +1 -0
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.d.ts +13 -0
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js +2 -0
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js.map +7 -0
- package/dist/esm/components/credits/creditsFaq/index.d.ts +16 -0
- package/dist/esm/components/credits/creditsFaq/index.js +2 -0
- package/dist/esm/components/credits/creditsFaq/index.js.map +7 -0
- package/dist/esm/components/credits/creditsInfoCard/index.d.ts +20 -0
- package/dist/esm/components/credits/creditsInfoCard/index.js +2 -0
- package/dist/esm/components/credits/creditsInfoCard/index.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.d.ts +14 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.d.ts +6 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.d.ts +13 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.d.ts +15 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.d.ts +26 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.js +1 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +9 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +20 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.d.ts +8 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +11 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +8 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +13 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +11 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.d.ts +9 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/index.d.ts +13 -0
- package/dist/esm/components/credits/creditsRedeemList/index.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/index.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/type.d.ts +77 -0
- package/dist/esm/components/credits/creditsRedeemList/type.js +1 -0
- package/dist/esm/components/credits/creditsRedeemList/type.js.map +7 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/index.js +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/index.js.map +7 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +60 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.js +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +7 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.d.ts +96 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +7 -0
- package/dist/esm/components/credits/index.d.ts +10 -0
- package/dist/esm/components/credits/index.js +2 -0
- package/dist/esm/components/credits/index.js.map +7 -0
- package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +29 -0
- package/dist/esm/components/credits/modal/MyRewardsModal.js +2 -0
- package/dist/esm/components/credits/modal/MyRewardsModal.js.map +7 -0
- package/dist/esm/components/credits/modal/activitiesModal.d.ts +29 -0
- package/dist/esm/components/credits/modal/activitiesModal.js +2 -0
- package/dist/esm/components/credits/modal/activitiesModal.js.map +7 -0
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.d.ts +24 -0
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +2 -0
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +7 -0
- package/dist/esm/components/credits/modal/loadingDots.d.ts +5 -0
- package/dist/esm/components/credits/modal/loadingDots.js +2 -0
- package/dist/esm/components/credits/modal/loadingDots.js.map +7 -0
- package/dist/esm/components/credits/modal/modalContainer.d.ts +15 -0
- package/dist/esm/components/credits/modal/modalContainer.js +2 -0
- package/dist/esm/components/credits/modal/modalContainer.js.map +7 -0
- package/dist/esm/components/credits/modal/rulesModal.d.ts +7 -0
- package/dist/esm/components/credits/modal/rulesModal.js +2 -0
- package/dist/esm/components/credits/modal/rulesModal.js.map +7 -0
- package/dist/esm/components/credits/modal/tip.d.ts +5 -0
- package/dist/esm/components/credits/modal/tip.js +2 -0
- package/dist/esm/components/credits/modal/tip.js.map +7 -0
- package/dist/esm/components/credits/type.d.ts +55 -0
- package/dist/esm/components/credits/type.js +1 -0
- package/dist/esm/components/credits/type.js.map +7 -0
- package/dist/esm/components/index.d.ts +3 -2
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +2 -2
- package/dist/esm/debug-env.d.ts +7 -0
- package/dist/esm/helpers/fetcher.js +1 -1
- package/dist/esm/helpers/fetcher.js.map +2 -2
- package/dist/esm/helpers/index.d.ts +2 -2
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/helpers/index.js.map +2 -2
- package/dist/esm/helpers/track.d.ts +15 -0
- package/dist/esm/helpers/track.js +2 -0
- package/dist/esm/helpers/track.js.map +7 -0
- package/dist/esm/index.css +2 -0
- package/dist/esm/index.css.map +7 -0
- package/dist/esm/index.d.ts +7 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/shopify/context/ShopifyProvider.d.ts +10 -0
- package/dist/esm/shopify/fetchers/create-cart.d.ts +13 -0
- package/dist/esm/shopify/fetchers/get-products-by-handles.d.ts +7 -0
- package/dist/esm/shopify/fetchers/index.d.ts +2 -0
- package/dist/esm/shopify/fragments/article.d.ts +2 -0
- package/dist/esm/shopify/fragments/blog.d.ts +1 -0
- package/dist/esm/shopify/fragments/cart.d.ts +1 -0
- package/dist/esm/shopify/fragments/collection.d.ts +1 -0
- package/dist/esm/shopify/fragments/image.d.ts +1 -0
- package/dist/esm/shopify/fragments/index.d.ts +11 -0
- package/dist/esm/shopify/fragments/metafields.d.ts +2 -0
- package/dist/esm/shopify/fragments/page-info.d.ts +1 -0
- package/dist/esm/shopify/fragments/page.d.ts +1 -0
- package/dist/esm/shopify/fragments/product.d.ts +1 -0
- package/dist/esm/shopify/fragments/seo.d.ts +1 -0
- package/dist/esm/shopify/fragments/variant.d.ts +1 -0
- package/dist/esm/shopify/gql/fragment-masking.d.ts +15 -0
- package/dist/esm/shopify/gql/gql.d.ts +87 -0
- package/dist/esm/shopify/gql/graphql.d.ts +7669 -0
- package/dist/esm/shopify/gql/index.d.ts +3 -0
- package/dist/esm/shopify/hooks/index.d.ts +2 -0
- package/dist/esm/shopify/hooks/useCreateCart.d.ts +2 -0
- package/dist/esm/shopify/hooks/useProductsByHandles.d.ts +4 -0
- package/dist/esm/shopify/mutations/create-cart.d.ts +1 -0
- package/dist/esm/shopify/queries/get-product-by-handles.d.ts +1 -0
- package/dist/esm/shopify/queries/index.d.ts +1 -0
- package/dist/esm/shopify/src/index.d.ts +5 -0
- package/dist/esm/shopify/tsup.config.d.ts +2 -0
- package/dist/esm/shopify/types/article.d.ts +48 -0
- package/dist/esm/shopify/types/cart.d.ts +173 -0
- package/dist/esm/shopify/types/checkout.d.ts +42 -0
- package/dist/esm/shopify/types/collection.d.ts +122 -0
- package/dist/esm/shopify/types/common.d.ts +42 -0
- package/dist/esm/shopify/types/config.d.ts +12 -0
- package/dist/esm/shopify/types/customer.d.ts +30 -0
- package/dist/esm/shopify/types/fetcher.d.ts +38 -0
- package/dist/esm/shopify/types/index.d.ts +10 -0
- package/dist/esm/shopify/types/page.d.ts +33 -0
- package/dist/esm/shopify/types/product.d.ts +174 -0
- package/dist/esm/shopify/types/search.d.ts +54 -0
- package/dist/esm/shopify/types/site.d.ts +33 -0
- package/dist/esm/shopify/types/type-helper.d.ts +5 -0
- package/dist/esm/shopify/utils/colors.d.ts +3 -0
- package/dist/esm/shopify/utils/const.d.ts +76 -0
- package/dist/esm/shopify/utils/cookie.d.ts +15 -0
- package/dist/esm/shopify/utils/errors.d.ts +38 -0
- package/dist/esm/shopify/utils/fetch-graphql-api.d.ts +19 -0
- package/dist/esm/shopify/utils/handle-fetch-response.d.ts +5 -0
- package/dist/esm/shopify/utils/helper.d.ts +28 -0
- package/dist/esm/shopify/utils/normalize/cart.d.ts +7 -0
- package/dist/esm/shopify/utils/normalize/customer.d.ts +3 -0
- package/dist/esm/shopify/utils/normalize/index.d.ts +2 -0
- package/dist/esm/shopify/utils/normalize/metafield.d.ts +5 -0
- package/dist/esm/shopify/utils/normalize/product.d.ts +16 -0
- package/dist/esm/shopify/utils/store.d.ts +2 -0
- package/dist/esm/shopify/utils/type-helper.d.ts +5 -0
- package/dist/esm/stories/chat.stories.d.ts +1 -1
- package/package.json +34 -27
- package/src/components/chat/button.tsx +1 -1
- package/src/components/chat/index.tsx +6 -6
- package/src/components/chat/messages.tsx +2 -2
- package/src/components/chat/response.tsx +1 -4
- package/src/components/chat/suggestions.tsx +1 -1
- package/src/components/credits/context/const.ts +103 -0
- package/src/components/credits/context/hooks/useActivities.ts +70 -0
- package/src/components/credits/context/hooks/useAddressValidate.ts +281 -0
- package/src/components/credits/context/hooks/useAlpcFetch.ts +295 -0
- package/src/components/credits/context/hooks/useClickOutside.ts +34 -0
- package/src/components/credits/context/hooks/useCopy.ts +35 -0
- package/src/components/credits/context/hooks/useCountries.ts +55 -0
- package/src/components/credits/context/hooks/useFirstPurchaseFinished.ts +24 -0
- package/src/components/credits/context/hooks/useMyRewards.ts +97 -0
- package/src/components/credits/context/hooks/useReceiptUploaded.ts +24 -0
- package/src/components/credits/context/hooks/useRedeemAndBuy.ts +60 -0
- package/src/components/credits/context/hooks/useRedeemCoupon.ts +33 -0
- package/src/components/credits/context/hooks/useRedeemProduct.ts +34 -0
- package/src/components/credits/context/hooks/useRedeemableList.ts +91 -0
- package/src/components/credits/context/hooks/useSendEmailValidation.ts +20 -0
- package/src/components/credits/context/hooks/useSubscribed.ts +37 -0
- package/src/components/credits/context/hooks/useSubscriptions.ts +54 -0
- package/src/components/credits/context/hooks/useUploadReceipt.tsx +30 -0
- package/src/components/credits/context/provider.tsx +86 -0
- package/src/components/credits/context/response.ts +72 -0
- package/src/components/credits/context/utils.ts +149 -0
- package/src/components/credits/creditsBanner/index.tsx +105 -0
- package/src/components/credits/creditsBenefits/benefitItem.tsx +73 -0
- package/src/components/credits/creditsBenefits/iconInfo.tsx +23 -0
- package/src/components/credits/creditsBenefits/index.tsx +119 -0
- package/src/components/credits/creditsCash/RedeemableItem.tsx +216 -0
- package/src/components/credits/creditsCash/index.tsx +102 -0
- package/src/components/credits/creditsCash/type.ts +46 -0
- package/src/components/credits/creditsFaq/faqItem/FaqItem.tsx +95 -0
- package/src/components/credits/creditsFaq/index.tsx +86 -0
- package/src/components/credits/creditsInfoCard/index.tsx +176 -0
- package/src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx +111 -0
- package/src/components/credits/creditsRedeemList/AddressForm/FormItem.tsx +23 -0
- package/src/components/credits/creditsRedeemList/AddressForm/Input.tsx +58 -0
- package/src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx +126 -0
- package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +156 -0
- package/src/components/credits/creditsRedeemList/AddressForm/type.ts +24 -0
- package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +213 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +72 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Error.tsx +14 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +129 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +72 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +45 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +196 -0
- package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +191 -0
- package/src/components/credits/creditsRedeemList/index.tsx +195 -0
- package/src/components/credits/creditsRedeemList/type.ts +78 -0
- package/src/components/credits/creditsWaysToGetCredits/index.tsx +189 -0
- package/src/components/credits/creditsWaysToGetCredits/type.ts +64 -0
- package/src/components/credits/creditsWaysToGetCredits/useActions.ts +217 -0
- package/src/components/credits/index.ts +11 -0
- package/src/components/credits/modal/MyRewardsModal.tsx +309 -0
- package/src/components/credits/modal/activitiesModal.tsx +248 -0
- package/src/components/credits/modal/creditsUploadReceiptModal.tsx +141 -0
- package/src/components/credits/modal/loadingDots.tsx +17 -0
- package/src/components/credits/modal/modalContainer.tsx +112 -0
- package/src/components/credits/modal/rulesModal.tsx +44 -0
- package/src/components/credits/modal/tip.tsx +92 -0
- package/src/components/credits/type.ts +60 -0
- package/src/components/index.ts +4 -2
- package/src/debug-env.ts +18 -0
- package/src/helpers/fetcher.ts +1 -1
- package/src/helpers/index.ts +2 -2
- package/src/helpers/track.ts +55 -0
- package/src/index.ts +23 -1
- package/src/shopify/MIGRATION_GUIDE.md +156 -0
- package/src/shopify/context/ShopifyProvider.tsx +34 -0
- package/src/shopify/dist/cart-BNkVu3fh.d.ts +220 -0
- package/src/shopify/dist/cart-BcrGTPdx.d.cts +220 -0
- package/src/shopify/dist/fetchers.cjs +7945 -0
- package/src/shopify/dist/fetchers.cjs.map +1 -0
- package/src/shopify/dist/fetchers.d.cts +3 -0
- package/src/shopify/dist/fetchers.d.ts +3 -0
- package/src/shopify/dist/fetchers.js +7942 -0
- package/src/shopify/dist/fetchers.js.map +1 -0
- package/src/shopify/dist/fragments.cjs +731 -0
- package/src/shopify/dist/fragments.cjs.map +1 -0
- package/src/shopify/dist/fragments.d.cts +25 -0
- package/src/shopify/dist/fragments.d.ts +25 -0
- package/src/shopify/dist/fragments.js +705 -0
- package/src/shopify/dist/fragments.js.map +1 -0
- package/src/shopify/dist/graphql-D4M28V-x.d.cts +3558 -0
- package/src/shopify/dist/graphql-D4M28V-x.d.ts +3558 -0
- package/src/shopify/dist/hooks.cjs +9431 -0
- package/src/shopify/dist/hooks.cjs.map +1 -0
- package/src/shopify/dist/hooks.d.cts +14 -0
- package/src/shopify/dist/hooks.d.ts +14 -0
- package/src/shopify/dist/hooks.js +9427 -0
- package/src/shopify/dist/hooks.js.map +1 -0
- package/src/shopify/dist/index-BTtE4HZM.d.ts +42 -0
- package/src/shopify/dist/index-BjNIecYX.d.cts +42 -0
- package/src/shopify/dist/index.cjs +9642 -0
- package/src/shopify/dist/index.cjs.map +1 -0
- package/src/shopify/dist/index.d.cts +11 -0
- package/src/shopify/dist/index.d.ts +11 -0
- package/src/shopify/dist/index.js +9619 -0
- package/src/shopify/dist/index.js.map +1 -0
- package/src/shopify/dist/product-Bqi3sqb9.d.cts +262 -0
- package/src/shopify/dist/product-DNk6jYAP.d.ts +262 -0
- package/src/shopify/dist/queries.cjs +615 -0
- package/src/shopify/dist/queries.cjs.map +1 -0
- package/src/shopify/dist/queries.d.cts +3 -0
- package/src/shopify/dist/queries.d.ts +3 -0
- package/src/shopify/dist/queries.js +601 -0
- package/src/shopify/dist/queries.js.map +1 -0
- package/src/shopify/dist/types.cjs +19 -0
- package/src/shopify/dist/types.cjs.map +1 -0
- package/src/shopify/dist/types.d.cts +282 -0
- package/src/shopify/dist/types.d.ts +282 -0
- package/src/shopify/dist/types.js +1 -0
- package/src/shopify/dist/types.js.map +1 -0
- package/src/shopify/dist/utils.cjs +334 -0
- package/src/shopify/dist/utils.cjs.map +1 -0
- package/src/shopify/dist/utils.d.cts +12 -0
- package/src/shopify/dist/utils.d.ts +12 -0
- package/src/shopify/dist/utils.js +319 -0
- package/src/shopify/dist/utils.js.map +1 -0
- package/src/shopify/fetchers/create-cart.ts +40 -0
- package/src/shopify/fetchers/get-products-by-handles.ts +41 -0
- package/src/shopify/fetchers/index.ts +3 -0
- package/src/shopify/fragments/article.ts +51 -0
- package/src/shopify/fragments/blog.ts +10 -0
- package/src/shopify/fragments/cart.ts +190 -0
- package/src/shopify/fragments/collection.ts +15 -0
- package/src/shopify/fragments/image.ts +8 -0
- package/src/shopify/fragments/index.ts +11 -0
- package/src/shopify/fragments/metafields.ts +17 -0
- package/src/shopify/fragments/page-info.ts +8 -0
- package/src/shopify/fragments/page.ts +12 -0
- package/src/shopify/fragments/product.ts +71 -0
- package/src/shopify/fragments/seo.ts +6 -0
- package/src/shopify/fragments/variant.ts +29 -0
- package/src/shopify/gql/fragment-masking.ts +85 -0
- package/src/shopify/gql/gql.ts +110 -0
- package/src/shopify/gql/graphql.ts +11780 -0
- package/src/shopify/gql/index.ts +4 -0
- package/src/shopify/hooks/index.ts +2 -0
- package/src/shopify/hooks/useCreateCart.ts +24 -0
- package/src/shopify/hooks/useProductsByHandles.ts +25 -0
- package/src/shopify/mutations/create-cart.ts +16 -0
- package/src/shopify/package.json +84 -0
- package/src/shopify/queries/get-product-by-handles.ts +32 -0
- package/src/shopify/queries/index.ts +2 -0
- package/src/shopify/src/index.ts +5 -0
- package/src/shopify/tsconfig.json +25 -0
- package/src/shopify/tsup.config.ts +21 -0
- package/src/shopify/types/article.ts +46 -0
- package/src/shopify/types/cart.ts +202 -0
- package/src/shopify/types/checkout.ts +44 -0
- package/src/shopify/types/collection.ts +104 -0
- package/src/shopify/types/common.ts +53 -0
- package/src/shopify/types/config.ts +14 -0
- package/src/shopify/types/customer.ts +31 -0
- package/src/shopify/types/fetcher.ts +61 -0
- package/src/shopify/types/index.ts +10 -0
- package/src/shopify/types/page.ts +45 -0
- package/src/shopify/types/product.ts +176 -0
- package/src/shopify/types/search.ts +62 -0
- package/src/shopify/types/site.ts +38 -0
- package/src/shopify/types/type-helper.ts +5 -0
- package/src/shopify/utils/colors.ts +206 -0
- package/src/shopify/utils/const.ts +115 -0
- package/src/shopify/utils/cookie.ts +39 -0
- package/src/shopify/utils/errors.ts +65 -0
- package/src/shopify/utils/fetch-graphql-api.ts +67 -0
- package/src/shopify/utils/handle-fetch-response.ts +60 -0
- package/src/shopify/utils/helper.ts +89 -0
- package/src/shopify/utils/normalize/cart.ts +106 -0
- package/src/shopify/utils/normalize/customer.ts +18 -0
- package/src/shopify/utils/normalize/index.ts +2 -0
- package/src/shopify/utils/normalize/metafield.ts +69 -0
- package/src/shopify/utils/normalize/product.ts +193 -0
- package/src/shopify/utils/store.ts +5 -0
- package/src/shopify/utils/type-helper.ts +7 -0
- package/src/stories/chat.stories.tsx +1 -1
- package/tailwind.config.ts +72 -0
- package/dist/cjs/components/animation/CodeEditor.d.ts +0 -7
- package/dist/cjs/components/animation/CodeEditor.js +0 -2
- package/dist/cjs/components/animation/CodeEditor.js.map +0 -7
- package/dist/cjs/components/animation/Preview.d.ts +0 -5
- package/dist/cjs/components/animation/Preview.js +0 -2
- package/dist/cjs/components/animation/Preview.js.map +0 -7
- package/dist/cjs/components/animation/bannerAni.d.ts +0 -16
- package/dist/cjs/components/animation/bannerAni.js +0 -59
- package/dist/cjs/components/animation/bannerAni.js.map +0 -7
- package/dist/cjs/components/animation/libs.d.js +0 -2
- package/dist/cjs/components/animation/textAni.d.ts +0 -9
- package/dist/cjs/components/animation/textAni.js +0 -2
- package/dist/cjs/components/animation/textAni.js.map +0 -7
- package/dist/cjs/components/chat/message.d.ts +0 -2
- package/dist/cjs/components/chat/response copy.d.ts +0 -2
- package/dist/cjs/components/chat/rresponse.d.ts +0 -2
- package/dist/cjs/components/theme.d.ts +0 -13
- package/dist/cjs/helpers/component-props.d.ts +0 -7
- package/dist/cjs/helpers/component-props.js +0 -2
- package/dist/cjs/helpers/component-props.js.map +0 -7
- package/dist/cjs/helpers/constants.d.ts +0 -2
- package/dist/cjs/helpers/constants.js +0 -2
- package/dist/cjs/helpers/constants.js.map +0 -7
- package/dist/cjs/stories/chat.stories.js +0 -2
- package/dist/cjs/stories/chat.stories.js.map +0 -7
- package/dist/cjs/tsconfig.tsbuildinfo +0 -1
- package/dist/esm/components/animation/CodeEditor.d.ts +0 -7
- package/dist/esm/components/animation/CodeEditor.js +0 -2
- package/dist/esm/components/animation/CodeEditor.js.map +0 -7
- package/dist/esm/components/animation/Preview.d.ts +0 -5
- package/dist/esm/components/animation/Preview.js +0 -2
- package/dist/esm/components/animation/Preview.js.map +0 -7
- package/dist/esm/components/animation/bannerAni.d.ts +0 -16
- package/dist/esm/components/animation/bannerAni.js +0 -59
- package/dist/esm/components/animation/bannerAni.js.map +0 -7
- package/dist/esm/components/animation/libs.d.js +0 -2
- package/dist/esm/components/animation/libs.d.js.map +0 -7
- package/dist/esm/components/animation/textAni.d.ts +0 -9
- package/dist/esm/components/animation/textAni.js +0 -2
- package/dist/esm/components/animation/textAni.js.map +0 -7
- package/dist/esm/components/chat/Markdown.d.ts +0 -5
- package/dist/esm/components/chat/marksdown.d.ts +0 -5
- package/dist/esm/components/chat/message.d.ts +0 -2
- package/dist/esm/components/chat/response copy.d.ts +0 -2
- package/dist/esm/components/chat/rresponse.d.ts +0 -2
- package/dist/esm/components/theme.d.ts +0 -13
- package/dist/esm/helpers/component-props.d.ts +0 -7
- package/dist/esm/helpers/component-props.js +0 -1
- package/dist/esm/helpers/constants.d.ts +0 -2
- package/dist/esm/helpers/constants.js +0 -2
- package/dist/esm/helpers/constants.js.map +0 -7
- package/dist/esm/stories/chat.stories.js +0 -2
- package/dist/esm/stories/chat.stories.js.map +0 -7
- package/dist/esm/styles/chat.css +0 -14
- package/dist/esm/styles/css/animations.css +0 -35
- package/dist/esm/styles/css/button.css +0 -56
- package/dist/esm/styles/css/colors.css +0 -12
- package/dist/esm/styles/css/console.css +0 -134
- package/dist/esm/styles/css/header.css +0 -43
- package/dist/esm/styles/css/input.css +0 -89
- package/dist/esm/styles/css/markdown.css +0 -131
- package/dist/esm/styles/css/messages.css +0 -73
- package/dist/esm/styles/css/panel.css +0 -23
- package/dist/esm/styles/css/popup.css +0 -44
- package/dist/esm/styles/css/response.css +0 -26
- package/dist/esm/styles/css/sidebar.css +0 -31
- package/dist/esm/styles/css/suggestions.css +0 -35
- package/dist/esm/styles/css/window.css +0 -60
- package/dist/esm/styles/index.css +0 -1
- package/dist/esm/tsconfig.tsbuildinfo +0 -1
- /package/dist/cjs/components/chat/{Markdown.d.ts → markdown.d.ts} +0 -0
- /package/dist/cjs/components/chat/{Response.d.ts → response.d.ts} +0 -0
- /package/dist/{cjs/components/chat/marksdown.d.ts → esm/components/chat/markdown.d.ts} +0 -0
- /package/dist/esm/components/chat/{Response.d.ts → response.d.ts} +0 -0
- /package/dist/{cjs/components/animation/libs.d.js.map → esm/components/credits/context/response.js.map} +0 -0
- /package/dist/esm/{helpers/component-props.js.map → components/credits/creditsCash/type.js.map} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CreditsPageCommon } from '../type';
|
|
2
|
+
export type CreditsRedeemListCopy = {
|
|
3
|
+
title: string;
|
|
4
|
+
giftCardLabel: string;
|
|
5
|
+
unlockRewards: string;
|
|
6
|
+
btnRedeem: string;
|
|
7
|
+
list: {
|
|
8
|
+
label: string;
|
|
9
|
+
list: {
|
|
10
|
+
id: string;
|
|
11
|
+
type: string;
|
|
12
|
+
value: string;
|
|
13
|
+
rules: string[];
|
|
14
|
+
}[];
|
|
15
|
+
}[];
|
|
16
|
+
validatorInfo: {
|
|
17
|
+
addressInfo: {
|
|
18
|
+
name: string;
|
|
19
|
+
country: string;
|
|
20
|
+
province: string;
|
|
21
|
+
city: string;
|
|
22
|
+
address: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
redeemModal: {
|
|
26
|
+
confirmTitle: string;
|
|
27
|
+
confirmButton: string;
|
|
28
|
+
commonError: string;
|
|
29
|
+
redeemLimitError: string;
|
|
30
|
+
inventoryNotEnough: string;
|
|
31
|
+
creditsNotEnough: string;
|
|
32
|
+
crossSiteError: string;
|
|
33
|
+
errorImageUrl: string;
|
|
34
|
+
coupon: {
|
|
35
|
+
successDesc: string;
|
|
36
|
+
successTitle: string;
|
|
37
|
+
successButton: string;
|
|
38
|
+
successButtonUrl: string;
|
|
39
|
+
};
|
|
40
|
+
product: {
|
|
41
|
+
required: string;
|
|
42
|
+
invalidEmail: string;
|
|
43
|
+
shippingAddress: string;
|
|
44
|
+
shippingProduct: string;
|
|
45
|
+
addressForm: {
|
|
46
|
+
key: string;
|
|
47
|
+
type: string;
|
|
48
|
+
label: string;
|
|
49
|
+
isSelect: boolean;
|
|
50
|
+
required: boolean;
|
|
51
|
+
placeholder: string;
|
|
52
|
+
}[][];
|
|
53
|
+
form: {
|
|
54
|
+
key: string;
|
|
55
|
+
type: string;
|
|
56
|
+
isSelect: boolean;
|
|
57
|
+
required: boolean;
|
|
58
|
+
placeholder: string;
|
|
59
|
+
}[][];
|
|
60
|
+
successDesc: string[];
|
|
61
|
+
rules: string[];
|
|
62
|
+
steps: {
|
|
63
|
+
imageUrl: string;
|
|
64
|
+
title: string;
|
|
65
|
+
}[];
|
|
66
|
+
quantityLabel: string;
|
|
67
|
+
totalPriceLabel: string;
|
|
68
|
+
variantLabel: string;
|
|
69
|
+
shippingFeeLabel: string;
|
|
70
|
+
paymentButton: string;
|
|
71
|
+
stepTitle: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
copied: string;
|
|
75
|
+
off: string;
|
|
76
|
+
copy: string;
|
|
77
|
+
} & CreditsPageCommon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=type.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as P,jsx as t,jsxs as s}from"react/jsx-runtime";import{Button as N,Container as I,Heading as r,Picture as f,Text as L}from"@anker-in/headless-ui";import{ChevronDownIcon as T,ChevronUpIcon as D}from"@heroicons/react/24/outline";import{motion as S}from"framer-motion";import{useMemo as A,useState as B}from"react";import{TaskType as p}from"./type";import{useActions as G}from"./useActions";import{useCreditsContext as M}from"../context/provider";import{cn as w}from"../../../helpers/index";const J=({copy:i,activate:m,subscribe:h,uploadReceipt:b,classNames:g})=>{const[n,v]=B(!1),{profile:F}=M(),c=!!F,{actions:x}=G({copy:i,activate:m,subscribe:h,uploadReceipt:b}),y=A(()=>{const e=i.list.map(l=>{if(!x[l.id])return;const{finished:o,notLogin:k,notFinished:u,completed:z}=x[l.id];let d="",a,C;return c?o?(d=z.buttonLabel,a=void 0):(d=u.buttonLabel,a=u.handleClick,C=u.link):(d=k.buttonLabel,a=k.handleClick),{...l,buttonLabel:d,handleClick:a,finished:o,link:C}}).filter(Boolean);return c?e.sort((l,o)=>l?.finished&&!o?.finished?1:!l?.finished&&o?.finished?-1:0):e},[x,i.list,c]);return t(I,{id:"ways-to-get-credits",className:" bg-[#F5F5F7] [&>div]:l:!px-0",children:s("div",{className:"rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]",children:[t(r,{as:"h2",size:4,html:i?.title,className:"text-center l:pl-[16px] l:text-left"}),s("div",{className:"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]",children:[s("div",{className:"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]",children:[t(r,{size:3,as:"h3",html:i.subtitle,className:g?.subtitle}),s("div",{className:"mt-[8px] flex items-center",children:[i.creditsIcon?.url&&t(f,{className:"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand",source:i.creditsIcon.url,alt:i.creditsIcon.alt||"credits"}),t(r,{html:i.equalCredits,size:4,as:"h3",className:w("mt-2 text-white md:text-[24px]",g?.equalCreditsText)})]})]}),t(f,{className:"w-full laptop:w-[50%]",source:i.mainImage?.url})]}),s("div",{className:"relative",children:[s(S.div,{className:w("relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2"),initial:{height:512},animate:{height:n?"auto":512},transition:{duration:.3},onAnimationComplete:()=>{if(!n&&window.screen.width<768){const e=document.getElementById("ways-to-get-credits");e&&e.scrollIntoView({behavior:"smooth",block:"end"})}},children:[y.map(e=>s("div",{className:"flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]",children:[s("div",{children:[t(r,{as:"h4",html:e.title,size:2,className:"text-pretty"}),s("div",{className:"mt-[4px] flex items-center",children:[t(f,{className:"size-[24px] xl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),t(L,{as:"p",html:e.credits,size:2,className:"ml-[4px] mt-[6px] lg-desktop:text-[18px]"})]})]}),e.handleClick&&!(e.id===p.UploadReceipt&&b.isSuccess)&&!(e.id===p.Activate&&m.isSuccess)&&!(e.id===p.Subscribe&&h.isSuccess)?t(N,{as:e.link?"a":"button",...e.link&&{href:e.link},...e.handleClick&&{onClick:e.handleClick},variant:"primary",loading:e.id===p.Activate&&m.isSendingActivateEmail,size:"lg",className:"mt-[24px] w-fit",children:e.buttonLabel}):t(N,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:e.buttonLabel})]},e.id)),!n&&t("div",{className:"absolute inset-0 min-md:hidden",style:{background:"linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%"}})]}),n?t("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{v(!1)},children:t(D,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):t(P,{children:t("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:t("button",{className:"w-fit",onClick:()=>v(!n),children:t(T,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})]})]})})};export{J as CreditsWaysToGetCredits};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { motion } from 'framer-motion'\nimport { useMemo, useState } from 'react'\n\nimport { TaskType, type CreditsWaysToGetCreditsProps } from './type'\nimport { useActions } from './useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { cn } from '../../../helpers/index'\n\nexport const CreditsWaysToGetCredits = ({\n copy,\n activate,\n subscribe,\n uploadReceipt,\n classNames,\n}: CreditsWaysToGetCreditsProps) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const isLogin = !!profile\n\n const { actions } = useActions({ copy, activate, subscribe, uploadReceipt })\n\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id=\"ways-to-get-credits\" className=\" bg-[#F5F5F7] [&>div]:l:!px-0\">\n <div className=\"rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]\">\n <Heading as=\"h2\" size={4} html={copy?.title} className=\"text-center l:pl-[16px] l:text-left\" />\n <div className=\"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]\">\n <div className=\"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]\">\n <Heading size={3} as=\"h3\" html={copy.subtitle} className={classNames?.subtitle} />\n <div className=\"mt-[8px] flex items-center\">\n {copy.creditsIcon?.url && (\n <Picture\n className=\"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand\"\n source={copy.creditsIcon.url}\n alt={copy.creditsIcon.alt || 'credits'}\n />\n )}\n <Heading\n html={copy.equalCredits}\n size={4}\n as=\"h3\"\n className={cn('mt-2 text-white md:text-[24px]', classNames?.equalCreditsText)}\n />\n </div>\n </div>\n <Picture className=\"w-full laptop:w-[50%]\" source={copy.mainImage?.url} />\n </div>\n\n <div className=\"relative\">\n <motion.div\n className={cn(\n 'relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2'\n )}\n initial={{ height: 512 }}\n animate={{ height: showMore ? 'auto' : 512 }}\n transition={{ duration: 0.3 }}\n onAnimationComplete={() => {\n if (!showMore && window.screen.width < 768) {\n const section = document.getElementById('ways-to-get-credits')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className=\"flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]\"\n >\n <div>\n <Heading as=\"h4\" html={item.title} size={2} className=\"text-pretty\" />\n <div className=\"mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text as=\"p\" html={item.credits} size={2} className=\"ml-[4px] mt-[6px] lg-desktop:text-[18px]\" />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && uploadReceipt.isSuccess) &&\n !(item.id === TaskType.Activate && activate.isSuccess) &&\n !(item.id === TaskType.Subscribe && subscribe.isSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n loading={item.id === TaskType.Activate && activate.isSendingActivateEmail}\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && (\n <div\n className=\"absolute inset-0 min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%' }}\n ></div>\n )}\n </motion.div>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </div>\n </div>\n </Container>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAiFQ,OA+FI,YAAAA,EA/FJ,OAAAC,EAII,QAAAC,MAJJ,oBAjFR,OAAS,UAAAC,EAAQ,aAAAC,EAAW,WAAAC,EAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC1D,OAAS,mBAAAC,EAAiB,iBAAAC,MAAqB,8BAC/C,OAAS,UAAAC,MAAc,gBACvB,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAElC,OAAS,YAAAC,MAAmD,SAC5D,OAAS,cAAAC,MAAkB,eAC3B,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,MAAAC,MAAU,yBAEZ,MAAMC,EAA0B,CAAC,CACtC,KAAAC,EACA,SAAAC,EACA,UAAAC,EACA,cAAAC,EACA,WAAAC,CACF,IAAoC,CAClC,KAAM,CAACC,EAAUC,CAAW,EAAIZ,EAAS,EAAK,EACxC,CAAE,QAAAa,CAAQ,EAAIV,EAAkB,EAChCW,EAAU,CAAC,CAACD,EAEZ,CAAE,QAAAE,CAAQ,EA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rD,QAAQ,UACR,QAASA,EAAK,KAAOhB,EAAS,UAAYM,EAAS,uBACnD,KAAK,KACL,UAAU,kBAET,SAAAU,EAAK,YACR,EAEA5B,EAACE,EAAA,CAAO,QAAQ,UAAU,KAAK,KAAK,UAAU,kBAAkB,SAAQ,GACrE,SAAA0B,EAAK,YACR,IAhCGA,EAAK,EAkCZ,CACD,EACA,CAACN,GACAtB,EAAC,OACC,UAAU,iCACV,MAAO,CAAE,WAAY,kEAAmE,EACzF,GAEL,EACCsB,EACCtB,EAAC,UACC,UAAU,8CACV,QAAS,IAAM,CACbuB,EAAY,EAAK,CACnB,EAEA,SAAAvB,EAACQ,EAAA,CAAc,UAAU,kDAAkD,EAC7E,EAEAR,EAAAD,EAAA,CACE,SAAAC,EAAC,OAAI,UAAU,6EACb,SAAAA,EAAC,UAAO,UAAU,QAAQ,QAAS,IAAMuB,EAAY,CAACD,CAAQ,EAC5D,SAAAtB,EAACO,EAAA,CAAgB,UAAU,kDAAkD,EAC/E,EACF,EACF,GAEJ,GACF,EACF,CAEJ",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "Button", "Container", "Heading", "Picture", "Text", "ChevronDownIcon", "ChevronUpIcon", "motion", "useMemo", "useState", "TaskType", "useActions", "useCreditsContext", "cn", "CreditsWaysToGetCredits", "copy", "activate", "subscribe", "uploadReceipt", "classNames", "showMore", "setShowMore", "profile", "isLogin", "actions", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b", "section"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ReceiptCopy } from '../modal/creditsUploadReceiptModal';
|
|
2
|
+
export type BenefitItem = {
|
|
3
|
+
title: string;
|
|
4
|
+
credits: string;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
export type WaysToGetCreditsCopy = {
|
|
8
|
+
title: string;
|
|
9
|
+
subtitle: string;
|
|
10
|
+
equalCredits: string;
|
|
11
|
+
musicIcon: string;
|
|
12
|
+
list: BenefitItem[];
|
|
13
|
+
mainImage: {
|
|
14
|
+
url: string;
|
|
15
|
+
alt: string;
|
|
16
|
+
};
|
|
17
|
+
joinNow: string;
|
|
18
|
+
activate: string;
|
|
19
|
+
completed: string;
|
|
20
|
+
completeProfile: string;
|
|
21
|
+
makeFirstPurchase: string;
|
|
22
|
+
goShopLink: string;
|
|
23
|
+
uploadReceipt: string;
|
|
24
|
+
shopNow: string;
|
|
25
|
+
subscribe: string;
|
|
26
|
+
sendEmailSuccess: string;
|
|
27
|
+
creditsIcon: {
|
|
28
|
+
url: string;
|
|
29
|
+
alt: string;
|
|
30
|
+
};
|
|
31
|
+
receipt: ReceiptCopy;
|
|
32
|
+
};
|
|
33
|
+
export declare enum TaskType {
|
|
34
|
+
Activate = "activate",
|
|
35
|
+
Subscribe = "subscribe",
|
|
36
|
+
CompleteProfile = "completeProfile",
|
|
37
|
+
FirstPurchase = "firstPurchase",
|
|
38
|
+
UploadReceipt = "uploadReceipt",
|
|
39
|
+
Shop = "shop"
|
|
40
|
+
}
|
|
41
|
+
export type CreditsWaysToGetCreditsProps = {
|
|
42
|
+
copy: WaysToGetCreditsCopy;
|
|
43
|
+
classNames?: {
|
|
44
|
+
equalCreditsText?: string;
|
|
45
|
+
subtitle?: string;
|
|
46
|
+
};
|
|
47
|
+
activate: {
|
|
48
|
+
openAuthCodePopup: () => void;
|
|
49
|
+
isSuccess: boolean;
|
|
50
|
+
isSendingActivateEmail: boolean;
|
|
51
|
+
};
|
|
52
|
+
subscribe: {
|
|
53
|
+
openSubscribePopup: () => void;
|
|
54
|
+
isSuccess: boolean;
|
|
55
|
+
};
|
|
56
|
+
uploadReceipt: {
|
|
57
|
+
openUploadReceiptPopup: () => void;
|
|
58
|
+
isSuccess: boolean;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/type.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ReceiptCopy } from '../modal/creditsUploadReceiptModal'\n\nexport type BenefitItem = {\n title: string\n credits: string\n id: string\n}\n\nexport type WaysToGetCreditsCopy = {\n title: string\n subtitle: string\n equalCredits: string\n musicIcon: string\n list: BenefitItem[]\n mainImage: {\n url: string\n alt: string\n }\n joinNow: string\n activate: string\n completed: string\n completeProfile: string\n makeFirstPurchase: string\n goShopLink: string\n uploadReceipt: string\n shopNow: string\n subscribe: string\n sendEmailSuccess: string\n creditsIcon: {\n url: string\n alt: string\n }\n receipt: ReceiptCopy\n}\n\nexport enum TaskType {\n Activate = 'activate',\n Subscribe = 'subscribe',\n CompleteProfile = 'completeProfile',\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shop = 'shop',\n}\n\nexport type CreditsWaysToGetCreditsProps = {\n copy: WaysToGetCreditsCopy\n classNames?: {\n equalCreditsText?: string\n subtitle?: string\n }\n activate: {\n openAuthCodePopup: () => void\n isSuccess: boolean\n isSendingActivateEmail: boolean\n }\n subscribe: {\n openSubscribePopup: () => void\n isSuccess: boolean\n }\n uploadReceipt: {\n openUploadReceiptPopup: () => void\n isSuccess: boolean\n }\n}\n"],
|
|
5
|
+
"mappings": "AAmCO,IAAKA,OACVA,EAAA,SAAW,WACXA,EAAA,UAAY,YACZA,EAAA,gBAAkB,kBAClBA,EAAA,cAAgB,gBAChBA,EAAA,cAAgB,gBAChBA,EAAA,KAAO,OANGA,OAAA",
|
|
6
|
+
"names": ["TaskType"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { CreditsWaysToGetCreditsProps } from './type';
|
|
2
|
+
export declare const useActions: ({ copy, subscribe, uploadReceipt, activate, gaParameters, }: CreditsWaysToGetCreditsProps & {
|
|
3
|
+
gaParameters?: {
|
|
4
|
+
position: string;
|
|
5
|
+
};
|
|
6
|
+
}) => {
|
|
7
|
+
actions: {
|
|
8
|
+
activate: {
|
|
9
|
+
finished: any;
|
|
10
|
+
notLogin: {
|
|
11
|
+
buttonLabel: string;
|
|
12
|
+
handleClick: () => void;
|
|
13
|
+
};
|
|
14
|
+
notFinished: {
|
|
15
|
+
buttonLabel: string;
|
|
16
|
+
handleClick: () => void;
|
|
17
|
+
};
|
|
18
|
+
completed: {
|
|
19
|
+
buttonLabel: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
subscribe: {
|
|
23
|
+
finished: boolean;
|
|
24
|
+
notLogin: {
|
|
25
|
+
buttonLabel: string;
|
|
26
|
+
handleClick: () => void;
|
|
27
|
+
};
|
|
28
|
+
notFinished: {
|
|
29
|
+
buttonLabel: string;
|
|
30
|
+
handleClick: () => void;
|
|
31
|
+
};
|
|
32
|
+
completed: {
|
|
33
|
+
buttonLabel: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
completeProfile: {
|
|
37
|
+
finished: any;
|
|
38
|
+
notLogin: {
|
|
39
|
+
buttonLabel: string;
|
|
40
|
+
handleClick: () => void;
|
|
41
|
+
};
|
|
42
|
+
notFinished: {
|
|
43
|
+
buttonLabel: string;
|
|
44
|
+
link: string;
|
|
45
|
+
handleClick: () => void;
|
|
46
|
+
};
|
|
47
|
+
completed: {
|
|
48
|
+
buttonLabel: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
firstPurchase: {
|
|
52
|
+
finished: boolean;
|
|
53
|
+
notLogin: {
|
|
54
|
+
buttonLabel: string;
|
|
55
|
+
handleClick: () => void;
|
|
56
|
+
};
|
|
57
|
+
notFinished: {
|
|
58
|
+
buttonLabel: string;
|
|
59
|
+
link: string;
|
|
60
|
+
handleClick: () => void;
|
|
61
|
+
};
|
|
62
|
+
completed: {
|
|
63
|
+
buttonLabel: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
uploadReceipt: {
|
|
67
|
+
finished: boolean;
|
|
68
|
+
notLogin: {
|
|
69
|
+
buttonLabel: string;
|
|
70
|
+
handleClick: () => void;
|
|
71
|
+
};
|
|
72
|
+
notFinished: {
|
|
73
|
+
buttonLabel: string;
|
|
74
|
+
handleClick: () => void;
|
|
75
|
+
};
|
|
76
|
+
completed: {
|
|
77
|
+
buttonLabel: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
shop: {
|
|
81
|
+
finished: boolean;
|
|
82
|
+
notLogin: {
|
|
83
|
+
buttonLabel: string;
|
|
84
|
+
handleClick: () => void;
|
|
85
|
+
};
|
|
86
|
+
notFinished: {
|
|
87
|
+
buttonLabel: string;
|
|
88
|
+
link: string;
|
|
89
|
+
handleClick: () => void;
|
|
90
|
+
};
|
|
91
|
+
completed: {
|
|
92
|
+
buttonLabel: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{TaskType as t}from"./type";import{useCreditsContext as L}from"../context/provider";import{useMemo as d}from"react";import C from"../context/hooks/useReceiptUploaded";import{useFirstPurchaseFinished as P}from"../context/hooks/useFirstPurchaseFinished";import{useSubscribed as g}from"../context/hooks/useSubscribed";import{useShopifyContext as v}from"@shopify/context/ShopifyProvider";import{gaTrack as F}from"../../../helpers/track";const x=({copy:e,subscribe:u,uploadReceipt:c,activate:m,gaParameters:n})=>{const{openSignUpPopup:a,gtm:p,profile:o}=L(),l=g(),s=P(),b=C(),{appName:h}=v(),r=d(()=>(o?.first_name||o?.last_name)&&o?.phone_number&&o?.dob,[o]);return d(()=>{const i=({buttonName:k,id:f,callback:N})=>{F({event:"ga4Event",event_name:"lp_button",member_active_status:o?.activated?"active":"not active",event_parameters:{page_group:p.pageGroup,position:n?.position||e.title,button_name:k,info:f}}),N()};return{actions:{[t.Activate]:{finished:o?.activated,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Activate})},notFinished:{buttonLabel:e?.activate,handleClick:()=>i({buttonName:e?.activate,callback:()=>m.openAuthCodePopup(),id:t.Activate})},completed:{buttonLabel:e?.completed}},[t.Subscribe]:{finished:l,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Subscribe})},notFinished:{buttonLabel:e?.subscribe,handleClick:()=>i({buttonName:e?.subscribe,callback:()=>u.openSubscribePopup(),id:t.Subscribe})},completed:{buttonLabel:e?.completed}},[t.CompleteProfile]:{finished:r,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.CompleteProfile})},notFinished:{buttonLabel:e?.completeProfile,link:`/account/profile?app=${h}`,handleClick:()=>i({buttonName:e?.completeProfile,callback:()=>{},id:t.CompleteProfile})},completed:{buttonLabel:e?.completed}},[t.FirstPurchase]:{finished:s,notLogin:{buttonLabel:e?.makeFirstPurchase,handleClick:()=>i({buttonName:e?.makeFirstPurchase,callback:a,id:t.FirstPurchase})},notFinished:{buttonLabel:e?.makeFirstPurchase,link:e?.goShopLink,handleClick:()=>i({buttonName:e?.makeFirstPurchase,callback:()=>{},id:t.FirstPurchase})},completed:{buttonLabel:e?.completed}},[t.UploadReceipt]:{finished:b,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.UploadReceipt})},notFinished:{buttonLabel:e?.uploadReceipt,handleClick:()=>i({buttonName:e?.uploadReceipt,callback:()=>c.openUploadReceiptPopup(),id:t.UploadReceipt})},completed:{buttonLabel:e?.completed}},[t.Shop]:{finished:!1,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Shop})},notFinished:{buttonLabel:e?.shopNow,link:e?.goShopLink,handleClick:()=>i({buttonName:e?.shopNow,callback:()=>{},id:t.Shop})},completed:{buttonLabel:e?.completed}}}}},[o?.activated,e?.joinNow,e?.activate,e?.completed,e?.subscribe,e?.completeProfile,e?.makeFirstPurchase,e?.uploadReceipt,e?.shopNow,e.title,e?.goShopLink,l,r,s,b,n?.position,a])};export{x as useActions};
|
|
2
|
+
//# sourceMappingURL=useActions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/useActions.ts"],
|
|
4
|
+
"sourcesContent": ["import { TaskType } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useMemo } from 'react'\nimport useReceiptUploaded from '../context/hooks/useReceiptUploaded'\nimport { useFirstPurchaseFinished } from '../context/hooks/useFirstPurchaseFinished'\nimport { useSubscribed } from '../context/hooks/useSubscribed'\nimport type { CreditsWaysToGetCreditsProps } from './type'\nimport { useShopifyContext } from '@shopify/context/ShopifyProvider'\nimport { gaTrack } from '../../../helpers/track'\n\nexport const useActions = ({\n copy,\n subscribe,\n uploadReceipt,\n activate,\n gaParameters,\n}: CreditsWaysToGetCreditsProps & {\n gaParameters?: {\n position: string\n }\n}) => {\n const { openSignUpPopup, gtm, profile } = useCreditsContext()\n const isSubscribed = useSubscribed()\n const firstPurchaseFinished = useFirstPurchaseFinished()\n const uploadedReceipt = useReceiptUploaded()\n const { appName } = useShopifyContext()\n\n const profileCompleted = useMemo(() => {\n return (profile?.first_name || profile?.last_name) && profile?.phone_number && profile?.dob\n }, [profile])\n\n return useMemo(() => {\n const handleClickWithTrack = ({\n buttonName,\n id,\n callback,\n }: {\n buttonName: string\n id?: string\n callback: () => void\n }) => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: gtm.pageGroup,\n position: gaParameters?.position || copy.title,\n button_name: buttonName,\n info: id,\n },\n })\n callback()\n }\n return {\n actions: {\n [TaskType.Activate]: {\n finished: profile?.activated,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({ buttonName: copy?.joinNow, callback: openSignUpPopup, id: TaskType.Activate }),\n },\n notFinished: {\n buttonLabel: copy?.activate,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.activate,\n callback: () => activate.openAuthCodePopup(),\n id: TaskType.Activate,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.Subscribe]: {\n finished: isSubscribed,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({ buttonName: copy?.joinNow, callback: openSignUpPopup, id: TaskType.Subscribe }),\n },\n notFinished: {\n buttonLabel: copy?.subscribe,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.subscribe,\n callback: () => subscribe.openSubscribePopup(),\n id: TaskType.Subscribe,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.CompleteProfile]: {\n finished: profileCompleted,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.CompleteProfile,\n }),\n },\n notFinished: {\n buttonLabel: copy?.completeProfile,\n link: `/account/profile?app=${appName}`,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.completeProfile,\n callback: () => {},\n id: TaskType.CompleteProfile,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.FirstPurchase]: {\n finished: firstPurchaseFinished,\n notLogin: {\n buttonLabel: copy?.makeFirstPurchase,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.makeFirstPurchase,\n callback: openSignUpPopup,\n id: TaskType.FirstPurchase,\n }),\n },\n notFinished: {\n buttonLabel: copy?.makeFirstPurchase,\n link: copy?.goShopLink,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.makeFirstPurchase,\n callback: () => {},\n id: TaskType.FirstPurchase,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.UploadReceipt]: {\n finished: uploadedReceipt,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.UploadReceipt,\n }),\n },\n notFinished: {\n buttonLabel: copy?.uploadReceipt,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.uploadReceipt,\n callback: () => uploadReceipt.openUploadReceiptPopup(),\n id: TaskType.UploadReceipt,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.Shop]: {\n finished: false,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.Shop,\n }),\n },\n notFinished: {\n buttonLabel: copy?.shopNow,\n link: copy?.goShopLink,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.shopNow,\n callback: () => {},\n id: TaskType.Shop,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n },\n }\n }, [\n profile?.activated,\n copy?.joinNow,\n copy?.activate,\n copy?.completed,\n copy?.subscribe,\n copy?.completeProfile,\n copy?.makeFirstPurchase,\n copy?.uploadReceipt,\n copy?.shopNow,\n copy.title,\n copy?.goShopLink,\n isSubscribed,\n profileCompleted,\n firstPurchaseFinished,\n uploadedReceipt,\n gaParameters?.position,\n openSignUpPopup,\n ])\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,MAAgB,SACzB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,WAAAC,MAAe,QACxB,OAAOC,MAAwB,sCAC/B,OAAS,4BAAAC,MAAgC,4CACzC,OAAS,iBAAAC,MAAqB,iCAE9B,OAAS,qBAAAC,MAAyB,mCAClC,OAAS,WAAAC,MAAe,yBAEjB,MAAMC,EAAa,CAAC,CACzB,KAAAC,EACA,UAAAC,EACA,cAAAC,EACA,SAAAC,EACA,aAAAC,CACF,IAIM,CACJ,KAAM,CAAE,gBAAAC,EAAiB,IAAAC,EAAK,QAAAC,CAAQ,EAAIf,EAAkB,EACtDgB,EAAeZ,EAA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,CACX,YAAaS,GAAM,QACnB,KAAMA,GAAM,WACZ,YAAa,IACXa,EAAqB,CACnB,WAAYb,GAAM,QAClB,SAAU,IAAM,CAAC,EACjB,GAAIT,EAAS,IACf,CAAC,CACL,EACA,UAAW,CACT,YAAaS,GAAM,SACrB,CACF,CACF,CACF,CACF,EAAG,CACDO,GAAS,UACTP,GAAM,QACNA,GAAM,SACNA,GAAM,UACNA,GAAM,UACNA,GAAM,gBACNA,GAAM,kBACNA,GAAM,cACNA,GAAM,QACNA,EAAK,MACLA,GAAM,WACNQ,EACAI,EACAH,EACAC,EACAN,GAAc,SACdC,CACF,CAAC,CACH",
|
|
6
|
+
"names": ["TaskType", "useCreditsContext", "useMemo", "useReceiptUploaded", "useFirstPurchaseFinished", "useSubscribed", "useShopifyContext", "gaTrack", "useActions", "copy", "subscribe", "uploadReceipt", "activate", "gaParameters", "openSignUpPopup", "gtm", "profile", "isSubscribed", "firstPurchaseFinished", "uploadedReceipt", "appName", "profileCompleted", "handleClickWithTrack", "buttonName", "id", "callback"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { CreditsProvider, useCreditsContext } from './context/provider';
|
|
2
|
+
export { useUploadReceipt as useCreditsUploadReceipt } from './context/hooks/useUploadReceipt';
|
|
3
|
+
export { CreditsUploadReceiptModal } from './modal/creditsUploadReceiptModal';
|
|
4
|
+
export { CreditsBanner } from './creditsBanner';
|
|
5
|
+
export { CreditsBenefits } from './creditsBenefits';
|
|
6
|
+
export { CreditsInfoCard } from './creditsInfoCard';
|
|
7
|
+
export { CreditsWaysToGetCredits } from './creditsWaysToGetCredits';
|
|
8
|
+
export { CreditsFaq } from './creditsFaq';
|
|
9
|
+
export { CreditsCash } from './creditsCash';
|
|
10
|
+
export { CreditsRedeemList } from './creditsRedeemList';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{CreditsProvider as t,useCreditsContext as o}from"./context/provider";import{useUploadReceipt as d}from"./context/hooks/useUploadReceipt";import{CreditsUploadReceiptModal as p}from"./modal/creditsUploadReceiptModal";import{CreditsBanner as f}from"./creditsBanner";import{CreditsBenefits as x}from"./creditsBenefits";import{CreditsInfoCard as n}from"./creditsInfoCard";import{CreditsWaysToGetCredits as R}from"./creditsWaysToGetCredits";import{CreditsFaq as u}from"./creditsFaq";import{CreditsCash as B}from"./creditsCash";import{CreditsRedeemList as q}from"./creditsRedeemList";export{f as CreditsBanner,x as CreditsBenefits,B as CreditsCash,u as CreditsFaq,n as CreditsInfoCard,t as CreditsProvider,q as CreditsRedeemList,p as CreditsUploadReceiptModal,R as CreditsWaysToGetCredits,o as useCreditsContext,d as useCreditsUploadReceipt};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/credits/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { CreditsProvider, useCreditsContext } from './context/provider'\n\nexport { useUploadReceipt as useCreditsUploadReceipt } from './context/hooks/useUploadReceipt'\nexport { CreditsUploadReceiptModal } from './modal/creditsUploadReceiptModal'\nexport { CreditsBanner } from './creditsBanner'\nexport { CreditsBenefits } from './creditsBenefits'\nexport { CreditsInfoCard } from './creditsInfoCard'\nexport { CreditsWaysToGetCredits } from './creditsWaysToGetCredits'\nexport { CreditsFaq } from './creditsFaq'\nexport { CreditsCash } from './creditsCash'\nexport { CreditsRedeemList } from './creditsRedeemList'\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,EAAiB,qBAAAC,MAAyB,qBAEnD,OAA6B,oBAApBC,MAAmD,mCAC5D,OAAS,6BAAAC,MAAiC,oCAC1C,OAAS,iBAAAC,MAAqB,kBAC9B,OAAS,mBAAAC,MAAuB,oBAChC,OAAS,mBAAAC,MAAuB,oBAChC,OAAS,2BAAAC,MAA+B,4BACxC,OAAS,cAAAC,MAAkB,eAC3B,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,qBAAAC,MAAyB",
|
|
6
|
+
"names": ["CreditsProvider", "useCreditsContext", "useUploadReceipt", "CreditsUploadReceiptModal", "CreditsBanner", "CreditsBenefits", "CreditsInfoCard", "CreditsWaysToGetCredits", "CreditsFaq", "CreditsCash", "CreditsRedeemList"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ModalContainerProps } from './modalContainer';
|
|
2
|
+
export interface MyRewardsMetafields {
|
|
3
|
+
title: string;
|
|
4
|
+
orderNumberLabel: string;
|
|
5
|
+
valueLabel: string;
|
|
6
|
+
receivedLabel: string;
|
|
7
|
+
failedLabel: string;
|
|
8
|
+
approveSuccessLabel: string;
|
|
9
|
+
couponTab: string;
|
|
10
|
+
productTab: string;
|
|
11
|
+
pendingLabel: string;
|
|
12
|
+
unfulfilledLabel: string;
|
|
13
|
+
fulfilledLabel: string;
|
|
14
|
+
confirmedTip: string;
|
|
15
|
+
pendingTip: string;
|
|
16
|
+
processingTip: string;
|
|
17
|
+
ShippedTip: string;
|
|
18
|
+
emptyListImageUrl: string;
|
|
19
|
+
emptyListLabel: string;
|
|
20
|
+
pointUnit: string;
|
|
21
|
+
code: string;
|
|
22
|
+
copied: string;
|
|
23
|
+
copy: string;
|
|
24
|
+
}
|
|
25
|
+
interface MyRewardsModalProps extends ModalContainerProps {
|
|
26
|
+
data: MyRewardsMetafields;
|
|
27
|
+
}
|
|
28
|
+
declare function MyRewardsModal({ data, ...props }: MyRewardsModalProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export default MyRewardsModal;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as i,jsxs as r}from"react/jsx-runtime";import{Tabs as j,TabsList as E,TabsTrigger as $,Picture as z}from"@anker-in/headless-ui";import M from"classnames";import H from"copy-to-clipboard";import K from"dayjs";import{useCallback as w,useMemo as p,useState as u}from"react";import{ApprovalStatus as m,AlpcConsumeType as n,RewardType as t}from"../context/const";import{CreditsModalContainer as V}from"./modalContainer";import q from"./tip";import B from"./loadingDots";import S from"../context/hooks/useMyRewards";function G({data:o,...a}){const[l,R]=u(n.Coupon),[d,F]=u(1),[c,h]=u(1),[_,g]=u(-1),A=p(()=>{const e=[];return o.couponTab&&e.push({title:o.couponTab,type:n.Coupon}),o.productTab&&e.push({title:o.productTab,type:n.Product}),e},[o.couponTab,o.productTab]),D=p(()=>({page:a.isOpen?c:0,pageSize:1e3,consumeType:n.Product}),[a.isOpen,c]),O=p(()=>({page:a.isOpen?d:0,pageSize:1e3,consumeType:n.Coupon}),[a.isOpen,d]),{myRewards:v=[],canNext:b,isLoading:x}=S(O),{myRewards:y=[],canNext:C,isLoading:T}=S(D),N=p(()=>l===n.Coupon?v.map(e=>({title:e.goods_title,value:e.consume_credits,type:t.Received,date:new Date(e.create_time*1e3),couponCode:e.coupon_code,orderNumber:""})):l===n.Product?y.map(e=>{let s=t.Pending;return e.fulfillment_status&&e.fulfillment_status!=="null"?e.fulfillment_status==="fulfilled"?s=t.Fulfilled:s=t.Unfulfilled:e.approval_status===m.Success||e.approval_status===m.DoubleConfirm?s=t.ApproveSuccess:e.approval_status===m.Failed&&(s=t.Failed),{title:e.goods_title,value:e.consume_credits,type:s,date:new Date(e.create_time*1e3),orderNumber:e.order_number,couponCode:""}}):[],[l,y,v]),L=p(()=>l===n.Coupon?b:l===n.Product?C:!1,[l,b,C]),U=p(()=>({[t.Received]:o.receivedLabel,[t.Pending]:o.pendingLabel,[t.ApproveFail]:o.failedLabel,[t.ApproveSuccess]:o.approveSuccessLabel,[t.Unfulfilled]:o.unfulfilledLabel,[t.Fulfilled]:o.fulfilledLabel,[t.Failed]:o.failedLabel}),[o]),P=p(()=>({[t.Received]:"",[t.Pending]:o.pendingTip,[t.ApproveFail]:"",[t.ApproveSuccess]:o.confirmedTip,[t.Unfulfilled]:o.processingTip,[t.Fulfilled]:o.ShippedTip,[t.Failed]:""}),[o]),k=p(()=>({[t.Received]:"#52C41A",[t.Pending]:"#999",[t.ApproveFail]:"#F84D4F",[t.ApproveSuccess]:"#999",[t.Unfulfilled]:"#999",[t.Fulfilled]:"#999",[t.Failed]:"#F84D4F"}),[]),I=w(()=>{L&&(l===n.Coupon?F(d+1):l===n.Product&&h(c+1))},[l,c,d,L]),Y=w((e,s)=>{g(s),H(e),setTimeout(()=>{g(-1)},2e3)},[]);return r(V,{title:o.title,className:M("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"min-l:px-0 md:mb-0 md:px-0",...a,onScrollEnd:I,children:[i("div",{className:"px-[24px] md:px-[16px]",children:i(j,{align:"left",shape:"rounded",value:l.toString(),onValueChange:e=>{R(Number(e))},children:i(E,{children:A.map(e=>i($,{value:e.type.toString(),children:e.title},e.type))})})}),r("div",{className:"mt-[24px] overflow-auto overscroll-contain px-[24px] md:px-[16px]",children:[!N.length&&!x&&!T&&r("div",{className:"flex h-full flex-col items-center justify-center",children:[i(z,{className:"mb-[12px] w-[160px]",src:o?.emptyListImageUrl}),i("div",{className:"text-[16px] font-semibold leading-[1.4]",children:o?.emptyListLabel})]}),x||T&&i("div",{className:"flex h-full flex-col items-center justify-center",children:i(B,{})}),i("div",{className:"grid gap-[18px] md:gap-[12px]",children:N.map((e,s)=>r("div",{className:"grid gap-[8px]",children:[e?.orderNumber&&r("div",{className:"text-[15px] font-semibold leading-[1.4] text-[#777]",children:[o.orderNumberLabel,": ",e.orderNumber]}),r("div",{className:"flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]",children:[r("div",{className:"grid gap-[4px]",children:[i("div",{className:"text-[16px] font-bold leading-[1.4]",children:e.title}),r("div",{className:"text-[14px] font-semibold text-[#999]",children:[o.valueLabel,": ",e.value," ",o?.pointUnit]}),r("div",{className:"text-[14px] font-semibold text-[#999]",children:[e?.couponCode?`${o?.code||"Code"}: ${e.couponCode} `:"",e?.couponCode&&i("span",{className:"cursor-pointer text-[14px] font-semibold text-brand underline",onClick:()=>{Y(e.couponCode,s)},role:"button",tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&f.preventDefault()},children:_===s?o?.copied||"COPIED":o?.copy||"COPY"})]})]}),r("div",{className:"grid gap-[4px] text-right",children:[r("div",{className:M("flex items-center justify-end text-[16px] font-bold leading-[1.4]",`text-[${k[e.type]}]`),children:[i("span",{children:U[e.type]}),P[e.type]&&i(q,{info:P[e.type],index:s})]}),i("div",{className:"text-[14px] font-semibold text-[#999]",children:K(e.date).format("YYYY-MM-DD HH:mm").toString()})]})]})]},s))})]})]})}var ne=G;export{ne as default};
|
|
2
|
+
//# sourceMappingURL=MyRewardsModal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/modal/MyRewardsModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Tabs, TabsList, TabsTrigger, Picture } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport clipboard from 'copy-to-clipboard'\nimport dayjs from 'dayjs'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport { ApprovalStatus, AlpcConsumeType, RewardType } from '../context/const'\nimport { CreditsModalContainer, type ModalContainerProps } from './modalContainer'\nimport Tip from './tip'\nimport LoadingDots from './loadingDots'\nimport useMyRewards from '../context/hooks/useMyRewards'\n\nexport interface MyRewardsMetafields {\n title: string\n orderNumberLabel: string\n valueLabel: string\n receivedLabel: string\n failedLabel: string\n approveSuccessLabel: string\n couponTab: string\n productTab: string\n pendingLabel: string\n unfulfilledLabel: string\n fulfilledLabel: string\n confirmedTip: string\n pendingTip: string\n processingTip: string\n ShippedTip: string\n emptyListImageUrl: string\n emptyListLabel: string\n pointUnit: string\n code: string\n copied: string\n copy: string\n}\ninterface MyRewardsModalProps extends ModalContainerProps {\n data: MyRewardsMetafields\n}\n\nfunction MyRewardsModal({ data, ...props }: MyRewardsModalProps) {\n const [activeTab, setActiveTab] = useState(AlpcConsumeType.Coupon)\n\n const [couponPage, setCouponPage] = useState(1)\n const [productPage, setProductPage] = useState(1)\n const [copied, setCopied] = useState(-1)\n\n const tabs = useMemo(() => {\n const availableTabs: { title: string; type: number }[] = []\n\n if (data.couponTab) {\n availableTabs.push({\n title: data.couponTab,\n type: AlpcConsumeType.Coupon,\n })\n }\n\n if (data.productTab) {\n availableTabs.push({\n title: data.productTab,\n type: AlpcConsumeType.Product,\n })\n }\n\n return availableTabs\n }, [data.couponTab, data.productTab])\n\n const myProductRewardsOptions = useMemo(() => {\n return {\n page: props.isOpen ? productPage : 0,\n pageSize: 1000,\n consumeType: AlpcConsumeType.Product,\n }\n }, [props.isOpen, productPage])\n const myCouponRewardsOptions = useMemo(() => {\n return {\n page: props.isOpen ? couponPage : 0,\n pageSize: 1000,\n consumeType: AlpcConsumeType.Coupon,\n }\n }, [props.isOpen, couponPage])\n\n const {\n myRewards: myCouponRewards = [],\n canNext: couponCanNext,\n isLoading: couponIsLoading,\n } = useMyRewards(myCouponRewardsOptions)\n const {\n myRewards: myProductRewards = [],\n canNext: productCanNext,\n isLoading: productIsLoading,\n } = useMyRewards(myProductRewardsOptions)\n\n const list = useMemo(() => {\n if (activeTab === AlpcConsumeType.Coupon) {\n return myCouponRewards.map(item => ({\n title: item.goods_title,\n value: item.consume_credits,\n type: RewardType.Received,\n date: new Date(item.create_time * 1000),\n couponCode: item.coupon_code,\n orderNumber: '',\n }))\n }\n\n if (activeTab === AlpcConsumeType.Product) {\n return myProductRewards.map(item => {\n let type = RewardType.Pending\n\n if (item.fulfillment_status && item.fulfillment_status !== 'null') {\n // \u7269\u6D41\u72B6\u6001\n if (item.fulfillment_status === 'fulfilled') {\n type = RewardType.Fulfilled\n } else {\n type = RewardType.Unfulfilled\n }\n } else {\n if (\n item.approval_status === ApprovalStatus.Success ||\n item.approval_status === ApprovalStatus.DoubleConfirm\n ) {\n type = RewardType.ApproveSuccess\n } else if (item.approval_status === ApprovalStatus.Failed) {\n type = RewardType.Failed\n }\n }\n\n return {\n title: item.goods_title,\n value: item.consume_credits,\n type,\n date: new Date(item.create_time * 1000),\n orderNumber: item.order_number,\n couponCode: '',\n }\n })\n }\n\n return []\n }, [activeTab, myProductRewards, myCouponRewards])\n\n const canNext = useMemo(() => {\n if (activeTab === AlpcConsumeType.Coupon) {\n return couponCanNext\n }\n\n if (activeTab === AlpcConsumeType.Product) {\n return productCanNext\n }\n\n return false\n }, [activeTab, couponCanNext, productCanNext])\n\n const TypeMap = useMemo(() => {\n return {\n [RewardType.Received]: data.receivedLabel,\n [RewardType.Pending]: data.pendingLabel,\n [RewardType.ApproveFail]: data.failedLabel,\n [RewardType.ApproveSuccess]: data.approveSuccessLabel,\n [RewardType.Unfulfilled]: data.unfulfilledLabel,\n [RewardType.Fulfilled]: data.fulfilledLabel,\n [RewardType.Failed]: data.failedLabel,\n }\n }, [data])\n\n const TipMap = useMemo(() => {\n return {\n [RewardType.Received]: '',\n [RewardType.Pending]: data.pendingTip,\n [RewardType.ApproveFail]: '',\n [RewardType.ApproveSuccess]: data.confirmedTip,\n [RewardType.Unfulfilled]: data.processingTip,\n [RewardType.Fulfilled]: data.ShippedTip,\n [RewardType.Failed]: '',\n }\n }, [data])\n\n const ColorMap = useMemo(() => {\n return {\n [RewardType.Received]: '#52C41A',\n [RewardType.Pending]: '#999',\n [RewardType.ApproveFail]: '#F84D4F',\n [RewardType.ApproveSuccess]: '#999',\n [RewardType.Unfulfilled]: '#999',\n [RewardType.Fulfilled]: '#999',\n [RewardType.Failed]: '#F84D4F',\n }\n }, [])\n\n const handleScrollEnd = useCallback(() => {\n if (!canNext) {\n return\n }\n\n if (activeTab === AlpcConsumeType.Coupon) {\n setCouponPage(couponPage + 1)\n } else if (activeTab === AlpcConsumeType.Product) {\n setProductPage(productPage + 1)\n }\n }, [activeTab, productPage, couponPage, canNext])\n\n const handleCopy = useCallback((code: string, idx: number) => {\n setCopied(idx)\n clipboard(code)\n setTimeout(() => {\n setCopied(-1)\n }, 2000)\n }, [])\n\n return (\n <CreditsModalContainer\n title={data.title}\n className={classNames('h-[800px] w-[640px]')}\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n scrollClassName=\"min-l:px-0 md:mb-0 md:px-0\"\n {...props}\n onScrollEnd={handleScrollEnd}\n >\n <div className=\"px-[24px] md:px-[16px]\">\n <Tabs\n align=\"left\"\n shape=\"rounded\"\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(Number(value))\n }}\n >\n <TabsList>\n {tabs.map(tab => (\n <TabsTrigger key={tab.type} value={tab.type.toString()}>\n {tab.title}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n </div>\n\n <div className=\"mt-[24px] overflow-auto overscroll-contain px-[24px] md:px-[16px]\">\n {!list.length && !couponIsLoading && !productIsLoading && (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <Picture className=\"mb-[12px] w-[160px]\" src={data?.emptyListImageUrl}></Picture>\n <div className=\"text-[16px] font-semibold leading-[1.4]\">{data?.emptyListLabel}</div>\n </div>\n )}\n {couponIsLoading ||\n (productIsLoading && (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <LoadingDots />\n </div>\n ))}\n <div className=\"grid gap-[18px] md:gap-[12px]\">\n {list.map((item, index) => (\n <div key={index} className=\"grid gap-[8px]\">\n {item?.orderNumber && (\n <div className=\"text-[15px] font-semibold leading-[1.4] text-[#777]\">\n {data.orderNumberLabel}: {item.orderNumber}\n </div>\n )}\n <div className=\"flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]\">\n <div className=\"grid gap-[4px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{item.title}</div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {data.valueLabel}: {item.value} {data?.pointUnit}\n </div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {item?.couponCode ? `${data?.code || 'Code'}: ${item.couponCode} ` : ''}\n {item?.couponCode && (\n <span\n className=\"cursor-pointer text-[14px] font-semibold text-brand underline\"\n onClick={() => {\n handleCopy(item.couponCode, index)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copied === index ? data?.copied || 'COPIED' : data?.copy || 'COPY'}\n </span>\n )}\n </div>\n </div>\n <div className=\"grid gap-[4px] text-right\">\n <div\n className={classNames(\n 'flex items-center justify-end text-[16px] font-bold leading-[1.4]',\n `text-[${ColorMap[item.type]}]`\n )}\n >\n <span>{TypeMap[item.type]}</span>\n {TipMap[item.type] && <Tip info={TipMap[item.type]} index={index} />}\n </div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}\n </div>\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n </CreditsModalContainer>\n )\n}\n\nexport default MyRewardsModal\n"],
|
|
5
|
+
"mappings": "AAqOc,cAAAA,EAUJ,QAAAC,MAVI,oBArOd,OAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,EAAa,WAAAC,MAAe,wBACrD,OAAOC,MAAgB,aACvB,OAAOC,MAAe,oBACtB,OAAOC,MAAW,QAClB,OAAS,eAAAC,EAAa,WAAAC,EAAS,YAAAC,MAAgB,QAE/C,OAAS,kBAAAC,EAAgB,mBAAAC,EAAiB,cAAAC,MAAkB,mBAC5D,OAAS,yBAAAC,MAAuD,mBAChE,OAAOC,MAAS,QAChB,OAAOC,MAAiB,gBACxB,OAAOC,MAAkB,gCA6BzB,SAASC,EAAe,CAAE,KAAAC,EAAM,GAAGC,CAAM,EAAwB,CAC/D,KAAM,CAACC,EAAWC,CAAY,EAAIZ,EAASE,EAAgB,MAAM,EAE3D,CAACW,EAAYC,CAAa,EAAId,EAAS,CAAC,EACxC,CAACe,EAAaC,CAAc,EAAIhB,EAAS,CAAC,EAC1C,CAACiB,EAAQC,CAAS,EAAIlB,EAAS,EAAE,EAEjCmB,EAAOpB,EAAQ,IAAM,CACzB,MAAMqB,EAAmD,CAAC,EAE1D,OA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C,EAAC,OAAI,UAAU,sDACZ,UAAAmB,EAAK,iBAAiB,KAAGqB,EAAK,aACjC,EAEFxC,EAAC,OAAI,UAAU,mFACb,UAAAA,EAAC,OAAI,UAAU,iBACb,UAAAD,EAAC,OAAI,UAAU,sCAAuC,SAAAyC,EAAK,MAAM,EACjExC,EAAC,OAAI,UAAU,wCACZ,UAAAmB,EAAK,WAAW,KAAGqB,EAAK,MAAM,IAAErB,GAAM,WACzC,EACAnB,EAAC,OAAI,UAAU,wCACZ,UAAAwC,GAAM,WAAa,GAAGrB,GAAM,MAAQ,MAAM,KAAKqB,EAAK,UAAU,IAAM,GACpEA,GAAM,YACLzC,EAAC,QACC,UAAU,gEACV,QAAS,IAAM,CACbgD,EAAWP,EAAK,WAAYY,CAAK,CACnC,EACA,KAAK,SACL,SAAU,EACV,UAAWC,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EAEC,SAAA1B,IAAWyB,EAAQjC,GAAM,QAAU,SAAWA,GAAM,MAAQ,OAC/D,GAEJ,GACF,EACAnB,EAAC,OAAI,UAAU,4BACb,UAAAA,EAAC,OACC,UAAWK,EACT,oEACA,SAASwC,EAASL,EAAK,IAAI,CAAC,GAC9B,EAEA,UAAAzC,EAAC,QAAM,SAAA4C,EAAQH,EAAK,IAAI,EAAE,EACzBI,EAAOJ,EAAK,IAAI,GAAKzC,EAACgB,EAAA,CAAI,KAAM6B,EAAOJ,EAAK,IAAI,EAAG,MAAOY,EAAO,GACpE,EACArD,EAAC,OAAI,UAAU,wCACZ,SAAAQ,EAAMiC,EAAK,IAAI,EAAE,OAAO,kBAAkB,EAAE,SAAS,EACxD,GACF,GACF,IA/CQY,CAgDV,CACD,EACH,GACF,GACF,CAEJ,CAEA,IAAOE,GAAQpC",
|
|
6
|
+
"names": ["jsx", "jsxs", "Tabs", "TabsList", "TabsTrigger", "Picture", "classNames", "clipboard", "dayjs", "useCallback", "useMemo", "useState", "ApprovalStatus", "AlpcConsumeType", "RewardType", "CreditsModalContainer", "Tip", "LoadingDots", "useMyRewards", "MyRewardsModal", "data", "props", "activeTab", "setActiveTab", "couponPage", "setCouponPage", "productPage", "setProductPage", "copied", "setCopied", "tabs", "availableTabs", "myProductRewardsOptions", "myCouponRewardsOptions", "myCouponRewards", "couponCanNext", "couponIsLoading", "myProductRewards", "productCanNext", "productIsLoading", "list", "item", "type", "canNext", "TypeMap", "TipMap", "ColorMap", "handleScrollEnd", "handleCopy", "code", "idx", "value", "tab", "index", "e", "MyRewardsModal_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ModalContainerProps } from './modalContainer';
|
|
2
|
+
export interface MyActivitiesMetafields {
|
|
3
|
+
title: string;
|
|
4
|
+
tips: string;
|
|
5
|
+
allTab: string;
|
|
6
|
+
earnedTab: string;
|
|
7
|
+
deductedTab: string;
|
|
8
|
+
expiredTab: string;
|
|
9
|
+
activationTask: string;
|
|
10
|
+
updateNameTask: string;
|
|
11
|
+
updatePhoneTask: string;
|
|
12
|
+
updateBirthdayTask: string;
|
|
13
|
+
updateAppNameTask: string;
|
|
14
|
+
subscriptionTask: string;
|
|
15
|
+
refundTask: string;
|
|
16
|
+
productUnApprovedTask: string;
|
|
17
|
+
pendingTips?: string;
|
|
18
|
+
pendingTips2?: string;
|
|
19
|
+
firstPurchaseTask: string;
|
|
20
|
+
uploadReceiptTask: string;
|
|
21
|
+
shoppingTask: string;
|
|
22
|
+
emptyListImageUrl: string;
|
|
23
|
+
emptyListLabel: string;
|
|
24
|
+
}
|
|
25
|
+
interface ActivitiesModalProps extends ModalContainerProps {
|
|
26
|
+
data: MyActivitiesMetafields;
|
|
27
|
+
}
|
|
28
|
+
declare function ActivitiesModal({ data, ...props }: ActivitiesModalProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export default ActivitiesModal;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as i,jsxs as n}from"react/jsx-runtime";import{useCallback as D,useMemo as f,useState as y}from"react";import{useCreditsContext as L}from"../context/provider";import{CreditType as p,DTC_TASK_TYPE as g,TaskSubType as r,TaskType as Y}from"../context/const";import E from"../context/hooks/useActivities";import{CreditsModalContainer as w}from"./modalContainer";import{cn as b}from"../../../helpers/utils";import{Tabs as R,TabsList as B,TabsTrigger as I}from"@anker-in/headless-ui";import j from"./loadingDots";import{Picture as F,Text as h}from"@anker-in/headless-ui";import N from"dayjs";function O({data:e,...c}){const[d,A]=y(1),{taskIdToTypeMapping:u}=L(),_=f(()=>({page:c.isOpen?d:0,pageSize:1e3}),[c.isOpen,d]),[o,M]=y(p.All),P=f(()=>{const s=[{title:e.allTab,type:p.All},{title:e.earnedTab,type:p.Earned},{title:e.deductedTab,type:p.Deducted}];return e.expiredTab&&s.push({title:e.expiredTab,type:p.Expired}),s},[e]),{activities:x=[],canNext:v,isLoading:k}=E(_),T=f(()=>{const s={[r.Activation]:e.activationTask,[r.UpdateName]:e.updateNameTask,[r.UpdatePhone]:e.updatePhoneTask,[r.UpdateBirthday]:e.updateBirthdayTask,[r.Subscription]:e.subscriptionTask,[r.UpadteAppName]:e.updateAppNameTask,[r.Refund]:e.refundTask,[r.ProductUnApproved]:e.productUnApprovedTask},m={[g.FirstPurchase]:e.firstPurchaseTask,[g.UploadReceipt]:e.uploadReceiptTask,[g.Shopping]:e.shoppingTask};function U(t){return t.task_type===Y.Redeem&&t.task_sub_type===r.ProductUnApproved&&e.productUnApprovedTask?t.task_name.replace("Refund",e.productUnApprovedTask):u?.[String(t.task_rule_id)]?m[u?.[String(t.task_rule_id)]]:s[t.task_sub_type]||t.task_name}let a=x.map(t=>({title:U(t),date:new Date(t.create_time*1e3),value:t.credit,type:t.credit_type,pending_time:t.pending_time,credit_type:t.credit_type,status:t.status}))||[];return o===p.Earned?a=a?.filter(t=>t.type===1):o===p.Deducted?a=a?.filter(t=>t.type===2&&t.status!==3):o===p.Expired&&(a=a?.filter(t=>t.type===2&&t.status===3)),a.map(t=>{let{value:l,...S}=t;return t.type===p.Deducted&&l>0&&(l=-l),{value:l,...S}})},[e.activationTask,e.updateNameTask,e.updatePhoneTask,e.updateBirthdayTask,e.subscriptionTask,e.updateAppNameTask,e.refundTask,e.productUnApprovedTask,e.firstPurchaseTask,e.uploadReceiptTask,e.shoppingTask,x,o,u]),C=D(()=>{v&&A(d+1)},[d,v]);return n(w,{title:e.title,className:b("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"min-l:px-0 md:mb-0 md:px-0",...c,onScrollEnd:C,children:[i("div",{className:"w-full overflow-x-auto",children:i(R,{align:"left",shape:"rounded",value:o.toString(),onValueChange:s=>{M(Number(s))},className:"px-[24px] md:px-[16px]",children:i(B,{children:P.map(s=>i(I,{value:s.type.toString(),children:s.title},s.type))})})}),n("div",{className:"mt-[24px] grid gap-[18px] overflow-auto overscroll-contain px-[24px] md:gap-[12px] md:px-[16px]",children:[k&&i("div",{className:"flex h-full flex-col items-center justify-center",children:i(j,{})}),!T.length&&!k&&n("div",{className:"flex h-full flex-col items-center justify-center",children:[i(F,{className:"mb-[16px] h-[120px] w-[160px]",src:e?.emptyListImageUrl}),i("div",{className:"leading-1.4 text-[16px] font-semibold",children:e?.emptyListLabel})]}),T.map((s,m)=>n("div",{className:"flex h-fit items-center justify-between rounded-[8px] bg-[#f2f0f1] px-[16px] py-[20px] text-[16px]",children:[n("div",{className:"grid gap-[6px]",children:[i("div",{className:"font-bold",children:s.title}),i("div",{className:"text-[14px] font-semibold text-[#999]",children:N(s.date).format("YYYY-MM-DD HH:mm").toString()}),!e.pendingTips&&n("div",{className:`hidden text-[14px] font-semibold text-[#777] ${s.status===2&&s.credit_type===1?"!flex":""}`,children:[i(h,{html:e.pendingTips}),i("span",{children:N.unix(s.pending_time).add(1,"day").format("YYYY-MM-DD")}),e.pendingTips2&&i(h,{html:e.pendingTips2})]})]}),n("div",{className:b("font-bold",s.value>=0||s.credit_type===p.Expired?"text-[#52C41A]":"text-[#F84D4F]"),children:[s.value>=0&&"+",s.value]})]},m))]}),!!T.length&&i("div",{className:"mt-[12px] px-[24px] pb-[24px] text-[14px] font-semibold text-[#999] md:px-[16px]",children:e.tips})]})}var Z=O;export{Z as default};
|
|
2
|
+
//# sourceMappingURL=activitiesModal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/modal/activitiesModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useMemo, useState } from 'react'\nimport { useCreditsContext } from '../context/provider'\nimport { CreditType, DTC_TASK_TYPE, TaskSubType, TaskType } from '../context/const'\nimport useActivities from '../context/hooks/useActivities'\nimport type { Task } from '../context/response'\nimport { CreditsModalContainer, type ModalContainerProps } from './modalContainer'\nimport { cn } from '../../../helpers/utils'\nimport { Tabs, TabsList, TabsTrigger } from '@anker-in/headless-ui'\nimport LoadingDots from './loadingDots'\nimport { Picture, Text } from '@anker-in/headless-ui'\nimport dayjs from 'dayjs'\n\nexport interface MyActivitiesMetafields {\n title: string\n tips: string\n allTab: string\n earnedTab: string\n deductedTab: string\n expiredTab: string\n activationTask: string\n updateNameTask: string\n updatePhoneTask: string\n updateBirthdayTask: string\n updateAppNameTask: string\n subscriptionTask: string\n refundTask: string\n productUnApprovedTask: string\n pendingTips?: string\n pendingTips2?: string\n firstPurchaseTask: string\n uploadReceiptTask: string\n shoppingTask: string\n emptyListImageUrl: string\n emptyListLabel: string\n}\n\ninterface ActivitiesModalProps extends ModalContainerProps {\n data: MyActivitiesMetafields\n}\n\nfunction ActivitiesModal({ data, ...props }: ActivitiesModalProps) {\n const [page, setPage] = useState(1)\n const { taskIdToTypeMapping } = useCreditsContext()\n\n const myActivitiesOptions = useMemo(() => {\n return {\n page: props.isOpen ? page : 0,\n pageSize: 1000,\n }\n }, [props.isOpen, page])\n\n const [activeTab, setActiveTab] = useState(CreditType.All)\n const tabs = useMemo(() => {\n const tabs = [\n {\n title: data.allTab,\n type: CreditType.All,\n },\n {\n title: data.earnedTab,\n type: CreditType.Earned,\n },\n {\n title: data.deductedTab,\n type: CreditType.Deducted,\n },\n ]\n if (data.expiredTab) {\n tabs.push({\n title: data.expiredTab,\n type: CreditType.Expired,\n })\n }\n return tabs\n }, [data])\n\n const { activities = [], canNext, isLoading } = useActivities(myActivitiesOptions)\n\n const list = useMemo(() => {\n const taskNameMap = {\n [TaskSubType.Activation]: data.activationTask,\n [TaskSubType.UpdateName]: data.updateNameTask,\n [TaskSubType.UpdatePhone]: data.updatePhoneTask,\n [TaskSubType.UpdateBirthday]: data.updateBirthdayTask,\n [TaskSubType.Subscription]: data.subscriptionTask,\n [TaskSubType.UpadteAppName]: data.updateAppNameTask,\n [TaskSubType.Refund]: data.refundTask,\n [TaskSubType.ProductUnApproved]: data.productUnApprovedTask,\n }\n const dtcTaskTypeToNameMap = {\n [DTC_TASK_TYPE.FirstPurchase]: data.firstPurchaseTask,\n [DTC_TASK_TYPE.UploadReceipt]: data.uploadReceiptTask,\n [DTC_TASK_TYPE.Shopping]: data.shoppingTask,\n }\n\n function getTitle(item: Task) {\n if (\n item.task_type === TaskType.Redeem &&\n item.task_sub_type === TaskSubType.ProductUnApproved &&\n data.productUnApprovedTask\n ) {\n // \u65B0\u589E\u7684\u90E8\u5206\u4EFB\u52A1\u90FD\u4F7F\u7528\u4E86 alpc \u540C\u4E00\u4E2A\u4EFB\u52A1\u7C7B\u578B\uFF0C\u9700\u8981\u7528\u4EFB\u52A1 id \u6765\u533A\u5206\n return item.task_name.replace('Refund', data.productUnApprovedTask)\n } else if (taskIdToTypeMapping?.[String(item.task_rule_id)]) {\n return dtcTaskTypeToNameMap[taskIdToTypeMapping?.[String(item.task_rule_id)]]\n } else {\n return taskNameMap[item.task_sub_type] || item.task_name\n }\n }\n\n const all = activities.map(item => ({\n title: getTitle(item),\n date: new Date(item.create_time * 1000),\n value: item.credit,\n type: item.credit_type,\n pending_time: item.pending_time,\n credit_type: item.credit_type,\n status: item.status,\n }))\n\n let filtered = all || []\n if (activeTab === CreditType.Earned) {\n filtered = filtered?.filter(item => item.type === 1)\n } else if (activeTab === CreditType.Deducted) {\n filtered = filtered?.filter(item => item.type === 2 && item.status !== 3)\n } else if (activeTab === CreditType.Expired) {\n filtered = filtered?.filter(item => item.type === 2 && item.status === 3)\n }\n\n return filtered.map(item => {\n let { value, ...otherItem } = item\n if (item.type === CreditType.Deducted && value > 0) {\n value = -value\n }\n\n return {\n value,\n ...otherItem,\n }\n })\n }, [\n data.activationTask,\n data.updateNameTask,\n data.updatePhoneTask,\n data.updateBirthdayTask,\n data.subscriptionTask,\n data.updateAppNameTask,\n data.refundTask,\n data.productUnApprovedTask,\n data.firstPurchaseTask,\n data.uploadReceiptTask,\n data.shoppingTask,\n activities,\n activeTab,\n taskIdToTypeMapping,\n ])\n\n const handleScrollEnd = useCallback(() => {\n if (!canNext) {\n return\n }\n setPage(page + 1)\n }, [page, canNext])\n\n return (\n <CreditsModalContainer\n title={data.title}\n className={cn('h-[800px] w-[640px]')}\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n scrollClassName=\"min-l:px-0 md:mb-0 md:px-0\"\n {...props}\n onScrollEnd={handleScrollEnd}\n >\n <div className=\"w-full overflow-x-auto\">\n <Tabs\n align=\"left\"\n shape=\"rounded\"\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(Number(value))\n }}\n className=\"px-[24px] md:px-[16px]\"\n >\n <TabsList>\n {tabs.map(tab => (\n <TabsTrigger key={tab.type} value={tab.type.toString()}>\n {tab.title}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n </div>\n\n <div className=\"mt-[24px] grid gap-[18px] overflow-auto overscroll-contain px-[24px] md:gap-[12px] md:px-[16px]\">\n {isLoading && (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <LoadingDots />\n </div>\n )}\n {!list.length && !isLoading && (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <Picture className=\"mb-[16px] h-[120px] w-[160px]\" src={data?.emptyListImageUrl}></Picture>\n <div className=\"leading-1.4 text-[16px] font-semibold\">{data?.emptyListLabel}</div>\n </div>\n )}\n {list.map((item, index) => (\n <div\n key={index}\n className=\"flex h-fit items-center justify-between rounded-[8px] bg-[#f2f0f1] px-[16px] py-[20px] text-[16px]\"\n >\n <div className=\"grid gap-[6px]\">\n <div className=\"font-bold\">{item.title}</div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}\n </div>\n {!data.pendingTips && (\n <div\n className={`hidden text-[14px] font-semibold text-[#777] ${item.status === 2 && item.credit_type === 1 ? '!flex' : ''}`}\n >\n <Text html={data.pendingTips} />\n <span>{dayjs.unix(item.pending_time).add(1, 'day').format('YYYY-MM-DD')}</span>\n {data.pendingTips2 && <Text html={data.pendingTips2} />}\n </div>\n )}\n </div>\n <div\n className={cn(\n 'font-bold',\n item.value >= 0 || item.credit_type === CreditType.Expired ? 'text-[#52C41A]' : 'text-[#F84D4F]'\n )}\n >\n {item.value >= 0 && '+'}\n {item.value}\n </div>\n </div>\n ))}\n </div>\n {!!list.length && (\n <div className=\"mt-[12px] px-[24px] pb-[24px] text-[14px] font-semibold text-[#999] md:px-[16px]\">\n {data.tips}\n </div>\n )}\n </CreditsModalContainer>\n )\n}\n\nexport default ActivitiesModal\n"],
|
|
5
|
+
"mappings": "AA0Lc,cAAAA,EAeJ,QAAAC,MAfI,oBA1Ld,OAAS,eAAAC,EAAa,WAAAC,EAAS,YAAAC,MAAgB,QAC/C,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,cAAAC,EAAY,iBAAAC,EAAe,eAAAC,EAAa,YAAAC,MAAgB,mBACjE,OAAOC,MAAmB,iCAE1B,OAAS,yBAAAC,MAAuD,mBAChE,OAAS,MAAAC,MAAU,yBACnB,OAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,MAAmB,wBAC5C,OAAOC,MAAiB,gBACxB,OAAS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AAU,EAAE,GAErH,UAAArC,EAACkB,EAAA,CAAK,KAAMG,EAAK,YAAa,EAC9BrB,EAAC,QAAM,SAAAmB,EAAM,KAAKkB,EAAK,YAAY,EAAE,IAAI,EAAG,KAAK,EAAE,OAAO,YAAY,EAAE,EACvEhB,EAAK,cAAgBrB,EAACkB,EAAA,CAAK,KAAMG,EAAK,aAAc,GACvD,GAEJ,EACApB,EAAC,OACC,UAAWW,EACT,YACAyB,EAAK,OAAS,GAAKA,EAAK,cAAgB/B,EAAW,QAAU,iBAAmB,gBAClF,EAEC,UAAA+B,EAAK,OAAS,GAAK,IACnBA,EAAK,OACR,IA1BKM,CA2BP,CACD,GACH,EACC,CAAC,CAACV,EAAK,QACNjC,EAAC,OAAI,UAAU,mFACZ,SAAAqB,EAAK,KACR,GAEJ,CAEJ,CAEA,IAAOuB,EAAQxB",
|
|
6
|
+
"names": ["jsx", "jsxs", "useCallback", "useMemo", "useState", "useCreditsContext", "CreditType", "DTC_TASK_TYPE", "TaskSubType", "TaskType", "useActivities", "CreditsModalContainer", "cn", "Tabs", "TabsList", "TabsTrigger", "LoadingDots", "Picture", "Text", "dayjs", "ActivitiesModal", "data", "props", "page", "setPage", "taskIdToTypeMapping", "myActivitiesOptions", "activeTab", "setActiveTab", "tabs", "activities", "canNext", "isLoading", "list", "taskNameMap", "dtcTaskTypeToNameMap", "getTitle", "item", "filtered", "value", "otherItem", "handleScrollEnd", "tab", "index", "activitiesModal_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ReceiptCopy = {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
placeholder: string;
|
|
5
|
+
note: string;
|
|
6
|
+
submit: string;
|
|
7
|
+
successTitle: string;
|
|
8
|
+
successDescription: string;
|
|
9
|
+
gotIt: string;
|
|
10
|
+
failedTitle: string;
|
|
11
|
+
successIcon: string;
|
|
12
|
+
failedIcon: string;
|
|
13
|
+
failedReasons: {
|
|
14
|
+
code: string;
|
|
15
|
+
id: string;
|
|
16
|
+
description: string;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
export declare function CreditsUploadReceiptModal({ isOpen, onClose, copy, onSuccess, }: {
|
|
20
|
+
isOpen: boolean;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
copy: ReceiptCopy;
|
|
23
|
+
onSuccess: () => void;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as s,jsxs as h}from"react/jsx-runtime";import{Button as f,Heading as g,Text as l}from"@anker-in/headless-ui";import{useCallback as S,useState as a}from"react";import{CreditsModalContainer as C}from"./modalContainer";import{useUploadReceipt as v}from"../context/hooks/useUploadReceipt";function k({isOpen:N,onClose:o,copy:e,onSuccess:r}){const{trigger:c,isMutating:b}=v(),[n,d]=a(""),[p,m]=a(!1),[t,u]=a({icon:"",title:"",description:"",isSuccess:!1}),R=S(()=>{c({orderName:n},{onSuccess:i=>{if(m(!0),i?.ok)r(),u({icon:e.successIcon,title:e.successTitle||"Success",description:e.successDescription||"Your receipt has been uploaded successfully",isSuccess:!0});else{const T=e.failedReasons.find(D=>D.code===i.code?.toString());u({icon:e.failedIcon,title:e.failedTitle||"Failed",description:T?.description||"Please try again",isSuccess:!1})}}})},[c,n,r,e.successIcon,e.successTitle,e.successDescription,e.failedReasons,e.failedIcon,e.failedTitle]),x=()=>{m(!1),d(""),t.isSuccess&&o()};return h(C,{isOpen:N,onClose:o,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-[48px] md:mb-0 md:pb-[24px] md:px-[16px]",titleClassName:"h-[56px]",useAnimation:!0,animationClassName:"md:translate-y-[100vh]",children:[s(g,{size:"3",children:e.title}),s(l,{size:"3",className:"mt-[8px] md:mt-[4px]",children:e.description}),s("input",{placeholder:e.placeholder,className:"mt-[24px] h-[50px] w-full rounded-[2px] border border-[#6D6D6F] pl-[14px] text-[16px] font-bold placeholder:text-[16px] placeholder:font-bold placeholder:text-[#6D6D6F] focus:outline-none focus:ring-0 md:rounded-[4px] md:placeholder:text-[14px]",value:n,onChange:i=>d(i.target.value)}),s(l,{size:"1",as:"p",className:"mt-[8px] text-[#6D6D6F]",children:e.note}),s(f,{variant:"primary",className:"mt-[24px] w-full",loading:b,onClick:R,children:e.submit}),p&&h(C,{isOpen:p,onClose:x,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-[48px] md:mb-0 md:pb-[24px] md:px-[16px] flex flex-col items-center text-center",titleClassName:"h-[56px]",children:[s(l,{size:"3",className:"size-[64px]",as:"div",html:t.icon}),s(g,{size:"3",className:"mt-[16px]",children:t.title}),s(l,{size:"3",className:"mt-[8px] md:mt-[4px]",children:t.description}),s(f,{variant:"primary",className:"mt-[24px]",onClick:x,children:e.gotIt})]})]})}export{k as CreditsUploadReceiptModal};
|
|
2
|
+
//# sourceMappingURL=creditsUploadReceiptModal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/modal/creditsUploadReceiptModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Button, Heading, Text } from '@anker-in/headless-ui'\nimport { useCallback, useState } from 'react'\nimport { CreditsModalContainer } from './modalContainer'\nimport { useUploadReceipt } from '../context/hooks/useUploadReceipt'\n\nexport type ReceiptCopy = {\n title: string\n description: string\n placeholder: string\n note: string\n submit: string\n successTitle: string\n successDescription: string\n gotIt: string\n failedTitle: string\n successIcon: string\n failedIcon: string\n failedReasons: {\n code: string\n id: string\n description: string\n }[]\n}\n\nexport function CreditsUploadReceiptModal({\n isOpen,\n onClose,\n copy,\n onSuccess,\n}: {\n isOpen: boolean\n onClose: () => void\n copy: ReceiptCopy\n onSuccess: () => void\n}) {\n const { trigger, isMutating } = useUploadReceipt()\n const [orderName, setOrderName] = useState('')\n const [resultPopup, setResultPopup] = useState(false)\n const [resultPopupContent, setResultPopupContent] = useState({\n icon: '',\n title: '',\n description: '',\n isSuccess: false,\n })\n\n const handleSubmit = useCallback(() => {\n trigger(\n { orderName },\n {\n onSuccess: result => {\n setResultPopup(true)\n if (result?.ok) {\n onSuccess()\n setResultPopupContent({\n icon: copy.successIcon,\n title: copy.successTitle || 'Success',\n description: copy.successDescription || 'Your receipt has been uploaded successfully',\n isSuccess: true,\n })\n } else {\n const error = copy.failedReasons.find(reason => reason.code === result.code?.toString())\n setResultPopupContent({\n icon: copy.failedIcon,\n title: copy.failedTitle || 'Failed',\n description: error?.description || 'Please try again',\n isSuccess: false,\n })\n }\n },\n }\n )\n }, [\n trigger,\n orderName,\n onSuccess,\n copy.successIcon,\n copy.successTitle,\n copy.successDescription,\n copy.failedReasons,\n copy.failedIcon,\n copy.failedTitle,\n ])\n\n const handleResultClose = () => {\n setResultPopup(false)\n setOrderName('')\n // \u5982\u679C\u4E0A\u4F20\u6210\u529F\uFF0C\u5168\u90E8\u5F39\u7A97\u5173\u95ED\n if (resultPopupContent.isSuccess) {\n onClose()\n }\n }\n\n return (\n <CreditsModalContainer\n isOpen={isOpen}\n onClose={onClose}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-[48px] md:mb-0 md:pb-[24px] md:px-[16px]\"\n titleClassName=\"h-[56px]\"\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n >\n <Heading size=\"3\">{copy.title}</Heading>\n <Text size=\"3\" className=\"mt-[8px] md:mt-[4px]\">\n {copy.description}\n </Text>\n <input\n placeholder={copy.placeholder}\n className=\"mt-[24px] h-[50px] w-full rounded-[2px] border border-[#6D6D6F] pl-[14px] text-[16px] font-bold placeholder:text-[16px] placeholder:font-bold placeholder:text-[#6D6D6F] focus:outline-none focus:ring-0 md:rounded-[4px] md:placeholder:text-[14px]\"\n value={orderName}\n onChange={e => setOrderName(e.target.value)}\n />\n <Text size=\"1\" as=\"p\" className=\"mt-[8px] text-[#6D6D6F]\">\n {copy.note}\n </Text>\n <Button variant=\"primary\" className=\"mt-[24px] w-full\" loading={isMutating} onClick={handleSubmit}>\n {copy.submit}\n </Button>\n {resultPopup && (\n <CreditsModalContainer\n isOpen={resultPopup}\n onClose={handleResultClose}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-[48px] md:mb-0 md:pb-[24px] md:px-[16px] flex flex-col items-center text-center\"\n titleClassName=\"h-[56px]\"\n >\n <Text size=\"3\" className=\"size-[64px]\" as=\"div\" html={resultPopupContent.icon} />\n <Heading size=\"3\" className=\"mt-[16px]\">\n {resultPopupContent.title}\n </Heading>\n <Text size=\"3\" className=\"mt-[8px] md:mt-[4px]\">\n {resultPopupContent.description}\n </Text>\n <Button variant=\"primary\" className=\"mt-[24px]\" onClick={handleResultClose}>\n {copy.gotIt}\n </Button>\n </CreditsModalContainer>\n )}\n </CreditsModalContainer>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAsGM,cAAAA,EAiBE,QAAAC,MAjBF,oBAtGN,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAS,eAAAC,EAAa,YAAAC,MAAgB,QACtC,OAAS,yBAAAC,MAA6B,mBACtC,OAAS,oBAAAC,MAAwB,oCAqB1B,SAASC,EAA0B,CACxC,OAAAC,EACA,QAAAC,EACA,KAAAC,EACA,UAAAC,CACF,EAKG,CACD,KAAM,CAAE,QAAAC,EAAS,WAAAC,CAAW,EAAIP,EAAiB,EAC3C,CAACQ,EAAWC,CAAY,EAAIX,EAAS,EAAE,EACvC,CAACY,EAAaC,CAAc,EAAIb,EAAS,EAAK,EAC9C,CAACc,EAAoBC,CAAqB,EAAIf,EAAS,CAC3D,KAAM,GACN,MAAO,GACP,YAAa,GACb,UAAW,EACb,CAAC,EAEKgB,EAAejB,EAAY,IAAM,CACrCS,EACE,CAAE,UAAAE,CAAU,EACZ,CACE,UAAWO,GAAU,CAEnB,GADAJ,EAAe,EAAI,EACfI,GAAQ,GACVV,EAAU,EACVQ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AAmB,KAAM,EAC/EpB,EAACG,EAAA,CAAQ,KAAK,IAAI,UAAU,YACzB,SAAAiB,EAAmB,MACtB,EACApB,EAACI,EAAA,CAAK,KAAK,IAAI,UAAU,uBACtB,SAAAgB,EAAmB,YACtB,EACApB,EAACE,EAAA,CAAO,QAAQ,UAAU,UAAU,YAAY,QAASwB,EACtD,SAAAd,EAAK,MACR,GACF,GAEJ,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Button", "Heading", "Text", "useCallback", "useState", "CreditsModalContainer", "useUploadReceipt", "CreditsUploadReceiptModal", "isOpen", "onClose", "copy", "onSuccess", "trigger", "isMutating", "orderName", "setOrderName", "resultPopup", "setResultPopup", "resultPopupContent", "setResultPopupContent", "handleSubmit", "result", "error", "reason", "handleResultClose", "e"]
|
|
7
|
+
}
|