@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.
Files changed (213) hide show
  1. package/dist/cjs/components/index.d.ts +1 -0
  2. package/dist/cjs/components/index.js +1 -1
  3. package/dist/cjs/components/index.js.map +2 -2
  4. package/dist/cjs/components/memberPopup/MemberPopup.d.ts +9 -0
  5. package/dist/cjs/components/memberPopup/MemberPopup.js +2 -0
  6. package/dist/cjs/components/memberPopup/MemberPopup.js.map +7 -0
  7. package/dist/cjs/components/memberPopup/context/provider.d.ts +11 -0
  8. package/dist/cjs/components/memberPopup/context/provider.js +2 -0
  9. package/dist/cjs/components/memberPopup/context/provider.js.map +7 -0
  10. package/dist/cjs/components/memberPopup/context/viewStack.d.ts +12 -0
  11. package/dist/cjs/components/memberPopup/context/viewStack.js +2 -0
  12. package/dist/cjs/components/memberPopup/context/viewStack.js.map +7 -0
  13. package/dist/cjs/components/memberPopup/icons.d.ts +27 -0
  14. package/dist/cjs/components/memberPopup/icons.js +2 -0
  15. package/dist/cjs/components/memberPopup/icons.js.map +7 -0
  16. package/dist/cjs/components/memberPopup/index.d.ts +4 -0
  17. package/dist/cjs/components/memberPopup/index.js +2 -0
  18. package/dist/cjs/components/memberPopup/index.js.map +7 -0
  19. package/dist/cjs/components/memberPopup/panels/Activity/SubscribeModal.d.ts +10 -0
  20. package/dist/cjs/components/memberPopup/panels/Activity/SubscribeModal.js +2 -0
  21. package/dist/cjs/components/memberPopup/panels/Activity/SubscribeModal.js.map +7 -0
  22. package/dist/cjs/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.d.ts +7 -0
  23. package/dist/cjs/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js +2 -0
  24. package/dist/cjs/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js.map +7 -0
  25. package/dist/cjs/components/memberPopup/panels/Activity/index.d.ts +7 -0
  26. package/dist/cjs/components/memberPopup/panels/Activity/index.js +2 -0
  27. package/dist/cjs/components/memberPopup/panels/Activity/index.js.map +7 -0
  28. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.d.ts +19 -0
  29. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js +2 -0
  30. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js.map +7 -0
  31. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.d.ts +20 -0
  32. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js +2 -0
  33. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js.map +7 -0
  34. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.d.ts +12 -0
  35. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.js +2 -0
  36. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.js.map +7 -0
  37. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.d.ts +17 -0
  38. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.js +2 -0
  39. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.js.map +7 -0
  40. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.d.ts +8 -0
  41. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.js +2 -0
  42. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.js.map +7 -0
  43. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.d.ts +7 -0
  44. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.js +2 -0
  45. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.js.map +7 -0
  46. package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.d.ts +8 -0
  47. package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.js +2 -0
  48. package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.js.map +7 -0
  49. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.d.ts +10 -0
  50. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js +2 -0
  51. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js.map +7 -0
  52. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.d.ts +9 -0
  53. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js +2 -0
  54. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js.map +7 -0
  55. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.d.ts +9 -0
  56. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js +2 -0
  57. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js.map +7 -0
  58. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.d.ts +10 -0
  59. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.js +2 -0
  60. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.js.map +7 -0
  61. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribePanel.d.ts +9 -0
  62. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribePanel.js +2 -0
  63. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribePanel.js.map +7 -0
  64. package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useActivities.d.ts +18 -0
  65. package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useActivities.js +2 -0
  66. package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useActivities.js.map +7 -0
  67. package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.d.ts +9 -0
  68. package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.js +2 -0
  69. package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.js.map +7 -0
  70. package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.d.ts +17 -0
  71. package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.js +2 -0
  72. package/dist/cjs/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.js.map +7 -0
  73. package/dist/cjs/components/memberPopup/panels/EarnCredits/index.d.ts +13 -0
  74. package/dist/cjs/components/memberPopup/panels/EarnCredits/index.js +2 -0
  75. package/dist/cjs/components/memberPopup/panels/EarnCredits/index.js.map +7 -0
  76. package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralDashboard.d.ts +13 -0
  77. package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js +2 -0
  78. package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js.map +7 -0
  79. package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralOverview.d.ts +12 -0
  80. package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralOverview.js +2 -0
  81. package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralOverview.js.map +7 -0
  82. package/dist/cjs/components/memberPopup/panels/Referral/index.d.ts +7 -0
  83. package/dist/cjs/components/memberPopup/panels/Referral/index.js +2 -0
  84. package/dist/cjs/components/memberPopup/panels/Referral/index.js.map +7 -0
  85. package/dist/cjs/components/memberPopup/type.d.ts +201 -0
  86. package/dist/cjs/components/memberPopup/type.js +2 -0
  87. package/dist/cjs/components/memberPopup/type.js.map +7 -0
  88. package/dist/esm/components/index.d.ts +1 -0
  89. package/dist/esm/components/index.js +1 -1
  90. package/dist/esm/components/index.js.map +2 -2
  91. package/dist/esm/components/memberPopup/MemberPopup.d.ts +9 -0
  92. package/dist/esm/components/memberPopup/MemberPopup.js +2 -0
  93. package/dist/esm/components/memberPopup/MemberPopup.js.map +7 -0
  94. package/dist/esm/components/memberPopup/context/provider.d.ts +11 -0
  95. package/dist/esm/components/memberPopup/context/provider.js +2 -0
  96. package/dist/esm/components/memberPopup/context/provider.js.map +7 -0
  97. package/dist/esm/components/memberPopup/context/viewStack.d.ts +12 -0
  98. package/dist/esm/components/memberPopup/context/viewStack.js +2 -0
  99. package/dist/esm/components/memberPopup/context/viewStack.js.map +7 -0
  100. package/dist/esm/components/memberPopup/icons.d.ts +27 -0
  101. package/dist/esm/components/memberPopup/icons.js +2 -0
  102. package/dist/esm/components/memberPopup/icons.js.map +7 -0
  103. package/dist/esm/components/memberPopup/index.d.ts +4 -0
  104. package/dist/esm/components/memberPopup/index.js +2 -0
  105. package/dist/esm/components/memberPopup/index.js.map +7 -0
  106. package/dist/esm/components/memberPopup/panels/Activity/SubscribeModal.d.ts +10 -0
  107. package/dist/esm/components/memberPopup/panels/Activity/SubscribeModal.js +2 -0
  108. package/dist/esm/components/memberPopup/panels/Activity/SubscribeModal.js.map +7 -0
  109. package/dist/esm/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.d.ts +7 -0
  110. package/dist/esm/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js +2 -0
  111. package/dist/esm/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js.map +7 -0
  112. package/dist/esm/components/memberPopup/panels/Activity/index.d.ts +7 -0
  113. package/dist/esm/components/memberPopup/panels/Activity/index.js +2 -0
  114. package/dist/esm/components/memberPopup/panels/Activity/index.js.map +7 -0
  115. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.d.ts +19 -0
  116. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js +2 -0
  117. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js.map +7 -0
  118. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.d.ts +20 -0
  119. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js +2 -0
  120. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js.map +7 -0
  121. package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.d.ts +12 -0
  122. package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.js +2 -0
  123. package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.js.map +7 -0
  124. package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.d.ts +17 -0
  125. package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.js +2 -0
  126. package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.js.map +7 -0
  127. package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.d.ts +8 -0
  128. package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.js +2 -0
  129. package/dist/esm/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.js.map +7 -0
  130. package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.d.ts +7 -0
  131. package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.js +2 -0
  132. package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.js.map +7 -0
  133. package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.d.ts +8 -0
  134. package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.js +2 -0
  135. package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.js.map +7 -0
  136. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.d.ts +10 -0
  137. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js +2 -0
  138. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js.map +7 -0
  139. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.d.ts +9 -0
  140. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js +2 -0
  141. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js.map +7 -0
  142. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.d.ts +9 -0
  143. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js +2 -0
  144. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js.map +7 -0
  145. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.d.ts +10 -0
  146. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.js +2 -0
  147. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.js.map +7 -0
  148. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribePanel.d.ts +9 -0
  149. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribePanel.js +2 -0
  150. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribePanel.js.map +7 -0
  151. package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useActivities.d.ts +18 -0
  152. package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useActivities.js +2 -0
  153. package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useActivities.js.map +7 -0
  154. package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.d.ts +9 -0
  155. package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.js +2 -0
  156. package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.js.map +7 -0
  157. package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.d.ts +17 -0
  158. package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.js +2 -0
  159. package/dist/esm/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.js.map +7 -0
  160. package/dist/esm/components/memberPopup/panels/EarnCredits/index.d.ts +13 -0
  161. package/dist/esm/components/memberPopup/panels/EarnCredits/index.js +2 -0
  162. package/dist/esm/components/memberPopup/panels/EarnCredits/index.js.map +7 -0
  163. package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralDashboard.d.ts +13 -0
  164. package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js +2 -0
  165. package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js.map +7 -0
  166. package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralOverview.d.ts +12 -0
  167. package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralOverview.js +2 -0
  168. package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralOverview.js.map +7 -0
  169. package/dist/esm/components/memberPopup/panels/Referral/index.d.ts +7 -0
  170. package/dist/esm/components/memberPopup/panels/Referral/index.js +2 -0
  171. package/dist/esm/components/memberPopup/panels/Referral/index.js.map +7 -0
  172. package/dist/esm/components/memberPopup/type.d.ts +201 -0
  173. package/dist/esm/components/memberPopup/type.js +2 -0
  174. package/dist/esm/components/memberPopup/type.js.map +7 -0
  175. package/dist/index.d.mts +1775 -0
  176. package/dist/index.d.ts +1775 -0
  177. package/dist/index.js +18542 -0
  178. package/dist/index.js.map +1 -0
  179. package/dist/index.mjs +18514 -0
  180. package/dist/index.mjs.map +1 -0
  181. package/package.json +1 -1
  182. package/src/components/index.ts +2 -0
  183. package/src/components/memberPopup/MemberPopup.tsx +283 -0
  184. package/src/components/memberPopup/context/provider.tsx +52 -0
  185. package/src/components/memberPopup/context/viewStack.tsx +23 -0
  186. package/src/components/memberPopup/icons.tsx +147 -0
  187. package/src/components/memberPopup/index.ts +24 -0
  188. package/src/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.tsx +150 -0
  189. package/src/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.tsx +142 -0
  190. package/src/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemAndBuy.ts +33 -0
  191. package/src/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemCoupon.ts +38 -0
  192. package/src/components/memberPopup/panels/ConsumeCredits/hooks/useRedeemableList.ts +55 -0
  193. package/src/components/memberPopup/panels/ConsumeCredits/index.tsx +220 -0
  194. package/src/components/memberPopup/panels/EarnCredits/ActivatePanel.tsx +323 -0
  195. package/src/components/memberPopup/panels/EarnCredits/CompleteProfileModal.tsx +186 -0
  196. package/src/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.tsx +179 -0
  197. package/src/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.tsx +130 -0
  198. package/src/components/memberPopup/panels/EarnCredits/SubscribeModal.tsx +144 -0
  199. package/src/components/memberPopup/panels/EarnCredits/SubscribePanel.tsx +147 -0
  200. package/src/components/memberPopup/panels/EarnCredits/hooks/useActivities.ts +64 -0
  201. package/src/components/memberPopup/panels/EarnCredits/hooks/useSubscribed.ts +32 -0
  202. package/src/components/memberPopup/panels/EarnCredits/hooks/useUpdateProfile.ts +50 -0
  203. package/src/components/memberPopup/panels/EarnCredits/index.tsx +215 -0
  204. package/src/components/memberPopup/panels/Referral/hooks/useReferralOverview.ts +41 -0
  205. package/src/components/memberPopup/panels/Referral/index.tsx +108 -0
  206. package/src/components/memberPopup/type.ts +213 -0
  207. package/tailwind.config.ts +4 -0
  208. package/dist/cjs/stories/CartCard.stories.d.ts +0 -33
  209. package/dist/cjs/stories/CartCard.stories.js +0 -21
  210. package/dist/cjs/stories/CartCard.stories.js.map +0 -7
  211. package/dist/esm/stories/CartCard.stories.d.ts +0 -33
  212. package/dist/esm/stories/CartCard.stories.js +0 -21
  213. package/dist/esm/stories/CartCard.stories.js.map +0 -7
