@anker-in/campaign-ui 0.2.10-beta.33 → 0.2.10-beta.35

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 (116) hide show
  1. package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js +1 -1
  2. package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js.map +2 -2
  3. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.d.ts +2 -1
  4. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +1 -1
  5. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +2 -2
  6. package/dist/cjs/components/credits/context/hooks/useUploadReceipt.js +1 -1
  7. package/dist/cjs/components/credits/context/hooks/useUploadReceipt.js.map +2 -2
  8. package/dist/cjs/components/credits/creditsCash/RedeemableItem.d.ts +0 -2
  9. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +1 -1
  10. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +3 -3
  11. package/dist/cjs/components/credits/creditsCash/index.d.ts +0 -2
  12. package/dist/cjs/components/credits/creditsCash/index.js +1 -1
  13. package/dist/cjs/components/credits/creditsCash/index.js.map +3 -3
  14. package/dist/cjs/components/credits/creditsFaq/index.js +1 -1
  15. package/dist/cjs/components/credits/creditsFaq/index.js.map +1 -1
  16. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  17. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +2 -2
  18. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
  19. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +2 -2
  20. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
  21. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +2 -2
  22. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  23. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  24. package/dist/cjs/components/credits/creditsRedeemList/index.d.ts +0 -1
  25. package/dist/cjs/components/credits/creditsRedeemList/index.js +1 -1
  26. package/dist/cjs/components/credits/creditsRedeemList/index.js.map +2 -2
  27. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js +1 -1
  28. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js.map +3 -3
  29. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +0 -1
  30. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js +1 -1
  31. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js.map +1 -1
  32. package/dist/cjs/components/registration/authCodeActivate/Message.d.ts +4 -0
  33. package/dist/cjs/components/registration/authCodeActivate/Message.js +2 -0
  34. package/dist/cjs/components/registration/authCodeActivate/Message.js.map +7 -0
  35. package/dist/cjs/components/registration/authCodeActivate/index.d.ts +3 -0
  36. package/dist/cjs/components/registration/authCodeActivate/index.js +2 -0
  37. package/dist/cjs/components/registration/authCodeActivate/index.js.map +7 -0
  38. package/dist/cjs/components/registration/authCodeActivate/type.d.ts +23 -0
  39. package/dist/cjs/components/registration/authCodeActivate/type.js +2 -0
  40. package/dist/cjs/components/registration/authCodeActivate/type.js.map +7 -0
  41. package/dist/cjs/components/registration/index.d.ts +1 -0
  42. package/dist/cjs/components/registration/index.js +2 -0
  43. package/dist/cjs/components/registration/index.js.map +7 -0
  44. package/dist/cjs/components/registration/modalContainer.js +1 -1
  45. package/dist/cjs/components/registration/modalContainer.js.map +2 -2
  46. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js +1 -1
  47. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js.map +2 -2
  48. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.d.ts +2 -1
  49. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +1 -1
  50. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +2 -2
  51. package/dist/esm/components/credits/context/hooks/useUploadReceipt.js +1 -1
  52. package/dist/esm/components/credits/context/hooks/useUploadReceipt.js.map +2 -2
  53. package/dist/esm/components/credits/creditsCash/RedeemableItem.d.ts +0 -2
  54. package/dist/esm/components/credits/creditsCash/RedeemableItem.js +1 -1
  55. package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +3 -3
  56. package/dist/esm/components/credits/creditsCash/index.d.ts +0 -2
  57. package/dist/esm/components/credits/creditsCash/index.js +1 -1
  58. package/dist/esm/components/credits/creditsCash/index.js.map +3 -3
  59. package/dist/esm/components/credits/creditsFaq/index.js +1 -1
  60. package/dist/esm/components/credits/creditsFaq/index.js.map +1 -1
  61. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  62. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +2 -2
  63. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
  64. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +2 -2
  65. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
  66. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +2 -2
  67. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  68. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  69. package/dist/esm/components/credits/creditsRedeemList/index.d.ts +0 -1
  70. package/dist/esm/components/credits/creditsRedeemList/index.js +1 -1
  71. package/dist/esm/components/credits/creditsRedeemList/index.js.map +2 -2
  72. package/dist/esm/components/credits/creditsWaysToGetCredits/index.js +1 -1
  73. package/dist/esm/components/credits/creditsWaysToGetCredits/index.js.map +2 -2
  74. package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +0 -1
  75. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js +1 -1
  76. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +1 -1
  77. package/dist/esm/components/registration/authCodeActivate/Message.d.ts +4 -0
  78. package/dist/esm/components/registration/authCodeActivate/Message.js +2 -0
  79. package/dist/esm/components/registration/authCodeActivate/Message.js.map +7 -0
  80. package/dist/esm/components/registration/authCodeActivate/index.d.ts +3 -0
  81. package/dist/esm/components/registration/authCodeActivate/index.js +2 -0
  82. package/dist/esm/components/registration/authCodeActivate/index.js.map +7 -0
  83. package/dist/esm/components/registration/authCodeActivate/type.d.ts +23 -0
  84. package/dist/esm/components/registration/authCodeActivate/type.js +1 -0
  85. package/dist/esm/components/registration/authCodeActivate/type.js.map +7 -0
  86. package/dist/esm/components/registration/index.d.ts +1 -0
  87. package/dist/esm/components/registration/index.js +2 -0
  88. package/dist/esm/components/registration/index.js.map +7 -0
  89. package/dist/esm/components/registration/modalContainer.js +1 -1
  90. package/dist/esm/components/registration/modalContainer.js.map +2 -2
  91. package/package.json +1 -1
  92. package/src/components/credits/context/hooks/useRedeemAndBuy.ts +3 -1
  93. package/src/components/credits/context/hooks/useRedeemCoupon.ts +2 -1
  94. package/src/components/credits/context/hooks/useUploadReceipt.tsx +0 -1
  95. package/src/components/credits/creditsCash/RedeemableItem.tsx +16 -16
  96. package/src/components/credits/creditsCash/index.tsx +25 -27
  97. package/src/components/credits/creditsFaq/index.tsx +1 -1
  98. package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +0 -1
  99. package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +1 -1
  100. package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +0 -1
  101. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +4 -4
  102. package/src/components/credits/creditsRedeemList/index.tsx +0 -4
  103. package/src/components/credits/creditsWaysToGetCredits/index.tsx +1 -2
  104. package/src/components/credits/creditsWaysToGetCredits/type.ts +0 -1
  105. package/dist/cjs/components/credits/creditsRedeemList/CardValue.d.ts +0 -6
  106. package/dist/cjs/components/credits/creditsRedeemList/CardValue.js +0 -2
  107. package/dist/cjs/components/credits/creditsRedeemList/CardValue.js.map +0 -7
  108. package/dist/esm/components/credits/creditsRedeemList/CardValue.d.ts +0 -6
  109. package/dist/esm/components/credits/creditsRedeemList/CardValue.js +0 -2
  110. package/dist/esm/components/credits/creditsRedeemList/CardValue.js.map +0 -7
  111. package/dist/index.d.mts +0 -493
  112. package/dist/index.d.ts +0 -493
  113. package/dist/index.js +0 -31210
  114. package/dist/index.js.map +0 -1
  115. package/dist/index.mjs +0 -31196
  116. package/dist/index.mjs.map +0 -1
