tf-checkout-react-native 1.0.42 → 1.0.45
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/lib/index.js +145 -42
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +145 -42
- package/lib/index.mjs.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/storageAdapter.d.ts +14 -0
- package/lib/typescript/src/utils/storageAdapter.d.ts.map +1 -0
- package/package.json +2 -1
- package/src/index.tsx +5 -0
- package/src/utils/storageAdapter.ts +44 -0
package/lib/index.mjs
CHANGED
|
@@ -9429,7 +9429,7 @@ function setCustomCookie(name, value, days = 5) {
|
|
|
9429
9429
|
date2.setTime(date2.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
9430
9430
|
expires = "; expires=" + date2.toUTCString();
|
|
9431
9431
|
}
|
|
9432
|
-
if (typeof window === "undefined") {
|
|
9432
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
9433
9433
|
return;
|
|
9434
9434
|
}
|
|
9435
9435
|
const { hostname } = window.location;
|
|
@@ -9447,7 +9447,7 @@ function setCustomCookie(name, value, days = 5) {
|
|
|
9447
9447
|
generalDomain = domain;
|
|
9448
9448
|
}
|
|
9449
9449
|
function getCookieByName(cname) {
|
|
9450
|
-
if (typeof window === "undefined") return "";
|
|
9450
|
+
if (typeof window === "undefined" || typeof document === "undefined") return "";
|
|
9451
9451
|
const name = cname + "=";
|
|
9452
9452
|
const ca = document.cookie.split(";");
|
|
9453
9453
|
for (let i = 0; i < ca.length; i++) {
|
|
@@ -9465,7 +9465,7 @@ function deleteCookieByName(name) {
|
|
|
9465
9465
|
if (getCookieByName(name) === "") {
|
|
9466
9466
|
return;
|
|
9467
9467
|
}
|
|
9468
|
-
if (typeof window === "undefined") {
|
|
9468
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
9469
9469
|
return;
|
|
9470
9470
|
}
|
|
9471
9471
|
const { hostname } = window.location;
|
|
@@ -9482,13 +9482,70 @@ function deleteCookieByName(name) {
|
|
|
9482
9482
|
} while (getCookieByName(name) !== "" && hostname !== domain);
|
|
9483
9483
|
generalDomain = domain;
|
|
9484
9484
|
}
|
|
9485
|
+
var UniversalStorage = class {
|
|
9486
|
+
constructor() {
|
|
9487
|
+
this.adapter = null;
|
|
9488
|
+
this.memoryStorage = /* @__PURE__ */ (() => {
|
|
9489
|
+
const store = /* @__PURE__ */ new Map();
|
|
9490
|
+
return {
|
|
9491
|
+
getItem: (key) => {
|
|
9492
|
+
var _a;
|
|
9493
|
+
return (_a = store.get(key)) != null ? _a : null;
|
|
9494
|
+
},
|
|
9495
|
+
setItem: (key, value) => {
|
|
9496
|
+
store.set(key, value);
|
|
9497
|
+
},
|
|
9498
|
+
removeItem: (key) => {
|
|
9499
|
+
store.delete(key);
|
|
9500
|
+
}
|
|
9501
|
+
};
|
|
9502
|
+
})();
|
|
9503
|
+
}
|
|
9504
|
+
setAdapter(adapter) {
|
|
9505
|
+
this.adapter = adapter;
|
|
9506
|
+
}
|
|
9507
|
+
getStorage() {
|
|
9508
|
+
if (this.adapter) {
|
|
9509
|
+
return this.adapter;
|
|
9510
|
+
}
|
|
9511
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
9512
|
+
return window.localStorage;
|
|
9513
|
+
}
|
|
9514
|
+
console.warn(
|
|
9515
|
+
"No storage adapter available. Using in-memory storage. Data will not persist."
|
|
9516
|
+
);
|
|
9517
|
+
return this.memoryStorage;
|
|
9518
|
+
}
|
|
9519
|
+
getItem(key) {
|
|
9520
|
+
try {
|
|
9521
|
+
return this.getStorage().getItem(key);
|
|
9522
|
+
} catch (error) {
|
|
9523
|
+
console.error(`Storage getItem error for key "${key}":`, error);
|
|
9524
|
+
return null;
|
|
9525
|
+
}
|
|
9526
|
+
}
|
|
9527
|
+
setItem(key, value) {
|
|
9528
|
+
try {
|
|
9529
|
+
this.getStorage().setItem(key, value);
|
|
9530
|
+
} catch (error) {
|
|
9531
|
+
console.error(`Storage setItem error for key "${key}":`, error);
|
|
9532
|
+
}
|
|
9533
|
+
}
|
|
9534
|
+
removeItem(key) {
|
|
9535
|
+
try {
|
|
9536
|
+
this.getStorage().removeItem(key);
|
|
9537
|
+
} catch (error) {
|
|
9538
|
+
console.error(`Storage removeItem error for key "${key}":`, error);
|
|
9539
|
+
}
|
|
9540
|
+
}
|
|
9541
|
+
};
|
|
9542
|
+
var storage = new UniversalStorage();
|
|
9485
9543
|
var headers = {
|
|
9486
9544
|
Accept: "application/vnd.api+json",
|
|
9487
9545
|
"Content-Type": "application/vnd.api+json"
|
|
9488
9546
|
};
|
|
9489
|
-
var
|
|
9490
|
-
|
|
9491
|
-
if (isWindowDefined && authGuestToken) {
|
|
9547
|
+
var authGuestToken = storage.getItem("auth_guest_token");
|
|
9548
|
+
if (authGuestToken) {
|
|
9492
9549
|
headers["Authorization-Guest"] = authGuestToken;
|
|
9493
9550
|
}
|
|
9494
9551
|
var setAxiosHeader = (key, value) => {
|
|
@@ -9531,7 +9588,9 @@ var authorize2 = async (data) => {
|
|
|
9531
9588
|
return response.data;
|
|
9532
9589
|
};
|
|
9533
9590
|
var register = async (data) => {
|
|
9534
|
-
const response = await publicRequest.post("v1/oauth/register-rn", data
|
|
9591
|
+
const response = await publicRequest.post("v1/oauth/register-rn", data, {
|
|
9592
|
+
headers: { "Content-Type": "multipart/form-data" }
|
|
9593
|
+
});
|
|
9535
9594
|
return response.data;
|
|
9536
9595
|
};
|
|
9537
9596
|
var getProfileData = async () => {
|
|
@@ -9548,7 +9607,7 @@ var checkEmailExists = async (email) => {
|
|
|
9548
9607
|
const formData = new FormData();
|
|
9549
9608
|
formData.append("email", email);
|
|
9550
9609
|
formData.append("is_checkout_flow", "true");
|
|
9551
|
-
const baseUrl = ((_a = publicRequest.defaults.baseURL) == null ? void 0 : _a.replace("/api", "")) || "";
|
|
9610
|
+
const baseUrl = CONFIGS.BASE_URL || ((_a = publicRequest.defaults.baseURL) == null ? void 0 : _a.replace("/api", "")) || "";
|
|
9552
9611
|
const url = `${baseUrl}/ajax/contact-email`;
|
|
9553
9612
|
const response = await publicRequest.post(
|
|
9554
9613
|
url,
|
|
@@ -9593,12 +9652,14 @@ var logoutUser = async ({
|
|
|
9593
9652
|
try {
|
|
9594
9653
|
await logout();
|
|
9595
9654
|
onLogoutSuccess && onLogoutSuccess();
|
|
9655
|
+
storage.removeItem("user_data");
|
|
9596
9656
|
if (isBrowser) {
|
|
9597
|
-
window.localStorage.removeItem("user_data");
|
|
9598
9657
|
setIsLogged && setIsLogged(false);
|
|
9599
|
-
const event = new window.CustomEvent("tf-logout");
|
|
9600
9658
|
deleteCookieByName("X-TF-ECOMMERCE");
|
|
9601
|
-
|
|
9659
|
+
if (typeof document !== "undefined") {
|
|
9660
|
+
const event = new window.CustomEvent("tf-logout");
|
|
9661
|
+
document.dispatchEvent(event);
|
|
9662
|
+
}
|
|
9602
9663
|
}
|
|
9603
9664
|
} catch (e) {
|
|
9604
9665
|
onLogoutError && onLogoutError(e);
|
|
@@ -9617,9 +9678,18 @@ var getQueryVariable = (variable) => {
|
|
|
9617
9678
|
}
|
|
9618
9679
|
return false;
|
|
9619
9680
|
};
|
|
9681
|
+
var priceWithCurrency = (value = "", currency = "US$") => {
|
|
9682
|
+
const num = parseFloat(value);
|
|
9683
|
+
const safe = Number.isFinite(num) ? num : 0;
|
|
9684
|
+
const formatted = safe.toLocaleString("en-US", {
|
|
9685
|
+
minimumFractionDigits: 2,
|
|
9686
|
+
maximumFractionDigits: 2
|
|
9687
|
+
});
|
|
9688
|
+
return `${currency} ${formatted}`;
|
|
9689
|
+
};
|
|
9620
9690
|
publicRequest.interceptors.request.use((config) => {
|
|
9621
9691
|
var _a;
|
|
9622
|
-
const guestToken =
|
|
9692
|
+
const guestToken = storage.getItem("auth_guest_token");
|
|
9623
9693
|
if (guestToken) {
|
|
9624
9694
|
config.headers["Authorization-Guest"] = guestToken;
|
|
9625
9695
|
}
|
|
@@ -9627,7 +9697,7 @@ publicRequest.interceptors.request.use((config) => {
|
|
|
9627
9697
|
if (xtfCookie) {
|
|
9628
9698
|
config.headers["X-TF-ECOMMERCE"] = xtfCookie;
|
|
9629
9699
|
}
|
|
9630
|
-
const additionalCookiesHeaderValue = isBrowser ? (_a = document.cookie) != null ? _a : "" : "";
|
|
9700
|
+
const additionalCookiesHeaderValue = isBrowser && typeof document !== "undefined" ? (_a = document.cookie) != null ? _a : "" : "";
|
|
9631
9701
|
if (additionalCookiesHeaderValue !== "") {
|
|
9632
9702
|
config.headers["Additional-Cookies"] = additionalCookiesHeaderValue;
|
|
9633
9703
|
}
|
|
@@ -9646,8 +9716,8 @@ publicRequest.interceptors.response.use(
|
|
|
9646
9716
|
"headers.authorization-guest",
|
|
9647
9717
|
""
|
|
9648
9718
|
);
|
|
9649
|
-
if (
|
|
9650
|
-
|
|
9719
|
+
if (authGuestToken2) {
|
|
9720
|
+
storage.setItem("auth_guest_token", authGuestToken2);
|
|
9651
9721
|
publicRequest.setGuestToken(authGuestToken2);
|
|
9652
9722
|
}
|
|
9653
9723
|
const xtfCookie = _get2(response, "headers.x-tf-ecommerce");
|
|
@@ -9661,8 +9731,8 @@ publicRequest.interceptors.response.use(
|
|
|
9661
9731
|
(error) => {
|
|
9662
9732
|
var _a;
|
|
9663
9733
|
if (((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) === 401) {
|
|
9734
|
+
storage.removeItem("user_data");
|
|
9664
9735
|
if (isBrowser) {
|
|
9665
|
-
window.localStorage.removeItem("user_data");
|
|
9666
9736
|
const errorType = _get2(error, "response.data.error");
|
|
9667
9737
|
if (errorType === "invalid_token") {
|
|
9668
9738
|
window.location.href = "/";
|
|
@@ -9670,8 +9740,8 @@ publicRequest.interceptors.response.use(
|
|
|
9670
9740
|
}
|
|
9671
9741
|
}
|
|
9672
9742
|
const authGuestToken2 = _get2(error, "response.headers.authorization-guest");
|
|
9673
|
-
if (
|
|
9674
|
-
|
|
9743
|
+
if (authGuestToken2) {
|
|
9744
|
+
storage.setItem("auth_guest_token", authGuestToken2);
|
|
9675
9745
|
publicRequest.setGuestToken(authGuestToken2);
|
|
9676
9746
|
}
|
|
9677
9747
|
return Promise.reject(error);
|
|
@@ -9684,7 +9754,7 @@ var addToCart2 = async (id, data) => {
|
|
|
9684
9754
|
{
|
|
9685
9755
|
headers: {
|
|
9686
9756
|
...publicRequest.defaults.headers.common,
|
|
9687
|
-
"Referer-Url": isBrowser ? document.referrer : ""
|
|
9757
|
+
"Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : ""
|
|
9688
9758
|
}
|
|
9689
9759
|
}
|
|
9690
9760
|
);
|
|
@@ -9714,7 +9784,7 @@ var getEvent = async (id, pk) => {
|
|
|
9714
9784
|
if (isBrowser) {
|
|
9715
9785
|
const params = new URL(`${window.location}`);
|
|
9716
9786
|
const referralId = params.searchParams.get("ttf_r") || "";
|
|
9717
|
-
const referral_key =
|
|
9787
|
+
const referral_key = storage.getItem("referral_key");
|
|
9718
9788
|
const [, referralIdlocal] = (referral_key || "").split(".");
|
|
9719
9789
|
referralValue = referralId || (referralIdlocal != null ? referralIdlocal : "");
|
|
9720
9790
|
invitationHash = params.searchParams.get("invitation-hash") || null;
|
|
@@ -9723,7 +9793,7 @@ var getEvent = async (id, pk) => {
|
|
|
9723
9793
|
params: { pk, invitationHash },
|
|
9724
9794
|
headers: {
|
|
9725
9795
|
...publicRequest.defaults.headers.common,
|
|
9726
|
-
"Referer-Url": isBrowser ? document.referrer : "",
|
|
9796
|
+
"Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : "",
|
|
9727
9797
|
"Referrer-Id": isBrowser ? referralValue : ""
|
|
9728
9798
|
}
|
|
9729
9799
|
});
|
|
@@ -9733,9 +9803,9 @@ var getTickets = async (eventId, promoCode, pk) => {
|
|
|
9733
9803
|
const invitationHash = getQueryVariable("invitation-hash");
|
|
9734
9804
|
const referralId = getQueryVariable("ttf_r");
|
|
9735
9805
|
if (referralId) {
|
|
9736
|
-
|
|
9806
|
+
storage.setItem("promoter_id", referralId);
|
|
9737
9807
|
}
|
|
9738
|
-
const promoterId =
|
|
9808
|
+
const promoterId = storage.getItem("promoter_id");
|
|
9739
9809
|
const params = { pk };
|
|
9740
9810
|
if (invitationHash) {
|
|
9741
9811
|
params["invitation-hash"] = invitationHash;
|
|
@@ -9748,7 +9818,7 @@ var getTickets = async (eventId, promoCode, pk) => {
|
|
|
9748
9818
|
if (promoCode) {
|
|
9749
9819
|
headers2["Promotion-Event"] = String(eventId);
|
|
9750
9820
|
headers2["Promotion-Code"] = promoCode;
|
|
9751
|
-
|
|
9821
|
+
storage.removeItem("promoter_id");
|
|
9752
9822
|
}
|
|
9753
9823
|
const response = await publicRequest.get(`v1/event/${eventId}/tickets/`, {
|
|
9754
9824
|
params,
|
|
@@ -9778,9 +9848,9 @@ var getTimeSlotsByDate = async (eventId, date2, promoCode, pk) => {
|
|
|
9778
9848
|
const invitationHash = getQueryVariable("invitation-hash");
|
|
9779
9849
|
const referralId = getQueryVariable("ttf_r");
|
|
9780
9850
|
if (referralId) {
|
|
9781
|
-
|
|
9851
|
+
storage.setItem("promoter_id", referralId);
|
|
9782
9852
|
}
|
|
9783
|
-
const promoterId =
|
|
9853
|
+
const promoterId = storage.getItem("promoter_id");
|
|
9784
9854
|
const params = { pk };
|
|
9785
9855
|
if (invitationHash) {
|
|
9786
9856
|
params["invitation-hash"] = invitationHash;
|
|
@@ -9793,7 +9863,7 @@ var getTimeSlotsByDate = async (eventId, date2, promoCode, pk) => {
|
|
|
9793
9863
|
if (promoCode) {
|
|
9794
9864
|
headers2["Promotion-Event"] = String(eventId);
|
|
9795
9865
|
headers2["Promotion-Code"] = promoCode;
|
|
9796
|
-
|
|
9866
|
+
storage.removeItem("promoter_id");
|
|
9797
9867
|
}
|
|
9798
9868
|
const response = await publicRequest.get(`v1/event/${eventId}/timeslots`, {
|
|
9799
9869
|
params: {
|
|
@@ -9846,7 +9916,7 @@ var getOrderDetails = async (orderId) => {
|
|
|
9846
9916
|
};
|
|
9847
9917
|
var getPaymentData = async (hash) => {
|
|
9848
9918
|
const response = await publicRequest.get(`v1/order/${hash}/review`, {
|
|
9849
|
-
headers: { "Referer-Url": isBrowser ? document.referrer : "" }
|
|
9919
|
+
headers: { "Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : "" }
|
|
9850
9920
|
});
|
|
9851
9921
|
return response.data;
|
|
9852
9922
|
};
|
|
@@ -9854,7 +9924,7 @@ var handlePaymentSuccess = async (orderHash) => {
|
|
|
9854
9924
|
const response = await publicRequest.post(`v1/order/${orderHash}/success`, void 0, {
|
|
9855
9925
|
headers: {
|
|
9856
9926
|
...publicRequest.defaults.headers.common,
|
|
9857
|
-
"Referer-Url": isBrowser ? document.referrer : ""
|
|
9927
|
+
"Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : ""
|
|
9858
9928
|
}
|
|
9859
9929
|
});
|
|
9860
9930
|
return response.data;
|
|
@@ -9863,7 +9933,7 @@ var handleFreeSuccess = async (orderHash) => {
|
|
|
9863
9933
|
const response = await publicRequest.post(
|
|
9864
9934
|
`v1/order/${orderHash}/complete_free_registration`,
|
|
9865
9935
|
void 0,
|
|
9866
|
-
{ headers: { "Referer-Url": isBrowser ? document.referrer : "" } }
|
|
9936
|
+
{ headers: { "Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : "" } }
|
|
9867
9937
|
);
|
|
9868
9938
|
return response.data;
|
|
9869
9939
|
};
|
|
@@ -11811,7 +11881,7 @@ var Checkout = forwardRef15(
|
|
|
11811
11881
|
if (item.id === key) {
|
|
11812
11882
|
item.title = (_b2 = (_a3 = texts == null ? void 0 : texts.orderReviewItems) == null ? void 0 : _a3[key]) != null ? _b2 : item.title;
|
|
11813
11883
|
if (key === "price" || key === "total") {
|
|
11814
|
-
item.value =
|
|
11884
|
+
item.value = priceWithCurrency(value, currency);
|
|
11815
11885
|
} else {
|
|
11816
11886
|
item.value = value;
|
|
11817
11887
|
}
|
|
@@ -14434,7 +14504,7 @@ var TicketListItem2 = ({
|
|
|
14434
14504
|
const feesIncluded = ticket.feeIncluded ? feesIncludedText : feesExcludedText;
|
|
14435
14505
|
const showOldPrice = ticket.price !== ticket.oldPrice;
|
|
14436
14506
|
const isTicketFree = +ticket.price === 0;
|
|
14437
|
-
const ticketPrice = isSoldOut ? soldOutText : isTicketFree ? freeText :
|
|
14507
|
+
const ticketPrice = isSoldOut ? soldOutText : isTicketFree ? freeText : priceWithCurrency(ticket.price.toFixed(2).toString(), ticket.priceSymbol);
|
|
14438
14508
|
const maximumOption = (_a = _maxBy(dropdownOptions, (o) => o.value)) == null ? void 0 : _a.value;
|
|
14439
14509
|
let rightContent = /* @__PURE__ */ jsx63(Fragment18, {});
|
|
14440
14510
|
if (ticket.soldOut || ticket.sold_out || !ticket.displayTicket) {
|
|
@@ -14456,7 +14526,7 @@ var TicketListItem2 = ({
|
|
|
14456
14526
|
/* @__PURE__ */ jsx63(Text32, { style: [CartListItemStyles.ticketNumber, styles3 == null ? void 0 : styles3.ticketName], numberOfLines: 2, children: ticket.displayName.toUpperCase() || `${ticketText} ${ticketNumber}` }),
|
|
14457
14527
|
isSoldOut ? /* @__PURE__ */ jsx63(View40, { style: [CartListItemStyles.soldOutContainer, styles3 == null ? void 0 : styles3.soldOutContainer], children: /* @__PURE__ */ jsx63(Text32, { style: [CartListItemStyles.soldOut, styles3 == null ? void 0 : styles3.soldOutText], children: soldOutMessage }) }) : /* @__PURE__ */ jsxs33(Fragment18, { children: [
|
|
14458
14528
|
/* @__PURE__ */ jsxs33(View40, { style: styles3 == null ? void 0 : styles3.pricesContainer, children: [
|
|
14459
|
-
showOldPrice && /* @__PURE__ */ jsx63(Text32, { style: [CartListItemStyles.oldPrice, styles3 == null ? void 0 : styles3.oldPrice], children:
|
|
14529
|
+
showOldPrice && /* @__PURE__ */ jsx63(Text32, { style: [CartListItemStyles.oldPrice, styles3 == null ? void 0 : styles3.oldPrice], children: priceWithCurrency((_b = ticket.oldPrice) == null ? void 0 : _b.toString(), ticket.priceSymbol) }),
|
|
14460
14530
|
/* @__PURE__ */ jsx63(Text32, { style: [CartListItemStyles.price, styles3 == null ? void 0 : styles3.price], children: ticketPrice })
|
|
14461
14531
|
] }),
|
|
14462
14532
|
/* @__PURE__ */ jsx63(Text32, { style: [CartListItemStyles.tax, styles3 == null ? void 0 : styles3.fees], children: feesIncluded.toUpperCase() })
|
|
@@ -15981,11 +16051,11 @@ var useCheckoutFlow = ({
|
|
|
15981
16051
|
updatedOrderItems.push({
|
|
15982
16052
|
id: ticket.ticket_type_id,
|
|
15983
16053
|
title: ticket.ticket_type_name,
|
|
15984
|
-
subtitle: `${ticket.quantity} x ${
|
|
16054
|
+
subtitle: `${ticket.quantity} x ${priceWithCurrency(
|
|
15985
16055
|
ticket.price_per_ticket,
|
|
15986
16056
|
currency
|
|
15987
16057
|
)}`,
|
|
15988
|
-
value:
|
|
16058
|
+
value: priceWithCurrency(ticket.total_price.toString(), currency)
|
|
15989
16059
|
});
|
|
15990
16060
|
});
|
|
15991
16061
|
}
|
|
@@ -15994,11 +16064,11 @@ var useCheckoutFlow = ({
|
|
|
15994
16064
|
updatedOrderItems.push({
|
|
15995
16065
|
id: `addon_${addon.add_on_name}`,
|
|
15996
16066
|
title: `${addon.add_on_name} (Add-on)`,
|
|
15997
|
-
subtitle: `${addon.quantity} x ${
|
|
16067
|
+
subtitle: `${addon.quantity} x ${priceWithCurrency(
|
|
15998
16068
|
addon.price_per_add_on,
|
|
15999
16069
|
currency
|
|
16000
16070
|
)}`,
|
|
16001
|
-
value:
|
|
16071
|
+
value: priceWithCurrency(addon.total_price.toString(), currency)
|
|
16002
16072
|
});
|
|
16003
16073
|
});
|
|
16004
16074
|
}
|
|
@@ -16006,13 +16076,13 @@ var useCheckoutFlow = ({
|
|
|
16006
16076
|
updatedOrderItems.push({
|
|
16007
16077
|
id: "tax",
|
|
16008
16078
|
title: cartPriceBreakdown.goods_tax_name || "Tax",
|
|
16009
|
-
value:
|
|
16079
|
+
value: priceWithCurrency(cartPriceBreakdown.goods_tax.toString(), currency)
|
|
16010
16080
|
});
|
|
16011
16081
|
}
|
|
16012
16082
|
updatedOrderItems.push({
|
|
16013
16083
|
id: "total",
|
|
16014
16084
|
title: "Total",
|
|
16015
|
-
value:
|
|
16085
|
+
value: priceWithCurrency(cartPriceBreakdown.total.toString(), currency)
|
|
16016
16086
|
});
|
|
16017
16087
|
setOrderItems(updatedOrderItems);
|
|
16018
16088
|
},
|
|
@@ -16114,14 +16184,14 @@ var useCheckoutFlow = ({
|
|
|
16114
16184
|
items.push({
|
|
16115
16185
|
id: "price",
|
|
16116
16186
|
title: "Ticket Price",
|
|
16117
|
-
value:
|
|
16187
|
+
value: priceWithCurrency(cartData.cart[0].price, currency)
|
|
16118
16188
|
});
|
|
16119
16189
|
}
|
|
16120
16190
|
const total = ((_m2 = (_l2 = cartData.cart) == null ? void 0 : _l2[0]) == null ? void 0 : _m2.price) || 0;
|
|
16121
16191
|
items.push({
|
|
16122
16192
|
id: "total",
|
|
16123
16193
|
title: "Total",
|
|
16124
|
-
value:
|
|
16194
|
+
value: priceWithCurrency(total, currency)
|
|
16125
16195
|
});
|
|
16126
16196
|
setOrderItems(items);
|
|
16127
16197
|
}
|
|
@@ -16398,7 +16468,7 @@ var AddonsContainer = ({
|
|
|
16398
16468
|
const priceWithFees = addonData.price || 0;
|
|
16399
16469
|
const addonCurrency = addonData.currency || currency;
|
|
16400
16470
|
const isAddonFree = Number(priceWithFees) === 0;
|
|
16401
|
-
const basePriceFormatted = isAddonFree ? "FREE" :
|
|
16471
|
+
const basePriceFormatted = isAddonFree ? "FREE" : priceWithCurrency((priceWithFees / 100).toString(), addonCurrency);
|
|
16402
16472
|
return /* @__PURE__ */ jsxs36(View42, { style: [customStyles == null ? void 0 : customStyles.addonItem], children: [
|
|
16403
16473
|
/* @__PURE__ */ jsxs36(View42, { style: [customStyles == null ? void 0 : customStyles.addonRow], children: [
|
|
16404
16474
|
/* @__PURE__ */ jsxs36(View42, { style: [customStyles == null ? void 0 : customStyles.addonInfo], children: [
|
|
@@ -18063,6 +18133,38 @@ var CheckoutProvider = ({ children }) => {
|
|
|
18063
18133
|
|
|
18064
18134
|
// src/index.tsx
|
|
18065
18135
|
import { LogBox, NativeModules } from "react-native";
|
|
18136
|
+
|
|
18137
|
+
// src/utils/storageAdapter.ts
|
|
18138
|
+
import { MMKV } from "react-native-mmkv";
|
|
18139
|
+
var mmkvStorage = new MMKV();
|
|
18140
|
+
var reactNativeStorageAdapter = {
|
|
18141
|
+
getItem: (key) => {
|
|
18142
|
+
try {
|
|
18143
|
+
const value = mmkvStorage.getString(key);
|
|
18144
|
+
return value != null ? value : null;
|
|
18145
|
+
} catch (error) {
|
|
18146
|
+
console.error(`[StorageAdapter] getItem error for key "${key}":`, error);
|
|
18147
|
+
return null;
|
|
18148
|
+
}
|
|
18149
|
+
},
|
|
18150
|
+
setItem: (key, value) => {
|
|
18151
|
+
try {
|
|
18152
|
+
mmkvStorage.set(key, value);
|
|
18153
|
+
} catch (error) {
|
|
18154
|
+
console.error(`[StorageAdapter] setItem error for key "${key}":`, error);
|
|
18155
|
+
}
|
|
18156
|
+
},
|
|
18157
|
+
removeItem: (key) => {
|
|
18158
|
+
try {
|
|
18159
|
+
mmkvStorage.delete(key);
|
|
18160
|
+
} catch (error) {
|
|
18161
|
+
console.error(`[StorageAdapter] removeItem error for key "${key}":`, error);
|
|
18162
|
+
}
|
|
18163
|
+
}
|
|
18164
|
+
};
|
|
18165
|
+
|
|
18166
|
+
// src/index.tsx
|
|
18167
|
+
storage.setAdapter(reactNativeStorageAdapter);
|
|
18066
18168
|
LogBox.ignoreAllLogs();
|
|
18067
18169
|
var index_default = NativeModules.TFCheckoutRNModule;
|
|
18068
18170
|
export {
|
|
@@ -18139,6 +18241,7 @@ export {
|
|
|
18139
18241
|
setConfigs,
|
|
18140
18242
|
setCustomCookie,
|
|
18141
18243
|
setLoggedUserData,
|
|
18244
|
+
storage,
|
|
18142
18245
|
updateCheckout,
|
|
18143
18246
|
useAddToCart,
|
|
18144
18247
|
useAddons,
|