@odynn/awayz-core 0.9.33 → 0.9.34

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 (39) hide show
  1. package/dist/{TripsService-CJxjOcrR.js → TripsService-k5PnDpcP.js} +1 -1
  2. package/dist/{cashUtils-DB_r0g-F.js → cashUtils-DnCt66eB.js} +8 -9
  3. package/dist/components/CashValue/CashValue.js +2 -2
  4. package/dist/components/CashValue/CashValue.stories.js +1 -1
  5. package/dist/components/ClientPointsValue/ClientPointsValue.js +1 -1
  6. package/dist/components/Wallet/Card/Card.stories.js +1 -1
  7. package/dist/configs/endpoints.js +1 -1
  8. package/dist/hooks/useAwayzAuth/useAwayzAuth.js +2 -2
  9. package/dist/hooks/useBookingManagement/useBookingManagement.js +1 -1
  10. package/dist/hooks/useBookingManagement/useBookingManagement.test.js +1 -1
  11. package/dist/hooks/useFeatureFlags.js +1 -1
  12. package/dist/hooks/useSearchLimit.js +1 -1
  13. package/dist/hooks/useTripManagement/useTripManagement.js +2 -2
  14. package/dist/hooks/useTripManagement/useTripManagement.test.js +2 -2
  15. package/dist/hooks/useWallet/useWallet.js +1 -1
  16. package/dist/hooks/useWallet/useWallet.test.js +1 -1
  17. package/dist/lib/configs/endpoints.d.ts +2 -1
  18. package/dist/lib/services/account/AccountService.d.ts +2 -1
  19. package/dist/lib/services/account/AccountServices.types.d.ts +22 -0
  20. package/dist/main.js +1 -1
  21. package/dist/{noRetryInstance-DKhe8ju0.js → noRetryInstance-Bit3xLkY.js} +121 -117
  22. package/dist/providers/AwayzProvider.js +1 -1
  23. package/dist/services/account/AccountService.js +1 -1
  24. package/dist/services/bookings/BookingService.js +1 -1
  25. package/dist/services/currency/CurrencyService.js +34 -31
  26. package/dist/services/features/featureService.js +1 -1
  27. package/dist/services/index.js +1 -1
  28. package/dist/services/instance.js +1 -1
  29. package/dist/services/instanceConfig.js +1 -1
  30. package/dist/services/noRetryInstance.js +1 -1
  31. package/dist/services/preferences/PreferencesService.js +1 -1
  32. package/dist/services/rewards/RewardsService.js +1 -1
  33. package/dist/services/trips/TripsService.js +2 -2
  34. package/dist/services/wallet/WalletService.js +1 -1
  35. package/dist/utils/clientPoints.js +1 -1
  36. package/package.json +3 -2
  37. package/dist/index-BlYZu1Ej.js +0 -5
  38. package/dist/lib/components/CashValue/CashValue.stories.d.ts +0 -38
  39. package/dist/lib/components/Wallet/Card/Card.stories.d.ts +0 -14
@@ -12,7 +12,7 @@ import "react-i18next";
12
12
  import '../assets/_styles3.css';import '../assets/_styles5.css';import '../assets/_styles4.css';import '../assets/_styles.css';import '../assets/_styles2.css';/* empty css */
13
13
  /* empty css */
14
14
  import { awayzClient as y } from "../configs/awayzClient.js";
15
- import "../noRetryInstance-DKhe8ju0.js";
15
+ import "../noRetryInstance-Bit3xLkY.js";
16
16
  /* empty css */
17
17
  /* empty css */
18
18
  import "../index-Cv-wvFlM.js";
@@ -1,5 +1,5 @@
1
1
  import "../../arrayExtensions-DlcBOj5a.js";
2
- import { A as e } from "../../noRetryInstance-DKhe8ju0.js";
2
+ import { A as e } from "../../noRetryInstance-Bit3xLkY.js";
3
3
  import "../../_styles.flight-booking-CaUgKcMC.js";
4
4
  import "react";
5
5
  import "../../configs/awayzClient.js";
