@odynn/awayz-core 0.4.1 → 0.4.3

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 (33) hide show
  1. package/dist/{AccountService-cvx__9rR.js → AccountService-CR5oZ1Bu.js} +29 -29
  2. package/dist/{TripsService-G1T_Co8r.js → TripsService-zpli8uBM.js} +1 -1
  3. package/dist/components/CashValue/CashValue.js +1 -1
  4. package/dist/components/CashValue/CashValue.stories.js +1 -1
  5. package/dist/components/Wallet/Card/Card.stories.js +1 -1
  6. package/dist/configs/endpoints.js +4 -3
  7. package/dist/hooks/useAwayzAuth/useAwayzAuth.js +1 -1
  8. package/dist/hooks/useBookingManagement/useBookingManagement.js +1 -1
  9. package/dist/hooks/useBookingManagement/useBookingManagement.test.js +1 -1
  10. package/dist/hooks/useSearchLimit.js +1 -1
  11. package/dist/hooks/useTripManagement/useTripManagement.js +2 -2
  12. package/dist/hooks/useTripManagement/useTripManagement.test.js +2 -2
  13. package/dist/hooks/useWallet/useWallet.js +46 -40
  14. package/dist/hooks/useWallet/useWallet.test.js +2 -2
  15. package/dist/lib/configs/endpoints.d.ts +4 -0
  16. package/dist/lib/hooks/useWallet/useWallet.types.d.ts +5 -0
  17. package/dist/lib/services/index.d.ts +1 -0
  18. package/dist/lib/services/rewards/RewardsService.d.ts +27 -0
  19. package/dist/lib/services/wallet/WalletService.d.ts +1 -0
  20. package/dist/main.js +31 -29
  21. package/dist/providers/AwayzProvider.js +1 -1
  22. package/dist/services/account/AccountService.js +1 -1
  23. package/dist/services/bookings/BookingService.js +1 -1
  24. package/dist/services/currency/CurrencyService.js +1 -1
  25. package/dist/services/index.js +4 -2
  26. package/dist/services/instance.js +1 -1
  27. package/dist/services/instanceConfig.js +1 -1
  28. package/dist/services/noRetryInstance.js +1 -1
  29. package/dist/services/preferences/PreferencesService.js +1 -1
  30. package/dist/services/rewards/RewardsService.js +46 -0
  31. package/dist/services/trips/TripsService.js +2 -2
  32. package/dist/services/wallet/WalletService.js +29 -15
  33. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  var lt = Object.defineProperty;
2
2
  var ft = (e, t, n) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var k = (e, t, n) => ft(e, typeof t != "symbol" ? t + "" : t, n);
3
+ var U = (e, t, n) => ft(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import "./arrayExtensions-DlcBOj5a.js";
5
5
  import "react";
6
6
  import { getBaseUrl as qe } from "./configs/baseUrl.js";
@@ -23,7 +23,7 @@ const ge = (e) => Array.isArray(e) ? e.map((t) => ge(t)) : typeof e == "object"
23
23
  }, {}) : e, lr = (e) => (Object.keys(e).forEach(
24
24
  (t) => !e[t] && delete e[t]
25
25
  ), e);
