@anker-in/campaign-ui 0.5.1-beta.3 → 0.5.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/credits/context/const.js +1 -1
- package/dist/cjs/components/credits/context/const.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useSubscribed.js.map +2 -2
- 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/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
- package/dist/cjs/components/index.d.ts +2 -2
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +2 -2
- package/dist/cjs/components/memberPopup/MemberPopup.js +1 -1
- package/dist/cjs/components/memberPopup/MemberPopup.js.map +3 -3
- package/dist/cjs/components/memberPopup/type.d.ts +6 -0
- package/dist/cjs/components/memberPopup/type.js +1 -1
- package/dist/cjs/components/memberPopup/type.js.map +1 -1
- package/dist/cjs/templates/Credits.js +1 -1
- package/dist/cjs/templates/Credits.js.map +2 -2
- package/dist/cjs/templates/Credits.types.d.ts +1 -0
- package/dist/cjs/templates/Credits.types.js.map +1 -1
- package/dist/esm/components/credits/context/const.js +1 -1
- package/dist/esm/components/credits/context/const.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +2 -2
- 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/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
- package/dist/esm/components/index.d.ts +2 -2
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +2 -2
- package/dist/esm/components/memberPopup/MemberPopup.js +1 -1
- package/dist/esm/components/memberPopup/MemberPopup.js.map +3 -3
- package/dist/esm/components/memberPopup/type.d.ts +6 -0
- package/dist/esm/components/memberPopup/type.js.map +1 -1
- package/dist/esm/templates/Credits.js +1 -1
- package/dist/esm/templates/Credits.js.map +2 -2
- package/dist/esm/templates/Credits.types.d.ts +1 -0
- package/dist/esm/templates/Credits.types.js.map +1 -1
- package/package.json +1 -2
- package/src/components/credits/context/const.ts +1 -0
- package/src/components/credits/context/hooks/useMyRewards.ts +2 -2
- package/src/components/credits/context/hooks/useRedeemCoupon.ts +2 -2
- package/src/components/credits/context/hooks/useRedeemGoGift.ts +2 -2
- package/src/components/credits/context/hooks/useRedeemProduct.ts +2 -2
- package/src/components/credits/context/hooks/useRedeemableList.ts +2 -2
- package/src/components/credits/context/hooks/useSubscribed.ts +0 -1
- package/src/components/credits/context/provider.tsx +4 -0
- package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +3 -3
- package/src/components/index.ts +2 -2
- package/src/components/memberPopup/MemberPopup.tsx +14 -3
- package/src/components/memberPopup/type.ts +6 -0
- package/src/templates/Credits.tsx +1 -0
- package/src/templates/Credits.types.ts +1 -0
- package/src/stories/CartCard.stories.tsx +0 -459
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/memberPopup/MemberPopup.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport { lazy, Suspense, useState, useCallback, useEffect } from 'react'\nimport { Picture } from '@anker-in/headless-ui'\nimport { gaTrack, type HeadlessConfig, useHeadlessContext, classNames as cn } from '@anker-in/lib'\nimport {\n MemberPopupActionType,\n MemberPopupPageScope,\n MemberPopupPanelType,\n type MemberPopupCopy,\n type MemberPopupContextValue,\n type MemberPopupItem,\n} from './type'\nimport { MemberPopupProvider } from './context/provider'\nimport { useMemberPopupContext } from './context/provider'\nimport { ViewStackContext, type ViewPayload } from './context/viewStack'\nimport { IconClose, IconArrow, IconCredit, IconBag, IconReferral, IconSwitch, IconSubscription } from './icons'\nimport { ROUNDED_BRANDS } from '../../constants'\n\nconst EarnCredits = lazy(() => import('./panels/EarnCredits'))\nconst ConsumeCredits = lazy(() => import('./panels/ConsumeCredits'))\nconst Referral = lazy(() => import('./panels/Referral'))\nconst CompleteProfilePanel = lazy(() => import('./panels/EarnCredits/CompleteProfilePanel'))\nconst ActivitiesSubscribePanel = lazy(() => import('./panels/ActivitiesSubscribePanel'))\nconst SubscribeEmailPanel = lazy(() => import('./panels/EarnCredits/SubscribeEmailPanel'))\nconst ActivatePanel = lazy(() => import('./panels/EarnCredits/ActivatePanel'))\nconst RedeemCouponPanel = lazy(() => import('./panels/ConsumeCredits/RedeemCouponPanel'))\n\ntype MemberPopupProps = MemberPopupContextValue & {\n headlessConfig: HeadlessConfig\n copy: MemberPopupCopy\n bottomOffset?: string\n}\n\nexport function MemberPopup({ copy, bottomOffset = '24px', ...providerProps }: MemberPopupProps) {\n const [isVisible, setIsVisible] = useState(false)\n\n useEffect(() => {\n const config = copy.pageConfig\n if (!config) {\n setIsVisible(true)\n return\n }\n const pathname = window.location.pathname\n const matches = config.pages.some(page => pathname === page || pathname.startsWith(page + '/'))\n switch (config.scope) {\n case MemberPopupPageScope.Include:\n setIsVisible(matches)\n break\n case MemberPopupPageScope.Exclude:\n setIsVisible(!matches)\n break\n default:\n setIsVisible(true)\n }\n }, [copy.pageConfig])\n\n return isVisible ? (\n <MemberPopupProvider {...providerProps} earnCreditsCopy={copy.earnCredits}>\n <MemberPopupContent copy={copy} bottomOffset={bottomOffset} />\n </MemberPopupProvider>\n ) : null\n}\n\ntype MemberPopupContentProps = {\n copy: MemberPopupCopy\n bottomOffset: string\n}\n\nfunction MemberPopupContent({ copy, bottomOffset }: MemberPopupContentProps) {\n const { profile, openSignInPopup, openSignUpPopup } = useMemberPopupContext()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n const [isOpen, setIsOpen] = useState(false)\n const [viewStack, setViewStack] = useState<ViewPayload[]>([])\n\n const currentView = viewStack[viewStack.length - 1] ?? null\n\n const pushView = useCallback((view: ViewPayload) => {\n setViewStack(prev => [...prev, view])\n }, [])\n\n const popView = useCallback(() => {\n setViewStack(prev => prev.slice(0, -1))\n }, [])\n\n const MEMBER_POPUP_INFO = 'Member Floating Window'\n\n function trackLpButton(position: string, buttonName: string) {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n position,\n button_name: buttonName,\n info: MEMBER_POPUP_INFO,\n },\n })\n }\n\n function handleAction(type: MemberPopupActionType, url?: string) {\n switch (type) {\n case MemberPopupActionType.ExternalLink:\n if (url) window.open(url, '_blank', 'noopener,noreferrer')\n break\n case MemberPopupActionType.OpenEarnCredits:\n trackLpButton('home', 'earn_credits')\n pushView({ type: MemberPopupPanelType.EarnCredits })\n break\n case MemberPopupActionType.OpenConsumeCredits:\n trackLpButton('home', 'consume_credits')\n pushView({ type: MemberPopupPanelType.ConsumeCredits })\n break\n case MemberPopupActionType.OpenReferral:\n trackLpButton('home', 'referral')\n pushView({ type: MemberPopupPanelType.Referral })\n break\n case MemberPopupActionType.OpenSubscribe:\n trackLpButton('home', 'subscribe')\n pushView({ type: MemberPopupPanelType.Subscribe })\n break\n }\n }\n\n function handleClose() {\n setIsOpen(false)\n setViewStack([])\n }\n\n return (\n <ViewStackContext.Provider value={{ pushView, popView }}>\n {isOpen && <div className=\"fixed inset-0 z-[998]\" onClick={handleClose} />}\n <div\n className=\"fixed right-0 z-[999] flex flex-row items-end pr-[20px] md:flex-col md:items-end md:right-0 md:w-screen md:pr-0 md:pl-0\"\n style={{ bottom: bottomOffset }}\n >\n {isOpen && (\n <div className=\"relative mr-[12px] md:mr-[12px] md:mb-[12px]\" onClick={e => e.stopPropagation()}>\n <div className=\"absolute right-[-7px] bottom-[24px] size-0 border-y-8 border-l-8 border-r-0 border-y-transparent border-l-white md:bottom-[-8px] md:right-[25px] md:top-auto md:border-y-0 md:border-l-8 md:border-r-8 md:border-t-8 md:border-l-transparent md:border-r-transparent md:border-t-white\" />\n <div\n className={cn(\n 'flex w-[420px] max-w-[calc(100vw-32px)] min-h-[500px] flex-col overflow-hidden bg-white shadow-[0_8px_32px_rgba(0,0,0,0.16)] md:w-[calc(100vw-32px)] md:max-w-[400px]',\n rounded ? 'rounded-[12px]' : 'rounded-none'\n )}\n style={{ maxHeight: 'min(80vh, 606px)' }}\n >\n <div className=\"flex items-center justify-end pl-[10px] pr-[16px] pb-[8px] pt-[16px]\">\n {currentView !== null && (\n <button\n className=\"mr-auto flex size-[24px] cursor-pointer items-center justify-center\"\n onClick={popView}\n aria-label=\"Back\"\n >\n <IconSwitch />\n </button>\n )}\n <button\n className=\"flex size-[24px] cursor-pointer items-center justify-center\"\n onClick={() => {\n trackLpButton('floating_button', 'close')\n handleClose()\n }}\n aria-label=\"Close\"\n >\n <IconClose />\n </button>\n </div>\n\n <div className=\"flex flex-1 flex-col gap-[12px] overflow-y-auto p-[16px]\">\n {currentView === null && (\n <>\n {(copy.title || copy.subtitle) && (\n <div className=\"flex flex-col gap-[4px]\">\n {copy.title && (\n <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>\n )}\n {copy.subtitle && (\n <p className=\"text-[16px] font-[700] leading-snug text-[#4a4c56]\">{copy.subtitle}</p>\n )}\n </div>\n )}\n {copy.list.map((item, i) => (\n <HomeCard key={i} item={item} onAction={handleAction} rounded={rounded} />\n ))}\n </>\n )}\n\n {currentView !== null && (\n <Suspense\n fallback={\n <div className=\"flex items-center justify-center py-[32px]\">\n <div className=\"size-[32px] animate-spin rounded-full border-[3px] border-[#080a0f] border-t-transparent\" />\n </div>\n }\n >\n {currentView.type === MemberPopupPanelType.EarnCredits && copy.earnCredits && (\n <EarnCredits copy={copy.earnCredits} />\n )}\n {currentView.type === MemberPopupPanelType.ConsumeCredits && copy.consumeCredits && (\n <ConsumeCredits copy={copy.consumeCredits} />\n )}\n {currentView.type === MemberPopupPanelType.Referral && copy.referral && (\n <Referral copy={copy.referral} onClose={popView} />\n )}\n {currentView.type === MemberPopupPanelType.CompleteProfile && copy.earnCredits && (\n <CompleteProfilePanel copy={copy.earnCredits.completeProfile} onClose={popView} />\n )}\n {currentView.type === MemberPopupPanelType.Subscribe && copy.activitiesSubscribe && (\n <ActivitiesSubscribePanel copy={copy.activitiesSubscribe} email={profile?.email} />\n )}\n {currentView.type === MemberPopupPanelType.SubscribeEmail && copy.earnCredits && (\n <SubscribeEmailPanel copy={copy.earnCredits.subscribe} email={profile?.email} onClose={popView} />\n )}\n {currentView.type === MemberPopupPanelType.Activate && copy.earnCredits && (\n <ActivatePanel copy={copy.earnCredits.authCodeActivate} onClose={popView} />\n )}\n {currentView.type === MemberPopupPanelType.RedeemCoupon &&\n currentView.props &&\n copy.consumeCredits && (\n <RedeemCouponPanel\n item={currentView.props as any}\n copy={copy.consumeCredits}\n onClose={popView}\n />\n )}\n </Suspense>\n )}\n </div>\n\n {copy.footer && !isLogin && (\n <div className=\"border-t border-[#dadce0] p-[16px]\">\n <div className=\"flex items-center justify-between gap-[16px]\">\n <div className=\"inline gap-[4px]\">\n <span className=\"text-[14px] font-[700] text-[#080a0f]\">{copy.footer.loginHint}</span>\n <button\n className=\"cursor-pointer ml-[4px] text-[14px] font-bold text-[#080a0f] underline\"\n onClick={openSignInPopup}\n >\n {copy.footer.loginLabel}\n </button>\n </div>\n <div className=\"flex shrink-0 items-center gap-[8px]\">\n <button\n className={cn(\n 'cursor-pointer border-[1.6px] border-[#080a0f] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-[#080a0f]',\n rounded ? 'rounded-[4px]' : 'rounded-none'\n )}\n onClick={openSignUpPopup}\n >\n {copy.footer.joinLabel}\n </button>\n </div>\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n\n <button\n className=\"flex cursor-pointer items-center justify-center rounded-full bg-white shadow-lg md:ml-auto md:mr-[16px]\"\n onClick={() => {\n const next = !isOpen\n trackLpButton('floating_button', next ? 'open' : 'close')\n setIsOpen(next)\n }}\n aria-label={copy.triggerImg.alt ?? 'Open member popup'}\n >\n <Picture source={copy.triggerImg.url} alt={copy.triggerImg.alt ?? ''} className=\"size-[58px]\" />\n </button>\n </div>\n </ViewStackContext.Provider>\n )\n}\n\ntype HomeCardProps = {\n item: MemberPopupItem\n onAction: (type: MemberPopupActionType, url?: string) => void\n rounded: boolean\n}\n\nfunction HomeCard({ item, onAction, rounded }: HomeCardProps) {\n const ACTION_ICON: Partial<Record<MemberPopupActionType, typeof IconCredit>> = {\n [MemberPopupActionType.OpenEarnCredits]: IconCredit,\n [MemberPopupActionType.OpenConsumeCredits]: IconBag,\n [MemberPopupActionType.OpenReferral]: IconReferral,\n [MemberPopupActionType.OpenSubscribe]: IconSubscription,\n }\n\n return (\n <div className={cn('flex flex-col gap-[16px] bg-[#f5f6f7] p-[16px]', rounded ? 'rounded-[8px]' : 'rounded-none')}>\n <div className=\"flex flex-col gap-[4px]\">\n <h3 className=\"text-[20px] font-[700] leading-[1.2] text-[#1e2024]\">{item.title}</h3>\n {item.description && <p className=\"text-[14px] font-[700] leading-[1.43] text-[#1e2024]\">{item.description}</p>}\n </div>\n\n <div className=\"flex flex-col gap-[16px]\">\n {item.links.map((link, i) => {\n const IconComponent = ACTION_ICON[link.type]\n return (\n <div key={i}>\n {i > 0 && <div className=\"mb-[16px] h-px bg-[#dadce0]\" />}\n <button\n className=\"flex w-full cursor-pointer items-center gap-[12px]\"\n onClick={() => onAction(link.type, link.url)}\n >\n {IconComponent && <IconComponent className=\"size-[24px] shrink-0\" />}\n <span className=\"flex-1 text-left text-[14px] font-[700] text-[#1e2024]\">{link.label}</span>\n <IconArrow className=\"size-[16px] shrink-0\" />\n </button>\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["MemberPopup_exports", "__export", "MemberPopup", "__toCommonJS", "import_jsx_runtime", "import_react", "import_headless_ui", "import_lib", "import_type", "import_provider", "import_viewStack", "import_icons", "import_constants", "EarnCredits", "ConsumeCredits", "Referral", "CompleteProfilePanel", "ActivitiesSubscribePanel", "SubscribeEmailPanel", "ActivatePanel", "RedeemCouponPanel", "copy", "bottomOffset", "providerProps", "isVisible", "setIsVisible", "config", "pathname", "matches", "page", "MemberPopupContent", "profile", "openSignInPopup", "openSignUpPopup", "brand", "rounded", "isLogin", "isOpen", "setIsOpen", "viewStack", "setViewStack", "currentView", "pushView", "view", "prev", "popView", "MEMBER_POPUP_INFO", "trackLpButton", "position", "buttonName", "handleAction", "type", "url", "handleClose", "e", "cn", "item", "i", "HomeCard", "next", "onAction", "ACTION_ICON", "link", "IconComponent"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { lazy, Suspense, useState, useCallback, useEffect, type CSSProperties } from 'react'\nimport { Picture } from '@anker-in/headless-ui'\nimport { gaTrack, type HeadlessConfig, useHeadlessContext, classNames as cn } from '@anker-in/lib'\nimport {\n MemberPopupActionType,\n MemberPopupPageScope,\n MemberPopupPanelType,\n type MemberPopupCopy,\n type MemberPopupContextValue,\n type MemberPopupItem,\n} from './type'\nimport { MemberPopupProvider } from './context/provider'\nimport { useMemberPopupContext } from './context/provider'\nimport { ViewStackContext, type ViewPayload } from './context/viewStack'\nimport { IconClose, IconArrow, IconCredit, IconBag, IconReferral, IconSwitch, IconSubscription } from './icons'\nimport { ROUNDED_BRANDS } from '../../constants'\n\nconst EarnCredits = lazy(() => import('./panels/EarnCredits'))\nconst ConsumeCredits = lazy(() => import('./panels/ConsumeCredits'))\nconst Referral = lazy(() => import('./panels/Referral'))\nconst CompleteProfilePanel = lazy(() => import('./panels/EarnCredits/CompleteProfilePanel'))\nconst ActivitiesSubscribePanel = lazy(() => import('./panels/ActivitiesSubscribePanel'))\nconst SubscribeEmailPanel = lazy(() => import('./panels/EarnCredits/SubscribeEmailPanel'))\nconst ActivatePanel = lazy(() => import('./panels/EarnCredits/ActivatePanel'))\nconst RedeemCouponPanel = lazy(() => import('./panels/ConsumeCredits/RedeemCouponPanel'))\n\ntype MemberPopupProps = MemberPopupContextValue & {\n headlessConfig: HeadlessConfig\n copy: MemberPopupCopy\n bottomOffset?: string\n}\n\nexport function MemberPopup({ copy, bottomOffset = '24px', ...providerProps }: MemberPopupProps) {\n const [isVisible, setIsVisible] = useState(false)\n const effectiveBottomOffset = copy.bottomOffset ?? bottomOffset\n\n useEffect(() => {\n const config = copy.pageConfig\n if (!config) {\n setIsVisible(true)\n return\n }\n const pathname = window.location.pathname\n const matches = config.pages.some(page => pathname === page || pathname.startsWith(page + '/'))\n switch (config.scope) {\n case MemberPopupPageScope.Include:\n setIsVisible(matches)\n break\n case MemberPopupPageScope.Exclude:\n setIsVisible(!matches)\n break\n default:\n setIsVisible(true)\n }\n }, [copy.pageConfig])\n\n return isVisible ? (\n <MemberPopupProvider {...providerProps} earnCreditsCopy={copy.earnCredits}>\n <MemberPopupContent copy={copy} bottomOffset={effectiveBottomOffset} />\n </MemberPopupProvider>\n ) : null\n}\n\ntype MemberPopupContentProps = {\n copy: MemberPopupCopy\n bottomOffset: string\n}\n\nfunction MemberPopupContent({ copy, bottomOffset }: MemberPopupContentProps) {\n const { profile, openSignInPopup, openSignUpPopup } = useMemberPopupContext()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n const [isOpen, setIsOpen] = useState(false)\n const [viewStack, setViewStack] = useState<ViewPayload[]>([])\n\n const currentView = viewStack[viewStack.length - 1] ?? null\n\n const pushView = useCallback((view: ViewPayload) => {\n setViewStack(prev => [...prev, view])\n }, [])\n\n const popView = useCallback(() => {\n setViewStack(prev => prev.slice(0, -1))\n }, [])\n\n const MEMBER_POPUP_INFO = 'Member Floating Window'\n\n function trackLpButton(position: string, buttonName: string) {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n position,\n button_name: buttonName,\n info: MEMBER_POPUP_INFO,\n },\n })\n }\n\n function handleAction(type: MemberPopupActionType, url?: string) {\n switch (type) {\n case MemberPopupActionType.ExternalLink:\n if (url) window.open(url, '_blank', 'noopener,noreferrer')\n break\n case MemberPopupActionType.OpenEarnCredits:\n trackLpButton('home', 'earn_credits')\n pushView({ type: MemberPopupPanelType.EarnCredits })\n break\n case MemberPopupActionType.OpenConsumeCredits:\n trackLpButton('home', 'consume_credits')\n pushView({ type: MemberPopupPanelType.ConsumeCredits })\n break\n case MemberPopupActionType.OpenReferral:\n trackLpButton('home', 'referral')\n pushView({ type: MemberPopupPanelType.Referral })\n break\n case MemberPopupActionType.OpenSubscribe:\n trackLpButton('home', 'subscribe')\n pushView({ type: MemberPopupPanelType.Subscribe })\n break\n }\n }\n\n function handleClose() {\n setIsOpen(false)\n setViewStack([])\n }\n\n return (\n <ViewStackContext.Provider value={{ pushView, popView }}>\n {isOpen && <div className=\"fixed inset-0 z-[998]\" onClick={handleClose} />}\n <div\n className=\"fixed right-0 z-[999] flex flex-row items-end pr-[20px] md:flex-col md:items-end md:right-0 md:w-screen md:pr-0 md:pl-0\"\n style={{ bottom: bottomOffset }}\n >\n {isOpen && (\n <div className=\"relative mr-[12px] md:mr-[12px] md:mb-[12px]\" onClick={e => e.stopPropagation()}>\n <div className=\"absolute right-[-7px] bottom-[24px] size-0 border-y-8 border-l-8 border-r-0 border-y-transparent border-l-white md:bottom-[-8px] md:right-[25px] md:top-auto md:border-y-0 md:border-l-8 md:border-r-8 md:border-t-8 md:border-l-transparent md:border-r-transparent md:border-t-white\" />\n <div\n className={cn(\n 'flex w-[420px] max-w-[calc(100vw-32px)] min-h-[500px] flex-col overflow-hidden bg-white shadow-[0_8px_32px_rgba(0,0,0,0.16)] md:w-[calc(100vw-32px)] md:max-w-[400px]',\n rounded ? 'rounded-[12px]' : 'rounded-none'\n )}\n style={{ maxHeight: 'min(80vh, 606px)' }}\n >\n <div className=\"flex items-center justify-end pl-[10px] pr-[16px] pb-[8px] pt-[16px]\">\n {currentView !== null && (\n <button\n className=\"mr-auto flex size-[24px] cursor-pointer items-center justify-center\"\n onClick={popView}\n aria-label=\"Back\"\n >\n <IconSwitch />\n </button>\n )}\n <button\n className=\"flex size-[24px] cursor-pointer items-center justify-center\"\n onClick={() => {\n trackLpButton('floating_button', 'close')\n handleClose()\n }}\n aria-label=\"Close\"\n >\n <IconClose />\n </button>\n </div>\n\n <div className=\"flex flex-1 flex-col gap-[12px] overflow-y-auto p-[16px]\">\n {currentView === null && (\n <>\n {(copy.title || copy.subtitle) && (\n <div className=\"flex flex-col gap-[4px]\">\n {copy.title && (\n <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>\n )}\n {copy.subtitle && (\n <p className=\"text-[16px] font-[700] leading-snug text-[#4a4c56]\">{copy.subtitle}</p>\n )}\n </div>\n )}\n {copy.list.map((item, i) => (\n <HomeCard key={i} item={item} onAction={handleAction} rounded={rounded} />\n ))}\n </>\n )}\n\n {currentView !== null && (\n <Suspense\n fallback={\n <div className=\"flex items-center justify-center py-[32px]\">\n <div className=\"size-[32px] animate-spin rounded-full border-[3px] border-[#080a0f] border-t-transparent\" />\n </div>\n }\n >\n {currentView.type === MemberPopupPanelType.EarnCredits && copy.earnCredits && (\n <EarnCredits copy={copy.earnCredits} />\n )}\n {currentView.type === MemberPopupPanelType.ConsumeCredits && copy.consumeCredits && (\n <ConsumeCredits copy={copy.consumeCredits} />\n )}\n {currentView.type === MemberPopupPanelType.Referral && copy.referral && (\n <Referral copy={copy.referral} onClose={popView} />\n )}\n {currentView.type === MemberPopupPanelType.CompleteProfile && copy.earnCredits && (\n <CompleteProfilePanel copy={copy.earnCredits.completeProfile} onClose={popView} />\n )}\n {currentView.type === MemberPopupPanelType.Subscribe && copy.activitiesSubscribe && (\n <ActivitiesSubscribePanel copy={copy.activitiesSubscribe} email={profile?.email} />\n )}\n {currentView.type === MemberPopupPanelType.SubscribeEmail && copy.earnCredits && (\n <SubscribeEmailPanel copy={copy.earnCredits.subscribe} email={profile?.email} onClose={popView} />\n )}\n {currentView.type === MemberPopupPanelType.Activate && copy.earnCredits && (\n <ActivatePanel copy={copy.earnCredits.authCodeActivate} onClose={popView} />\n )}\n {currentView.type === MemberPopupPanelType.RedeemCoupon &&\n currentView.props &&\n copy.consumeCredits && (\n <RedeemCouponPanel\n item={currentView.props as any}\n copy={copy.consumeCredits}\n onClose={popView}\n />\n )}\n </Suspense>\n )}\n </div>\n\n {copy.footer && !isLogin && (\n <div className=\"border-t border-[#dadce0] p-[16px]\">\n <div className=\"flex items-center justify-between gap-[16px]\">\n <div className=\"inline gap-[4px]\">\n <span className=\"text-[14px] font-[700] text-[#080a0f]\">{copy.footer.loginHint}</span>\n <button\n className=\"cursor-pointer ml-[4px] text-[14px] font-bold text-[#080a0f] underline\"\n onClick={openSignInPopup}\n >\n {copy.footer.loginLabel}\n </button>\n </div>\n <div className=\"flex shrink-0 items-center gap-[8px]\">\n <button\n className={cn(\n 'cursor-pointer border-[1.6px] border-[#080a0f] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-[#080a0f]',\n rounded ? 'rounded-[4px]' : 'rounded-none'\n )}\n onClick={openSignUpPopup}\n >\n {copy.footer.joinLabel}\n </button>\n </div>\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n\n <button\n className=\"flex cursor-pointer items-center justify-center rounded-full bg-white shadow-lg md:ml-auto md:mr-[16px]\"\n onClick={() => {\n const next = !isOpen\n trackLpButton('floating_button', next ? 'open' : 'close')\n setIsOpen(next)\n }}\n aria-label={copy.triggerImg.alt ?? 'Open member popup'}\n >\n <div\n className=\"size-[var(--member-popup-pc-icon-size)] md:size-[var(--member-popup-mobile-icon-size)]\"\n style={\n {\n '--member-popup-pc-icon-size': copy.pcIconSize ?? '58px',\n '--member-popup-mobile-icon-size': copy.mobileIconSize ?? copy.pcIconSize ?? '58px',\n } as CSSProperties\n }\n >\n <Picture source={copy.triggerImg.url} alt={copy.triggerImg.alt ?? ''} className=\"size-full\" />\n </div>\n </button>\n </div>\n </ViewStackContext.Provider>\n )\n}\n\ntype HomeCardProps = {\n item: MemberPopupItem\n onAction: (type: MemberPopupActionType, url?: string) => void\n rounded: boolean\n}\n\nfunction HomeCard({ item, onAction, rounded }: HomeCardProps) {\n const ACTION_ICON: Partial<Record<MemberPopupActionType, typeof IconCredit>> = {\n [MemberPopupActionType.OpenEarnCredits]: IconCredit,\n [MemberPopupActionType.OpenConsumeCredits]: IconBag,\n [MemberPopupActionType.OpenReferral]: IconReferral,\n [MemberPopupActionType.OpenSubscribe]: IconSubscription,\n }\n\n return (\n <div className={cn('flex flex-col gap-[16px] bg-[#f5f6f7] p-[16px]', rounded ? 'rounded-[8px]' : 'rounded-none')}>\n <div className=\"flex flex-col gap-[4px]\">\n <h3 className=\"text-[20px] font-[700] leading-[1.2] text-[#1e2024]\">{item.title}</h3>\n {item.description && <p className=\"text-[14px] font-[700] leading-[1.43] text-[#1e2024]\">{item.description}</p>}\n </div>\n\n <div className=\"flex flex-col gap-[16px]\">\n {item.links.map((link, i) => {\n const IconComponent = ACTION_ICON[link.type]\n return (\n <div key={i}>\n {i > 0 && <div className=\"mb-[16px] h-px bg-[#dadce0]\" />}\n <button\n className=\"flex w-full cursor-pointer items-center gap-[12px]\"\n onClick={() => onAction(link.type, link.url)}\n >\n {IconComponent && <IconComponent className=\"size-[24px] shrink-0\" />}\n <span className=\"flex-1 text-left text-[14px] font-[700] text-[#1e2024]\">{link.label}</span>\n <IconArrow className=\"size-[16px] shrink-0\" />\n </button>\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GA4DM,IAAAI,EAAA,6BA1DNC,EAAqF,iBACrFC,EAAwB,iCACxBC,EAAmF,yBACnFC,EAOO,kBACPC,EAAoC,8BACpCA,EAAsC,8BACtCC,EAAmD,+BACnDC,EAAsG,mBACtGC,EAA+B,2BAE/B,MAAMC,KAAc,QAAK,IAAM,OAAO,sBAAsB,CAAC,EACvDC,KAAiB,QAAK,IAAM,OAAO,yBAAyB,CAAC,EAC7DC,KAAW,QAAK,IAAM,OAAO,mBAAmB,CAAC,EACjDC,KAAuB,QAAK,IAAM,OAAO,2CAA2C,CAAC,EACrFC,KAA2B,QAAK,IAAM,OAAO,mCAAmC,CAAC,EACjFC,KA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AAU,YAAY,EAC9F,EACF,GACF,GACF,CAEJ,CAQA,SAASsC,EAAS,CAAE,KAAAF,EAAM,SAAAI,EAAU,QAAAzB,CAAQ,EAAkB,CAC5D,MAAM0B,EAAyE,CAC7E,CAAC,wBAAsB,eAAe,EAAG,aACzC,CAAC,wBAAsB,kBAAkB,EAAG,UAC5C,CAAC,wBAAsB,YAAY,EAAG,eACtC,CAAC,wBAAsB,aAAa,EAAG,kBACzC,EAEA,SACE,QAAC,OAAI,aAAW,EAAAN,YAAG,iDAAkDpB,EAAU,gBAAkB,cAAc,EAC7G,qBAAC,OAAI,UAAU,0BACb,oBAAC,MAAG,UAAU,sDAAuD,SAAAqB,EAAK,MAAM,EAC/EA,EAAK,gBAAe,OAAC,KAAE,UAAU,uDAAwD,SAAAA,EAAK,YAAY,GAC7G,KAEA,OAAC,OAAI,UAAU,2BACZ,SAAAA,EAAK,MAAM,IAAI,CAACM,EAAML,IAAM,CAC3B,MAAMM,EAAgBF,EAAYC,EAAK,IAAI,EAC3C,SACE,QAAC,OACE,UAAAL,EAAI,MAAK,OAAC,OAAI,UAAU,8BAA8B,KACvD,QAAC,UACC,UAAU,qDACV,QAAS,IAAMG,EAASE,EAAK,KAAMA,EAAK,GAAG,EAE1C,UAAAC,MAAiB,OAACA,EAAA,CAAc,UAAU,uBAAuB,KAClE,OAAC,QAAK,UAAU,yDAA0D,SAAAD,EAAK,MAAM,KACrF,OAAC,aAAU,UAAU,uBAAuB,GAC9C,IATQL,CAUV,CAEJ,CAAC,EACH,GACF,CAEJ",
|
|
6
|
+
"names": ["MemberPopup_exports", "__export", "MemberPopup", "__toCommonJS", "import_jsx_runtime", "import_react", "import_headless_ui", "import_lib", "import_type", "import_provider", "import_viewStack", "import_icons", "import_constants", "EarnCredits", "ConsumeCredits", "Referral", "CompleteProfilePanel", "ActivitiesSubscribePanel", "SubscribeEmailPanel", "ActivatePanel", "RedeemCouponPanel", "copy", "bottomOffset", "providerProps", "isVisible", "setIsVisible", "effectiveBottomOffset", "config", "pathname", "matches", "page", "MemberPopupContent", "profile", "openSignInPopup", "openSignUpPopup", "brand", "rounded", "isLogin", "isOpen", "setIsOpen", "viewStack", "setViewStack", "currentView", "pushView", "view", "prev", "popView", "MEMBER_POPUP_INFO", "trackLpButton", "position", "buttonName", "handleAction", "type", "url", "handleClose", "e", "cn", "item", "i", "HomeCard", "next", "onAction", "ACTION_ICON", "link", "IconComponent"]
|
|
7
7
|
}
|
|
@@ -75,6 +75,12 @@ export type MemberPopupCopy = {
|
|
|
75
75
|
referral?: ReferralCopy;
|
|
76
76
|
/** 页面覆盖范围配置,默认全局展示 */
|
|
77
77
|
pageConfig?: MemberPopupPageConfig;
|
|
78
|
+
/** 悬浮窗距离底部的距离,设置后优先于组件 bottomOffset prop(默认 '24px') */
|
|
79
|
+
bottomOffset?: string;
|
|
80
|
+
/** 触发按钮图标尺寸(PC 端,默认 '58px') */
|
|
81
|
+
pcIconSize?: string;
|
|
82
|
+
/** 触发按钮图标尺寸(移动端,默认 '58px') */
|
|
83
|
+
mobileIconSize?: string;
|
|
78
84
|
};
|
|
79
85
|
export type EarnCreditsCopy = {
|
|
80
86
|
title?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var m=(r,e)=>{for(var o in e)g(r,o,{get:e[o],enumerable:!0})},f=(r,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of b(e))!C.call(r,t)&&t!==o&&g(r,t,{get:()=>e[t],enumerable:!(s=u(e,t))||s.enumerable});return r};var E=r=>f(g({},"__esModule",{value:!0}),r);var L={};m(L,{ConsumeCreditsItemType:()=>p,EarnCreditsTaskType:()=>c,MemberPopupActionType:()=>a,MemberPopupPageScope:()=>d,MemberPopupPanelType:()=>l});module.exports=E(L);var l=(i=>(i.EarnCredits="EARN_CREDITS",i.ConsumeCredits="CONSUME_CREDITS",i.Referral="REFERRAL",i.CompleteProfile="COMPLETE_PROFILE",i.Subscribe="SUBSCRIBE",i.SubscribeEmail="SUBSCRIBE_EMAIL",i.RedeemCoupon="REDEEM_COUPON",i.Activate="ACTIVATE",i))(l||{}),a=(n=>(n.ExternalLink="EXTERNAL_LINK",n.OpenEarnCredits="OPEN_EARN_CREDITS",n.OpenConsumeCredits="OPEN_CONSUME_CREDITS",n.OpenReferral="OPEN_REFERRAL",n.OpenSubscribe="OPEN_SUBSCRIBE",n))(a||{}),c=(t=>(t.Activate="activate",t.CompleteProfile="completeProfile",t.Subscribe="subscribe",t.Shop="shop",t))(c||{}),p=(t=>(t.Coupon="COUPON",t.RedeemAndBuy="REDEEM_AND_BUY",t.GiftCard="GIFT_CARD",t.Product="PRODUCT",t))(p||{}),d=(s=>(s.Global="GLOBAL",s.Include="INCLUDE",s.Exclude="EXCLUDE",s))(d||{});
|
|
2
2
|
//# sourceMappingURL=type.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/memberPopup/type.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AuthCodeActivateCopy } from '../registration/authCodeActivate/type'\nimport type { CreditInfoResponse } from '../credits/context/response'\nimport type { DTC_TASK_TYPE } from '../credits/context/const'\n\nexport type { AuthCodeActivateCopy }\n\n// \u2500\u2500\u2500 \u9762\u677F\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPanelType {\n EarnCredits = 'EARN_CREDITS',\n ConsumeCredits = 'CONSUME_CREDITS',\n Referral = 'REFERRAL',\n CompleteProfile = 'COMPLETE_PROFILE',\n Subscribe = 'SUBSCRIBE',\n SubscribeEmail = 'SUBSCRIBE_EMAIL',\n RedeemCoupon = 'REDEEM_COUPON',\n Activate = 'ACTIVATE',\n}\n\n// \u2500\u2500\u2500 item action \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupActionType {\n ExternalLink = 'EXTERNAL_LINK',\n OpenEarnCredits = 'OPEN_EARN_CREDITS',\n OpenConsumeCredits = 'OPEN_CONSUME_CREDITS',\n OpenReferral = 'OPEN_REFERRAL',\n OpenSubscribe = 'OPEN_SUBSCRIBE',\n}\n\n// \u2500\u2500\u2500 EarnCredits \u4EFB\u52A1\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum EarnCreditsTaskType {\n Activate = 'activate',\n CompleteProfile = 'completeProfile',\n Subscribe = 'subscribe',\n Shop = 'shop',\n}\n\n// \u2500\u2500\u2500 ConsumeCredits item \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum ConsumeCreditsItemType {\n Coupon = 'COUPON',\n RedeemAndBuy = 'REDEEM_AND_BUY',\n GiftCard = 'GIFT_CARD',\n Product = 'PRODUCT',\n}\n\n// \u2500\u2500\u2500 \u901A\u7528 link\uFF08\u7EDF\u4E00\u4E00\u79CD\u7C7B\u578B\uFF09 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupLink = {\n type: MemberPopupActionType\n label: string\n url?: string // \u4EC5 ExternalLink \u65F6\u4F7F\u7528\n}\n\n// \u2500\u2500\u2500 list item \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupItem = {\n title: string\n description?: string\n links: MemberPopupLink[]\n}\n\n// \u2500\u2500 \u4E3B\u7EC4\u4EF6 Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPageScope {\n /** \u5168\u5C40\u5C55\u793A */\n Global = 'GLOBAL',\n /** \u4EC5\u5728\u7279\u5B9A\u9875\u9762\u5C55\u793A */\n Include = 'INCLUDE',\n /** \u5728\u7279\u5B9A\u9875\u9762\u4E0D\u5C55\u793A */\n Exclude = 'EXCLUDE',\n}\n\nexport type MemberPopupPageConfig = {\n scope: MemberPopupPageScope\n /** \u9875\u9762\u8DEF\u5F84\u5217\u8868\uFF0C\u652F\u6301\u7CBE\u786E\u5339\u914D\u548C\u524D\u7F00\u5339\u914D\uFF08\u5982 \"/products\" \u4F1A\u5339\u914D \"/products/xxx\"\uFF09 */\n pages: string[]\n}\n\nexport type MemberPopupCopy = {\n triggerImg: { url: string; alt?: string }\n title?: string\n subtitle?: string\n list: MemberPopupItem[]\n footer?: {\n loginHint: string\n loginLabel: string\n joinLabel: string\n shopLabel: string\n shopUrl?: string\n }\n activitiesSubscribe?: SubscribeModalCopy\n earnCredits?: EarnCreditsCopy\n consumeCredits?: ConsumeCreditsopy\n referral?: ReferralCopy\n /** \u9875\u9762\u8986\u76D6\u8303\u56F4\u914D\u7F6E\uFF0C\u9ED8\u8BA4\u5168\u5C40\u5C55\u793A */\n pageConfig?: MemberPopupPageConfig\n}\n\n// \u2500\u2500\u2500 EarnCredits Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type EarnCreditsCopy = {\n title?: string\n subtitle?: string\n balanceLabel?: string\n comingSoonLabel?: string\n creditUnit?: string\n joinNow: string\n completed: string\n activate: string\n completeProfileLabel: string\n subscribeLabel: string\n shopNow: string\n goShopLink?: string\n list: {\n id: EarnCreditsTaskType\n title: string\n credits?: string\n }[]\n // \u5B50\u5F39\u7A97\u6587\u6848\n authCodeActivate: AuthCodeActivateCopy\n completeProfile: CompleteProfileCopy\n subscribe: SubscribeModalCopy\n}\n\nexport type CompleteProfileCopy = {\n title: string\n subtitle?: string\n firstName: string\n lastName: string\n email: string\n phone: string\n birthday: string\n country: string\n save: string\n cancel: string\n edit: string\n required: string\n}\n\nexport type SubscribeModalCopy = {\n title: string\n desc?: string\n placeholder: string\n policy?: string\n policyDefaultChecked?: boolean\n successTips?: string\n subscribedLabel?: string\n dealsType?: string\n buttonLabel?: string\n single_brand_subscribe?: boolean\n genre?: string\n sub_brand_type?: string\n promo?: {\n title?: string\n description?: string\n learnMoreLabel?: string\n learnMoreUrl?: string\n image?: { url: string; alt?: string }\n }\n}\n\n// \u2500\u2500\u2500 ConsumeCredits Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type ConsumeCreditsopy = {\n title?: string\n subtitle?: string\n soldOut: string\n unlockRewards: string\n btnRedeem: string\n insufficientCredits?: string\n balanceLabel?: string\n comingSoonLabel?: string\n creditUnit?: string\n off?: string\n giftCard?: string\n imageMapping?: {\n [key in ConsumeCreditsItemType]?: { url: string }\n }\n list: ConsumeCreditsItem[]\n redeemModal: RedeemCouponModalCopy\n creditsPage?: { label: string; url: string; redeemListSectionId?: string }\n}\n\nexport type ConsumeCreditsItem = {\n redeemId: string | number\n title: string\n description?: string\n image: { url: string; alt?: string }\n type: ConsumeCreditsItemType\n product?: { handle: string; sku: string }\n price?: number\n value?: string\n rules?: string[]\n}\n\nexport type RedeemCouponModalCopy = {\n confirmTitle: string\n confirmButton: string\n off?: string\n commonError: string\n redeemLimitError: string\n inventoryNotEnough: string\n creditsNotEnough: string\n crossSiteError: string\n successTitle: string\n successDesc: string\n successButton: string\n successButtonUrl?: string\n copyLabel?: string\n copiedLabel?: string\n}\n\n// \u2500\u2500\u2500 Referral Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type ReferralCopy = {\n title?: string\n description?: string\n cashAvailableLabel: string\n cashPendingLabel: string\n creditUnit?: string\n referralLinksLabel?: string\n referralLinkBaseUrl?: string\n copyLabel?: string\n copiedLabel?: string\n howToTitle?: string\n howToDescription?: string\n learnMoreLabel?: string\n learnMoreUrl?: string\n image?: { url: string; alt?: string }\n ctaButton: string\n ctaUrl?: string\n loginTitle?: string\n loginDescription?: string\n loginCtaLabel?: string\n}\n\n// \u2500\u2500\u2500 Provider Context \u7C7B\u578B \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type AlpcConfig = {\n brand: string\n locale: string\n appName: string\n apiBaseUrl?: string\n}\n\nexport type MemberPopupContextValue = {\n profile: any\n isLoadingProfile: boolean\n creditInfo?: CreditInfoResponse\n fetchCreditInfo: (userId: string) => void\n openSignUpPopup: () => void\n openSignInPopup: () => void\n taskIdToTypeMapping?: Record<string, DTC_TASK_TYPE>\n alpcConfig: AlpcConfig\n pageHandle?: string\n}\n\nexport type MemberPopupInternalContextValue = MemberPopupContextValue & {\n isSubscribeSuccess: boolean\n setIsSubscribeSuccess: (v: boolean) => void\n isActivateSuccess: boolean\n setIsActivateSuccess: (v: boolean) => void\n isProfileCompleteSuccess: boolean\n setIsProfileCompleteSuccess: (v: boolean) => void\n}\n"],
|
|
4
|
+
"sourcesContent": ["import type { AuthCodeActivateCopy } from '../registration/authCodeActivate/type'\nimport type { CreditInfoResponse } from '../credits/context/response'\nimport type { DTC_TASK_TYPE } from '../credits/context/const'\n\nexport type { AuthCodeActivateCopy }\n\n// \u2500\u2500\u2500 \u9762\u677F\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPanelType {\n EarnCredits = 'EARN_CREDITS',\n ConsumeCredits = 'CONSUME_CREDITS',\n Referral = 'REFERRAL',\n CompleteProfile = 'COMPLETE_PROFILE',\n Subscribe = 'SUBSCRIBE',\n SubscribeEmail = 'SUBSCRIBE_EMAIL',\n RedeemCoupon = 'REDEEM_COUPON',\n Activate = 'ACTIVATE',\n}\n\n// \u2500\u2500\u2500 item action \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupActionType {\n ExternalLink = 'EXTERNAL_LINK',\n OpenEarnCredits = 'OPEN_EARN_CREDITS',\n OpenConsumeCredits = 'OPEN_CONSUME_CREDITS',\n OpenReferral = 'OPEN_REFERRAL',\n OpenSubscribe = 'OPEN_SUBSCRIBE',\n}\n\n// \u2500\u2500\u2500 EarnCredits \u4EFB\u52A1\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum EarnCreditsTaskType {\n Activate = 'activate',\n CompleteProfile = 'completeProfile',\n Subscribe = 'subscribe',\n Shop = 'shop',\n}\n\n// \u2500\u2500\u2500 ConsumeCredits item \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum ConsumeCreditsItemType {\n Coupon = 'COUPON',\n RedeemAndBuy = 'REDEEM_AND_BUY',\n GiftCard = 'GIFT_CARD',\n Product = 'PRODUCT',\n}\n\n// \u2500\u2500\u2500 \u901A\u7528 link\uFF08\u7EDF\u4E00\u4E00\u79CD\u7C7B\u578B\uFF09 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupLink = {\n type: MemberPopupActionType\n label: string\n url?: string // \u4EC5 ExternalLink \u65F6\u4F7F\u7528\n}\n\n// \u2500\u2500\u2500 list item \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupItem = {\n title: string\n description?: string\n links: MemberPopupLink[]\n}\n\n// \u2500\u2500 \u4E3B\u7EC4\u4EF6 Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPageScope {\n /** \u5168\u5C40\u5C55\u793A */\n Global = 'GLOBAL',\n /** \u4EC5\u5728\u7279\u5B9A\u9875\u9762\u5C55\u793A */\n Include = 'INCLUDE',\n /** \u5728\u7279\u5B9A\u9875\u9762\u4E0D\u5C55\u793A */\n Exclude = 'EXCLUDE',\n}\n\nexport type MemberPopupPageConfig = {\n scope: MemberPopupPageScope\n /** \u9875\u9762\u8DEF\u5F84\u5217\u8868\uFF0C\u652F\u6301\u7CBE\u786E\u5339\u914D\u548C\u524D\u7F00\u5339\u914D\uFF08\u5982 \"/products\" \u4F1A\u5339\u914D \"/products/xxx\"\uFF09 */\n pages: string[]\n}\n\nexport type MemberPopupCopy = {\n triggerImg: { url: string; alt?: string }\n title?: string\n subtitle?: string\n list: MemberPopupItem[]\n footer?: {\n loginHint: string\n loginLabel: string\n joinLabel: string\n shopLabel: string\n shopUrl?: string\n }\n activitiesSubscribe?: SubscribeModalCopy\n earnCredits?: EarnCreditsCopy\n consumeCredits?: ConsumeCreditsopy\n referral?: ReferralCopy\n /** \u9875\u9762\u8986\u76D6\u8303\u56F4\u914D\u7F6E\uFF0C\u9ED8\u8BA4\u5168\u5C40\u5C55\u793A */\n pageConfig?: MemberPopupPageConfig\n /** \u60AC\u6D6E\u7A97\u8DDD\u79BB\u5E95\u90E8\u7684\u8DDD\u79BB\uFF0C\u8BBE\u7F6E\u540E\u4F18\u5148\u4E8E\u7EC4\u4EF6 bottomOffset prop\uFF08\u9ED8\u8BA4 '24px'\uFF09 */\n bottomOffset?: string\n /** \u89E6\u53D1\u6309\u94AE\u56FE\u6807\u5C3A\u5BF8\uFF08PC \u7AEF\uFF0C\u9ED8\u8BA4 '58px'\uFF09 */\n pcIconSize?: string\n /** \u89E6\u53D1\u6309\u94AE\u56FE\u6807\u5C3A\u5BF8\uFF08\u79FB\u52A8\u7AEF\uFF0C\u9ED8\u8BA4 '58px'\uFF09 */\n mobileIconSize?: string\n}\n\n// \u2500\u2500\u2500 EarnCredits Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type EarnCreditsCopy = {\n title?: string\n subtitle?: string\n balanceLabel?: string\n comingSoonLabel?: string\n creditUnit?: string\n joinNow: string\n completed: string\n activate: string\n completeProfileLabel: string\n subscribeLabel: string\n shopNow: string\n goShopLink?: string\n list: {\n id: EarnCreditsTaskType\n title: string\n credits?: string\n }[]\n // \u5B50\u5F39\u7A97\u6587\u6848\n authCodeActivate: AuthCodeActivateCopy\n completeProfile: CompleteProfileCopy\n subscribe: SubscribeModalCopy\n}\n\nexport type CompleteProfileCopy = {\n title: string\n subtitle?: string\n firstName: string\n lastName: string\n email: string\n phone: string\n birthday: string\n country: string\n save: string\n cancel: string\n edit: string\n required: string\n}\n\nexport type SubscribeModalCopy = {\n title: string\n desc?: string\n placeholder: string\n policy?: string\n policyDefaultChecked?: boolean\n successTips?: string\n subscribedLabel?: string\n dealsType?: string\n buttonLabel?: string\n single_brand_subscribe?: boolean\n genre?: string\n sub_brand_type?: string\n promo?: {\n title?: string\n description?: string\n learnMoreLabel?: string\n learnMoreUrl?: string\n image?: { url: string; alt?: string }\n }\n}\n\n// \u2500\u2500\u2500 ConsumeCredits Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type ConsumeCreditsopy = {\n title?: string\n subtitle?: string\n soldOut: string\n unlockRewards: string\n btnRedeem: string\n insufficientCredits?: string\n balanceLabel?: string\n comingSoonLabel?: string\n creditUnit?: string\n off?: string\n giftCard?: string\n imageMapping?: {\n [key in ConsumeCreditsItemType]?: { url: string }\n }\n list: ConsumeCreditsItem[]\n redeemModal: RedeemCouponModalCopy\n creditsPage?: { label: string; url: string; redeemListSectionId?: string }\n}\n\nexport type ConsumeCreditsItem = {\n redeemId: string | number\n title: string\n description?: string\n image: { url: string; alt?: string }\n type: ConsumeCreditsItemType\n product?: { handle: string; sku: string }\n price?: number\n value?: string\n rules?: string[]\n}\n\nexport type RedeemCouponModalCopy = {\n confirmTitle: string\n confirmButton: string\n off?: string\n commonError: string\n redeemLimitError: string\n inventoryNotEnough: string\n creditsNotEnough: string\n crossSiteError: string\n successTitle: string\n successDesc: string\n successButton: string\n successButtonUrl?: string\n copyLabel?: string\n copiedLabel?: string\n}\n\n// \u2500\u2500\u2500 Referral Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type ReferralCopy = {\n title?: string\n description?: string\n cashAvailableLabel: string\n cashPendingLabel: string\n creditUnit?: string\n referralLinksLabel?: string\n referralLinkBaseUrl?: string\n copyLabel?: string\n copiedLabel?: string\n howToTitle?: string\n howToDescription?: string\n learnMoreLabel?: string\n learnMoreUrl?: string\n image?: { url: string; alt?: string }\n ctaButton: string\n ctaUrl?: string\n loginTitle?: string\n loginDescription?: string\n loginCtaLabel?: string\n}\n\n// \u2500\u2500\u2500 Provider Context \u7C7B\u578B \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type AlpcConfig = {\n brand: string\n locale: string\n appName: string\n apiBaseUrl?: string\n}\n\nexport type MemberPopupContextValue = {\n profile: any\n isLoadingProfile: boolean\n creditInfo?: CreditInfoResponse\n fetchCreditInfo: (userId: string) => void\n openSignUpPopup: () => void\n openSignInPopup: () => void\n taskIdToTypeMapping?: Record<string, DTC_TASK_TYPE>\n alpcConfig: AlpcConfig\n pageHandle?: string\n}\n\nexport type MemberPopupInternalContextValue = MemberPopupContextValue & {\n isSubscribeSuccess: boolean\n setIsSubscribeSuccess: (v: boolean) => void\n isActivateSuccess: boolean\n setIsActivateSuccess: (v: boolean) => void\n isProfileCompleteSuccess: boolean\n setIsProfileCompleteSuccess: (v: boolean) => void\n}\n"],
|
|
5
5
|
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,EAAA,wBAAAC,EAAA,0BAAAC,EAAA,yBAAAC,EAAA,yBAAAC,IAAA,eAAAC,EAAAP,GAOO,IAAKM,OACVA,EAAA,YAAc,eACdA,EAAA,eAAiB,kBACjBA,EAAA,SAAW,WACXA,EAAA,gBAAkB,mBAClBA,EAAA,UAAY,YACZA,EAAA,eAAiB,kBACjBA,EAAA,aAAe,gBACfA,EAAA,SAAW,WARDA,OAAA,IAYAF,OACVA,EAAA,aAAe,gBACfA,EAAA,gBAAkB,oBAClBA,EAAA,mBAAqB,uBACrBA,EAAA,aAAe,gBACfA,EAAA,cAAgB,iBALNA,OAAA,IASAD,OACVA,EAAA,SAAW,WACXA,EAAA,gBAAkB,kBAClBA,EAAA,UAAY,YACZA,EAAA,KAAO,OAJGA,OAAA,IAQAD,OACVA,EAAA,OAAS,SACTA,EAAA,aAAe,iBACfA,EAAA,SAAW,YACXA,EAAA,QAAU,UAJAA,OAAA,IAsBAG,OAEVA,EAAA,OAAS,SAETA,EAAA,QAAU,UAEVA,EAAA,QAAU,UANAA,OAAA",
|
|
6
6
|
"names": ["type_exports", "__export", "ConsumeCreditsItemType", "EarnCreditsTaskType", "MemberPopupActionType", "MemberPopupPageScope", "MemberPopupPanelType", "__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=(r
|
|
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=(i,r)=>{for(var d in r)C(i,d,{get:r[d],enumerable:!0})},h=(i,r,d,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of E(r))!K.call(i,p)&&p!==d&&C(i,p,{get:()=>r[p],enumerable:!(t=W(r,p))||t.enumerable});return i};var T=(i,r,d)=>(d=i!=null?U(H(i)):{},h(r||!i||!i.__esModule?C(d,"default",{value:i,enumerable:!0}):d,i)),z=i=>h(C({},"__esModule",{value:!0}),i);var V={};Y(V,{CreditsTemplate:()=>Q});module.exports=z(V);var e=require("react/jsx-runtime"),c=require("@anker-in/lib"),l=require("react"),M=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"),A=require("../components/credits/creditsCash"),S=require("../components/credits/creditsMemberPrice"),D=require("../components/credits/creditsFaq"),N=require("../components/credits/creditsNavigation"),F=T(require("../components/credits/modal/ActivitiesModal")),q=T(require("../components/credits/modal/RewardsModal")),s=require("./Credits.types");const J=({headlessConfig:i,pageConfig:r,userContext:d})=>{const{openMyRewardsModal:t,setOpenMyRewardsModal:p,openActivitiesModal:m,setOpenActivitiesModal:y,pageCommon:n}=(0,f.useCreditsContext)(),u=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{if(u.current||typeof window>"u")return;const a=new URLSearchParams(window.location.search).get("section");if(!a)return;const x=56,g=(P=0)=>{const v=document.getElementById(a);if(v){u.current=!0;const O=v.getBoundingClientRect().top+window.pageYOffset-x;window.scrollTo({top:O,behavior:"smooth"})}else P<10&&setTimeout(()=>g(P+1),300)};g()},[]),(0,e.jsxs)(e.Fragment,{children:[r.components[s.ComponentKey.Navigation]&&(0,e.jsx)(N.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:i.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)(A.CreditsCash,{copy:a,id:o}),o===s.ComponentKey.MemberPrice&&(0,e.jsx)(S.CreditsMemberPrice,{copy:a,id:o}),o===s.ComponentKey.Faqs&&(0,e.jsx)(D.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:t,data:n.rewardsModal,onClose:()=>p(!1)})]})},Q=({headlessConfig:i,siteConfig:r,creditsConfig:d,userContext:t,pageConfig:p,registrationContext:m,gtm:y,cartConfig:n})=>(0,e.jsx)(c.HeadlessProvider,{headlessConfig:i,children:(0,e.jsx)(M.RegistrationProvider,{copy:r.registrationsSettings,email:t?.profile?.email,children:(0,e.jsx)(f.CreditsProvider,{profile:t?.profile,removeProfile:t?.removeProfile,isLoadingProfile:t?.isLoadingProfile,openSignInPopup:m.openSignInPopup,openSignUpPopup:m.openSignUpPopup,creditInfo:t?.creditInfo,taskIdToTypeMapping:r.taskIdToTypeMapping,customer:t?.customer,fetchCreditInfo:t?.fetchCreditInfo,customerLoading:t?.customerLoading,gtm:y,pageCommon:p.common,memberPriceDiscount:r.memberPriceDiscount,alpcBrand:d?.alpcBrand,alpcCountry:d?.alpcCountry,cartConfig:n,apiBaseUrl:t?.apiBaseUrl,children:(0,e.jsx)(J,{headlessConfig:i,pageConfig:p,userContext:t})})})});
|
|
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 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": "0jBAA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MH,EAAsB,EAAK,EAC5C,GAEJ,CAEJ,EAEazB,EAAkB,CAAC,CAC9B,eAAAqB,EACA,WAAAmB,EACA,cAAAC,EACA,YAAAlB,EACA,WAAAD,EACA,oBAAAoB,EACA,IAAAC,EACA,WAAAC,CACF,OAEI,OAAC,oBAAiB,eAAgBvB,EAChC,mBAAC,wBAAqB,KAAMmB,EAAW,sBAAuB,MAAOjB,GAAa,SAAS,MACzF,mBAAC,mBACC,QAASA,GAAa,QACtB,cAAeA,GAAa,cAC5B,iBAAkBA,GAAa,iBAC/B,gBAAiBmB,EAAoB,gBACrC,gBAAiBA,EAAoB,gBACrC,WAAYnB,GAAa,WACzB,oBAAqBiB,EAAW,oBAChC,SAAUjB,GAAa,SACvB,gBAAiBA,GAAa,gBAC9B,gBAAiBA,GAAa,gBAC9B,IAAKoB,EACL,WAAYrB,EAAW,OACvB,oBAAqBkB,EAAW,oBAChC,UAAWC,GAAe,UAC1B,WAAYG,EACZ,WAAYrB,GAAa,WAEzB,mBAACH,EAAA,CAAe,eAAgBC,EAAgB,WAAYC,EAAY,YAAaC,EAAa,EACpG,EACF,EACF",
|
|
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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAgEQ,IAAAI,EAAA,6BAhERC,EAA6C,yBAC7CC,EAAkC,iBAClCC,EAAqC,uDACrCA,EAAmD,kDACnDC,EAA8B,+CAC9BC,EAAgC,iDAChCC,EAAgC,iDAChCC,EAAwC,yDACxCC,EAAsC,uDACtCC,EAAkC,mDAClCC,EAA8B,+CAC9BC,EAA4B,6CAC5BC,EAAmC,oDACnCC,EAA2B,4CAC3BC,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,iBAAkBA,GAAa,iBAC/B,gBAAiBmB,EAAoB,gBACrC,gBAAiBA,EAAoB,gBACrC,WAAYnB,GAAa,WACzB,oBAAqBiB,EAAW,oBAChC,SAAUjB,GAAa,SACvB,gBAAiBA,GAAa,gBAC9B,gBAAiBA,GAAa,gBAC9B,IAAKoB,EACL,WAAYrB,EAAW,OACvB,oBAAqBkB,EAAW,oBAChC,UAAWC,GAAe,UAC1B,YAAaA,GAAe,YAC5B,WAAYG,EACZ,WAAYrB,GAAa,WAEzB,mBAACH,EAAA,CAAe,eAAgBC,EAAgB,WAAYC,EAAY,YAAaC,EAAa,EACpG,EACF,EACF",
|
|
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
|
}
|
|
@@ -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 }\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 }\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
|
-
var c=(g=>(g[g.All=0]="All",g[g.Earned=1]="Earned",g[g.Deducted=2]="Deducted",g[g.Expired=3]="Expired",g))(c||{}),
|
|
1
|
+
var c=(g=>(g[g.All=0]="All",g[g.Earned=1]="Earned",g[g.Deducted=2]="Deducted",g[g.Expired=3]="Expired",g))(c||{}),u=(f=>(f.Coupon="coupon",f.GiftCard="giftCard",f.GoGift="goGift",f.Product="product",f.ShippingCoupon="shippingCoupon",f))(u||{}),P=(t=>(t[t.Coupon=1]="Coupon",t[t.Product=2]="Product",t[t.ExternalProduct=5]="ExternalProduct",t))(P||{}),h=(t=>(t[t.Program=1]="Program",t[t.Operation=2]="Operation",t[t.Redeem=3]="Redeem",t))(h||{}),G=(t=>(t.FirstPurchase="firstPurchase",t.UploadReceipt="uploadReceipt",t.Shopping="shopping",t))(G||{}),L=(o=>(o[o.Activation=1]="Activation",o[o.UpdateName=2]="UpdateName",o[o.UpdatePhone=3]="UpdatePhone",o[o.UpdateBirthday=4]="UpdateBirthday",o[o.Subscription=5]="Subscription",o[o.UpadteAppName=7]="UpadteAppName",o[o.Refund=3e3]="Refund",o[o.ProductUnApproved=5e3]="ProductUnApproved",o))(L||{}),U=(x=>(x.FixedMount="fixed_amount",x.Percent="percent",x))(U||{}),m=(n=>(n[n.Received=0]="Received",n[n.Pending=1]="Pending",n[n.ApproveSuccess=2]="ApproveSuccess",n[n.ApproveFail=3]="ApproveFail",n[n.Unfulfilled=4]="Unfulfilled",n[n.Fulfilled=5]="Fulfilled",n[n.Failed=6]="Failed",n[n.GogiftPending=7]="GogiftPending",n[n.GogiftApproved=8]="GogiftApproved",n[n.GogiftSecondConfirm=9]="GogiftSecondConfirm",n[n.GogiftRejected=10]="GogiftRejected",n[n.GogiftCallbackPending=11]="GogiftCallbackPending",n[n.GogiftCallbackSuccess=12]="GogiftCallbackSuccess",n[n.GogiftCallbackTimeout=13]="GogiftCallbackTimeout",n))(m||{}),F=(i=>(i[i.CodeLpcRedeemFailed=180001]="CodeLpcRedeemFailed",i[i.CodeLpcUserNotFound=180002]="CodeLpcUserNotFound",i[i.CodeLpcCreditRuleNotFound=180003]="CodeLpcCreditRuleNotFound",i[i.CodeLpcUnknownError=180004]="CodeLpcUnknownError",i[i.CodeLpcNotEnoughCredits=180005]="CodeLpcNotEnoughCredits",i[i.CodeLpcUserMigrate=180006]="CodeLpcUserMigrate",i[i.CodeLpcRuleInventoryNotEnough=180007]="CodeLpcRuleInventoryNotEnough",i[i.CodeLpcShopifyCouponRuleRedeemLimit=180009]="CodeLpcShopifyCouponRuleRedeemLimit",i[i.CodeCrossSiteError=180011]="CodeCrossSiteError",i))(F||{});const M=new Map([["eu-en","eu"],["eu-de","de"],["eu-fr","fr"]]);var N=(g=>(g[g.Pending=0]="Pending",g[g.Success=1]="Success",g[g.Failed=2]="Failed",g[g.DoubleConfirm=3]="DoubleConfirm",g))(N||{});const $={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",pl:"z\u0142",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED",es:"\u20AC"};export{M as ALPC_COUNTRY_MAP,P as AlpcConsumeType,F as AlpcErrorCode,N as ApprovalStatus,u as ConsumeType,U as CouponType,c as CreditType,G as DTC_TASK_TYPE,$ as PRICE_SYMBOL,m as RewardType,L as TaskSubType,h as TaskType};
|
|
2
2
|
//# sourceMappingURL=const.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/context/const.ts"],
|
|
4
|
-
"sourcesContent": ["export enum CreditType {\n All = 0,\n Earned = 1,\n Deducted = 2,\n Expired = 3,\n}\n\nexport enum ConsumeType {\n Coupon = 'coupon',\n GiftCard = 'giftCard',\n GoGift = 'goGift',\n Product = 'product',\n ShippingCoupon = 'shippingCoupon',\n}\n\nexport enum AlpcConsumeType {\n Coupon = 1,\n Product = 2,\n ExternalProduct = 5,\n}\n\nexport enum TaskType {\n Program = 1,\n Operation = 2,\n Redeem = 3,\n}\n\nexport enum DTC_TASK_TYPE {\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shopping = 'shopping',\n}\n\nexport enum TaskSubType {\n Activation = 1, // \u6FC0\u6D3B\u4E8B\u4EF6\n UpdateName = 2, // \u5B8C\u5584\u59D3\u540D\n UpdatePhone = 3, // \u66F4\u65B0\u624B\u673A\u53F7\n UpdateBirthday = 4, // \u66F4\u65B0\u751F\u65E5\n Subscription = 5, // \u8BA2\u9605\n UpadteAppName = 7, // \u5B8C\u5584APP\u59D3\u540D\n Refund = 3000, // \u8D2D\u7269\u9001\u79EF\u5206\u4EFB\u52A1\u9000\u6B3E\n ProductUnApproved = 5000, // \u5151\u6362\u5546\u54C1\u5BA1\u6838\u4E0D\u901A\u8FC7\n}\n\nexport enum CouponType {\n FixedMount = 'fixed_amount',\n Percent = 'percent',\n}\n\nexport enum RewardType {\n Received = 0,\n Pending = 1,\n ApproveSuccess = 2,\n ApproveFail = 3,\n Unfulfilled = 4,\n Fulfilled = 5,\n Failed = 6,\n GogiftPending = 7,\n GogiftApproved = 8,\n GogiftSecondConfirm = 9,\n GogiftRejected = 10,\n GogiftCallbackPending = 11,\n GogiftCallbackSuccess = 12,\n GogiftCallbackTimeout = 13,\n}\n\nexport enum AlpcErrorCode {\n CodeLpcRedeemFailed = 180001,\n //user not found\n CodeLpcUserNotFound = 180002,\n //credit rule not found\n CodeLpcCreditRuleNotFound = 180003,\n //unknown error\n CodeLpcUnknownError = 180004,\n // not enough credits\n CodeLpcNotEnoughCredits = 180005,\n // user migrate\n CodeLpcUserMigrate = 180006,\n // \u5E93\u5B58\u4E0D\u8DB3\n CodeLpcRuleInventoryNotEnough = 180007,\n // \u5151\u6362\u6B21\u6570\u9650\u5236\n CodeLpcShopifyCouponRuleRedeemLimit = 180009,\n // \u8DE8\u533A\u5151\u6362\u9519\u8BEF\uFF08\u975E\u6B27\u5151\u6362\u6B27\u6D32\u7684\uFF09\n CodeCrossSiteError = 180011,\n}\n\nexport const ALPC_COUNTRY_MAP = new Map<string, string>([\n ['eu-en', 'eu'],\n ['eu-de', 'de'],\n])\n\nexport enum ApprovalStatus {\n Pending = 0,\n Success = 1,\n Failed = 2,\n DoubleConfirm = 3,\n}\n\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n pl: 'z\u0142',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n es: '\u20AC',\n}\n"],
|
|
5
|
-
"mappings": "AAAO,IAAKA,OACVA,IAAA,IAAM,GAAN,MACAA,IAAA,OAAS,GAAT,SACAA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UAJUA,OAAA,IAOAC,OACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBALPA,OAAA,IAQAC,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA,QAAU,GAAV,UACAA,IAAA,gBAAkB,GAAlB,kBAHUA,OAAA,IAMAC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SAHUA,OAAA,IAMAC,OACVA,EAAA,cAAgB,gBAChBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAHDA,OAAA,IAMAC,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,WAAa,GAAb,aACAA,IAAA,YAAc,GAAd,cACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,aAAe,GAAf,eACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,OAAS,KAAT,SACAA,IAAA,kBAAoB,KAApB,oBARUA,OAAA,IAWAC,OACVA,EAAA,WAAa,eACbA,EAAA,QAAU,UAFAA,OAAA,IAKAC,OACVA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,YAAc,GAAd,cACAA,IAAA,YAAc,GAAd,cACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,oBAAsB,GAAtB,sBACAA,IAAA,eAAiB,IAAjB,iBACAA,IAAA,sBAAwB,IAAxB,wBACAA,IAAA,sBAAwB,IAAxB,wBACAA,IAAA,sBAAwB,IAAxB,wBAdUA,OAAA,IAiBAC,OACVA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,0BAA4B,QAA5B,4BAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,wBAA0B,QAA1B,0BAEAA,IAAA,mBAAqB,QAArB,qBAEAA,IAAA,8BAAgC,QAAhC,gCAEAA,IAAA,oCAAsC,QAAtC,sCAEAA,IAAA,mBAAqB,QAArB,qBAjBUA,OAAA,IAoBL,MAAMC,EAAmB,IAAI,IAAoB,CACtD,CAAC,QAAS,IAAI,EACd,CAAC,QAAS,IAAI,CAChB,CAAC,EAEM,IAAKC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA,IAOL,MAAMC,EAAe,CAC1B,GAAI,IACJ,GAAI,OACJ,GAAI,IACJ,GAAI,SACJ,GAAI,UACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,IACJ,GAAI,IACJ,GAAI,MACJ,GAAI,QACN",
|
|
4
|
+
"sourcesContent": ["export enum CreditType {\n All = 0,\n Earned = 1,\n Deducted = 2,\n Expired = 3,\n}\n\nexport enum ConsumeType {\n Coupon = 'coupon',\n GiftCard = 'giftCard',\n GoGift = 'goGift',\n Product = 'product',\n ShippingCoupon = 'shippingCoupon',\n}\n\nexport enum AlpcConsumeType {\n Coupon = 1,\n Product = 2,\n ExternalProduct = 5,\n}\n\nexport enum TaskType {\n Program = 1,\n Operation = 2,\n Redeem = 3,\n}\n\nexport enum DTC_TASK_TYPE {\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shopping = 'shopping',\n}\n\nexport enum TaskSubType {\n Activation = 1, // \u6FC0\u6D3B\u4E8B\u4EF6\n UpdateName = 2, // \u5B8C\u5584\u59D3\u540D\n UpdatePhone = 3, // \u66F4\u65B0\u624B\u673A\u53F7\n UpdateBirthday = 4, // \u66F4\u65B0\u751F\u65E5\n Subscription = 5, // \u8BA2\u9605\n UpadteAppName = 7, // \u5B8C\u5584APP\u59D3\u540D\n Refund = 3000, // \u8D2D\u7269\u9001\u79EF\u5206\u4EFB\u52A1\u9000\u6B3E\n ProductUnApproved = 5000, // \u5151\u6362\u5546\u54C1\u5BA1\u6838\u4E0D\u901A\u8FC7\n}\n\nexport enum CouponType {\n FixedMount = 'fixed_amount',\n Percent = 'percent',\n}\n\nexport enum RewardType {\n Received = 0,\n Pending = 1,\n ApproveSuccess = 2,\n ApproveFail = 3,\n Unfulfilled = 4,\n Fulfilled = 5,\n Failed = 6,\n GogiftPending = 7,\n GogiftApproved = 8,\n GogiftSecondConfirm = 9,\n GogiftRejected = 10,\n GogiftCallbackPending = 11,\n GogiftCallbackSuccess = 12,\n GogiftCallbackTimeout = 13,\n}\n\nexport enum AlpcErrorCode {\n CodeLpcRedeemFailed = 180001,\n //user not found\n CodeLpcUserNotFound = 180002,\n //credit rule not found\n CodeLpcCreditRuleNotFound = 180003,\n //unknown error\n CodeLpcUnknownError = 180004,\n // not enough credits\n CodeLpcNotEnoughCredits = 180005,\n // user migrate\n CodeLpcUserMigrate = 180006,\n // \u5E93\u5B58\u4E0D\u8DB3\n CodeLpcRuleInventoryNotEnough = 180007,\n // \u5151\u6362\u6B21\u6570\u9650\u5236\n CodeLpcShopifyCouponRuleRedeemLimit = 180009,\n // \u8DE8\u533A\u5151\u6362\u9519\u8BEF\uFF08\u975E\u6B27\u5151\u6362\u6B27\u6D32\u7684\uFF09\n CodeCrossSiteError = 180011,\n}\n\nexport const ALPC_COUNTRY_MAP = new Map<string, string>([\n ['eu-en', 'eu'],\n ['eu-de', 'de'],\n ['eu-fr', 'fr'],\n])\n\nexport enum ApprovalStatus {\n Pending = 0,\n Success = 1,\n Failed = 2,\n DoubleConfirm = 3,\n}\n\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n pl: 'z\u0142',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n es: '\u20AC',\n}\n"],
|
|
5
|
+
"mappings": "AAAO,IAAKA,OACVA,IAAA,IAAM,GAAN,MACAA,IAAA,OAAS,GAAT,SACAA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UAJUA,OAAA,IAOAC,OACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBALPA,OAAA,IAQAC,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA,QAAU,GAAV,UACAA,IAAA,gBAAkB,GAAlB,kBAHUA,OAAA,IAMAC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SAHUA,OAAA,IAMAC,OACVA,EAAA,cAAgB,gBAChBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAHDA,OAAA,IAMAC,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,WAAa,GAAb,aACAA,IAAA,YAAc,GAAd,cACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,aAAe,GAAf,eACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,OAAS,KAAT,SACAA,IAAA,kBAAoB,KAApB,oBARUA,OAAA,IAWAC,OACVA,EAAA,WAAa,eACbA,EAAA,QAAU,UAFAA,OAAA,IAKAC,OACVA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,YAAc,GAAd,cACAA,IAAA,YAAc,GAAd,cACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,oBAAsB,GAAtB,sBACAA,IAAA,eAAiB,IAAjB,iBACAA,IAAA,sBAAwB,IAAxB,wBACAA,IAAA,sBAAwB,IAAxB,wBACAA,IAAA,sBAAwB,IAAxB,wBAdUA,OAAA,IAiBAC,OACVA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,0BAA4B,QAA5B,4BAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,wBAA0B,QAA1B,0BAEAA,IAAA,mBAAqB,QAArB,qBAEAA,IAAA,8BAAgC,QAAhC,gCAEAA,IAAA,oCAAsC,QAAtC,sCAEAA,IAAA,mBAAqB,QAArB,qBAjBUA,OAAA,IAoBL,MAAMC,EAAmB,IAAI,IAAoB,CACtD,CAAC,QAAS,IAAI,EACd,CAAC,QAAS,IAAI,EACd,CAAC,QAAS,IAAI,CAChB,CAAC,EAEM,IAAKC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA,IAOL,MAAMC,EAAe,CAC1B,GAAI,IACJ,GAAI,OACJ,GAAI,IACJ,GAAI,SACJ,GAAI,UACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,IACJ,GAAI,IACJ,GAAI,MACJ,GAAI,QACN",
|
|
6
6
|
"names": ["CreditType", "ConsumeType", "AlpcConsumeType", "TaskType", "DTC_TASK_TYPE", "TaskSubType", "CouponType", "RewardType", "AlpcErrorCode", "ALPC_COUNTRY_MAP", "ApprovalStatus", "PRICE_SYMBOL"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useCallback as R,useEffect as
|
|
1
|
+
import{useCallback as R,useEffect as b,useState as d}from"react";import{ALPC_COUNTRY_MAP as A,AlpcConsumeType as M}from"../const";import{useAlpcMutation as w}from"./useAlpcFetch";import{useCreditsContext as L}from"../provider";import{useHeadlessContext as T}from"@anker-in/lib";function x({page:s,pageSize:r,consumeType:n}){const{profile:e,alpcBrand:c,alpcCountry:l}=L(),{brand:g,locale:a,appName:_}=T(),t=c||g,[u,f]=d([]),[p,y]=d(0),{isMutating:i,trigger:C}=w({url:"/v1/credit/log/coupon",initData:{brand:t,country:l||A.get(a)||a,app_name:_}}),o=R(async()=>{e?.user_id&&await C({consume_type:n||M.Coupon,page:s,page_size:r,user_id:e?.user_id},{onSuccess(m){y(m?.data?.total),f(m?.data?.redeem_logs||[])}})},[n,s,r,e?.user_id]);return b(()=>{!t||!e?.user_id||o()},[o,t]),{myRewards:u,isLoading:i,total:p,getMyRewards:o,canNext:p>u.length&&!i}}var S=x;export{S as default};
|
|
2
2
|
//# sourceMappingURL=useMyRewards.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useMyRewards.ts"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { profile, alpcBrand } = useCreditsContext()\n const { brand: headlessBrand, locale, appName } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n const getMyRewards = useCallback(async () => {\n if (!profile?.user_id) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setTotal(responseData?.data?.total)\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, page, pageSize, profile?.user_id])\n\n useEffect(() => {\n if (!brand || !profile?.user_id) {\n return\n }\n getMyRewards()\n }, [getMyRewards, brand])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,oBAAAC,EAAkB,mBAAAC,MAAuB,WAClD,OAAS,mBAAAC,MAAuB,iBAEhC,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAE,QAAAC,EAAS,UAAAC,
|
|
6
|
-
"names": ["useCallback", "useEffect", "useState", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "useAlpcMutation", "useCreditsContext", "useHeadlessContext", "useMyRewards", "page", "pageSize", "consumeType", "profile", "alpcBrand", "headlessBrand", "locale", "appName", "brand", "myRewards", "setMyRewards", "total", "setTotal", "isLoading", "trigger", "getMyRewards", "responseData", "useMyRewards_default"]
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { profile, alpcBrand, alpcCountry } = useCreditsContext()\n const { brand: headlessBrand, locale, appName } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: alpcCountry || ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n const getMyRewards = useCallback(async () => {\n if (!profile?.user_id) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setTotal(responseData?.data?.total)\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, page, pageSize, profile?.user_id])\n\n useEffect(() => {\n if (!brand || !profile?.user_id) {\n return\n }\n getMyRewards()\n }, [getMyRewards, brand])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,oBAAAC,EAAkB,mBAAAC,MAAuB,WAClD,OAAS,mBAAAC,MAAuB,iBAEhC,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAE,QAAAC,EAAS,UAAAC,EAAW,YAAAC,CAAY,EAAIR,EAAkB,EACxD,CAAE,MAAOS,EAAe,OAAAC,EAAQ,QAAAC,CAAQ,EAAIV,EAAmB,EAC/DW,EAAQL,GAAaE,EAErB,CAACI,EAAWC,CAAY,EAAIlB,EAA8B,CAAC,CAAC,EAC5D,CAACmB,EAAOC,CAAQ,EAAIpB,EAAS,CAAC,EAE9B,CAAE,WAAYqB,EAAW,QAAAC,CAAQ,EAAInB,EAQzC,CACA,IAAK,wBACL,SAAU,CACR,MAAOa,EACP,QAASJ,GAAeX,EAAiB,IAAIa,CAAM,GAAKA,EACxD,SAAUC,CACZ,CACF,CAAC,EAEKQ,EAAezB,EAAY,SAAY,CACtCY,GAAS,SAGd,MAAMY,EACJ,CACE,aAAcb,GAAeP,EAAgB,OAC7C,KAAAK,EACA,UAAWC,EACX,QAASE,GAAS,OACpB,EACA,CACE,UAAUc,EAAc,CACtBJ,EAASI,GAAc,MAAM,KAAK,EAClCN,EAAaM,GAAc,MAAM,aAAe,CAAC,CAAC,CACpD,CACF,CACF,CACF,EAAG,CAACf,EAAaF,EAAMC,EAAUE,GAAS,OAAO,CAAC,EAElD,OAAAX,EAAU,IAAM,CACV,CAACiB,GAAS,CAACN,GAAS,SAGxBa,EAAa,CACf,EAAG,CAACA,EAAcP,CAAK,CAAC,EAEjB,CACL,UAAAC,EACA,UAAAI,EACA,MAAAF,EACA,aAAAI,EACA,QAASJ,EAAQF,EAAU,QAAU,CAACI,CACxC,CACF,CAEA,IAAOI,EAAQnB",
|
|
6
|
+
"names": ["useCallback", "useEffect", "useState", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "useAlpcMutation", "useCreditsContext", "useHeadlessContext", "useMyRewards", "page", "pageSize", "consumeType", "profile", "alpcBrand", "alpcCountry", "headlessBrand", "locale", "appName", "brand", "myRewards", "setMyRewards", "total", "setTotal", "isLoading", "trigger", "getMyRewards", "responseData", "useMyRewards_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ALPC_COUNTRY_MAP as
|
|
1
|
+
import{ALPC_COUNTRY_MAP as p}from"../const";import{useAlpcMutation as a}from"./useAlpcFetch";import{useHeadlessContext as u}from"@anker-in/lib";import{useCreditsContext as d}from"../provider";const R=(o={})=>{const{alpcBrand:n,alpcCountry:t}=d(),{locale:e,appName:r,brand:s}=u();return a({url:"/v1/credit/redeem/coupon",initData:{brand:n||s,country:t||p.get(e)||e,app_name:r}},o)};export{R as useRedeemCoupon};
|
|
2
2
|
//# sourceMappingURL=useRedeemCoupon.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemCoupon.ts"],
|
|
4
|
-
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemCouponResponse = {\n data: {\n success: boolean\n coupon_code: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemCoupon = (mutationOptions: UseMutationConfig<RedeemCouponResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemCouponResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/coupon`,\n initData: {\n brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,cAW3B,MAAMC,EAAkB,CAACC,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,
|
|
6
|
-
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useCreditsContext", "useRedeemCoupon", "mutationOptions", "alpcBrand", "locale", "appName", "headlessBrand"]
|
|
4
|
+
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemCouponResponse = {\n data: {\n success: boolean\n coupon_code: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemCoupon = (mutationOptions: UseMutationConfig<RedeemCouponResponse> = {}) => {\n const { alpcBrand, alpcCountry } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemCouponResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/coupon`,\n initData: {\n brand,\n country: alpcCountry || ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,cAW3B,MAAMC,EAAkB,CAACC,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAY,EAAIJ,EAAkB,EAC/C,CAAE,OAAAK,EAAQ,QAAAC,EAAS,MAAOC,CAAc,EAAIR,EAAmB,EAGrE,OAAOD,EAOL,CACE,IAAK,2BACL,SAAU,CACR,MAZQK,GAAaI,EAarB,QAASH,GAAeP,EAAiB,IAAIQ,CAAM,GAAKA,EACxD,SAAUC,CACZ,CACF,EACAJ,CACF,CACF",
|
|
6
|
+
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useCreditsContext", "useRedeemCoupon", "mutationOptions", "alpcBrand", "alpcCountry", "locale", "appName", "headlessBrand"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ALPC_COUNTRY_MAP as
|
|
1
|
+
import{ALPC_COUNTRY_MAP as i}from"../const";import{useAlpcMutation as a}from"./useAlpcFetch";import{useHeadlessContext as d}from"@anker-in/lib";import{useCreditsContext as m}from"../provider";const l=(t={})=>{const{alpcBrand:o,alpcCountry:n}=m(),{locale:e,appName:r,brand:s}=d();return a({url:"/v1/credit/redeem/gogift",initData:{brand:o||s,country:n||i.get(e)||e,app_name:r}},t)};export{l as useRedeemGoGift};
|
|
2
2
|
//# sourceMappingURL=useRedeemGoGift.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemGoGift.ts"],
|
|
4
|
-
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemGoGiftResponse = {\n data: {\n id: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemGoGift = (mutationOptions: UseMutationConfig<RedeemGoGiftResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemGoGiftResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/gogift`,\n initData: {\n brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,cAU3B,MAAMC,EAAkB,CAACC,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,
|
|
6
|
-
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useCreditsContext", "useRedeemGoGift", "mutationOptions", "alpcBrand", "locale", "appName", "headlessBrand"]
|
|
4
|
+
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemGoGiftResponse = {\n data: {\n id: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemGoGift = (mutationOptions: UseMutationConfig<RedeemGoGiftResponse> = {}) => {\n const { alpcBrand, alpcCountry } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemGoGiftResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/gogift`,\n initData: {\n brand,\n country: alpcCountry || ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,cAU3B,MAAMC,EAAkB,CAACC,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAY,EAAIJ,EAAkB,EAC/C,CAAE,OAAAK,EAAQ,QAAAC,EAAS,MAAOC,CAAc,EAAIR,EAAmB,EAGrE,OAAOD,EAOL,CACE,IAAK,2BACL,SAAU,CACR,MAZQK,GAAaI,EAarB,QAASH,GAAeP,EAAiB,IAAIQ,CAAM,GAAKA,EACxD,SAAUC,CACZ,CACF,EACAJ,CACF,CACF",
|
|
6
|
+
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useCreditsContext", "useRedeemGoGift", "mutationOptions", "alpcBrand", "alpcCountry", "locale", "appName", "headlessBrand"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ALPC_COUNTRY_MAP as
|
|
1
|
+
import{ALPC_COUNTRY_MAP as d}from"../const";import{useAlpcMutation as u}from"./useAlpcFetch";import{useHeadlessContext as p}from"@anker-in/lib";import{useCreditsContext as c}from"../provider";const b=(o={})=>{const{alpcBrand:t,alpcCountry:n}=c(),{storeDomain:r,locale:e,appName:s,brand:a}=p();return u({url:"/v1/credit/exchange/goods",initData:{quantity:1,brand:t||a,country:(n||d.get(e||"")||e)?.toUpperCase(),domain:r,app_name:s}},o)};export{b as useRedeemProduct};
|
|
2
2
|
//# sourceMappingURL=useRedeemProduct.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemProduct.ts"],
|
|
4
|
-
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemProductResponse = {\n code: number\n data: {\n success: boolean\n }\n}\n\nexport const useRedeemProduct = (mutationOptions: UseMutationConfig<RedeemProductResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { storeDomain, locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemProductResponse,\n {\n rule_id: number\n address: string\n }\n >(\n {\n url: `/v1/credit/exchange/goods`,\n initData: {\n quantity: 1,\n brand,\n country: (ALPC_COUNTRY_MAP.get(locale || '') || locale)?.toUpperCase(),\n domain: storeDomain,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,cAS3B,MAAMC,EAAmB,CAACC,EAA4D,CAAC,IAAM,CAClG,KAAM,CAAE,UAAAC,
|
|
6
|
-
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useCreditsContext", "useRedeemProduct", "mutationOptions", "alpcBrand", "storeDomain", "locale", "appName", "headlessBrand"]
|
|
4
|
+
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemProductResponse = {\n code: number\n data: {\n success: boolean\n }\n}\n\nexport const useRedeemProduct = (mutationOptions: UseMutationConfig<RedeemProductResponse> = {}) => {\n const { alpcBrand, alpcCountry } = useCreditsContext()\n const { storeDomain, locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemProductResponse,\n {\n rule_id: number\n address: string\n }\n >(\n {\n url: `/v1/credit/exchange/goods`,\n initData: {\n quantity: 1,\n brand,\n country: (alpcCountry || ALPC_COUNTRY_MAP.get(locale || '') || locale)?.toUpperCase(),\n domain: storeDomain,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,cAS3B,MAAMC,EAAmB,CAACC,EAA4D,CAAC,IAAM,CAClG,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAY,EAAIJ,EAAkB,EAC/C,CAAE,YAAAK,EAAa,OAAAC,EAAQ,QAAAC,EAAS,MAAOC,CAAc,EAAIT,EAAmB,EAGlF,OAAOD,EAOL,CACE,IAAK,4BACL,SAAU,CACR,SAAU,EACV,MAbQK,GAAaK,EAcrB,SAAUJ,GAAeP,EAAiB,IAAIS,GAAU,EAAE,GAAKA,IAAS,YAAY,EACpF,OAAQD,EACR,SAAUE,CACZ,CACF,EACAL,CACF,CACF",
|
|
6
|
+
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useCreditsContext", "useRedeemProduct", "mutationOptions", "alpcBrand", "alpcCountry", "storeDomain", "locale", "appName", "headlessBrand"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useCallback as
|
|
1
|
+
import{useCallback as _,useEffect as g,useState as T}from"react";import{useAlpcMutation as R}from"./useAlpcFetch";import{ALPC_COUNTRY_MAP as L}from"../const";import{useCreditsContext as b}from"../provider";import{useHeadlessContext as A}from"@anker-in/lib";function x(l){let e="";const{profile:o,isLoadingProfile:n,alpcBrand:p,alpcCountry:m}=b(),{locale:r,brand:a}=A(),s=p||a;r==="pl"?e="eu":e=r;const[d,C]=T([]),{isMutating:y,trigger:u}=R({url:"/v1/credit/consume_credit_rules",initData:{brand:s,page:1,page_size:999,country:(m||L.get(e)||e)?.toUpperCase()}}),t=_(i=>{u({user_id:o?.user_id,...i?.consumeType&&{consume_type:i.consumeType}},{onSuccess(c){console.log("responseData",c);let f=c?.data?.consume_credit_rules||[];C(f)}})},[o,u,e]);return g(()=>{!s||n||t({consumeType:l?.consumeType})},[t,n,s]),{listLoading:y,redeemableList:d,getRedeemableList:t}}var k=x;export{k as default};
|
|
2
2
|
//# sourceMappingURL=useRedeemableList.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemableList.ts"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList(props?: { consumeType: AlpcConsumeType }) {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { consume_type?: AlpcConsumeType; user_id?: string }\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 999,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n },\n })\n\n const getRedeemableList = useCallback(\n (props?: { consumeType?: AlpcConsumeType }) => {\n trigger(\n {\n user_id: profile?.user_id,\n ...(props?.consumeType && { consume_type: props.consumeType }),\n },\n {\n onSuccess(responseData) {\n console.log('responseData', responseData)\n let list = responseData?.data?.consume_credit_rules || []\n setRedeemableList(list)\n },\n }\n )\n },\n [profile, trigger, locale]\n )\n\n useEffect(() => {\n if (!brand || isLoadingProfile) {\n return\n }\n getRedeemableList({ consumeType: props?.consumeType })\n }, [getRedeemableList, isLoadingProfile, brand])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,oBAAAC,MAAyC,WAClD,OAAS,qBAAAC,MAAyB,cAElC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAkBC,EAA0C,CACnE,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,
|
|
6
|
-
"names": ["useCallback", "useEffect", "useState", "useAlpcMutation", "ALPC_COUNTRY_MAP", "useCreditsContext", "useHeadlessContext", "useRedeemableList", "props", "locale", "profile", "isLoadingProfile", "alpcBrand", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list", "useRedeemableList_default"]
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList(props?: { consumeType: AlpcConsumeType }) {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand, alpcCountry } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { consume_type?: AlpcConsumeType; user_id?: string }\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 999,\n country: (alpcCountry || ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n },\n })\n\n const getRedeemableList = useCallback(\n (props?: { consumeType?: AlpcConsumeType }) => {\n trigger(\n {\n user_id: profile?.user_id,\n ...(props?.consumeType && { consume_type: props.consumeType }),\n },\n {\n onSuccess(responseData) {\n console.log('responseData', responseData)\n let list = responseData?.data?.consume_credit_rules || []\n setRedeemableList(list)\n },\n }\n )\n },\n [profile, trigger, locale]\n )\n\n useEffect(() => {\n if (!brand || isLoadingProfile) {\n return\n }\n getRedeemableList({ consumeType: props?.consumeType })\n }, [getRedeemableList, isLoadingProfile, brand])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,oBAAAC,MAAyC,WAClD,OAAS,qBAAAC,MAAyB,cAElC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAkBC,EAA0C,CACnE,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,EAAW,YAAAC,CAAY,EAAIR,EAAkB,EAC1E,CAAE,OAAQS,EAAe,MAAOC,CAAc,EAAIT,EAAmB,EACrEU,EAAQJ,GAAaG,EAEvBD,IAAkB,KACpBL,EAAS,KAETA,EAASK,EAGX,KAAM,CAACG,EAAgBC,CAAiB,EAAIhB,EAAsC,CAAC,CAAC,EAC9E,CAAE,WAAYiB,EAAa,QAAAC,CAAQ,EAAIjB,EAK3C,CACA,IAAK,kCACL,SAAU,CACR,MAAAa,EACA,KAAM,EACN,UAAW,IACX,SAAUH,GAAeT,EAAiB,IAAIK,CAAM,GAAKA,IAAS,YAAY,CAChF,CACF,CAAC,EAEKY,EAAoBrB,EACvBQ,GAA8C,CAC7CY,EACE,CACE,QAASV,GAAS,QAClB,GAAIF,GAAO,aAAe,CAAE,aAAcA,EAAM,WAAY,CAC9D,EACA,CACE,UAAUc,EAAc,CACtB,QAAQ,IAAI,eAAgBA,CAAY,EACxC,IAAIC,EAAOD,GAAc,MAAM,sBAAwB,CAAC,EACxDJ,EAAkBK,CAAI,CACxB,CACF,CACF,CACF,EACA,CAACb,EAASU,EAASX,CAAM,CAC3B,EAEA,OAAAR,EAAU,IAAM,CACV,CAACe,GAASL,GAGdU,EAAkB,CAAE,YAAab,GAAO,WAAY,CAAC,CACvD,EAAG,CAACa,EAAmBV,EAAkBK,CAAK,CAAC,EAExC,CACL,YAAAG,EACA,eAAAF,EACA,kBAAAI,CACF,CACF,CAEA,IAAOG,EAAQjB",
|
|
6
|
+
"names": ["useCallback", "useEffect", "useState", "useAlpcMutation", "ALPC_COUNTRY_MAP", "useCreditsContext", "useHeadlessContext", "useRedeemableList", "props", "locale", "profile", "isLoadingProfile", "alpcBrand", "alpcCountry", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list", "useRedeemableList_default"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useSubscribed.ts"],
|
|
4
|
-
"sourcesContent": ["import { useMemo } from 'react'\n\nimport { TaskSubType } from '../const'\nimport useActivities from './useActivities'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext, useSubscriptions } from '@anker-in/lib'\n\nexport const useSubscribed = () => {\n const { profile } = useCreditsContext()\n const { brand } = useHeadlessContext()\n\n const activitiesOptions = useMemo(() => ({ page: 1, pageSize: 50 }), [])\n\n const { activities } = useActivities(activitiesOptions)\n const { data: subscription } = useSubscriptions({ email: profile?.email })\n
|
|
5
|
-
"mappings": "AAAA,OAAS,WAAAA,MAAe,QAExB,OAAS,eAAAC,MAAmB,WAC5B,OAAOC,MAAmB,kBAC1B,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,EAAoB,oBAAAC,MAAwB,gBAE9C,MAAMC,EAAgB,IAAM,CACjC,KAAM,CAAE,QAAAC,CAAQ,EAAIJ,EAAkB,EAChC,CAAE,MAAAK,CAAM,EAAIJ,EAAmB,EAE/BK,EAAoBT,EAAQ,KAAO,CAAE,KAAM,EAAG,SAAU,EAAG,GAAI,CAAC,CAAC,EAEjE,CAAE,WAAAU,CAAW,EAAIR,EAAcO,CAAiB,EAChD,CAAE,KAAME,CAAa,EAAIN,EAAiB,CAAE,MAAOE,GAAS,KAAM,CAAC,
|
|
4
|
+
"sourcesContent": ["import { useMemo } from 'react'\n\nimport { TaskSubType } from '../const'\nimport useActivities from './useActivities'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext, useSubscriptions } from '@anker-in/lib'\n\nexport const useSubscribed = () => {\n const { profile } = useCreditsContext()\n const { brand } = useHeadlessContext()\n\n const activitiesOptions = useMemo(() => ({ page: 1, pageSize: 50 }), [])\n\n const { activities } = useActivities(activitiesOptions)\n const { data: subscription } = useSubscriptions({ email: profile?.email })\n const subscriptionData = subscription?.data || subscription\n\n const isSubscribed = useMemo(() => {\n if (!subscriptionData?.preference) {\n return false\n }\n\n const subscribeResult = subscriptionData.preference.some((item: any) => {\n return item.brand === brand && item.subscribe\n })\n\n if (subscribeResult) {\n return true\n }\n\n return activities?.some(item => {\n return item.task_sub_type === TaskSubType.Subscription\n })\n }, [subscriptionData?.preference, activities])\n\n return isSubscribed\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,WAAAA,MAAe,QAExB,OAAS,eAAAC,MAAmB,WAC5B,OAAOC,MAAmB,kBAC1B,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,EAAoB,oBAAAC,MAAwB,gBAE9C,MAAMC,EAAgB,IAAM,CACjC,KAAM,CAAE,QAAAC,CAAQ,EAAIJ,EAAkB,EAChC,CAAE,MAAAK,CAAM,EAAIJ,EAAmB,EAE/BK,EAAoBT,EAAQ,KAAO,CAAE,KAAM,EAAG,SAAU,EAAG,GAAI,CAAC,CAAC,EAEjE,CAAE,WAAAU,CAAW,EAAIR,EAAcO,CAAiB,EAChD,CAAE,KAAME,CAAa,EAAIN,EAAiB,CAAE,MAAOE,GAAS,KAAM,CAAC,EACnEK,EAAmBD,GAAc,MAAQA,EAoB/C,OAlBqBX,EAAQ,IACtBY,GAAkB,WAICA,EAAiB,WAAW,KAAMC,GACjDA,EAAK,QAAUL,GAASK,EAAK,SACrC,EAGQ,GAGFH,GAAY,KAAKG,GACfA,EAAK,gBAAkBZ,EAAY,YAC3C,EAbQ,GAcR,CAACW,GAAkB,WAAYF,CAAU,CAAC,CAG/C",
|
|
6
6
|
"names": ["useMemo", "TaskSubType", "useActivities", "useCreditsContext", "useHeadlessContext", "useSubscriptions", "useSubscribed", "profile", "brand", "activitiesOptions", "activities", "subscription", "subscriptionData", "item"]
|
|
7
7
|
}
|