@anker-in/campaign-ui 0.4.7 → 0.5.0-beta.1
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/index.d.ts +1 -0
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +2 -2
- package/dist/cjs/components/memberPopup/MemberPopup.d.ts +9 -0
- package/dist/cjs/components/memberPopup/MemberPopup.js +2 -0
- package/dist/cjs/components/memberPopup/MemberPopup.js.map +7 -0
- package/dist/cjs/components/memberPopup/context/provider.d.ts +11 -0
- package/dist/cjs/components/memberPopup/context/provider.js +2 -0
- package/dist/cjs/components/memberPopup/context/provider.js.map +7 -0
- package/dist/cjs/components/memberPopup/context/viewStack.d.ts +12 -0
- package/dist/cjs/components/memberPopup/context/viewStack.js +2 -0
- package/dist/cjs/components/memberPopup/context/viewStack.js.map +7 -0
- package/dist/cjs/components/memberPopup/icons.d.ts +27 -0
- package/dist/cjs/components/memberPopup/icons.js +2 -0
- package/dist/cjs/components/memberPopup/icons.js.map +7 -0
- package/dist/cjs/components/memberPopup/index.d.ts +4 -0
- package/dist/cjs/components/memberPopup/index.js +2 -0
- package/dist/cjs/components/memberPopup/index.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/Activity/SubscribeModal.d.ts +10 -0
- package/dist/cjs/components/memberPopup/panels/Activity/SubscribeModal.js +2 -0
- package/dist/cjs/components/memberPopup/panels/Activity/SubscribeModal.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.d.ts +7 -0
- package/dist/cjs/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js +2 -0
- package/dist/cjs/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/Activity/index.d.ts +7 -0
- package/dist/cjs/components/memberPopup/panels/Activity/index.js +2 -0
- package/dist/cjs/components/memberPopup/panels/Activity/index.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.d.ts +19 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js +2 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.d.ts +20 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js +2 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.d.ts +12 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.js +2 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.d.ts +17 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.js +2 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.d.ts +8 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.js +2 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.d.ts +7 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.js +2 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.d.ts +8 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.d.ts +10 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.d.ts +9 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.d.ts +9 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.d.ts +10 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribePanel.d.ts +9 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribePanel.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribePanel.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useActivities.d.ts +18 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useActivities.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useActivities.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.d.ts +9 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.d.ts +17 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/index.d.ts +13 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/index.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/index.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralDashboard.d.ts +13 -0
- package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js +2 -0
- package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralOverview.d.ts +12 -0
- package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralOverview.js +2 -0
- package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralOverview.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/Referral/index.d.ts +7 -0
- package/dist/cjs/components/memberPopup/panels/Referral/index.js +2 -0
- package/dist/cjs/components/memberPopup/panels/Referral/index.js.map +7 -0
- package/dist/cjs/components/memberPopup/type.d.ts +201 -0
- package/dist/cjs/components/memberPopup/type.js +2 -0
- package/dist/cjs/components/memberPopup/type.js.map +7 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +2 -2
- package/dist/esm/components/memberPopup/MemberPopup.d.ts +9 -0
- package/dist/esm/components/memberPopup/MemberPopup.js +2 -0
- package/dist/esm/components/memberPopup/MemberPopup.js.map +7 -0
- package/dist/esm/components/memberPopup/context/provider.d.ts +11 -0
- package/dist/esm/components/memberPopup/context/provider.js +2 -0
- package/dist/esm/components/memberPopup/context/provider.js.map +7 -0
- package/dist/esm/components/memberPopup/context/viewStack.d.ts +12 -0
- package/dist/esm/components/memberPopup/context/viewStack.js +2 -0
- package/dist/esm/components/memberPopup/context/viewStack.js.map +7 -0
- package/dist/esm/components/memberPopup/icons.d.ts +27 -0
- package/dist/esm/components/memberPopup/icons.js +2 -0
- package/dist/esm/components/memberPopup/icons.js.map +7 -0
- package/dist/esm/components/memberPopup/index.d.ts +4 -0
- package/dist/esm/components/memberPopup/index.js +2 -0
- package/dist/esm/components/memberPopup/index.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/Activity/SubscribeModal.d.ts +10 -0
- package/dist/esm/components/memberPopup/panels/Activity/SubscribeModal.js +2 -0
- package/dist/esm/components/memberPopup/panels/Activity/SubscribeModal.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.d.ts +7 -0
- package/dist/esm/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js +2 -0
- package/dist/esm/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/Activity/index.d.ts +7 -0
- package/dist/esm/components/memberPopup/panels/Activity/index.js +2 -0
- package/dist/esm/components/memberPopup/panels/Activity/index.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.d.ts +19 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js +2 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.d.ts +20 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js +2 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.d.ts +12 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.js +2 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.d.ts +17 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.js +2 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.d.ts +8 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.js +2 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.d.ts +7 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.js +2 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.d.ts +8 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.d.ts +10 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.d.ts +9 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.d.ts +9 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.d.ts +10 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribePanel.d.ts +9 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribePanel.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribePanel.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useActivities.d.ts +18 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useActivities.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useActivities.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.d.ts +9 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.d.ts +17 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/index.d.ts +13 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/index.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/index.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralDashboard.d.ts +13 -0
- package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js +2 -0
- package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralOverview.d.ts +12 -0
- package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralOverview.js +2 -0
- package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralOverview.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/Referral/index.d.ts +7 -0
- package/dist/esm/components/memberPopup/panels/Referral/index.js +2 -0
- package/dist/esm/components/memberPopup/panels/Referral/index.js.map +7 -0
- package/dist/esm/components/memberPopup/type.d.ts +201 -0
- package/dist/esm/components/memberPopup/type.js +2 -0
- package/dist/esm/components/memberPopup/type.js.map +7 -0
- package/dist/index.d.mts +1775 -0
- package/dist/index.d.ts +1775 -0
- package/dist/index.js +18542 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +18514 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +1 -1
- package/src/components/index.ts +2 -0
- package/src/components/memberPopup/MemberPopup.tsx +283 -0
- package/src/components/memberPopup/context/provider.tsx +52 -0
- package/src/components/memberPopup/context/viewStack.tsx +23 -0
- package/src/components/memberPopup/icons.tsx +147 -0
- package/src/components/memberPopup/index.ts +24 -0
- package/src/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.tsx +150 -0
- package/src/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.tsx +142 -0
- package/src/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.ts +33 -0
- package/src/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.ts +38 -0
- package/src/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.ts +55 -0
- package/src/components/memberPopup/panels/ConsumeCredits/index.tsx +220 -0
- package/src/components/memberPopup/panels/EarnCredits/ActivatePanel.tsx +323 -0
- package/src/components/memberPopup/panels/EarnCredits/CompleteProfileModal.tsx +186 -0
- package/src/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.tsx +179 -0
- package/src/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.tsx +130 -0
- package/src/components/memberPopup/panels/EarnCredits/SubscribeModal.tsx +144 -0
- package/src/components/memberPopup/panels/EarnCredits/SubscribePanel.tsx +147 -0
- package/src/components/memberPopup/panels/EarnCredits/hooks/useActivities.ts +64 -0
- package/src/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.ts +32 -0
- package/src/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.ts +50 -0
- package/src/components/memberPopup/panels/EarnCredits/index.tsx +215 -0
- package/src/components/memberPopup/panels/Referral/hooks/useReferralOverview.ts +41 -0
- package/src/components/memberPopup/panels/Referral/index.tsx +108 -0
- package/src/components/memberPopup/type.ts +213 -0
- package/tailwind.config.ts +4 -0
- package/dist/cjs/stories/CartCard.stories.d.ts +0 -33
- package/dist/cjs/stories/CartCard.stories.js +0 -21
- package/dist/cjs/stories/CartCard.stories.js.map +0 -7
- package/dist/esm/stories/CartCard.stories.d.ts +0 -33
- package/dist/esm/stories/CartCard.stories.js +0 -21
- package/dist/esm/stories/CartCard.stories.js.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/memberPopup/context/provider.tsx"],
|
|
4
|
+
"sourcesContent": ["import { createContext, PropsWithChildren, useContext } from 'react'\nimport { HeadlessProvider, type HeadlessConfig } from '@anker-in/lib'\nimport { RegistrationProvider } from '../../registration'\nimport type { EarnCreditsCopy, MemberPopupContextValue } from '../type'\n\nexport const MemberPopupContext = createContext<MemberPopupContextValue>({\n profile: null,\n isLoadingProfile: false,\n creditInfo: undefined,\n fetchCreditInfo: () => {},\n openSignUpPopup: () => {},\n openSignInPopup: () => {},\n taskIdToTypeMapping: {},\n alpcConfig: {\n brand: '',\n locale: '',\n appName: '',\n },\n})\n\ntype MemberPopupProviderProps = MemberPopupContextValue & {\n headlessConfig: HeadlessConfig\n earnCreditsCopy?: EarnCreditsCopy\n}\n\nexport function MemberPopupProvider({\n children,\n headlessConfig,\n earnCreditsCopy,\n ...contextValue\n}: PropsWithChildren<MemberPopupProviderProps>) {\n return (\n <HeadlessProvider headlessConfig={headlessConfig}>\n <RegistrationProvider\n email={contextValue.profile?.email}\n copy={{ authCodeActivate: earnCreditsCopy?.authCodeActivate }}\n >\n <MemberPopupContext.Provider value={contextValue}>\n {children}\n </MemberPopupContext.Provider>\n </RegistrationProvider>\n </HeadlessProvider>\n )\n}\n\nexport function useMemberPopupContext() {\n const context = useContext(MemberPopupContext)\n if (!context) {\n throw new Error('useMemberPopupContext must be used within a MemberPopupProvider')\n }\n return context\n}\n"],
|
|
5
|
+
"mappings": "AAqCQ,cAAAA,MAAA,oBArCR,OAAS,iBAAAC,EAAkC,cAAAC,MAAkB,QAC7D,OAAS,oBAAAC,MAA6C,gBACtD,OAAS,wBAAAC,MAA4B,qBAG9B,MAAMC,EAAqBJ,EAAuC,CACvE,QAAS,KACT,iBAAkB,GAClB,WAAY,OACZ,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,oBAAqB,CAAC,EACtB,WAAY,CACV,MAAO,GACP,OAAQ,GACR,QAAS,EACX,CACF,CAAC,EAOM,SAASK,EAAoB,CAClC,SAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,GAAGC,CACL,EAAgD,CAC9C,OACEV,EAACG,EAAA,CAAiB,eAAgBK,EAChC,SAAAR,EAACI,EAAA,CACC,MAAOM,EAAa,SAAS,MAC7B,KAAM,CAAE,iBAAkBD,GAAiB,gBAAiB,EAE5D,SAAAT,EAACK,EAAmB,SAAnB,CAA4B,MAAOK,EACjC,SAAAH,EACH,EACF,EACF,CAEJ,CAEO,SAASI,GAAwB,CACtC,MAAMC,EAAUV,EAAWG,CAAkB,EAC7C,GAAI,CAACO,EACH,MAAM,IAAI,MAAM,iEAAiE,EAEnF,OAAOA,CACT",
|
|
6
|
+
"names": ["jsx", "createContext", "useContext", "HeadlessProvider", "RegistrationProvider", "MemberPopupContext", "MemberPopupProvider", "children", "headlessConfig", "earnCreditsCopy", "contextValue", "useMemberPopupContext", "context"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MemberPopupPanelType } from '../type';
|
|
2
|
+
export type ViewPayload = {
|
|
3
|
+
type: MemberPopupPanelType;
|
|
4
|
+
props?: Record<string, any>;
|
|
5
|
+
};
|
|
6
|
+
type ViewStackContextValue = {
|
|
7
|
+
pushView: (view: ViewPayload) => void;
|
|
8
|
+
popView: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const ViewStackContext: import("react").Context<ViewStackContextValue>;
|
|
11
|
+
export declare function useViewStack(): ViewStackContextValue;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/memberPopup/context/viewStack.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { createContext, useContext, ReactNode } from 'react'\nimport type { MemberPopupPanelType } from '../type'\n\nexport type ViewPayload = {\n type: MemberPopupPanelType\n props?: Record<string, any>\n}\n\ntype ViewStackContextValue = {\n pushView: (view: ViewPayload) => void\n popView: () => void\n}\n\nexport const ViewStackContext = createContext<ViewStackContextValue>({\n pushView: () => {},\n popView: () => {},\n})\n\nexport function useViewStack() {\n return useContext(ViewStackContext)\n}\n"],
|
|
5
|
+
"mappings": "aAEA,OAAS,iBAAAA,EAAe,cAAAC,MAA6B,QAa9C,MAAMC,EAAmBF,EAAqC,CACnE,SAAU,IAAM,CAAC,EACjB,QAAS,IAAM,CAAC,CAClB,CAAC,EAEM,SAASG,GAAe,CAC7B,OAAOF,EAAWC,CAAgB,CACpC",
|
|
6
|
+
"names": ["createContext", "useContext", "ViewStackContext", "useViewStack"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare function IconCredit({ className }: {
|
|
2
|
+
className?: string;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function IconReferral({ className }: {
|
|
5
|
+
className?: string;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function IconBag({ className }: {
|
|
8
|
+
className?: string;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function IconArrow({ className }: {
|
|
11
|
+
className?: string;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function IconSwitch({ className }: {
|
|
14
|
+
className?: string;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function IconClose({ className }: {
|
|
17
|
+
className?: string;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function IconLock({ className }: {
|
|
20
|
+
className?: string;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function IconSubscription({ className }: {
|
|
23
|
+
className?: string;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function IconOrders({ className }: {
|
|
26
|
+
className?: string;
|
|
27
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as C,jsxs as l}from"react/jsx-runtime";function t({className:e}){return C("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:C("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0003 3C17.523 3.00008 22 5.19431 22 7.90032C22 8.01277 21.9915 8.12423 21.9763 8.23479H21.9839V12.1548C21.9839 12.1641 21.984 12.1734 21.9839 12.1827V16.9378C21.9838 18.4028 20.8785 19.6787 19.2622 20.5275C17.6036 21.3984 15.1898 21.961 12.0003 21.961C8.79879 21.961 6.37801 21.3516 4.71689 20.4311C3.09999 19.5351 2.0163 18.2163 2.01606 16.7688V8.23479H2.02374C2.00851 8.12423 2.00001 8.01277 2 7.90032C2 5.19426 6.4776 3 12.0003 3ZM19.8389 15.5867C19.5023 15.8163 19.1437 16.0239 18.7734 16.2053C16.9845 17.0818 14.5886 17.5941 12.0003 17.5941C9.41205 17.5941 7.01555 17.0819 5.22662 16.2053C4.85632 16.0239 4.49771 15.8163 4.16109 15.5867V16.7688C4.16138 17.0936 4.45699 17.8347 5.75659 18.5549C7.01292 19.2511 9.04868 19.816 12.0003 19.816C14.964 19.816 17.0062 19.2893 18.2651 18.6283C19.5655 17.9453 19.8387 17.245 19.8389 16.9378V15.5867ZM19.8389 10.9398C18.0072 12.0718 15.1774 12.7999 12.0003 12.8C8.82306 12.8 5.99293 12.0718 4.16109 10.9398V12.1548C4.16109 12.724 4.66373 13.5412 6.17065 14.2795C7.60708 14.9833 9.66698 15.4491 12.0003 15.4491C14.3337 15.4491 16.3936 14.9834 17.83 14.2795C19.3264 13.5463 19.832 12.7353 19.8389 12.1666V10.9398ZM12.0178 5.09056C7.75321 5.09056 4.29618 6.29223 4.29585 7.77464C4.29585 9.25715 7.75301 10.4594 12.0178 10.4594C16.2826 10.4594 19.7398 9.25714 19.7398 7.77464C19.7394 6.29223 16.2824 5.09058 12.0178 5.09056Z",fill:"#1D1D1F"})})}function n({className:e}){return C("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:C("path",{d:"M14.9932 1.76724C15.3482 1.41222 15.9243 1.41222 16.2793 1.76724C16.6336 2.1222 16.6338 2.69756 16.2793 3.0524L14.1943 5.13736H21.0898C21.5919 5.13741 21.999 5.54449 21.999 6.04654V9.68326C21.9986 10.1849 21.5916 10.5924 21.0898 10.5924H20.6367V20.5915C20.6364 21.0933 20.2294 21.5006 19.7275 21.5006H4.27344C3.77154 21.5006 3.36455 21.0933 3.36426 20.5915V10.5924H2.9082C2.4064 10.5924 1.99947 10.185 1.99902 9.68326V6.04654C1.99902 5.54446 2.40613 5.13736 2.9082 5.13736H9.80469L7.7207 3.0524C7.36574 2.69744 7.36587 2.12228 7.7207 1.76724C8.07573 1.41222 8.65084 1.41222 9.00586 1.76724L11.999 4.75943L14.9932 1.76724ZM5.18262 19.6823H11.0908V10.5924H5.18262V19.6823ZM12.9092 19.6823H18.8193V10.5924H12.9092V19.6823ZM3.81738 8.77408H4.25C4.25777 8.77388 4.26562 8.7731 4.27344 8.7731H19.7275C19.7354 8.7731 19.7432 8.77388 19.751 8.77408H20.1807V6.95572H3.81738V8.77408Z",fill:"#080A0F"})})}function s({className:e}){return l("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[C("path",{d:"M12.9998 12C13.552 12 13.9998 12.4477 13.9998 13C13.9998 13.5523 13.552 14 12.9998 14H10.9998C10.4475 14 9.99977 13.5523 9.99977 13C9.99977 12.4477 10.4475 12 10.9998 12H12.9998Z",fill:"#080A0F"}),C("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.9998 1C14.4187 1.00001 16.4359 2.71782 16.8992 5H19.074C20.6543 5.00001 21.9642 6.2259 22.0681 7.80273L22.8572 19.8027C22.971 21.5333 21.5983 22.9999 19.864 23H4.13551C2.40123 22.9999 1.02849 21.5333 1.14235 19.8027L1.93141 7.80273C2.03531 6.22589 3.34525 5 4.92555 5H7.10035C7.56367 2.71782 9.58085 1 11.9998 1ZM4.92555 7C4.39875 7 3.96209 7.40891 3.9275 7.93457L3.13746 19.9346C3.09966 20.5113 3.55755 20.9999 4.13551 21H19.864C20.442 20.9999 20.8999 20.5113 20.8621 19.9346L20.072 7.93457C20.0375 7.40892 19.6008 7.00001 19.074 7H16.9998V11C16.9998 11.5523 16.552 12 15.9998 12C15.4475 12 14.9998 11.5523 14.9998 11V7H8.99977V11C8.99977 11.5523 8.55204 12 7.99977 12C7.44748 12 6.99977 11.5523 6.99977 11V7H4.92555ZM11.9998 3C10.6939 3 9.58571 3.83533 9.1736 5H14.8259C14.4138 3.83532 13.3056 3.00001 11.9998 3Z",fill:"#080A0F"})]})}function i({className:e}){return C("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:C("path",{d:"M5.52827 3.52876C5.78862 3.26841 6.21063 3.26841 6.47098 3.52876L10.471 7.52876C10.7313 7.78911 10.7313 8.21112 10.471 8.47147L6.47098 12.4715C6.21063 12.7318 5.78862 12.7318 5.52827 12.4715C5.26792 12.2111 5.26792 11.7891 5.52827 11.5288L9.05692 8.00011L5.52827 4.47147C5.26792 4.21112 5.26792 3.78911 5.52827 3.52876Z",fill:"#080A0F"})})}function o({className:e}){return C("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:C("path",{d:"M15 6L9 12L15 18",stroke:"#2A2C32",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function r({className:e}){return C("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:C("path",{d:"M5.6356 5.63569C6.02607 5.24511 6.65929 5.24516 7.04981 5.63569L11.9996 10.5854L16.9493 5.63569C17.3398 5.24516 17.973 5.24511 18.3635 5.63569C18.754 6.02623 18.7539 6.65937 18.3635 7.0499L13.4138 11.9996L18.3635 16.9494C18.7539 17.3399 18.754 17.9731 18.3635 18.3636C17.973 18.7542 17.3398 18.7541 16.9493 18.3636L11.9996 13.4139L7.04981 18.3636C6.65929 18.7541 6.02607 18.7542 5.6356 18.3636C5.24516 17.9731 5.24517 17.3399 5.6356 16.9494L10.5853 11.9996L5.6356 7.0499C5.24517 6.65937 5.24516 6.02623 5.6356 5.63569Z",fill:"#080A0F"})})}function w({className:e}){return l("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[C("path",{d:"M12 14.0006C12.5523 14.0006 12.9996 14.4479 12.9996 15.0002V18.0002C12.9996 18.5525 12.5523 18.9998 12 18.9998C11.4477 18.9998 11.0004 18.5525 11.0004 18.0002V15.0002C11.0004 14.4479 11.4477 14.0006 12 14.0006Z",fill:"#080A0F"}),C("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.9988 1.00098C15.3123 1.00119 17.9988 3.68739 17.9988 7.00098V10.001H18.9996C20.6564 10.001 21.9996 11.3441 21.9996 13.001V20.0006C21.9996 21.6574 20.6564 23.0006 18.9996 23.0006H5.00037C3.34351 23.0006 2.00037 21.6574 2.00037 20.0006V13.001C2.00037 11.3441 3.34351 10.001 5.00037 10.001H5.9988V7.00098C5.9988 3.68726 8.68512 1.00098 11.9988 1.00098ZM5.00037 12.0002C4.44808 12.0002 3.99959 12.4487 3.99959 13.001V20.0006C3.99959 20.5529 4.44808 21.0002 5.00037 21.0002H18.9996C19.5519 21.0002 20.0004 20.5529 20.0004 20.0006V13.001C20.0004 12.4487 19.5519 12.0002 18.9996 12.0002H5.00037ZM11.9988 3.0002C9.78969 3.0002 7.99802 4.79184 7.99802 7.00098V10.001H15.9984V7.00098C15.9984 4.79197 14.2077 3.00041 11.9988 3.0002Z",fill:"#080A0F"})]})}function g({className:e}){return l("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[C("path",{d:"M12 7C12.5523 7 13 7.44772 13 8V10H15C15.5523 10 16 10.4477 16 11C16 11.5523 15.5523 12 15 12H13V14C13 14.5523 12.5523 15 12 15C11.4477 15 11 14.5523 11 14V12H9C8.44772 12 8 11.5523 8 11C8 10.4477 8.44772 10 9 10H11V8C11 7.44772 11.4477 7 12 7Z",fill:"#080A0F"}),C("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 1.5C20.1046 1.5 21 2.39544 21 3.5V20.8574C20.9998 22.3559 19.4122 23.322 18.0811 22.6338L12 19.4893L5.91895 22.6338C4.5878 23.322 3.00016 22.3559 3 20.8574V3.5C3 2.39543 3.89543 1.5 5 1.5H19ZM5 20.8574L11.541 17.4756L11.6514 17.4268C11.9137 17.3291 12.207 17.3454 12.459 17.4756L19 20.8574V3.5H5V20.8574Z",fill:"#080A0F"})]})}function a({className:e}){return l("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[C("path",{d:"M16 17C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H8C7.44772 19 7 18.5523 7 18C7 17.4477 7.44772 17 8 17H16Z",fill:"#080A0F"}),C("path",{d:"M16 13C16.5523 13 17 13.4477 17 14C17 14.5523 16.5523 15 16 15H8C7.44772 15 7 14.5523 7 14C7 13.4477 7.44772 13 8 13H16Z",fill:"#080A0F"}),C("path",{d:"M16 9C16.5523 9 17 9.44771 17 10C17 10.5523 16.5523 11 16 11H8C7.44772 11 7 10.5523 7 10C7 9.44771 7.44772 9 8 9H16Z",fill:"#080A0F"}),C("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14 1C15.0249 1 15.9041 1.61743 16.29 2.5H17.999L18.1543 2.50391C19.7392 2.58449 20.999 3.89508 20.999 5.5V20C20.999 21.6569 19.6559 23 17.999 23H6.00781C4.35096 23 3.00781 21.6569 3.00781 20V5.5C3.00781 3.84315 4.35096 2.5 6.00781 2.5H7.70996C8.0959 1.61743 8.97512 1 10 1H14ZM6.00781 4.5C5.45553 4.5 5.00781 4.94772 5.00781 5.5V20C5.00781 20.5523 5.45553 21 6.00781 21H17.999C18.5513 21 18.999 20.5523 18.999 20V5.5C18.999 4.98218 18.6059 4.55602 18.1016 4.50488L17.999 4.5H16.4805C16.363 5.35738 15.6299 6.01836 14.7402 6.01855H9.24805C8.35832 6.01844 7.6243 5.35749 7.50684 4.5H6.00781ZM10 3C9.72386 3 9.5 3.22386 9.5 3.5C9.5 3.77614 9.72386 4 10 4H14C14.2761 4 14.5 3.77614 14.5 3.5C14.5 3.22386 14.2761 3 14 3H10Z",fill:"#080A0F"})]})}export{i as IconArrow,s as IconBag,r as IconClose,t as IconCredit,w as IconLock,a as IconOrders,n as IconReferral,g as IconSubscription,o as IconSwitch};
|
|
2
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/memberPopup/icons.tsx"],
|
|
4
|
+
"sourcesContent": ["export function IconCredit({ className }: { className?: string }) {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.0003 3C17.523 3.00008 22 5.19431 22 7.90032C22 8.01277 21.9915 8.12423 21.9763 8.23479H21.9839V12.1548C21.9839 12.1641 21.984 12.1734 21.9839 12.1827V16.9378C21.9838 18.4028 20.8785 19.6787 19.2622 20.5275C17.6036 21.3984 15.1898 21.961 12.0003 21.961C8.79879 21.961 6.37801 21.3516 4.71689 20.4311C3.09999 19.5351 2.0163 18.2163 2.01606 16.7688V8.23479H2.02374C2.00851 8.12423 2.00001 8.01277 2 7.90032C2 5.19426 6.4776 3 12.0003 3ZM19.8389 15.5867C19.5023 15.8163 19.1437 16.0239 18.7734 16.2053C16.9845 17.0818 14.5886 17.5941 12.0003 17.5941C9.41205 17.5941 7.01555 17.0819 5.22662 16.2053C4.85632 16.0239 4.49771 15.8163 4.16109 15.5867V16.7688C4.16138 17.0936 4.45699 17.8347 5.75659 18.5549C7.01292 19.2511 9.04868 19.816 12.0003 19.816C14.964 19.816 17.0062 19.2893 18.2651 18.6283C19.5655 17.9453 19.8387 17.245 19.8389 16.9378V15.5867ZM19.8389 10.9398C18.0072 12.0718 15.1774 12.7999 12.0003 12.8C8.82306 12.8 5.99293 12.0718 4.16109 10.9398V12.1548C4.16109 12.724 4.66373 13.5412 6.17065 14.2795C7.60708 14.9833 9.66698 15.4491 12.0003 15.4491C14.3337 15.4491 16.3936 14.9834 17.83 14.2795C19.3264 13.5463 19.832 12.7353 19.8389 12.1666V10.9398ZM12.0178 5.09056C7.75321 5.09056 4.29618 6.29223 4.29585 7.77464C4.29585 9.25715 7.75301 10.4594 12.0178 10.4594C16.2826 10.4594 19.7398 9.25714 19.7398 7.77464C19.7394 6.29223 16.2824 5.09058 12.0178 5.09056Z\"\n fill=\"#1D1D1F\"\n />\n </svg>\n )\n}\n\nexport function IconReferral({ className }: { className?: string }) {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n >\n <path\n d=\"M14.9932 1.76724C15.3482 1.41222 15.9243 1.41222 16.2793 1.76724C16.6336 2.1222 16.6338 2.69756 16.2793 3.0524L14.1943 5.13736H21.0898C21.5919 5.13741 21.999 5.54449 21.999 6.04654V9.68326C21.9986 10.1849 21.5916 10.5924 21.0898 10.5924H20.6367V20.5915C20.6364 21.0933 20.2294 21.5006 19.7275 21.5006H4.27344C3.77154 21.5006 3.36455 21.0933 3.36426 20.5915V10.5924H2.9082C2.4064 10.5924 1.99947 10.185 1.99902 9.68326V6.04654C1.99902 5.54446 2.40613 5.13736 2.9082 5.13736H9.80469L7.7207 3.0524C7.36574 2.69744 7.36587 2.12228 7.7207 1.76724C8.07573 1.41222 8.65084 1.41222 9.00586 1.76724L11.999 4.75943L14.9932 1.76724ZM5.18262 19.6823H11.0908V10.5924H5.18262V19.6823ZM12.9092 19.6823H18.8193V10.5924H12.9092V19.6823ZM3.81738 8.77408H4.25C4.25777 8.77388 4.26562 8.7731 4.27344 8.7731H19.7275C19.7354 8.7731 19.7432 8.77388 19.751 8.77408H20.1807V6.95572H3.81738V8.77408Z\"\n fill=\"#080A0F\"\n />\n </svg>\n )\n}\n\nexport function IconBag({ className }: { className?: string }) {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n >\n <path\n d=\"M12.9998 12C13.552 12 13.9998 12.4477 13.9998 13C13.9998 13.5523 13.552 14 12.9998 14H10.9998C10.4475 14 9.99977 13.5523 9.99977 13C9.99977 12.4477 10.4475 12 10.9998 12H12.9998Z\"\n fill=\"#080A0F\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M11.9998 1C14.4187 1.00001 16.4359 2.71782 16.8992 5H19.074C20.6543 5.00001 21.9642 6.2259 22.0681 7.80273L22.8572 19.8027C22.971 21.5333 21.5983 22.9999 19.864 23H4.13551C2.40123 22.9999 1.02849 21.5333 1.14235 19.8027L1.93141 7.80273C2.03531 6.22589 3.34525 5 4.92555 5H7.10035C7.56367 2.71782 9.58085 1 11.9998 1ZM4.92555 7C4.39875 7 3.96209 7.40891 3.9275 7.93457L3.13746 19.9346C3.09966 20.5113 3.55755 20.9999 4.13551 21H19.864C20.442 20.9999 20.8999 20.5113 20.8621 19.9346L20.072 7.93457C20.0375 7.40892 19.6008 7.00001 19.074 7H16.9998V11C16.9998 11.5523 16.552 12 15.9998 12C15.4475 12 14.9998 11.5523 14.9998 11V7H8.99977V11C8.99977 11.5523 8.55204 12 7.99977 12C7.44748 12 6.99977 11.5523 6.99977 11V7H4.92555ZM11.9998 3C10.6939 3 9.58571 3.83533 9.1736 5H14.8259C14.4138 3.83532 13.3056 3.00001 11.9998 3Z\"\n fill=\"#080A0F\"\n />\n </svg>\n )\n}\n\nexport function IconArrow({ className }: { className?: string }) {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n >\n <path\n d=\"M5.52827 3.52876C5.78862 3.26841 6.21063 3.26841 6.47098 3.52876L10.471 7.52876C10.7313 7.78911 10.7313 8.21112 10.471 8.47147L6.47098 12.4715C6.21063 12.7318 5.78862 12.7318 5.52827 12.4715C5.26792 12.2111 5.26792 11.7891 5.52827 11.5288L9.05692 8.00011L5.52827 4.47147C5.26792 4.21112 5.26792 3.78911 5.52827 3.52876Z\"\n fill=\"#080A0F\"\n />\n </svg>\n )\n}\n\nexport function IconSwitch({ className }: { className?: string }) {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n >\n <path\n d=\"M15 6L9 12L15 18\"\n stroke=\"#2A2C32\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\nexport function IconClose({ className }: { className?: string }) {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n >\n <path\n d=\"M5.6356 5.63569C6.02607 5.24511 6.65929 5.24516 7.04981 5.63569L11.9996 10.5854L16.9493 5.63569C17.3398 5.24516 17.973 5.24511 18.3635 5.63569C18.754 6.02623 18.7539 6.65937 18.3635 7.0499L13.4138 11.9996L18.3635 16.9494C18.7539 17.3399 18.754 17.9731 18.3635 18.3636C17.973 18.7542 17.3398 18.7541 16.9493 18.3636L11.9996 13.4139L7.04981 18.3636C6.65929 18.7541 6.02607 18.7542 5.6356 18.3636C5.24516 17.9731 5.24517 17.3399 5.6356 16.9494L10.5853 11.9996L5.6356 7.0499C5.24517 6.65937 5.24516 6.02623 5.6356 5.63569Z\"\n fill=\"#080A0F\"\n />\n </svg>\n )\n}\n\nexport function IconLock({ className }: { className?: string }) {\n return (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" className={className}>\n <path d=\"M12 14.0006C12.5523 14.0006 12.9996 14.4479 12.9996 15.0002V18.0002C12.9996 18.5525 12.5523 18.9998 12 18.9998C11.4477 18.9998 11.0004 18.5525 11.0004 18.0002V15.0002C11.0004 14.4479 11.4477 14.0006 12 14.0006Z\" fill=\"#080A0F\" />\n <path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M11.9988 1.00098C15.3123 1.00119 17.9988 3.68739 17.9988 7.00098V10.001H18.9996C20.6564 10.001 21.9996 11.3441 21.9996 13.001V20.0006C21.9996 21.6574 20.6564 23.0006 18.9996 23.0006H5.00037C3.34351 23.0006 2.00037 21.6574 2.00037 20.0006V13.001C2.00037 11.3441 3.34351 10.001 5.00037 10.001H5.9988V7.00098C5.9988 3.68726 8.68512 1.00098 11.9988 1.00098ZM5.00037 12.0002C4.44808 12.0002 3.99959 12.4487 3.99959 13.001V20.0006C3.99959 20.5529 4.44808 21.0002 5.00037 21.0002H18.9996C19.5519 21.0002 20.0004 20.5529 20.0004 20.0006V13.001C20.0004 12.4487 19.5519 12.0002 18.9996 12.0002H5.00037ZM11.9988 3.0002C9.78969 3.0002 7.99802 4.79184 7.99802 7.00098V10.001H15.9984V7.00098C15.9984 4.79197 14.2077 3.00041 11.9988 3.0002Z\" fill=\"#080A0F\" />\n </svg>\n )\n}\n\nexport function IconSubscription({ className }: { className?: string }) {\n return (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" className={className}>\n <path d=\"M12 7C12.5523 7 13 7.44772 13 8V10H15C15.5523 10 16 10.4477 16 11C16 11.5523 15.5523 12 15 12H13V14C13 14.5523 12.5523 15 12 15C11.4477 15 11 14.5523 11 14V12H9C8.44772 12 8 11.5523 8 11C8 10.4477 8.44772 10 9 10H11V8C11 7.44772 11.4477 7 12 7Z\" fill=\"#080A0F\" />\n <path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M19 1.5C20.1046 1.5 21 2.39544 21 3.5V20.8574C20.9998 22.3559 19.4122 23.322 18.0811 22.6338L12 19.4893L5.91895 22.6338C4.5878 23.322 3.00016 22.3559 3 20.8574V3.5C3 2.39543 3.89543 1.5 5 1.5H19ZM5 20.8574L11.541 17.4756L11.6514 17.4268C11.9137 17.3291 12.207 17.3454 12.459 17.4756L19 20.8574V3.5H5V20.8574Z\" fill=\"#080A0F\" />\n </svg>\n )\n}\n\nexport function IconOrders({ className }: { className?: string }) {\n return (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" className={className}>\n <path d=\"M16 17C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H8C7.44772 19 7 18.5523 7 18C7 17.4477 7.44772 17 8 17H16Z\" fill=\"#080A0F\" />\n <path d=\"M16 13C16.5523 13 17 13.4477 17 14C17 14.5523 16.5523 15 16 15H8C7.44772 15 7 14.5523 7 14C7 13.4477 7.44772 13 8 13H16Z\" fill=\"#080A0F\" />\n <path d=\"M16 9C16.5523 9 17 9.44771 17 10C17 10.5523 16.5523 11 16 11H8C7.44772 11 7 10.5523 7 10C7 9.44771 7.44772 9 8 9H16Z\" fill=\"#080A0F\" />\n <path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M14 1C15.0249 1 15.9041 1.61743 16.29 2.5H17.999L18.1543 2.50391C19.7392 2.58449 20.999 3.89508 20.999 5.5V20C20.999 21.6569 19.6559 23 17.999 23H6.00781C4.35096 23 3.00781 21.6569 3.00781 20V5.5C3.00781 3.84315 4.35096 2.5 6.00781 2.5H7.70996C8.0959 1.61743 8.97512 1 10 1H14ZM6.00781 4.5C5.45553 4.5 5.00781 4.94772 5.00781 5.5V20C5.00781 20.5523 5.45553 21 6.00781 21H17.999C18.5513 21 18.999 20.5523 18.999 20V5.5C18.999 4.98218 18.6059 4.55602 18.1016 4.50488L17.999 4.5H16.4805C16.363 5.35738 15.6299 6.01836 14.7402 6.01855H9.24805C8.35832 6.01844 7.6243 5.35749 7.50684 4.5H6.00781ZM10 3C9.72386 3 9.5 3.22386 9.5 3.5C9.5 3.77614 9.72386 4 10 4H14C14.2761 4 14.5 3.77614 14.5 3.5C14.5 3.22386 14.2761 3 14 3H10Z\" fill=\"#080A0F\" />\n </svg>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAUM,cAAAA,EA8BF,QAAAC,MA9BE,oBAVC,SAASC,EAAW,CAAE,UAAAC,CAAU,EAA2B,CAChE,OACEH,EAAC,OACC,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OACL,MAAM,6BACN,UAAWG,EAEX,SAAAH,EAAC,QACC,SAAS,UACT,SAAS,UACT,EAAE,41CACF,KA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AAC,QAAK,EAAE,qNAAqN,KAAK,UAAU,EAC5OA,EAAC,QAAK,SAAS,UAAU,SAAS,UAAU,EAAE,wtBAAwtB,KAAK,UAAU,GACvxB,CAEJ,CAEO,SAASU,EAAiB,CAAE,UAAAP,CAAU,EAA2B,CACtE,OACEF,EAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAA6B,UAAWE,EACxG,UAAAH,EAAC,QAAK,EAAE,uPAAuP,KAAK,UAAU,EAC9QA,EAAC,QAAK,SAAS,UAAU,SAAS,UAAU,EAAE,uTAAuT,KAAK,UAAU,GACtX,CAEJ,CAEO,SAASW,EAAW,CAAE,UAAAR,CAAU,EAA2B,CAChE,OACEF,EAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAA6B,UAAWE,EACxG,UAAAH,EAAC,QAAK,EAAE,2HAA2H,KAAK,UAAU,EAClJA,EAAC,QAAK,EAAE,2HAA2H,KAAK,UAAU,EAClJA,EAAC,QAAK,EAAE,uHAAuH,KAAK,UAAU,EAC9IA,EAAC,QAAK,SAAS,UAAU,SAAS,UAAU,EAAE,ktBAAktB,KAAK,UAAU,GACjxB,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "IconCredit", "className", "IconReferral", "IconBag", "IconArrow", "IconSwitch", "IconClose", "IconLock", "IconSubscription", "IconOrders"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { MemberPopup } from './MemberPopup';
|
|
2
|
+
export { useMemberPopupContext } from './context/provider';
|
|
3
|
+
export { MemberPopupPanelType, MemberPopupActionType, EarnCreditsTaskType, ConsumeCreditsItemType, } from './type';
|
|
4
|
+
export type { MemberPopupCopy, MemberPopupItem, MemberPopupLink, EarnCreditsCopy, CompleteProfileCopy, SubscribeModalCopy, ConsumeCreditsopy, ConsumeCreditsItem, RedeemCouponModalCopy, ReferralCopy, AlpcConfig, MemberPopupContextValue, } from './type';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{MemberPopup as p}from"./MemberPopup";import{useMemberPopupContext as m}from"./context/provider";import{MemberPopupPanelType as C,MemberPopupActionType as u,EarnCreditsTaskType as y,ConsumeCreditsItemType as n}from"./type";export{n as ConsumeCreditsItemType,y as EarnCreditsTaskType,p as MemberPopup,u as MemberPopupActionType,C as MemberPopupPanelType,m as useMemberPopupContext};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/memberPopup/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { MemberPopup } from './MemberPopup'\nexport { useMemberPopupContext } from './context/provider'\n\nexport {\n MemberPopupPanelType,\n MemberPopupActionType,\n EarnCreditsTaskType,\n ConsumeCreditsItemType,\n} from './type'\n\nexport type {\n MemberPopupCopy,\n MemberPopupItem,\n MemberPopupLink,\n EarnCreditsCopy,\n CompleteProfileCopy,\n SubscribeModalCopy,\n ConsumeCreditsopy,\n ConsumeCreditsItem,\n RedeemCouponModalCopy,\n ReferralCopy,\n AlpcConfig,\n MemberPopupContextValue,\n} from './type'\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,MAAmB,gBAC5B,OAAS,yBAAAC,MAA6B,qBAEtC,OACE,wBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,0BAAAC,MACK",
|
|
6
|
+
"names": ["MemberPopup", "useMemberPopupContext", "MemberPopupPanelType", "MemberPopupActionType", "EarnCreditsTaskType", "ConsumeCreditsItemType"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ActivitySubscribeCopy } from '../../type';
|
|
2
|
+
type Props = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onSuccess?: () => void;
|
|
6
|
+
copy: ActivitySubscribeCopy;
|
|
7
|
+
email?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function ActivitySubscribeModal({ isOpen, onClose, onSuccess, copy, email: initialEmail }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as t,jsxs as m}from"react/jsx-runtime";import{useCallback as w,useEffect as f,useState as b}from"react";import{Button as M,Checkbox as D,Text as h}from"@anker-in/headless-ui";import{classNames as l,useHeadlessContext as v}from"@anker-in/lib";import{CreditsModalContainer as P}from"../../../credits/modal/ModalContainer";import{useActivitySubscribe as T}from"./hooks/useActivitySubscribe";import{useMemberPopupContext as _}from"../../context/provider";import{ROUNDED_BRANDS as B}from"../../../../constants";function E({isOpen:C,onClose:d,onSuccess:c,copy:e,email:o}){const{alpcConfig:N}=_(),{storeDomain:g}=v(),[a,S]=b(!1),[n,p]=b(o??""),{brand:y}=v(),r=B.includes(y),{subscribe:x,loading:A,error:u,success:s}=T(e,N.locale,g);f(()=>{o&&p(o)},[o]),f(()=>{s&&(c?.(),setTimeout(()=>d(),3e3))},[s,c,d]);const k=w(()=>{x(n,a)},[x,n,a]);return t(P,{isOpen:C,onClose:d,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] md:mb-[24px]",useAnimation:!0,animationClassName:"md:translate-y-[100vh]",children:m("div",{className:"flex flex-col gap-[16px] text-center",children:[t(h,{className:"text-[22px] font-bold",html:e.title}),e.desc&&t(h,{className:"text-left text-[16px] font-semibold text-[#1f2021]",html:e.desc}),m("div",{className:l("flex h-[52px] w-full overflow-hidden md:flex-col md:h-auto md:gap-[16px]",r?"rounded-[2px]":"rounded-none"),children:[t("input",{className:l("h-full flex-1 border border-[#d8d8d8] px-[14px] text-[16px] outline-none placeholder:text-[#999] md:h-[52px]",r?"rounded-l-[2px] md:rounded-[2px]":"rounded-none"),placeholder:e.placeholder,value:n,onChange:i=>p(i.target.value.trim())}),t(M,{variant:"primary",loading:A,className:l("!h-full !min-w-0 !px-[24px] md:!h-[46px]",r?"!rounded-l-none !rounded-r-[2px] md:!rounded-[2px]":"!rounded-none"),onClick:k,children:e.buttonLabel??"Subscribe"})]}),m("div",{className:"flex w-full items-start gap-[8px]",children:[t(D,{checked:a,onCheckedChange:()=>S(i=>!i),className:"border-[#1d1d1f]"}),t("label",{className:"text-left text-[14px] font-semibold text-[#777] [&_a]:underline",dangerouslySetInnerHTML:{__html:e.policy??""}})]}),t("div",{className:l("text-left text-[16px] font-semibold",u&&"text-[#f84d4f]",s&&"text-[#52c41a]"),children:s?e.successTips??"Subscribed!":u})]})})}export{E as ActivitySubscribeModal};
|
|
2
|
+
//# sourceMappingURL=SubscribeModal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/memberPopup/panels/Activity/SubscribeModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\nimport { Button, Checkbox, Text } from '@anker-in/headless-ui'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { CreditsModalContainer } from '../../../credits/modal/ModalContainer'\nimport { emailValidate } from '../../../credits/context/utils'\nimport { useActivitySubscribe } from './hooks/useActivitySubscribe'\nimport { useMemberPopupContext } from '../../context/provider'\nimport type { ActivitySubscribeCopy } from '../../type'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype Props = {\n isOpen: boolean\n onClose: () => void\n onSuccess?: () => void\n copy: ActivitySubscribeCopy\n email?: string\n}\n\nexport function ActivitySubscribeModal({ isOpen, onClose, onSuccess, copy, email: initialEmail }: Props) {\n const { alpcConfig } = useMemberPopupContext()\n const { storeDomain } = useHeadlessContext()\n const [policy, setPolicy] = useState(false)\n const [email, setEmail] = useState(initialEmail ?? '')\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const { subscribe, loading, error, success } = useActivitySubscribe(copy, alpcConfig.locale, storeDomain)\n\n useEffect(() => {\n if (initialEmail) setEmail(initialEmail)\n }, [initialEmail])\n\n useEffect(() => {\n if (success) {\n onSuccess?.()\n setTimeout(() => onClose(), 3000)\n }\n }, [success, onSuccess, onClose])\n\n const handleSubmit = useCallback(() => {\n subscribe(email, policy)\n }, [subscribe, email, policy])\n\n return (\n <CreditsModalContainer\n isOpen={isOpen}\n onClose={onClose}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] md:mb-[24px]\"\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n >\n <div className=\"flex flex-col gap-[16px] text-center\">\n <Text className=\"text-[22px] font-bold\" html={copy.title} />\n {copy.desc && (\n <Text className=\"text-left text-[16px] font-semibold text-[#1f2021]\" html={copy.desc} />\n )}\n\n <div className={cn('flex h-[52px] w-full overflow-hidden md:flex-col md:h-auto md:gap-[16px]', rounded ? 'rounded-[2px]' : 'rounded-none')}>\n <input\n className={cn('h-full flex-1 border border-[#d8d8d8] px-[14px] text-[16px] outline-none placeholder:text-[#999] md:h-[52px]', rounded ? 'rounded-l-[2px] md:rounded-[2px]' : 'rounded-none')}\n placeholder={copy.placeholder}\n value={email}\n onChange={e => setEmail(e.target.value.trim())}\n />\n <Button\n variant=\"primary\"\n loading={loading}\n className={cn('!h-full !min-w-0 !px-[24px] md:!h-[46px]', rounded ? '!rounded-l-none !rounded-r-[2px] md:!rounded-[2px]' : '!rounded-none')}\n onClick={handleSubmit}\n >\n {copy.buttonLabel ?? 'Subscribe'}\n </Button>\n </div>\n\n <div className=\"flex w-full items-start gap-[8px]\">\n <Checkbox checked={policy} onCheckedChange={() => setPolicy(v => !v)} className=\"border-[#1d1d1f]\" />\n <label\n className=\"text-left text-[14px] font-semibold text-[#777] [&_a]:underline\"\n dangerouslySetInnerHTML={{ __html: copy.policy ?? '' }}\n />\n </div>\n\n <div className={cn('text-left text-[16px] font-semibold', error && 'text-[#f84d4f]', success && 'text-[#52c41a]')}>\n {success ? (copy.successTips ?? 'Subscribed!') : error}\n </div>\n </div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BAAmB,yBAEnB,SAAAf,EAAC,OAAI,UAAU,uCACb,UAAAD,EAACO,EAAA,CAAK,UAAU,wBAAwB,KAAMW,EAAK,MAAO,EACzDA,EAAK,MACJlB,EAACO,EAAA,CAAK,UAAU,qDAAqD,KAAMW,EAAK,KAAM,EAGxFjB,EAAC,OAAI,UAAWO,EAAG,2EAA4EmB,EAAU,gBAAkB,cAAc,EACvI,UAAA3B,EAAC,SACC,UAAWQ,EAAG,+GAAgHmB,EAAU,mCAAqC,cAAc,EAC3L,YAAaT,EAAK,YAClB,MAAOM,EACP,SAAUS,GAAKR,EAASQ,EAAE,OAAO,MAAM,KAAK,CAAC,EAC/C,EACAjC,EAACK,EAAA,CACC,QAAQ,UACR,QAASwB,EACT,UAAWrB,EAAG,2CAA4CmB,EAAU,qDAAuD,eAAe,EAC1I,QAASK,EAER,SAAAd,EAAK,aAAe,YACvB,GACF,EAEAjB,EAAC,OAAI,UAAU,oCACb,UAAAD,EAACM,EAAA,CAAS,QAASgB,EAAQ,gBAAiB,IAAMC,EAAUW,GAAK,CAACA,CAAC,EAAG,UAAU,mBAAmB,EACnGlC,EAAC,SACC,UAAU,kEACV,wBAAyB,CAAE,OAAQkB,EAAK,QAAU,EAAG,EACvD,GACF,EAEAlB,EAAC,OAAI,UAAWQ,EAAG,sCAAuCsB,GAAS,iBAAkBC,GAAW,gBAAgB,EAC7G,SAAAA,EAAWb,EAAK,aAAe,cAAiBY,EACnD,GACF,EACF,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "useCallback", "useEffect", "useState", "Button", "Checkbox", "Text", "cn", "useHeadlessContext", "CreditsModalContainer", "useActivitySubscribe", "useMemberPopupContext", "ROUNDED_BRANDS", "ActivitySubscribeModal", "isOpen", "onClose", "onSuccess", "copy", "initialEmail", "alpcConfig", "storeDomain", "policy", "setPolicy", "email", "setEmail", "brand", "rounded", "subscribe", "loading", "error", "success", "handleSubmit", "e", "v"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ActivitySubscribeCopy } from '../../../type';
|
|
2
|
+
export declare function useActivitySubscribe(copy: ActivitySubscribeCopy, locale: string, shopifyDomain: string): {
|
|
3
|
+
subscribe: (email: string, policy: boolean) => Promise<boolean>;
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: string;
|
|
6
|
+
success: boolean;
|
|
7
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useCallback as g,useState as n}from"react";import{parse as p}from"query-string";import _ from"js-cookie";import{emailValidate as y}from"../../../../credits/context/utils";function m(){if(typeof window>"u")return{register_source:""};const{search:e,href:s}=window.location;return{register_source:p(e).redirect??_.get("reg_source")??s}}function A(e,s,t){const[u,o]=n(!1),[c,r]=n(""),[b,l]=n(!1);return{subscribe:g(async(i,f)=>{if(r(""),!i)return r("Please fill in your email"),!1;if(!y(i))return r("Invalid email address"),!1;if(!f)return r("Please agree to the policy"),!1;o(!0);const{register_source:d}=m();try{const a=await(await fetch("/api/multipass/rainbowbridge/activities",{method:"POST",headers:{"Content-Type":"application/json","current-language":s},body:JSON.stringify({email:i,register_source:d,shopify_domain:t,single_brand_subscribe:e.single_brand_subscribe??!0,genre:e.genre??"",sub_brand_type:e.sub_brand_type??""})})).json();return a.errors?(r(a.errors??"Error occurred"),!1):(l(!0),!0)}catch{return r("Network error"),!1}finally{o(!1)}},[s,e.single_brand_subscribe,e.genre,e.sub_brand_type,t]),loading:u,error:c,success:b}}export{A as useActivitySubscribe};
|
|
2
|
+
//# sourceMappingURL=useActivitySubscribe.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.ts"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useState } from 'react'\nimport { parse } from 'query-string'\nimport Cookies from 'js-cookie'\nimport { emailValidate } from '../../../../credits/context/utils'\nimport type { ActivitySubscribeCopy } from '../../../type'\n\nfunction getAdCookie() {\n if (typeof window === 'undefined') return { register_source: '' }\n const { search, href } = window.location\n const query = parse(search)\n return {\n register_source: query.redirect ?? Cookies.get('reg_source') ?? href,\n }\n}\n\nexport function useActivitySubscribe(copy: ActivitySubscribeCopy, locale: string, shopifyDomain: string) {\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState('')\n const [success, setSuccess] = useState(false)\n\n const subscribe = useCallback(\n async (email: string, policy: boolean): Promise<boolean> => {\n setError('')\n if (!email) { setError('Please fill in your email'); return false }\n if (!emailValidate(email)) { setError('Invalid email address'); return false }\n if (!policy) { setError('Please agree to the policy'); return false }\n\n setLoading(true)\n const { register_source } = getAdCookie()\n try {\n const response = await fetch('/api/multipass/rainbowbridge/activities', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', 'current-language': locale },\n body: JSON.stringify({\n email,\n register_source,\n shopify_domain: shopifyDomain,\n single_brand_subscribe: copy.single_brand_subscribe ?? true,\n genre: copy.genre ?? '',\n sub_brand_type: copy.sub_brand_type ?? '',\n }),\n })\n const result = await response.json()\n if (!result.errors) {\n setSuccess(true)\n return true\n }\n setError(result.errors ?? 'Error occurred')\n return false\n } catch {\n setError('Network error')\n return false\n } finally {\n setLoading(false)\n }\n },\n [locale, copy.single_brand_subscribe, copy.genre, copy.sub_brand_type, shopifyDomain]\n )\n\n return { subscribe, loading, error, success }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,EAAa,YAAAC,MAAgB,QACtC,OAAS,SAAAC,MAAa,eACtB,OAAOC,MAAa,YACpB,OAAS,iBAAAC,MAAqB,oCAG9B,SAASC,GAAc,CACrB,GAAI,OAAO,OAAW,IAAa,MAAO,CAAE,gBAAiB,EAAG,EAChE,KAAM,CAAE,OAAAC,EAAQ,KAAAC,CAAK,EAAI,OAAO,SAEhC,MAAO,CACL,gBAFYL,EAAMI,CAAM,EAED,UAAYH,EAAQ,IAAI,YAAY,GAAKI,CAClE,CACF,CAEO,SAASC,EAAqBC,EAA6BC,EAAgBC,EAAuB,CACvG,KAAM,CAACC,EAASC,CAAU,EAAIZ,EAAS,EAAK,EACtC,CAACa,EAAOC,CAAQ,EAAId,EAAS,EAAE,EAC/B,CAACe,EAASC,CAAU,EAAIhB,EAAS,EAAK,EAyC5C,MAAO,CAAE,UAvCSD,EAChB,MAAOkB,EAAeC,IAAsC,CAE1D,GADAJ,EAAS,EAAE,EACP,CAACG,EAAS,OAAAH,EAAS,2BAA2B,EAAU,GAC5D,GAAI,CAACX,EAAcc,CAAK,EAAK,OAAAH,EAAS,uBAAuB,EAAU,GACvE,GAAI,CAACI,EAAU,OAAAJ,EAAS,4BAA4B,EAAU,GAE9DF,EAAW,EAAI,EACf,KAAM,CAAE,gBAAAO,CAAgB,EAAIf,EAAY,EACxC,GAAI,CAaF,MAAMgB,EAAS,MAZE,MAAM,MAAM,0CAA2C,CACtE,OAAQ,OACR,QAAS,CAAE,eAAgB,mBAAoB,mBAAoBX,CAAO,EAC1E,KAAM,KAAK,UAAU,CACnB,MAAAQ,EACA,gBAAAE,EACA,eAAgBT,EAChB,uBAAwBF,EAAK,wBAA0B,GACvD,MAAOA,EAAK,OAAS,GACrB,eAAgBA,EAAK,gBAAkB,EACzC,CAAC,CACH,CAAC,GAC6B,KAAK,EACnC,OAAKY,EAAO,QAIZN,EAASM,EAAO,QAAU,gBAAgB,EACnC,KAJLJ,EAAW,EAAI,EACR,GAIX,MAAQ,CACN,OAAAF,EAAS,eAAe,EACjB,EACT,QAAE,CACAF,EAAW,EAAK,CAClB,CACF,EACA,CAACH,EAAQD,EAAK,uBAAwBA,EAAK,MAAOA,EAAK,eAAgBE,CAAa,CACtF,EAEoB,QAAAC,EAAS,MAAAE,EAAO,QAAAE,CAAQ,CAC9C",
|
|
6
|
+
"names": ["useCallback", "useState", "parse", "Cookies", "emailValidate", "getAdCookie", "search", "href", "useActivitySubscribe", "copy", "locale", "shopifyDomain", "loading", "setLoading", "error", "setError", "success", "setSuccess", "email", "policy", "register_source", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as p,jsx as t,jsxs as i}from"react/jsx-runtime";import{useState as m}from"react";import{Button as s,Picture as u,Text as r}from"@anker-in/headless-ui";import{CreditsModalContainer as b}from"../../../credits/modal/ModalContainer";import{useMemberPopupContext as d}from"../../context/provider";import{ActivitySubscribeModal as c}from"./SubscribeModal";function f({copy:e,onClose:l}){const{profile:o}=d(),[n,a]=m(!1);return i(p,{children:[t(b,{isOpen:!0,onClose:l,title:void 0,className:"w-[540px] md:h-auto",useAnimation:!0,animationClassName:"md:translate-y-[100vh]",children:i("div",{className:"flex flex-col gap-[20px]",children:[e.image?.url&&t(u,{source:e.image.url,alt:e.image.alt??"",className:"w-full rounded-[8px]"}),e.title&&t(r,{className:"text-[20px] font-bold",html:e.title}),e.description&&t(r,{className:"text-[14px] leading-[1.5] text-[#666]",html:e.description}),i("div",{className:"flex gap-[12px]",children:[e.ctaButton&&t(s,{variant:"primary",size:"lg",className:"flex-1",as:e.ctaUrl?"a":"button",...e.ctaUrl?{href:e.ctaUrl,target:"_blank",rel:"noopener noreferrer"}:{},children:e.ctaButton}),e.subscribe&&t(s,{variant:"secondary",size:"lg",className:"flex-1",onClick:()=>a(!0),children:e.subscribe.buttonLabel??"Subscribe"})]})]})}),e.subscribe&&t(c,{isOpen:n,onClose:()=>a(!1),copy:e.subscribe,email:o?.email})]})}var h=f;export{h as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/memberPopup/panels/Activity/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useState } from 'react'\nimport { Button, Picture, Text } from '@anker-in/headless-ui'\nimport { CreditsModalContainer } from '../../../credits/modal/ModalContainer'\nimport { useMemberPopupContext } from '../../context/provider'\nimport { ActivitySubscribeModal } from './SubscribeModal'\nimport type { ActivityCopy } from '../../type'\n\ntype Props = {\n copy: ActivityCopy\n onClose: () => void\n}\n\nfunction Activity({ copy, onClose }: Props) {\n const { profile } = useMemberPopupContext()\n const [isSubscribeOpen, setIsSubscribeOpen] = useState(false)\n\n return (\n <>\n <CreditsModalContainer\n isOpen\n onClose={onClose}\n title={undefined}\n className=\"w-[540px] md:h-auto\"\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n >\n <div className=\"flex flex-col gap-[20px]\">\n {copy.image?.url && (\n <Picture\n source={copy.image.url}\n alt={copy.image.alt ?? ''}\n className=\"w-full rounded-[8px]\"\n />\n )}\n {copy.title && (\n <Text className=\"text-[20px] font-bold\" html={copy.title} />\n )}\n {copy.description && (\n <Text className=\"text-[14px] leading-[1.5] text-[#666]\" html={copy.description} />\n )}\n <div className=\"flex gap-[12px]\">\n {copy.ctaButton && (\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"flex-1\"\n as={copy.ctaUrl ? 'a' : 'button'}\n {...(copy.ctaUrl\n ? { href: copy.ctaUrl, target: '_blank', rel: 'noopener noreferrer' }\n : {})}\n >\n {copy.ctaButton}\n </Button>\n )}\n {copy.subscribe && (\n <Button\n variant=\"secondary\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={() => setIsSubscribeOpen(true)}\n >\n {copy.subscribe.buttonLabel ?? 'Subscribe'}\n </Button>\n )}\n </div>\n </div>\n </CreditsModalContainer>\n\n {copy.subscribe && (\n <ActivitySubscribeModal\n isOpen={isSubscribeOpen}\n onClose={() => setIsSubscribeOpen(false)}\n copy={copy.subscribe}\n email={profile?.email}\n />\n )}\n </>\n )\n}\n\nexport default Activity\n"],
|
|
5
|
+
"mappings": "AAiBI,mBAAAA,EAWQ,OAAAC,EAYF,QAAAC,MAvBN,oBAjBJ,OAAS,YAAAC,MAAgB,QACzB,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAS,yBAAAC,MAA6B,wCACtC,OAAS,yBAAAC,MAA6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upContext", "ActivitySubscribeModal", "Activity", "copy", "onClose", "profile", "isSubscribeOpen", "setIsSubscribeOpen", "Activity_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RedeemCouponModalCopy, AlpcConfig } from '../../type';
|
|
2
|
+
type Props = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
itemTitle: string;
|
|
6
|
+
itemCredits: number;
|
|
7
|
+
itemImage?: {
|
|
8
|
+
url: string;
|
|
9
|
+
alt?: string;
|
|
10
|
+
};
|
|
11
|
+
redeemId: number;
|
|
12
|
+
userId?: string;
|
|
13
|
+
copy: RedeemCouponModalCopy;
|
|
14
|
+
pointUnit?: string;
|
|
15
|
+
alpcConfig: AlpcConfig;
|
|
16
|
+
onError?: (code: number) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare function RedeemCouponModal({ isOpen, onClose, itemTitle, itemCredits, itemImage, redeemId, userId, copy, pointUnit, alpcConfig, onError, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as w,jsx as t,jsxs as s}from"react/jsx-runtime";import{useCallback as S,useEffect as A,useState as c}from"react";import{Button as h,Text as l}from"@anker-in/headless-ui";import{classNames as E}from"@anker-in/lib";import{CreditsModalContainer as U}from"../../../credits/modal/ModalContainer";import{AlpcErrorCode as a}from"../../../credits/context/const";import{useRedeemCoupon as _}from"./hooks/useRedeemCoupon";import z from"../../../credits/context/hooks/useCopy";function J({isOpen:m,onClose:x,itemTitle:D,itemCredits:B,itemImage:d,redeemId:u,userId:f,copy:e,pointUnit:R="pts",alpcConfig:M,onError:C}){const[p,b]=c(),[g,n]=c(""),[T,r]=c(!1),{copy:k,copied:N}=z(),{isMutating:y,trigger:v}=_(M),L=S(async()=>{n("");const{data:o}=await v({user_id:f,rule_id:u});if(!o){n(e.commonError);return}if(o.data?.success)b(o.data.coupon_code);else{let i=e.commonError;o.code===a.CodeLpcShopifyCouponRuleRedeemLimit?(i=e.redeemLimitError,r(!0)):o.code===a.CodeLpcRuleInventoryNotEnough?(i=e.inventoryNotEnough,r(!0)):o.code===a.CodeLpcNotEnoughCredits?(i=e.creditsNotEnough,r(!0)):o.code===a.CodeCrossSiteError&&(i=e.crossSiteError,r(!0)),n(i),C?.(o.code)}},[v,f,u,e,C]);return A(()=>{m||(b(void 0),n(""),r(!1))},[m]),s(U,{isOpen:m,onClose:x,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] px-0 min-l:px-0 md:mb-[24px]",titleClassName:"h-[56px] bg-[#f5f5f7]",children:[s("div",{className:"bg-[#f5f5f7] px-[48px] pb-[24px] md:px-[16px]",children:[d?.url&&t("div",{className:"relative mx-auto h-[164px] w-[324px]",children:t("img",{src:d.url,alt:d.alt??"",className:"h-full w-full object-cover"})}),s("p",{className:E("mt-[30px] text-center text-[24px] font-bold md:mt-[18px] md:text-[20px]"),children:[B," ",R]})]}),t("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:p?s(w,{children:[s("div",{className:"flex items-center justify-center gap-[10px]",children:[t("span",{className:"text-[24px] font-bold",children:p}),t("button",{className:E("text-[16px] font-bold underline",N&&"pointer-events-none"),onClick:()=>k(p),children:N?"Copied":"Copy"})]}),t(l,{className:"mb-[4px] mt-[16px] text-[24px] font-bold md:text-[20px]",html:e.successTitle}),t(l,{className:"text-[16px] font-bold text-[#6d6d6f] md:text-[14px]",html:e.successDesc}),t(h,{variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:()=>{e.successButtonUrl&&(window.location.href=e.successButtonUrl),x()},children:e.successButton})]}):s(w,{children:[t(l,{className:"block text-[24px] font-bold md:text-[20px]",html:e.confirmTitle}),t(h,{loading:y,variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:L,disabled:T,children:e.confirmButton})]})}),g&&t("div",{className:"bg-white px-[48px] py-[12px] text-center md:px-[16px]",children:t(l,{className:"text-[14px] font-semibold text-[#ff0000]",html:g})})]})}export{J as RedeemCouponModal};
|
|
2
|
+
//# sourceMappingURL=RedeemCouponModal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\nimport { Button, Text } from '@anker-in/headless-ui'\nimport { classNames as cn } from '@anker-in/lib'\nimport { CreditsModalContainer } from '../../../credits/modal/ModalContainer'\nimport { AlpcErrorCode } from '../../../credits/context/const'\nimport { useRedeemCoupon } from './hooks/useRedeemCoupon'\nimport useCopy from '../../../credits/context/hooks/useCopy'\nimport type { RedeemCouponModalCopy, AlpcConfig } from '../../type'\n\ntype Props = {\n isOpen: boolean\n onClose: () => void\n itemTitle: string\n itemCredits: number\n itemImage?: { url: string; alt?: string }\n redeemId: number\n userId?: string\n copy: RedeemCouponModalCopy\n pointUnit?: string\n alpcConfig: AlpcConfig\n onError?: (code: number) => void\n}\n\nexport function RedeemCouponModal({\n isOpen,\n onClose,\n itemTitle,\n itemCredits,\n itemImage,\n redeemId,\n userId,\n copy,\n pointUnit = 'pts',\n alpcConfig,\n onError,\n}: Props) {\n const [couponCode, setCouponCode] = useState<string>()\n const [errorInfo, setErrorInfo] = useState('')\n const [disabled, setDisabled] = useState(false)\n const { copy: copyText, copied } = useCopy()\n\n const { isMutating: loading, trigger } = useRedeemCoupon(alpcConfig)\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n const { data } = await trigger({ user_id: userId, rule_id: redeemId })\n if (!data) {\n setErrorInfo(copy.commonError)\n return\n }\n if (data.data?.success) {\n setCouponCode(data.data.coupon_code)\n } else {\n let msg = copy.commonError\n if (data.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n msg = copy.redeemLimitError\n setDisabled(true)\n } else if (data.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n msg = copy.inventoryNotEnough\n setDisabled(true)\n } else if (data.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n msg = copy.creditsNotEnough\n setDisabled(true)\n } else if (data.code === AlpcErrorCode.CodeCrossSiteError) {\n msg = copy.crossSiteError\n setDisabled(true)\n }\n setErrorInfo(msg)\n onError?.(data.code)\n }\n }, [trigger, userId, redeemId, copy, onError])\n\n useEffect(() => {\n if (!isOpen) {\n setCouponCode(undefined)\n setErrorInfo('')\n setDisabled(false)\n }\n }, [isOpen])\n\n return (\n <CreditsModalContainer\n isOpen={isOpen}\n onClose={onClose}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] px-0 min-l:px-0 md:mb-[24px]\"\n titleClassName=\"h-[56px] bg-[#f5f5f7]\"\n >\n <div className=\"bg-[#f5f5f7] px-[48px] pb-[24px] md:px-[16px]\">\n {itemImage?.url && (\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n <img src={itemImage.url} alt={itemImage.alt ?? ''} className=\"h-full w-full object-cover\" />\n </div>\n )}\n <p className={cn('mt-[30px] text-center text-[24px] font-bold md:mt-[18px] md:text-[20px]')}>\n {itemCredits} {pointUnit}\n </p>\n </div>\n\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n {!couponCode ? (\n <>\n <Text className=\"block text-[24px] font-bold md:text-[20px]\" html={copy.confirmTitle} />\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={handleConfirm}\n disabled={disabled}\n >\n {copy.confirmButton}\n </Button>\n </>\n ) : (\n <>\n <div className=\"flex items-center justify-center gap-[10px]\">\n <span className=\"text-[24px] font-bold\">{couponCode}</span>\n <button\n className={cn('text-[16px] font-bold underline', copied && 'pointer-events-none')}\n onClick={() => copyText(couponCode)}\n >\n {copied ? 'Copied' : 'Copy'}\n </button>\n </div>\n <Text className=\"mb-[4px] mt-[16px] text-[24px] font-bold md:text-[20px]\" html={copy.successTitle} />\n <Text className=\"text-[16px] font-bold text-[#6d6d6f] md:text-[14px]\" html={copy.successDesc} />\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={() => {\n if (copy.successButtonUrl) window.location.href = copy.successButtonUrl\n onClose()\n }}\n >\n {copy.successButton}\n </Button>\n </>\n )}\n </div>\n\n {errorInfo && (\n <div className=\"bg-white px-[48px] py-[12px] text-center md:px-[16px]\">\n <Text className=\"text-[14px] font-semibold text-[#ff0000]\" html={errorInfo} />\n </div>\n )}\n </CreditsModalContainer>\n )\n}\n"],
|
|
5
|
+
"mappings": "AA2FY,OAUF,YAAAA,EAVE,OAAAC,EAGJ,QAAAC,MAHI,oBA3FZ,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QACjD,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAS,cAAcC,MAAU,gBACjC,OAAS,yBAAAC,MAA6B,wCACtC,OAAS,iBAAAC,MAAqB,iCAC9B,OAAS,mBAAAC,MAAuB,0BAChC,OAAOC,MAAa,yCAiBb,SAASC,EAAkB,CAChC,OAAAC,EACA,QAAAC,EACA,UAAAC,EACA,YAAAC,EACA,UAAAC,EACA,SAAAC,EACA,OAAAC,EACA,KAAAC,EACA,UAAAC,EAAY,MACZ,WAAAC,EACA,QAAAC,CACF,EAAU,CACR,KAAM,CAACC,EAAYC,CAAa,EAAIrB,EAAiB,EAC/C,CAACsB,EAAWC,CAAY,EAAIvB,EAAS,EAAE,EACvC,CAACwB,EAAUC,CAAW,EAAIzB,EAAS,EAAK,EACxC,CAAE,KAAM0B,EAAU,OAAAC,CAAO,EAAIpB,EAAQ,EAErC,CAAE,WAAYqB,EAAS,QAAAC,CAAQ,EAAIvB,EAAgBY,CAAU,EAE7DY,EAAgBhC,EAAY,SAAY,CAC5CyB,EAAa,EAAE,EACf,KAAM,CAAE,KAAAQ,CAAK,EAAI,MAAMF,EAAQ,CAAE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F,QAAS,IAAMD,EAASN,CAAU,EAEjC,SAAAO,EAAS,SAAW,OACvB,GACF,EACA/B,EAACM,EAAA,CAAK,UAAU,0DAA0D,KAAMc,EAAK,aAAc,EACnGpB,EAACM,EAAA,CAAK,UAAU,sDAAsD,KAAMc,EAAK,YAAa,EAC9FpB,EAACK,EAAA,CACC,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAAS,IAAM,CACTe,EAAK,mBAAkB,OAAO,SAAS,KAAOA,EAAK,kBACvDN,EAAQ,CACV,EAEC,SAAAM,EAAK,cACR,GACF,EArCAnB,EAAAF,EAAA,CACE,UAAAC,EAACM,EAAA,CAAK,UAAU,6CAA6C,KAAMc,EAAK,aAAc,EACtFpB,EAACK,EAAA,CACC,QAAS2B,EACT,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAASE,EACT,SAAUN,EAET,SAAAR,EAAK,cACR,GACF,EA2BJ,EAECM,GACC1B,EAAC,OAAI,UAAU,wDACb,SAAAA,EAACM,EAAA,CAAK,UAAU,2CAA2C,KAAMoB,EAAW,EAC9E,GAEJ,CAEJ",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "useCallback", "useEffect", "useState", "Button", "Text", "cn", "CreditsModalContainer", "AlpcErrorCode", "useRedeemCoupon", "useCopy", "RedeemCouponModal", "isOpen", "onClose", "itemTitle", "itemCredits", "itemImage", "redeemId", "userId", "copy", "pointUnit", "alpcConfig", "onError", "couponCode", "setCouponCode", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "copyText", "copied", "loading", "trigger", "handleConfirm", "data", "msg"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RedeemCouponModalCopy, AlpcConfig } from '../../type';
|
|
2
|
+
type Props = {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
itemTitle: string;
|
|
5
|
+
itemCredits: number;
|
|
6
|
+
itemImage?: {
|
|
7
|
+
url: string;
|
|
8
|
+
alt?: string;
|
|
9
|
+
};
|
|
10
|
+
itemValue?: string;
|
|
11
|
+
itemOff?: string;
|
|
12
|
+
redeemId: number;
|
|
13
|
+
userId?: string;
|
|
14
|
+
copy: RedeemCouponModalCopy;
|
|
15
|
+
pointUnit?: string;
|
|
16
|
+
alpcConfig: AlpcConfig;
|
|
17
|
+
onError?: (code: number) => void;
|
|
18
|
+
};
|
|
19
|
+
export default function RedeemCouponPanel({ onClose, itemTitle, itemCredits, itemImage, itemValue, itemOff, redeemId, userId, copy, pointUnit, alpcConfig, onError, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useCallback as U,useEffect as _,useState as f}from"react";import{Text as l,Button as w}from"@anker-in/headless-ui";import{useHeadlessContext as M,classNames as m}from"@anker-in/lib";import{AlpcErrorCode as d}from"../../../credits/context/const";import{useRedeemCoupon as P}from"./hooks/useRedeemCoupon";import j from"../../../credits/context/hooks/useCopy";import{ROUNDED_BRANDS as H}from"../../../../constants";function I({onClose:R,itemTitle:O,itemCredits:B,itemImage:a,itemValue:x,itemOff:C,redeemId:c,userId:g,copy:e,pointUnit:T="pts",alpcConfig:k,onError:N}){const[u,b]=f(),[v,i]=f(""),[y,s]=f(!1),{copy:D,copied:h}=j(),{brand:L}=M(),p=H.includes(L),{isMutating:S,trigger:E}=P(k),A=U(async()=>{i("");const{data:o}=await E({user_id:g,rule_id:c});if(!o){i(e.commonError);return}if(o.data?.success)b(o.data.coupon_code);else{let r=e.commonError;o.code===d.CodeLpcShopifyCouponRuleRedeemLimit?(r=e.redeemLimitError,s(!0)):o.code===d.CodeLpcRuleInventoryNotEnough?(r=e.inventoryNotEnough,s(!0)):o.code===d.CodeLpcNotEnoughCredits?(r=e.creditsNotEnough,s(!0)):o.code===d.CodeCrossSiteError&&(r=e.crossSiteError,s(!0)),i(r),N?.(o.code)}},[E,g,c,e,N]);return _(()=>{b(void 0),i(""),s(!1)},[c]),n("div",{className:"flex flex-col gap-[16px]",children:[a?.url&&n("div",{className:m("relative overflow-hidden w-fit mx-auto",p?"rounded-[8px]":"rounded-none"),children:[t("img",{src:a.url,alt:a.alt??"",className:"mx-auto h-[140px] object-contain"}),x&&n("div",{className:"absolute bottom-[20px] left-[20px] text-[32px] font-[800] leading-none text-white",children:[x,C?` ${C}`:""]})]}),n("p",{className:"text-center text-[24px] font-[700] text-[#1d1d1f]",children:[B," ",T]}),u?n("div",{className:"flex flex-col gap-[12px] text-center",children:[n("div",{className:"flex items-center justify-center gap-[10px]",children:[t("span",{className:"text-[24px] font-[700]",children:u}),t("button",{className:"cursor-pointer text-[14px] font-[700] underline disabled:pointer-events-none",disabled:h,onClick:()=>D(u),children:h?"Copied":"Copy"})]}),t(l,{className:"text-[20px] font-[700]",html:e.successTitle}),t(l,{className:"text-[14px] font-[700] text-[#6d6d6f]",html:e.successDesc}),t(w,{className:m("w-full py-[12px] text-[14px] font-[700] text-white bg-[#080a0f]",p?"rounded-[4px]":"rounded-none"),onClick:()=>{e.successButtonUrl&&(window.location.href=e.successButtonUrl),R()},children:e.successButton})]}):n("div",{className:"flex flex-col gap-[12px] text-center",children:[t(l,{className:"block text-[20px] font-[700]",html:e.confirmTitle}),t(w,{className:m("w-full py-[12px] text-[14px] font-[700] text-white disabled:opacity-60 bg-[#080a0f]",p?"rounded-[4px]":"rounded-none"),disabled:y,loading:S,onClick:A,children:e.confirmButton})]}),v&&t(l,{className:"text-center text-[14px] font-[700] text-[#ff0000]",html:v})]})}export{I as default};
|
|
2
|
+
//# sourceMappingURL=RedeemCouponPanel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\nimport { Text, Button } from '@anker-in/headless-ui'\nimport { useHeadlessContext, classNames as cn } from '@anker-in/lib'\nimport { AlpcErrorCode } from '../../../credits/context/const'\nimport { useRedeemCoupon } from './hooks/useRedeemCoupon'\nimport useCopy from '../../../credits/context/hooks/useCopy'\nimport type { RedeemCouponModalCopy, AlpcConfig } from '../../type'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype Props = {\n onClose: () => void\n itemTitle: string\n itemCredits: number\n itemImage?: { url: string; alt?: string }\n itemValue?: string\n itemOff?: string\n redeemId: number\n userId?: string\n copy: RedeemCouponModalCopy\n pointUnit?: string\n alpcConfig: AlpcConfig\n onError?: (code: number) => void\n}\n\nexport default function RedeemCouponPanel({\n onClose,\n itemTitle,\n itemCredits,\n itemImage,\n itemValue,\n itemOff,\n redeemId,\n userId,\n copy,\n pointUnit = 'pts',\n alpcConfig,\n onError,\n}: Props) {\n const [couponCode, setCouponCode] = useState<string>()\n const [errorInfo, setErrorInfo] = useState('')\n const [disabled, setDisabled] = useState(false)\n const { copy: copyText, copied } = useCopy()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const { isMutating: loading, trigger } = useRedeemCoupon(alpcConfig)\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n const { data } = await trigger({ user_id: userId, rule_id: redeemId })\n if (!data) {\n setErrorInfo(copy.commonError)\n return\n }\n if (data.data?.success) {\n setCouponCode(data.data.coupon_code)\n } else {\n let msg = copy.commonError\n if (data.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n msg = copy.redeemLimitError\n setDisabled(true)\n } else if (data.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n msg = copy.inventoryNotEnough\n setDisabled(true)\n } else if (data.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n msg = copy.creditsNotEnough\n setDisabled(true)\n } else if (data.code === AlpcErrorCode.CodeCrossSiteError) {\n msg = copy.crossSiteError\n setDisabled(true)\n }\n setErrorInfo(msg)\n onError?.(data.code)\n }\n }, [trigger, userId, redeemId, copy, onError])\n\n useEffect(() => {\n setCouponCode(undefined)\n setErrorInfo('')\n setDisabled(false)\n }, [redeemId])\n\n return (\n <div className=\"flex flex-col gap-[16px]\">\n {itemImage?.url && (\n <div className={cn('relative overflow-hidden w-fit mx-auto', rounded ? 'rounded-[8px]' : 'rounded-none')}>\n <img src={itemImage.url} alt={itemImage.alt ?? ''} className=\"mx-auto h-[140px] object-contain\" />\n {itemValue && (\n <div className=\"absolute bottom-[20px] left-[20px] text-[32px] font-[800] leading-none text-white\">\n {itemValue}\n {itemOff ? ` ${itemOff}` : ''}\n </div>\n )}\n </div>\n )}\n\n <p className=\"text-center text-[24px] font-[700] text-[#1d1d1f]\">\n {itemCredits} {pointUnit}\n </p>\n\n {!couponCode ? (\n <div className=\"flex flex-col gap-[12px] text-center\">\n <Text className=\"block text-[20px] font-[700]\" html={copy.confirmTitle} />\n <Button\n className={cn('w-full py-[12px] text-[14px] font-[700] text-white disabled:opacity-60 bg-[#080a0f]', rounded ? 'rounded-[4px]' : 'rounded-none')}\n disabled={disabled}\n loading={loading}\n onClick={handleConfirm}\n >\n {copy.confirmButton}\n </Button>\n </div>\n ) : (\n <div className=\"flex flex-col gap-[12px] text-center\">\n <div className=\"flex items-center justify-center gap-[10px]\">\n <span className=\"text-[24px] font-[700]\">{couponCode}</span>\n <button\n className=\"cursor-pointer text-[14px] font-[700] underline disabled:pointer-events-none\"\n disabled={copied}\n onClick={() => copyText(couponCode)}\n >\n {copied ? 'Copied' : 'Copy'}\n </button>\n </div>\n <Text className=\"text-[20px] font-[700]\" html={copy.successTitle} />\n <Text className=\"text-[14px] font-[700] text-[#6d6d6f]\" html={copy.successDesc} />\n <Button\n className={cn('w-full py-[12px] text-[14px] font-[700] text-white bg-[#080a0f]', rounded ? 'rounded-[4px]' : 'rounded-none')}\n onClick={() => {\n if (copy.successButtonUrl) window.location.href = copy.successButtonUrl\n onClose()\n }}\n >\n {copy.successButton}\n </Button>\n </div>\n )}\n\n {errorInfo && <Text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Ac,EAC3H,QAAS,IAAM,CACTb,EAAK,mBAAkB,OAAO,SAAS,KAAOA,EAAK,kBACvDR,EAAQ,CACV,EAEC,SAAAQ,EAAK,cACR,GACF,EAlCArB,EAAC,OAAI,UAAU,uCACb,UAAAD,EAACK,EAAA,CAAK,UAAU,+BAA+B,KAAMiB,EAAK,aAAc,EACxEtB,EAACM,EAAA,CACC,UAAWE,EAAG,sFAAuF2B,EAAU,gBAAkB,cAAc,EAC/I,SAAUL,EACV,QAASM,EACT,QAASE,EAER,SAAAhB,EAAK,cACR,GACF,EA2BDM,GAAa5B,EAACK,EAAA,CAAK,UAAU,oDAAoD,KAAMuB,EAAW,GACrG,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "useCallback", "useEffect", "useState", "Text", "Button", "useHeadlessContext", "cn", "AlpcErrorCode", "useRedeemCoupon", "useCopy", "ROUNDED_BRANDS", "RedeemCouponPanel", "onClose", "itemTitle", "itemCredits", "itemImage", "itemValue", "itemOff", "redeemId", "userId", "copy", "pointUnit", "alpcConfig", "onError", "couponCode", "setCouponCode", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "copyText", "copied", "brand", "rounded", "loading", "trigger", "handleConfirm", "data", "msg"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AlpcConfig } from '../../../type';
|
|
2
|
+
import type { ProductVariant } from '@anker-in/lib';
|
|
3
|
+
type RedeemAndBuyArg = {
|
|
4
|
+
productVariant: ProductVariant;
|
|
5
|
+
quantity?: number;
|
|
6
|
+
redeemId: number;
|
|
7
|
+
userId?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function useRedeemAndBuy(config: AlpcConfig): {
|
|
10
|
+
trigger: (arg: RedeemAndBuyArg) => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useBuyNow as i}from"@anker-in/lib";import{useRedeemCoupon as d}from"./useRedeemCoupon";function c(t){const{trigger:o}=d(t),{trigger:n}=i({},{throwOnError:!0});return{trigger:async e=>{const{data:r}=await o({user_id:e.userId,rule_id:e.redeemId});if(r?.data?.coupon_code)await n({discountCodes:[r.data.coupon_code],lineItems:[{variant:e.productVariant,quantity:e.quantity??1}]});else throw new Error(r?.msg??"Redeem failed")}}}export{c as useRedeemAndBuy};
|
|
2
|
+
//# sourceMappingURL=useRedeemAndBuy.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.ts"],
|
|
4
|
+
"sourcesContent": ["import { useBuyNow } from '@anker-in/lib'\nimport { useRedeemCoupon } from './useRedeemCoupon'\nimport type { AlpcConfig } from '../../../type'\nimport type { ProductVariant } from '@anker-in/lib'\n\ntype RedeemAndBuyArg = {\n productVariant: ProductVariant\n quantity?: number\n redeemId: number\n userId?: string\n}\n\nexport function useRedeemAndBuy(config: AlpcConfig) {\n const { trigger: redeemTrigger } = useRedeemCoupon(config)\n const { trigger: buyNow } = useBuyNow({}, { throwOnError: true })\n\n const trigger = async (arg: RedeemAndBuyArg) => {\n const { data } = await redeemTrigger({\n user_id: arg.userId,\n rule_id: arg.redeemId,\n })\n if (data?.data?.coupon_code) {\n await buyNow({\n discountCodes: [data.data.coupon_code],\n lineItems: [{ variant: arg.productVariant, quantity: arg.quantity ?? 1 }],\n })\n } else {\n throw new Error(data?.msg ?? 'Redeem failed')\n }\n }\n\n return { trigger }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,aAAAA,MAAiB,gBAC1B,OAAS,mBAAAC,MAAuB,oBAWzB,SAASC,EAAgBC,EAAoB,CAClD,KAAM,CAAE,QAASC,CAAc,EAAIH,EAAgBE,CAAM,EACnD,CAAE,QAASE,CAAO,EAAIL,EAAU,CAAC,EAAG,CAAE,aAAc,EAAK,CAAC,EAiBhE,MAAO,CAAE,QAfO,MAAOM,GAAyB,CAC9C,KAAM,CAAE,KAAAC,CAAK,EAAI,MAAMH,EAAc,CACnC,QAASE,EAAI,OACb,QAASA,EAAI,QACf,CAAC,EACD,GAAIC,GAAM,MAAM,YACd,MAAMF,EAAO,CACX,cAAe,CAACE,EAAK,KAAK,WAAW,EACrC,UAAW,CAAC,CAAE,QAASD,EAAI,eAAgB,SAAUA,EAAI,UAAY,CAAE,CAAC,CAC1E,CAAC,MAED,OAAM,IAAI,MAAMC,GAAM,KAAO,eAAe,CAEhD,CAEiB,CACnB",
|
|
6
|
+
"names": ["useBuyNow", "useRedeemCoupon", "useRedeemAndBuy", "config", "redeemTrigger", "buyNow", "arg", "data"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AlpcConfig } from '../../../type';
|
|
2
|
+
type RedeemCouponResponse = {
|
|
3
|
+
data: {
|
|
4
|
+
data: {
|
|
5
|
+
success: boolean;
|
|
6
|
+
coupon_code: string;
|
|
7
|
+
};
|
|
8
|
+
msg: string;
|
|
9
|
+
code: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
type RedeemCouponParams = {
|
|
13
|
+
user_id?: string;
|
|
14
|
+
rule_id: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function useRedeemCoupon(config: AlpcConfig): import("swr/mutation").SWRMutationResponse<RedeemCouponResponse, Error, string, RedeemCouponParams>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import a from"swr/mutation";import{getAlpcPath as i}from"../../../../credits/context/utils";import{ALPC_COUNTRY_MAP as m}from"../../../../credits/context/const";function l(o){const{brand:n,locale:e,appName:r,apiBaseUrl:t}=o;return a("/v1/credit/redeem/coupon",async(p,{arg:s})=>(await fetch(i(e,t)+p,{method:"POST",headers:{"Content-Type":"application/json","current-language":e},body:JSON.stringify({brand:n,country:m.get(e)||e,app_name:r,...s})})).json())}export{l as useRedeemCoupon};
|
|
2
|
+
//# sourceMappingURL=useRedeemCoupon.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.ts"],
|
|
4
|
+
"sourcesContent": ["import useSWRMutation from 'swr/mutation'\nimport { getAlpcPath } from '../../../../credits/context/utils'\nimport { ALPC_COUNTRY_MAP } from '../../../../credits/context/const'\nimport type { AlpcConfig } from '../../../type'\n\ntype RedeemCouponResponse = {\n data: {\n data: { success: boolean; coupon_code: string }\n msg: string\n code: number\n }\n}\n\ntype RedeemCouponParams = {\n user_id?: string\n rule_id: number\n}\n\nexport function useRedeemCoupon(config: AlpcConfig) {\n const { brand, locale, appName, apiBaseUrl } = config\n\n return useSWRMutation<RedeemCouponResponse, Error, string, RedeemCouponParams>(\n `/v1/credit/redeem/coupon`,\n async (url: string, { arg }) => {\n const response = await fetch(getAlpcPath(locale, apiBaseUrl) + url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', 'current-language': locale },\n body: JSON.stringify({\n brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n ...arg,\n }),\n })\n return response.json()\n }\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAoB,eAC3B,OAAS,eAAAC,MAAmB,oCAC5B,OAAS,oBAAAC,MAAwB,oCAgB1B,SAASC,EAAgBC,EAAoB,CAClD,KAAM,CAAE,MAAAC,EAAO,OAAAC,EAAQ,QAAAC,EAAS,WAAAC,CAAW,EAAIJ,EAE/C,OAAOJ,EACL,2BACA,MAAOS,EAAa,CAAE,IAAAC,CAAI,KACP,MAAM,MAAMT,EAAYK,EAAQE,CAAU,EAAIC,EAAK,CAClE,OAAQ,OACR,QAAS,CAAE,eAAgB,mBAAoB,mBAAoBH,CAAO,EAC1E,KAAM,KAAK,UAAU,CACnB,MAAAD,EACA,QAASH,EAAiB,IAAII,CAAM,GAAKA,EACzC,SAAUC,EACV,GAAGG,CACL,CAAC,CACH,CAAC,GACe,KAAK,CAEzB,CACF",
|
|
6
|
+
"names": ["useSWRMutation", "getAlpcPath", "ALPC_COUNTRY_MAP", "useRedeemCoupon", "config", "brand", "locale", "appName", "apiBaseUrl", "url", "arg"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AlpcConsumeType } from '../../../../credits/context/const';
|
|
2
|
+
import type { ConsumeCreditRuleResponse } from '../../../../credits/context/response';
|
|
3
|
+
import type { AlpcConfig } from '../../../type';
|
|
4
|
+
export declare function useRedeemableList(config: AlpcConfig): {
|
|
5
|
+
redeemableList: ConsumeCreditRuleResponse[];
|
|
6
|
+
listLoading: boolean;
|
|
7
|
+
getRedeemableList: (consumeType?: AlpcConsumeType) => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useCallback as d,useEffect as g,useState as f}from"react";import C from"swr/mutation";import{getAlpcPath as y}from"../../../../credits/context/utils";import{ALPC_COUNTRY_MAP as R}from"../../../../credits/context/const";function P(p){const{brand:t,locale:n,appName:i,apiBaseUrl:c}=p;let e=n;n==="pl"&&(e="eu");const[u,l]=f([]),{isMutating:m,trigger:a}=C("/v1/credit/consume_credit_rules",async(o,{arg:s})=>(await fetch(y(e,c)+o,{method:"POST",headers:{"Content-Type":"application/json","current-language":e},body:JSON.stringify(s)})).json()),r=d(o=>{a({brand:t,page:1,page_size:999,country:(R.get(e)||e)?.toUpperCase(),app_name:i,...o!==void 0&&{consume_type:o}},{onSuccess({data:s}){l(s?.data?.consume_credit_rules??[])}})},[t,e,i,a]);return g(()=>{t&&r()},[t,r]),{redeemableList:u,listLoading:m,getRedeemableList:r}}export{P as useRedeemableList};
|
|
2
|
+
//# sourceMappingURL=useRedeemableList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.ts"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\nimport useSWRMutation from 'swr/mutation'\nimport { getAlpcPath, languageTerritory } from '../../../../credits/context/utils'\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../../../../credits/context/const'\nimport type { ConsumeCreditRuleResponse } from '../../../../credits/context/response'\nimport type { AlpcConfig } from '../../../type'\n\nexport function useRedeemableList(config: AlpcConfig) {\n const { brand, locale, appName, apiBaseUrl } = config\n\n let resolvedLocale = locale\n if (locale === 'pl') resolvedLocale = 'eu'\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n\n const { isMutating: listLoading, trigger } = useSWRMutation(\n `/v1/credit/consume_credit_rules`,\n async (url: string, { arg }: { arg: Record<string, any> }) => {\n const response = await fetch(getAlpcPath(resolvedLocale, apiBaseUrl) + url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', 'current-language': resolvedLocale },\n body: JSON.stringify(arg),\n })\n return response.json()\n }\n )\n\n const getRedeemableList = useCallback(\n (consumeType?: AlpcConsumeType) => {\n trigger(\n {\n brand,\n page: 1,\n page_size: 999,\n country: (ALPC_COUNTRY_MAP.get(resolvedLocale) || resolvedLocale)?.toUpperCase(),\n app_name: appName,\n ...(consumeType !== undefined && { consume_type: consumeType }),\n },\n {\n onSuccess({ data }) {\n setRedeemableList(data?.data?.consume_credit_rules ?? [])\n },\n }\n )\n },\n [brand, resolvedLocale, appName, trigger]\n )\n\n useEffect(() => {\n if (!brand) return\n getRedeemableList()\n }, [brand, getRedeemableList])\n\n return { redeemableList, listLoading, getRedeemableList }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QACjD,OAAOC,MAAoB,eAC3B,OAAS,eAAAC,MAAsC,oCAC/C,OAAS,oBAAAC,MAAyC,oCAI3C,SAASC,EAAkBC,EAAoB,CACpD,KAAM,CAAE,MAAAC,EAAO,OAAAC,EAAQ,QAAAC,EAAS,WAAAC,CAAW,EAAIJ,EAE/C,IAAIK,EAAiBH,EACjBA,IAAW,OAAMG,EAAiB,MAEtC,KAAM,CAACC,EAAgBC,CAAiB,EAAIZ,EAAsC,CAAC,CAAC,EAE9E,CAAE,WAAYa,EAAa,QAAAC,CAAQ,EAAIb,EAC3C,kCACA,MAAOc,EAAa,CAAE,IAAAC,CAAI,KACP,MAAM,MAAMd,EAAYQ,EAAgBD,CAAU,EAAIM,EAAK,CAC1E,OAAQ,OACR,QAAS,CAAE,eAAgB,mBAAoB,mBAAoBL,CAAe,EAClF,KAAM,KAAK,UAAUM,CAAG,CAC1B,CAAC,GACe,KAAK,CAEzB,EAEMC,EAAoBnB,EACvBoB,GAAkC,CACjCJ,EACE,CACE,MAAAR,EACA,KAAM,EACN,UAAW,IACX,SAAUH,EAAiB,IAAIO,CAAc,GAAKA,IAAiB,YAAY,EAC/E,SAAUF,EACV,GAAIU,IAAgB,QAAa,CAAE,aAAcA,CAAY,CAC/D,EACA,CACE,UAAU,CAAE,KAAAC,CAAK,EAAG,CAClBP,EAAkBO,GAAM,MAAM,sBAAwB,CAAC,CAAC,CAC1D,CACF,CACF,CACF,EACA,CAACb,EAAOI,EAAgBF,EAASM,CAAO,CAC1C,EAEA,OAAAf,EAAU,IAAM,CACTO,GACLW,EAAkB,CACpB,EAAG,CAACX,EAAOW,CAAiB,CAAC,EAEtB,CAAE,eAAAN,EAAgB,YAAAE,EAAa,kBAAAI,CAAkB,CAC1D",
|
|
6
|
+
"names": ["useCallback", "useEffect", "useState", "useSWRMutation", "getAlpcPath", "ALPC_COUNTRY_MAP", "useRedeemableList", "config", "brand", "locale", "appName", "apiBaseUrl", "resolvedLocale", "redeemableList", "setRedeemableList", "listLoading", "trigger", "url", "arg", "getRedeemableList", "consumeType", "data"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as K,jsx as n,jsxs as r}from"react/jsx-runtime";import{useMemo as L,useState as I}from"react";import{Picture as S,Button as $}from"@anker-in/headless-ui";import{classNames as R,useProductsByHandles as z,useHeadlessContext as F}from"@anker-in/lib";import{useMemberPopupContext as T}from"../../context/provider";import{useViewStack as V}from"../../context/viewStack";import{useRedeemableList as j}from"./hooks/useRedeemableList";import{useRedeemAndBuy as H}from"./hooks/useRedeemAndBuy";import{ConsumeCreditsItemType as o,MemberPopupPanelType as G}from"../../type";import{numberFormat as v}from"../../../credits/context/utils";import{ROUNDED_BRANDS as q}from"../../../../constants";function J({copy:t,onClose:Q}){const{profile:d,creditInfo:u,openSignUpPopup:B,alpcConfig:c}=T(),{pushView:D}=V(),{brand:_}=F(),g=q.includes(_),[b,N]=I(""),[P,C]=I(null),p=!!d,{redeemableList:y,listLoading:w}=j(c),{trigger:A}=H(c),k=t.list.map(e=>e.product?.handle).filter(Boolean),{data:h}=z({handles:k}),M=L(()=>t.list.map(e=>{const a=y.find(l=>String(l.id)===String(e.redeemId));if(!a)return null;const i=Number(u?.available_credit??0),f=p&&!!d?.activated&&a.consume_credits>i,m=a.is_limited&&(!a.remaining_inventory||a.remaining_inventory<=0);let s,x;return e.type===o.RedeemAndBuy&&e.product&&(s=h?.find(l=>l.handle===e.product.handle),x=s?.variants?.find(l=>l.sku===e.product.sku)??s?.variants?.[0],!s||!x)?null:{...e,alpcData:a,insufficient:f,soldOut:m,product:s,variant:x}}).filter(Boolean),[t.list,y,u,d,p,h]);function O(e){return p?e.soldOut?t.soldOut:t.btnRedeem:t.unlockRewards}function U(e){return e.soldOut||e.insufficient}async function E(e){if(!p){B();return}if(e.type===o.Coupon)D({type:G.RedeemCoupon,props:{itemTitle:e.title,itemCredits:e.alpcData.consume_credits,itemImage:t.imageMapping?.[e.type]?{url:t.imageMapping[e.type].url,alt:e.image?.alt}:e.image,itemValue:e.value,itemOff:t.off,redeemId:Number(e.redeemId),userId:d?.user_id,alpcConfig:c}});else{N(""),C(e.redeemId);try{await A({productVariant:e.variant,redeemId:Number(e.redeemId),userId:d?.user_id})}catch(a){N(a?.message??t.redeemModal.commonError)}finally{C(null)}}}return n(K,{children:r("div",{className:"flex flex-1 flex-col gap-[12px]",children:[r("div",{className:"flex flex-col gap-[8px]",children:[t.title&&n("h2",{className:"text-[24px] font-[700] leading-[1.2] text-[#080a0f]",children:t.title}),t.subtitle&&n("p",{className:"text-[16px] font-[700] leading-snug text-[#4a4c56]",children:t.subtitle})]}),t.insufficientCredits&&u&&r("div",{className:"text-[14px] font-[700] text-[#1d1d1f]",children:[t.insufficientCredits,": ",v(u.available_credit)," ",t.pointUnit]}),b&&n("div",{className:"text-[14px] font-[700] text-[#f84d4f]",children:b}),w?n("div",{className:"flex flex-1 items-center justify-center py-[32px]",children:n("div",{className:"size-[32px] animate-spin rounded-full border-[3px] border-[#080a0f] border-t-transparent"})}):n("div",{className:"flex flex-col",children:M.map((e,a)=>r("div",{className:"relative py-[16px]",children:[a>0&&n("div",{className:"absolute inset-x-0 top-0 h-px bg-[#dadce0]"}),r("div",{className:"flex items-center gap-[12px]",children:[(()=>{const i=e.type===o.RedeemAndBuy,f=t.imageMapping?.[e.type]?.url,m=i?e.variant?.image?.url??e.product?.images?.[0]?.url??e.image?.url:f??e.image?.url,s=i?e.variant?.image?.altText??e.product?.images?.[0]?.alt??e.image?.alt??"":e.image?.alt??"";return m?r("div",{className:R("relative size-[64px] shrink-0 overflow-hidden",g?"rounded-[4px]":"rounded-none"),children:[n(S,{source:m,alt:s,className:"flex size-full items-center justify-center",imgClassName:i?"object-cover":"h-full w-auto object-contain"}),!i&&e.value&&r("div",{className:"absolute bottom-[20px] left-[4px] text-[14px] font-[800] leading-none text-white",children:[e.value," ",t.off]})]}):null})(),r("div",{className:"min-w-0 flex-1",children:[n("div",{className:"text-[16px] font-[700] text-[#1e2024] line-clamp-2",children:e.type===o.RedeemAndBuy&&e.product?.title?e.product.title:e.title}),n("div",{className:"mt-[4px] text-[14px] text-[#666]",children:e.type===o.RedeemAndBuy&&e.price!=null?`${v(e.alpcData.consume_credits)} ${t.pointUnit??""} + $${Number(e.price).toFixed(2)}`:`${v(e.alpcData.consume_credits)} ${t.pointUnit??""}`})]}),r("div",{className:"relative group",children:[n($,{className:R("bg-[#080a0f] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white",g?"rounded-[4px]":"rounded-none"),disabled:U(e),loading:P===e.redeemId,onClick:()=>E(e),children:O(e)}),e.insufficient&&n("div",{className:"pointer-events-none absolute left-[48px] top-full mt-[10px] hidden -translate-x-1/2 group-hover:block",children:r("div",{className:"relative bg-[#6D6D6F] p-[16px] text-[14px] font-[700] text-white shadow md:px-[10px] md:py-[8px]",children:[n("p",{className:"text-pretty tracking-[-0.02em] text-[14px]",children:t.insufficientCredits}),n("div",{className:"absolute -top-[8px] left-[48px] size-[16px] origin-top-left rotate-45 rounded-[2px] bg-[#6D6D6F]"})]})})]})]})]},a))}),t.creditsPage?.url&&n("a",{href:t.creditsPage.url,target:"_blank",rel:"noopener noreferrer",className:"mt-auto self-start text-[14px] font-[700] text-[#080a0f] underline",children:t.creditsPage.label??"Go to Credits Page"})]})})}var ie=J;export{ie as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/memberPopup/panels/ConsumeCredits/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useMemo, useState } from 'react'\nimport { Picture, Button } from '@anker-in/headless-ui'\nimport { classNames as cn, useProductsByHandles, useHeadlessContext } from '@anker-in/lib'\nimport { useMemberPopupContext } from '../../context/provider'\nimport { useViewStack } from '../../context/viewStack'\nimport { useRedeemableList } from './hooks/useRedeemableList'\nimport { useRedeemAndBuy } from './hooks/useRedeemAndBuy'\nimport {\n ConsumeCreditsItemType,\n MemberPopupPanelType,\n type ConsumeCreditsopy,\n type ConsumeCreditsItem,\n} from '../../type'\nimport { numberFormat } from '../../../credits/context/utils'\nimport type { ConsumeCreditRuleResponse } from '../../../credits/context/response'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype EnrichedItem = ConsumeCreditsItem & {\n alpcData: ConsumeCreditRuleResponse\n insufficient: boolean\n soldOut: boolean\n product?: any\n variant?: any\n}\n\ntype Props = {\n copy: ConsumeCreditsopy\n onClose: () => void\n}\n\nfunction ConsumeCredits({ copy, onClose }: Props) {\n const { profile, creditInfo, openSignUpPopup, alpcConfig } = useMemberPopupContext()\n const { pushView } = useViewStack()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const [redeemAndBuyError, setRedeemAndBuyError] = useState('')\n const [loadingId, setLoadingId] = useState<string | number | null>(null)\n\n const isLogin = !!profile\n const { redeemableList, listLoading } = useRedeemableList(alpcConfig)\n const { trigger: redeemAndBuy } = useRedeemAndBuy(alpcConfig)\n\n const handles = copy.list.map(item => item.product?.handle).filter(Boolean) as string[]\n const { data: products } = useProductsByHandles({ handles })\n\n const list = useMemo(() => {\n return copy.list\n .map(item => {\n const alpcData = redeemableList.find(r => String(r.id) === String(item.redeemId))\n if (!alpcData) return null\n\n const availableCredit = Number(creditInfo?.available_credit ?? 0)\n const insufficient = isLogin && !!profile?.activated && alpcData.consume_credits > availableCredit\n const soldOut = alpcData.is_limited && (!alpcData.remaining_inventory || alpcData.remaining_inventory <= 0)\n\n let product\n let variant\n if (item.type === ConsumeCreditsItemType.RedeemAndBuy && item.product) {\n product = products?.find((p: any) => p.handle === item.product!.handle)\n variant = product?.variants?.find((v: any) => v.sku === item.product!.sku) ?? product?.variants?.[0]\n if (!product || !variant) return null\n }\n\n return { ...item, alpcData, insufficient, soldOut, product, variant }\n })\n .filter(Boolean) as EnrichedItem[]\n }, [copy.list, redeemableList, creditInfo, profile, isLogin, products])\n\n function getButtonLabel(item: (typeof list)[number]) {\n if (!isLogin) return copy.unlockRewards\n if (item.soldOut) return copy.soldOut\n return copy.btnRedeem\n }\n\n function isDisabled(item: (typeof list)[number]) {\n return item.soldOut || item.insufficient\n }\n\n async function handleRedeem(item: (typeof list)[number]) {\n if (!isLogin) {\n openSignUpPopup()\n return\n }\n if (item.type === ConsumeCreditsItemType.Coupon) {\n pushView({\n type: MemberPopupPanelType.RedeemCoupon,\n props: {\n itemTitle: item.title,\n itemCredits: item.alpcData.consume_credits,\n itemImage: copy.imageMapping?.[item.type]\n ? { url: copy.imageMapping[item.type]!.url, alt: item.image?.alt }\n : item.image,\n itemValue: item.value,\n itemOff: copy.off,\n redeemId: Number(item.redeemId),\n userId: profile?.user_id,\n alpcConfig,\n },\n })\n } else {\n setRedeemAndBuyError('')\n setLoadingId(item.redeemId)\n try {\n await redeemAndBuy({\n productVariant: item.variant,\n redeemId: Number(item.redeemId),\n userId: profile?.user_id,\n })\n } catch (e: any) {\n setRedeemAndBuyError(e?.message ?? copy.redeemModal.commonError)\n } finally {\n setLoadingId(null)\n }\n }\n }\n\n return (\n <>\n <div className=\"flex flex-1 flex-col gap-[12px]\">\n <div className=\"flex flex-col gap-[8px]\">\n {copy.title && <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>}\n {copy.subtitle && <p className=\"text-[16px] font-[700] leading-snug text-[#4a4c56]\">{copy.subtitle}</p>}\n </div>\n\n {copy.insufficientCredits && creditInfo && (\n <div className=\"text-[14px] font-[700] text-[#1d1d1f]\">\n {copy.insufficientCredits}: {numberFormat(creditInfo.available_credit)} {copy.pointUnit}\n </div>\n )}\n {redeemAndBuyError && <div className=\"text-[14px] font-[700] text-[#f84d4f]\">{redeemAndBuyError}</div>}\n\n {listLoading ? (\n <div className=\"flex flex-1 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 <div className=\"flex flex-col\">\n {list.map((item, idx) => (\n <div key={idx} className=\"relative py-[16px]\">\n {idx > 0 && <div className=\"absolute inset-x-0 top-0 h-px bg-[#dadce0]\" />}\n <div className=\"flex items-center gap-[12px]\">\n {(() => {\n const isRedeemAndBuy = item.type === ConsumeCreditsItemType.RedeemAndBuy\n const mappedImgUrl = copy.imageMapping?.[item.type]?.url\n const imgUrl = isRedeemAndBuy\n ? (item.variant?.image?.url ?? item.product?.images?.[0]?.url ?? item.image?.url)\n : (mappedImgUrl ?? item.image?.url)\n const imgAlt = isRedeemAndBuy\n ? (item.variant?.image?.altText ?? item.product?.images?.[0]?.alt ?? item.image?.alt ?? '')\n : (item.image?.alt ?? '')\n if (!imgUrl) return null\n return (\n <div className={cn('relative size-[64px] shrink-0 overflow-hidden', rounded ? 'rounded-[4px]' : 'rounded-none')}>\n <Picture\n source={imgUrl}\n alt={imgAlt}\n className=\"flex size-full items-center justify-center\"\n imgClassName={isRedeemAndBuy ? 'object-cover' : 'h-full w-auto object-contain'}\n />\n {!isRedeemAndBuy && item.value && (\n <div className=\"absolute bottom-[20px] left-[4px] text-[14px] font-[800] leading-none text-white\">\n {item.value} {copy.off}\n </div>\n )}\n </div>\n )\n })()}\n <div className=\"min-w-0 flex-1\">\n <div className=\"text-[16px] font-[700] text-[#1e2024] line-clamp-2\">\n {item.type === ConsumeCreditsItemType.RedeemAndBuy && item.product?.title\n ? item.product.title\n : item.title}\n </div>\n <div className=\"mt-[4px] text-[14px] text-[#666]\">\n {item.type === ConsumeCreditsItemType.RedeemAndBuy && item.price != null\n ? `${numberFormat(item.alpcData.consume_credits)} ${copy.pointUnit ?? ''} + $${Number(item.price).toFixed(2)}`\n : `${numberFormat(item.alpcData.consume_credits)} ${copy.pointUnit ?? ''}`}\n </div>\n </div>\n <div className=\"relative group\">\n <Button\n className={cn('bg-[#080a0f] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white', rounded ? 'rounded-[4px]' : 'rounded-none')}\n disabled={isDisabled(item)}\n loading={loadingId === item.redeemId}\n onClick={() => handleRedeem(item)}\n >\n {getButtonLabel(item)}\n </Button>\n {item.insufficient && (\n <div className=\"pointer-events-none absolute left-[48px] top-full mt-[10px] hidden -translate-x-1/2 group-hover:block\">\n <div className=\"relative bg-[#6D6D6F] p-[16px] text-[14px] font-[700] text-white shadow md:px-[10px] md:py-[8px]\">\n <p className=\"text-pretty tracking-[-0.02em] text-[14px]\">{copy.insufficientCredits}</p>\n <div className=\"absolute -top-[8px] left-[48px] size-[16px] origin-top-left rotate-45 rounded-[2px] bg-[#6D6D6F]\" />\n </div>\n </div>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n )}\n\n {copy.creditsPage?.url && (\n <a\n href={copy.creditsPage.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"mt-auto self-start text-[14px] font-[700] text-[#080a0f] underline\"\n >\n {copy.creditsPage.label ?? 'Go to Credits Page'}\n </a>\n )}\n </div>\n </>\n )\n}\n\nexport default ConsumeCredits\n"],
|
|
5
|
+
"mappings": "AAsHI,mBAAAA,EAGqB,OAAAC,EADjB,QAAAC,MAFJ,oBAtHJ,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAClC,OAAS,WAAAC,EAAS,UAAAC,MAAc,wBAChC,OAAS,cAAcC,EAAI,wBAAAC,EAAsB,sBAAAC,MAA0B,gBAC3E,OAAS,yBAAAC,MAA6B,yBACtC,OAAS,gBAAAC,MAAoB,0BAC7B,OAAS,qBAAAC,MAAyB,4BAClC,OAAS,mBAAAC,MAAuB,0BAChC,OACE,0BAAAC,EACA,wBAAAC,MAGK,aACP,OAAS,gBAAAC,MAAoB,iCAE7B,OAAS,kBAAAC,MAAsB,wBAe/B,SAASC,EAAe,CAAE,KAAAC,EAAM,QAAAC,CAAQ,EAAU,CAChD,KAAM,CAAE,QAAAC,EAAS,WAAAC,EAAY,gBAAAC,EAAiB,WAAAC,CAAW,EAAId,EAAsB,EAC7E,CAAE,SAAAe,CAAS,EAAId,EAAa,EAC5B,CAAE,MAAAe,CAAM,EAAIjB,EAAmB,EAC/BkB,EAAUV,EAAe,SAASS,CAAK,EAEvC,CAACE,EAAmBC,C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aqB,EAAK,SAAS,eAAe,CAAC,IAAIlB,EAAK,WAAa,EAAE,OAAO,OAAOkB,EAAK,KAAK,EAAE,QAAQ,CAAC,CAAC,GAC1G,GAAGrB,EAAaqB,EAAK,SAAS,eAAe,CAAC,IAAIlB,EAAK,WAAa,EAAE,GAC5E,GACF,EACAjB,EAAC,OAAI,UAAU,iBACb,UAAAD,EAACK,EAAA,CACC,UAAWC,EAAG,6FAA8FoB,EAAU,gBAAkB,cAAc,EACtJ,SAAUuB,EAAWb,CAAI,EACzB,QAASP,IAAcO,EAAK,SAC5B,QAAS,IAAMc,EAAad,CAAI,EAE/B,SAAAY,EAAeZ,CAAI,EACtB,EACCA,EAAK,cACJpC,EAAC,OAAI,UAAU,wGACb,SAAAC,EAAC,OAAI,UAAU,mGACb,UAAAD,EAAC,KAAE,UAAU,6CAA8C,SAAAkB,EAAK,oBAAoB,EACpFlB,EAAC,OAAI,UAAU,mGAAmG,GACpH,EACF,GAEJ,GACF,IA3DQoD,CA4DV,CACD,EACH,EAGClC,EAAK,aAAa,KACjBlB,EAAC,KACC,KAAMkB,EAAK,YAAY,IACvB,OAAO,SACP,IAAI,sBACJ,UAAU,qEAET,SAAAA,EAAK,YAAY,OAAS,qBAC7B,GAEJ,EACF,CAEJ,CAEA,IAAOuC,GAAQxC",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "useMemo", "useState", "Picture", "Button", "cn", "useProductsByHandles", "useHeadlessContext", "useMemberPopupContext", "useViewStack", "useRedeemableList", "useRedeemAndBuy", "ConsumeCreditsItemType", "MemberPopupPanelType", "numberFormat", "ROUNDED_BRANDS", "ConsumeCredits", "copy", "onClose", "profile", "creditInfo", "openSignUpPopup", "alpcConfig", "pushView", "brand", "rounded", "redeemAndBuyError", "setRedeemAndBuyError", "loadingId", "setLoadingId", "isLogin", "redeemableList", "listLoading", "redeemAndBuy", "handles", "item", "products", "list", "alpcData", "r", "availableCredit", "insufficient", "soldOut", "product", "variant", "p", "v", "getButtonLabel", "isDisabled", "handleRedeem", "e", "idx", "isRedeemAndBuy", "mappedImgUrl", "imgUrl", "imgAlt", "ConsumeCredits_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AuthCodeActivateCopy } from '../../type';
|
|
2
|
+
type Props = {
|
|
3
|
+
copy: AuthCodeActivateCopy;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onSuccess?: () => void;
|
|
6
|
+
};
|
|
7
|
+
export default function ActivatePanel({ copy, onClose, onSuccess }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|