@@ -0,0 +1,215 @@
1
+ import { useMemo } from 'react'
2
+ import { classNames as cn, useHeadlessContext } from '@anker-in/lib'
3
+ import { useMemberPopupContext } from '../../context/provider'
4
+ import { useViewStack } from '../../context/viewStack'
5
+ import { useSubscribed } from './hooks/useSubscribed'
6
+ import { EarnCreditsTaskType, MemberPopupPanelType, type EarnCreditsCopy } from '../../type'
7
+ import { IconBag, IconLock, IconSubscription, IconOrders } from '../../icons'
8
+ import { numberFormat } from '../../../credits/context/utils'
9
+ import { ROUNDED_BRANDS } from '../../../../constants'
10
+
11
+ function TaskIcon({ id, className }: { id: EarnCreditsTaskType; className?: string }) {
12
+ switch (id) {
13
+ case EarnCreditsTaskType.Activate:
14
+ return <IconLock className={className} />
15
+ case EarnCreditsTaskType.Subscribe:
16
+ return <IconSubscription className={className} />
17
+ case EarnCreditsTaskType.Shop:
18
+ return <IconBag className={className} />
19
+ case EarnCreditsTaskType.CompleteProfile:
20
+ return <IconOrders className={className} />
21
+ }
22
+ }
23
+
24
+ type Props = {
25
+ copy: EarnCreditsCopy
26
+ onClose: () => void
27
+ isSubscribeSuccess?: boolean
28
+ isActivateSuccess?: boolean
29
+ isProfileCompleteSuccess?: boolean
30
+ onSubscribeSuccess?: () => void
31
+ onActivateSuccess?: () => void
32
+ onProfileCompleteSuccess?: () => void
33
+ }
34
+
35
+ function EarnCredits({
36
+ copy,
37
+ onClose,
38
+ isSubscribeSuccess = false,
39
+ isActivateSuccess = false,
40
+ isProfileCompleteSuccess = false,
41
+ onSubscribeSuccess,
42
+ onActivateSuccess,
43
+ onProfileCompleteSuccess,
44
+ }: Props) {
45
+ const { profile, openSignUpPopup, alpcConfig, creditInfo } = useMemberPopupContext()
46
+ const { pushView } = useViewStack()
47
+ const { locale } = alpcConfig
48
+ const { brand } = useHeadlessContext()
49
+ const rounded = ROUNDED_BRANDS.includes(brand)
50
+
51
+ const isLogin = !!profile
52
+
53
+ const isSubscribed = useSubscribed({
54
+ userId: profile?.user_id,
55
+ brand: alpcConfig.brand,
56
+ email: profile?.email,
57
+ locale,
58
+ apiBaseUrl: alpcConfig.apiBaseUrl,
59
+ })
60
+
61
+ const profileCompleted = useMemo(() => {
62
+ return isProfileCompleteSuccess || (!!(profile?.first_name || profile?.last_name) && !!profile?.phone_number && !!profile?.dob)
63
+ }, [profile, isProfileCompleteSuccess])
64
+
65
+ const taskStates: Record<EarnCreditsTaskType, { finished: boolean; onClick?: () => void; link?: string }> = useMemo(() => ({
66
+ [EarnCreditsTaskType.Activate]: {
67
+ finished: !!profile?.activated || isActivateSuccess,
68
+ onClick: isLogin
69
+ ? () => pushView({
70
+ type: MemberPopupPanelType.Activate,
71
+ props: { onSuccess: onActivateSuccess },
72
+ })
73
+ : openSignUpPopup,
74
+ },
75
+ [EarnCreditsTaskType.CompleteProfile]: {
76
+ finished: profileCompleted,
77
+ onClick: isLogin
78
+ ? () => pushView({
79
+ type: MemberPopupPanelType.CompleteProfile,
80
+ props: { onSuccess: onProfileCompleteSuccess },
81
+ })
82
+ : openSignUpPopup,
83
+ },
84
+ [EarnCreditsTaskType.Subscribe]: {
85
+ finished: isSubscribed || isSubscribeSuccess,
86
+ onClick: isLogin
87
+ ? () => pushView({
88
+ type: MemberPopupPanelType.SubscribeEmail,
89
+ props: { onSuccess: onSubscribeSuccess },
90
+ })
91
+ : openSignUpPopup,
92
+ },
93
+ [EarnCreditsTaskType.Shop]: {
94
+ finished: false,
95
+ link: copy.goShopLink,
96
+ onClick: isLogin ? undefined : openSignUpPopup,
97
+ },
98
+ }), [profile, isLogin, isActivateSuccess, isProfileCompleteSuccess, profileCompleted, isSubscribed, isSubscribeSuccess, openSignUpPopup, pushView, copy.goShopLink])
99
+
100
+ const list = useMemo(() => {
101
+ return copy.list.map(item => {
102
+ const state = taskStates[item.id]
103
+ if (!state) return null
104
+ const buttonLabel = state.finished
105
+ ? copy.completed
106
+ : isLogin
107
+ ? getNotFinishedLabel(item.id, copy)
108
+ : copy.joinNow
109
+ return { ...item, ...state, buttonLabel }
110
+ }).filter(Boolean) as (typeof copy.list[number] & {
111
+ finished: boolean
112
+ onClick?: () => void
113
+ link?: string
114
+ buttonLabel: string
115
+ })[]
116
+ }, [copy, taskStates, isLogin])
117
+
118
+ return (
119
+ <div className="flex flex-col gap-[16px]">
120
+ <div className="flex flex-col gap-[16px]">
121
+ <div className="flex flex-col gap-[8px]">
122
+ {copy.title && <h2 className="text-[24px] font-[700] leading-[1.2] text-[#080a0f]">{copy.title}</h2>}
123
+ </div>
124
+
125
+ {isLogin && creditInfo && (
126
+ <div className={cn('flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]', rounded ? 'rounded-[8px]' : 'rounded-none')}>
127
+ <div className="flex flex-1 flex-col gap-[4px]">
128
+ <div className="text-[14px] font-[700] text-[#1e2024]">
129
+ {copy.balanceLabel ?? 'AnkerCredits Balance'}
130
+ </div>
131
+ <div className="flex items-end gap-[4px]">
132
+ <span className="text-[24px] font-[700] leading-[1.2] text-[#1e2024]">
133
+ {numberFormat(creditInfo.available_credit)}
134
+ </span>
135
+ <span className="text-[14px] font-[700] leading-[1.4] text-[#1e2024]">
136
+ {copy.creditUnit ?? 'ankercredits'}
137
+ </span>
138
+ </div>
139
+ </div>
140
+ <div className="h-full w-px bg-[#dadce0]" />
141
+ <div className="flex flex-1 flex-col gap-[4px]">
142
+ <div className="text-[14px] font-[700] text-[#1e2024]">
143
+ {copy.comingSoonLabel ?? 'Coming Soon'}
144
+ </div>
145
+ <div className="flex items-end gap-[4px]">
146
+ <span className="text-[24px] font-[700] leading-[1.2] text-[#1e2024]">
147
+ {numberFormat(creditInfo.pending_credit ?? 0)}
148
+ </span>
149
+ <span className="text-[14px] font-[700] leading-[1.4] text-[#1e2024]">
150
+ {copy.creditUnit ?? 'ankercredits'}
151
+ </span>
152
+ </div>
153
+ </div>
154
+ </div>
155
+ )}
156
+ </div>
157
+
158
+ <div className="flex flex-col gap-[16px]">
159
+ {copy.subtitle && (
160
+ <p className="text-[16px] font-[700] text-[#1e2024]">{copy.subtitle}</p>
161
+ )}
162
+
163
+ <div className="flex flex-col">
164
+ {list.map((item, idx) => (
165
+ <div key={idx} className="relative py-[16px]">
166
+ {idx > 0 && <div className="absolute left-0 right-0 top-0 h-px bg-[#dadce0]" />}
167
+ <div className={cn('flex items-center gap-[12px]', item.finished && 'opacity-60')}>
168
+ <TaskIcon id={item.id} className="size-[24px] shrink-0" />
169
+ <div className="flex-1">
170
+ <div className="text-[16px] font-[700] text-[#1e2024]">{item.title}</div>
171
+ {item.description && (
172
+ <div className="mt-[4px] text-[14px] font-[700] text-[#4a4c56]">{item.description}</div>
173
+ )}
174
+ </div>
175
+ {!item.finished && item.link ? (
176
+ <a
177
+ href={item.link}
178
+ target="_blank"
179
+ rel="noopener noreferrer"
180
+ className={cn('cursor-pointer bg-[#080a0f] min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white', rounded ? 'rounded-[4px]' : 'rounded-none')}
181
+ >
182
+ {item.buttonLabel}
183
+ </a>
184
+ ) : (
185
+ <button
186
+ className={cn(
187
+ 'cursor-pointer min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white',
188
+ item.finished ? 'bg-[#767880]' : 'bg-[#080a0f]',
189
+ rounded ? 'rounded-[4px]' : 'rounded-none'
190
+ )}
191
+ disabled={item.finished}
192
+ onClick={!item.finished ? item.onClick : undefined}
193
+ >
194
+ {item.buttonLabel}
195
+ </button>
196
+ )}
197
+ </div>
198
+ </div>
199
+ ))}
200
+ </div>
201
+ </div>
202
+ </div>
203
+ )
204
+ }
205
+
206
+ function getNotFinishedLabel(id: EarnCreditsTaskType, copy: EarnCreditsCopy): string {
207
+ switch (id) {
208
+ case EarnCreditsTaskType.Activate: return copy.activate
209
+ case EarnCreditsTaskType.CompleteProfile: return copy.completeProfileLabel
210
+ case EarnCreditsTaskType.Subscribe: return copy.subscribeLabel
211
+ case EarnCreditsTaskType.Shop: return copy.shopNow
212
+ }
213
+ }
214
+
215
+ export default EarnCredits
@@ -0,0 +1,41 @@
1
+ import useSWR from 'swr'
2
+ import { useMemberPopupContext } from '../../../context/provider'
3
+
4
+ export type ReferralRewardOverviewResponse = {
5
+ data: {
6
+ data: {
7
+ available: number
8
+ pending: number
9
+ }
10
+ }
11
+ }
12
+
13
+ export function useReferralOverview(): {
14
+ isLoading: boolean
15
+ data?: ReferralRewardOverviewResponse
16
+ } {
17
+ const { profile, alpcConfig } = useMemberPopupContext()
18
+ const isLogin = !!profile
19
+
20
+ const swrKey = isLogin ? `/api/multipass/mktsrv/v1/referral/reward/overview/cash` : null
21
+
22
+ const swrFetcher = async (url: string) => {
23
+ const response = await fetch(url, {
24
+ method: 'GET',
25
+ headers: {
26
+ 'Content-Type': 'application/json',
27
+ 'current-language': alpcConfig.locale,
28
+ },
29
+ })
30
+ if (!response.ok) {
31
+ throw new Error(`HTTP error! status: ${response.status}`)
32
+ }
33
+ return response.json()
34
+ }
35
+
36
+ const { data, isLoading } = useSWR<ReferralRewardOverviewResponse>(swrKey, swrFetcher, {
37
+ revalidateOnFocus: false,
38
+ })
39
+
40
+ return { isLoading, data }
41
+ }
@@ -0,0 +1,108 @@
1
+ import { Picture } from '@anker-in/headless-ui'
2
+ import { classNames as cn, useHeadlessContext } from '@anker-in/lib'
3
+ import { useMemberPopupContext } from '../../context/provider'
4
+ import { useReferralOverview } from './hooks/useReferralOverview'
5
+ import { formatPrice } from '../../../credits/context/utils'
6
+
7
+ import type { ReferralCopy } from '../../type'
8
+ import { ROUNDED_BRANDS } from '../../../../constants'
9
+
10
+ type Props = {
11
+ copy: ReferralCopy
12
+ onClose: () => void
13
+ }
14
+
15
+ function Referral({ copy, onClose }: Props) {
16
+ const { profile, alpcConfig } = useMemberPopupContext()
17
+ const isLogin = !!profile
18
+ const { brand, currencyCode = 'USD' as string } = useHeadlessContext()
19
+ const rounded = ROUNDED_BRANDS.includes(brand)
20
+
21
+ const { data } = useReferralOverview()
22
+
23
+ const cashAvailable = data?.data?.data?.available ?? 0
24
+ const cashPending = data?.data?.data?.pending ?? 0
25
+
26
+ console.log('cashAvailable', cashAvailable)
27
+ console.log('cashPending', cashPending)
28
+ console.log('data', data)
29
+ console.log('data.data', data?.data)
30
+
31
+ return (
32
+ <div className="flex flex-col gap-[12px]">
33
+ {copy.title && <h2 className="text-[24px] font-[700] leading-[1.2] text-[#080a0f]">{copy.title}</h2>}
34
+
35
+ {isLogin && (
36
+ <div
37
+ className={cn(
38
+ 'flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]',
39
+ rounded ? 'rounded-[8px]' : 'rounded-none'
40
+ )}
41
+ >
42
+ <div className="flex flex-1 flex-col gap-[4px]">
43
+ <div className="text-[14px] font-[700] text-[#1e2024]">{copy.cashAvailableLabel}</div>
44
+ <span className="text-[24px] font-[700] leading-[1.2] text-[#1e2024]">
45
+ {formatPrice({ amount: cashAvailable, currencyCode, locale: alpcConfig.locale })}
46
+ </span>
47
+ </div>
48
+ <div className="h-full w-px self-stretch bg-[#dadce0]" />
49
+ <div className="flex flex-1 flex-col gap-[4px]">
50
+ <div className="text-[14px] font-[700] text-[#1e2024]">{copy.cashPendingLabel}</div>
51
+ <span className="text-[24px] font-[700] leading-[1.2] text-[#1e2024]">
52
+ {formatPrice({ amount: cashPending, currencyCode, locale: alpcConfig.locale })}
53
+ </span>
54
+ </div>
55
+ </div>
56
+ )}
57
+
58
+ {(copy.howToTitle || copy.howToDescription) && (
59
+ <div className="flex flex-col gap-[8px]">
60
+ {copy.howToTitle && (
61
+ <h3 className="text-[20px] font-[700] leading-[1.2] text-[#080a0f]">{copy.howToTitle}</h3>
62
+ )}
63
+ {copy.howToDescription && <p className="text-[14px] leading-[1.5] text-[#1e2024]">{copy.howToDescription}</p>}
64
+ {copy.learnMoreLabel && copy.learnMoreUrl && (
65
+ <a
66
+ href={copy.learnMoreUrl}
67
+ target="_blank"
68
+ rel="noopener noreferrer"
69
+ className="flex items-center gap-[4px] text-[14px] font-[700] text-[#080a0f] underline"
70
+ >
71
+ {copy.learnMoreLabel}
72
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
73
+ <path
74
+ 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"
75
+ fill="#080A0F"
76
+ />
77
+ </svg>
78
+ </a>
79
+ )}
80
+ </div>
81
+ )}
82
+
83
+ {copy.image?.url && (
84
+ <Picture
85
+ source={copy.image.url}
86
+ alt={copy.image.alt ?? ''}
87
+ className={cn('h-[100px] w-full object-cover', rounded ? 'rounded-[8px]' : 'rounded-none')}
88
+ />
89
+ )}
90
+
91
+ {copy.ctaButton && (
92
+ <a
93
+ href={copy.ctaUrl ?? '#'}
94
+ target="_blank"
95
+ rel="noopener noreferrer"
96
+ className={cn(
97
+ 'block w-full cursor-pointer bg-[#080a0f] py-[14px] text-center text-[14px] font-[700] text-white',
98
+ rounded ? 'rounded-[4px]' : 'rounded-none'
99
+ )}
100
+ >
101
+ {copy.ctaButton}
102
+ </a>
103
+ )}
104
+ </div>
105
+ )
106
+ }
107
+
108
+ export default Referral
@@ -0,0 +1,213 @@
1
+ import type { AuthCodeActivateCopy } from '../registration/authCodeActivate/type'
2
+ import type { CreditInfoResponse } from '../credits/context/response'
3
+ import type { DTC_TASK_TYPE } from '../credits/context/const'
4
+
5
+ export type { AuthCodeActivateCopy }
6
+
7
+ // ─── 面板类型枚举 ─────────────────────────────────────
8
+ export enum MemberPopupPanelType {
9
+ EarnCredits = 'EARN_CREDITS',
10
+ ConsumeCredits = 'CONSUME_CREDITS',
11
+ Referral = 'REFERRAL',
12
+ CompleteProfile = 'COMPLETE_PROFILE',
13
+ Subscribe = 'SUBSCRIBE',
14
+ SubscribeEmail = 'SUBSCRIBE_EMAIL',
15
+ RedeemCoupon = 'REDEEM_COUPON',
16
+ Activate = 'ACTIVATE',
17
+ }
18
+
19
+ // ─── item action 类型枚举 ─────────────────────────────
20
+ export enum MemberPopupActionType {
21
+ ExternalLink = 'EXTERNAL_LINK',
22
+ OpenEarnCredits = 'OPEN_EARN_CREDITS',
23
+ OpenConsumeCredits = 'OPEN_CONSUME_CREDITS',
24
+ OpenReferral = 'OPEN_REFERRAL',
25
+ OpenSubscribe = 'OPEN_SUBSCRIBE',
26
+ }
27
+
28
+ // ─── EarnCredits 任务类型枚举 ─────────────────────────
29
+ export enum EarnCreditsTaskType {
30
+ Activate = 'activate',
31
+ CompleteProfile = 'completeProfile',
32
+ Subscribe = 'subscribe',
33
+ Shop = 'shop',
34
+ }
35
+
36
+ // ─── ConsumeCredits item 类型枚举 ─────────────────────
37
+ export enum ConsumeCreditsItemType {
38
+ Coupon = 'COUPON',
39
+ RedeemAndBuy = 'REDEEM_AND_BUY',
40
+ }
41
+
42
+ // ─── 通用 link(统一一种类型) ─────────────────────────
43
+ export type MemberPopupLink = {
44
+ type: MemberPopupActionType
45
+ label: string
46
+ url?: string // 仅 ExternalLink 时使用
47
+ }
48
+
49
+ // ─── list item ────────────────────────────────────────
50
+ export type MemberPopupItem = {
51
+ title: string
52
+ description?: string
53
+ links: MemberPopupLink[]
54
+ }
55
+
56
+ // ─── 主组件 Copy ──────────────────────────────────────
57
+ export type MemberPopupCopy = {
58
+ triggerImg: { url: string; alt?: string }
59
+ title?: string
60
+ subtitle?: string
61
+ list: MemberPopupItem[]
62
+ footer?: {
63
+ loginHint: string
64
+ loginLabel: string
65
+ joinLabel: string
66
+ shopLabel: string
67
+ shopUrl?: string
68
+ }
69
+ subscribe?: SubscribeModalCopy
70
+ earnCredits?: EarnCreditsCopy
71
+ consumeCredits?: ConsumeCreditsopy
72
+ referral?: ReferralCopy
73
+ }
74
+
75
+ // ─── EarnCredits Copy ────────────────────────────────
76
+ export type EarnCreditsCopy = {
77
+ title?: string
78
+ subtitle?: string
79
+ balanceLabel?: string
80
+ comingSoonLabel?: string
81
+ creditUnit?: string
82
+ joinNow: string
83
+ completed: string
84
+ activate: string
85
+ completeProfileLabel: string
86
+ subscribeLabel: string
87
+ shopNow: string
88
+ goShopLink?: string
89
+ list: {
90
+ id: EarnCreditsTaskType
91
+ title: string
92
+ description: string
93
+ credits?: string
94
+ }[]
95
+ // 子弹窗文案
96
+ authCodeActivate: AuthCodeActivateCopy
97
+ completeProfile: CompleteProfileCopy
98
+ subscribe: SubscribeModalCopy
99
+ }
100
+
101
+ export type CompleteProfileCopy = {
102
+ title: string
103
+ subtitle?: string
104
+ firstName: string
105
+ lastName: string
106
+ email: string
107
+ phone: string
108
+ birthday: string
109
+ country: string
110
+ save: string
111
+ cancel: string
112
+ edit: string
113
+ required: string
114
+ }
115
+
116
+ export type SubscribeModalCopy = {
117
+ title: string
118
+ desc?: string
119
+ placeholder: string
120
+ policy?: string
121
+ successTips?: string
122
+ dealsType?: string
123
+ buttonLabel?: string
124
+ single_brand_subscribe?: boolean
125
+ genre?: string
126
+ sub_brand_type?: string
127
+ }
128
+
129
+ // ─── ConsumeCredits Copy ────────────────────────────
130
+ export type ConsumeCreditsopy = {
131
+ title?: string
132
+ subtitle?: string
133
+ soldOut: string
134
+ unlockRewards: string
135
+ btnRedeem: string
136
+ insufficientCredits?: string
137
+ pointUnit?: string
138
+ off?: string
139
+ imageMapping?: {
140
+ [key in ConsumeCreditsItemType]?: { url: string }
141
+ }
142
+ list: ConsumeCreditsItem[]
143
+ redeemModal: RedeemCouponModalCopy
144
+ creditsPage?: { label: string; url: string }
145
+ }
146
+
147
+ export type ConsumeCreditsItem = {
148
+ redeemId: string | number
149
+ title: string
150
+ description?: string
151
+ image: { url: string; alt?: string }
152
+ type: ConsumeCreditsItemType
153
+ product?: { handle: string; sku: string }
154
+ price?: number
155
+ value?: string
156
+ rules?: string[]
157
+ }
158
+
159
+ export type RedeemCouponModalCopy = {
160
+ confirmTitle: string
161
+ confirmButton: string
162
+ commonError: string
163
+ redeemLimitError: string
164
+ inventoryNotEnough: string
165
+ creditsNotEnough: string
166
+ crossSiteError: string
167
+ successTitle: string
168
+ successDesc: string
169
+ successButton: string
170
+ successButtonUrl?: string
171
+ }
172
+
173
+ // ─── Referral Copy ───────────────────────────────────
174
+ export type ReferralCopy = {
175
+ title?: string
176
+ description?: string
177
+ cashAvailableLabel: string
178
+ cashPendingLabel: string
179
+ creditUnit?: string
180
+ referralLinksLabel?: string
181
+ referralLinkBaseUrl?: string
182
+ copyLabel?: string
183
+ copiedLabel?: string
184
+ howToTitle?: string
185
+ howToDescription?: string
186
+ learnMoreLabel?: string
187
+ learnMoreUrl?: string
188
+ image?: { url: string; alt?: string }
189
+ ctaButton: string
190
+ ctaUrl?: string
191
+ loginTitle?: string
192
+ loginDescription?: string
193
+ loginCtaLabel?: string
194
+ }
195
+
196
+ // ─── Provider Context 类型 ───────────────────────────
197
+ export type AlpcConfig = {
198
+ brand: string
199
+ locale: string
200
+ appName: string
201
+ apiBaseUrl?: string
202
+ }
203
+
204
+ export type MemberPopupContextValue = {
205
+ profile: any
206
+ isLoadingProfile: boolean
207
+ creditInfo?: CreditInfoResponse
208
+ fetchCreditInfo: (userId: string) => void
209
+ openSignUpPopup: () => void
210
+ openSignInPopup: () => void
211
+ taskIdToTypeMapping?: Record<string, DTC_TASK_TYPE>
212
+ alpcConfig: AlpcConfig
213
+ }
@@ -14,6 +14,10 @@ export default {
14
14
  },
