@odynn/awayz-core 0.2.28 → 0.2.30

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/{AccountService-B-dpvIRm.js → AccountService-BLoJ4G-f.js} +1490 -1483
  2. package/dist/assets/_styles.css +1 -1
  3. package/dist/components/CashValue/CashValue.js +203 -199
  4. package/dist/components/CashValue/CashValue.stories.js +95 -0
  5. package/dist/components/CashValue/CashValueTypes.js +2 -2
  6. package/dist/components/index.js +5 -4
  7. package/dist/hooks/useAwayzAuth/useAwayzAuth.js +1 -1
  8. package/dist/hooks/useSearchLimit.js +1 -1
  9. package/dist/hooks/useWallet/useWallet.js +4 -3
  10. package/dist/hooks/useWallet/useWallet.test.js +2 -1
  11. package/dist/lib/components/CashValue/CashValue.d.ts +33 -1
  12. package/dist/lib/components/CashValue/CashValue.stories.d.ts +36 -0
  13. package/dist/lib/components/CashValue/CashValueTypes.d.ts +3 -2
  14. package/dist/lib/components/index.d.ts +1 -0
  15. package/dist/lib/configs/awayzConfig.d.ts +4 -0
  16. package/dist/lib/hooks/useWallet/useWallet.d.ts +7 -7
  17. package/dist/lib/main.d.ts +1 -3
  18. package/dist/lib/services/index.d.ts +4 -0
  19. package/dist/lib/services/instanceConfig.d.ts +67 -0
  20. package/dist/lib/services/noRetryInstance.d.ts +1 -0
  21. package/dist/main.js +22 -19
  22. package/dist/providers/AwayzProvider.js +23 -22
  23. package/dist/services/account/AccountService.js +1 -1
  24. package/dist/services/currency/CurrencyService.js +8 -7
  25. package/dist/services/index.js +9 -0
  26. package/dist/services/instance.js +3 -5
  27. package/dist/services/instanceConfig.js +13 -0
  28. package/dist/services/noRetryInstance.js +10 -0
  29. package/dist/services/wallet/WalletService.js +7 -6
  30. package/package.json +1 -1
