@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/dist/index.mjs CHANGED
@@ -17714,17 +17714,17 @@ function useCreditsContext() {
17714
17714
  return useContext(CreditsContext);
17715
17715
  }
17716
17716
 
17717
- // node_modules/swr/dist/mutation/index.mjs
17717
+ // ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/mutation/index.mjs
17718
17718
  import React9, { useState as useState3, useRef as useRef3, useCallback as useCallback3 } from "react";
17719
17719
 
17720
- // node_modules/swr/dist/index/index.mjs
17720
+ // ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/index/index.mjs
17721
17721
  var import_shim = __toESM(require_shim(), 1);
17722
- import React8, { useRef as useRef2, useMemo as useMemo5, useCallback as useCallback2, useDebugValue } from "react";
17722
+ import React8, { useRef as useRef2, useMemo as useMemo4, useCallback as useCallback2, useDebugValue } from "react";
17723
17723
 
17724
- // node_modules/swr/dist/_internal/config-context-client-BoS53ST9.mjs
17724
+ // ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/_internal/config-context-client-v7VOFo66.mjs
17725
17725
  import React6, { useEffect as useEffect4, useLayoutEffect, createContext as createContext2, useContext as useContext2, useMemo as useMemo3, useRef, createElement } from "react";
17726
17726
 
17727
- // node_modules/swr/dist/_internal/events.mjs
17727
+ // ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/_internal/events.mjs
17728
17728
  var events_exports = {};
