@anker-in/campaign-ui 0.5.10 → 0.5.12
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/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/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/provider.d.ts +2 -1
- package/dist/cjs/components/credits/context/provider.js +1 -1
- package/dist/cjs/components/credits/context/provider.js.map +3 -3
- package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +32 -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.js +2 -0
- package/dist/cjs/components/credits/modal/activitiesModal.js.map +7 -0
- package/dist/cjs/helpers/fetchResponse.d.ts +14 -0
- package/dist/cjs/helpers/fetchResponse.js +2 -0
- package/dist/cjs/helpers/fetchResponse.js.map +7 -0
- package/dist/cjs/helpers/fetcher.d.ts +2 -0
- package/dist/cjs/helpers/fetcher.js +2 -0
- package/dist/cjs/helpers/fetcher.js.map +7 -0
- package/dist/cjs/helpers/index.d.ts +2 -0
- package/dist/cjs/helpers/index.js +2 -0
- package/dist/cjs/helpers/index.js.map +7 -0
- 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/helpers/utils.d.ts +3 -0
- package/dist/cjs/helpers/utils.js +2 -0
- package/dist/cjs/helpers/utils.js.map +7 -0
- package/dist/cjs/index.css +2 -0
- package/dist/cjs/index.css.map +7 -0
- 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/templates/Credits.types.d.ts +1 -0
- package/dist/cjs/templates/Credits.types.js.map +1 -1
- package/dist/cjs/templates/{Credits.js → credits.js} +1 -1
- package/dist/cjs/templates/{Credits.js.map → credits.js.map} +2 -2
- package/dist/cjs/tsconfig.tsbuildinfo +1 -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/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/provider.d.ts +2 -1
- package/dist/esm/components/credits/context/provider.js +1 -1
- package/dist/esm/components/credits/context/provider.js.map +3 -3
- package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +32 -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.js +2 -0
- package/dist/esm/components/credits/modal/activitiesModal.js.map +7 -0
- package/dist/esm/helpers/fetchResponse.d.ts +14 -0
- package/dist/esm/helpers/fetchResponse.js +2 -0
- package/dist/esm/helpers/fetchResponse.js.map +7 -0
- package/dist/esm/helpers/fetcher.d.ts +2 -0
- package/dist/esm/helpers/fetcher.js +2 -0
- package/dist/esm/helpers/fetcher.js.map +7 -0
- package/dist/esm/helpers/index.d.ts +2 -0
- package/dist/esm/helpers/index.js +2 -0
- package/dist/esm/helpers/index.js.map +7 -0
- 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/helpers/utils.d.ts +3 -0
- package/dist/esm/helpers/utils.js +2 -0
- package/dist/esm/helpers/utils.js.map +7 -0
- package/dist/esm/index.css +2 -0
- package/dist/esm/index.css.map +7 -0
- 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/templates/Credits.types.d.ts +1 -0
- package/dist/esm/templates/Credits.types.js.map +1 -1
- package/dist/esm/templates/credits.js +2 -0
- package/dist/esm/templates/{Credits.js.map → credits.js.map} +2 -2
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/package.json +19 -19
- package/src/components/credits/context/provider.tsx +4 -0
- package/src/components/credits/modal/ActivitiesModal.tsx +6 -1
- package/src/templates/Credits.tsx +1 -0
- package/src/templates/Credits.types.ts +1 -0
- package/dist/cjs/components/credits/modal/ActivitiesModal.js +0 -2
- package/dist/cjs/components/credits/modal/ActivitiesModal.js.map +0 -7
- package/dist/esm/components/credits/modal/ActivitiesModal.js +0 -2
- package/dist/esm/components/credits/modal/ActivitiesModal.js.map +0 -7
- package/dist/esm/templates/Credits.js +0 -2
- /package/dist/cjs/components/credits/creditsBenefits/{BenefitItem.d.ts → benefitItem.d.ts} +0 -0
- /package/dist/cjs/components/credits/creditsBenefits/{BenefitItem.js → benefitItem.js} +0 -0
- /package/dist/cjs/components/credits/creditsBenefits/{BenefitItem.js.map → benefitItem.js.map} +0 -0
- /package/dist/cjs/components/credits/creditsBenefits/{IconInfo.d.ts → iconInfo.d.ts} +0 -0
- /package/dist/cjs/components/credits/creditsBenefits/{IconInfo.js → iconInfo.js} +0 -0
- /package/dist/cjs/components/credits/creditsBenefits/{IconInfo.js.map → iconInfo.js.map} +0 -0
- /package/dist/cjs/components/credits/modal/{ActivitiesModal.d.ts → activitiesModal.d.ts} +0 -0
- /package/dist/cjs/components/credits/modal/{CreditsUploadReceiptModal.d.ts → creditsUploadReceiptModal.d.ts} +0 -0
- /package/dist/cjs/components/credits/modal/{CreditsUploadReceiptModal.js → creditsUploadReceiptModal.js} +0 -0
- /package/dist/cjs/components/credits/modal/{CreditsUploadReceiptModal.js.map → creditsUploadReceiptModal.js.map} +0 -0
- /package/dist/cjs/components/credits/modal/{LoadingDots.d.ts → loadingDots.d.ts} +0 -0
- /package/dist/cjs/components/credits/modal/{LoadingDots.js → loadingDots.js} +0 -0
- /package/dist/cjs/components/credits/modal/{LoadingDots.js.map → loadingDots.js.map} +0 -0
- /package/dist/cjs/components/credits/modal/{ModalContainer.d.ts → modalContainer.d.ts} +0 -0
- /package/dist/cjs/components/credits/modal/{ModalContainer.js → modalContainer.js} +0 -0
- /package/dist/cjs/components/credits/modal/{ModalContainer.js.map → modalContainer.js.map} +0 -0
- /package/dist/cjs/components/credits/modal/{RulesModal.d.ts → rulesModal.d.ts} +0 -0
- /package/dist/cjs/components/credits/modal/{RulesModal.js → rulesModal.js} +0 -0
- /package/dist/cjs/components/credits/modal/{RulesModal.js.map → rulesModal.js.map} +0 -0
- /package/dist/cjs/components/credits/modal/{SubscribeModal.d.ts → subscribeModal.d.ts} +0 -0
- /package/dist/cjs/components/credits/modal/{SubscribeModal.js → subscribeModal.js} +0 -0
- /package/dist/cjs/components/credits/modal/{SubscribeModal.js.map → subscribeModal.js.map} +0 -0
- /package/dist/cjs/components/credits/modal/{Tip.d.ts → tip.d.ts} +0 -0
- /package/dist/cjs/components/credits/modal/{Tip.js → tip.js} +0 -0
- /package/dist/cjs/components/credits/modal/{Tip.js.map → tip.js.map} +0 -0
- /package/dist/cjs/templates/{Credits.d.ts → credits.d.ts} +0 -0
- /package/dist/esm/components/credits/creditsBenefits/{BenefitItem.d.ts → benefitItem.d.ts} +0 -0
- /package/dist/esm/components/credits/creditsBenefits/{BenefitItem.js → benefitItem.js} +0 -0
- /package/dist/esm/components/credits/creditsBenefits/{BenefitItem.js.map → benefitItem.js.map} +0 -0
- /package/dist/esm/components/credits/creditsBenefits/{IconInfo.d.ts → iconInfo.d.ts} +0 -0
- /package/dist/esm/components/credits/creditsBenefits/{IconInfo.js → iconInfo.js} +0 -0
- /package/dist/esm/components/credits/creditsBenefits/{IconInfo.js.map → iconInfo.js.map} +0 -0
- /package/dist/esm/components/credits/modal/{ActivitiesModal.d.ts → activitiesModal.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{CreditsUploadReceiptModal.d.ts → creditsUploadReceiptModal.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{CreditsUploadReceiptModal.js → creditsUploadReceiptModal.js} +0 -0
- /package/dist/esm/components/credits/modal/{CreditsUploadReceiptModal.js.map → creditsUploadReceiptModal.js.map} +0 -0
- /package/dist/esm/components/credits/modal/{LoadingDots.d.ts → loadingDots.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{LoadingDots.js → loadingDots.js} +0 -0
- /package/dist/esm/components/credits/modal/{LoadingDots.js.map → loadingDots.js.map} +0 -0
- /package/dist/esm/components/credits/modal/{ModalContainer.d.ts → modalContainer.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{ModalContainer.js → modalContainer.js} +0 -0
- /package/dist/esm/components/credits/modal/{ModalContainer.js.map → modalContainer.js.map} +0 -0
- /package/dist/esm/components/credits/modal/{RulesModal.d.ts → rulesModal.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{RulesModal.js → rulesModal.js} +0 -0
- /package/dist/esm/components/credits/modal/{RulesModal.js.map → rulesModal.js.map} +0 -0
- /package/dist/esm/components/credits/modal/{SubscribeModal.d.ts → subscribeModal.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{SubscribeModal.js → subscribeModal.js} +0 -0
- /package/dist/esm/components/credits/modal/{SubscribeModal.js.map → subscribeModal.js.map} +0 -0
- /package/dist/esm/components/credits/modal/{Tip.d.ts → tip.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{Tip.js → tip.js} +0 -0
- /package/dist/esm/components/credits/modal/{Tip.js.map → tip.js.map} +0 -0
- /package/dist/esm/templates/{Credits.d.ts → credits.d.ts} +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Media, Product as ShopifyProduct } from '../gql';
|
|
2
|
+
import { SearchHook } from './search';
|
|
3
|
+
export type ProductImage = {
|
|
4
|
+
url: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
};
|
|
7
|
+
export type ProductPrice = {
|
|
8
|
+
value: number;
|
|
9
|
+
currencyCode?: 'USD' | 'EUR' | 'ARS' | string;
|
|
10
|
+
retailPrice?: number;
|
|
11
|
+
salePrice?: number;
|
|
12
|
+
listPrice?: number;
|
|
13
|
+
extendedSalePrice?: number;
|
|
14
|
+
extendedListPrice?: number;
|
|
15
|
+
};
|
|
16
|
+
export type ProductOption = {
|
|
17
|
+
__typename?: 'ProductOption';
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
values: ProductOptionValues[];
|
|
21
|
+
};
|
|
22
|
+
export type ProductOptionValues = {
|
|
23
|
+
label: string;
|
|
24
|
+
hexColors?: string[];
|
|
25
|
+
};
|
|
26
|
+
export type ProductVariant = {
|
|
27
|
+
id: string | number;
|
|
28
|
+
options: ProductOption[];
|
|
29
|
+
availableForSale?: boolean;
|
|
30
|
+
quantityAvailable: number;
|
|
31
|
+
metafields?: Record<string, any>;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
34
|
+
type NormalizedProduct = {
|
|
35
|
+
id: string;
|
|
36
|
+
description: string;
|
|
37
|
+
descriptionHtml?: string;
|
|
38
|
+
productType?: string;
|
|
39
|
+
sku?: string;
|
|
40
|
+
slug?: string;
|
|
41
|
+
handle?: string;
|
|
42
|
+
path?: string;
|
|
43
|
+
images: ProductImage[];
|
|
44
|
+
media: ProductMedia[];
|
|
45
|
+
variants: ProductVariant[];
|
|
46
|
+
price: ProductPrice;
|
|
47
|
+
listPrice?: number;
|
|
48
|
+
options: ProductOption[];
|
|
49
|
+
preRender?: string;
|
|
50
|
+
seo?: any;
|
|
51
|
+
metafields?: {
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type Product = Omit<ShopifyProduct, keyof NormalizedProduct> & NormalizedProduct;
|
|
56
|
+
export type GetProductBody = {
|
|
57
|
+
handles: string;
|
|
58
|
+
locale?: string;
|
|
59
|
+
};
|
|
60
|
+
export type ProductTypes = {
|
|
61
|
+
product: Product;
|
|
62
|
+
getBody: GetProductBody;
|
|
63
|
+
};
|
|
64
|
+
export type GetProductHook<T extends ProductTypes = ProductTypes> = {
|
|
65
|
+
data: {
|
|
66
|
+
products: (T['product'] | {})[] | [];
|
|
67
|
+
};
|
|
68
|
+
body: T['getBody'];
|
|
69
|
+
input: T['getBody'];
|
|
70
|
+
fetcherInput: T['getBody'];
|
|
71
|
+
};
|
|
72
|
+
export type ProductsSchema<T extends ProductTypes = ProductTypes> = {
|
|
73
|
+
endpoint: {
|
|
74
|
+
options: {};
|
|
75
|
+
handlers: {
|
|
76
|
+
getProducts: SearchHook;
|
|
77
|
+
getProduct: GetProductHook<T>;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export type GetAllProductPathsOperation<T extends ProductTypes = ProductTypes> = {
|
|
82
|
+
data: {
|
|
83
|
+
products: Pick<T['product'], 'path'>[];
|
|
84
|
+
};
|
|
85
|
+
variables: {
|
|
86
|
+
first?: number;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export type GetAllProductsOperation<T extends ProductTypes = ProductTypes> = {
|
|
90
|
+
data: {
|
|
91
|
+
products: T['product'][];
|
|
92
|
+
};
|
|
93
|
+
variables: {
|
|
94
|
+
relevance?: 'featured' | 'best_selling' | 'newest';
|
|
95
|
+
ids?: string[];
|
|
96
|
+
first?: number;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
export type GetProductOperation<T extends ProductTypes = ProductTypes> = {
|
|
100
|
+
data: {
|
|
101
|
+
product?: T['product'];
|
|
102
|
+
};
|
|
103
|
+
variables: {
|
|
104
|
+
path: string;
|
|
105
|
+
slug?: never;
|
|
106
|
+
} | {
|
|
107
|
+
path?: never;
|
|
108
|
+
slug: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export type Options = Record<string, string>;
|
|
112
|
+
export type ProductCoupon = {
|
|
113
|
+
sku: string;
|
|
114
|
+
variant_shopify_id: number;
|
|
115
|
+
variant_price: string;
|
|
116
|
+
handle: string;
|
|
117
|
+
product_type: string;
|
|
118
|
+
product_title: string;
|
|
119
|
+
product_shopify_id: number;
|
|
120
|
+
title: string;
|
|
121
|
+
starts_at: string;
|
|
122
|
+
ends_at?: string;
|
|
123
|
+
value_type: string;
|
|
124
|
+
value: string;
|
|
125
|
+
shopify_domain: string;
|
|
126
|
+
currency: string;
|
|
127
|
+
custom_domain: string;
|
|
128
|
+
shop_discount_threshold_value: number;
|
|
129
|
+
fixed_value: string;
|
|
130
|
+
value_style: string;
|
|
131
|
+
variant_price4wscode: number;
|
|
132
|
+
variant_image: string;
|
|
133
|
+
currency_symbol: string;
|
|
134
|
+
fixed_amount_sort_key: number;
|
|
135
|
+
percentage_sort_key: number;
|
|
136
|
+
variant_url: string;
|
|
137
|
+
variant_metafields: any[];
|
|
138
|
+
product_tags: string;
|
|
139
|
+
product_metafields: any[];
|
|
140
|
+
available_for_sale: boolean;
|
|
141
|
+
shopify_created_at: string;
|
|
142
|
+
shopify_updated_at: string;
|
|
143
|
+
timezone: string;
|
|
144
|
+
starts_at_with_timezone: string;
|
|
145
|
+
ends_at_with_timezone?: string;
|
|
146
|
+
amazon_deal: boolean;
|
|
147
|
+
};
|
|
148
|
+
export type VariantCoupon = {
|
|
149
|
+
title: string;
|
|
150
|
+
starts_at: string;
|
|
151
|
+
ends_at: string | null;
|
|
152
|
+
variant_shopify_id: number;
|
|
153
|
+
value_type: 'percentage' | 'fixed' | 'fixed_amount' | 'fix_discount_amount';
|
|
154
|
+
value: string;
|
|
155
|
+
currency: string;
|
|
156
|
+
fixed_value: string;
|
|
157
|
+
value_style: string;
|
|
158
|
+
variant_price4wscode: number;
|
|
159
|
+
discount_type: string;
|
|
160
|
+
amazon_deal: boolean;
|
|
161
|
+
cdi_id: number;
|
|
162
|
+
cdi_updated_at: string;
|
|
163
|
+
};
|
|
164
|
+
export type ProductMedia = Media & {
|
|
165
|
+
sources?: {
|
|
166
|
+
url: string;
|
|
167
|
+
altText: string;
|
|
168
|
+
}[];
|
|
169
|
+
image?: {
|
|
170
|
+
url: string;
|
|
171
|
+
altText: string;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ProductTypes } from './product';
|
|
2
|
+
import type { PageTypes } from './page';
|
|
3
|
+
export type SearchBody = {
|
|
4
|
+
first?: number;
|
|
5
|
+
after?: string;
|
|
6
|
+
before?: string;
|
|
7
|
+
reverse?: boolean;
|
|
8
|
+
sort?: string;
|
|
9
|
+
sku?: string;
|
|
10
|
+
query?: string;
|
|
11
|
+
search?: string;
|
|
12
|
+
sortKey?: string;
|
|
13
|
+
filters?: any;
|
|
14
|
+
productFilters?: any;
|
|
15
|
+
categoryId?: string | number;
|
|
16
|
+
brandId?: string | number;
|
|
17
|
+
termSearch?: string;
|
|
18
|
+
types?: string[];
|
|
19
|
+
};
|
|
20
|
+
export type SearchProductsInput = {
|
|
21
|
+
after?: string;
|
|
22
|
+
before?: string;
|
|
23
|
+
sortKey?: string;
|
|
24
|
+
locale?: string;
|
|
25
|
+
first?: number;
|
|
26
|
+
last?: number;
|
|
27
|
+
types?: string[];
|
|
28
|
+
filters?: any;
|
|
29
|
+
productFilters?: any;
|
|
30
|
+
reverse?: boolean;
|
|
31
|
+
searchTerm?: string;
|
|
32
|
+
};
|
|
33
|
+
export type ShopifySearchOperation = {
|
|
34
|
+
data: {
|
|
35
|
+
products: ProductTypes['product'][];
|
|
36
|
+
found: boolean;
|
|
37
|
+
} | {
|
|
38
|
+
pages: PageTypes['page'][];
|
|
39
|
+
products: ProductTypes['product'][];
|
|
40
|
+
};
|
|
41
|
+
variables: SearchBody;
|
|
42
|
+
};
|
|
43
|
+
export type SearchHook = {
|
|
44
|
+
data: {
|
|
45
|
+
products: ProductTypes['product'][];
|
|
46
|
+
found: boolean;
|
|
47
|
+
} | {
|
|
48
|
+
pages: PageTypes['page'][];
|
|
49
|
+
products: ProductTypes['product'][];
|
|
50
|
+
};
|
|
51
|
+
body: SearchBody;
|
|
52
|
+
input: SearchBody;
|
|
53
|
+
fetcherInput: SearchBody;
|
|
54
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Category } from './collection';
|
|
2
|
+
export type Brand = any;
|
|
3
|
+
export type Policy = {
|
|
4
|
+
handle: string;
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
body?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
};
|
|
10
|
+
export type Shop = {
|
|
11
|
+
name: string;
|
|
12
|
+
privacyPolicy: Policy;
|
|
13
|
+
refundPolicy: Policy;
|
|
14
|
+
shippingPolicy: Policy;
|
|
15
|
+
termsOfService: Policy;
|
|
16
|
+
subscriptionPolicy: Policy;
|
|
17
|
+
};
|
|
18
|
+
export type SiteTypes = {
|
|
19
|
+
shop: Shop;
|
|
20
|
+
category: Category;
|
|
21
|
+
brand: Brand;
|
|
22
|
+
};
|
|
23
|
+
export type GetSiteInfoOperation<T extends SiteTypes = SiteTypes> = {
|
|
24
|
+
data: {
|
|
25
|
+
shop: Shop;
|
|
26
|
+
categories: T['category'][];
|
|
27
|
+
brands: T['brand'][];
|
|
28
|
+
shopName?: string;
|
|
29
|
+
metafields?: {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare enum CartDataSource {
|
|
2
|
+
Storefront = "storefront",
|
|
3
|
+
Theme = "theme"
|
|
4
|
+
}
|
|
5
|
+
export declare const REVALIDATE_TIME: number;
|
|
6
|
+
export declare const SOLD_OUT_PRICE = 9999999.99;
|
|
7
|
+
export declare enum TemplateType {
|
|
8
|
+
Page = "page",
|
|
9
|
+
Product = "product",
|
|
10
|
+
Collection = "collection",
|
|
11
|
+
Blog = "blog",
|
|
12
|
+
Article = "article"
|
|
13
|
+
}
|
|
14
|
+
export declare enum DiscountType {
|
|
15
|
+
fixedAmount = "fixed_amount",
|
|
16
|
+
percentage = "percentage"
|
|
17
|
+
}
|
|
18
|
+
export declare const createConstants: (config: {
|
|
19
|
+
env: string;
|
|
20
|
+
brand: string;
|
|
21
|
+
locales: string[];
|
|
22
|
+
googleClientId?: string;
|
|
23
|
+
facebookAppId?: string;
|
|
24
|
+
applicationName?: string;
|
|
25
|
+
}) => {
|
|
26
|
+
locales: string[];
|
|
27
|
+
env: string;
|
|
28
|
+
applicationName: any;
|
|
29
|
+
host: string;
|
|
30
|
+
brand: string;
|
|
31
|
+
googleClientId: string | undefined;
|
|
32
|
+
facebookAppId: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
export declare const COLOR_LABEL: string[];
|
|
35
|
+
export declare enum CouponChannel {
|
|
36
|
+
LIGHTNING_DEAL = "LIGHTNING_DEAL",
|
|
37
|
+
DEAL = "LIGHTNING_DEAL",
|
|
38
|
+
COUPON = "COUPON",
|
|
39
|
+
PED = "PED",
|
|
40
|
+
WS24 = "WS24",
|
|
41
|
+
WSTD = "WSTD",
|
|
42
|
+
WSCH = "WSCH"
|
|
43
|
+
}
|
|
44
|
+
export declare const PRICE_SYMBOL: {
|
|
45
|
+
us: string;
|
|
46
|
+
uk: string;
|
|
47
|
+
ca: string;
|
|
48
|
+
eu: string;
|
|
49
|
+
pl: string;
|
|
50
|
+
fr: string;
|
|
51
|
+
de: string;
|
|
52
|
+
vn: string;
|
|
53
|
+
cl: string;
|
|
54
|
+
sg: string;
|
|
55
|
+
ae: string;
|
|
56
|
+
es: string;
|
|
57
|
+
};
|
|
58
|
+
export declare const CURRENCY_CODE: {
|
|
59
|
+
us: string;
|
|
60
|
+
uk: string;
|
|
61
|
+
ca: string;
|
|
62
|
+
eu: string;
|
|
63
|
+
pl: string;
|
|
64
|
+
fr: string;
|
|
65
|
+
de: string;
|
|
66
|
+
vn: string;
|
|
67
|
+
cl: string;
|
|
68
|
+
es: string;
|
|
69
|
+
};
|
|
70
|
+
export declare const COUNTRY_CODE: Record<string, string>;
|
|
71
|
+
export declare const LANGUAGE_CODE: Record<string, string>;
|
|
72
|
+
export declare const CUSTOMER_ATTRIBUTE_KEY = "_discounts_function_env";
|
|
73
|
+
export declare const CUSTOMER_SCRIPT_GIFT_KEY = "_giveaway_gradient_gifts";
|
|
74
|
+
export declare const CODE_AMOUNT_KEY = "_sku_code_money";
|
|
75
|
+
export declare const SCRIPT_CODE_AMOUNT_KEY = "_code_money";
|
|
76
|
+
export declare const MAIN_PRODUCT_CODE: string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ShopifyConfig, SiteConfig } from '../types/config';
|
|
2
|
+
export declare const SHOPIFY_COOKIE_EXPIRE = 30;
|
|
3
|
+
export declare const SHOPIFY_CART_COOKIE_EXPIRE = 14;
|
|
4
|
+
export declare const getCookieName: (type: string, domain: string, locale: string) => string;
|
|
5
|
+
export declare const getCartIdCookieName: ({ shopifyConfig, siteConfig, withLocale, }: {
|
|
6
|
+
shopifyConfig: ShopifyConfig;
|
|
7
|
+
siteConfig: SiteConfig;
|
|
8
|
+
withLocale?: boolean;
|
|
9
|
+
}) => string;
|
|
10
|
+
export declare const createCartCookieOptions: () => {
|
|
11
|
+
domain: string;
|
|
12
|
+
expires: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const setCartCookies: (name: string, value: string) => void;
|
|
15
|
+
export declare const removeCartCookies: (name: string) => void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type ErrorData = {
|
|
2
|
+
message: string;
|
|
3
|
+
code?: string;
|
|
4
|
+
};
|
|
5
|
+
export type ErrorProps = {
|
|
6
|
+
code?: string;
|
|
7
|
+
} & ({
|
|
8
|
+
message: string;
|
|
9
|
+
errors?: never;
|
|
10
|
+
} | {
|
|
11
|
+
message?: never;
|
|
12
|
+
errors: ErrorData[];
|
|
13
|
+
});
|
|
14
|
+
export declare class CommerceError extends Error {
|
|
15
|
+
code?: string;
|
|
16
|
+
errors: ErrorData[];
|
|
17
|
+
constructor({ message, code, errors }: ErrorProps);
|
|
18
|
+
}
|
|
19
|
+
export declare class ValidationError extends CommerceError {
|
|
20
|
+
constructor(options: ErrorProps);
|
|
21
|
+
}
|
|
22
|
+
export declare class CommerceFetcherError extends CommerceError {
|
|
23
|
+
status: number;
|
|
24
|
+
constructor(options: {
|
|
25
|
+
status: number;
|
|
26
|
+
} & ErrorProps);
|
|
27
|
+
}
|
|
28
|
+
export declare class FetcherError extends Error {
|
|
29
|
+
status: number;
|
|
30
|
+
errors: string[];
|
|
31
|
+
errorCode: string;
|
|
32
|
+
constructor(options: {
|
|
33
|
+
status: number;
|
|
34
|
+
errors?: string[];
|
|
35
|
+
message?: string;
|
|
36
|
+
errorCode?: string;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ShopifyConfig } from '../types/config';
|
|
2
|
+
/**
|
|
3
|
+
* Graphql Api 接口 fetch 方法
|
|
4
|
+
* @param query: 查询语句
|
|
5
|
+
* @param variables: 查询参数
|
|
6
|
+
* @param config: 店铺配置
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function fetchGraphqlApi<Data, Variables = undefined>({ query, variables, fetchOptions, headers, config, }: {
|
|
10
|
+
query: string;
|
|
11
|
+
variables?: Variables;
|
|
12
|
+
headers?: Record<string, any>;
|
|
13
|
+
fetchOptions?: Omit<RequestInit, 'headers' | 'method' | 'body'>;
|
|
14
|
+
config: ShopifyConfig;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
status: number;
|
|
17
|
+
data: Data;
|
|
18
|
+
errors?: any;
|
|
19
|
+
} | never>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CommerceFetcherError, FetcherError } from './errors';
|
|
2
|
+
export declare function getCommerceError(errors: any[] | null, status?: number): CommerceFetcherError;
|
|
3
|
+
export declare function getFetcherError(error: string | string[], statusCode: any, errorCode: any): Promise<FetcherError>;
|
|
4
|
+
export declare function getAsyncError(res: Response, responseData: any): Promise<FetcherError>;
|
|
5
|
+
export declare const handleFetchResponse: (res: Response) => Promise<any>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HasMetafieldsIdentifier } from '../gql';
|
|
2
|
+
import { HasMetafieldQueryRoot } from '../types/fetcher';
|
|
3
|
+
import { PartialRecord } from '../utils/type-helper';
|
|
4
|
+
import { ProductVariant } from '../types/product';
|
|
5
|
+
export declare function isObjEmpty(obj?: Record<string, any>): boolean;
|
|
6
|
+
export declare function atobID(id: string): string | undefined;
|
|
7
|
+
export declare function btoaID(id: string, type?: 'ProductVariant' | 'Product'): string;
|
|
8
|
+
export declare const getThemeLocale: (locale: string) => string;
|
|
9
|
+
/**
|
|
10
|
+
* 生成 metafieldIdentifiers 查询参数
|
|
11
|
+
* {
|
|
12
|
+
* product: { namespace: 'product', key: 'img' },
|
|
13
|
+
* variant: { namespace: 'variant', key: 'img' }
|
|
14
|
+
* }
|
|
15
|
+
* =>
|
|
16
|
+
* {
|
|
17
|
+
* productMetafieldIdentifiers: [{ namespace: 'combo', key: 'product' }]
|
|
18
|
+
* variantMetafieldIdentifiers: [{ namespace: 'combo', key: 'variant' }]
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export declare function constructMetafieldIdentifiersQueryParams<T extends HasMetafieldQueryRoot>(metafieldIdentifiers?: PartialRecord<T, HasMetafieldsIdentifier[]>, metafieldsNamespace?: string): PartialRecord<`${T}MetafieldIdentifiers`, HasMetafieldsIdentifier[]>;
|
|
22
|
+
export declare const referralAttributes: () => {
|
|
23
|
+
key: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}[];
|
|
26
|
+
export declare const getNormalCoupon: ({ variant }: {
|
|
27
|
+
variant?: ProductVariant;
|
|
28
|
+
}) => any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CartLine as ShopifyCartLine } from '../../gql';
|
|
2
|
+
import type { Cart, LineItem } from '../../types/cart';
|
|
3
|
+
import type { Cart as ShopifyCart } from '../../gql';
|
|
4
|
+
export declare function normalizeCart(cart: ShopifyCart, metafieldNamespacePrefix?: string): Cart;
|
|
5
|
+
export declare function normalizeLineItem({ node: { id, merchandise: variant, quantity, discountAllocations, attributes, cost }, }: {
|
|
6
|
+
node: ShopifyCartLine;
|
|
7
|
+
}, metafieldNamespacePrefix?: string): LineItem;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from 'graphql/jsutils/Maybe';
|
|
2
|
+
import { Metafield } from '../../gql';
|
|
3
|
+
export declare const normalizeMetafields: (metafields: Maybe<Metafield>[], metafieldNamespacePrefix: string) => Record<string, any>;
|
|
4
|
+
export declare function parseJSON(str: string): any;
|
|
5
|
+
export declare const parseMetafield: (metafield: Metafield) => any;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Product as ShopifyProduct, ProductOption } from '../../gql';
|
|
2
|
+
import type { Product } from '../../types/product';
|
|
3
|
+
export declare const normalizeProductOption: ({ id, name, values, }: ProductOption) => {
|
|
4
|
+
__typename: "ProductOption";
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
values: {
|
|
8
|
+
label: string;
|
|
9
|
+
hexColors?: string[];
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
export declare const getCouponsFromVariantMetafields: ({ metafields, variantId }: {
|
|
13
|
+
metafields: any;
|
|
14
|
+
variantId: string;
|
|
15
|
+
}) => any;
|
|
16
|
+
export declare function normalizeProduct(product: ShopifyProduct, metafieldNamespacePrefix?: string): Product;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/templates/Credits.types.ts"],
|
|
4
|
-
"sourcesContent": ["import { HeadlessConfig } from '@anker-in/lib'\nimport { DTC_TASK_TYPE } from '../components/credits/context/const'\nimport { CreditsPageCommon } from '../components/credits/type'\nimport { FunctionMemberPriceConfig } from '../components/credits/context/memberPriceTypes'\nimport { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type'\nimport type { CreditsBannerCopy } from '../components/credits/creditsBanner'\nimport type { CreditsInfoCardCopy } from '../components/credits/creditsInfoCard'\nimport type { CreditsBenefitsCopy } from '../components/credits/creditsBenefits'\nimport type { CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysToGetCredits'\nimport type { CreditsAnkersolixTaskCopy } from '../components/credits/creditsAnkersolixTask'\nimport type { CreditsRedeemListCopy } from '../components/credits/creditsRedeemList'\nimport type { CreditsGoGiftCopy } from '../components/credits/creditsGoGift'\nimport type { CreditsCashCopy } from '../components/credits/creditsCash'\nimport type { CreditsMemberPriceCopy } from '../components/credits/creditsMemberPrice'\nimport type { CreditsFaqCopy } from '../components/credits/creditsFaq'\nimport type { CreditsNavigationCopy } from '../components/credits/creditsNavigation'\n\n// Re-export copy types for convenience\nexport type {\n CreditsBannerCopy,\n CreditsInfoCardCopy,\n CreditsBenefitsCopy,\n CreditsWaysToGetCreditsCopy,\n CreditsAnkersolixTaskCopy,\n CreditsRedeemListCopy,\n CreditsGoGiftCopy,\n CreditsCashCopy,\n CreditsMemberPriceCopy,\n CreditsFaqCopy,\n CreditsNavigationCopy,\n}\n\nexport enum ComponentKey {\n Navigation = 'creditsNavigation',\n Banner = 'creditsBanner',\n InfoCard = 'creditsInfoCard',\n Benefits = 'creditsBenefits',\n WaysToGetCredits = 'creditsWaysToGetCredits',\n AnkersolixTask = 'creditsAnkersolixTask',\n RedeemList = 'creditsRedeemList',\n GoGift = 'creditsGoGift',\n SpendCreditsLikeCash = 'creditsCash',\n MemberPrice = 'creditsMemberPrice',\n Faqs = 'creditsFaq',\n}\n\nexport type CreditsTemplateProps = {\n headlessConfig: HeadlessConfig\n siteConfig: {\n registrationsSettings: {\n authCodeActivate: AuthCodeActivateCopy\n }\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n }\n creditsConfig?: {\n alpcBrand?: string\n alpcCountry?: string\n }\n pageConfig: {\n order: ComponentKey[]\n common: CreditsPageCommon\n components: {\n [ComponentKey.Navigation]?: CreditsNavigationCopy\n [ComponentKey.Banner]?: CreditsBannerCopy\n [ComponentKey.InfoCard]?: CreditsInfoCardCopy\n [ComponentKey.Benefits]?: CreditsBenefitsCopy\n [ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy\n [ComponentKey.AnkersolixTask]?: CreditsAnkersolixTaskCopy\n [ComponentKey.RedeemList]?: CreditsRedeemListCopy\n [ComponentKey.GoGift]?: CreditsGoGiftCopy\n [ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy\n [ComponentKey.MemberPrice]?: CreditsMemberPriceCopy\n [ComponentKey.Faqs]?: CreditsFaqCopy\n }\n }\n userContext: {\n profile: any\n removeProfile: () => void\n isLoadingProfile: boolean\n creditInfo: any\n customer: any\n customerLoading: boolean\n fetchCreditInfo: () => void\n apiBaseUrl?: string\n }\n registrationContext: {\n openSignUpPopup: () => void\n openSignInPopup: () => void\n }\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n}\n\nexport type CreditsContentProps = {\n headlessConfig: HeadlessConfig\n pageConfig: CreditsTemplateProps['pageConfig']\n userContext: CreditsTemplateProps['userContext']\n}\n"],
|
|
4
|
+
"sourcesContent": ["import { HeadlessConfig } from '@anker-in/lib'\nimport { DTC_TASK_TYPE } from '../components/credits/context/const'\nimport { CreditsPageCommon } from '../components/credits/type'\nimport { FunctionMemberPriceConfig } from '../components/credits/context/memberPriceTypes'\nimport { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type'\nimport type { CreditsBannerCopy } from '../components/credits/creditsBanner'\nimport type { CreditsInfoCardCopy } from '../components/credits/creditsInfoCard'\nimport type { CreditsBenefitsCopy } from '../components/credits/creditsBenefits'\nimport type { CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysToGetCredits'\nimport type { CreditsAnkersolixTaskCopy } from '../components/credits/creditsAnkersolixTask'\nimport type { CreditsRedeemListCopy } from '../components/credits/creditsRedeemList'\nimport type { CreditsGoGiftCopy } from '../components/credits/creditsGoGift'\nimport type { CreditsCashCopy } from '../components/credits/creditsCash'\nimport type { CreditsMemberPriceCopy } from '../components/credits/creditsMemberPrice'\nimport type { CreditsFaqCopy } from '../components/credits/creditsFaq'\nimport type { CreditsNavigationCopy } from '../components/credits/creditsNavigation'\n\n// Re-export copy types for convenience\nexport type {\n CreditsBannerCopy,\n CreditsInfoCardCopy,\n CreditsBenefitsCopy,\n CreditsWaysToGetCreditsCopy,\n CreditsAnkersolixTaskCopy,\n CreditsRedeemListCopy,\n CreditsGoGiftCopy,\n CreditsCashCopy,\n CreditsMemberPriceCopy,\n CreditsFaqCopy,\n CreditsNavigationCopy,\n}\n\nexport enum ComponentKey {\n Navigation = 'creditsNavigation',\n Banner = 'creditsBanner',\n InfoCard = 'creditsInfoCard',\n Benefits = 'creditsBenefits',\n WaysToGetCredits = 'creditsWaysToGetCredits',\n AnkersolixTask = 'creditsAnkersolixTask',\n RedeemList = 'creditsRedeemList',\n GoGift = 'creditsGoGift',\n SpendCreditsLikeCash = 'creditsCash',\n MemberPrice = 'creditsMemberPrice',\n Faqs = 'creditsFaq',\n}\n\nexport type CreditsTemplateProps = {\n headlessConfig: HeadlessConfig\n siteConfig: {\n registrationsSettings: {\n authCodeActivate: AuthCodeActivateCopy\n }\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n taskNameMapping: Record<string, string>\n }\n creditsConfig?: {\n alpcBrand?: string\n alpcCountry?: string\n }\n pageConfig: {\n order: ComponentKey[]\n common: CreditsPageCommon\n components: {\n [ComponentKey.Navigation]?: CreditsNavigationCopy\n [ComponentKey.Banner]?: CreditsBannerCopy\n [ComponentKey.InfoCard]?: CreditsInfoCardCopy\n [ComponentKey.Benefits]?: CreditsBenefitsCopy\n [ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy\n [ComponentKey.AnkersolixTask]?: CreditsAnkersolixTaskCopy\n [ComponentKey.RedeemList]?: CreditsRedeemListCopy\n [ComponentKey.GoGift]?: CreditsGoGiftCopy\n [ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy\n [ComponentKey.MemberPrice]?: CreditsMemberPriceCopy\n [ComponentKey.Faqs]?: CreditsFaqCopy\n }\n }\n userContext: {\n profile: any\n removeProfile: () => void\n isLoadingProfile: boolean\n creditInfo: any\n customer: any\n customerLoading: boolean\n fetchCreditInfo: () => void\n apiBaseUrl?: string\n }\n registrationContext: {\n openSignUpPopup: () => void\n openSignInPopup: () => void\n }\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n}\n\nexport type CreditsContentProps = {\n headlessConfig: HeadlessConfig\n pageConfig: CreditsTemplateProps['pageConfig']\n userContext: CreditsTemplateProps['userContext']\n}\n"],
|
|
5
5
|
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAgCO,IAAKE,OACVA,EAAA,WAAa,oBACbA,EAAA,OAAS,gBACTA,EAAA,SAAW,kBACXA,EAAA,SAAW,kBACXA,EAAA,iBAAmB,0BACnBA,EAAA,eAAiB,wBACjBA,EAAA,WAAa,oBACbA,EAAA,OAAS,gBACTA,EAAA,qBAAuB,cACvBA,EAAA,YAAc,qBACdA,EAAA,KAAO,aAXGA,OAAA",
|
|
6
6
|
"names": ["Credits_types_exports", "__export", "ComponentKey", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var U=Object.create;var C=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var Y=(
|
|
1
|
+
"use strict";var U=Object.create;var C=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var Y=(t,r)=>{for(var d in r)C(t,d,{get:r[d],enumerable:!0})},M=(t,r,d,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of E(r))!K.call(t,p)&&p!==d&&C(t,p,{get:()=>r[p],enumerable:!(i=W(r,p))||i.enumerable});return t};var h=(t,r,d)=>(d=t!=null?U(H(t)):{},M(r||!t||!t.__esModule?C(d,"default",{value:t,enumerable:!0}):d,t)),z=t=>M(C({},"__esModule",{value:!0}),t);var V={};Y(V,{CreditsTemplate:()=>Q});module.exports=z(V);var e=require("react/jsx-runtime"),c=require("@anker-in/lib"),l=require("react"),T=require("../components/registration/context/provider"),f=require("../components/credits/context/provider"),w=require("../components/credits/creditsBanner"),B=require("../components/credits/creditsInfoCard"),b=require("../components/credits/creditsBenefits"),I=require("../components/credits/creditsWaysToGetCredits"),G=require("../components/credits/creditsAnkersolixTask"),R=require("../components/credits/creditsRedeemList"),L=require("../components/credits/creditsGoGift"),N=require("../components/credits/creditsCash"),A=require("../components/credits/creditsMemberPrice"),S=require("../components/credits/creditsFaq"),D=require("../components/credits/creditsNavigation"),F=h(require("../components/credits/modal/ActivitiesModal")),q=h(require("../components/credits/modal/RewardsModal")),s=require("./Credits.types");const J=({headlessConfig:t,pageConfig:r,userContext:d})=>{const{openMyRewardsModal:i,setOpenMyRewardsModal:p,openActivitiesModal:m,setOpenActivitiesModal:y,pageCommon:n}=(0,f.useCreditsContext)(),g=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{if(g.current||typeof window>"u")return;const a=new URLSearchParams(window.location.search).get("section");if(!a)return;const x=56,u=(P=0)=>{const v=document.getElementById(a);if(v){g.current=!0;const O=v.getBoundingClientRect().top+window.pageYOffset-x;window.scrollTo({top:O,behavior:"smooth"})}else P<10&&setTimeout(()=>u(P+1),300)};u()},[]),(0,e.jsxs)(e.Fragment,{children:[r.components[s.ComponentKey.Navigation]&&(0,e.jsx)(D.CreditsNavigation,{copy:r.components[s.ComponentKey.Navigation]}),(0,e.jsx)("div",{className:(0,c.classNames)("bg-[#f5f5f7] leading-[1.2]"),children:r.order.map(o=>{if(o===s.ComponentKey.Navigation)return null;const a=r.components?.[o];return a?(0,e.jsxs)(e.Fragment,{children:[o===s.ComponentKey.Banner&&(0,e.jsx)(w.CreditsBanner,{copy:a,id:o}),o===s.ComponentKey.InfoCard&&d?.profile&&(0,e.jsx)(B.CreditsInfoCard,{copy:a,id:o}),o===s.ComponentKey.Benefits&&(0,e.jsx)(b.CreditsBenefits,{copy:a,id:o}),o===s.ComponentKey.WaysToGetCredits&&(0,e.jsx)(I.CreditsWaysToGetCredits,{copy:a,id:o,classNames:t.brand==="anker"?{subtitle:"text-white",equalCreditsText:"bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent"}:{subtitle:"text-[#D1D1D1]",equalCreditsText:"text-[#F6EAD0]"}}),o===s.ComponentKey.AnkersolixTask&&(0,e.jsx)(G.CreditsAnkersolixTask,{copy:a,id:o}),o===s.ComponentKey.RedeemList&&(0,e.jsx)(R.CreditsRedeemList,{copy:a,id:o}),o===s.ComponentKey.GoGift&&(0,e.jsx)(L.CreditsGoGift,{copy:a,id:o}),o===s.ComponentKey.SpendCreditsLikeCash&&(0,e.jsx)(N.CreditsCash,{copy:a,id:o}),o===s.ComponentKey.MemberPrice&&(0,e.jsx)(A.CreditsMemberPrice,{copy:a,id:o}),o===s.ComponentKey.Faqs&&(0,e.jsx)(S.CreditsFaq,{copy:a,id:o}),o!==s.ComponentKey.Banner&&(0,e.jsx)("div",{className:"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16"})]}):null})}),n?.activitiesModal&&(0,e.jsx)(F.default,{isOpen:m,data:n.activitiesModal,onClose:()=>y(!1)}),n?.rewardsModal&&(0,e.jsx)(q.default,{isOpen:i,data:n.rewardsModal,onClose:()=>p(!1)})]})},Q=({headlessConfig:t,siteConfig:r,creditsConfig:d,userContext:i,pageConfig:p,registrationContext:m,gtm:y,cartConfig:n})=>(0,e.jsx)(c.HeadlessProvider,{headlessConfig:t,children:(0,e.jsx)(T.RegistrationProvider,{copy:r.registrationsSettings,email:i?.profile?.email,children:(0,e.jsx)(f.CreditsProvider,{profile:i?.profile,removeProfile:i?.removeProfile,isLoadingProfile:i?.isLoadingProfile,openSignInPopup:m.openSignInPopup,openSignUpPopup:m.openSignUpPopup,creditInfo:i?.creditInfo,taskIdToTypeMapping:r.taskIdToTypeMapping,taskNameMapping:r.taskNameMapping,customer:i?.customer,fetchCreditInfo:i?.fetchCreditInfo,customerLoading:i?.customerLoading,gtm:y,pageCommon:p.common,memberPriceDiscount:r.memberPriceDiscount,alpcBrand:d?.alpcBrand,alpcCountry:d?.alpcCountry,cartConfig:n,apiBaseUrl:i?.apiBaseUrl,children:(0,e.jsx)(J,{headlessConfig:t,pageConfig:p,userContext:i})})})});
|
|
2
2
|
//# sourceMappingURL=Credits.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/templates/Credits.tsx"],
|
|
4
|
-
"sourcesContent": ["import { classNames, HeadlessProvider } from '@anker-in/lib'\nimport { useEffect, useRef } from 'react'\nimport { RegistrationProvider } from '../components/registration/context/provider'\nimport { CreditsProvider, useCreditsContext } from '../components/credits/context/provider'\nimport { CreditsBanner } from '../components/credits/creditsBanner'\nimport { CreditsInfoCard } from '../components/credits/creditsInfoCard'\nimport { CreditsBenefits } from '../components/credits/creditsBenefits'\nimport { CreditsWaysToGetCredits } from '../components/credits/creditsWaysToGetCredits'\nimport { CreditsAnkersolixTask } from '../components/credits/creditsAnkersolixTask'\nimport { CreditsRedeemList } from '../components/credits/creditsRedeemList'\nimport { CreditsGoGift } from '../components/credits/creditsGoGift'\nimport { CreditsCash } from '../components/credits/creditsCash'\nimport { CreditsMemberPrice } from '../components/credits/creditsMemberPrice'\nimport { CreditsFaq } from '../components/credits/creditsFaq'\nimport { CreditsNavigation } from '../components/credits/creditsNavigation'\nimport ActivitiesModal from '../components/credits/modal/ActivitiesModal'\nimport RewardsModal from '../components/credits/modal/RewardsModal'\nimport { ComponentKey } from './Credits.types'\nimport type {\n CreditsTemplateProps,\n CreditsContentProps,\n CreditsBannerCopy,\n CreditsInfoCardCopy,\n CreditsBenefitsCopy,\n CreditsWaysToGetCreditsCopy,\n CreditsAnkersolixTaskCopy,\n CreditsRedeemListCopy,\n CreditsGoGiftCopy,\n CreditsCashCopy,\n CreditsMemberPriceCopy,\n CreditsFaqCopy,\n} from './Credits.types'\n\nconst CreditsContent = ({ headlessConfig, pageConfig, userContext }: CreditsContentProps) => {\n const { openMyRewardsModal, setOpenMyRewardsModal, openActivitiesModal, setOpenActivitiesModal, pageCommon } = useCreditsContext()\n const hasScrolled = useRef(false)\n\n useEffect(() => {\n if (hasScrolled.current || typeof window === 'undefined') return\n\n const params = new URLSearchParams(window.location.search)\n const section = params.get('section')\n if (!section) return\n\n const navHeight = 56\n\n const tryScroll = (attempts = 0) => {\n const el = document.getElementById(section)\n if (el) {\n hasScrolled.current = true\n const top = el.getBoundingClientRect().top + window.pageYOffset - navHeight\n window.scrollTo({ top, behavior: 'smooth' })\n } else if (attempts < 10) {\n setTimeout(() => tryScroll(attempts + 1), 300)\n }\n }\n\n tryScroll()\n }, [])\n\n return (\n <>\n {/* \u5BFC\u822A\u7EC4\u4EF6 - \u56FA\u5B9A\u4F4D\u7F6E\uFF0C\u4E0D\u53C2\u4E0E order \u6392\u5E8F */}\n {pageConfig.components[ComponentKey.Navigation] && (\n <CreditsNavigation copy={pageConfig.components[ComponentKey.Navigation]} />\n )}\n <div className={classNames('bg-[#f5f5f7] leading-[1.2]')}>\n {pageConfig.order.map(key => {\n // \u8DF3\u8FC7\u5BFC\u822A\u7EC4\u4EF6\uFF0C\u56E0\u4E3A\u5B83\u5DF2\u7ECF\u56FA\u5B9A\u6E32\u67D3\u5728\u4E0A\u65B9\n if (key === ComponentKey.Navigation) return null\n const componentCopy = pageConfig.components?.[key]\n if (!componentCopy) return null\n return (\n <>\n {key === ComponentKey.Banner && <CreditsBanner copy={componentCopy as CreditsBannerCopy} id={key} />}\n {key === ComponentKey.InfoCard && userContext?.profile && (\n <CreditsInfoCard copy={componentCopy as CreditsInfoCardCopy} id={key} />\n )}\n {key === ComponentKey.Benefits && (\n <CreditsBenefits copy={componentCopy as CreditsBenefitsCopy} id={key} />\n )}\n {key === ComponentKey.WaysToGetCredits && (\n <CreditsWaysToGetCredits\n copy={componentCopy as CreditsWaysToGetCreditsCopy}\n id={key}\n classNames={\n headlessConfig.brand === 'anker'\n ? {\n subtitle: 'text-white',\n equalCreditsText:\n 'bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent',\n }\n : {\n subtitle: 'text-[#D1D1D1]',\n equalCreditsText: 'text-[#F6EAD0]',\n }\n }\n />\n )}\n {key === ComponentKey.AnkersolixTask && (\n <CreditsAnkersolixTask copy={componentCopy as CreditsAnkersolixTaskCopy} id={key} />\n )}\n {key === ComponentKey.RedeemList && (\n <CreditsRedeemList copy={componentCopy as CreditsRedeemListCopy} id={key} />\n )}\n {key === ComponentKey.GoGift && <CreditsGoGift copy={componentCopy as CreditsGoGiftCopy} id={key} />}\n {key === ComponentKey.SpendCreditsLikeCash && (\n <CreditsCash copy={componentCopy as CreditsCashCopy} id={key} />\n )}\n {key === ComponentKey.MemberPrice && (\n <CreditsMemberPrice copy={componentCopy as CreditsMemberPriceCopy} id={key} />\n )}\n {key === ComponentKey.Faqs && <CreditsFaq copy={componentCopy as CreditsFaqCopy} id={key} />}\n {key !== ComponentKey.Banner && (\n <div className=\"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16\" />\n )}\n </>\n )\n })}\n </div>\n\n {/* Global Modals */}\n {pageCommon?.activitiesModal && (\n <ActivitiesModal\n isOpen={openActivitiesModal}\n data={pageCommon.activitiesModal}\n onClose={() => setOpenActivitiesModal(false)}\n />\n )}\n {pageCommon?.rewardsModal && (\n <RewardsModal\n isOpen={openMyRewardsModal}\n data={pageCommon.rewardsModal}\n onClose={() => setOpenMyRewardsModal(false)}\n />\n )}\n </>\n )\n}\n\nexport const CreditsTemplate = ({\n headlessConfig,\n siteConfig,\n creditsConfig,\n userContext,\n pageConfig,\n registrationContext,\n gtm,\n cartConfig,\n}: CreditsTemplateProps) => {\n return (\n <HeadlessProvider headlessConfig={headlessConfig}>\n <RegistrationProvider copy={siteConfig.registrationsSettings} email={userContext?.profile?.email}>\n <CreditsProvider\n profile={userContext?.profile}\n removeProfile={userContext?.removeProfile}\n isLoadingProfile={userContext?.isLoadingProfile}\n openSignInPopup={registrationContext.openSignInPopup}\n openSignUpPopup={registrationContext.openSignUpPopup}\n creditInfo={userContext?.creditInfo}\n taskIdToTypeMapping={siteConfig.taskIdToTypeMapping}\n customer={userContext?.customer}\n fetchCreditInfo={userContext?.fetchCreditInfo}\n customerLoading={userContext?.customerLoading}\n gtm={gtm}\n pageCommon={pageConfig.common}\n memberPriceDiscount={siteConfig.memberPriceDiscount}\n alpcBrand={creditsConfig?.alpcBrand}\n alpcCountry={creditsConfig?.alpcCountry}\n cartConfig={cartConfig}\n apiBaseUrl={userContext?.apiBaseUrl}\n >\n <CreditsContent headlessConfig={headlessConfig} pageConfig={pageConfig} userContext={userContext} />\n </CreditsProvider>\n </RegistrationProvider>\n </HeadlessProvider>\n )\n}\n"],
|
|
5
|
-
"mappings": "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",
|
|
4
|
+
"sourcesContent": ["import { classNames, HeadlessProvider } from '@anker-in/lib'\nimport { useEffect, useRef } from 'react'\nimport { RegistrationProvider } from '../components/registration/context/provider'\nimport { CreditsProvider, useCreditsContext } from '../components/credits/context/provider'\nimport { CreditsBanner } from '../components/credits/creditsBanner'\nimport { CreditsInfoCard } from '../components/credits/creditsInfoCard'\nimport { CreditsBenefits } from '../components/credits/creditsBenefits'\nimport { CreditsWaysToGetCredits } from '../components/credits/creditsWaysToGetCredits'\nimport { CreditsAnkersolixTask } from '../components/credits/creditsAnkersolixTask'\nimport { CreditsRedeemList } from '../components/credits/creditsRedeemList'\nimport { CreditsGoGift } from '../components/credits/creditsGoGift'\nimport { CreditsCash } from '../components/credits/creditsCash'\nimport { CreditsMemberPrice } from '../components/credits/creditsMemberPrice'\nimport { CreditsFaq } from '../components/credits/creditsFaq'\nimport { CreditsNavigation } from '../components/credits/creditsNavigation'\nimport ActivitiesModal from '../components/credits/modal/ActivitiesModal'\nimport RewardsModal from '../components/credits/modal/RewardsModal'\nimport { ComponentKey } from './Credits.types'\nimport type {\n CreditsTemplateProps,\n CreditsContentProps,\n CreditsBannerCopy,\n CreditsInfoCardCopy,\n CreditsBenefitsCopy,\n CreditsWaysToGetCreditsCopy,\n CreditsAnkersolixTaskCopy,\n CreditsRedeemListCopy,\n CreditsGoGiftCopy,\n CreditsCashCopy,\n CreditsMemberPriceCopy,\n CreditsFaqCopy,\n} from './Credits.types'\n\nconst CreditsContent = ({ headlessConfig, pageConfig, userContext }: CreditsContentProps) => {\n const { openMyRewardsModal, setOpenMyRewardsModal, openActivitiesModal, setOpenActivitiesModal, pageCommon } = useCreditsContext()\n const hasScrolled = useRef(false)\n\n useEffect(() => {\n if (hasScrolled.current || typeof window === 'undefined') return\n\n const params = new URLSearchParams(window.location.search)\n const section = params.get('section')\n if (!section) return\n\n const navHeight = 56\n\n const tryScroll = (attempts = 0) => {\n const el = document.getElementById(section)\n if (el) {\n hasScrolled.current = true\n const top = el.getBoundingClientRect().top + window.pageYOffset - navHeight\n window.scrollTo({ top, behavior: 'smooth' })\n } else if (attempts < 10) {\n setTimeout(() => tryScroll(attempts + 1), 300)\n }\n }\n\n tryScroll()\n }, [])\n\n return (\n <>\n {/* \u5BFC\u822A\u7EC4\u4EF6 - \u56FA\u5B9A\u4F4D\u7F6E\uFF0C\u4E0D\u53C2\u4E0E order \u6392\u5E8F */}\n {pageConfig.components[ComponentKey.Navigation] && (\n <CreditsNavigation copy={pageConfig.components[ComponentKey.Navigation]} />\n )}\n <div className={classNames('bg-[#f5f5f7] leading-[1.2]')}>\n {pageConfig.order.map(key => {\n // \u8DF3\u8FC7\u5BFC\u822A\u7EC4\u4EF6\uFF0C\u56E0\u4E3A\u5B83\u5DF2\u7ECF\u56FA\u5B9A\u6E32\u67D3\u5728\u4E0A\u65B9\n if (key === ComponentKey.Navigation) return null\n const componentCopy = pageConfig.components?.[key]\n if (!componentCopy) return null\n return (\n <>\n {key === ComponentKey.Banner && <CreditsBanner copy={componentCopy as CreditsBannerCopy} id={key} />}\n {key === ComponentKey.InfoCard && userContext?.profile && (\n <CreditsInfoCard copy={componentCopy as CreditsInfoCardCopy} id={key} />\n )}\n {key === ComponentKey.Benefits && (\n <CreditsBenefits copy={componentCopy as CreditsBenefitsCopy} id={key} />\n )}\n {key === ComponentKey.WaysToGetCredits && (\n <CreditsWaysToGetCredits\n copy={componentCopy as CreditsWaysToGetCreditsCopy}\n id={key}\n classNames={\n headlessConfig.brand === 'anker'\n ? {\n subtitle: 'text-white',\n equalCreditsText:\n 'bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent',\n }\n : {\n subtitle: 'text-[#D1D1D1]',\n equalCreditsText: 'text-[#F6EAD0]',\n }\n }\n />\n )}\n {key === ComponentKey.AnkersolixTask && (\n <CreditsAnkersolixTask copy={componentCopy as CreditsAnkersolixTaskCopy} id={key} />\n )}\n {key === ComponentKey.RedeemList && (\n <CreditsRedeemList copy={componentCopy as CreditsRedeemListCopy} id={key} />\n )}\n {key === ComponentKey.GoGift && <CreditsGoGift copy={componentCopy as CreditsGoGiftCopy} id={key} />}\n {key === ComponentKey.SpendCreditsLikeCash && (\n <CreditsCash copy={componentCopy as CreditsCashCopy} id={key} />\n )}\n {key === ComponentKey.MemberPrice && (\n <CreditsMemberPrice copy={componentCopy as CreditsMemberPriceCopy} id={key} />\n )}\n {key === ComponentKey.Faqs && <CreditsFaq copy={componentCopy as CreditsFaqCopy} id={key} />}\n {key !== ComponentKey.Banner && (\n <div className=\"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16\" />\n )}\n </>\n )\n })}\n </div>\n\n {/* Global Modals */}\n {pageCommon?.activitiesModal && (\n <ActivitiesModal\n isOpen={openActivitiesModal}\n data={pageCommon.activitiesModal}\n onClose={() => setOpenActivitiesModal(false)}\n />\n )}\n {pageCommon?.rewardsModal && (\n <RewardsModal\n isOpen={openMyRewardsModal}\n data={pageCommon.rewardsModal}\n onClose={() => setOpenMyRewardsModal(false)}\n />\n )}\n </>\n )\n}\n\nexport const CreditsTemplate = ({\n headlessConfig,\n siteConfig,\n creditsConfig,\n userContext,\n pageConfig,\n registrationContext,\n gtm,\n cartConfig,\n}: CreditsTemplateProps) => {\n return (\n <HeadlessProvider headlessConfig={headlessConfig}>\n <RegistrationProvider copy={siteConfig.registrationsSettings} email={userContext?.profile?.email}>\n <CreditsProvider\n profile={userContext?.profile}\n removeProfile={userContext?.removeProfile}\n isLoadingProfile={userContext?.isLoadingProfile}\n openSignInPopup={registrationContext.openSignInPopup}\n openSignUpPopup={registrationContext.openSignUpPopup}\n creditInfo={userContext?.creditInfo}\n taskIdToTypeMapping={siteConfig.taskIdToTypeMapping}\n taskNameMapping={siteConfig.taskNameMapping}\n customer={userContext?.customer}\n fetchCreditInfo={userContext?.fetchCreditInfo}\n customerLoading={userContext?.customerLoading}\n gtm={gtm}\n pageCommon={pageConfig.common}\n memberPriceDiscount={siteConfig.memberPriceDiscount}\n alpcBrand={creditsConfig?.alpcBrand}\n alpcCountry={creditsConfig?.alpcCountry}\n cartConfig={cartConfig}\n apiBaseUrl={userContext?.apiBaseUrl}\n >\n <CreditsContent headlessConfig={headlessConfig} pageConfig={pageConfig} userContext={userContext} />\n </CreditsProvider>\n </RegistrationProvider>\n </HeadlessProvider>\n )\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["Credits_exports", "__export", "CreditsTemplate", "__toCommonJS", "import_jsx_runtime", "import_lib", "import_react", "import_provider", "import_creditsBanner", "import_creditsInfoCard", "import_creditsBenefits", "import_creditsWaysToGetCredits", "import_creditsAnkersolixTask", "import_creditsRedeemList", "import_creditsGoGift", "import_creditsCash", "import_creditsMemberPrice", "import_creditsFaq", "import_creditsNavigation", "import_ActivitiesModal", "import_RewardsModal", "import_Credits", "CreditsContent", "headlessConfig", "pageConfig", "userContext", "openMyRewardsModal", "setOpenMyRewardsModal", "openActivitiesModal", "setOpenActivitiesModal", "pageCommon", "hasScrolled", "section", "navHeight", "tryScroll", "attempts", "el", "top", "key", "componentCopy", "ActivitiesModal", "RewardsModal", "siteConfig", "creditsConfig", "registrationContext", "gtm", "cartConfig"]
|
|
7
7
|
}
|