@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.
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +79 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +126 -138
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/components/credits/context/hooks/useActivities.ts +1 -1
- package/src/components/credits/context/hooks/useAddressValidate.ts +1 -1
- package/src/components/credits/context/hooks/useAlpcFetch.ts +1 -1
- package/src/components/credits/context/hooks/useCountries.ts +1 -1
- package/src/components/credits/context/hooks/useMyRewards.ts +1 -1
- package/src/components/credits/context/hooks/useRedeemAndBuy.ts +2 -2
- package/src/components/credits/context/hooks/useRedeemCoupon.ts +1 -1
- package/src/components/credits/context/hooks/useRedeemProduct.ts +1 -1
- package/src/components/credits/context/hooks/useRedeemableList.ts +1 -1
- package/src/components/credits/context/hooks/useSendEmailValidation.ts +1 -1
- package/src/components/credits/context/hooks/useSubscribed.ts +1 -1
- package/src/components/credits/context/hooks/useSubscriptions.ts +1 -1
- package/src/components/credits/creditsCash/index.tsx +2 -2
- package/src/components/credits/creditsCash/type.ts +1 -1
- package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +1 -1
- package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +1 -1
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +1 -1
- package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +1 -1
- package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +1 -1
- package/src/components/credits/creditsRedeemList/index.tsx +1 -1
- package/src/components/credits/creditsWaysToGetCredits/useActions.ts +1 -1
- package/src/components/credits/type.ts +1 -1
- package/src/index.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export { useCopilotAction, useCopilotChat, useCopilotReadable } from '@copilotkit/react-core';
|
|
4
4
|
export { ActionExecutionMessage, Role, TextMessage } from '@copilotkit/runtime-client-gql';
|
|
5
|
-
import * as
|
|
6
|
-
export * from '@anker-in/
|
|
5
|
+
import * as swr_dist_mutation from 'swr/dist/mutation';
|
|
6
|
+
export * from '@anker-in/lib';
|
|
7
7
|
|
|
8
8
|
interface ChatProps {
|
|
9
9
|
title: string;
|
|
@@ -131,7 +131,7 @@ declare function useCreditsContext(): {
|
|
|
131
131
|
};
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
declare const useUploadReceipt: () =>
|
|
134
|
+
declare const useUploadReceipt: () => swr_dist_mutation.SWRMutationResponse<{
|
|
135
135
|
ok: boolean;
|
|
136
136
|
code: number;
|
|
137
137
|
}, any, "/api/multipass/mktsrv/v1/credit/upload_third_party_order", {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export { useCopilotAction, useCopilotChat, useCopilotReadable } from '@copilotkit/react-core';
|
|
4
4
|
export { ActionExecutionMessage, Role, TextMessage } from '@copilotkit/runtime-client-gql';
|
|
5
|
-
import * as
|
|
6
|
-
export * from '@anker-in/
|
|
5
|
+
import * as swr_dist_mutation from 'swr/dist/mutation';
|
|
6
|
+
export * from '@anker-in/lib';
|
|
7
7
|
|
|
8
8
|
interface ChatProps {
|
|
9
9
|
title: string;
|
|
@@ -131,7 +131,7 @@ declare function useCreditsContext(): {
|
|
|
131
131
|
};
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
declare const useUploadReceipt: () =>
|
|
134
|
+
declare const useUploadReceipt: () => swr_dist_mutation.SWRMutationResponse<{
|
|
135
135
|
ok: boolean;
|
|
136
136
|
code: number;
|
|
137
137
|
}, any, "/api/multipass/mktsrv/v1/credit/upload_third_party_order", {
|
package/dist/index.js
CHANGED
|
@@ -17728,17 +17728,17 @@ function useCreditsContext() {
|
|
|
17728
17728
|
return (0, import_react8.useContext)(CreditsContext);
|
|
17729
17729
|
}
|
|
17730
17730
|
|
|
17731
|
-
// node_modules/swr/dist/mutation/index.mjs
|
|
17731
|
+
// ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/mutation/index.mjs
|
|
17732
17732
|
var import_react12 = __toESM(require("react"), 1);
|
|
17733
17733
|
|
|
17734
|
-
// node_modules/swr/dist/index/index.mjs
|
|
17734
|
+
// ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/index/index.mjs
|
|
17735
17735
|
var import_react11 = __toESM(require("react"), 1);
|
|
17736
17736
|
var import_shim = __toESM(require_shim(), 1);
|
|
17737
17737
|
|
|
17738
|
-
// node_modules/swr/dist/_internal/config-context-client-
|
|
17738
|
+
// ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/_internal/config-context-client-v7VOFo66.mjs
|
|
17739
17739
|
var import_react9 = __toESM(require("react"), 1);
|
|
17740
17740
|
|
|
17741
|
-
// node_modules/swr/dist/_internal/events.mjs
|
|
17741
|
+
// ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/_internal/events.mjs
|
|
17742
17742
|
var events_exports = {};
|
|
17743
17743
|
__export(events_exports, {
|
|
17744
17744
|
ERROR_REVALIDATE_EVENT: () => ERROR_REVALIDATE_EVENT,
|
|
@@ -17777,7 +17777,7 @@ function dequal(foo, bar) {
|
|
|
17777
17777
|
return foo !== foo && bar !== bar;
|
|
17778
17778
|
}
|
|
17779
17779
|
|
|
17780
|
-
// node_modules/swr/dist/_internal/config-context-client-
|
|
17780
|
+
// ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/_internal/config-context-client-v7VOFo66.mjs
|
|
17781
17781
|
var SWRGlobalState = /* @__PURE__ */ new WeakMap();
|
|
17782
17782
|
var noop = () => {
|
|
17783
17783
|
};
|
|
@@ -17884,15 +17884,13 @@ var slowConnection = !IS_SERVER && navigatorConnection && ([
|
|
|
17884
17884
|
"2g"
|
|
17885
17885
|
].includes(navigatorConnection.effectiveType) || navigatorConnection.saveData);
|
|
17886
17886
|
var table2 = /* @__PURE__ */ new WeakMap();
|
|
17887
|
-
var
|
|
17888
|
-
var isObjectTypeName = (typeName, type) => typeName === `[object ${type}]`;
|
|
17887
|
+
var isObjectType = (value, type) => OBJECT.prototype.toString.call(value) === `[object ${type}]`;
|
|
17889
17888
|
var counter = 0;
|
|
17890
17889
|
var stableHash = (arg) => {
|
|
17891
17890
|
const type = typeof arg;
|
|
17892
|
-
const
|
|
17893
|
-
const
|
|
17894
|
-
const
|
|
17895
|
-
const isPlainObject2 = isObjectTypeName(typeName, "Object");
|
|
17891
|
+
const isDate = isObjectType(arg, "Date");
|
|
17892
|
+
const isRegex = isObjectType(arg, "RegExp");
|
|
17893
|
+
const isPlainObject2 = isObjectType(arg, "Object");
|
|
17896
17894
|
let result;
|
|
17897
17895
|
let index2;
|
|
17898
17896
|
if (OBJECT(arg) === arg && !isDate && !isRegex) {
|
|
@@ -17991,7 +17989,6 @@ async function internalMutate(...args) {
|
|
|
17991
17989
|
}
|
|
17992
17990
|
let data = _data;
|
|
17993
17991
|
let error;
|
|
17994
|
-
let isError = false;
|
|
17995
17992
|
const beforeMutationTs = getTimestamp();
|
|
17996
17993
|
MUTATION[key] = [
|
|
17997
17994
|
beforeMutationTs,
|
|
@@ -18014,18 +18011,16 @@ async function internalMutate(...args) {
|
|
|
18014
18011
|
data = data(committedData);
|
|
18015
18012
|
} catch (err) {
|
|
18016
18013
|
error = err;
|
|
18017
|
-
isError = true;
|
|
18018
18014
|
}
|
|
18019
18015
|
}
|
|
18020
18016
|
if (data && isPromiseLike(data)) {
|
|
18021
18017
|
data = await data.catch((err) => {
|
|
18022
18018
|
error = err;
|
|
18023
|
-
isError = true;
|
|
18024
18019
|
});
|
|
18025
18020
|
if (beforeMutationTs !== MUTATION[key][0]) {
|
|
18026
|
-
if (
|
|
18021
|
+
if (error) throw error;
|
|
18027
18022
|
return data;
|
|
18028
|
-
} else if (
|
|
18023
|
+
} else if (error && hasOptimisticData && rollbackOnError(error)) {
|
|
18029
18024
|
populateCache = true;
|
|
18030
18025
|
set({
|
|
18031
18026
|
data: committedData,
|
|
@@ -18034,7 +18029,7 @@ async function internalMutate(...args) {
|
|
|
18034
18029
|
}
|
|
18035
18030
|
}
|
|
18036
18031
|
if (populateCache) {
|
|
18037
|
-
if (!
|
|
18032
|
+
if (!error) {
|
|
18038
18033
|
if (isFunction(populateCache)) {
|
|
18039
18034
|
const populateCachedData = populateCache(data, committedData);
|
|
18040
18035
|
set({
|
|
@@ -18057,7 +18052,7 @@ async function internalMutate(...args) {
|
|
|
18057
18052
|
_c: UNDEFINED
|
|
18058
18053
|
});
|
|
18059
18054
|
});
|
|
18060
|
-
if (
|
|
18055
|
+
if (error) {
|
|
18061
18056
|
if (throwOnError) throw error;
|
|
18062
18057
|
return;
|
|
18063
18058
|
}
|
|
@@ -18215,10 +18210,10 @@ var SWRConfig = (props) => {
|
|
|
18215
18210
|
}));
|
|
18216
18211
|
};
|
|
18217
18212
|
|
|
18218
|
-
// node_modules/swr/dist/_internal/constants.mjs
|
|
18213
|
+
// ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/_internal/constants.mjs
|
|
18219
18214
|
var INFINITE_PREFIX = "$inf$";
|
|
18220
18215
|
|
|
18221
|
-
// node_modules/swr/dist/_internal/index.mjs
|
|
18216
|
+
// ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/_internal/index.mjs
|
|
18222
18217
|
var import_react10 = __toESM(require("react"), 1);
|
|
18223
18218
|
var enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;
|
|
18224
18219
|
var use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];
|
|
@@ -18239,11 +18234,7 @@ var normalize2 = (args) => {
|
|
|
18239
18234
|
];
|
|
18240
18235
|
};
|
|
18241
18236
|
var useSWRConfig = () => {
|
|
18242
|
-
|
|
18243
|
-
const mergedConfig = (0, import_react10.useMemo)(() => mergeObjects(defaultConfig, parentConfig), [
|
|
18244
|
-
parentConfig
|
|
18245
|
-
]);
|
|
18246
|
-
return mergedConfig;
|
|
18237
|
+
return mergeObjects(defaultConfig, (0, import_react10.useContext)(SWRConfigContext));
|
|
18247
18238
|
};
|
|
18248
18239
|
var middleware = (useSWRNext) => (key_, fetcher_, config) => {
|
|
18249
18240
|
const fetcher3 = fetcher_ && ((...args) => {
|
|
@@ -18297,7 +18288,7 @@ var withMiddleware = (useSWR2, middleware2) => {
|
|
|
18297
18288
|
};
|
|
18298
18289
|
setupDevTools();
|
|
18299
18290
|
|
|
18300
|
-
// node_modules/swr/dist/index/index.mjs
|
|
18291
|
+
// ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/index/index.mjs
|
|
18301
18292
|
var noop2 = () => {
|
|
18302
18293
|
};
|
|
18303
18294
|
var UNDEFINED2 = (
|
|
@@ -18331,7 +18322,6 @@ var use2 = import_react11.default.use || // This extra generic is to avoid TypeS
|
|
|
18331
18322
|
var WITH_DEDUPE = {
|
|
18332
18323
|
dedupe: true
|
|
18333
18324
|
};
|
|
18334
|
-
var resolvedUndef = Promise.resolve(UNDEFINED);
|
|
18335
18325
|
var useSWRHandler = (_key, fetcher3, config) => {
|
|
18336
18326
|
const { cache: cache2, compare: compare2, suspense, fallbackData, revalidateOnMount, revalidateIfStale, refreshInterval, refreshWhenHidden, refreshWhenOffline, keepPreviousData } = config;
|
|
18337
18327
|
const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache2);
|
|
@@ -18619,12 +18609,10 @@ var useSWRHandler = (_key, fetcher3, config) => {
|
|
|
18619
18609
|
_k: fnArg
|
|
18620
18610
|
});
|
|
18621
18611
|
if (shouldDoInitialRevalidation) {
|
|
18622
|
-
if (
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
rAF(softRevalidate);
|
|
18627
|
-
}
|
|
18612
|
+
if (isUndefined(data) || IS_SERVER) {
|
|
18613
|
+
softRevalidate();
|
|
18614
|
+
} else {
|
|
18615
|
+
rAF(softRevalidate);
|
|
18628
18616
|
}
|
|
18629
18617
|
}
|
|
18630
18618
|
return () => {
|
|
@@ -18663,28 +18651,28 @@ var useSWRHandler = (_key, fetcher3, config) => {
|
|
|
18663
18651
|
key
|
|
18664
18652
|
]);
|
|
18665
18653
|
(0, import_react11.useDebugValue)(returnedData);
|
|
18666
|
-
if (suspense) {
|
|
18667
|
-
|
|
18668
|
-
if (!IS_REACT_LEGACY && IS_SERVER && hasKeyButNoData) {
|
|
18654
|
+
if (suspense && isUndefined(data) && key) {
|
|
18655
|
+
if (!IS_REACT_LEGACY && IS_SERVER) {
|
|
18669
18656
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
18670
18657
|
}
|
|
18671
|
-
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
unmountedRef.current = false;
|
|
18675
|
-
}
|
|
18658
|
+
fetcherRef.current = fetcher3;
|
|
18659
|
+
configRef.current = config;
|
|
18660
|
+
unmountedRef.current = false;
|
|
18676
18661
|
const req = PRELOAD[key];
|
|
18677
|
-
|
|
18678
|
-
|
|
18679
|
-
|
|
18680
|
-
throw error;
|
|
18662
|
+
if (!isUndefined(req)) {
|
|
18663
|
+
const promise = boundMutate(req);
|
|
18664
|
+
use2(promise);
|
|
18681
18665
|
}
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18666
|
+
if (isUndefined(error)) {
|
|
18667
|
+
const promise = revalidate(WITH_DEDUPE);
|
|
18668
|
+
if (!isUndefined(returnedData)) {
|
|
18669
|
+
promise.status = "fulfilled";
|
|
18670
|
+
promise.value = true;
|
|
18671
|
+
}
|
|
18672
|
+
use2(promise);
|
|
18673
|
+
} else {
|
|
18674
|
+
throw error;
|
|
18686
18675
|
}
|
|
18687
|
-
use2(revalidation);
|
|
18688
18676
|
}
|
|
18689
18677
|
const swrResponse = {
|
|
18690
18678
|
mutate: boundMutate,
|
|
@@ -18712,7 +18700,7 @@ var SWRConfig2 = OBJECT.defineProperty(SWRConfig, "defaultValue", {
|
|
|
18712
18700
|
});
|
|
18713
18701
|
var useSWR = withArgs(useSWRHandler);
|
|
18714
18702
|
|
|
18715
|
-
// node_modules/swr/dist/mutation/index.mjs
|
|
18703
|
+
// ../../node_modules/.pnpm/swr@2.3.3_react@18.3.1/node_modules/swr/dist/mutation/index.mjs
|
|
18716
18704
|
var startTransition = IS_REACT_LEGACY ? (cb) => {
|
|
18717
18705
|
cb();
|
|
18718
18706
|
} : import_react12.default.startTransition;
|
|
@@ -19526,7 +19514,7 @@ var import_react18 = require("react");
|
|
|
19526
19514
|
// src/components/credits/context/hooks/useAlpcFetch.ts
|
|
19527
19515
|
var import_js_cookie2 = __toESM(require_js_cookie());
|
|
19528
19516
|
var import_react17 = require("react");
|
|
19529
|
-
var
|
|
19517
|
+
var import_lib25 = require("@anker-in/lib");
|
|
19530
19518
|
var reAuthPromise;
|
|
19531
19519
|
var fetcher2 = (options) => {
|
|
19532
19520
|
return fetch(getAlpcPath(options.locale) + options.url, options.fetchOptions).then(async (response) => {
|
|
@@ -19648,7 +19636,7 @@ var useMutation = (url, fetcher3, mutationConfig = {}) => {
|
|
|
19648
19636
|
var useAlpcMutation = (options, mutationOptions) => {
|
|
19649
19637
|
const [retry, setRetry] = (0, import_react17.useState)(false);
|
|
19650
19638
|
const { removeProfile } = useCreditsContext();
|
|
19651
|
-
const { locale = "", brand } = (0,
|
|
19639
|
+
const { locale = "", brand } = (0, import_lib25.useHeadlessContext)();
|
|
19652
19640
|
const { url, initData, headers, ...fetchOptions } = options;
|
|
19653
19641
|
const context = useMutation(
|
|
19654
19642
|
url,
|
|
@@ -19685,10 +19673,10 @@ var useAlpcMutation = (options, mutationOptions) => {
|
|
|
19685
19673
|
};
|
|
19686
19674
|
|
|
19687
19675
|
// src/components/credits/context/hooks/useActivities.ts
|
|
19688
|
-
var
|
|
19676
|
+
var import_lib26 = require("@anker-in/lib");
|
|
19689
19677
|
function useActivities({ page, pageSize, options = {} }) {
|
|
19690
19678
|
const { profile, isLoadingProfile } = useCreditsContext();
|
|
19691
|
-
const { brand } = (0,
|
|
19679
|
+
const { brand } = (0, import_lib26.useHeadlessContext)();
|
|
19692
19680
|
const [activities, setActivities] = (0, import_react18.useState)([]);
|
|
19693
19681
|
const [total, setTotal] = (0, import_react18.useState)(0);
|
|
19694
19682
|
const [currentPage, setCurrentPage] = (0, import_react18.useState)(0);
|
|
@@ -20045,14 +20033,14 @@ var tip_default = Tip;
|
|
|
20045
20033
|
|
|
20046
20034
|
// src/components/credits/context/hooks/useMyRewards.ts
|
|
20047
20035
|
var import_react21 = require("react");
|
|
20048
|
-
var
|
|
20036
|
+
var import_lib27 = require("@anker-in/lib");
|
|
20049
20037
|
function useMyRewards({
|
|
20050
20038
|
page,
|
|
20051
20039
|
pageSize,
|
|
20052
20040
|
consumeType
|
|
20053
20041
|
}) {
|
|
20054
20042
|
const { isLoadingProfile, profile } = useCreditsContext();
|
|
20055
|
-
const { brand, locale, appName } = (0,
|
|
20043
|
+
const { brand, locale, appName } = (0, import_lib27.useHeadlessContext)();
|
|
20056
20044
|
const isLogin = !!profile;
|
|
20057
20045
|
const [myRewards, setMyRewards] = (0, import_react21.useState)([]);
|
|
20058
20046
|
const [total, setTotal] = (0, import_react21.useState)(0);
|
|
@@ -28316,11 +28304,11 @@ var import_react46 = require("react");
|
|
|
28316
28304
|
|
|
28317
28305
|
// src/components/credits/context/hooks/useSubscriptions.ts
|
|
28318
28306
|
var import_react45 = require("react");
|
|
28319
|
-
var
|
|
28307
|
+
var import_lib28 = require("@anker-in/lib");
|
|
28320
28308
|
function useSubscriptions(email) {
|
|
28321
28309
|
const loading = (0, import_react45.useRef)(false);
|
|
28322
28310
|
const [subscriptionData, setSubscriptionData] = (0, import_react45.useState)();
|
|
28323
|
-
const { locale } = (0,
|
|
28311
|
+
const { locale } = (0, import_lib28.useHeadlessContext)();
|
|
28324
28312
|
const fetchSubscription = (0, import_react45.useCallback)(async () => {
|
|
28325
28313
|
if (!email) {
|
|
28326
28314
|
return;
|
|
@@ -28360,10 +28348,10 @@ function useSubscriptions(email) {
|
|
|
28360
28348
|
var useSubscriptions_default = useSubscriptions;
|
|
28361
28349
|
|
|
28362
28350
|
// src/components/credits/context/hooks/useSubscribed.ts
|
|
28363
|
-
var
|
|
28351
|
+
var import_lib29 = require("@anker-in/lib");
|
|
28364
28352
|
var useSubscribed = () => {
|
|
28365
28353
|
const { profile } = useCreditsContext();
|
|
28366
|
-
const { brand } = (0,
|
|
28354
|
+
const { brand } = (0, import_lib29.useHeadlessContext)();
|
|
28367
28355
|
const activitiesOptions = (0, import_react46.useMemo)(() => ({ page: 1, pageSize: 50 }), []);
|
|
28368
28356
|
const { activities } = useActivities_default(activitiesOptions);
|
|
28369
28357
|
const { subscriptionData } = useSubscriptions_default(profile == null ? void 0 : profile.email);
|
|
@@ -28385,7 +28373,7 @@ var useSubscribed = () => {
|
|
|
28385
28373
|
};
|
|
28386
28374
|
|
|
28387
28375
|
// src/components/credits/creditsWaysToGetCredits/useActions.ts
|
|
28388
|
-
var
|
|
28376
|
+
var import_lib30 = require("@anker-in/lib");
|
|
28389
28377
|
var useActions = ({
|
|
28390
28378
|
copy,
|
|
28391
28379
|
subscribe,
|
|
@@ -28397,7 +28385,7 @@ var useActions = ({
|
|
|
28397
28385
|
const isSubscribed = useSubscribed();
|
|
28398
28386
|
const firstPurchaseFinished = useFirstPurchaseFinished();
|
|
28399
28387
|
const uploadedReceipt = useReceiptUploaded_default();
|
|
28400
|
-
const { appName, passportUrl } = (0,
|
|
28388
|
+
const { appName, passportUrl } = (0, import_lib30.useHeadlessContext)();
|
|
28401
28389
|
console.log("passportUrl", passportUrl);
|
|
28402
28390
|
const profileCompleted = (0, import_react47.useMemo)(() => {
|
|
28403
28391
|
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);
|
|
@@ -28899,9 +28887,9 @@ var import_headless_ui12 = require("@anker-in/headless-ui");
|
|
|
28899
28887
|
var import_react51 = require("react");
|
|
28900
28888
|
|
|
28901
28889
|
// src/components/credits/context/hooks/useRedeemCoupon.ts
|
|
28902
|
-
var
|
|
28890
|
+
var import_lib31 = require("@anker-in/lib");
|
|
28903
28891
|
var useRedeemCoupon = (mutationOptions = {}) => {
|
|
28904
|
-
const { locale, appName, brand } = (0,
|
|
28892
|
+
const { locale, appName, brand } = (0, import_lib31.useHeadlessContext)();
|
|
28905
28893
|
return useAlpcMutation(
|
|
28906
28894
|
{
|
|
28907
28895
|
url: `/v1/credit/redeem/coupon`,
|
|
@@ -28916,11 +28904,11 @@ var useRedeemCoupon = (mutationOptions = {}) => {
|
|
|
28916
28904
|
};
|
|
28917
28905
|
|
|
28918
28906
|
// src/components/credits/context/hooks/useRedeemAndBuy.ts
|
|
28919
|
-
var
|
|
28907
|
+
var import_lib32 = require("@anker-in/lib");
|
|
28920
28908
|
var useRedeemAndBuy = (_, swrOptions) => {
|
|
28921
28909
|
const { trigger } = useRedeemCoupon();
|
|
28922
28910
|
const { profile } = useCreditsContext();
|
|
28923
|
-
const { trigger: buyNow } = (0,
|
|
28911
|
+
const { trigger: buyNow } = (0, import_lib32.useBuyNow)(
|
|
28924
28912
|
{},
|
|
28925
28913
|
{
|
|
28926
28914
|
throwOnError: true
|
|
@@ -29152,12 +29140,12 @@ var RedeemableItem_default = RedeemableItem;
|
|
|
29152
29140
|
|
|
29153
29141
|
// src/components/credits/context/hooks/useRedeemableList.ts
|
|
29154
29142
|
var import_react52 = require("react");
|
|
29155
|
-
var
|
|
29143
|
+
var import_lib33 = require("@anker-in/lib");
|
|
29156
29144
|
function useRedeemableList() {
|
|
29157
29145
|
var _a;
|
|
29158
29146
|
let locale = "";
|
|
29159
29147
|
const { profile, isLoadingProfile } = useCreditsContext();
|
|
29160
|
-
const { locale: contextLocale, brand } = (0,
|
|
29148
|
+
const { locale: contextLocale, brand } = (0, import_lib33.useHeadlessContext)();
|
|
29161
29149
|
if (contextLocale === "pl") {
|
|
29162
29150
|
locale = "eu";
|
|
29163
29151
|
} else {
|
|
@@ -29255,7 +29243,7 @@ function RulesModal({
|
|
|
29255
29243
|
var rulesModal_default = RulesModal;
|
|
29256
29244
|
|
|
29257
29245
|
// src/components/credits/creditsCash/index.tsx
|
|
29258
|
-
var
|
|
29246
|
+
var import_lib34 = require("@anker-in/lib");
|
|
29259
29247
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
29260
29248
|
var CreditsCash = ({
|
|
29261
29249
|
copy,
|
|
@@ -29269,7 +29257,7 @@ var CreditsCash = ({
|
|
|
29269
29257
|
const { redeemableList } = useRedeemableList_default();
|
|
29270
29258
|
const locale = "us";
|
|
29271
29259
|
const variantMetafieldIdentifiers = [];
|
|
29272
|
-
const { data: productByHandles } = (0,
|
|
29260
|
+
const { data: productByHandles } = (0, import_lib34.useProductsByHandles)({
|
|
29273
29261
|
locale,
|
|
29274
29262
|
handles: ((_a = copy == null ? void 0 : copy.list) == null ? void 0 : _a.map((item) => {
|
|
29275
29263
|
var _a2, _b;
|
|
@@ -29385,7 +29373,7 @@ var useCopy = () => {
|
|
|
29385
29373
|
var useCopy_default = useCopy;
|
|
29386
29374
|
|
|
29387
29375
|
// src/components/credits/creditsRedeemList/RedeemCouponModal.tsx
|
|
29388
|
-
var
|
|
29376
|
+
var import_lib35 = require("@anker-in/lib");
|
|
29389
29377
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
29390
29378
|
function RedeemCouponModal({
|
|
29391
29379
|
item,
|
|
@@ -29394,7 +29382,7 @@ function RedeemCouponModal({
|
|
|
29394
29382
|
...props
|
|
29395
29383
|
}) {
|
|
29396
29384
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
29397
|
-
const { locale } = (0,
|
|
29385
|
+
const { locale } = (0, import_lib35.useHeadlessContext)();
|
|
29398
29386
|
const [couponCode, setCouponCode] = (0, import_react56.useState)();
|
|
29399
29387
|
const [errorInfo, setErrorInfo] = (0, import_react56.useState)();
|
|
29400
29388
|
const [disabled, setDisabled] = (0, import_react56.useState)(false);
|
|
@@ -29585,9 +29573,9 @@ var import_react65 = require("react");
|
|
|
29585
29573
|
|
|
29586
29574
|
// src/components/credits/context/hooks/useCountries.ts
|
|
29587
29575
|
var import_react57 = require("react");
|
|
29588
|
-
var
|
|
29576
|
+
var import_lib36 = require("@anker-in/lib");
|
|
29589
29577
|
function useCountries({ shopifyStoreDomain }) {
|
|
29590
|
-
const { locale = "" } = (0,
|
|
29578
|
+
const { locale = "" } = (0, import_lib36.useHeadlessContext)();
|
|
29591
29579
|
const [isLoading, setLoading] = (0, import_react57.useState)(false);
|
|
29592
29580
|
const [countries, setCountries] = (0, import_react57.useState)([]);
|
|
29593
29581
|
(0, import_react57.useEffect)(() => {
|
|
@@ -29629,7 +29617,7 @@ var useCountries_default = useCountries;
|
|
|
29629
29617
|
|
|
29630
29618
|
// src/components/credits/context/hooks/useAddressValidate.ts
|
|
29631
29619
|
var import_react58 = require("react");
|
|
29632
|
-
var
|
|
29620
|
+
var import_lib37 = require("@anker-in/lib");
|
|
29633
29621
|
var US_SPECIAL_CHARACTERS = /[&%*<>^#;-]/;
|
|
29634
29622
|
var EU_SPECIAL_CHARACTERS = /[&^*%<>;,?]/;
|
|
29635
29623
|
var SC_CHARACTERS = /[^a-zA-Z0-9\s]/;
|
|
@@ -29700,7 +29688,7 @@ var useAddressValidate = ({
|
|
|
29700
29688
|
formData,
|
|
29701
29689
|
errorLabel
|
|
29702
29690
|
}) => {
|
|
29703
|
-
const { locale } = (0,
|
|
29691
|
+
const { locale } = (0, import_lib37.useHeadlessContext)();
|
|
29704
29692
|
const [errors, setErrors] = (0, import_react58.useState)([]);
|
|
29705
29693
|
const addressRules = (0, import_react58.useMemo)(() => {
|
|
29706
29694
|
const {
|
|
@@ -29838,10 +29826,10 @@ var useAddressValidate = ({
|
|
|
29838
29826
|
};
|
|
29839
29827
|
|
|
29840
29828
|
// src/components/credits/context/hooks/useRedeemProduct.ts
|
|
29841
|
-
var
|
|
29829
|
+
var import_lib38 = require("@anker-in/lib");
|
|
29842
29830
|
var useRedeemProduct = (mutationOptions = {}) => {
|
|
29843
29831
|
var _a;
|
|
29844
|
-
const { storeDomain, locale, appName, brand } = (0,
|
|
29832
|
+
const { storeDomain, locale, appName, brand } = (0, import_lib38.useHeadlessContext)();
|
|
29845
29833
|
return useAlpcMutation(
|
|
29846
29834
|
{
|
|
29847
29835
|
url: `/v1/credit/exchange/goods`,
|
|
@@ -29858,7 +29846,7 @@ var useRedeemProduct = (mutationOptions = {}) => {
|
|
|
29858
29846
|
};
|
|
29859
29847
|
|
|
29860
29848
|
// src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx
|
|
29861
|
-
var
|
|
29849
|
+
var import_lib42 = require("@anker-in/lib");
|
|
29862
29850
|
|
|
29863
29851
|
// src/components/credits/creditsRedeemList/RedeemProductModal/Error.tsx
|
|
29864
29852
|
var import_headless_ui16 = require("@anker-in/headless-ui");
|
|
@@ -29876,11 +29864,11 @@ var import_classnames6 = __toESM(require_classnames());
|
|
|
29876
29864
|
|
|
29877
29865
|
// src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx
|
|
29878
29866
|
var import_headless_ui17 = require("@anker-in/headless-ui");
|
|
29879
|
-
var
|
|
29867
|
+
var import_lib39 = require("@anker-in/lib");
|
|
29880
29868
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
29881
29869
|
var ProductInfo = ({ item, copy }) => {
|
|
29882
29870
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
29883
|
-
const { locale } = (0,
|
|
29871
|
+
const { locale } = (0, import_lib39.useHeadlessContext)();
|
|
29884
29872
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex w-full items-center justify-center md:items-start md:justify-start", children: [
|
|
29885
29873
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
29886
29874
|
import_headless_ui17.Picture,
|
|
@@ -30278,11 +30266,11 @@ function StateSelect({ states, stateName = "", stateCode = "", className = "", o
|
|
|
30278
30266
|
}
|
|
30279
30267
|
|
|
30280
30268
|
// src/components/credits/creditsRedeemList/AddressForm/index.tsx
|
|
30281
|
-
var
|
|
30269
|
+
var import_lib40 = require("@anker-in/lib");
|
|
30282
30270
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
30283
30271
|
var AddressForm = ({ countries, countriesLoading, form, validate, errors, onChange }) => {
|
|
30284
30272
|
const { profile, customer } = useCreditsContext();
|
|
30285
|
-
const { locale } = (0,
|
|
30273
|
+
const { locale } = (0, import_lib40.useHeadlessContext)();
|
|
30286
30274
|
const [address, setAddress] = (0, import_react63.useState)();
|
|
30287
30275
|
const states = (0, import_react63.useMemo)(() => {
|
|
30288
30276
|
const currentCountry = countries.find((item) => item.code === (address == null ? void 0 : address.country));
|
|
@@ -30406,7 +30394,7 @@ var AddressForm = ({ countries, countriesLoading, form, validate, errors, onChan
|
|
|
30406
30394
|
};
|
|
30407
30395
|
|
|
30408
30396
|
// src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx
|
|
30409
|
-
var
|
|
30397
|
+
var import_lib41 = require("@anker-in/lib");
|
|
30410
30398
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
30411
30399
|
var Address = ({
|
|
30412
30400
|
copy,
|
|
@@ -30421,7 +30409,7 @@ var Address = ({
|
|
|
30421
30409
|
handlePayment,
|
|
30422
30410
|
item
|
|
30423
30411
|
}) => {
|
|
30424
|
-
const { storeDomain } = (0,
|
|
30412
|
+
const { storeDomain } = (0, import_lib41.useHeadlessContext)();
|
|
30425
30413
|
const { countries = [], isLoading: countriesLoading } = useCountries_default({ shopifyStoreDomain: storeDomain });
|
|
30426
30414
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "relative", children: [
|
|
30427
30415
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: (0, import_classnames11.default)("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
|
|
@@ -30576,7 +30564,7 @@ var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
|
30576
30564
|
function RedeemProductModal({ item, copy, onError, ...props }) {
|
|
30577
30565
|
var _a;
|
|
30578
30566
|
const { fetchCreditInfo, profile } = useCreditsContext();
|
|
30579
|
-
const { storeDomain, locale } = (0,
|
|
30567
|
+
const { storeDomain, locale } = (0, import_lib42.useHeadlessContext)();
|
|
30580
30568
|
const { validatorInfo } = copy;
|
|
30581
30569
|
const { shippingAddress, shippingProduct } = copy.redeemModal.product;
|
|
30582
30570
|
const [status, setStatus] = (0, import_react65.useState)("init");
|
|
@@ -30735,7 +30723,7 @@ function RedeemProductModal({ item, copy, onError, ...props }) {
|
|
|
30735
30723
|
var RedeemProductModal_default = RedeemProductModal;
|
|
30736
30724
|
|
|
30737
30725
|
// src/components/credits/creditsRedeemList/index.tsx
|
|
30738
|
-
var
|
|
30726
|
+
var import_lib43 = require("@anker-in/lib");
|
|
30739
30727
|
|
|
30740
30728
|
// src/components/credits/creditsRedeemList/RedeemableItem.tsx
|
|
30741
30729
|
var import_headless_ui24 = require("@anker-in/headless-ui");
|
|
@@ -30963,7 +30951,7 @@ function CreditsRedeemList({
|
|
|
30963
30951
|
});
|
|
30964
30952
|
}, [copy.list, activeTab, redeemableList]);
|
|
30965
30953
|
const handles = alpcList.map((item) => item.handle);
|
|
30966
|
-
const { data: products } = (0,
|
|
30954
|
+
const { data: products } = (0, import_lib43.useProductsByHandles)({ handles });
|
|
30967
30955
|
const list3 = (0, import_react67.useMemo)(() => {
|
|
30968
30956
|
const currentList = copy.list.find((item) => item.label === activeTab);
|
|
30969
30957
|
return currentList == null ? void 0 : currentList.list.filter((item) => alpcList.some((alpcItem) => alpcItem.id === item.id)).map((item) => {
|
|
@@ -31084,7 +31072,7 @@ function CreditsRedeemList({
|
|
|
31084
31072
|
}
|
|
31085
31073
|
|
|
31086
31074
|
// src/index.ts
|
|
31087
|
-
__reExport(index_exports, require("@anker-in/
|
|
31075
|
+
__reExport(index_exports, require("@anker-in/lib"), module.exports);
|
|
31088
31076
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31089
31077
|
0 && (module.exports = {
|
|
31090
31078
|
ActionExecutionMessage,
|
|
@@ -31105,7 +31093,7 @@ __reExport(index_exports, require("@anker-in/shopify"), module.exports);
|
|
|
31105
31093
|
useCopilotReadable,
|
|
31106
31094
|
useCreditsContext,
|
|
31107
31095
|
useCreditsUploadReceipt,
|
|
31108
|
-
...require("@anker-in/
|
|
31096
|
+
...require("@anker-in/lib")
|
|
31109
31097
|
});
|
|
31110
31098
|
/*! Bundled license information:
|
|
31111
31099
|
|