15
15
  theme: {
16
16
  extend: {
17
+ screens: {
18
+ 'cmp-md': { max: '767px' },
19
+ 'cmp-sm': { max: '374px' },
20
+ },
17
21
  colors: {
18
22
  primary: {
19
23
  DEFAULT: 'var(--brand-color-1)',
@@ -1,33 +0,0 @@
1
- /**
2
- * CartCard Storybook Stories
3
- * 展示购物车卡片组件的各种状态
4
- */
5
- import type { Meta, StoryObj } from '@storybook/react';
6
- import React from 'react';
7
- import type { CartContent } from '../components/LiveChatWidget/types';
8
- declare const CartCardWrapper: React.FC<{
9
- content: CartContent;
10
- }>;
11
- declare const meta: Meta<typeof CartCardWrapper>;
12
- export default meta;
13
- type Story = StoryObj<typeof CartCardWrapper>;
14
- /**
15
- * 空购物车状态
16
- */
17
- export declare const Empty: Story;
18
- /**
19
- * 单件商品
20
- */
21
- export declare const SingleItem: Story;
22
- /**
23
- * 多件商品
24
- */
25
- export declare const MultipleItems: Story;
26
- /**
27
- * 有折扣码的购物车
28
- */
29
- export declare const WithDiscount: Story;
30
- /**
31
- * 多个折扣码(部分失效)
32
- */
33
- export declare const WithMultipleDiscounts: Story;
@@ -1,21 +0,0 @@
1
- "use strict";var c=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var a in e)c(t,a,{get:e[a],enumerable:!0})},m=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!s.call(t,o)&&o!==a&&c(t,o,{get:()=>e[o],enumerable:!(n=i(e,o))||n.enumerable});return t};var y=t=>m(c({},"__esModule",{value:!0}),t);var A={};p(A,{Empty:()=>S,MultipleItems:()=>g,SingleItem:()=>f,WithDiscount:()=>U,WithMultipleDiscounts:()=>D,default:()=>C});module.exports=y(A);var r=require("react/jsx-runtime"),u=require("../components/LiveChatWidget/components/MessageContent/CartCard.js");const l=({content:t})=>(0,r.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-gray-100 p-4",children:(0,r.jsx)("div",{className:"w-full max-w-md",children:u.CartCard.render(t,!1,!1)})}),h={title:"Campaign/LiveChatWidget/MessageContent/CartCard",component:l,parameters:{layout:"fullscreen",docs:{description:{component:`
2
- # \u8D2D\u7269\u8F66\u5361\u7247\u7EC4\u4EF6
3
-
4
- \u663E\u793A\u7528\u6237\u8D2D\u7269\u8F66\u5185\u5BB9\uFF0C\u5305\u62EC\u5546\u54C1\u5217\u8868\u3001\u4EF7\u683C\u6C47\u603B\u548C\u7ED3\u8D26\u6309\u94AE\u3002
5
-
6
- ## \u529F\u80FD\u7279\u6027
7
-
8
- - \u{1F4E6} **\u5546\u54C1\u5217\u8868**: \u5C55\u793A\u8D2D\u7269\u8F66\u4E2D\u7684\u6240\u6709\u5546\u54C1
9
- - \u{1F4B0} **\u4EF7\u683C\u6C47\u603B**: \u663E\u793A\u5C0F\u8BA1\u3001\u6298\u6263\u548C\u603B\u8BA1
10
- - \u{1F39F}\uFE0F **\u6298\u6263\u7801**: \u663E\u793A\u5DF2\u5E94\u7528\u7684\u6298\u6263\u7801\u53CA\u5176\u72B6\u6001
11
- - \u{1F6D2} **\u7ED3\u8D26\u6309\u94AE**: \u4E00\u952E\u8DF3\u8F6C\u5230 Shopify \u7ED3\u8D26\u9875\u9762
12
- - \u{1F233} **\u7A7A\u72B6\u6001**: \u4F18\u96C5\u7684\u7A7A\u8D2D\u7269\u8F66\u63D0\u793A
13
-
14
- ## \u4F7F\u7528\u573A\u666F
15
-
16
- - \u7528\u6237\u6DFB\u52A0\u5546\u54C1\u5230\u8D2D\u7269\u8F66\u540E (add_to_cart)
17
- - \u7528\u6237\u67E5\u8BE2\u8D2D\u7269\u8F66\u5185\u5BB9 (get_cart)
18
- - \u7528\u6237\u4FEE\u6539\u8D2D\u7269\u8F66\u6570\u91CF (update_cart_item)
19
- - \u7528\u6237\u5E94\u7528\u6298\u6263\u7801 (update_discount_codes)
20
- `}}},tags:["autodocs"]};var C=h;const S={args:{content:{type:"cart",data:{isEmpty:!0,cartId:"gid://shopify/Cart/empty",totalQuantity:0,lines:[],cost:{totalAmount:{amount:"0.00",currencyCode:"USD"},subtotalAmount:{amount:"0.00",currencyCode:"USD"}}}}}},f={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:1,lines:[{id:"gid://shopify/CartLine/12345",quantity:1,cost:{totalAmount:{amount:"99.99",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"99.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}}],cost:{totalAmount:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"99.99",currencyCode:"USD"}},checkoutUrl:"https://checkout.shopify.com/example"}}}},g={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:5,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}},{id:"gid://shopify/CartLine/12346",quantity:1,cost:{totalAmount:{amount:"129.99",currencyCode:"USD"},amountPerQuantity:{amount:"129.99",currencyCode:"USD"},subtotalAmount:{amount:"129.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567891",title:"White",price:{amount:"129.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop",altText:"eufy Security Camera"},product:{id:"gid://shopify/Product/8179159826619",title:"eufy Security Camera",handle:"eufy-security-camera"}}},{id:"gid://shopify/CartLine/12347",quantity:2,cost:{totalAmount:{amount:"79.98",currencyCode:"USD"},amountPerQuantity:{amount:"39.99",currencyCode:"USD"},subtotalAmount:{amount:"79.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567892",title:"USB-C Cable",price:{amount:"39.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1583863788434-e58a36330cf0?w=400&h=400&fit=crop",altText:"Anker USB-C Cable"},product:{id:"gid://shopify/Product/8179159826620",title:"Anker USB-C Cable 6ft",handle:"anker-usb-c-cable"}}}],cost:{totalAmount:{amount:"409.95",currencyCode:"USD"},subtotalAmount:{amount:"409.95",currencyCode:"USD"}},checkoutUrl:"https://checkout.shopify.com/example"}}}},U={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:3,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}},{id:"gid://shopify/CartLine/12346",quantity:1,cost:{totalAmount:{amount:"129.99",currencyCode:"USD"},amountPerQuantity:{amount:"129.99",currencyCode:"USD"},subtotalAmount:{amount:"129.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567891",title:"White",price:{amount:"129.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop",altText:"eufy Security Camera"},product:{id:"gid://shopify/Product/8179159826619",title:"eufy Security Camera",handle:"eufy-security-camera"}}}],cost:{totalAmount:{amount:"296.97",currencyCode:"USD"},subtotalAmount:{amount:"329.97",currencyCode:"USD"}},discountCodes:[{code:"SPRING20",applicable:!0}],checkoutUrl:"https://checkout.shopify.com/example"}}}},D={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:2,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}}],cost:{totalAmount:{amount:"179.98",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},discountCodes:[{code:"WELCOME10",applicable:!0},{code:"EXPIRED20",applicable:!1}],checkoutUrl:"https://checkout.shopify.com/example"}}}};
21
- //# sourceMappingURL=CartCard.stories.js.map