@@ -0,0 +1,95 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { CashValue as r } from "./CashValue.js";
3
+ import { AwayzProvider as a } from "../../providers/AwayzProvider.js";
4
+ import "react";
5
+ import "../../context/AwayzContext.js";
6
+ import "../../AccountService-BLoJ4G-f.js";
7
+ import "../../configs/awayzClient.js";
8
+ import "@tanstack/react-query";
9
+ import { EAuthFlow as s } from "../../types/EAuthFlow.js";
10
+ import "../../services/noRetryInstance.js";
11
+ import { EToolTipPosition as t, EInvalidAmountDisplayOption as o } from "./CashValueTypes.js";
12
+ const f = {
13
+ title: "Core/Cash Value",
14
+ component: r,
15
+ parameters: {
16
+ layout: "centered"
17
+ },
18
+ argTypes: {
19
+ // Dropdown options for the EInvalidAmountDisplayOption enum
20
+ zeroDisplayOption: {
21
+ options: Object.values(o),
22
+ mapping: Object.values(o),
23
+ control: {
24
+ type: "select",
25
+ labels: Object.keys(o)
26
+ }
27
+ },
28
+ // Dropdown options for the EToolTipPosition enum
29
+ position: {
30
+ options: Object.values(t),
31
+ mapping: Object.values(t),
32
+ control: {
33
+ type: "select",
34
+ labels: Object.keys(t)
35
+ }
36
+ }
37
+ },
38
+ tags: ["autodocs"],
39
+ decorators: [
40
+ (n) => /* @__PURE__ */ e(
41
+ a,
42
+ {
43
+ config: {
44
+ authFlow: s.STANDARD,
45
+ clientId: void 0,
46
+ trustedOrigins: ["*"],
47
+ testMode: !0,
48
+ debugRefreshToken: void 0
49
+ },
50
+ children: /* @__PURE__ */ e(n, {})
51
+ }
52
+ )
53
+ ]
54
+ }, v = {
55
+ name: "Euro to Dollar Cash Value",
56
+ args: {
57
+ amount: 100,
58
+ currency: "EUR"
59
+ }
60
+ }, D = {
61
+ name: "Invalid Amount",
62
+ args: {
63
+ amount: "invalid",
64
+ currency: "EUR"
65
+ }
66
+ }, E = {
67
+ name: "Zero Amount with Display as Zero",
68
+ args: {
69
+ amount: 0,
70
+ zeroDisplayOption: o.DISPLAY_AS_ZERO,
71
+ currency: "EUR"
72
+ }
73
+ }, b = {
74
+ name: "Negative Amount",
75
+ args: {
76
+ amount: -100,
77
+ currency: "EUR"
78
+ }
79
+ }, h = {
80
+ name: "Custom Zero Amount",
81
+ args: {
82
+ amount: 0,
83
+ currency: "EUR",
84
+ zeroDisplayOption: o.CUSTOM,
85
+ customDisplay: "No fee"
86
+ }
87
+ };
88
+ export {
89
+ h as CustomZeroAmount,
90
+ v as Default,
91
+ D as InvalidAmount,
92
+ b as NegativeAmount,
93
+ E as ZeroAmount,
94
+ f as default
95
+ };
@@ -1,5 +1,5 @@
1
- var e = /* @__PURE__ */ ((r) => (r.TOP = "top", r.BOTTOM = "bottom", r.RIGHT = "right", r.LEFT = "left", r))(e || {}), A = /* @__PURE__ */ ((r) => (r.NA = "N/A", r.HIDDEN = "hidden", r.DISPLAYASZERO = "DisplayAsZero", r))(A || {});
1
+ var e = /* @__PURE__ */ ((r) => (r.TOP = "top", r.BOTTOM = "bottom", r.RIGHT = "right", r.LEFT = "left", r))(e || {}), H = /* @__PURE__ */ ((r) => (r.NA = "N/A", r.HIDDEN = "Hidden", r.DISPLAY_AS_ZERO = "Display as Zero", r.CUSTOM = "Custom", r))(H || {});
2
2
  export {
3
- A as EInvalidAmountDisplayOption,
3
+ H as EInvalidAmountDisplayOption,
4
4
  e as EToolTipPosition
5
5
  };
@@ -1,6 +1,7 @@
1
- import { CashValue as e } from "./CashValue/CashValue.js";
2
- import { EToolTipPosition as p } from "./CashValue/CashValueTypes.js";
1
+ import { CashValue as p } from "./CashValue/CashValue.js";
2
+ import { EInvalidAmountDisplayOption as a, EToolTipPosition as l } from "./CashValue/CashValueTypes.js";
3
3
  export {
4
- e as CashValue,
5
- p as EToolTipPosition
4
+ p as CashValue,
5
+ a as EInvalidAmountDisplayOption,
6
+ l as EToolTipPosition
6
7
  };
@@ -1,4 +1,4 @@
1
- import { A as U, E as r, e as o, a as v } from "../../AccountService-B-dpvIRm.js";
1
+ import { A as U, d as r, e as o, E as v } from "../../AccountService-BLoJ4G-f.js";
2
2
  import { useState as E, useCallback as R, useEffect as y } from "react";
3
3
  import { EAuthFlow as S } from "../../types/EAuthFlow.js";
4
4
  import { awayzClient as A } from "../../configs/awayzClient.js";
@@ -1,4 +1,4 @@
1
- import { a as s, e as i, d as n } from "../AccountService-B-dpvIRm.js";
1
+ import { E as s, e as i, b as n } from "../AccountService-BLoJ4G-f.js";
2
2
  import { useQuery as u } from "@tanstack/react-query";
3
3
  import "react";
4
4
  import { useAwayzContext as c } from "./useAwayzContext.js";
