@anker-in/campaign-ui 0.2.0-beta.1 → 0.2.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/credits/context/provider.d.ts +2 -2
- package/dist/cjs/components/credits/context/provider.js +1 -1
- package/dist/cjs/components/credits/context/provider.js.map +3 -3
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +1 -1
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +3 -3
- package/dist/cjs/components/credits/creditsBenefits/index.js +3 -3
- package/dist/cjs/components/credits/creditsBenefits/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +3 -3
- package/dist/cjs/components/credits/creditsFaq/index.js +1 -1
- package/dist/cjs/components/credits/creditsFaq/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +0 -2
- package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
- package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js.map +2 -2
- package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
- package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +2 -2
- package/dist/cjs/components/credits/modal/activitiesModal.js +1 -1
- package/dist/cjs/components/credits/modal/activitiesModal.js.map +2 -2
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +1 -1
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
- package/dist/cjs/components/credits/modal/modalContainer.js +1 -1
- package/dist/cjs/components/credits/modal/modalContainer.js.map +3 -3
- package/dist/cjs/components/credits/modal/subscribeModal.js +1 -1
- package/dist/cjs/components/credits/modal/subscribeModal.js.map +3 -3
- package/dist/cjs/components/credits/modal/tip.js +1 -1
- package/dist/cjs/components/credits/modal/tip.js.map +3 -3
- package/dist/cjs/components/credits/type.d.ts +3 -2
- package/dist/cjs/components/credits/type.js +1 -1
- package/dist/cjs/components/credits/type.js.map +1 -1
- package/dist/cjs/components/registration/authCodeActivate/Message.js +1 -1
- package/dist/cjs/components/registration/authCodeActivate/Message.js.map +2 -2
- package/dist/cjs/components/registration/authCodeActivate/index.js +1 -1
- package/dist/cjs/components/registration/authCodeActivate/index.js.map +3 -3
- package/dist/cjs/components/registration/authCodeActivate/type.d.ts +0 -1
- package/dist/cjs/components/registration/authCodeActivate/type.js.map +1 -1
- package/dist/cjs/components/registration/context/provider.d.ts +2 -0
- package/dist/cjs/components/registration/context/provider.js +1 -1
- package/dist/cjs/components/registration/context/provider.js.map +3 -3
- package/dist/cjs/components/registration/modalContainer.d.ts +1 -2
- package/dist/cjs/components/registration/modalContainer.js +1 -1
- package/dist/cjs/components/registration/modalContainer.js.map +3 -3
- package/dist/cjs/templates/credits.d.ts +9 -8
- package/dist/cjs/templates/credits.js +1 -1
- package/dist/cjs/templates/credits.js.map +3 -3
- package/dist/esm/components/credits/context/provider.d.ts +2 -2
- package/dist/esm/components/credits/context/provider.js +1 -1
- package/dist/esm/components/credits/context/provider.js.map +3 -3
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js +1 -1
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +3 -3
- package/dist/esm/components/credits/creditsBenefits/index.js +3 -3
- package/dist/esm/components/credits/creditsBenefits/index.js.map +3 -3
- package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +3 -3
- package/dist/esm/components/credits/creditsFaq/index.js +1 -1
- package/dist/esm/components/credits/creditsFaq/index.js.map +3 -3
- package/dist/esm/components/credits/creditsInfoCard/index.d.ts +0 -2
- package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
- package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +3 -3
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +2 -2
- package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
- package/dist/esm/components/credits/modal/MyRewardsModal.js.map +3 -3
- package/dist/esm/components/credits/modal/activitiesModal.js +1 -1
- package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +1 -1
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
- package/dist/esm/components/credits/modal/modalContainer.js +1 -1
- package/dist/esm/components/credits/modal/modalContainer.js.map +3 -3
- package/dist/esm/components/credits/modal/subscribeModal.js +1 -1
- package/dist/esm/components/credits/modal/subscribeModal.js.map +3 -3
- package/dist/esm/components/credits/modal/tip.js +1 -1
- package/dist/esm/components/credits/modal/tip.js.map +3 -3
- package/dist/esm/components/credits/type.d.ts +3 -2
- package/dist/esm/components/registration/authCodeActivate/Message.js +1 -1
- package/dist/esm/components/registration/authCodeActivate/Message.js.map +2 -2
- package/dist/esm/components/registration/authCodeActivate/index.js +1 -1
- package/dist/esm/components/registration/authCodeActivate/index.js.map +3 -3
- package/dist/esm/components/registration/authCodeActivate/type.d.ts +0 -1
- package/dist/esm/components/registration/context/provider.d.ts +2 -0
- package/dist/esm/components/registration/context/provider.js +1 -1
- package/dist/esm/components/registration/context/provider.js.map +3 -3
- package/dist/esm/components/registration/modalContainer.d.ts +1 -2
- package/dist/esm/components/registration/modalContainer.js +1 -1
- package/dist/esm/components/registration/modalContainer.js.map +3 -3
- package/dist/esm/templates/credits.d.ts +9 -8
- package/dist/esm/templates/credits.js +1 -1
- package/dist/esm/templates/credits.js.map +3 -3
- package/package.json +3 -3
- package/src/components/credits/context/provider.tsx +1 -4
- package/src/components/credits/creditsBenefits/benefitItem.tsx +2 -5
- package/src/components/credits/creditsBenefits/index.tsx +1 -4
- package/src/components/credits/creditsCash/CreditsCash.tsx +3 -6
- package/src/components/credits/creditsFaq/index.tsx +2 -3
- package/src/components/credits/creditsInfoCard/index.tsx +10 -12
- package/src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx +3 -4
- package/src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx +2 -3
- package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +2 -3
- package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +2 -4
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +2 -3
- package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +6 -4
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +2 -3
- package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +2 -3
- package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +5 -3
- package/src/components/credits/creditsWaysToGetCredits/useActions.ts +4 -1
- package/src/components/credits/modal/MyRewardsModal.tsx +2 -3
- package/src/components/credits/modal/activitiesModal.tsx +2 -3
- package/src/components/credits/modal/creditsUploadReceiptModal.tsx +2 -3
- package/src/components/credits/modal/modalContainer.tsx +2 -3
- package/src/components/credits/modal/subscribeModal.tsx +9 -32
- package/src/components/credits/modal/tip.tsx +2 -3
- package/src/components/credits/type.ts +3 -2
- package/src/components/registration/authCodeActivate/Message.tsx +1 -1
- package/src/components/registration/authCodeActivate/index.tsx +141 -109
- package/src/components/registration/authCodeActivate/type.ts +0 -1
- package/src/components/registration/context/provider.tsx +9 -0
- package/src/components/registration/modalContainer.tsx +9 -7
- package/src/templates/credits.tsx +41 -31
- package/src/components/credits/const.ts +0 -1
|
@@ -2,8 +2,7 @@ import { Picture } from '@anker-in/headless-ui'
|
|
|
2
2
|
import useClickOutside from '../../context/hooks/useClickOutside'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
import { useEffect, useState } from 'react'
|
|
5
|
-
import {
|
|
6
|
-
import { useHeadlessContext } from '@anker-in/lib'
|
|
5
|
+
import { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
7
6
|
|
|
8
7
|
interface Country {
|
|
9
8
|
id: string
|
|
@@ -23,7 +22,7 @@ export function CountrySelect({ countries, loading, className, value, onChange }
|
|
|
23
22
|
const [show, setShow] = useState(false)
|
|
24
23
|
const [display, setDisplay] = useState<any>('')
|
|
25
24
|
const { brand } = useHeadlessContext()
|
|
26
|
-
const rounded =
|
|
25
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
27
26
|
const dorpdown = useClickOutside<HTMLDivElement>(() => {
|
|
28
27
|
setShow(false)
|
|
29
28
|
})
|
|
@@ -75,7 +74,7 @@ export function CountrySelect({ countries, loading, className, value, onChange }
|
|
|
75
74
|
|
|
76
75
|
<Picture
|
|
77
76
|
source="https://cdn.shopify.com/s/files/1/0517/6767/3016/files/country-select.png?v=1692202500"
|
|
78
|
-
|
|
77
|
+
className="absolute pointer-events-none right-0 top-0 bottom-0 size-[50px] object-cover"
|
|
79
78
|
alt="arrow"
|
|
80
79
|
/>
|
|
81
80
|
|
|
@@ -2,8 +2,7 @@ import classNames from 'classnames'
|
|
|
2
2
|
import { Picture } from '@anker-in/headless-ui'
|
|
3
3
|
import { useEffect, useMemo, useState } from 'react'
|
|
4
4
|
import useClickOutside from '../../context/hooks/useClickOutside'
|
|
5
|
-
import { useHeadlessContext } from '@anker-in/lib'
|
|
6
|
-
import { roundedBrands } from '../../const'
|
|
5
|
+
import { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
7
6
|
|
|
8
7
|
interface StateSelectProps {
|
|
9
8
|
states: { code: string; id: string; name: string }[]
|
|
@@ -19,7 +18,7 @@ export function StateSelect({ states, stateName = '', stateCode = '', className
|
|
|
19
18
|
const [show, setShow] = useState(false)
|
|
20
19
|
const [display, setDisplay] = useState<any>('')
|
|
21
20
|
const { brand } = useHeadlessContext()
|
|
22
|
-
const rounded =
|
|
21
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
23
22
|
|
|
24
23
|
const dropdown = useClickOutside<HTMLDivElement>(() => {
|
|
25
24
|
setShow(false)
|
|
@@ -7,14 +7,13 @@ import { Input } from './Input'
|
|
|
7
7
|
import { StateSelect } from './StateSelect'
|
|
8
8
|
import { ALPC_COUNTRY_MAP } from '../../context/const'
|
|
9
9
|
import { useCreditsContext } from '../../context/provider'
|
|
10
|
-
import { useHeadlessContext } from '@anker-in/lib'
|
|
10
|
+
import { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
11
11
|
import { AddressFormProps } from './type'
|
|
12
|
-
import { roundedBrands } from '../../const'
|
|
13
12
|
|
|
14
13
|
export const AddressForm = ({ countries, countriesLoading, form, validate, errors, onChange }: AddressFormProps) => {
|
|
15
14
|
const { profile, customer } = useCreditsContext()
|
|
16
15
|
const { locale, brand } = useHeadlessContext()
|
|
17
|
-
const rounded =
|
|
16
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
18
17
|
const [address, setAddress] = useState<Record<string, any>>()
|
|
19
18
|
|
|
20
19
|
const states = useMemo(() => {
|
|
@@ -7,14 +7,12 @@ import RedeemProductModal from './RedeemProductModal'
|
|
|
7
7
|
import { useCreditsContext } from '../context/provider'
|
|
8
8
|
import useRedeemableList from '../context/hooks/useRedeemableList'
|
|
9
9
|
import { AlpcConsumeType, AlpcErrorCode } from '../context/const'
|
|
10
|
-
import { useHeadlessContext, useProductsByHandles } from '@anker-in/lib'
|
|
10
|
+
import { useHeadlessContext, useProductsByHandles, gaTrack, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
11
11
|
import type { RedeemableItem as RedeemableItemType } from '../type'
|
|
12
12
|
import { RedeemableItem } from './RedeemableItem'
|
|
13
13
|
import RulesModal from '../modal/rulesModal'
|
|
14
14
|
import { CreditsRedeemListCopy } from './type'
|
|
15
|
-
import { gaTrack } from '@anker-in/lib'
|
|
16
15
|
import { useRegistration } from '../../../components/registration'
|
|
17
|
-
import { roundedBrands } from '../const'
|
|
18
16
|
|
|
19
17
|
export const CreditsRedeemList = ({ copy }: { copy: CreditsRedeemListCopy }) => {
|
|
20
18
|
const {
|
|
@@ -25,7 +23,7 @@ export const CreditsRedeemList = ({ copy }: { copy: CreditsRedeemListCopy }) =>
|
|
|
25
23
|
} = useCreditsContext()
|
|
26
24
|
const { authCodeActivate } = useRegistration()
|
|
27
25
|
const { brand } = useHeadlessContext()
|
|
28
|
-
const rounded =
|
|
26
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
29
27
|
|
|
30
28
|
const isLogin = Object.keys(profile || {}).length > 0
|
|
31
29
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Button, Text } from '@anker-in/headless-ui'
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { AddressForm } from '../AddressForm'
|
|
4
|
-
import { useHeadlessContext } from '@anker-in/lib'
|
|
4
|
+
import { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
5
5
|
import type { RedeemableItem as RedeemableItemType } from '../../type'
|
|
6
6
|
import { CreditsRedeemListCopy } from '../type'
|
|
7
7
|
import { ProductInfo } from './ProductInfo'
|
|
8
8
|
import useCountries from '../../context/hooks/useCountries'
|
|
9
|
-
import { roundedBrands } from '../../const'
|
|
10
9
|
|
|
11
10
|
type AddressProps = {
|
|
12
11
|
copy: CreditsRedeemListCopy
|
|
@@ -36,7 +35,7 @@ export const Address = ({
|
|
|
36
35
|
item,
|
|
37
36
|
}: AddressProps) => {
|
|
38
37
|
const { storeDomain, brand } = useHeadlessContext()
|
|
39
|
-
const rounded =
|
|
38
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
40
39
|
const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })
|
|
41
40
|
|
|
42
41
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Picture } from '@anker-in/headless-ui'
|
|
1
|
+
import { Picture, Text } from '@anker-in/headless-ui'
|
|
2
2
|
import { formatPrice } from '../../context/utils'
|
|
3
3
|
import type { RedeemableItem as RedeemableItemType } from '../../type'
|
|
4
4
|
import { CreditsRedeemListCopy } from '../type'
|
|
@@ -34,9 +34,11 @@ export const ProductInfo = ({ item, copy }: ProductInfoProps) => {
|
|
|
34
34
|
</div>
|
|
35
35
|
|
|
36
36
|
<div className="mt-[16px] md:mt-[12px]">
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
<Text
|
|
38
|
+
className="mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden"
|
|
39
|
+
html={item.product.title}
|
|
40
|
+
title={item.product.title}
|
|
41
|
+
></Text>
|
|
40
42
|
<div className="flex font-semibold leading-[1.4] md:flex-col">
|
|
41
43
|
<div className="mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]">
|
|
42
44
|
<div className="mb-[8px] flex items-center md:mb-[4px]">
|
|
@@ -3,8 +3,7 @@ import classNames from 'classnames'
|
|
|
3
3
|
import type { RedeemableItem as RedeemableItemType } from '../../type'
|
|
4
4
|
import { CreditsRedeemListCopy } from '../type'
|
|
5
5
|
import { ProductInfo } from './ProductInfo'
|
|
6
|
-
import { useHeadlessContext } from '@anker-in/lib'
|
|
7
|
-
import { roundedBrands } from '../../const'
|
|
6
|
+
import { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
8
7
|
|
|
9
8
|
type SuccessProps = {
|
|
10
9
|
copy: CreditsRedeemListCopy
|
|
@@ -18,7 +17,7 @@ type SuccessProps = {
|
|
|
18
17
|
|
|
19
18
|
export const Success = ({ copy, shippingProduct, loading, address, disabled, onClose, item }: SuccessProps) => {
|
|
20
19
|
const { brand } = useHeadlessContext()
|
|
21
|
-
const rounded =
|
|
20
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
22
21
|
return (
|
|
23
22
|
<div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>
|
|
24
23
|
<div className="flex flex-col items-center">
|
|
@@ -8,9 +8,8 @@ import type { RedeemableItem as RedeemableItemType } from '../type'
|
|
|
8
8
|
import { AlpcConsumeType, ConsumeType } from '../context/const'
|
|
9
9
|
import { numberFormat } from '../context/utils'
|
|
10
10
|
import type { CreditsRedeemListCopy } from './type'
|
|
11
|
-
import { gaTrack, useHeadlessContext } from '@anker-in/lib'
|
|
11
|
+
import { gaTrack, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
12
12
|
import { NoneProductValue } from './NonProductValue'
|
|
13
|
-
import { roundedBrands } from '../const'
|
|
14
13
|
|
|
15
14
|
export function RedeemableItem({
|
|
16
15
|
copy,
|
|
@@ -33,7 +32,7 @@ export function RedeemableItem({
|
|
|
33
32
|
} = useCreditsContext()
|
|
34
33
|
const { brand } = useHeadlessContext()
|
|
35
34
|
const isLogin = Object.keys(profile || {}).length > 0
|
|
36
|
-
const rounded =
|
|
35
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
37
36
|
|
|
38
37
|
const isDisabled = useMemo(() => {
|
|
39
38
|
if (item.alpc?.remainingInventory <= 0 && item.alpc?.isLimited) {
|
|
@@ -6,18 +6,17 @@ import { useMemo, useState } from 'react'
|
|
|
6
6
|
import { TaskType, type CreditsWaysToGetCreditsProps } from './type'
|
|
7
7
|
import { useActions } from './useActions'
|
|
8
8
|
import { useCreditsContext } from '../context/provider'
|
|
9
|
-
import { classNames as cn, useHeadlessContext } from '@anker-in/lib'
|
|
9
|
+
import { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
10
10
|
import { useRegistration } from '../../registration'
|
|
11
11
|
import { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'
|
|
12
12
|
import { CreditsSubscribeModal } from '../modal/subscribeModal'
|
|
13
|
-
import { roundedBrands } from '../const'
|
|
14
13
|
|
|
15
14
|
export const CreditsWaysToGetCredits = ({ copy, classNames }: CreditsWaysToGetCreditsProps) => {
|
|
16
15
|
const [showMore, setShowMore] = useState(false)
|
|
17
16
|
const { profile } = useCreditsContext()
|
|
18
17
|
const { authCodeActivate } = useRegistration()
|
|
19
18
|
const { brand } = useHeadlessContext()
|
|
20
|
-
const rounded =
|
|
19
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
21
20
|
const isLogin = !!profile
|
|
22
21
|
|
|
23
22
|
const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)
|
|
@@ -223,6 +222,9 @@ export const CreditsWaysToGetCredits = ({ copy, classNames }: CreditsWaysToGetCr
|
|
|
223
222
|
copy={copy.subscribe}
|
|
224
223
|
onSuccess={() => {
|
|
225
224
|
setIsSubscribeSuccess(true)
|
|
225
|
+
setTimeout(() => {
|
|
226
|
+
setIsSubscribeModalOpen(false)
|
|
227
|
+
}, 3000)
|
|
226
228
|
}}
|
|
227
229
|
isOpen={isSubscribeModalOpen}
|
|
228
230
|
onClose={() => {
|
|
@@ -77,7 +77,10 @@ export const useActions = ({
|
|
|
77
77
|
handleClick: () =>
|
|
78
78
|
handleClickWithTrack({
|
|
79
79
|
buttonName: copy?.activate,
|
|
80
|
-
callback: () =>
|
|
80
|
+
callback: () => {
|
|
81
|
+
authCodeActivate.setAutoSendEmail(true)
|
|
82
|
+
authCodeActivate.open()
|
|
83
|
+
},
|
|
81
84
|
id: TaskType.Activate,
|
|
82
85
|
}),
|
|
83
86
|
},
|
|
@@ -9,8 +9,7 @@ import { CreditsModalContainer, type ModalContainerProps } from './modalContaine
|
|
|
9
9
|
import Tip from './tip'
|
|
10
10
|
import LoadingDots from './loadingDots'
|
|
11
11
|
import useMyRewards from '../context/hooks/useMyRewards'
|
|
12
|
-
import { useHeadlessContext } from '@anker-in/lib'
|
|
13
|
-
import { roundedBrands } from '../const'
|
|
12
|
+
import { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
14
13
|
|
|
15
14
|
export interface MyRewardsMetafields {
|
|
16
15
|
title: string
|
|
@@ -45,7 +44,7 @@ interface MyRewardsModalProps extends ModalContainerProps {
|
|
|
45
44
|
function MyRewardsModal({ data, ...props }: MyRewardsModalProps) {
|
|
46
45
|
const [activeTab, setActiveTab] = useState(AlpcConsumeType.Coupon)
|
|
47
46
|
const { brand } = useHeadlessContext()
|
|
48
|
-
const rounded =
|
|
47
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
49
48
|
|
|
50
49
|
const [couponPage, setCouponPage] = useState(1)
|
|
51
50
|
const [productPage, setProductPage] = useState(1)
|
|
@@ -4,12 +4,11 @@ import { CreditType, DTC_TASK_TYPE, TaskSubType, TaskType } from '../context/con
|
|
|
4
4
|
import useActivities from '../context/hooks/useActivities'
|
|
5
5
|
import type { Task } from '../context/response'
|
|
6
6
|
import { CreditsModalContainer, type ModalContainerProps } from './modalContainer'
|
|
7
|
-
import { classNames as cn, useHeadlessContext } from '@anker-in/lib'
|
|
7
|
+
import { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
8
8
|
import { Tabs, TabsList, TabsTrigger } from '@anker-in/headless-ui'
|
|
9
9
|
import LoadingDots from './loadingDots'
|
|
10
10
|
import { Picture, Text } from '@anker-in/headless-ui'
|
|
11
11
|
import dayjs from 'dayjs'
|
|
12
|
-
import { roundedBrands } from '../const'
|
|
13
12
|
|
|
14
13
|
export interface MyActivitiesMetafields {
|
|
15
14
|
title: string
|
|
@@ -46,7 +45,7 @@ function ActivitiesModal({ data, ...props }: ActivitiesModalProps) {
|
|
|
46
45
|
const [page, setPage] = useState(1)
|
|
47
46
|
const { taskIdToTypeMapping } = useCreditsContext()
|
|
48
47
|
const { brand } = useHeadlessContext()
|
|
49
|
-
const rounded =
|
|
48
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
50
49
|
|
|
51
50
|
const myActivitiesOptions = useMemo(() => {
|
|
52
51
|
return {
|
|
@@ -2,8 +2,7 @@ import { Button, Heading, Text } from '@anker-in/headless-ui'
|
|
|
2
2
|
import { useCallback, useState } from 'react'
|
|
3
3
|
import { CreditsModalContainer } from './modalContainer'
|
|
4
4
|
import { useUploadReceipt } from '../context/hooks/useUploadReceipt'
|
|
5
|
-
import { useHeadlessContext } from '@anker-in/lib'
|
|
6
|
-
import { roundedBrands } from '../const'
|
|
5
|
+
import { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
7
6
|
import classNames from 'classnames'
|
|
8
7
|
|
|
9
8
|
export type ReceiptCopy = {
|
|
@@ -47,7 +46,7 @@ export function CreditsUploadReceiptModal({
|
|
|
47
46
|
})
|
|
48
47
|
|
|
49
48
|
const { brand } = useHeadlessContext()
|
|
50
|
-
const rounded =
|
|
49
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
51
50
|
|
|
52
51
|
const handleSubmit = useCallback(() => {
|
|
53
52
|
trigger(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { classNames as cn, useHeadlessContext } from '@anker-in/lib'
|
|
1
|
+
import { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
2
2
|
import { useEffect, useState, type UIEvent } from 'react'
|
|
3
3
|
import ReactModal from 'react-modal'
|
|
4
|
-
import { roundedBrands } from '../const'
|
|
5
4
|
|
|
6
5
|
export type ModalContainerProps = {
|
|
7
6
|
overlayClassName?: string
|
|
@@ -43,7 +42,7 @@ export const CreditsModalContainer = ({
|
|
|
43
42
|
}, [isOpen, useAnimation])
|
|
44
43
|
|
|
45
44
|
const { brand } = useHeadlessContext()
|
|
46
|
-
const rounded =
|
|
45
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
47
46
|
|
|
48
47
|
return (
|
|
49
48
|
<ReactModal
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react'
|
|
2
2
|
import { useRouter } from 'next/router'
|
|
3
|
-
import { Button, Picture, Text } from '@anker-in/headless-ui'
|
|
4
|
-
import { classNames, fetcher, gaTrack, useHeadlessContext } from '@anker-in/lib'
|
|
3
|
+
import { Button, Checkbox, Picture, Text } from '@anker-in/headless-ui'
|
|
4
|
+
import { classNames, fetcher, gaTrack, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
5
5
|
import Cookies from 'js-cookie'
|
|
6
6
|
import { parse } from 'query-string'
|
|
7
7
|
import sha256 from 'crypto-js/sha256'
|
|
8
8
|
import { useCreditsContext } from '../context/provider'
|
|
9
9
|
import { emailValidate } from '../context/utils'
|
|
10
10
|
import { CreditsModalContainer, type ModalContainerProps } from './modalContainer'
|
|
11
|
-
import { roundedBrands } from '../const'
|
|
12
11
|
|
|
13
12
|
export type CreditsSubscribeModalCopy = {
|
|
14
13
|
title: string
|
|
@@ -44,7 +43,7 @@ const getAdCookie = () => {
|
|
|
44
43
|
|
|
45
44
|
export function CreditsSubscribeModal({ copy, onSuccess, ...props }: CreditsSubscribeModalProps) {
|
|
46
45
|
const { brand } = useHeadlessContext()
|
|
47
|
-
const rounded =
|
|
46
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
48
47
|
const { locale } = useRouter()
|
|
49
48
|
const [policy, setPolicy] = useState(false)
|
|
50
49
|
const [email, setEmail] = useState('')
|
|
@@ -93,10 +92,12 @@ export function CreditsSubscribeModal({ copy, onSuccess, ...props }: CreditsSubs
|
|
|
93
92
|
|
|
94
93
|
if (!result.errors) {
|
|
95
94
|
setSuccessMessage(copy.successTips || 'Subscribed successfully!')
|
|
96
|
-
|
|
95
|
+
if (onSuccess) {
|
|
96
|
+
onSuccess()
|
|
97
|
+
}
|
|
97
98
|
setTimeout(() => {
|
|
98
99
|
setSuccessMessage('')
|
|
99
|
-
},
|
|
100
|
+
}, 3000)
|
|
100
101
|
gaTrack({
|
|
101
102
|
subscribe_hashed_email: email ? sha256(email) : '',
|
|
102
103
|
})
|
|
@@ -177,33 +178,9 @@ export function CreditsSubscribeModal({ copy, onSuccess, ...props }: CreditsSubs
|
|
|
177
178
|
</Button>
|
|
178
179
|
</div>
|
|
179
180
|
<div className="flex w-full">
|
|
180
|
-
<
|
|
181
|
-
className="group relative mr-6 cursor-pointer"
|
|
182
|
-
onClick={() => setPolicy(!policy)}
|
|
183
|
-
onKeyDown={e => {
|
|
184
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
185
|
-
e.preventDefault()
|
|
186
|
-
setPolicy(!policy)
|
|
187
|
-
}
|
|
188
|
-
}}
|
|
189
|
-
role="button"
|
|
190
|
-
tabIndex={0}
|
|
191
|
-
>
|
|
192
|
-
<input
|
|
193
|
-
type="checkbox"
|
|
194
|
-
readOnly
|
|
195
|
-
checked={policy}
|
|
196
|
-
className="peer absolute left-0 top-0 h-4 w-4 cursor-pointer opacity-0"
|
|
197
|
-
/>
|
|
198
|
-
<label
|
|
199
|
-
className={classNames(
|
|
200
|
-
'absolute left-[30px] top-0 h-5 cursor-pointer leading-5 before:absolute before:left-[-30px] before:top-0 before:h-4 before:w-4 before:rounded-[2px] before:border before:border-[#aaa] before:content-[""] after:absolute after:left-[-25px] after:top-[1px] after:h-[10px] after:w-[6px] after:rotate-45 after:border-0 after:content-[""] group-hover:before:border-[#17bbef] peer-checked:before:border-[#17bbef] peer-checked:before:bg-[#17bbef] peer-checked:after:border-b-2 peer-checked:after:border-r-2 peer-checked:after:border-white peer-checked:after:bg-[#17bbef]',
|
|
201
|
-
!rounded && 'rounded-none'
|
|
202
|
-
)}
|
|
203
|
-
/>
|
|
204
|
-
</div>
|
|
181
|
+
<Checkbox checked={policy} onCheckedChange={() => setPolicy(!policy)} required className="border-[#1d1d1f]" />
|
|
205
182
|
<label
|
|
206
|
-
className="text-left text-[14px] font-semibold text-[#777] [&_a]:underline"
|
|
183
|
+
className="text-left ml-2 text-[14px] font-semibold text-[#777] [&_a]:underline"
|
|
207
184
|
dangerouslySetInnerHTML={{
|
|
208
185
|
__html: copy?.policy || '',
|
|
209
186
|
}}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { useHeadlessContext } from '@anker-in/lib'
|
|
1
|
+
import { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { useState } from 'react'
|
|
4
|
-
import { roundedBrands } from '../const'
|
|
5
4
|
|
|
6
5
|
function Tip({ info, index }: { info: string; index: number }) {
|
|
7
6
|
const [show, setShow] = useState(false)
|
|
8
7
|
|
|
9
8
|
const { brand } = useHeadlessContext()
|
|
10
|
-
const rounded =
|
|
9
|
+
const rounded = ROUNDED_BRANDS.includes(brand)
|
|
11
10
|
|
|
12
11
|
return (
|
|
13
12
|
<div
|
|
@@ -52,6 +52,7 @@ export interface ShippingZone {
|
|
|
52
52
|
|
|
53
53
|
export type CreditsPageCommon = {
|
|
54
54
|
pointUnit?: string
|
|
55
|
+
infoIcon?: string
|
|
55
56
|
ruleLabel?: string
|
|
56
57
|
soldOut?: string
|
|
57
58
|
copied?: string
|
|
@@ -63,8 +64,8 @@ export type CreditsPageCommon = {
|
|
|
63
64
|
url: string
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
activitiesModal?: MyActivitiesMetafields
|
|
68
|
+
rewardsModal?: MyRewardsMetafields
|
|
68
69
|
validatorInfo?: {
|
|
69
70
|
addressInfo: {
|
|
70
71
|
name: string
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const Message = ({ status, message }: { status: string; message: string }) => {
|
|
2
2
|
return (
|
|
3
3
|
status && (
|
|
4
|
-
<div className="absolute left-5 right-5 top-
|
|
4
|
+
<div className="absolute left-5 right-5 top-2 flex items-center gap-2 rounded-sm bg-white px-4 py-3 shadow-lg min-md:left-12 min-md:right-12">
|
|
5
5
|
<div className="flex-shrink-0">
|
|
6
6
|
{status === 'success' && (
|
|
7
7
|
<span className="inline-block h-5 w-5">
|