17729
17729
  __export(events_exports, {
17730
17730
  ERROR_REVALIDATE_EVENT: () => ERROR_REVALIDATE_EVENT,
@@ -17763,7 +17763,7 @@ function dequal(foo, bar) {
17763
17763
  return foo !== foo && bar !== bar;
17764
17764
  }
17765
17765
 
17766
- // node_modules/swr/dist/_internal/config-context-client-BoS53ST9.mjs
17766
+ // ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/_internal/config-context-client-v7VOFo66.mjs
17767
17767
  var SWRGlobalState = /* @__PURE__ */ new WeakMap();
17768
17768
  var noop = () => {
17769
17769
  };
@@ -17870,15 +17870,13 @@ var slowConnection = !IS_SERVER && navigatorConnection && ([
17870
17870
  "2g"
17871
17871
  ].includes(navigatorConnection.effectiveType) || navigatorConnection.saveData);
17872
17872
  var table2 = /* @__PURE__ */ new WeakMap();
17873
- var getTypeName = (value) => OBJECT.prototype.toString.call(value);
17874
- var isObjectTypeName = (typeName, type) => typeName === `[object ${type}]`;
17873
+ var isObjectType = (value, type) => OBJECT.prototype.toString.call(value) === `[object ${type}]`;
17875
17874
  var counter = 0;
17876
17875
  var stableHash = (arg) => {
17877
17876
  const type = typeof arg;
17878
- const typeName = getTypeName(arg);
17879
- const isDate = isObjectTypeName(typeName, "Date");
17880
- const isRegex = isObjectTypeName(typeName, "RegExp");
17881
- const isPlainObject2 = isObjectTypeName(typeName, "Object");
17877
+ const isDate = isObjectType(arg, "Date");
17878
+ const isRegex = isObjectType(arg, "RegExp");
17879
+ const isPlainObject2 = isObjectType(arg, "Object");
17882
17880
  let result;
17883
17881
  let index2;
17884
17882
  if (OBJECT(arg) === arg && !isDate && !isRegex) {
@@ -17977,7 +17975,6 @@ async function internalMutate(...args) {
17977
17975
  }
17978
17976
  let data = _data;
17979
17977
  let error;
17980
- let isError = false;
17981
17978
  const beforeMutationTs = getTimestamp();
17982
17979
  MUTATION[key] = [
17983
17980
  beforeMutationTs,
@@ -18000,18 +17997,16 @@ async function internalMutate(...args) {
18000
17997
  data = data(committedData);
18001
17998
  } catch (err) {
18002
17999
  error = err;
18003
- isError = true;
18004
18000
  }
18005
18001
  }
18006
18002
  if (data && isPromiseLike(data)) {
18007
18003
  data = await data.catch((err) => {
18008
18004
  error = err;
18009
- isError = true;
18010
18005
  });
18011
18006
  if (beforeMutationTs !== MUTATION[key][0]) {
18012
- if (isError) throw error;
18007
+ if (error) throw error;
18013
18008
  return data;
18014
- } else if (isError && hasOptimisticData && rollbackOnError(error)) {
18009
+ } else if (error && hasOptimisticData && rollbackOnError(error)) {
18015
18010
  populateCache = true;
18016
18011
  set({
18017
18012
  data: committedData,
@@ -18020,7 +18015,7 @@ async function internalMutate(...args) {
18020
18015
  }
18021
18016
  }
18022
18017
  if (populateCache) {
18023
- if (!isError) {
18018
+ if (!error) {
18024
18019
  if (isFunction(populateCache)) {
18025
18020
  const populateCachedData = populateCache(data, committedData);
18026
18021
  set({
@@ -18043,7 +18038,7 @@ async function internalMutate(...args) {
18043
18038
  _c: UNDEFINED
18044
18039
  });
18045
18040
  });
18046
- if (isError) {
18041
+ if (error) {
18047
18042
  if (throwOnError) throw error;
18048
18043
  return;
18049
18044
  }
@@ -18201,11 +18196,11 @@ var SWRConfig = (props) => {
18201
18196
  }));
18202
18197
  };
18203
18198
 
18204
- // node_modules/swr/dist/_internal/constants.mjs
18199
+ // ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/_internal/constants.mjs
18205
18200
  var INFINITE_PREFIX = "$inf$";
18206
18201
 
18207
- // node_modules/swr/dist/_internal/index.mjs
18208
- import React7, { useContext as useContext3, useMemo as useMemo4 } from "react";
18202
+ // ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/_internal/index.mjs
18203
+ import React7, { useContext as useContext3 } from "react";
18209
18204
  var enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;
18210
18205
  var use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];
18211
18206
  var setupDevTools = () => {
@@ -18225,11 +18220,7 @@ var normalize2 = (args) => {
18225
18220
  ];
18226
18221
  };
18227
18222
  var useSWRConfig = () => {
18228
- const parentConfig = useContext3(SWRConfigContext);
18229
- const mergedConfig = useMemo4(() => mergeObjects(defaultConfig, parentConfig), [
18230
- parentConfig
18231
- ]);
18232
- return mergedConfig;
18223
+ return mergeObjects(defaultConfig, useContext3(SWRConfigContext));
18233
18224
  };
18234
18225
  var middleware = (useSWRNext) => (key_, fetcher_, config) => {
18235
18226
  const fetcher3 = fetcher_ && ((...args) => {
@@ -18283,7 +18274,7 @@ var withMiddleware = (useSWR2, middleware2) => {
18283
18274
  };
18284
18275
  setupDevTools();
18285
18276
 
18286
- // node_modules/swr/dist/index/index.mjs
18277
+ // ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/index/index.mjs
18287
18278
  var noop2 = () => {
18288
18279
  };
18289
18280
  var UNDEFINED2 = (
@@ -18317,7 +18308,6 @@ var use2 = React8.use || // This extra generic is to avoid TypeScript mixing up
18317
18308
  var WITH_DEDUPE = {
18318
18309
  dedupe: true
18319
18310
  };
18320
- var resolvedUndef = Promise.resolve(UNDEFINED);
18321
18311
  var useSWRHandler = (_key, fetcher3, config) => {
18322
18312
  const { cache: cache2, compare: compare2, suspense, fallbackData, revalidateOnMount, revalidateIfStale, refreshInterval, refreshWhenHidden, refreshWhenOffline, keepPreviousData } = config;
18323
18313
  const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache2);
@@ -18352,7 +18342,7 @@ var useSWRHandler = (_key, fetcher3, config) => {
18352
18342
  }
18353
18343
  return true;
18354
18344
  };
18355
- const getSnapshot = useMemo5(() => {
18345
+ const getSnapshot = useMemo4(() => {
18356
18346
  const shouldStartRequest = (() => {
18357
18347
  if (!key) return false;
18358
18348
  if (!fetcher3) return false;
@@ -18605,12 +18595,10 @@ var useSWRHandler = (_key, fetcher3, config) => {
18605
18595
  _k: fnArg
18606
18596
  });
18607
18597
  if (shouldDoInitialRevalidation) {
18608
- if (!FETCH[key]) {
18609
- if (isUndefined(data) || IS_SERVER) {
18610
- softRevalidate();
18611
- } else {
18612
- rAF(softRevalidate);
18613
- }
18598
+ if (isUndefined(data) || IS_SERVER) {
18599
+ softRevalidate();
18600
+ } else {
18601
+ rAF(softRevalidate);
18614
18602
  }
18615
18603
  }
18616
18604
  return () => {
@@ -18649,28 +18637,28 @@ var useSWRHandler = (_key, fetcher3, config) => {
18649
18637
  key
18650
18638
  ]);
18651
18639
  useDebugValue(returnedData);
18652
- if (suspense) {
18653
- const hasKeyButNoData = key && isUndefined(data);
18654
- if (!IS_REACT_LEGACY && IS_SERVER && hasKeyButNoData) {
18640
+ if (suspense && isUndefined(data) && key) {
18641
+ if (!IS_REACT_LEGACY && IS_SERVER) {
18655
18642
  throw new Error("Fallback data is required when using Suspense in SSR.");
18656
18643
  }
18657
- if (hasKeyButNoData) {
18658
- fetcherRef.current = fetcher3;
18659
- configRef.current = config;
18660
- unmountedRef.current = false;
18661
- }
18644
+ fetcherRef.current = fetcher3;
18645
+ configRef.current = config;
18646
+ unmountedRef.current = false;
18662
18647
  const req = PRELOAD[key];
18663
- const mutateReq = !isUndefined(req) && hasKeyButNoData ? boundMutate(req) : resolvedUndef;
18664
- use2(mutateReq);
18665
- if (!isUndefined(error) && hasKeyButNoData) {
18666
- throw error;
18648
+ if (!isUndefined(req)) {
18649
+ const promise = boundMutate(req);
18650
+ use2(promise);
18667
18651
  }
18668
- const revalidation = hasKeyButNoData ? revalidate(WITH_DEDUPE) : resolvedUndef;
18669
- if (!isUndefined(returnedData) && hasKeyButNoData) {
18670
- revalidation.status = "fulfilled";
18671
- revalidation.value = true;
18652
+ if (isUndefined(error)) {
18653
+ const promise = revalidate(WITH_DEDUPE);
18654
+ if (!isUndefined(returnedData)) {
18655
+ promise.status = "fulfilled";
18656
+ promise.value = true;
18657
+ }
18658
+ use2(promise);
18659
+ } else {
18660
+ throw error;
18672
18661
  }
18673
- use2(revalidation);
18674
18662
  }
18675
18663
  const swrResponse = {
18676
18664
  mutate: boundMutate,
@@ -18698,7 +18686,7 @@ var SWRConfig2 = OBJECT.defineProperty(SWRConfig, "defaultValue", {
18698
18686
  });
18699
18687
  var useSWR = withArgs(useSWRHandler);
18700
18688
 
18701
- // node_modules/swr/dist/mutation/index.mjs
18689
+ // ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/mutation/index.mjs
18702
18690
  var startTransition = IS_REACT_LEGACY ? (cb) => {
18703
18691
  cb();
18704
18692
  } : React9.startTransition;
@@ -19504,7 +19492,7 @@ function formatPrice({
19504
19492
  }
19505
19493
 
19506
19494
  // src/components/credits/modal/activitiesModal.tsx
19507
- import { useCallback as useCallback7, useMemo as useMemo6, useState as useState9 } from "react";
19495
+ import { useCallback as useCallback7, useMemo as useMemo5, useState as useState9 } from "react";
19508
19496
 
19509
19497
  // src/components/credits/context/hooks/useActivities.ts
19510
19498
  import { useCallback as useCallback6, useEffect as useEffect6, useState as useState8 } from "react";
@@ -19512,7 +19500,7 @@ import { useCallback as useCallback6, useEffect as useEffect6, useState as useSt
19512
19500
  // src/components/credits/context/hooks/useAlpcFetch.ts
19513
19501
  var import_js_cookie2 = __toESM(require_js_cookie());
19514
19502
  import { useCallback as useCallback5, useRef as useRef4, useState as useState7 } from "react";
19515
- import { useHeadlessContext } from "@anker-in/shared";
19503
+ import { useHeadlessContext } from "@anker-in/lib";
19516
19504
  var reAuthPromise;
19517
19505
  var fetcher2 = (options) => {
19518
19506
  return fetch(getAlpcPath(options.locale) + options.url, options.fetchOptions).then(async (response) => {
@@ -19671,7 +19659,7 @@ var useAlpcMutation = (options, mutationOptions) => {
19671
19659
  };
19672
19660
 
19673
19661
  // src/components/credits/context/hooks/useActivities.ts
19674
- import { useHeadlessContext as useHeadlessContext2 } from "@anker-in/shared";
19662
+ import { useHeadlessContext as useHeadlessContext2 } from "@anker-in/lib";
19675
19663
  function useActivities({ page, pageSize, options = {} }) {
19676
19664
  const { profile, isLoadingProfile } = useCreditsContext();
19677
19665
  const { brand } = useHeadlessContext2();
@@ -19741,14 +19729,14 @@ function ActivitiesModal({ data, ...props }) {
19741
19729
  var _a, _b;
19742
19730
  const [page, setPage] = useState9(1);
19743
19731
  const { taskIdToTypeMapping } = useCreditsContext();
19744
- const myActivitiesOptions = useMemo6(() => {
19732
+ const myActivitiesOptions = useMemo5(() => {
19745
19733
  return {
19746
19734
  page: props.isOpen ? page : 0,
19747
19735
  pageSize: 1e3
19748
19736
  };
19749
19737
  }, [props.isOpen, page]);
19750
19738
  const [activeTab, setActiveTab] = useState9(0 /* All */);
19751
- const tabs = useMemo6(() => {
19739
+ const tabs = useMemo5(() => {
19752
19740
  const tabs2 = [
19753
19741
  {
19754
19742
  title: data.allTab,
@@ -19772,7 +19760,7 @@ function ActivitiesModal({ data, ...props }) {
19772
19760
  return tabs2;
19773
19761
  }, [data]);
19774
19762
  const { activities = [], canNext, isLoading } = useActivities_default(myActivitiesOptions);
19775
- const list3 = useMemo6(() => {
19763
+ const list3 = useMemo5(() => {
19776
19764
  const taskNameMap = {
19777
19765
  [1 /* Activation */]: data.activationTask,
19778
19766
  [2 /* UpdateName */]: data.updateNameTask,
@@ -19932,7 +19920,7 @@ var import_classnames4 = __toESM(require_classnames());
19932
19920
  var import_copy_to_clipboard = __toESM(require_copy_to_clipboard());
19933
19921
  import { Tabs as Tabs2, TabsList as TabsList2, TabsTrigger as TabsTrigger2, Picture as Picture4 } from "@anker-in/headless-ui";
19934
19922
  import dayjs2 from "dayjs";
19935
- import { useCallback as useCallback9, useMemo as useMemo7, useState as useState12 } from "react";
19923
+ import { useCallback as useCallback9, useMemo as useMemo6, useState as useState12 } from "react";
19936
19924
 
19937
19925
  // src/components/credits/modal/tip.tsx
19938
19926
  var import_classnames3 = __toESM(require_classnames());
@@ -20031,7 +20019,7 @@ var tip_default = Tip;
20031
20019
 
20032
20020
  // src/components/credits/context/hooks/useMyRewards.ts
20033
20021
  import { useCallback as useCallback8, useEffect as useEffect7, useState as useState11 } from "react";
20034
- import { useHeadlessContext as useHeadlessContext3 } from "@anker-in/shared";
20022
+ import { useHeadlessContext as useHeadlessContext3 } from "@anker-in/lib";
20035
20023
  function useMyRewards({
20036
20024
  page,
20037
20025
  pageSize,
@@ -20112,7 +20100,7 @@ function MyRewardsModal({ data, ...props }) {
20112
20100
  const [couponPage, setCouponPage] = useState12(1);
20113
20101
  const [productPage, setProductPage] = useState12(1);
20114
20102
  const [copied, setCopied] = useState12(-1);
20115
- const tabs = useMemo7(() => {
20103
+ const tabs = useMemo6(() => {
20116
20104
  const availableTabs = [];
20117
20105
  if (data.couponTab) {
20118
20106
  availableTabs.push({
@@ -20128,14 +20116,14 @@ function MyRewardsModal({ data, ...props }) {
20128
20116
  }
20129
20117
  return availableTabs;
20130
20118
  }, [data.couponTab, data.productTab]);
20131
- const myProductRewardsOptions = useMemo7(() => {
20119
+ const myProductRewardsOptions = useMemo6(() => {
20132
20120
  return {
20133
20121
  page: props.isOpen ? productPage : 0,
20134
20122
  pageSize: 1e3,
20135
20123
  consumeType: 2 /* Product */
20136
20124
  };
20137
20125
  }, [props.isOpen, productPage]);
20138
- const myCouponRewardsOptions = useMemo7(() => {
20126
+ const myCouponRewardsOptions = useMemo6(() => {
20139
20127
  return {
20140
20128
  page: props.isOpen ? couponPage : 0,
20141
20129
  pageSize: 1e3,
@@ -20152,7 +20140,7 @@ function MyRewardsModal({ data, ...props }) {
20152
20140
  canNext: productCanNext,
20153
20141
  isLoading: productIsLoading
20154
20142
  } = useMyRewards_default(myProductRewardsOptions);
20155
- const list3 = useMemo7(() => {
20143
+ const list3 = useMemo6(() => {
20156
20144
  if (activeTab === 1 /* Coupon */) {
20157
20145
  return myCouponRewards.map((item) => ({
20158
20146
  title: item.goods_title,
@@ -20191,7 +20179,7 @@ function MyRewardsModal({ data, ...props }) {
20191
20179
  }
20192
20180
  return [];
20193
20181
  }, [activeTab, myProductRewards, myCouponRewards]);
20194
- const canNext = useMemo7(() => {
20182
+ const canNext = useMemo6(() => {
20195
20183
  if (activeTab === 1 /* Coupon */) {
20196
20184
  return couponCanNext;
20197
20185
  }
@@ -20200,7 +20188,7 @@ function MyRewardsModal({ data, ...props }) {
20200
20188
  }
20201
20189
  return false;
20202
20190
  }, [activeTab, couponCanNext, productCanNext]);
20203
- const TypeMap = useMemo7(() => {
20191
+ const TypeMap = useMemo6(() => {
20204
20192
  return {
20205
20193
  [0 /* Received */]: data.receivedLabel,
20206
20194
  [1 /* Pending */]: data.pendingLabel,
@@ -20211,7 +20199,7 @@ function MyRewardsModal({ data, ...props }) {
20211
20199
  [6 /* Failed */]: data.failedLabel
20212
20200
  };
20213
20201
  }, [data]);
20214
- const TipMap = useMemo7(() => {
20202
+ const TipMap = useMemo6(() => {
20215
20203
  return {
20216
20204
  [0 /* Received */]: "",
20217
20205
  [1 /* Pending */]: data.pendingTip,
@@ -20222,7 +20210,7 @@ function MyRewardsModal({ data, ...props }) {
20222
20210
  [6 /* Failed */]: ""
20223
20211
  };
20224
20212
  }, [data]);
20225
- const ColorMap = useMemo7(() => {
20213
+ const ColorMap = useMemo6(() => {
20226
20214
  return {
20227
20215
  [0 /* Received */]: "#52C41A",
20228
20216
  [1 /* Pending */]: "#999",
@@ -20951,7 +20939,7 @@ import { createContext as createContext7 } from "react";
20951
20939
  var MotionContext = createContext7({});
20952
20940
 
20953
20941
  // ../../node_modules/.pnpm/framer-motion@11.18.2_@emotion+is-prop-valid@1.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/MotionContext/create.mjs
20954
- import { useContext as useContext5, useMemo as useMemo8 } from "react";
20942
+ import { useContext as useContext5, useMemo as useMemo7 } from "react";
20955
20943
 
20956
20944
  // ../../node_modules/.pnpm/framer-motion@11.18.2_@emotion+is-prop-valid@1.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/utils/is-variant-label.mjs
20957
20945
  function isVariantLabel(v) {
@@ -20998,7 +20986,7 @@ function getCurrentTreeVariants(props, context) {
20998
20986
  // ../../node_modules/.pnpm/framer-motion@11.18.2_@emotion+is-prop-valid@1.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/MotionContext/create.mjs
20999
20987
  function useCreateMotionContext(props) {
21000
20988
  const { initial, animate } = getCurrentTreeVariants(props, useContext5(MotionContext));
21001
- return useMemo8(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
20989
+ return useMemo7(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
21002
20990
  }
21003
20991
  function variantLabelsAsDependency(prop) {
21004
20992
  return Array.isArray(prop) ? prop.join(" ") : prop;
@@ -21837,10 +21825,10 @@ var htmlMotionConfig = {
21837
21825
  };
21838
21826
 
21839
21827
  // ../../node_modules/.pnpm/framer-motion@11.18.2_@emotion+is-prop-valid@1.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/use-render.mjs
21840
- import { Fragment as Fragment4, useMemo as useMemo11, createElement as createElement4 } from "react";
21828
+ import { Fragment as Fragment4, useMemo as useMemo10, createElement as createElement4 } from "react";
21841
21829
 
21842
21830
  // ../../node_modules/.pnpm/framer-motion@11.18.2_@emotion+is-prop-valid@1.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/html/use-props.mjs
21843
- import { useMemo as useMemo9 } from "react";
21831
+ import { useMemo as useMemo8 } from "react";
21844
21832
  function copyRawValuesOnly(target, source, props) {
21845
21833
  for (const key in source) {
21846
21834
  if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
@@ -21849,7 +21837,7 @@ function copyRawValuesOnly(target, source, props) {
21849
21837
  }
21850
21838
  }
21851
21839
  function useInitialMotionValues({ transformTemplate }, visualState) {
21852
- return useMemo9(() => {
21840
+ return useMemo8(() => {
21853
21841
  const state = createHtmlRenderState();
21854
21842
  buildHTMLStyles(state, visualState, transformTemplate);
21855
21843
  return Object.assign({}, state.vars, state.style);
@@ -21878,9 +21866,9 @@ function useHTMLProps(props, visualState) {
21878
21866
  }
21879
21867
 
21880
21868
  // ../../node_modules/.pnpm/framer-motion@11.18.2_@emotion+is-prop-valid@1.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/use-props.mjs
21881
- import { useMemo as useMemo10 } from "react";
21869
+ import { useMemo as useMemo9 } from "react";
21882
21870
  function useSVGProps(props, visualState, _isStatic, Component2) {
21883
- const visualProps = useMemo10(() => {
21871
+ const visualProps = useMemo9(() => {
21884
21872
  const state = createSvgRenderState();
21885
21873
  buildSVGAttrs(state, visualState, isSVGTag(Component2), props.transformTemplate);
21886
21874
  return {
@@ -21904,7 +21892,7 @@ function createUseRender(forwardMotionProps = false) {
21904
21892
  const filteredProps = filterProps(props, typeof Component2 === "string", forwardMotionProps);
21905
21893
  const elementProps = Component2 !== Fragment4 ? { ...filteredProps, ...visualProps, ref } : {};
21906
21894
  const { children } = props;
21907
- const renderedChildren = useMemo11(() => isMotionValue(children) ? children.get() : children, [children]);
21895
+ const renderedChildren = useMemo10(() => isMotionValue(children) ? children.get() : children, [children]);
21908
21896
  return createElement4(Component2, {
21909
21897
  ...elementProps,
21910
21898
  children: renderedChildren
@@ -28257,18 +28245,18 @@ var createMotionComponent = /* @__PURE__ */ createMotionComponentFactory({
28257
28245
  var motion = /* @__PURE__ */ createDOMMotionComponentProxy(createMotionComponent);
28258
28246
 
28259
28247
  // src/components/credits/creditsWaysToGetCredits/index.tsx
28260
- import { useMemo as useMemo16, useState as useState15 } from "react";
28248
+ import { useMemo as useMemo15, useState as useState15 } from "react";
28261
28249
 
28262
28250
  // src/components/credits/creditsWaysToGetCredits/useActions.ts
28263
- import { useMemo as useMemo15 } from "react";
28251
+ import { useMemo as useMemo14 } from "react";
28264
28252
 
28265
28253
  // src/components/credits/context/hooks/useReceiptUploaded.ts
28266
- import { useMemo as useMemo12 } from "react";
28254
+ import { useMemo as useMemo11 } from "react";
28267
28255
  var useReceiptUploaded = () => {
28268
28256
  const { taskIdToTypeMapping } = useCreditsContext();
28269
- const activitiesOptions = useMemo12(() => ({ page: 1, pageSize: 50 }), []);
28257
+ const activitiesOptions = useMemo11(() => ({ page: 1, pageSize: 50 }), []);
28270
28258
  const { activities } = useActivities_default(activitiesOptions);
28271
- const uploadedReceipt = useMemo12(() => {
28259
+ const uploadedReceipt = useMemo11(() => {
28272
28260
  return activities == null ? void 0 : activities.some((item) => {
28273
28261
  const uploadReceiptTaskId = Object.keys(taskIdToTypeMapping || {}).find(
28274
28262
  (type) => (taskIdToTypeMapping == null ? void 0 : taskIdToTypeMapping[type]) === "uploadReceipt" /* UploadReceipt */
@@ -28281,12 +28269,12 @@ var useReceiptUploaded = () => {
28281
28269
  var useReceiptUploaded_default = useReceiptUploaded;
28282
28270
 
28283
28271
  // src/components/credits/context/hooks/useFirstPurchaseFinished.ts
28284
- import { useMemo as useMemo13 } from "react";
28272
+ import { useMemo as useMemo12 } from "react";
28285
28273
  var useFirstPurchaseFinished = () => {
28286
28274
  const { taskIdToTypeMapping } = useCreditsContext();
28287
- const activitiesOptions = useMemo13(() => ({ page: 1, pageSize: 50 }), []);
28275
+ const activitiesOptions = useMemo12(() => ({ page: 1, pageSize: 50 }), []);
28288
28276
  const { activities } = useActivities_default(activitiesOptions);
28289
- const firstPurchaseFinished = useMemo13(() => {
28277
+ const firstPurchaseFinished = useMemo12(() => {
28290
28278
  return activities == null ? void 0 : activities.some((item) => {
28291
28279
  const firstPurchaseTaskId = Object.keys(taskIdToTypeMapping || {}).find(
28292
28280
  (type) => (taskIdToTypeMapping == null ? void 0 : taskIdToTypeMapping[type]) === "firstPurchase" /* FirstPurchase */
@@ -28298,11 +28286,11 @@ var useFirstPurchaseFinished = () => {
28298
28286
  };
28299
28287
 
28300
28288
  // src/components/credits/context/hooks/useSubscribed.ts
28301
- import { useMemo as useMemo14 } from "react";
28289
+ import { useMemo as useMemo13 } from "react";
28302
28290
 
28303
28291
  // src/components/credits/context/hooks/useSubscriptions.ts
28304
28292
  import { useCallback as useCallback13, useEffect as useEffect11, useRef as useRef7, useState as useState14 } from "react";
28305
- import { useHeadlessContext as useHeadlessContext4 } from "@anker-in/shared";
28293
+ import { useHeadlessContext as useHeadlessContext4 } from "@anker-in/lib";
28306
28294
  function useSubscriptions(email) {
28307
28295
  const loading = useRef7(false);
28308
28296
  const [subscriptionData, setSubscriptionData] = useState14();
@@ -28346,14 +28334,14 @@ function useSubscriptions(email) {
28346
28334
  var useSubscriptions_default = useSubscriptions;
28347
28335
 
28348
28336
  // src/components/credits/context/hooks/useSubscribed.ts
28349
- import { useHeadlessContext as useHeadlessContext5 } from "@anker-in/shared";
28337
+ import { useHeadlessContext as useHeadlessContext5 } from "@anker-in/lib";
28350
28338
  var useSubscribed = () => {
28351
28339
  const { profile } = useCreditsContext();
28352
28340
  const { brand } = useHeadlessContext5();
28353
- const activitiesOptions = useMemo14(() => ({ page: 1, pageSize: 50 }), []);
28341
+ const activitiesOptions = useMemo13(() => ({ page: 1, pageSize: 50 }), []);
28354
28342
  const { activities } = useActivities_default(activitiesOptions);
28355
28343
  const { subscriptionData } = useSubscriptions_default(profile == null ? void 0 : profile.email);
28356
- const isSubscribed = useMemo14(() => {
28344
+ const isSubscribed = useMemo13(() => {
28357
28345
  if (!(subscriptionData == null ? void 0 : subscriptionData.preference)) {
28358
28346
  return false;
28359
28347
  }
@@ -28371,7 +28359,7 @@ var useSubscribed = () => {
28371
28359
  };
28372
28360
 
28373
28361
  // src/components/credits/creditsWaysToGetCredits/useActions.ts
28374
- import { useHeadlessContext as useHeadlessContext6 } from "@anker-in/shared";
28362
+ import { useHeadlessContext as useHeadlessContext6 } from "@anker-in/lib";
28375
28363
  var useActions = ({
28376
28364
  copy,
28377
28365
  subscribe,
@@ -28385,10 +28373,10 @@ var useActions = ({
28385
28373
  const uploadedReceipt = useReceiptUploaded_default();
28386
28374
  const { appName, passportUrl } = useHeadlessContext6();
28387
28375
  console.log("passportUrl", passportUrl);
28388
- const profileCompleted = useMemo15(() => {
28376
+ const profileCompleted = useMemo14(() => {
28389
28377
  return ((profile == null ? void 0 : profile.first_name) || (profile == null ? void 0 : profile.last_name)) && (profile == null ? void 0 : profile.phone_number) && (profile == null ? void 0 : profile.dob);
28390
28378
  }, [profile]);
28391
- return useMemo15(() => {
28379
+ return useMemo14(() => {
28392
28380
  const handleClickWithTrack = ({
28393
28381
  buttonName,
28394
28382
  id: id3,
@@ -28576,7 +28564,7 @@ var CreditsWaysToGetCredits = ({
28576
28564
  const { profile } = useCreditsContext();
28577
28565
  const isLogin = !!profile;
28578
28566
  const { actions } = useActions({ copy, activate, subscribe, uploadReceipt: uploadReceipt2 });
28579
- const list3 = useMemo16(() => {
28567
+ const list3 = useMemo15(() => {
28580
28568
  const list4 = copy.list.map((item) => {
28581
28569
  if (!actions[item.id]) {
28582
28570
  return void 0;
@@ -28725,7 +28713,7 @@ var CreditsWaysToGetCredits = ({
28725
28713
 
28726
28714
  // src/components/credits/creditsFaq/index.tsx
28727
28715
  import { Container as Container5, Heading as Heading7, Tabs as Tabs3, TabsList as TabsList3, TabsTrigger as TabsTrigger3, Text as Text8 } from "@anker-in/headless-ui";
28728
- import { useMemo as useMemo17, useState as useState17 } from "react";
28716
+ import { useMemo as useMemo16, useState as useState17 } from "react";
28729
28717
 
28730
28718
  // src/components/credits/creditsFaq/faqItem/FaqItem.tsx
28731
28719
  import { Heading as Heading6, Text as Text7 } from "@anker-in/headless-ui";
@@ -28823,12 +28811,12 @@ import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
28823
28811
  var CreditsFaq = ({ copy }) => {
28824
28812
  var _a, _b, _c, _d, _e;
28825
28813
  const { title, items: faqList, subTitle = "" } = copy || {};
28826
- const categoryList = useMemo17(() => {
28814
+ const categoryList = useMemo16(() => {
28827
28815
  var _a2;
28828
28816
  return Array.from(new Set((_a2 = faqList == null ? void 0 : faqList.map) == null ? void 0 : _a2.call(faqList, (faq) => faq.category_name).filter((item) => !!item)));
28829
28817
  }, [faqList]);
28830
28818
  const [activeTab, setActiveTab] = useState17(((_a = categoryList[0]) == null ? void 0 : _a.toString()) || "");
28831
- const currentList = useMemo17(() => {
28819
+ const currentList = useMemo16(() => {
28832
28820
  if (!faqList) return [];
28833
28821
  if (categoryList.length) {
28834
28822
  return faqList.filter((item) => (item == null ? void 0 : item.category_name) === activeTab);
@@ -28878,14 +28866,14 @@ var CreditsFaq = ({ copy }) => {
28878
28866
 
28879
28867
  // src/components/credits/creditsCash/index.tsx
28880
28868
  import { Container as Container6, Heading as Heading8 } from "@anker-in/headless-ui";
28881
- import { useMemo as useMemo20, useState as useState19 } from "react";
28869
+ import { useMemo as useMemo19, useState as useState19 } from "react";
28882
28870
 
28883
28871
  // src/components/credits/creditsCash/RedeemableItem.tsx
28884
28872
  import { Button as Button5, Text as Text9, Picture as Picture6 } from "@anker-in/headless-ui";
28885
- import { useMemo as useMemo18 } from "react";
28873
+ import { useMemo as useMemo17 } from "react";
28886
28874
 
28887
28875
  // src/components/credits/context/hooks/useRedeemCoupon.ts
28888
- import { useHeadlessContext as useHeadlessContext7 } from "@anker-in/shared";
28876
+ import { useHeadlessContext as useHeadlessContext7 } from "@anker-in/lib";
28889
28877
  var useRedeemCoupon = (mutationOptions = {}) => {
28890
28878
  const { locale, appName, brand } = useHeadlessContext7();
28891
28879
  return useAlpcMutation(
@@ -28902,7 +28890,7 @@ var useRedeemCoupon = (mutationOptions = {}) => {
28902
28890
  };
28903
28891
 
28904
28892
  // src/components/credits/context/hooks/useRedeemAndBuy.ts
28905
- import { useBuyNow } from "@anker-in/cart";
28893
+ import { useBuyNow } from "@anker-in/lib";
28906
28894
  var useRedeemAndBuy = (_, swrOptions) => {
28907
28895
  const { trigger } = useRedeemCoupon();
28908
28896
  const { profile } = useCreditsContext();
@@ -28962,14 +28950,14 @@ function RedeemableItem({
28962
28950
  onError: () => console.log("error")
28963
28951
  }
28964
28952
  );
28965
- const isLogin = useMemo18(() => {
28953
+ const isLogin = useMemo17(() => {
28966
28954
  return !!profile;
28967
28955
  }, [profile == null ? void 0 : profile.activated]);
28968
- const inSufficientCredit = useMemo18(() => {
28956
+ const inSufficientCredit = useMemo17(() => {
28969
28957
  var _a2;
28970
28958
  return isLogin && (profile == null ? void 0 : profile.activated) && ((_a2 = itemData.alpcData) == null ? void 0 : _a2.consumeCredits) > Number((creditInfo == null ? void 0 : creditInfo.available_credit) || 0);
28971
28959
  }, [isLogin, profile == null ? void 0 : profile.activated, (_a = itemData.alpcData) == null ? void 0 : _a.consumeCredits, creditInfo == null ? void 0 : creditInfo.available_credit]);
28972
- const isDisabled = useMemo18(() => {
28960
+ const isDisabled = useMemo17(() => {
28973
28961
  var _a2, _b2, _c2;
28974
28962
  if (((_a2 = itemData.alpcData) == null ? void 0 : _a2.remainingInventory) <= 0 && ((_b2 = itemData.alpcData) == null ? void 0 : _b2.isLimited)) {
28975
28963
  return true;
@@ -29016,7 +29004,7 @@ function RedeemableItem({
29016
29004
  });
29017
29005
  }
29018
29006
  };
29019
- const redeemButtonText = useMemo18(() => {
29007
+ const redeemButtonText = useMemo17(() => {
29020
29008
  var _a2;
29021
29009
  if (!((_a2 = itemData.productVariant) == null ? void 0 : _a2.availableForSale)) {
29022
29010
  return (copy == null ? void 0 : copy.soldOut) || "Sold Out";
@@ -29138,7 +29126,7 @@ var RedeemableItem_default = RedeemableItem;
29138
29126
 
29139
29127
  // src/components/credits/context/hooks/useRedeemableList.ts
29140
29128
  import { useCallback as useCallback14, useEffect as useEffect13, useState as useState18 } from "react";
29141
- import { useHeadlessContext as useHeadlessContext8 } from "@anker-in/shared";
29129
+ import { useHeadlessContext as useHeadlessContext8 } from "@anker-in/lib";
29142
29130
  function useRedeemableList() {
29143
29131
  var _a;
29144
29132
  let locale = "";
@@ -29214,7 +29202,7 @@ var useRedeemableList_default = useRedeemableList;
29214
29202
 
29215
29203
  // src/components/credits/modal/rulesModal.tsx
29216
29204
  import { Text as Text10 } from "@anker-in/headless-ui";
29217
- import { useMemo as useMemo19 } from "react";
29205
+ import { useMemo as useMemo18 } from "react";
29218
29206
  import { jsx as jsx26 } from "react/jsx-runtime";
29219
29207
  function RulesModal({
29220
29208
  rules,
@@ -29222,7 +29210,7 @@ function RulesModal({
29222
29210
  ruleClassName,
29223
29211
  ...props
29224
29212
  }) {
29225
- const rulesComponent = useMemo19(() => {
29213
+ const rulesComponent = useMemo18(() => {
29226
29214
  if (typeof rules === "string") {
29227
29215
  return /* @__PURE__ */ jsx26(Text10, { className: cn("text-[16px] font-semibold", ruleClassName), html: rules });
29228
29216
  } else {
@@ -29241,7 +29229,7 @@ function RulesModal({
29241
29229
  var rulesModal_default = RulesModal;
29242
29230
 
29243
29231
  // src/components/credits/creditsCash/index.tsx
29244
- import { useProductsByHandles } from "@anker-in/shopify";
29232
+ import { useProductsByHandles } from "@anker-in/lib";
29245
29233
  import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
29246
29234
  var CreditsCash = ({
29247
29235
  copy,
@@ -29265,7 +29253,7 @@ var CreditsCash = ({
29265
29253
  variant: variantMetafieldIdentifiers
29266
29254
  }
29267
29255
  });
29268
- const list3 = useMemo20(() => {
29256
+ const list3 = useMemo19(() => {
29269
29257
  return productByHandles == null ? void 0 : productByHandles.map((product) => {
29270
29258
  var _a2, _b;
29271
29259
  const config = copy.list.find((item) => {
@@ -29333,7 +29321,7 @@ var CreditsCash = ({
29333
29321
  // src/components/credits/creditsRedeemList/index.tsx
29334
29322
  var import_classnames15 = __toESM(require_classnames());
29335
29323
  import { Container as Container7, Heading as Heading9, Tabs as Tabs4, TabsList as TabsList4, TabsTrigger as TabsTrigger4 } from "@anker-in/headless-ui";
29336
- import { useCallback as useCallback21, useMemo as useMemo27, useState as useState29 } from "react";
29324
+ import { useCallback as useCallback21, useMemo as useMemo26, useState as useState29 } from "react";
29337
29325
 
29338
29326
  // src/components/credits/creditsRedeemList/RedeemCouponModal.tsx
29339
29327
  var import_classnames5 = __toESM(require_classnames());
@@ -29371,7 +29359,7 @@ var useCopy = () => {
29371
29359
  var useCopy_default = useCopy;
29372
29360
 
29373
29361
  // src/components/credits/creditsRedeemList/RedeemCouponModal.tsx
29374
- import { useHeadlessContext as useHeadlessContext9 } from "@anker-in/shared";
29362
+ import { useHeadlessContext as useHeadlessContext9 } from "@anker-in/lib";
29375
29363
  import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
29376
29364
  function RedeemCouponModal({
29377
29365
  item,
@@ -29567,11 +29555,11 @@ var RedeemCouponModal_default = RedeemCouponModal;
29567
29555
 
29568
29556
  // src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx
29569
29557
  var import_classnames13 = __toESM(require_classnames());
29570
- import { useCallback as useCallback20, useEffect as useEffect22, useMemo as useMemo25, useState as useState28 } from "react";
29558
+ import { useCallback as useCallback20, useEffect as useEffect22, useMemo as useMemo24, useState as useState28 } from "react";
29571
29559
 
29572
29560
  // src/components/credits/context/hooks/useCountries.ts
29573
29561
  import { useEffect as useEffect16, useState as useState22 } from "react";
29574
- import { useHeadlessContext as useHeadlessContext10 } from "@anker-in/shared";
29562
+ import { useHeadlessContext as useHeadlessContext10 } from "@anker-in/lib";
29575
29563
  function useCountries({ shopifyStoreDomain }) {
29576
29564
  const { locale = "" } = useHeadlessContext10();
29577
29565
  const [isLoading, setLoading] = useState22(false);
@@ -29614,8 +29602,8 @@ function useCountries({ shopifyStoreDomain }) {
29614
29602
  var useCountries_default = useCountries;
29615
29603
 
29616
29604
  // src/components/credits/context/hooks/useAddressValidate.ts
29617
- import { useCallback as useCallback17, useMemo as useMemo21, useState as useState23 } from "react";
29618
- import { useHeadlessContext as useHeadlessContext11 } from "@anker-in/shared";
29605
+ import { useCallback as useCallback17, useMemo as useMemo20, useState as useState23 } from "react";
29606
+ import { useHeadlessContext as useHeadlessContext11 } from "@anker-in/lib";
29619
29607
  var US_SPECIAL_CHARACTERS = /[&%*<>^#;-]/;
29620
29608
  var EU_SPECIAL_CHARACTERS = /[&^*%<>;,?]/;
29621
29609
  var SC_CHARACTERS = /[^a-zA-Z0-9\s]/;
@@ -29688,7 +29676,7 @@ var useAddressValidate = ({
29688
29676
  }) => {
29689
29677
  const { locale } = useHeadlessContext11();
29690
29678
  const [errors, setErrors] = useState23([]);
29691
- const addressRules = useMemo21(() => {
29679
+ const addressRules = useMemo20(() => {
29692
29680
  const {
29693
29681
  city_rules = {},
29694
29682
  name_rules = {},
@@ -29824,7 +29812,7 @@ var useAddressValidate = ({
29824
29812
  };
29825
29813
 
29826
29814
  // src/components/credits/context/hooks/useRedeemProduct.ts
29827
- import { useHeadlessContext as useHeadlessContext12 } from "@anker-in/shared";
29815
+ import { useHeadlessContext as useHeadlessContext12 } from "@anker-in/lib";
29828
29816
  var useRedeemProduct = (mutationOptions = {}) => {
29829
29817
  var _a;
29830
29818
  const { storeDomain, locale, appName, brand } = useHeadlessContext12();
@@ -29844,7 +29832,7 @@ var useRedeemProduct = (mutationOptions = {}) => {
29844
29832
  };
29845
29833
 
29846
29834
  // src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx
29847
- import { useHeadlessContext as useHeadlessContext16 } from "@anker-in/shared";
29835
+ import { useHeadlessContext as useHeadlessContext16 } from "@anker-in/lib";
29848
29836
 
29849
29837
  // src/components/credits/creditsRedeemList/RedeemProductModal/Error.tsx
29850
29838
  import { Picture as Picture8, Text as Text12 } from "@anker-in/headless-ui";
@@ -29862,7 +29850,7 @@ import { Button as Button7, Text as Text13 } from "@anker-in/headless-ui";
29862
29850
 
29863
29851
  // src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx
29864
29852
  import { Picture as Picture9 } from "@anker-in/headless-ui";
29865
- import { useHeadlessContext as useHeadlessContext13 } from "@anker-in/shared";
29853
+ import { useHeadlessContext as useHeadlessContext13 } from "@anker-in/lib";
29866
29854
  import { jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
29867
29855
  var ProductInfo = ({ item, copy }) => {
29868
29856
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -29964,7 +29952,7 @@ import { Button as Button8, Text as Text15 } from "@anker-in/headless-ui";
29964
29952
 
29965
29953
  // src/components/credits/creditsRedeemList/AddressForm/index.tsx
29966
29954
  var import_classnames10 = __toESM(require_classnames());
29967
- import { useCallback as useCallback19, useEffect as useEffect21, useMemo as useMemo23, useState as useState27 } from "react";
29955
+ import { useCallback as useCallback19, useEffect as useEffect21, useMemo as useMemo22, useState as useState27 } from "react";
29968
29956
 
29969
29957
  // src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx
29970
29958
  import { Picture as Picture10 } from "@anker-in/headless-ui";
@@ -30153,7 +30141,7 @@ function Input({ className, error, value, placeholder, disabled, onChange, onBlu
30153
30141
  // src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx
30154
30142
  var import_classnames9 = __toESM(require_classnames());
30155
30143
  import { Picture as Picture11 } from "@anker-in/headless-ui";
30156
- import { useEffect as useEffect20, useMemo as useMemo22, useState as useState26 } from "react";
30144
+ import { useEffect as useEffect20, useMemo as useMemo21, useState as useState26 } from "react";
30157
30145
  import { Fragment as Fragment8, jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
30158
30146
  function StateSelect({ states, stateName = "", stateCode = "", className = "", onChange }) {
30159
30147
  const [show, setShow] = useState26(false);
@@ -30161,7 +30149,7 @@ function StateSelect({ states, stateName = "", stateCode = "", className = "", o
30161
30149
  const dropdown = useClickOutside_default(() => {
30162
30150
  setShow(false);
30163
30151
  });
30164
- const value = useMemo22(() => {
30152
+ const value = useMemo21(() => {
30165
30153
  const currentState = states.find((item) => stateCode ? item.code === stateCode : item.name === stateName);
30166
30154
  return currentState ? [currentState == null ? void 0 : currentState.id, currentState == null ? void 0 : currentState.name, currentState == null ? void 0 : currentState.code].join(",") : "";
30167
30155
  }, [states, stateCode, stateName]);
@@ -30264,17 +30252,17 @@ function StateSelect({ states, stateName = "", stateCode = "", className = "", o
30264
30252
  }
30265
30253
 
30266
30254
  // src/components/credits/creditsRedeemList/AddressForm/index.tsx
30267
- import { useHeadlessContext as useHeadlessContext14 } from "@anker-in/shared";
30255
+ import { useHeadlessContext as useHeadlessContext14 } from "@anker-in/lib";
30268
30256
  import { jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
30269
30257
  var AddressForm = ({ countries, countriesLoading, form, validate, errors, onChange }) => {
30270
30258
  const { profile, customer } = useCreditsContext();
30271
30259
  const { locale } = useHeadlessContext14();
30272
30260
  const [address, setAddress] = useState27();
30273
- const states = useMemo23(() => {
30261
+ const states = useMemo22(() => {
30274
30262
  const currentCountry = countries.find((item) => item.code === (address == null ? void 0 : address.country));
30275
30263
  return (currentCountry == null ? void 0 : currentCountry.provinces) || [];
30276
30264
  }, [address, countries]);
30277
- const stateInputKey = useMemo23(() => {
30265
+ const stateInputKey = useMemo22(() => {
30278
30266
  const stateInput = form == null ? void 0 : form.flat().find((item) => item.type === "state");
30279
30267
  return stateInput == null ? void 0 : stateInput.key;
30280
30268
  }, [form]);
@@ -30392,7 +30380,7 @@ var AddressForm = ({ countries, countriesLoading, form, validate, errors, onChan
30392
30380
  };
30393
30381
 
30394
30382
  // src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx
30395
- import { useHeadlessContext as useHeadlessContext15 } from "@anker-in/shared";
30383
+ import { useHeadlessContext as useHeadlessContext15 } from "@anker-in/lib";
30396
30384
  import { jsx as jsx37, jsxs as jsxs30 } from "react/jsx-runtime";
30397
30385
  var Address = ({
30398
30386
  copy,
@@ -30447,11 +30435,11 @@ var Address = ({
30447
30435
  // src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx
30448
30436
  var import_classnames12 = __toESM(require_classnames());
30449
30437
  import { Button as Button9, Picture as Picture12, Text as Text16 } from "@anker-in/headless-ui";
30450
- import { Fragment as Fragment9, useMemo as useMemo24 } from "react";
30438
+ import { Fragment as Fragment9, useMemo as useMemo23 } from "react";
30451
30439
  import { Fragment as Fragment10, jsx as jsx38, jsxs as jsxs31 } from "react/jsx-runtime";
30452
30440
  var Init = ({ copy, item, loading, disabled, setStatus }) => {
30453
30441
  var _a, _b, _c, _d, _e, _f;
30454
- const rules = useMemo24(() => {
30442
+ const rules = useMemo23(() => {
30455
30443
  var _a2, _b2;
30456
30444
  if ((_a2 = item.config.rules) == null ? void 0 : _a2.length) {
30457
30445
  return item.config.rules;
@@ -30624,7 +30612,7 @@ function RedeemProductModal({ item, copy, onError, ...props }) {
30624
30612
  });
30625
30613
  }
30626
30614
  });
30627
- const stateInputKey = useMemo25(() => {
30615
+ const stateInputKey = useMemo24(() => {
30628
30616
  var _a2;
30629
30617
  const stateInput = (_a2 = copy == null ? void 0 : copy.redeemModal.product.form) == null ? void 0 : _a2.flat().find((item2) => item2.type === "state");
30630
30618
  return stateInput == null ? void 0 : stateInput.key;
@@ -30721,12 +30709,12 @@ function RedeemProductModal({ item, copy, onError, ...props }) {
30721
30709
  var RedeemProductModal_default = RedeemProductModal;
30722
30710
 
30723
30711
  // src/components/credits/creditsRedeemList/index.tsx
30724
- import { useProductsByHandles as useProductsByHandles2 } from "@anker-in/shopify";
30712
+ import { useProductsByHandles as useProductsByHandles2 } from "@anker-in/lib";
30725
30713
 
30726
30714
  // src/components/credits/creditsRedeemList/RedeemableItem.tsx
30727
30715
  var import_classnames14 = __toESM(require_classnames());
30728
30716
  import { Button as Button10, Text as Text17, Picture as Picture13 } from "@anker-in/headless-ui";
30729
- import { useMemo as useMemo26 } from "react";
30717
+ import { useMemo as useMemo25 } from "react";
30730
30718
  import { jsx as jsx40, jsxs as jsxs33 } from "react/jsx-runtime";
30731
30719
  function RedeemableItem2({
30732
30720
  copy,
@@ -30742,7 +30730,7 @@ function RedeemableItem2({
30742
30730
  gtm: { pageGroup }
30743
30731
  } = useCreditsContext();
30744
30732
  const isLogin = Object.keys(profile || {}).length > 0;
30745
- const isDisabled = useMemo26(() => {
30733
+ const isDisabled = useMemo25(() => {
30746
30734
  var _a2, _b2, _c2, _d2, _e2;
30747
30735
  if (((_a2 = item.alpc) == null ? void 0 : _a2.remainingInventory) <= 0 && ((_b2 = item.alpc) == null ? void 0 : _b2.isLimited)) {
30748
30736
  return true;
@@ -30766,7 +30754,7 @@ function RedeemableItem2({
30766
30754
  creditInfo == null ? void 0 : creditInfo.available_credit,
30767
30755
  (_e = item.variant) == null ? void 0 : _e.availableForSale
30768
30756
  ]);
30769
- const redeemButtonText = useMemo26(() => {
30757
+ const redeemButtonText = useMemo25(() => {
30770
30758
  var _a2, _b2;
30771
30759
  if (!isLogin) {
30772
30760
  return copy.unlockRewards;
@@ -30933,7 +30921,7 @@ function CreditsRedeemList({
30933
30921
  const [popRedeemData, setPopRedeemData] = useState29(void 0);
30934
30922
  const [rules, setRules] = useState29();
30935
30923
  const { listLoading, redeemableList, getRedeemableList } = useRedeemableList_default();
30936
- const alpcList = useMemo27(() => {
30924
+ const alpcList = useMemo26(() => {
30937
30925
  return redeemableList.map((item) => {
30938
30926
  return {
30939
30927
  id: item.id.toString(),
@@ -30950,7 +30938,7 @@ function CreditsRedeemList({
30950
30938
  }, [copy.list, activeTab, redeemableList]);
30951
30939
  const handles = alpcList.map((item) => item.handle);
30952
30940
  const { data: products } = useProductsByHandles2({ handles });
30953
- const list3 = useMemo27(() => {
30941
+ const list3 = useMemo26(() => {
30954
30942
  const currentList = copy.list.find((item) => item.label === activeTab);
30955
30943
  return currentList == null ? void 0 : currentList.list.filter((item) => alpcList.some((alpcItem) => alpcItem.id === item.id)).map((item) => {
30956
30944
  const alpcItem = alpcList.find((alpcItem2) => alpcItem2.id === item.id);
@@ -31070,7 +31058,7 @@ function CreditsRedeemList({
31070
31058
  }
31071
31059
 
31072
31060
  // src/index.ts
31073
- export * from "@anker-in/shopify";
31061
+ export * from "@anker-in/lib";
31074
31062
  export {
31075
31063
  ActionExecutionMessage3 as ActionExecutionMessage,
31076
31064
  chat_default as Chat,