@@ -3,6 +3,7 @@ import { useRedeemCoupon } from './useRedeemCoupon'
3
3
  import type { ProductVariant } from '@anker-in/lib'
4
4
  import { useCreditsContext } from '../provider'
5
5
  import { useBuyNow } from '@anker-in/lib'
6
+ import { AlpcErrorCode } from '../const'
6
7
 
7
8
  export const useRedeemAndBuy = (
8
9
  _: any,
@@ -38,6 +39,7 @@ export const useRedeemAndBuy = (
38
39
  user_id: profile?.user_id,
39
40
  rule_id: arg.redeemId,
40
41
  })
42
+ console.log('res', res)
41
43
  if (res && res?.data?.coupon_code) {
42
44
  buyNow({
43
45
  discountCodes: [res.data.coupon_code],
@@ -49,7 +51,7 @@ export const useRedeemAndBuy = (
49
51
  ],
50
52
  })
51
53
  } else {
52
- throw new Error('Redeem failed')
54
+ throw new Error(`Redeem failed: ${res?.msg}`)
53
55
  }
54
56
  },
55
57
  swrOptions
@@ -3,11 +3,12 @@ import { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'
3
3
  import { useHeadlessContext } from '@anker-in/lib'
4
4
 
5
5
  type RedeemCouponResponse = {
6
- code: number
7
6
  data: {
8
7
  success: boolean
9
8
  coupon_code: string
10
9
  }
10
+ msg: string // 报错信息
11
+ code: number // 报错码
11
12
  }
12
13
 
13
14
  export const useRedeemCoupon = (mutationOptions: UseMutationConfig<RedeemCouponResponse> = {}) => {
@@ -18,7 +18,6 @@ export const uploadReceipt = async (
18
18
  }),
19
19
  })
