@anker-in/campaign-ui 0.2.10-beta.20 → 0.2.10-beta.21

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 (30) hide show
  1. package/dist/index.d.mts +3 -3
  2. package/dist/index.d.ts +3 -3
  3. package/dist/index.js +79 -91
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +126 -138
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +9 -9
  8. package/src/components/credits/context/hooks/useActivities.ts +1 -1
  9. package/src/components/credits/context/hooks/useAddressValidate.ts +1 -1
  10. package/src/components/credits/context/hooks/useAlpcFetch.ts +1 -1
  11. package/src/components/credits/context/hooks/useCountries.ts +1 -1
  12. package/src/components/credits/context/hooks/useMyRewards.ts +1 -1
  13. package/src/components/credits/context/hooks/useRedeemAndBuy.ts +2 -2
  14. package/src/components/credits/context/hooks/useRedeemCoupon.ts +1 -1
  15. package/src/components/credits/context/hooks/useRedeemProduct.ts +1 -1
  16. package/src/components/credits/context/hooks/useRedeemableList.ts +1 -1
  17. package/src/components/credits/context/hooks/useSendEmailValidation.ts +1 -1
  18. package/src/components/credits/context/hooks/useSubscribed.ts +1 -1
  19. package/src/components/credits/context/hooks/useSubscriptions.ts +1 -1
  20. package/src/components/credits/creditsCash/index.tsx +2 -2
  21. package/src/components/credits/creditsCash/type.ts +1 -1
  22. package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +1 -1
  23. package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +1 -1
  24. package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +1 -1
  25. package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +1 -1
  26. package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +1 -1
  27. package/src/components/credits/creditsRedeemList/index.tsx +1 -1
  28. package/src/components/credits/creditsWaysToGetCredits/useActions.ts +1 -1
  29. package/src/components/credits/type.ts +1 -1
  30. package/src/index.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anker-in/campaign-ui",
3
- "version": "0.2.10-beta.20",
3
+ "version": "0.2.10-beta.21",
4
4
  "description": "Campaign UI components and utilities for Anker projects",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -46,6 +46,8 @@
46
46
  "@testing-library/react": "^14.3.1",
47
47
  "@types/jest": "^29.5.12",
48
48
  "@types/node": "^20",
49
+ "@types/react": "^18.3.3",
50
+ "@types/react-dom": "^18.3.0",
49
51
  "babel-jest": "^29.7.0",
50
52
  "eslint-plugin-react-hooks": "^4.6.2",
51
53
  "eslint-plugin-require-extensions": "^0.1.3",
@@ -55,15 +57,12 @@
55
57
  "react-test-renderer": "^18.3.1",
56
58
  "stylelint": "^16.6.0",
57
59
  "tsup": "^8.4.0",
58
- "typescript": "^5.0.0",
59
- "@anker-in/cart": "1.0.0-beta.2",
60
- "@anker-in/shared": "1.0.0-beta.2",
61
- "@anker-in/shopify": "0.0.0-beta.6"
60
+ "typescript": "^5.0.0"
62
61
  },
63
62
  "peerDependencies": {
64
63
  "react": "^18.3.1",
65
64
  "react-dom": "^18.3.1",
66
- "@anker-in/lib": "1.0.0-beta.6"
65
+ "@anker-in/lib": "0.0.0-beta.1"
67
66
  },
68
67
  "dependencies": {
69
68
  "@copilotkit/react-core": "1.1.2",
@@ -88,7 +87,9 @@
88
87
  "react-codepen-embed": "^1.1.0",
89
88
  "swiper": "^11.1.3",
90
89
  "tailwind-merge": "^2.3.0",
91
- "tailwindcss": "^3.4.3"
90
+ "tailwindcss": "^3.4.3",
91
+ "@anker-in/headless-ui": "1.0.19",
92
+ "@anker-in/lib": "0.0.0-beta.1"
92
93
  },