@@ -1,12 +1,13 @@
1
1
  import { useQuery as m, useMutation as p } from "@tanstack/react-query";
2
- import { a as t, b as u } from "../../AccountService-B-dpvIRm.js";
2
+ import { E as t, a as u } from "../../AccountService-BLoJ4G-f.js";
3
3
  import "react";
4
4
  import { WalletService as n } from "../../services/wallet/WalletService.js";
5
5
  import "react/jsx-runtime";
6
6
  import "../../context/AwayzContext.js";
7
7
  import { awayzClient as d } from "../../configs/awayzClient.js";
8
+ import "../../services/noRetryInstance.js";
8
9
  import '../../assets/_styles.css';/* empty css */
9
- const E = () => {
10
+ const B = () => {
10
11
  const { data: r } = m({
11
12
  queryKey: [t.PROGRAMS],
12
13
  queryFn: n.getAwards,
@@ -53,5 +54,5 @@ const E = () => {
53
54
  };
54
55
  };
55
56
  export {
56
- E as useWallet
57
+ B as useWallet
57
58
  };
@@ -6,10 +6,11 @@ import { useWallet as mf } from "./useWallet.js";
6
6
  import "react/jsx-runtime";
7
7
  import "react";
8
8
  import "../../context/AwayzContext.js";
9
- import { c as gf } from "../../AccountService-B-dpvIRm.js";
9
+ import { c as gf } from "../../AccountService-BLoJ4G-f.js";
10
10
  import { EWalletEndpoints as yf } from "../../configs/endpoints.js";
11
11
  import "../../configs/awayzClient.js";
12
12
  import "@tanstack/react-query";
13
+ import "../../services/noRetryInstance.js";
13
14
  /* empty css */
14
15
  var bf = {
15
16
  reset: [0, 0],
@@ -1,9 +1,41 @@
1
1
  import { EToolTipPosition, EInvalidAmountDisplayOption } from './CashValueTypes';
2
2
  export interface ICashValueProps {
3
+ /**
4
+ * The amount of money to be displayed.
5
+ * Can be a number or a string (e.g., "100.50").
6
+ */
3
7
  amount: number | string;
8
+ /**
9
+ * The currency code of the amount (e.g., "USD", "EUR").
10
+ * This is used to determine the conversion rate.
11
+ */
4
12
  currency: string;
13
+ /**
14
+ * The position of the tooltip when the amount is converted.
15
+ * Default is 'right'.
16
+ */
5
17
  position?: EToolTipPosition;
18
+ /**
19
+ * The display option for invalid amounts (e.g., negative values or null).
20
+ * Options include:
21
+ * - EInvalidAmountDisplayOption.NA: Displays "N/A".
22
+ * - EInvalidAmountDisplayOption.HIDDEN: Hides the value.
23
+ * - EInvalidAmountDisplayOption.DISPLAYASZERO: Displays as zero.
24
+ * - EInvalidAmountDisplayOption.CUSTOM: Custom display string.
25
+ */
6
26
  zeroDisplayOption?: EInvalidAmountDisplayOption;
27
+ /**
28
+ * A custom display string for invalid amounts.
29
+ * This is used when zeroDisplayOption is set to EInvalidAmountDisplayOption.CUSTOM.
30
+ */
31
+ customDisplay?: string;
7
32
  }
8
33
  export declare const CurrencyCallStaleTimeMs: number;
9
- export declare const CashValue: ({ amount, currency, position, zeroDisplayOption }: ICashValueProps) => import("react/jsx-runtime").JSX.Element;
34
+ /**
35
+ * A component that displays values with optional currency conversion.
36
+ *
37
+ * This component renders a amount in the user's regional currency.
38
+ * If the original currency differs from the user's currency, it shows a conversion
39
+ * tooltip with details about the conversion rate and original amount.
40
+ */
41
+ export declare const CashValue: ({ amount, currency, position, zeroDisplayOption, customDisplay }: ICashValueProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ import { EInvalidAmountDisplayOption, EToolTipPosition } from './CashValueTypes';
3
+ declare const meta: {
4
+ title: string;
5
+ component: ({ amount, currency, position, zeroDisplayOption, customDisplay }: import('./CashValue').ICashValueProps) => import("react/jsx-runtime").JSX.Element;
6
+ parameters: {
7
+ layout: string;
8
+ };
9
+ argTypes: {
10
+ zeroDisplayOption: {
11
+ options: EInvalidAmountDisplayOption[];
12
+ mapping: EInvalidAmountDisplayOption[];
13
+ control: {
14
+ type: "select";
15
+ labels: string[];
16
+ };
17
+ };
18
+ position: {
19
+ options: EToolTipPosition[];
20
+ mapping: EToolTipPosition[];
21
+ control: {
22
+ type: "select";
23
+ labels: string[];
24
+ };
25
+ };
26
+ };
27
+ tags: string[];
28
+ decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
29
+ };
30
+ export default meta;
31
+ type Story = StoryObj<typeof meta>;
32
+ export declare const Default: Story;
33
+ export declare const InvalidAmount: Story;
34
+ export declare const ZeroAmount: Story;
35
+ export declare const NegativeAmount: Story;
36
+ export declare const CustomZeroAmount: Story;
@@ -23,6 +23,7 @@ export declare enum EToolTipPosition {
23
23
  */
24
24
  export declare enum EInvalidAmountDisplayOption {
25
25
  NA = "N/A",
26
- HIDDEN = "hidden",
27
- DISPLAYASZERO = "DisplayAsZero"
26
+ HIDDEN = "Hidden",
27
+ DISPLAY_AS_ZERO = "Display as Zero",
28
+ CUSTOM = "Custom"
28
29
  }
@@ -1,2 +1,3 @@
1
1
  export { CashValue } from './CashValue/CashValue';
2
2
  export { EToolTipPosition } from './CashValue/CashValueTypes';
3
+ export * from './CashValue/CashValueTypes';
@@ -16,6 +16,10 @@ export interface IAwayzConfig {
16
16
  * Enable test mode to use the Awayz components in a test environment
17
17
  */
18
18
  testMode?: boolean;
19
+ /**
20
+ * For debugging purposes only. This token is used to bypass the authentication flow and is not meant to be used in production.
21
+ */
22
+ debugRefreshToken?: string;
19
23
  /**
20
24
  * Enable non-chain hotels for hotel searches
21
25
  * @default false
@@ -3,13 +3,13 @@ interface ISetAwardPointsRequest {
3
3
  awardsAmount: number;
4
4
  }
5
5
  export declare const useWallet: () => {
6
- allPrograms: import('../../main').ILoyaltyProgram[];
7
- hotelPrograms: import('../../main').ILoyaltyProgram[];
8
- airlinePrograms: import('../../main').ILoyaltyProgram[];
9
- bankPrograms: import('../../main').ILoyaltyProgram[];
6
+ allPrograms: import('../../services').ILoyaltyProgram[];
7
+ hotelPrograms: import('../../services').ILoyaltyProgram[];
8
+ airlinePrograms: import('../../services').ILoyaltyProgram[];
9
+ bankPrograms: import('../../services').ILoyaltyProgram[];
10
10
  updatePoints: import('@tanstack/react-query').UseMutateFunction<void, Error, ISetAwardPointsRequest, unknown>;
11
- getProgramById: (programId: string) => import('../../main').ILoyaltyProgram | null;
12
- banks: import('../../main').IBank[] | undefined;
13
- cards: import('../../main').ICard[] | undefined;
11
+ getProgramById: (programId: string) => import('../../services').ILoyaltyProgram | null;
12
+ banks: import('../../services').IBank[] | undefined;
13
+ cards: import('../../services').ICard[] | undefined;
14
14
  };
15
15
  export {};
@@ -3,9 +3,7 @@ export * from './hooks/useAwayzContext';
3
3
  export * from './hooks/useSearchLimit';
4
4
  export * from './hooks/useWallet/useWallet';
5
5
  export * from './types';
6
- export * from './services/instance';
6
+ export * from './services';
7
7
  export * from './configs/awayzClient';
8
8
  export * from './components';
9
- export * from './services/currency/CurrencyService';
10
9
  export { getBaseUrl } from './configs/baseUrl';
11
- export * from './services/wallet/WalletService.types';
@@ -0,0 +1,4 @@
1
+ export { instance, clientInstance } from './instance';
2
+ export { clientNoRetryInstance } from './noRetryInstance';
3
+ export * from './currency/CurrencyService';
4
+ export * from './wallet/WalletService.types';
@@ -0,0 +1,67 @@
1
+ import { AxiosError, HttpStatusCode, InternalAxiosRequestConfig } from 'axios';
2
+ export interface IFailedRequestsNoRetryQueue {
3
+ res: (token: string) => void;
4
+ rej: (err: Error) => void;
5
+ }
6
+ export declare const getClientConfig: (config: InternalAxiosRequestConfig<any>) => {
7
+ headers: import('axios').AxiosRequestHeaders;
8
+ url?: string;
9
+ method?: import('axios').Method | string;
10
+ baseURL?: string;
11
+ allowAbsoluteUrls?: boolean;
12
+ transformRequest?: import('axios').AxiosRequestTransformer | import('axios').AxiosRequestTransformer[];
13
+ transformResponse?: import('axios').AxiosResponseTransformer | import('axios').AxiosResponseTransformer[];
14
+ params?: any;
15
+ paramsSerializer?: import('axios').ParamsSerializerOptions | import('axios').CustomParamsSerializer;
16
+ data?: any;
17
+ timeout?: number;
18
+ timeoutErrorMessage?: string;
19
+ withCredentials?: boolean;
20
+ adapter?: (import('axios').AxiosAdapter | ("fetch" | "xhr" | "http" | (string & {}))) | (import('axios').AxiosAdapter | ("fetch" | "xhr" | "http" | (string & {})))[];
21
+ auth?: import('axios').AxiosBasicCredentials;
22
+ responseType?: import('axios').ResponseType;
23
+ responseEncoding?: import('axios').responseEncoding | string;
24
+ xsrfCookieName?: string;
25
+ xsrfHeaderName?: string;
26
+ onUploadProgress?: (progressEvent: import('axios').AxiosProgressEvent) => void;
27
+ onDownloadProgress?: (progressEvent: import('axios').AxiosProgressEvent) => void;
28
+ maxContentLength?: number;
29
+ validateStatus?: ((status: number) => boolean) | null;
30
+ maxBodyLength?: number;
31
+ maxRedirects?: number;
32
+ maxRate?: number | [number, number];
33
+ beforeRedirect?: (options: Record<string, any>, responseDetails: {
34
+ headers: Record<string, string>;
35
+ statusCode: HttpStatusCode;
36
+ }) => void;
37
+ socketPath?: string | null;
38
+ transport?: any;
39
+ httpAgent?: any;
40
+ httpsAgent?: any;
41
+ proxy?: import('axios').AxiosProxyConfig | false;
42
+ cancelToken?: import('axios').CancelToken;
43
+ decompress?: boolean;
44
+ transitional?: import('axios').TransitionalOptions;
45
+ signal?: import('axios').GenericAbortSignal;
46
+ insecureHTTPParser?: boolean;
47
+ env?: {
48
+ FormData?: new (...args: any[]) => object;
49
+ };
50
+ formSerializer?: import('axios').FormSerializerOptions;
51
+ family?: import('axios').AddressFamily;
52
+ lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: import('axios').LookupAddress | import('axios').LookupAddress[], family?: import('axios').AddressFamily) => void) => void) | ((hostname: string, options: object) => Promise<[address: import('axios').LookupAddressEntry | import('axios').LookupAddressEntry[], family?: import('axios').AddressFamily] | import('axios').LookupAddress>);
53
+ withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
54
+ fetchOptions?: Record<string, any>;
55
+ };
56
+ /**
57
+ * Processes a queue of failed requests by either rejecting or resolving each request based on the presence of an error.
58
+ *
59
+ * @param failedRequestsQueue - An array of request objects, each expected to have `rej` (reject) and `res` (resolve) functions.
60
+ * @param error - An Error object if the requests should be rejected, or `null` if they should be resolved.
61
+ * @param token - An optional token to resolve the requests with if there is no error.
62
+ */
63
+ export declare const processFailedRequests: (failedRequestsQueue: IFailedRequestsNoRetryQueue[], error: Error | null, token?: string) => void;
64
+ export declare const delay: (timeInMs: number) => Promise<unknown>;
65
+ export declare const executeWithDelay: <T>(fn: () => T | Promise<T>, timeInMs: number) => Promise<T>;
66
+ export declare const authFailurePostMessage: (action: "refresh_token" | "exchange_token", error: any) => void;
67
+ export declare const handleAxiosError: (failedRequestsQueue: IFailedRequestsNoRetryQueue[], error: AxiosError, clientRetryLimit: number, isRefreshing: boolean, instance: any) => Promise<any>;
@@ -0,0 +1 @@
1
+ export declare const clientNoRetryInstance: import('axios').AxiosInstance;
package/dist/main.js CHANGED
@@ -1,25 +1,28 @@
1
- import { AwayzProvider as e } from "./providers/AwayzProvider.js";
1
+ import { AwayzProvider as r } from "./providers/AwayzProvider.js";
2
2
  import { useAwayzContext as a } from "./hooks/useAwayzContext.js";
3
- import { useSearchLimit as p } from "./hooks/useSearchLimit.js";
4
- import { useWallet as f } from "./hooks/useWallet/useWallet.js";
5
- import { EAuthFlow as s } from "./types/EAuthFlow.js";
6
- import { c as l, i as c } from "./AccountService-B-dpvIRm.js";
7
- import { awayzClient as w } from "./configs/awayzClient.js";
8
- import { CashValue as C } from "./components/CashValue/CashValue.js";
9
- import { EToolTipPosition as z } from "./components/CashValue/CashValueTypes.js";
10
- import { CurrencyService as v } from "./services/currency/CurrencyService.js";
11
- import { getBaseUrl as P } from "./configs/baseUrl.js";
3
+ import { useSearchLimit as n } from "./hooks/useSearchLimit.js";
4
+ import { useWallet as m } from "./hooks/useWallet/useWallet.js";
5
+ import { EAuthFlow as f } from "./types/EAuthFlow.js";
6
+ import { c as l, i as c } from "./AccountService-BLoJ4G-f.js";
7
+ import { clientNoRetryInstance as y } from "./services/noRetryInstance.js";
8
+ import { CurrencyService as A } from "./services/currency/CurrencyService.js";
9
+ import { awayzClient as h } from "./configs/awayzClient.js";
10
+ import { CashValue as z } from "./components/CashValue/CashValue.js";
11
+ import { EInvalidAmountDisplayOption as I, EToolTipPosition as d } from "./components/CashValue/CashValueTypes.js";
12
+ import { getBaseUrl as S } from "./configs/baseUrl.js";
12
13
  export {
13
- e as AwayzProvider,
14
- C as CashValue,
15
- v as CurrencyService,
16
- s as EAuthFlow,
17
- z as EToolTipPosition,
18
- w as awayzClient,
14
+ r as AwayzProvider,
15
+ z as CashValue,
16
+ A as CurrencyService,
17
+ f as EAuthFlow,
18
+ I as EInvalidAmountDisplayOption,
19
+ d as EToolTipPosition,
20
+ h as awayzClient,
19
21
  l as clientInstance,
20
- P as getBaseUrl,
22
+ y as clientNoRetryInstance,
23
+ S as getBaseUrl,
21
24
  c as instance,
22
25
  a as useAwayzContext,
23
- p as useSearchLimit,
24
- f as useWallet
26
+ n as useSearchLimit,
27
+ m as useWallet
25
28
  };
@@ -1,34 +1,35 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { useEffect as i } from "react";
3
- import { AwayzContext as m } from "../context/AwayzContext.js";
4
- import { E as e } from "../AccountService-B-dpvIRm.js";
5
- import { useAwayzAuth as s } from "../hooks/useAwayzAuth/useAwayzAuth.js";
6
- import { setBaseUrl as l } from "../configs/baseUrl.js";
7
- import { QueryClientProvider as u } from "@tanstack/react-query";
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useEffect as s } from "react";
3
+ import { AwayzContext as l } from "../context/AwayzContext.js";
4
+ import { d as t } from "../AccountService-BLoJ4G-f.js";
5
+ import { useAwayzAuth as m } from "../hooks/useAwayzAuth/useAwayzAuth.js";
6
+ import { setBaseUrl as u } from "../configs/baseUrl.js";
7
+ import { QueryClientProvider as i } from "@tanstack/react-query";
8
8
  import { awayzClient as d } from "../configs/awayzClient.js";
9
+ import "../services/noRetryInstance.js";
9
10
  import '../assets/_styles.css';/* empty css */
10
- import { defaultAwayzConfig as n } from "../configs/defaultAwayzConfig.js";
11
- const C = ({ children: o, config: r }) => {
12
- const a = s({
13
- authFlow: r.authFlow,
14
- onSuccess: r.onAuthSuccess,
15
- onError: r.onAuthFailure,
16
- trustedOrigins: r.trustedOrigins
11
+ import { defaultAwayzConfig as p } from "../configs/defaultAwayzConfig.js";
12
+ const v = ({ children: o, config: e }) => {
13
+ const a = m({
14
+ authFlow: e.authFlow,
15
+ onSuccess: e.onAuthSuccess,
16
+ onError: e.onAuthFailure,
17
+ trustedOrigins: e.trustedOrigins
17
18
  });
18
- return i(() => {
19
- if (!r.clientId) {
19
+ return s(() => {
20
+ if (!e.clientId) {
20
21
  console.error("You need to provide a client ID to the AwayzProvider");
21
22
  return;
22
23
  }
23
- localStorage.setItem(e.CLIENT_ID, r.clientId), localStorage.setItem(e.AUTH_FLOW, r.authFlow), l(r.testMode ?? !1);
24
- }, [r]), /* @__PURE__ */ t(u, { client: d, children: /* @__PURE__ */ t(
25
- m.Provider,
24
+ localStorage.setItem(t.CLIENT_ID, e.clientId), localStorage.setItem(t.AUTH_FLOW, e.authFlow), e.debugRefreshToken && e.testMode && (localStorage.setItem(t.REFRESH_TOKEN, e.debugRefreshToken), localStorage.setItem(t.TOKEN, e.debugRefreshToken)), u(e.testMode ?? !1);
25
+ }, [e]), /* @__PURE__ */ r(i, { client: d, children: /* @__PURE__ */ r(
26
+ l.Provider,
26
27
  {
27
28
  value: {
28
29
  ...a,
29
30
  config: {
30
- ...n,
31
- ...r
31
+ ...p,
32
+ ...e
32
33
  }
33
34
  },
34
35
  children: o
@@ -36,5 +37,5 @@ const C = ({ children: o, config: r }) => {
36
37
  ) });
37
38
  };
38
39
  export {
39
- C as AwayzProvider
40
+ v as AwayzProvider
40
41
  };
@@ -1,4 +1,4 @@
1
- import { e as m } from "../../AccountService-B-dpvIRm.js";
1
+ import { e as m } from "../../AccountService-BLoJ4G-f.js";
2
2
  import "react";
3
3
  import "../../configs/endpoints.js";
4
4
  import "../../configs/awayzClient.js";
@@ -1,13 +1,14 @@
1
- import '../../assets/_styles.css';var i = Object.defineProperty;
2
- var y = (t, r, e) => r in t ? i(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
1
+ import '../../assets/_styles.css';var u = Object.defineProperty;
2
+ var y = (t, r, e) => r in t ? u(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
3
3
  var o = (t, r, e) => y(t, typeof r != "symbol" ? r + "" : r, e);
4
- import { e as p, a as C, c as a } from "../../AccountService-B-dpvIRm.js";
4
+ import { e as p, E as C, c as a } from "../../AccountService-BLoJ4G-f.js";
5
5
  import "react";
6
6
  import { ECurrencyEndpoints as s } from "../../configs/endpoints.js";
7
7
  import "react/jsx-runtime";
8
8
  import "../../context/AwayzContext.js";
9
9
  import { awayzClient as m } from "../../configs/awayzClient.js";
10
10
  import "@tanstack/react-query";
11
+ import "../noRetryInstance.js";
11
12
  /* empty css */
12
13
  class E {
13
14
  constructor() {
@@ -21,12 +22,12 @@ class E {
21
22
  });
22
23
  if (!e)
23
24
  throw new Error("Failed to fetch user data");
24
- const { userRegion: c } = n, { data: u } = await a.post(s.CURRENCY_CONVERSION, {
25
+ const { userRegion: c } = n, { data: i } = await a.post(s.CURRENCY_CONVERSION, {
25
26
  target_currency: c.currency,
26
27
  base_currency: r
27
28
  });
28
29
  if (e)
29
- return u.data.conversion_rate;
30
+ return i.data.conversion_rate;
30
31
  } catch (e) {
31
32
  console.error(e);
32
33
  }
@@ -60,7 +61,7 @@ class E {
60
61
  });
61
62
  }
62
63
  }
63
- const h = new E();
64
+ const O = new E();
64
65
  export {
65
- h as CurrencyService
66
+ O as CurrencyService
66
67
  };
@@ -0,0 +1,9 @@
1
+ import { c as n, i as t } from "../AccountService-BLoJ4G-f.js";
2
+ import { clientNoRetryInstance as o } from "./noRetryInstance.js";
3
+ import { CurrencyService as i } from "./currency/CurrencyService.js";
4
+ export {
5
+ i as CurrencyService,
6
+ n as clientInstance,
7
+ o as clientNoRetryInstance,
8
+ t as instance
9
+ };
@@ -1,9 +1,7 @@
1
- import { c as p, i as a } from "../AccountService-B-dpvIRm.js";
1
+ import { c, i as e } from "../AccountService-BLoJ4G-f.js";
2
2
  import "react";
3
- import "../configs/endpoints.js";
4
3
  import "../configs/baseUrl.js";
5
- import "../types/EAuthFlow.js";
6
4
  export {
7
- p as clientInstance,
8
- a as instance
5
+ c as clientInstance,
6
+ e as instance
9
7
  };
@@ -0,0 +1,13 @@
1
+ import { l as i, j as l, k as p, g as m, h as g, p as h } from "../AccountService-BLoJ4G-f.js";
2
+ import "../configs/baseUrl.js";
3
+ import "react";
4
+ import "../configs/endpoints.js";
5
+ import "../types/EAuthFlow.js";
6
+ export {
7
+ i as authFailurePostMessage,
8
+ l as delay,
9
+ p as executeWithDelay,
10
+ m as getClientConfig,
11
+ g as handleAxiosError,
12
+ h as processFailedRequests
13
+ };
@@ -0,0 +1,10 @@
1
+ import { f as t, g as r, h as n } from "../AccountService-BLoJ4G-f.js";
2
+ const s = t.create();
3
+ s.interceptors.request.use((e) => (e = r(e), e));
4
+ const o = 1;
5
+ let a = !1;
6
+ const i = [];
7
+ s.interceptors.response.use(null, (e) => n(i, e, o, a, s));
8
+ export {
9
+ s as clientNoRetryInstance
10
+ };