26
- var $ = /* @__PURE__ */ ((e) => (e.LOCATIONS = "LOCATIONS", e.CHECK_USER = "CHECK_USER", e.USER_REGIONS = "USER_REGIONS", e.CONVERT_CURRENCY = "CONVERT_CURRENCY", e.CLIENT_COMPONENT_KEY = "CLIENT_COMPONENT_KEY", e.SEARCH_LIMIT = "SEARCH_LIMIT", e.PROGRAMS = "PROGRAMS", e.USER_PROGRAMS = "USER_PROGRAMS", e.BANKS = "BANKS", e.CARDS = "CARDS", e.USER_CARDS = "USER_CARDS", e.TRIPS = "TRIPS", e.UNCATEGORISED_BOOKINGS = "UNCATEGORISED_BOOKINGS", e.BOOKING = "BOOKING", e))($ || {}), mt = /* @__PURE__ */ ((e) => (e.HOTEL = "Hotel", e.AIRLINE = "Airline", e.BANK = "Bank", e))(mt || {}), F = /* @__PURE__ */ ((e) => (e.TOKEN = "token", e.REFRESH_TOKEN = "refreshToken", e.CLIENT_ID = "clientId", e.AUTH_FLOW = "authFlow", e))(F || {});
26
+ var $ = /* @__PURE__ */ ((e) => (e.LOCATIONS = "LOCATIONS", e.CHECK_USER = "CHECK_USER", e.USER_REGIONS = "USER_REGIONS", e.CONVERT_CURRENCY = "CONVERT_CURRENCY", e.CLIENT_COMPONENT_KEY = "CLIENT_COMPONENT_KEY", e.SEARCH_LIMIT = "SEARCH_LIMIT", e.PROGRAMS = "PROGRAMS", e.USER_PROGRAMS = "USER_PROGRAMS", e.BANKS = "BANKS", e.CARDS = "CARDS", e.USER_CARDS = "USER_CARDS", e.TRIPS = "TRIPS", e.UNCATEGORISED_BOOKINGS = "UNCATEGORISED_BOOKINGS", e.BOOKING = "BOOKING", e.VALUE_CENTS = "VALUE_CENTS", e))($ || {}), mt = /* @__PURE__ */ ((e) => (e.HOTEL = "Hotel", e.AIRLINE = "Airline", e.BANK = "Bank", e))(mt || {}), F = /* @__PURE__ */ ((e) => (e.TOKEN = "token", e.REFRESH_TOKEN = "refreshToken", e.CLIENT_ID = "clientId", e.AUTH_FLOW = "authFlow", e))(F || {});
27
27
  function He(e, t) {
28
28
  return function() {
29
29
  return e.apply(t, arguments);
@@ -50,7 +50,7 @@ const Rt = re("string"), _ = re("function"), ze = re("number"), se = (e) => e !=
50
50
  let t;
51
51
  return e && (typeof FormData == "function" && e instanceof FormData || _(e.append) && ((t = ne(e)) === "formdata" || // detect form-data instance
52
52
  t === "object" && _(e.toString) && e.toString() === "[object FormData]"));
53
- }, Nt = x("URLSearchParams"), [Ct, xt, kt, Ut] = ["ReadableStream", "Request", "Response", "Headers"].map(x), Ft = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
53
+ }, Nt = x("URLSearchParams"), [Ct, xt, Ut, kt] = ["ReadableStream", "Request", "Response", "Headers"].map(x), Ft = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
54
54
  function G(e, t, { allOwnKeys: n = !1 } = {}) {
55
55
  if (e === null || typeof e > "u")
56
56
  return;
@@ -201,8 +201,8 @@ const Xt = (e) => {
201
201
  isPlainObject: X,
202
202
  isReadableStream: Ct,
203
203
  isRequest: xt,
204
- isResponse: kt,
205
- isHeaders: Ut,
204
+ isResponse: Ut,
205
+ isHeaders: kt,
206
206
  isUndefined: v,
207
207
  isDate: gt,
208
208
  isFile: bt,
@@ -932,12 +932,12 @@ const Q = (e, t, n = 3) => {
932
932
  function xn(e) {
933
933
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
934
934
  }
935
- function kn(e, t) {
935
+ function Un(e, t) {
936
936
  return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
937
937
  }
938
938
  function nt(e, t, n) {
939
939
  let r = !xn(t);
940
- return e && (r || n == !1) ? kn(e, t) : t;
940
+ return e && (r || n == !1) ? Un(e, t) : t;
941
941
  }
942
942
  const xe = (e) => e instanceof N ? { ...e } : e;
943
943
  function M(e, t) {
@@ -1025,7 +1025,7 @@ const rt = (e) => {
1025
1025
  u && i.set(s, u);
1026
1026
  }
1027
1027
  return t;
1028
- }, Un = typeof XMLHttpRequest < "u", Fn = Un && function(e) {
1028
+ }, kn = typeof XMLHttpRequest < "u", Fn = kn && function(e) {
1029
1029
  return new Promise(function(n, r) {
1030
1030
  const s = rt(e);
1031
1031
  let o = s.data;
@@ -1133,7 +1133,7 @@ const rt = (e) => {
1133
1133
  } finally {
1134
1134
  await t.cancel();
1135
1135
  }
1136
- }, ke = (e, t, n, r) => {
1136
+ }, Ue = (e, t, n, r) => {
1137
1137
  const s = Ln(e, t);
1138
1138
  let o = 0, i, c = (f) => {
1139
1139
  i || (i = !0, r && r(f));
@@ -1178,7 +1178,7 @@ const rt = (e) => {
1178
1178
  }
1179
1179
  }).headers.has("Content-Type");
1180
1180
  return e && !t;
1181
- }), Ue = 64 * 1024, he = st && ot(() => a.isReadableStream(new Response("").body)), ee = {
1181
+ }), ke = 64 * 1024, he = st && ot(() => a.isReadableStream(new Response("").body)), ee = {
1182
1182
  stream: he && ((e) => e.body)
1183
1183
  };
1184
1184
  ie && ((e) => {
@@ -1238,7 +1238,7 @@ const Hn = async (e) => {
1238
1238
  p,
1239
1239
  Q(Ce(f))
1240
1240
  );
1241
- r = ke(A.body, Ue, D, V);
1241
+ r = Ue(A.body, ke, D, V);
1242
1242
  }
1243
1243
  }
1244
1244
  a.isString(d) || (d = d ? "include" : "omit");
@@ -1264,7 +1264,7 @@ const Hn = async (e) => {
1264
1264
  Q(Ce(c), !0)
1265
1265
  ) || [];
1266
1266
  g = new Response(
1267
- ke(g.body, Ue, D, () => {
1267
+ Ue(g.body, ke, D, () => {
1268
1268
  V && V(), m && m();
1269
1269
  }),
1270
1270
  A
@@ -1405,7 +1405,7 @@ function Kn(e, t, n) {
1405
1405
  const Z = {
1406
1406
  assertOptions: Kn,
1407
1407
  validators: ae
1408
- }, U = Z.validators;
1408
+ }, k = Z.validators;
1409
1409
  let H = class {
1410
1410
  constructor(t) {
1411
1411
  this.defaults = t || {}, this.interceptors = {
@@ -1442,17 +1442,17 @@ let H = class {
1442
1442
  typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = M(this.defaults, n);
1443
1443
  const { transitional: r, paramsSerializer: s, headers: o } = n;
1444
1444
  r !== void 0 && Z.assertOptions(r, {
1445
- silentJSONParsing: U.transitional(U.boolean),
1446
- forcedJSONParsing: U.transitional(U.boolean),
1447
- clarifyTimeoutError: U.transitional(U.boolean)
1445
+ silentJSONParsing: k.transitional(k.boolean),
1446
+ forcedJSONParsing: k.transitional(k.boolean),
1447
+ clarifyTimeoutError: k.transitional(k.boolean)
1448
1448
  }, !1), s != null && (a.isFunction(s) ? n.paramsSerializer = {
1449
1449
  serialize: s
1450
1450
  } : Z.assertOptions(s, {
1451
- encode: U.function,
1452
- serialize: U.function
1451
+ encode: k.function,
1452
+ serialize: k.function
1453
1453
  }, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), Z.assertOptions(n, {
1454
- baseUrl: U.spelling("baseURL"),
1455
- withXsrfToken: U.spelling("withXSRFToken")
1454
+ baseUrl: k.spelling("baseURL"),
1455
+ withXsrfToken: k.spelling("withXSRFToken")
1456
1456
  }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1457
1457
  let i = o && a.merge(
1458
1458
  o.common,
@@ -1791,7 +1791,7 @@ class nr {
1791
1791
  * @param params - The sign-in parameters containing email and password.
1792
1792
  * @returns A promise that resolves to a service response containing authentication data.
1793
1793
  */
1794
- k(this, "login", async (t) => {
1794
+ U(this, "login", async (t) => {
1795
1795
  var n, r, s, o, i;
1796
1796
  try {
1797
1797
  const { data: c } = await C.post(O.SIGN_IN, {
@@ -1827,7 +1827,7 @@ class nr {
1827
1827
  * @param params - The sign-up parameters containing email, password, and region.
1828
1828
  * @returns A promise that resolves to a service response containing authentication data.
1829
1829
  */
1830
- k(this, "signUp", async (t) => {
1830
+ U(this, "signUp", async (t) => {
1831
1831
  var n, r, s, o, i, c;
1832
1832
  try {
1833
1833
  const { data: f } = await C.post(O.SIGN_UP, {
@@ -1863,7 +1863,7 @@ class nr {
1863
1863
  };
1864
1864
  }
1865
1865
  });
1866
- k(this, "resendVerificationEmail", async (t) => {
1866
+ U(this, "resendVerificationEmail", async (t) => {
1867
1867
  var n, r, s;
1868
1868
  try {
1869
1869
  return (await C.post(
@@ -1887,7 +1887,7 @@ class nr {
1887
1887
  * @param idToken - The ID token to authenticate with.
1888
1888
  * @returns A promise that resolves to a service response containing authentication data.
1889
1889
  */
1890
- k(this, "authenticateWithToken", async (t) => {
1890
+ U(this, "authenticateWithToken", async (t) => {
1891
1891
  var n, r, s;
1892
1892
  try {
1893
1893
  const { data: o } = await C.post(O.EXCHANGE_TOKEN, {
@@ -1920,7 +1920,7 @@ class nr {
1920
1920
  *
1921
1921
  * @returns A promise that resolves to a service response containing the user details.
1922
1922
  */
1923
- k(this, "checkUser", async () => {
1923
+ U(this, "checkUser", async () => {
1924
1924
  try {
1925
1925
  const { data: t } = await C.get(O.ME), n = await W.ensureQueryData({
1926
1926
  queryKey: [$.USER_REGIONS],
@@ -1950,7 +1950,7 @@ class nr {
1950
1950
  *
1951
1951
  * @param refreshToken - The refresh token
1952
1952
  */
1953
- k(this, "refreshEmbedToken", async (t) => {
1953
+ U(this, "refreshEmbedToken", async (t) => {
1954
1954
  try {
1955
1955
  const { data: n } = await C.post(
1956
1956
  O.REFRESH_EMBED_TOKEN,
@@ -1975,7 +1975,7 @@ class nr {
1975
1975
  *
1976
1976
  * @param refreshToken - The refresh token
1977
1977
  */
1978
- k(this, "refreshToken", async (t) => {
1978
+ U(this, "refreshToken", async (t) => {
1979
1979
  try {
1980
1980
  const { data: n } = await C.post(
1981
1981
  O.REFRESH_TOKEN,
@@ -2003,13 +2003,13 @@ class nr {
2003
2003
  *
2004
2004
  * @returns A promise that resolves to a service response containing the request limit data.
2005
2005
  */
2006
- k(this, "getRequestLimit", async () => (await C.get(O.REQUEST_LIMIT)).data);
2006
+ U(this, "getRequestLimit", async () => (await C.get(O.REQUEST_LIMIT)).data);
2007
2007
  /**
2008
2008
  * Retrieves the regions available for user registration.
2009
2009
  *
2010
2010
  * @returns A promise that resolves to a service response containing the available regions.
2011
2011
  */
2012
- k(this, "getRegions", async () => {
2012
+ U(this, "getRegions", async () => {
2013
2013
  var n;
2014
2014
  const t = await C.get(O.REGIONS);
2015
2015
  return L((n = t.data) == null ? void 0 : n.data);
@@ -1,7 +1,7 @@
1
1
  var _ = Object.defineProperty;
2
2
  var g = (a, e, s) => e in a ? _(a, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[e] = s;
3
3
  var r = (a, e, s) => g(a, typeof e != "symbol" ? e + "" : e, s);
4
- import { c as n, j as p, b as o, r as T } from "./AccountService-cvx__9rR.js";
4
+ import { c as n, j as p, b as o, r as T } from "./AccountService-CR5oZ1Bu.js";
5
5
  import { EBookingType as m } from "./services/trips/TripService.types.js";
6
6
  import { EMyTripsEndpoints as i } from "./configs/endpoints.js";
7
7
  import "./arrayExtensions-DlcBOj5a.js";
@@ -5,7 +5,7 @@ import { u as D, a as ot, c as A, b as q, d as ve, e as st, f as it, g as G, o a
5
5
  import { r as yt, R as gt } from "../../index-Cv-wvFlM.js";
6
6
  import { useQuery as Ct } from "@tanstack/react-query";
7
7
  import "../../arrayExtensions-DlcBOj5a.js";
8
- import { E as Et } from "../../AccountService-cvx__9rR.js";
8
+ import { E as Et } from "../../AccountService-CR5oZ1Bu.js";
9
9
  import { b as ue } from "../../index-CDh8vAM_.js";
10
10
  import "../../context/AwayzContext.js";
11
11
  import "../../configs/awayzClient.js";
@@ -5,7 +5,7 @@ import "react";
5
5
  import "../../context/AwayzContext.js";
6
6
  import "@tanstack/react-query";
7
7
  import "../../arrayExtensions-DlcBOj5a.js";
8
- import "../../AccountService-cvx__9rR.js";
8
+ import "../../AccountService-CR5oZ1Bu.js";
9
9
  import "../../configs/awayzClient.js";
10
10
  import { EAuthFlow as i } from "../../types/EAuthFlow.js";
11
11
  import "../../services/noRetryInstance.js";
@@ -5,7 +5,7 @@ import "react";
5
5
  import "../../../context/AwayzContext.js";
6
6
  import "@tanstack/react-query";
7
7
  import "../../../arrayExtensions-DlcBOj5a.js";
8
- import "../../../AccountService-cvx__9rR.js";
8
+ import "../../../AccountService-CR5oZ1Bu.js";
9
9
  import "../../../configs/awayzClient.js";
10
10
  import { EAuthFlow as e } from "../../../types/EAuthFlow.js";
11
11
  import "../../../services/noRetryInstance.js";
@@ -1,9 +1,10 @@
1
- var r = /* @__PURE__ */ ((e) => (e.SIGN_IN = "auth/user-login", e.SIGN_UP = "auth/sign-up", e.ME = "user", e.RESEND_VERIFICATION_EMAIL = "auth/resend-verification-email", e.UPDATE_USER_DETAILS = "account/update/user", e.CONFIRM_EMAIL = "account/verifyAccount", e.FORGOT_PASSWORD = "email/sendVeri", e.RESEND_OTP = "email/sendForgotPasswordVerification", e.RESET_PASSWORD = "account/updateUserPassword", e.REQUEST_LIMIT = "user/request-limit", e.APPLE_SOCIAL_SIGN_UP = "tp/apple/get/user", e.GOOGLE_SOCIAL_SIGN_UP = "tp/google/get/user", e.UPDATE_USER = "account/details/addUserDetails", e.ACKNOWLEDGEMENT = "account/update/userAcknowledgement", e.REGIONS = "user/region", e.UPDATE_USER_REGION = "/account/update/userRegion", e.UPDATE_PASSENGER_DETAILS = "/account/awayz", e.REFRESH_TOKEN = "auth/refresh-token", e.EXCHANGE_TOKEN = "user/exchange-token", e.REFRESH_EMBED_TOKEN = "user/refresh-token", e.OAUTH_INITIATE = "user/oauth2/initiate", e.OAUTH_CALLBACK = "user/oauth2/callback", e))(r || {}), a = /* @__PURE__ */ ((e) => (e.CURRENCY_CONVERSION = "currency/convert", e))(a || {}), _ = /* @__PURE__ */ ((e) => (e.USER_AWARDS = "user/rewards", e.USER_CARDS = "user/cards", e.ADD_USER_CARDS = "user/cards/add", e.REMOVE_USER_CARDS = "user/cards/remove", e.BANKS = "banks", e.CARDS = "cards", e))(_ || {}), S = /* @__PURE__ */ ((e) => (e.TRIPS = "user/trips", e.ADD_BOOKING = "user/trips/add-booking-to-trip", e.REMOVE_BOOKING = "user/trips/remove-booking-from-trip", e.UNCATEGORISED_BOOKINGS = "/user/trips/get-uncategorized-bookings", e))(S || {}), R = /* @__PURE__ */ ((e) => (e.USER_HOTEL_BOOKINGS = "/user/bookings/hotels", e.USER_FLIGHT_BOOKINGS = "/user/bookings/flights", e.INITIATE_FLIGHT_CANCEL = "/duffel/flights/initiate-order-cancellation", e.CONFIRM_FLIGHT_CANCEL = "/duffel/flights/confirm-order-cancellation", e.CANCEL_HOTEL_BOOKING = "/duffel/hotels/cancel", e))(R || {}), O = /* @__PURE__ */ ((e) => (e.USER_PREFERENCES = "/user/user-preferences", e))(O || {});
1
+ var r = /* @__PURE__ */ ((e) => (e.SIGN_IN = "auth/user-login", e.SIGN_UP = "auth/sign-up", e.ME = "user", e.RESEND_VERIFICATION_EMAIL = "auth/resend-verification-email", e.UPDATE_USER_DETAILS = "account/update/user", e.CONFIRM_EMAIL = "account/verifyAccount", e.FORGOT_PASSWORD = "email/sendVeri", e.RESEND_OTP = "email/sendForgotPasswordVerification", e.RESET_PASSWORD = "account/updateUserPassword", e.REQUEST_LIMIT = "user/request-limit", e.APPLE_SOCIAL_SIGN_UP = "tp/apple/get/user", e.GOOGLE_SOCIAL_SIGN_UP = "tp/google/get/user", e.UPDATE_USER = "account/details/addUserDetails", e.ACKNOWLEDGEMENT = "account/update/userAcknowledgement", e.REGIONS = "user/region", e.UPDATE_USER_REGION = "/account/update/userRegion", e.UPDATE_PASSENGER_DETAILS = "/account/awayz", e.REFRESH_TOKEN = "auth/refresh-token", e.EXCHANGE_TOKEN = "user/exchange-token", e.REFRESH_EMBED_TOKEN = "user/refresh-token", e.OAUTH_INITIATE = "user/oauth2/initiate", e.OAUTH_CALLBACK = "user/oauth2/callback", e))(r || {}), _ = /* @__PURE__ */ ((e) => (e.CURRENCY_CONVERSION = "currency/convert", e))(_ || {}), a = /* @__PURE__ */ ((e) => (e.USER_AWARDS = "user/rewards", e.LINKED_USER_AWARDS = "user/rewards/user-linked", e.USER_CARDS = "user/cards", e.ADD_USER_CARDS = "user/cards/add", e.REMOVE_USER_CARDS = "user/cards/remove", e.BANKS = "banks", e.CARDS = "cards", e))(a || {}), S = /* @__PURE__ */ ((e) => (e.TRIPS = "user/trips", e.ADD_BOOKING = "user/trips/add-booking-to-trip", e.REMOVE_BOOKING = "user/trips/remove-booking-from-trip", e.UNCATEGORISED_BOOKINGS = "/user/trips/get-uncategorized-bookings", e))(S || {}), R = /* @__PURE__ */ ((e) => (e.USER_HOTEL_BOOKINGS = "/user/bookings/hotels", e.USER_FLIGHT_BOOKINGS = "/user/bookings/flights", e.INITIATE_FLIGHT_CANCEL = "/duffel/flights/initiate-order-cancellation", e.CONFIRM_FLIGHT_CANCEL = "/duffel/flights/confirm-order-cancellation", e.CANCEL_HOTEL_BOOKING = "/duffel/hotels/cancel", e))(R || {}), I = /* @__PURE__ */ ((e) => (e.POINTS_PER_CENT = "/user/rewards/points-per-cent", e))(I || {}), O = /* @__PURE__ */ ((e) => (e.USER_PREFERENCES = "/user/user-preferences", e))(O || {});
2
2
  export {
3
3
  r as EAuthEndpoints,
4
4
  R as EBookingEndpoints,
5
- a as ECurrencyEndpoints,
5
+ _ as ECurrencyEndpoints,
6
6
  S as EMyTripsEndpoints,
7
7
  O as EPreferencesEndpoints,
8
- _ as EWalletEndpoints
8
+ I as ERewardsEndpoints,
9
+ a as EWalletEndpoints
9
10
  };
@@ -1,5 +1,5 @@
1
1
  import "../../arrayExtensions-DlcBOj5a.js";
2
- import { f as P, d as n, A as o, E as U } from "../../AccountService-cvx__9rR.js";
2
+ import { f as P, d as n, A as o, E as U } from "../../AccountService-CR5oZ1Bu.js";
3
3
  import { useState as m, useCallback as A, useEffect as S } from "react";
4
4
  import { awayzClient as O } from "../../configs/awayzClient.js";
5
5
  import { PreferencesService as v } from "../../services/preferences/PreferencesService.js";
@@ -1,7 +1,7 @@
1
1
  import { useQuery as a, useMutation as s } from "@tanstack/react-query";
2
2
  import { EBookingType as e } from "../../services/trips/TripService.types.js";
3
3
  import "../../arrayExtensions-DlcBOj5a.js";
4
- import { E as t } from "../../AccountService-cvx__9rR.js";
4
+ import { E as t } from "../../AccountService-CR5oZ1Bu.js";
5
5
  import "react";
6
6
  import { BookingService as o } from "../../services/bookings/BookingService.js";
7
7
  import "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
1
  import { renderHook as t, waitFor as r } from "../../tests/TestWrapper.js";
2
2
  import { useBookingManagement as a } from "./useBookingManagement.js";
3
- import { c as i } from "../../AccountService-cvx__9rR.js";
3
+ import { c as i } from "../../AccountService-CR5oZ1Bu.js";
4
4
  import "../../services/noRetryInstance.js";
5
5
  import "../../arrayExtensions-DlcBOj5a.js";
6
6
  import "react";
@@ -1,6 +1,6 @@
1
1
  import { useQuery as u } from "@tanstack/react-query";
2
2
  import "../arrayExtensions-DlcBOj5a.js";
3
- import { E as m, A as c, b as f } from "../AccountService-cvx__9rR.js";
3
+ import { E as m, A as c, b as f } from "../AccountService-CR5oZ1Bu.js";
4
4
  import { useEffect as d } from "react";
5
5
  import { useAwayzContext as y } from "./useAwayzContext.js";
6
6
  var i = /* @__PURE__ */ ((r) => (r.HOTEL = "Hotel", r.FLIGHT = "Flight", r))(i || {});
@@ -1,8 +1,8 @@
1
1
  import { useQuery as p, useMutation as s } from "@tanstack/react-query";
2
2
  import { h as m } from "../../arrayExtensions-DlcBOj5a.js";
3
- import { E as e } from "../../AccountService-cvx__9rR.js";
3
+ import { E as e } from "../../AccountService-CR5oZ1Bu.js";
4
4
  import "react";
5
- import { T as t } from "../../TripsService-G1T_Co8r.js";
5
+ import { T as t } from "../../TripsService-zpli8uBM.js";
6
6
  import "react/jsx-runtime";
7
7
  import "../../context/AwayzContext.js";
8
8
  import { awayzClient as o } from "../../configs/awayzClient.js";
@@ -4,9 +4,9 @@ import { useTripManagement as n } from "./useTripManagement.js";
4
4
  import "react/jsx-runtime";
5
5
  import "react";
6
6
  import "../../context/AwayzContext.js";
7
- import { D as f } from "../../TripsService-G1T_Co8r.js";
7
+ import { D as f } from "../../TripsService-zpli8uBM.js";
8
8
  import "../../configs/awayzClient.js";
9
- import { c } from "../../AccountService-cvx__9rR.js";
9
+ import { c } from "../../AccountService-CR5oZ1Bu.js";
10
10
  import { EMyTripsEndpoints as d } from "../../configs/endpoints.js";
11
11
  import "@tanstack/react-query";
12
12
  import { EBookingType as m } from "../../services/trips/TripService.types.js";
@@ -1,6 +1,6 @@
1
1
  import { useQuery as n, useMutation as i } from "@tanstack/react-query";
2
2
  import "../../arrayExtensions-DlcBOj5a.js";
3
- import { E as t, a as d } from "../../AccountService-cvx__9rR.js";
3
+ import { E as t, a as u } from "../../AccountService-CR5oZ1Bu.js";
4
4
  import "react";
5
5
  import "react/jsx-runtime";
6
6
  import "../../context/AwayzContext.js";
@@ -14,20 +14,25 @@ import '../../assets/_styles5.css';import '../../assets/_styles4.css';import '..
14
14
  /* empty css */
15
15
  import { WalletService as o } from "../../services/wallet/WalletService.js";
16
16
  const B = () => {
17
- const { user: e } = f(), { data: a } = n({
17
+ const { user: r } = f(), { data: e } = n({
18
18
  queryKey: [t.PROGRAMS],
19
19
  queryFn: o.getAwards,
20
20
  placeholderData: []
21
+ }), { data: l } = n({
22
+ queryKey: [t.USER_PROGRAMS, r == null ? void 0 : r.id],
23
+ queryFn: () => r != null && r.id ? o.getUserAwards(r.id) : [],
24
+ placeholderData: [],
25
+ enabled: !!(r != null && r.id)
21
26
  }), { data: y } = n({
22
- queryKey: [t.USER_PROGRAMS, e == null ? void 0 : e.id],
23
- queryFn: () => e != null && e.id ? o.getUserAwards(e.id) : [],
27
+ queryKey: [t.USER_PROGRAMS, r == null ? void 0 : r.id],
28
+ queryFn: () => r != null && r.id ? o.getLinkedUserAwards(r.id) : [],
24
29
  placeholderData: [],
25
- enabled: !!(e != null && e.id)
26
- }), { data: l } = n({
30
+ enabled: !!(r != null && r.id)
31
+ }), { data: g } = n({
27
32
  queryKey: [t.BANKS],
28
33
  queryFn: o.getBanks,
29
34
  placeholderData: []
30
- }), { data: g } = n({
35
+ }), { data: A } = n({
31
36
  queryKey: [t.CARDS],
32
37
  queryFn: o.getCards,
33
38
  placeholderData: []
@@ -35,51 +40,51 @@ const B = () => {
35
40
  queryKey: [t.USER_CARDS],
36
41
  queryFn: o.getUserCards,
37
42
  placeholderData: []
38
- }), { mutate: A } = i({
39
- mutationFn: async (r) => {
40
- const { mainProgram: m, awardsAmount: u } = typeof r == "string" ? { mainProgram: r, awardsAmount: 0 } : r;
41
- await o.addAwardProgram(m, u);
43
+ }), { mutate: P } = i({
44
+ mutationFn: async (a) => {
45
+ const { mainProgram: d, awardsAmount: m } = typeof a == "string" ? { mainProgram: a, awardsAmount: 0 } : a;
46
+ await o.addAwardProgram(d, m);
42
47
  },
43
48
  onSuccess: () => {
44
49
  s.invalidateQueries({
45
50
  queryKey: [t.PROGRAMS]
46
51
  });
47
52
  }
48
- }), { mutate: P } = i({
49
- mutationFn: async (r) => {
50
- await o.removeAwardProgram(r);
53
+ }), { mutate: R } = i({
54
+ mutationFn: async (a) => {
55
+ await o.removeAwardProgram(a);
51
56
  },
52
57
  onSuccess: () => {
53
58
  s.invalidateQueries({
54
59
  queryKey: [t.PROGRAMS]
55
60
  });
56
61
  }
57
- }), { mutate: R } = i({
58
- mutationFn: async (r) => {
59
- const { mainProgram: m, awardsAmount: u } = r, c = a == null ? void 0 : a.find(
60
- (w) => w.mainProgram === m
62
+ }), { mutate: S } = i({
63
+ mutationFn: async (a) => {
64
+ const { mainProgram: d, awardsAmount: m } = a, c = e == null ? void 0 : e.find(
65
+ (q) => q.mainProgram === d
61
66
  );
62
67
  if (!c)
63
68
  throw new Error("Program not found");
64
- await o.setAwardPoints(c.mainProgram, u);
69
+ await o.setAwardPoints(c.mainProgram, m);
65
70
  },
66
71
  onSuccess: () => {
67
72
  s.invalidateQueries({
68
73
  queryKey: [t.PROGRAMS]
69
74
  });
70
75
  }
71
- }), { mutate: S } = i({
72
- mutationFn: async (r) => {
73
- await o.addCardsToWallet(r);
76
+ }), { mutate: C } = i({
77
+ mutationFn: async (a) => {
78
+ await o.addCardsToWallet(a);
74
79
  },
75
80
  onSuccess: () => {
76
81
  s.invalidateQueries({
77
82
  queryKey: [t.USER_CARDS]
78
83
  });
79
84
  }
80
- }), { mutate: C } = i({
81
- mutationFn: async (r) => {
82
- await o.removeCardsFromWallet(r);
85
+ }), { mutate: w } = i({
86
+ mutationFn: async (a) => {
87
+ await o.removeCardsFromWallet(a);
83
88
  },
84
89
  onSuccess: () => {
85
90
  s.invalidateQueries({
@@ -89,26 +94,27 @@ const B = () => {
89
94
  });
90
95
  return {
91
96
  // Program Management
92
- allPrograms: a || [],
93
- userPrograms: y || [],
94
- hotelPrograms: (a == null ? void 0 : a.filter(
95
- (r) => r.category.includes(d.HOTEL)
97
+ allPrograms: e || [],
98
+ userPrograms: l || [],
99
+ linkedUserPrograms: y || [],
100
+ hotelPrograms: (e == null ? void 0 : e.filter(
101
+ (a) => a.category.includes(u.HOTEL)
96
102
  )) || [],
97
- airlinePrograms: (a == null ? void 0 : a.filter(
98
- (r) => r.category.includes(d.AIRLINE)
103
+ airlinePrograms: (e == null ? void 0 : e.filter(
104
+ (a) => a.category.includes(u.AIRLINE)
99
105
  )) || [],
100
- bankPrograms: (a == null ? void 0 : a.filter(
101
- (r) => r.category.includes(d.BANK)
106
+ bankPrograms: (e == null ? void 0 : e.filter(
107
+ (a) => a.category.includes(u.BANK)
102
108
  )) || [],
103
- updatePoints: R,
104
- addAwardProgram: A,
105
- removeAwardProgram: P,
109
+ updatePoints: S,
110
+ addAwardProgram: P,
111
+ removeAwardProgram: R,
106
112
  // Car Management
107
- banks: l || [],
108
- allCards: g || [],
113
+ banks: g || [],
114
+ allCards: A || [],
109
115
  userCards: p || [],
110
- addCards: S,
111
- removeCards: C
116
+ addCards: C,
117
+ removeCards: w
112
118
  };
113
119
  };
114
120
  export {
@@ -4,7 +4,7 @@ import "react";
4
4
  import "../../context/AwayzContext.js";
5
5
  import "../../arrayExtensions-DlcBOj5a.js";
6
6
  import "../../configs/awayzClient.js";
7
- import { c as l } from "../../AccountService-cvx__9rR.js";
7
+ import { c as l } from "../../AccountService-CR5oZ1Bu.js";
8
8
  import "@tanstack/react-query";
9
9
  import { useWallet as t } from "./useWallet.js";
10
10
  import "../../services/noRetryInstance.js";
@@ -28,7 +28,7 @@ const _ = !0, v = [{ _id: "AAAviatorBis", name: "AAdvantage Aviator Business", s
28
28
  metadata: C
29
29
  };
30
30
  m("useWallet", () => {
31
- c.mocked(l.get).mockImplementation((e) => e === r.USER_CARDS ? Promise.resolve({ data: U }) : e === r.CARDS ? Promise.resolve({ data: y }) : e === r.USER_AWARDS ? Promise.resolve({ data: A }) : Promise.resolve({
31
+ c.mocked(l.get).mockImplementation((e) => e === r.USER_CARDS ? Promise.resolve({ data: U }) : e === r.CARDS ? Promise.resolve({ data: y }) : e === r.USER_AWARDS || e === r.LINKED_USER_AWARDS ? Promise.resolve({ data: A }) : Promise.resolve({
32
32
  data: {
33
33
  success: !0
34
34
  }
@@ -27,6 +27,7 @@ export declare enum ECurrencyEndpoints {
27
27
  }
28
28
  export declare enum EWalletEndpoints {
29
29
  USER_AWARDS = "user/rewards",
30
+ LINKED_USER_AWARDS = "user/rewards/user-linked",
30
31
  USER_CARDS = "user/cards",
31
32
  ADD_USER_CARDS = "user/cards/add",
32
33
  REMOVE_USER_CARDS = "user/cards/remove",
@@ -46,6 +47,9 @@ export declare enum EBookingEndpoints {
46
47
  CONFIRM_FLIGHT_CANCEL = "/duffel/flights/confirm-order-cancellation",
47
48
  CANCEL_HOTEL_BOOKING = "/duffel/hotels/cancel"
48
49
  }
50
+ export declare enum ERewardsEndpoints {
51
+ POINTS_PER_CENT = "/user/rewards/points-per-cent"
52
+ }
49
53
  export declare enum EPreferencesEndpoints {
50
54
  USER_PREFERENCES = "/user/user-preferences"
51
55
  }
@@ -10,8 +10,13 @@ export interface IWalletHook {
10
10
  allPrograms: ILoyaltyProgram[];
11
11
  /**
12
12
  * All loyalty programs for a specific user.
13
+ * @deprecated Use linkedUserPrograms instead.
13
14
  */
14
15
  userPrograms: ILoyaltyProgram[];
16
+ /**
17
+ * All loyalty programs linked to a specific user.
18
+ */
19
+ linkedUserPrograms: ILoyaltyProgram[];
15
20
  /**
16
21
  * Supported loyalty programs related to hotels.
17
22
  */
@@ -4,3 +4,4 @@ export * from './currency/CurrencyService';
4
4
  export * from './wallet/WalletService.types';
5
5
  export * from './trips/TripService.types';
6
6
  export * from './bookings/BookingService.types';
7
+ export * from './rewards/RewardsService';
@@ -0,0 +1,27 @@
1
+ declare class _RewardsService {
2
+ /**
3
+ * Fetches the cents-per-point value for a given rewards program.
4
+ *
5
+ * @param name - The name of the rewards program (e.g., "Delta SkyMiles")
6
+ * @returns The cent value of one point, or 0 if not found (data.data.value_cents)
7
+ *
8
+ * @example
9
+ * const cents = await RewardsService.getPointsPerCent("Delta SkyMiles");
10
+ *
11
+ * @example Response structure:
12
+ * {
13
+ * success: true,
14
+ * data: {
15
+ * name: "Delta SkyMiles",
16
+ * region: "US",
17
+ * currency: "USD",
18
+ * value_cents: 1.1,
19
+ * _created: "2020-09-21T01:41:20.021Z",
20
+ * _id: "680ee8bfde2bea4d2e411cb8"
21
+ * },
22
+ * }
23
+ */
24
+ getPointsPerCent: (name: string) => Promise<any>;
25
+ }
26
+ export declare const RewardsService: _RewardsService;
27
+ export {};
@@ -2,6 +2,7 @@ import { IBank, ICard, ILoyaltyProgram } from './WalletService.types';
2
2
  declare class _WalletService {
3
3
  getAwards: () => Promise<ILoyaltyProgram[]>;
4
4
  getUserAwards: (user_id: string, category?: string) => Promise<ILoyaltyProgram[]>;
5
+ getLinkedUserAwards: (user_id: string, category?: string) => Promise<ILoyaltyProgram[]>;
5
6
  addAwardProgram: (main_program: string, amount?: number) => Promise<any>;
6
7
  removeAwardProgram: (name: string) => Promise<any>;
7
8
  setAwardPoints: (main_program: string, amount: number) => Promise<any>;
package/dist/main.js CHANGED
@@ -2,43 +2,45 @@ import { AwayzProvider as e } from "./providers/AwayzProvider.js";
2
2
  import { useAwayzContext as p } from "./hooks/useAwayzContext.js";
3
3
  import { useSearchLimit as a } from "./hooks/useSearchLimit.js";
4
4
  import { useWallet as m } from "./hooks/useWallet/useWallet.js";
5
- import { useTripManagement as f, validateUpdateTripArgs as l } from "./hooks/useTripManagement/useTripManagement.js";
5
+ import { useTripManagement as f, validateUpdateTripArgs as s } from "./hooks/useTripManagement/useTripManagement.js";
6
6
  import { useBookingManagement as c } from "./hooks/useBookingManagement/useBookingManagement.js";
7
7
  import { EAuthFlow as y } from "./types/EAuthFlow.js";
8
- import { EHotelCurrencyOption as C, currencySymbols as d } from "./types/ECurrency.js";
9
- import { c as B, i as E } from "./AccountService-cvx__9rR.js";
10
- import { clientNoRetryInstance as h } from "./services/noRetryInstance.js";
11
- import { CurrencyService as v } from "./services/currency/CurrencyService.js";
12
- import { EBookingType as z } from "./services/trips/TripService.types.js";
13
- import { awayzClient as S } from "./configs/awayzClient.js";
14
- import { CashValue as H } from "./components/CashValue/CashValue.js";
15
- import { EInvalidAmountDisplayOption as O, EToolTipPosition as P } from "./components/CashValue/CashValueTypes.js";
16
- import { Card as b } from "./components/Wallet/Card/Card.js";
17
- import { FlightBooking as L } from "./components/Bookings/FlightBooking/FlightBooking.js";
18
- import { HotelBooking as R } from "./components/Bookings/HotelBooking/HotelBooking.js";
19
- import { getBaseUrl as W } from "./configs/baseUrl.js";
8
+ import { EHotelCurrencyOption as d, currencySymbols as C } from "./types/ECurrency.js";
9
+ import { c as w, i as A } from "./AccountService-CR5oZ1Bu.js";
10
+ import { clientNoRetryInstance as E } from "./services/noRetryInstance.js";
11
+ import { CurrencyService as h } from "./services/currency/CurrencyService.js";
12
+ import { EBookingType as S } from "./services/trips/TripService.types.js";
13
+ import { RewardsService as I } from "./services/rewards/RewardsService.js";
14
+ import { awayzClient as H } from "./configs/awayzClient.js";
15
+ import { CashValue as O } from "./components/CashValue/CashValue.js";
16
+ import { EInvalidAmountDisplayOption as R, EToolTipPosition as U } from "./components/CashValue/CashValueTypes.js";
17
+ import { Card as D } from "./components/Wallet/Card/Card.js";
18
+ import { FlightBooking as N } from "./components/Bookings/FlightBooking/FlightBooking.js";
19
+ import { HotelBooking as W } from "./components/Bookings/HotelBooking/HotelBooking.js";
20
+ import { getBaseUrl as q } from "./configs/baseUrl.js";
20
21
  export {
21
22
  e as AwayzProvider,
22
- b as Card,
23
- H as CashValue,
24
- v as CurrencyService,
23
+ D as Card,
24
+ O as CashValue,
25
+ h as CurrencyService,
25
26
  y as EAuthFlow,
26
- z as EBookingType,
27
- C as EHotelCurrencyOption,
28
- O as EInvalidAmountDisplayOption,
29
- P as EToolTipPosition,
30
- L as FlightBooking,
31
- R as HotelBooking,
32
- S as awayzClient,
33
- B as clientInstance,
34
- h as clientNoRetryInstance,
35
- d as currencySymbols,
36
- W as getBaseUrl,
37
- E as instance,
27
+ S as EBookingType,
28
+ d as EHotelCurrencyOption,
29
+ R as EInvalidAmountDisplayOption,
30
+ U as EToolTipPosition,
31
+ N as FlightBooking,
32
+ W as HotelBooking,
33
+ I as RewardsService,
34
+ H as awayzClient,
35
+ w as clientInstance,
36
+ E as clientNoRetryInstance,
37
+ C as currencySymbols,
38
+ q as getBaseUrl,
39
+ A as instance,
38
40
  p as useAwayzContext,
39
41
  c as useBookingManagement,
40
42
  a as useSearchLimit,
41
43
  f as useTripManagement,
42
44
  m as useWallet,
43
- l as validateUpdateTripArgs
45
+ s as validateUpdateTripArgs
44
46
  };
@@ -2,7 +2,7 @@ import { jsx as t } from "react/jsx-runtime";
2
2
  import { useEffect as a } from "react";
3
3
  import { AwayzContext as m } from "../context/AwayzContext.js";
4
4
  import "../arrayExtensions-DlcBOj5a.js";
5
- import { d as r } from "../AccountService-cvx__9rR.js";
5
+ import { d as r } from "../AccountService-CR5oZ1Bu.js";
6
6
  import { useAwayzAuth as l } from "../hooks/useAwayzAuth/useAwayzAuth.js";
7
7
  import { setCustomBaseUrl as i, setBaseUrl as u } from "../configs/baseUrl.js";
8
8
  import { QueryClientProvider as d } from "@tanstack/react-query";
@@ -1,5 +1,5 @@
1
1
  import "../../arrayExtensions-DlcBOj5a.js";
2
- import { A as c } from "../../AccountService-cvx__9rR.js";
2
+ import { A as c } from "../../AccountService-CR5oZ1Bu.js";
3
3
  import "react";
4
4
  import "../../configs/endpoints.js";
5
5
  import "../../configs/awayzClient.js";
@@ -2,7 +2,7 @@ var l = Object.defineProperty;
2
2
  var u = (r, e, a) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[e] = a;
3
3
  var c = (r, e, a) => u(r, typeof e != "symbol" ? e + "" : e, a);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { c as i, b as s } from "../../AccountService-cvx__9rR.js";
5
+ import { c as i, b as s } from "../../AccountService-CR5oZ1Bu.js";
6
6
  import "react";
7
7
  import { EBookingEndpoints as d } from "../../configs/endpoints.js";
8
8
  const _ = (r) => {
@@ -2,7 +2,7 @@ import '../../assets/_styles5.css';import '../../assets/_styles4.css';import '..
2
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 n = (t, r, e) => y(t, typeof r != "symbol" ? r + "" : r, e);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { A as p, E as m, c as a } from "../../AccountService-cvx__9rR.js";
5
+ import { A as p, E as m, c as a } from "../../AccountService-CR5oZ1Bu.js";
6
6
  import "react";
7
7
  import { ECurrencyEndpoints as s } from "../../configs/endpoints.js";
8
8
  import "react/jsx-runtime";
@@ -1,11 +1,13 @@
1
- import { c as o, i as n } from "../AccountService-cvx__9rR.js";
1
+ import { c as o, i as t } from "../AccountService-CR5oZ1Bu.js";
2
2
  import { clientNoRetryInstance as c } from "./noRetryInstance.js";
3
3
  import { CurrencyService as a } from "./currency/CurrencyService.js";
4
4
  import { EBookingType as s } from "./trips/TripService.types.js";
5
+ import { RewardsService as m } from "./rewards/RewardsService.js";
5
6
  export {
6
7
  a as CurrencyService,
7
8
  s as EBookingType,
9
+ m as RewardsService,
8
10
  o as clientInstance,
9
11
  c as clientNoRetryInstance,
10
- n as instance
12
+ t as instance
11
13
  };
@@ -1,5 +1,5 @@
1
1
  import "../arrayExtensions-DlcBOj5a.js";
2
- import { c as a, i as c } from "../AccountService-cvx__9rR.js";
2
+ import { c as a, i as c } from "../AccountService-CR5oZ1Bu.js";
3
3
  import "react";
4
4
  import "../configs/baseUrl.js";
5
5
  export {
@@ -1,4 +1,4 @@
1
- import { m as p, k as l, l as m, g, h, p as u } from "../AccountService-cvx__9rR.js";
1
+ import { m as p, k as l, l as m, g, h, p as u } from "../AccountService-CR5oZ1Bu.js";
2
2
  import "../configs/baseUrl.js";
3
3
  import "../arrayExtensions-DlcBOj5a.js";
4
4
  import "react";
@@ -1,4 +1,4 @@
1
- import { e as t, g as r, h as n } from "../AccountService-cvx__9rR.js";
1
+ import { e as t, g as r, h as n } from "../AccountService-CR5oZ1Bu.js";
2
2
  const s = t.create();
3
3
  s.interceptors.request.use((e) => (e = r(e), e));
4
4
  const o = 1;
@@ -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 "../../AccountService-cvx__9rR.js";
5
+ import { c as i } from "../../AccountService-CR5oZ1Bu.js";
6
6
  class E {
7
7
  constructor() {
8
8
  n(this, "setCurrency", async (e) => {
@@ -0,0 +1,46 @@
1
+ var s = Object.defineProperty;
2
+ var n = (t, e, a) => e in t ? s(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
3
+ var r = (t, e, a) => n(t, typeof e != "symbol" ? e + "" : e, a);
4
+ import { ERewardsEndpoints as c } from "../../configs/endpoints.js";
5
+ import { c as o } from "../../AccountService-CR5oZ1Bu.js";
6
+ class i {
7
+ constructor() {
8
+ /**
9
+ * Fetches the cents-per-point value for a given rewards program.
10
+ *
11
+ * @param name - The name of the rewards program (e.g., "Delta SkyMiles")
12
+ * @returns The cent value of one point, or 0 if not found (data.data.value_cents)
13
+ *
14
+ * @example
15
+ * const cents = await RewardsService.getPointsPerCent("Delta SkyMiles");
16
+ *
17
+ * @example Response structure:
18
+ * {
19
+ * success: true,
20
+ * data: {
21
+ * name: "Delta SkyMiles",
22
+ * region: "US",
23
+ * currency: "USD",
24
+ * value_cents: 1.1,
25
+ * _created: "2020-09-21T01:41:20.021Z",
26
+ * _id: "680ee8bfde2bea4d2e411cb8"
27
+ * },
28
+ * }
29
+ */
30
+ r(this, "getPointsPerCent", async (e) => {
31
+ const { data: a } = await o.get(
32
+ c.POINTS_PER_CENT,
33
+ {
34
+ params: {
35
+ name: e
36
+ }
37
+ }
38
+ );
39
+ return a.data.value_cents || 0;
40
+ });
41
+ }
42
+ }
43
+ const w = new i();
44
+ export {
45
+ w as RewardsService
46
+ };
@@ -1,8 +1,8 @@
1
- import "../../AccountService-cvx__9rR.js";
1
+ import "../../AccountService-CR5oZ1Bu.js";
2
2
  import "./TripService.types.js";
3
3
  import "../../configs/endpoints.js";
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { T as s } from "../../TripsService-G1T_Co8r.js";
5
+ import { T as s } from "../../TripsService-zpli8uBM.js";
6
6
  import "react";
7
7
  export {
8
8
  s as TripsService
@@ -1,8 +1,8 @@
1
1
  var o = Object.defineProperty;
2
- var i = (n, a, t) => a in n ? o(n, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[a] = t;
3
- var r = (n, a, t) => i(n, typeof a != "symbol" ? a + "" : a, t);
2
+ var i = (d, a, t) => a in d ? o(d, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[a] = t;
3
+ var r = (d, a, t) => i(d, typeof a != "symbol" ? a + "" : a, t);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { c as s, b as d } from "../../AccountService-cvx__9rR.js";
5
+ import { c as s, b as c } from "../../AccountService-CR5oZ1Bu.js";
6
6
  import "react";
7
7
  import { EWalletEndpoints as e } from "../../configs/endpoints.js";
8
8
  class A {
@@ -13,11 +13,11 @@ class A {
13
13
  } = await s.get(
14
14
  e.USER_AWARDS
15
15
  );
16
- return d(a);
16
+ return c(a);
17
17
  });
18
18
  r(this, "getUserAwards", async (a, t) => {
19
19
  const {
20
- data: { data: c }
20
+ data: { data: n }
21
21
  } = await s.get(
22
22
  e.USER_AWARDS,
23
23
  {
@@ -27,14 +27,28 @@ class A {
27
27
  }
28
28
  }
29
29
  );
30
- return d(c);
30
+ return c(n);
31
+ });
32
+ r(this, "getLinkedUserAwards", async (a, t) => {
33
+ const {
34
+ data: { data: n }
35
+ } = await s.get(
36
+ e.LINKED_USER_AWARDS,
37
+ {
38
+ params: {
39
+ user_id: a,
40
+ category: t
41
+ }
42
+ }
43
+ );
44
+ return c(n);
31
45
  });
32
46
  r(this, "addAwardProgram", async (a, t = 0) => {
33
- const { data: c } = await s.post(e.USER_AWARDS, {
47
+ const { data: n } = await s.post(e.USER_AWARDS, {
34
48
  main_program: a,
35
49
  amount: t
36
50
  });
37
- return c;
51
+ return n;
38
52
  });
39
53
  r(this, "removeAwardProgram", async (a) => {
40
54
  const { data: t } = await s.delete(e.USER_AWARDS, {
@@ -45,29 +59,29 @@ class A {
45
59
  return t;
46
60
  });
47
61
  r(this, "setAwardPoints", async (a, t) => {
48
- const { data: c } = await s.put(e.USER_AWARDS, {
62
+ const { data: n } = await s.put(e.USER_AWARDS, {
49
63
  main_program: a,
50
64
  amount: t
51
65
  });
52
- return c;
66
+ return n;
53
67
  });
54
68
  r(this, "getBanks", async () => {
55
69
  const { data: a } = await s.get(
56
70
  e.BANKS
57
71
  );
58
- return a.success ? a.data.map((t) => d(t)) : [];
72
+ return a.success ? a.data.map((t) => c(t)) : [];
59
73
  });
60
74
  r(this, "getCards", async () => {
61
75
  const { data: a } = await s.get(
62
76
  e.CARDS
63
77
  );
64
- return a.success ? a.data.map((t) => d(t)) : [];
78
+ return a.success ? a.data.map((t) => c(t)) : [];
65
79
  });
66
80
  r(this, "getUserCards", async () => {
67
81
  const { data: a } = await s.get(
68
82
  e.USER_CARDS
69
83
  );
70
- return a.success ? a.data.map((t) => d(t)) : [];
84
+ return a.success ? a.data.map((t) => c(t)) : [];
71
85
  });
72
86
  r(this, "addCardsToWallet", async (a) => {
73
87
  const { data: t } = await s.post(
@@ -89,7 +103,7 @@ class A {
89
103
  });
90
104
  }
91
105
  }
92
- const w = new A();
106
+ const g = new A();
93
107
  export {
94
- w as WalletService
108
+ g as WalletService
95
109
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"