93
94
  "publishConfig": {
94
95
  "access": "public",
@@ -100,8 +101,7 @@
100
101
  "scripts": {
101
102
  "dev": "pnpm run dev:css & tsup --watch",
102
103
  "dev:css": "postcss src/styles/global.css -o style.css --watch",
103
- "build": "pnpm run build:css & tsup",
104
- "build:css": "postcss src/styles/chat.css -o style.css",
104
+ "build": "tsup",
105
105
  "lint": "eslint \"src/**/*.ts*\"",
106
106
  "test": "echo run @anker-in/campaign-ui tests",
107
107
  "type-check": "tsc --noEmit",
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react'
3
3
  import { useAlpcMutation } from './useAlpcFetch'
4
4
  import type { CreditLogResponse } from '../response'
5
5
  import { useCreditsContext } from '../provider'
6
- import { useHeadlessContext } from '@anker-in/shared'
6
+ import { useHeadlessContext } from '@anker-in/lib'
7
7
 
8
8
  function useActivities({ page, pageSize, options = {} }: { page: number; pageSize: number; options?: any }) {
9
9
  const { profile, isLoadingProfile } = useCreditsContext()
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useMemo, useState } from 'react'
2
2
  import { emailValidate } from '../utils'
3
- import { useHeadlessContext } from '@anker-in/shared'
3
+ import { useHeadlessContext } from '@anker-in/lib'
4
4
 
5
5
  type ValidatorCallback = (value: string, params?: Record<string, any>) => boolean
6
6
 
@@ -1,7 +1,7 @@
1
1
  import Cookies from 'js-cookie'
2
2
  import { useCallback, useRef, useState } from 'react'
3
3
  import useSWR, { type SWRConfiguration } from 'swr'
4
- import { useHeadlessContext } from '@anker-in/shared'
4
+ import { useHeadlessContext } from '@anker-in/lib'
5
5
 
6
6
  import { getAlpcPath } from '../utils'
7
7
  import { useCreditsContext } from '../provider'
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState } from 'react'
2
2
 
3
- import { useHeadlessContext } from '@anker-in/shared'
3
+ import { useHeadlessContext } from '@anker-in/lib'
4
4
  import { type ShippingCountry, type ShippingZone } from '../../type'
5
5
 
6
6
  function useCountries({ shopifyStoreDomain }: { shopifyStoreDomain: string }) {
@@ -4,7 +4,7 @@ import { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'
4
4
  import { useAlpcMutation } from './useAlpcFetch'
5
5
  import type { RedeemLogResponse } from '../response'
6
6
  import { useCreditsContext } from '../provider'
7
- import { useHeadlessContext } from '@anker-in/shared'
7
+ import { useHeadlessContext } from '@anker-in/lib'
8
8
 
9
9
  function useMyRewards({
10
10
  page,
@@ -1,8 +1,8 @@
1
1
  import useSWRMutation, { SWRMutationConfiguration } from 'swr/mutation'
2
2
  import { useRedeemCoupon } from './useRedeemCoupon'
3
- import type { ProductVariant } from '@anker-in/shopify'
3
+ import type { ProductVariant } from '@anker-in/lib'
4
4
  import { useCreditsContext } from '../provider'
5
- import { useBuyNow } from '@anker-in/cart'
5
+ import { useBuyNow } from '@anker-in/lib'
6
6
 
7
7
  export const useRedeemAndBuy = (
8
8
  _: any,
@@ -1,6 +1,6 @@
1
1
  import { ALPC_COUNTRY_MAP } from '../const'
2
2
  import { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'
3
- import { useHeadlessContext } from '@anker-in/shared'
3
+ import { useHeadlessContext } from '@anker-in/lib'
4
4
 
5
5
  type RedeemCouponResponse = {
6
6
  code: number
@@ -1,6 +1,6 @@
1
1
  import { ALPC_COUNTRY_MAP } from '../const'
2
2
  import { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'
3
- import { useHeadlessContext } from '@anker-in/shared'
3
+ import { useHeadlessContext } from '@anker-in/lib'
4
4
 
5
5
  type RedeemProductResponse = {
6
6
  code: number
@@ -4,7 +4,7 @@ import { useAlpcMutation } from './useAlpcFetch'
4
4
  import { ALPC_COUNTRY_MAP } from '../const'
5
5
  import { useCreditsContext } from '../provider'
6
6
  import type { ConsumeCreditRuleResponse } from '../response'
7
- import { useHeadlessContext } from '@anker-in/shared'
7
+ import { useHeadlessContext } from '@anker-in/lib'
8
8
 
9
9
  function useRedeemableList() {
10
10
  let locale = '' as string
@@ -1,7 +1,7 @@
1
1
  import fetcher from '../../../../helpers/fetcher'
2
2
  import useSWRMutation from 'swr/mutation'
3
3
  import { useCreditsContext } from '../provider'
4
- import { useHeadlessContext } from '@anker-in/shared'
4
+ import { useHeadlessContext } from '@anker-in/lib'
5
5
 
6
6
  export function useSendEmailValidation() {
7
7
  const { profile } = useCreditsContext()
@@ -4,7 +4,7 @@ import { TaskSubType } from '../const'
4
4
  import useActivities from './useActivities'
5
5
  import useSubscriptions from './useSubscriptions'
6
6
  import { useCreditsContext } from '../provider'
7
- import { useHeadlessContext } from '@anker-in/shared'
7
+ import { useHeadlessContext } from '@anker-in/lib'
8
8
 
9
9
  export const useSubscribed = () => {
10
10
  const { profile } = useCreditsContext()
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useEffect, useRef, useState } from 'react'
2
2
  import type { Subscription } from '../../type'
3
3
  import fetcher from '../../../../helpers/fetcher'
4
- import { useHeadlessContext } from '@anker-in/shared'
4
+ import { useHeadlessContext } from '@anker-in/lib'
5
5
 
6
6
  function useSubscriptions(email?: string) {
7
7
  const loading = useRef(false)
@@ -5,9 +5,9 @@ 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/shopify'
8
+ import { useProductsByHandles } from '@anker-in/lib'
9
9
  import { CreditsCashCopy, RedeemItem } from './type'
10
- import { Product } from '@anker-in/shopify'
10
+ import { Product } from '@anker-in/lib'
11
11
 
12
12
  export const CreditsCash = ({
13
13
  copy,
@@ -1,4 +1,4 @@
1
- import { ProductVariant, Product } from '@anker-in/shopify'
1
+ import { ProductVariant, Product } from '@anker-in/lib'
2
2
  import { AlpcConsumeType } from '../context/const'
3
3
 
4
4
  type RedeemableItemConfig = {
@@ -7,7 +7,7 @@ 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/shared'
10
+ import { useHeadlessContext } from '@anker-in/lib'
11
11
  import { AddressFormProps } from './type'
12
12
 
13
13
  export const AddressForm = ({ countries, countriesLoading, form, validate, errors, onChange }: AddressFormProps) => {
@@ -9,7 +9,7 @@ import { AlpcErrorCode } from '../context/const'
9
9
  import { CreditsModalContainer } from '../modal/modalContainer'
10
10
  import { numberFormat } from '../context/utils'
11
11
  import type { RedeemableItem as RedeemableItemType } from '../type'
12
- import { useHeadlessContext } from '@anker-in/shared'
12
+ import { useHeadlessContext } from '@anker-in/lib'
13
13
  import { CreditsRedeemListCopy } from './type'
14
14
 
15
15
  function RedeemCouponModal({
@@ -1,7 +1,7 @@
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/shared'
4
+ import { useHeadlessContext } 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'
@@ -2,7 +2,7 @@ import { Picture } 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'
5
- import { useHeadlessContext } from '@anker-in/shared'
5
+ import { useHeadlessContext } from '@anker-in/lib'
6
6
 
7
7
  type ProductInfoProps = {
8
8
  item: RedeemableItemType
@@ -8,7 +8,7 @@ import { useRedeemProduct } from '../../context/hooks/useRedeemProduct'
8
8
  import type { ModalContainerProps } from '../../modal/modalContainer'
9
9
  import { CreditsModalContainer } from '../../modal/modalContainer'
10
10
  import type { RedeemableItem as RedeemableItemType } from '../../type'
11
- import { useHeadlessContext } from '@anker-in/shared'
11
+ import { useHeadlessContext } from '@anker-in/lib'
12
12
  import { CreditsRedeemListCopy } from '../type'
13
13
  import { Error } from './Error'
14
14
  import { Success } from './Success'
@@ -7,7 +7,7 @@ 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 { useProductsByHandles } from '@anker-in/shopify'
10
+ import { useProductsByHandles } 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'
@@ -5,7 +5,7 @@ import useReceiptUploaded from '../context/hooks/useReceiptUploaded'
5
5
  import { useFirstPurchaseFinished } from '../context/hooks/useFirstPurchaseFinished'
6
6
  import { useSubscribed } from '../context/hooks/useSubscribed'
7
7
  import type { CreditsWaysToGetCreditsProps } from './type'
8
- import { useHeadlessContext } from '@anker-in/shared'
8
+ import { useHeadlessContext } from '@anker-in/lib'
9
9
  import { gaTrack } from '../../../helpers/track'
10
10
 
11
11
  export const useActions = ({
@@ -1,4 +1,4 @@
1
- import type { Product, ProductVariant } from '@anker-in/shopify'
1
+ import type { Product, ProductVariant } from '@anker-in/lib'
2
2
  import type { AlpcConsumeType, ConsumeType } from './context/const'
3
3
 
4
4
  export interface Subscription {
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './components/index'
2
2
 
3
3
  // 导出 Shopify 相关模块
4
- export * from '@anker-in/shopify'
4
+ export * from '@anker-in/lib'