20
20
  const { data } = await response.json()
21
- console.log('data', data)
22
21
  return {
23
22
  ok: data?.code === 0,
24
23
  code: data?.code,
@@ -1,5 +1,5 @@
1
1
  import { Button, Text, Picture } from '@anker-in/headless-ui'
2
- import { useMemo } from 'react'
2
+ import { useMemo, useState } from 'react'
3
3
  import { cn } from '../../../helpers'
4
4
 
5
5
  import { CreditsCashCopy, RedeemItem } from './type'
@@ -23,8 +23,6 @@ function RedeemableItem({
23
23
  authCodeActivate: {
24
24
  openAuthCodePopup: Function
25
25
  isSuccess: boolean
26
- setOnSuccess: (arg: Function) => void
27
- isSendingActivateEmail: boolean
28
26
  }
29
27
  }) {
30
28
  const {
@@ -33,10 +31,13 @@ function RedeemableItem({
33
31
  openSignUpPopup,
34
32
  gtm: { pageGroup },
35
33
  } = useCreditsContext()
34
+ const [error, setError] = useState<string | null>(null)
36
35
  const { trigger, isMutating } = useRedeemAndBuy(
37
36
  {},
38
37
  {
39
- onError: () => console.log('error'),
38
+ onError: error => {
39
+ setError(error.message)
40
+ },
40
41
  }
41
42
  )
42
43
 
@@ -74,18 +75,16 @@ function RedeemableItem({
74
75
  ])
75
76
 
76
77
  const handleRedeem = () => {
77
- const buyNow = () =>
78
- trigger({
79
- productVariant: itemData?.productVariant,
80
- redeemId: itemData?.config?.redeemId,
81
- })
78
+ setError(null)
82
79
  if (!isLogin) {
83
80
  openSignUpPopup()
84
- } else if (!profile?.activated && !(authCodeActivate.isSendingActivateEmail || authCodeActivate.isSuccess)) {
81
+ } else if (!profile?.activated && !authCodeActivate.isSuccess) {
85
82
  authCodeActivate.openAuthCodePopup()
86
- authCodeActivate.setOnSuccess(buyNow)
87
83
  } else {
88
- buyNow()
84
+ trigger({
85
+ productVariant: itemData?.productVariant,
86
+ redeemId: itemData?.config?.redeemId,
87
+ })
89
88
  gaTrack({
90
89
  event: 'ga4Event',
91
90
  event_name: 'lp_button',
@@ -134,7 +133,7 @@ function RedeemableItem({
134
133
  html={itemData?.product?.title}
135
134
  title={itemData.config?.title || itemData.alpcData?.title || itemData.product?.title}
136
135
  size={2}
137
- className="line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:line-clamp-3 l:h-[56px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]"
136
+ className="line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:h-[40px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]"
138
137
  />
139
138
  {itemData?.config?.rules?.split('<br>')?.length > 0 && (
140
139
  <button
@@ -166,14 +165,14 @@ function RedeemableItem({
166
165
  )}
167
166
  <div className="mt-[24px] flex items-center l:mt-[12px] laptop:text-[16px] lg-desktop:text-[18px]">
168
167
  <Picture
169
- className="size-[20px]"
168
+ className="size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]"
170
169
  source="https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"
171
170
  />
172
171
  <Text
173
172
  html={`${numberFormat(itemData?.alpcData?.consumeCredits)} + ${itemData?.config?.price}`}
174
173
  size={2}
175
174
  as="p"
176
- className="ml-[4px] text-[28px] font-bold leading-[1.2] md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "
175
+ className="ml-[4px] mt-[4px] text-[28px] font-bold leading-none md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "
177
176
  />
178
177
  </div>
179
178
 
@@ -187,7 +186,7 @@ function RedeemableItem({
187
186
  onClick={() => {
188
187
  handleRedeem()
189
188
  }}
190
- title={inSufficientCredit ? 'Insufficient credit' : redeemButtonText}
189
+ title={inSufficientCredit ? copy.insufficientCredits : redeemButtonText}
191
190
  >
192
191
  {redeemButtonText}
193
192
  </Button>
@@ -204,6 +203,7 @@ function RedeemableItem({
204
203
  </div>
205
204
  </div>
206
205
  </div>
206
+ {error && <div className="mt-[8px] text-[14px] text-[#FF0000]">{error}</div>}
207
207
  </div>
208
208
  )
209
209
  }
@@ -5,7 +5,7 @@ import RedeemableItem from './RedeemableItem'
5
5
  import useRedeemableList from '../context/hooks/useRedeemableList'
6
6
  import { cn } from '../../../helpers'
7
7
  import RulesModal from '../modal/rulesModal'
8
- import { useProductsByHandles } from '@anker-in/lib'
8
+ import { useHeadlessContext, useProductsByHandles } from '@anker-in/lib'
9
9
  import { CreditsCashCopy, RedeemItem } from './type'
10
10
  import { Product } from '@anker-in/lib'
11
11
 
@@ -23,19 +23,14 @@ export const CreditsCash = ({
23
23
  authCodeActivate: {
24
24
  openAuthCodePopup: Function
25
25
  isSuccess: boolean
26
- setOnSuccess: (arg: Function) => void
27
- isSendingActivateEmail: boolean
28
26
  }
29
27
  }) => {
30
28
  const [rules, setRules] = useState<string | string[]>()
31
29
  const { redeemableList } = useRedeemableList()
32
30
 
33
- // Temporary variables until proper configuration
34
- const locale = 'us'
35
31
  const variantMetafieldIdentifiers: any[] = []
36
32
 
37
33
  const { data: productByHandles } = useProductsByHandles({
38
- locale,
39
34
  handles: copy?.list?.map(item => item.products?.[0]?.handle) || [],
40
35
  metafieldIdentifiers: {
41
36
  variant: variantMetafieldIdentifiers,
@@ -43,26 +38,29 @@ export const CreditsCash = ({
43
38
  })
44
39
 
45
40
  const list = useMemo(() => {
46
- return productByHandles?.map((product: Product) => {
47
- const config = copy.list.find(item => item.products?.[0]?.handle === product.handle)
48
- const alpcData = redeemableList.find(item => item.id?.toString() === config?.redeemId?.toString())
49
-
50
- return {
51
- product,
52
- productVariant:
53
- product.variants?.find((variant: any) => variant.sku === config?.products?.[0]?.sku) || product.variants?.[0],
54
- alpcData: {
55
- id: alpcData?.id,
56
- consumeCredits: alpcData?.consume_credits,
57
- remainingInventory: alpcData?.remaining_inventory,
58
- isLimited: alpcData?.is_limited,
59
- consumeType: alpcData?.consume_type,
60
- title: alpcData?.name,
61
- desc: alpcData?.note,
62
- },
63
- config,
64
- }
65
- }) as unknown as RedeemItem[]
41
+ return productByHandles
42
+ ?.map((product: Product) => {
43
+ const config = copy.list.find(item => item.products?.[0]?.handle === product.handle)
44
+ const alpcData = redeemableList.find(item => item.id?.toString() === config?.redeemId?.toString())
45
+ const productVariant =
46
+ product.variants?.find((variant: any) => variant.sku === config?.products?.[0]?.sku) || product.variants?.[0]
47
+ if (!alpcData || !productVariant) return null
48
+ return {
49
+ product,
50
+ productVariant,
51
+ alpcData: {
52
+ id: alpcData?.id,
53
+ consumeCredits: alpcData?.consume_credits,
54
+ remainingInventory: alpcData?.remaining_inventory,
55
+ isLimited: alpcData?.is_limited,
56
+ consumeType: alpcData?.consume_type,
57
+ title: alpcData?.name,
58
+ desc: alpcData?.note,
59
+ },
60
+ config,
61
+ }
62
+ })
63
+ .filter(Boolean) as unknown as RedeemItem[]
66
64
  }, [productByHandles, copy.list, redeemableList])
67
65
 
68
66
  console.log('list', list)
@@ -70,7 +68,7 @@ export const CreditsCash = ({
70
68
  return (
71
69
  <Container className={cn('bg-[#F5F5F5]', className)}>
72
70
  {!hideTitle && <Heading as="h2" size="4" html={copy.title} />}
73
- <div className="relative mt-[24px] grid grid-cols-4 gap-[16px] md:grid-cols-2 md-xl:grid-cols-3">
71
+ <div className="relative mt-[24px] grid grid-cols-4 gap-[16px] l:gap-[12px] md:grid-cols-2 md-xl:grid-cols-3">
74
72
  {list?.map((item, index: number) => (
75
73
  <RedeemableItem
76
74
  key={index}
@@ -76,7 +76,7 @@ export const CreditsFaq = ({ copy }: { copy: FaqCopy }) => {
76
76
  <a
77
77
  href={copy.learnMore?.link}
78
78
  target="_blank"
79
- className="mt-[64px] block w-full text-center text-[18px] font-bold text-brand hover:underline l:text-[16px]"
79
+ className="mt-[24px] block w-full text-center text-[18px] font-bold text-brand hover:underline l:text-[16px]"
80
80
  >
81
81
  {copy.learnMore?.label}
82
82
  </a>
@@ -58,7 +58,6 @@ export const AddressForm = ({ countries, countriesLoading, form, validate, error
58
58
  }
59
59
  }, [customer, profile?.email, locale])
60
60
 
61
- console.log('customer', customer)
62
61
  useEffect(() => {
63
62
  if (customer) {
64
63
  const defaultAddress = getDefaultAddress()
@@ -199,7 +199,7 @@ function RedeemCouponModal({
199
199
  </>
200
200
  )}
201
201
  {errorInfo && (
202
- <div className="mx-auto max-w-full py-[12px] text-center">
202
+ <div className="mx-auto max-w-full py-[12px] text-center text-[#FF0000]">
203
203
  <Text className="text-[14px] font-semibold text-[#1F2021]" html={errorInfo} />
204
204
  </div>
205
205
  )}
@@ -127,7 +127,6 @@ function RedeemProductModal({ item, copy, onError, ...props }: RedeemProductModa
127
127
  // 地址校验错误
128
128
  return
129
129
  }
130
- console.log('address', address)
131
130
  let requestAddress = { ...address }
132
131
  if (requestAddress.name) {
133
132
  delete requestAddress.name
@@ -105,7 +105,7 @@ export function RedeemableItem({
105
105
  html={item.config?.title || item.alpc?.title}
106
106
  title={item.config?.title || item.alpc?.title}
107
107
  size={2}
108
- className="text-[24px] font-bold leading-[1.2] l:text-[16px] l-xxl:text-[20px]"
108
+ className="line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:h-[40px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]"
109
109
  />
110
110
  {item.config?.rules?.length > 0 && (
111
111
  <button
@@ -136,16 +136,16 @@ export function RedeemableItem({
136
136
  </button>
137
137
  )}
138
138
  <div>
139
- <div className="mt-[24px] flex items-center l:mt-[12px] l-xl:mt-[16px]">
139
+ <div className="mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]">
140
140
  <Picture
141
- className="size-[20px]"
141
+ className="size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]"
142
142
  source="https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"
143
143
  />
144
144
  <Text
145
145
  html={`${numberFormat(item.alpc?.consumeCredits)}`}
146
146
  size={2}
147
147
  as="p"
148
- className="ml-[4px] text-[28px] font-bold leading-[1.2] md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "
148
+ className="ml-[4px] text-[28px] font-bold mt-[4px] leading-none md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "
149
149
  />
150
150
  </div>
151
151
 
@@ -30,7 +30,6 @@ export function CreditsRedeemList({
30
30
  activate: {
31
31
  openAuthCodePopup: () => void
32
32
  isSuccess: boolean
33
- setOnSuccess: (callback: Function) => void
34
33
  }
35
34
  }) {
36
35
  const {
@@ -139,9 +138,6 @@ export function CreditsRedeemList({
139
138
  openSignUpPopup()
140
139
  } else if (!profile?.activated && !activate.isSuccess) {
141
140
  activate.openAuthCodePopup()
142
- activate.setOnSuccess(() => {
143
- setPopRedeemData(item)
144
- })
145
141
  } else {
146
142
  setPopRedeemData(item)
147
143
  }
@@ -144,7 +144,6 @@ export const CreditsWaysToGetCredits = ({
144
144
  {...(item.link && { href: item.link })}
145
145
  {...(item.handleClick && { onClick: item.handleClick })}
146
146
  variant="primary"
147
- loading={item.id === TaskType.Activate && activate.isSendingActivateEmail}
148
147
  size="lg"
149
148
  className="mt-[24px] w-fit"
150
149
  >
@@ -159,7 +158,7 @@ export const CreditsWaysToGetCredits = ({
159
158
  ))}
160
159
  {!showMore && (
161
160
  <div
162
- className="absolute inset-0 min-md:hidden"
161
+ className="absolute inset-0 pointer-events-none min-md:hidden"
163
162
  style={{ background: 'linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%' }}
164
163
  ></div>
165
164
  )}
@@ -51,7 +51,6 @@ export type CreditsWaysToGetCreditsProps = {
51
51
  activate: {
52
52
  openAuthCodePopup: () => void
53
53
  isSuccess: boolean
54
- isSendingActivateEmail: boolean
55
54
  }
56
55
  subscribe: {
57
56
  openSubscribePopup: () => void
@@ -1,6 +0,0 @@
1
- import { RedeemableItem } from '../type';
2
- import { CreditsRedeemListCopy } from './type';
3
- export declare const CardValue: ({ item, copy }: {
4
- item: RedeemableItem;
5
- copy: CreditsRedeemListCopy;
6
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- "use strict";var i=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var a in t)i(e,a,{get:t[a],enumerable:!0})},c=(e,t,a,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of n(t))!s.call(e,o)&&o!==a&&i(e,o,{get:()=>t[o],enumerable:!(p=d(t,o))||p.enumerable});return e};var u=e=>c(i({},"__esModule",{value:!0}),e);var h={};f(h,{CardValue:()=>g});module.exports=u(h);var l=require("react/jsx-runtime"),x=require("@anker-in/headless-ui"),r=require("@anker-in/lib"),m=require("../context/const");const g=({item:e,copy:t})=>{switch(e.config?.type){case m.ConsumeType.Product:return(0,l.jsx)("div",{className:(0,r.classNames)("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:(0,l.jsx)(x.Picture,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product.images?.[0]?.url})});default:break}return e.config?.type===m.ConsumeType.ShippingCoupon?(0,l.jsx)(x.Text,{className:"text-[32px] font-bold leading-none md:text-[12px] l-xxl:text-[18px] md-l:text-[14px]",html:e.config?.value}):(0,l.jsxs)("div",{className:"flex items-end",children:[(0,l.jsx)(x.Text,{className:"text-[64px] font-extrabold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]",html:e.config?.value}),(0,l.jsx)(x.Text,{className:"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]",html:e.config?.type===m.ConsumeType.GiftCard?t?.giftCardLabel:t?.off})]})};
2
- //# sourceMappingURL=CardValue.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/components/credits/creditsRedeemList/CardValue.tsx"],
4
- "sourcesContent": ["import { Text, Picture } from '@anker-in/headless-ui'\nimport { classNames } from '@anker-in/lib'\nimport { RedeemableItem } from '../type'\nimport { ConsumeType } from '../context/const'\nimport { CreditsRedeemListCopy } from './type'\n\nexport const CardValue = ({ item, copy }: { item: RedeemableItem; copy: CreditsRedeemListCopy }) => {\n switch (item.config?.type) {\n case ConsumeType.Product:\n return (\n <div className={classNames('relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]')}>\n <Picture\n className=\"h-full w-auto [&_img]:h-full [&_img]:object-contain\"\n source={item.config?.image?.url || item.product.images?.[0]?.url}\n ></Picture>\n </div>\n )\n break\n\n default:\n break\n }\n if (item.config?.type === ConsumeType.ShippingCoupon) {\n return (\n <Text\n className=\"text-[32px] font-bold leading-none md:text-[12px] l-xxl:text-[18px] md-l:text-[14px]\"\n html={item.config?.value}\n />\n )\n } else {\n return (\n <div className=\"flex items-end\">\n <Text\n className=\"text-[64px] font-extrabold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]\"\n html={item.config?.value}\n />\n <Text\n className=\"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]\"\n html={item.config?.type === ConsumeType.GiftCard ? copy?.giftCardLabel : copy?.off}\n />\n </div>\n )\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GAWU,IAAAI,EAAA,6BAXVC,EAA8B,iCAC9BC,EAA2B,yBAE3BC,EAA4B,4BAGrB,MAAML,EAAY,CAAC,CAAE,KAAAM,EAAM,KAAAC,CAAK,IAA6D,CAClG,OAAQD,EAAK,QAAQ,KAAM,CACzB,KAAK,cAAY,QACf,SACE,OAAC,OAAI,aAAW,cAAW,2EAA2E,EACpG,mBAAC,WACC,UAAU,sDACV,OAAQA,EAAK,QAAQ,OAAO,KAAOA,EAAK,QAAQ,SAAS,CAAC,GAAG,IAC9D,EACH,EAIJ,QACE,KACJ,CACA,OAAIA,EAAK,QAAQ,OAAS,cAAY,kBAElC,OAAC,QACC,UAAU,uFACV,KAAMA,EAAK,QAAQ,MACrB,KAIA,QAAC,OAAI,UAAU,iBACb,oBAAC,QACC,UAAU,4FACV,KAAMA,EAAK,QAAQ,MACrB,KACA,OAAC,QACC,UAAU,2GACV,KAAMA,EAAK,QAAQ,OAAS,cAAY,SAAWC,GAAM,cAAgBA,GAAM,IACjF,GACF,CAGN",
6
- "names": ["CardValue_exports", "__export", "CardValue", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_lib", "import_const", "item", "copy"]
7
- }
@@ -1,6 +0,0 @@
1
- import { RedeemableItem } from '../type';
2
- import { CreditsRedeemListCopy } from './type';
3
- export declare const CardValue: ({ item, copy }: {
4
- item: RedeemableItem;
5
- copy: CreditsRedeemListCopy;
6
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- import{jsx as t,jsxs as i}from"react/jsx-runtime";import{Text as l,Picture as a}from"@anker-in/headless-ui";import{classNames as m}from"@anker-in/lib";import{ConsumeType as x}from"../context/const";const u=({item:e,copy:o})=>{switch(e.config?.type){case x.Product:return t("div",{className:m("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:t(a,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product.images?.[0]?.url})});default:break}return e.config?.type===x.ShippingCoupon?t(l,{className:"text-[32px] font-bold leading-none md:text-[12px] l-xxl:text-[18px] md-l:text-[14px]",html:e.config?.value}):i("div",{className:"flex items-end",children:[t(l,{className:"text-[64px] font-extrabold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]",html:e.config?.value}),t(l,{className:"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]",html:e.config?.type===x.GiftCard?o?.giftCardLabel:o?.off})]})};export{u as CardValue};
2
- //# sourceMappingURL=CardValue.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/components/credits/creditsRedeemList/CardValue.tsx"],
4
- "sourcesContent": ["import { Text, Picture } from '@anker-in/headless-ui'\nimport { classNames } from '@anker-in/lib'\nimport { RedeemableItem } from '../type'\nimport { ConsumeType } from '../context/const'\nimport { CreditsRedeemListCopy } from './type'\n\nexport const CardValue = ({ item, copy }: { item: RedeemableItem; copy: CreditsRedeemListCopy }) => {\n switch (item.config?.type) {\n case ConsumeType.Product:\n return (\n <div className={classNames('relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]')}>\n <Picture\n className=\"h-full w-auto [&_img]:h-full [&_img]:object-contain\"\n source={item.config?.image?.url || item.product.images?.[0]?.url}\n ></Picture>\n </div>\n )\n break\n\n default:\n break\n }\n if (item.config?.type === ConsumeType.ShippingCoupon) {\n return (\n <Text\n className=\"text-[32px] font-bold leading-none md:text-[12px] l-xxl:text-[18px] md-l:text-[14px]\"\n html={item.config?.value}\n />\n )\n } else {\n return (\n <div className=\"flex items-end\">\n <Text\n className=\"text-[64px] font-extrabold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]\"\n html={item.config?.value}\n />\n <Text\n className=\"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]\"\n html={item.config?.type === ConsumeType.GiftCard ? copy?.giftCardLabel : copy?.off}\n />\n </div>\n )\n }\n}\n"],
5
- "mappings": "AAWU,cAAAA,EAoBJ,QAAAC,MApBI,oBAXV,OAAS,QAAAC,EAAM,WAAAC,MAAe,wBAC9B,OAAS,cAAAC,MAAkB,gBAE3B,OAAS,eAAAC,MAAmB,mBAGrB,MAAMC,EAAY,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAA6D,CAClG,OAAQD,EAAK,QAAQ,KAAM,CACzB,KAAKF,EAAY,QACf,OACEL,EAAC,OAAI,UAAWI,EAAW,2EAA2E,EACpG,SAAAJ,EAACG,EAAA,CACC,UAAU,sDACV,OAAQI,EAAK,QAAQ,OAAO,KAAOA,EAAK,QAAQ,SAAS,CAAC,GAAG,IAC9D,EACH,EAIJ,QACE,KACJ,CACA,OAAIA,EAAK,QAAQ,OAASF,EAAY,eAElCL,EAACE,EAAA,CACC,UAAU,uFACV,KAAMK,EAAK,QAAQ,MACrB,EAIAN,EAAC,OAAI,UAAU,iBACb,UAAAD,EAACE,EAAA,CACC,UAAU,4FACV,KAAMK,EAAK,QAAQ,MACrB,EACAP,EAACE,EAAA,CACC,UAAU,2GACV,KAAMK,EAAK,QAAQ,OAASF,EAAY,SAAWG,GAAM,cAAgBA,GAAM,IACjF,GACF,CAGN",
6
- "names": ["jsx", "jsxs", "Text", "Picture", "classNames", "ConsumeType", "CardValue", "item", "copy"]
7
- }