@@ -2,7 +2,7 @@ var g = Object.defineProperty;
2
2
  var y = (r, t, a) => t in r ? g(r, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[t] = a;
3
3
  var c = (r, t, a) => y(r, typeof t != "symbol" ? t + "" : t, a);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { c as d, b as u, g as p } from "../../noRetryInstance-DKhe8ju0.js";
5
+ import { c as d, b as u, g as p } from "../../noRetryInstance-Bit3xLkY.js";
6
6
  import "react";
7
7
  import { EBookingEndpoints as i } from "../../configs/endpoints.js";
8
8
  const f = (r) => {
@@ -1,11 +1,10 @@
1
- import '../../assets/_styles3.css';import '../../assets/_styles5.css';import '../../assets/_styles4.css';import '../../assets/_styles.css';import '../../assets/_styles2.css';var y = Object.defineProperty;
2
- var m = (t, r, e) => r in t ? y(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
3
- var n = (t, r, e) => m(t, typeof r != "symbol" ? r + "" : r, e);
1
+ import '../../assets/_styles3.css';import '../../assets/_styles5.css';import '../../assets/_styles4.css';import '../../assets/_styles.css';import '../../assets/_styles2.css';var f = Object.defineProperty;
2
+ var l = (c, r, t) => r in c ? f(c, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[r] = t;
3
+ var o = (c, r, t) => l(c, typeof r != "symbol" ? r + "" : r, t);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { E } from "../../index-BlYZu1Ej.js";
6
- import { A as C, E as _, c as s } from "../../noRetryInstance-DKhe8ju0.js";
5
+ import { A as i, E as u, c as y } from "../../noRetryInstance-Bit3xLkY.js";
7
6
  import "react";
8
- import { ECurrencyEndpoints as i } from "../../configs/endpoints.js";
7
+ import { ECurrencyEndpoints as p } from "../../configs/endpoints.js";
9
8
  import "react/jsx-runtime";
10
9
  import "react-i18next";
11
10
  /* empty css */
@@ -17,28 +16,32 @@ import "@tanstack/react-query";
17
16
  import "../../index-Cv-wvFlM.js";
18
17
  import "../../context/AwayzContext.js";
19
18
  /* empty css */
20
- import { awayzClient as R } from "../../configs/awayzClient.js";
19
+ import { awayzClient as m } from "../../configs/awayzClient.js";
21
20
  class d {
22
21
  constructor() {
23
- n(this, "convertCurrency", async ({
22
+ o(this, "convertCurrency", async ({
24
23
  baseCurrency: r,
25
- targetCurrency: e
24
+ targetCurrency: t
26
25
  }) => {
26
+ var n;
27
27
  try {
28
- const { success: o, data: c } = await R.ensureQueryData({
29
- queryKey: [_.CHECK_USER],
30
- queryFn: C.checkUser
28
+ const { success: e, data: C } = await m.ensureQueryData({
29
+ queryKey: [u.CHECK_USER],
30
+ queryFn: i.checkUser
31
+ }), a = await m.ensureQueryData({
32
+ queryKey: [u.CLIENT_DETAILS],
33
+ queryFn: i.getClientDetails
31
34
  });
32
- if (!o)
35
+ if (!e || !a)
33
36
  throw new Error("Failed to fetch user data");
34
- const { userRegion: u, preferences: p } = c, { data: a } = await s.post(i.CURRENCY_CONVERSION, {
35
- target_currency: e ?? p.currency ?? u.currency,
37
+ const { userRegion: E, preferences: _ } = C, { data: s } = await y.post(p.CURRENCY_CONVERSION, {
38
+ target_currency: t ?? _.currency ?? E.currency,
36
39
  base_currency: r
37
40
  });
38
- if (o && a.data)
39
- return a.data.conversion_rate * (1 + E);
40
- } catch (o) {
41
- console.error(o);
41
+ if (e && s.data)
42
+ return s.data.conversion_rate * (1 + (((n = a.pointsAsCash) == null ? void 0 : n.exchangeRateBuffer) ?? 0));
43
+ } catch (e) {
44
+ console.error(e);
42
45
  }
43
46
  return 0;
44
47
  });
@@ -50,27 +53,27 @@ class d {
50
53
  * @parm amount the amount to be converted from the base to the target currency
51
54
  * @returns the converted amount
52
55
  */
53
- n(this, "convertToCurrency", async ({
56
+ o(this, "convertToCurrency", async ({
54
57
  baseCurrency: r,
55
- targetCurrency: e,
56
- amount: o
58
+ targetCurrency: t,
59
+ amount: n
57
60
  }) => {
58
61
  try {
59
- const { data: c } = await s.post(i.CURRENCY_CONVERSION, {
60
- target_currency: e,
62
+ const { data: e } = await y.post(p.CURRENCY_CONVERSION, {
63
+ target_currency: t,
61
64
  base_currency: r,
62
- amount: o
65
+ amount: n
63
66
  });
64
- if (c.success)
65
- return c.data.conversion_result;
66
- } catch (c) {
67
- console.error(c);
67
+ if (e.success)
68
+ return e.data.conversion_result;
69
+ } catch (e) {
70
+ console.error(e);
68
71
  }
69
72
  return 0;
70
73
  });
71
74
  }
72
75
  }
73
- const Q = new d();
76
+ const b = new d();
74
77
  export {
75
- Q as CurrencyService
78
+ b as CurrencyService
76
79
  };
@@ -1,5 +1,5 @@
1
1
  import { EAuthEndpoints as a } from "../../configs/endpoints.js";
2
- import { c as o } from "../../noRetryInstance-DKhe8ju0.js";
2
+ import { c as o } from "../../noRetryInstance-Bit3xLkY.js";
3
3
  class i {
4
4
  static async getFeatures() {
5
5
  try {
@@ -1,5 +1,5 @@
1
1
  import { CurrencyService as a } from "./currency/CurrencyService.js";
2
- import { c as t, a as o, g as c, i as s } from "../noRetryInstance-DKhe8ju0.js";
2
+ import { c as t, a as o, g as c, i as s } from "../noRetryInstance-Bit3xLkY.js";
3
3
  import { RewardsService as p } from "./rewards/RewardsService.js";
4
4
  import { EBookingType as m } from "./trips/TripService.types.js";
5
5
  export {
@@ -1,7 +1,7 @@
1
1
  import "../arrayExtensions-DlcBOj5a.js";
2
2
  import "../_styles.flight-booking-CaUgKcMC.js";
3
3
  import "react";
4
- import { c as r, g as s, i as c } from "../noRetryInstance-DKhe8ju0.js";
4
+ import { c as r, g as s, i as c } from "../noRetryInstance-Bit3xLkY.js";
5
5
  import "../configs/baseUrl.js";
6
6
  export {
7
7
  r as clientInstance,
@@ -1,7 +1,7 @@
1
1
  import "../arrayExtensions-DlcBOj5a.js";
2
2
  import "../_styles.flight-booking-CaUgKcMC.js";
3
3
  import "react";
4
- import { m as F, k as j, l as k, h as q, j as w, n as A, p as D } from "../noRetryInstance-DKhe8ju0.js";
4
+ import { m as F, k as j, l as k, h as q, j as w, n as A, p as D } from "../noRetryInstance-Bit3xLkY.js";
5
5
  import "../configs/baseUrl.js";
6
6
  import "../configs/endpoints.js";
7
7
  import "../configs/gatewayBaseUrl.js";
@@ -1,4 +1,4 @@
1
- import { a } from "../noRetryInstance-DKhe8ju0.js";
1
+ import { a } from "../noRetryInstance-Bit3xLkY.js";
2
2
  export {
3
3
  a as clientNoRetryInstance
4
4
  };
@@ -2,7 +2,7 @@ var a = Object.defineProperty;
2
2
  var o = (s, e, r) => e in s ? a(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
3
3
  var n = (s, e, r) => o(s, typeof e != "symbol" ? e + "" : e, r);
4
4
  import { EPreferencesEndpoints as u } from "../../configs/endpoints.js";
5
- import { c as i } from "../../noRetryInstance-DKhe8ju0.js";
5
+ import { c as i } from "../../noRetryInstance-Bit3xLkY.js";
6
6
  class E {
7
7
  constructor() {
8
8
  n(this, "setCurrency", async (e) => {
@@ -2,7 +2,7 @@ var s = Object.defineProperty;
2
2
  var n = (t, e, a) => e in t ? s(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
3
3
  var r = (t, e, a) => n(t, typeof e != "symbol" ? e + "" : e, a);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { c as o, b as c } from "../../noRetryInstance-DKhe8ju0.js";
5
+ import { c as o, b as c } from "../../noRetryInstance-Bit3xLkY.js";
6
6
  import "react";
7
7
  import { ERewardsEndpoints as i } from "../../configs/endpoints.js";
8
8
  class m {
@@ -1,6 +1,6 @@
1
1
  import "../../arrayExtensions-DlcBOj5a.js";
2
- import "../../noRetryInstance-DKhe8ju0.js";
3
- import { T } from "../../TripsService-CJxjOcrR.js";
2
+ import "../../noRetryInstance-Bit3xLkY.js";
3
+ import { T } from "../../TripsService-k5PnDpcP.js";
4
4
  import "react";
5
5
  import "../../configs/defaultAwayzConfig.js";
6
6
  import "../../configs/endpoints.js";
@@ -2,7 +2,7 @@ var o = Object.defineProperty;
2
2
  var i = (d, a, t) => a in d ? o(d, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[a] = t;
3
3
  var r = (d, a, t) => i(d, typeof a != "symbol" ? a + "" : a, t);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { c as e, b as c, g as A } from "../../noRetryInstance-DKhe8ju0.js";
5
+ import { c as e, b as c, g as A } from "../../noRetryInstance-Bit3xLkY.js";
6
6
  import "react";
7
7
  import { EWalletEndpoints as s } from "../../configs/endpoints.js";
8
8
  class u {
@@ -1,5 +1,5 @@
1
1
  import "../arrayExtensions-DlcBOj5a.js";
2
- import { E as m } from "../noRetryInstance-DKhe8ju0.js";
2
+ import { E as m } from "../noRetryInstance-Bit3xLkY.js";
3
3
  import "react";
4
4
  import "react/jsx-runtime";
5
5
  import "react-i18next";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.9.33",
3
+ "version": "0.9.34",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -12,7 +12,8 @@
12
12
  "build": "tsc -b && vite build",
13
13
  "patch": "npm run build && npm version patch && npm publish --access public",
14
14
  "minor": "npm run build && npm version minor && npm publish --access public",
15
- "major": "npm run build && npm version major && npm publish --access public"
15
+ "major": "npm run build && npm version major && npm publish --access public",
16
+ "yalc-publish": "yalc publish --push"
16
17
  },
17
18
  "peerDependencies": {
18
19
  "@tanstack/react-query": "^5.66.9",
@@ -1,5 +0,0 @@
1
- const E = "USD", s = 0.03;
2
- export {
3
- E as D,
4
- s as E
5
- };
@@ -1,38 +0,0 @@
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, decimalPlaces, showConversion, showOriginal }: 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 ZeroCurrencyAmount: Story;
36
- export declare const ZeroCurrencyNoDecimalAmount: Story;
37
- export declare const NegativeAmount: Story;
38
- export declare const CustomZeroAmount: Story;
@@ -1,14 +0,0 @@
1
- import { StoryObj } from '@storybook/react';
2
- declare const meta: {
3
- title: string;
4
- component: ({ details, onCardDelete }: import('./Card').ICardProps) => import("react/jsx-runtime").JSX.Element;
5
- parameters: {
6
- layout: string;
7
- };
8
- tags: string[];
9
- decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
10
- };
11
- export default meta;
12
- type Story = StoryObj<typeof meta>;
13
- export declare const DarkCard: Story;
14
- export declare const LightCard: Story;