tf-checkout-react-native 1.0.42 → 1.0.43
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 +141 -40
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +141 -40
- 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.js
CHANGED
|
@@ -178,6 +178,7 @@ __export(index_exports, {
|
|
|
178
178
|
setConfigs: () => setConfigs,
|
|
179
179
|
setCustomCookie: () => setCustomCookie,
|
|
180
180
|
setLoggedUserData: () => setLoggedUserData,
|
|
181
|
+
storage: () => storage,
|
|
181
182
|
updateCheckout: () => updateCheckout,
|
|
182
183
|
useAddToCart: () => useAddToCart,
|
|
183
184
|
useAddons: () => useAddons,
|
|
@@ -9505,7 +9506,7 @@ function setCustomCookie(name, value, days = 5) {
|
|
|
9505
9506
|
date2.setTime(date2.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
9506
9507
|
expires = "; expires=" + date2.toUTCString();
|
|
9507
9508
|
}
|
|
9508
|
-
if (typeof window === "undefined") {
|
|
9509
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
9509
9510
|
return;
|
|
9510
9511
|
}
|
|
9511
9512
|
const { hostname } = window.location;
|
|
@@ -9523,7 +9524,7 @@ function setCustomCookie(name, value, days = 5) {
|
|
|
9523
9524
|
generalDomain = domain;
|
|
9524
9525
|
}
|
|
9525
9526
|
function getCookieByName(cname) {
|
|
9526
|
-
if (typeof window === "undefined") return "";
|
|
9527
|
+
if (typeof window === "undefined" || typeof document === "undefined") return "";
|
|
9527
9528
|
const name = cname + "=";
|
|
9528
9529
|
const ca = document.cookie.split(";");
|
|
9529
9530
|
for (let i = 0; i < ca.length; i++) {
|
|
@@ -9541,7 +9542,7 @@ function deleteCookieByName(name) {
|
|
|
9541
9542
|
if (getCookieByName(name) === "") {
|
|
9542
9543
|
return;
|
|
9543
9544
|
}
|
|
9544
|
-
if (typeof window === "undefined") {
|
|
9545
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
9545
9546
|
return;
|
|
9546
9547
|
}
|
|
9547
9548
|
const { hostname } = window.location;
|
|
@@ -9558,13 +9559,70 @@ function deleteCookieByName(name) {
|
|
|
9558
9559
|
} while (getCookieByName(name) !== "" && hostname !== domain);
|
|
9559
9560
|
generalDomain = domain;
|
|
9560
9561
|
}
|
|
9562
|
+
var UniversalStorage = class {
|
|
9563
|
+
constructor() {
|
|
9564
|
+
this.adapter = null;
|
|
9565
|
+
this.memoryStorage = /* @__PURE__ */ (() => {
|
|
9566
|
+
const store = /* @__PURE__ */ new Map();
|
|
9567
|
+
return {
|
|
9568
|
+
getItem: (key) => {
|
|
9569
|
+
var _a;
|
|
9570
|
+
return (_a = store.get(key)) != null ? _a : null;
|
|
9571
|
+
},
|
|
9572
|
+
setItem: (key, value) => {
|
|
9573
|
+
store.set(key, value);
|
|
9574
|
+
},
|
|
9575
|
+
removeItem: (key) => {
|
|
9576
|
+
store.delete(key);
|
|
9577
|
+
}
|
|
9578
|
+
};
|
|
9579
|
+
})();
|
|
9580
|
+
}
|
|
9581
|
+
setAdapter(adapter) {
|
|
9582
|
+
this.adapter = adapter;
|
|
9583
|
+
}
|
|
9584
|
+
getStorage() {
|
|
9585
|
+
if (this.adapter) {
|
|
9586
|
+
return this.adapter;
|
|
9587
|
+
}
|
|
9588
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
9589
|
+
return window.localStorage;
|
|
9590
|
+
}
|
|
9591
|
+
console.warn(
|
|
9592
|
+
"No storage adapter available. Using in-memory storage. Data will not persist."
|
|
9593
|
+
);
|
|
9594
|
+
return this.memoryStorage;
|
|
9595
|
+
}
|
|
9596
|
+
getItem(key) {
|
|
9597
|
+
try {
|
|
9598
|
+
return this.getStorage().getItem(key);
|
|
9599
|
+
} catch (error) {
|
|
9600
|
+
console.error(`Storage getItem error for key "${key}":`, error);
|
|
9601
|
+
return null;
|
|
9602
|
+
}
|
|
9603
|
+
}
|
|
9604
|
+
setItem(key, value) {
|
|
9605
|
+
try {
|
|
9606
|
+
this.getStorage().setItem(key, value);
|
|
9607
|
+
} catch (error) {
|
|
9608
|
+
console.error(`Storage setItem error for key "${key}":`, error);
|
|
9609
|
+
}
|
|
9610
|
+
}
|
|
9611
|
+
removeItem(key) {
|
|
9612
|
+
try {
|
|
9613
|
+
this.getStorage().removeItem(key);
|
|
9614
|
+
} catch (error) {
|
|
9615
|
+
console.error(`Storage removeItem error for key "${key}":`, error);
|
|
9616
|
+
}
|
|
9617
|
+
}
|
|
9618
|
+
};
|
|
9619
|
+
var storage = new UniversalStorage();
|
|
9561
9620
|
var headers = {
|
|
9562
9621
|
Accept: "application/vnd.api+json",
|
|
9563
9622
|
"Content-Type": "application/vnd.api+json"
|
|
9564
9623
|
};
|
|
9565
|
-
var
|
|
9566
|
-
|
|
9567
|
-
if (isWindowDefined && authGuestToken) {
|
|
9624
|
+
var authGuestToken = storage.getItem("auth_guest_token");
|
|
9625
|
+
if (authGuestToken) {
|
|
9568
9626
|
headers["Authorization-Guest"] = authGuestToken;
|
|
9569
9627
|
}
|
|
9570
9628
|
var setAxiosHeader = (key, value) => {
|
|
@@ -9669,12 +9727,14 @@ var logoutUser = async ({
|
|
|
9669
9727
|
try {
|
|
9670
9728
|
await logout();
|
|
9671
9729
|
onLogoutSuccess && onLogoutSuccess();
|
|
9730
|
+
storage.removeItem("user_data");
|
|
9672
9731
|
if (isBrowser) {
|
|
9673
|
-
window.localStorage.removeItem("user_data");
|
|
9674
9732
|
setIsLogged && setIsLogged(false);
|
|
9675
|
-
const event = new window.CustomEvent("tf-logout");
|
|
9676
9733
|
deleteCookieByName("X-TF-ECOMMERCE");
|
|
9677
|
-
|
|
9734
|
+
if (typeof document !== "undefined") {
|
|
9735
|
+
const event = new window.CustomEvent("tf-logout");
|
|
9736
|
+
document.dispatchEvent(event);
|
|
9737
|
+
}
|
|
9678
9738
|
}
|
|
9679
9739
|
} catch (e) {
|
|
9680
9740
|
onLogoutError && onLogoutError(e);
|
|
@@ -9693,9 +9753,18 @@ var getQueryVariable = (variable) => {
|
|
|
9693
9753
|
}
|
|
9694
9754
|
return false;
|
|
9695
9755
|
};
|
|
9756
|
+
var priceWithCurrency = (value = "", currency = "US$") => {
|
|
9757
|
+
const num = parseFloat(value);
|
|
9758
|
+
const safe = Number.isFinite(num) ? num : 0;
|
|
9759
|
+
const formatted = safe.toLocaleString("en-US", {
|
|
9760
|
+
minimumFractionDigits: 2,
|
|
9761
|
+
maximumFractionDigits: 2
|
|
9762
|
+
});
|
|
9763
|
+
return `${currency} ${formatted}`;
|
|
9764
|
+
};
|
|
9696
9765
|
publicRequest.interceptors.request.use((config) => {
|
|
9697
9766
|
var _a;
|
|
9698
|
-
const guestToken =
|
|
9767
|
+
const guestToken = storage.getItem("auth_guest_token");
|
|
9699
9768
|
if (guestToken) {
|
|
9700
9769
|
config.headers["Authorization-Guest"] = guestToken;
|
|
9701
9770
|
}
|
|
@@ -9703,7 +9772,7 @@ publicRequest.interceptors.request.use((config) => {
|
|
|
9703
9772
|
if (xtfCookie) {
|
|
9704
9773
|
config.headers["X-TF-ECOMMERCE"] = xtfCookie;
|
|
9705
9774
|
}
|
|
9706
|
-
const additionalCookiesHeaderValue = isBrowser ? (_a = document.cookie) != null ? _a : "" : "";
|
|
9775
|
+
const additionalCookiesHeaderValue = isBrowser && typeof document !== "undefined" ? (_a = document.cookie) != null ? _a : "" : "";
|
|
9707
9776
|
if (additionalCookiesHeaderValue !== "") {
|
|
9708
9777
|
config.headers["Additional-Cookies"] = additionalCookiesHeaderValue;
|
|
9709
9778
|
}
|
|
@@ -9722,8 +9791,8 @@ publicRequest.interceptors.response.use(
|
|
|
9722
9791
|
"headers.authorization-guest",
|
|
9723
9792
|
""
|
|
9724
9793
|
);
|
|
9725
|
-
if (
|
|
9726
|
-
|
|
9794
|
+
if (authGuestToken2) {
|
|
9795
|
+
storage.setItem("auth_guest_token", authGuestToken2);
|
|
9727
9796
|
publicRequest.setGuestToken(authGuestToken2);
|
|
9728
9797
|
}
|
|
9729
9798
|
const xtfCookie = (0, import_get2.default)(response, "headers.x-tf-ecommerce");
|
|
@@ -9737,8 +9806,8 @@ publicRequest.interceptors.response.use(
|
|
|
9737
9806
|
(error) => {
|
|
9738
9807
|
var _a;
|
|
9739
9808
|
if (((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) === 401) {
|
|
9809
|
+
storage.removeItem("user_data");
|
|
9740
9810
|
if (isBrowser) {
|
|
9741
|
-
window.localStorage.removeItem("user_data");
|
|
9742
9811
|
const errorType = (0, import_get2.default)(error, "response.data.error");
|
|
9743
9812
|
if (errorType === "invalid_token") {
|
|
9744
9813
|
window.location.href = "/";
|
|
@@ -9746,8 +9815,8 @@ publicRequest.interceptors.response.use(
|
|
|
9746
9815
|
}
|
|
9747
9816
|
}
|
|
9748
9817
|
const authGuestToken2 = (0, import_get2.default)(error, "response.headers.authorization-guest");
|
|
9749
|
-
if (
|
|
9750
|
-
|
|
9818
|
+
if (authGuestToken2) {
|
|
9819
|
+
storage.setItem("auth_guest_token", authGuestToken2);
|
|
9751
9820
|
publicRequest.setGuestToken(authGuestToken2);
|
|
9752
9821
|
}
|
|
9753
9822
|
return Promise.reject(error);
|
|
@@ -9760,7 +9829,7 @@ var addToCart2 = async (id, data) => {
|
|
|
9760
9829
|
{
|
|
9761
9830
|
headers: {
|
|
9762
9831
|
...publicRequest.defaults.headers.common,
|
|
9763
|
-
"Referer-Url": isBrowser ? document.referrer : ""
|
|
9832
|
+
"Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : ""
|
|
9764
9833
|
}
|
|
9765
9834
|
}
|
|
9766
9835
|
);
|
|
@@ -9790,7 +9859,7 @@ var getEvent = async (id, pk) => {
|
|
|
9790
9859
|
if (isBrowser) {
|
|
9791
9860
|
const params = new URL(`${window.location}`);
|
|
9792
9861
|
const referralId = params.searchParams.get("ttf_r") || "";
|
|
9793
|
-
const referral_key =
|
|
9862
|
+
const referral_key = storage.getItem("referral_key");
|
|
9794
9863
|
const [, referralIdlocal] = (referral_key || "").split(".");
|
|
9795
9864
|
referralValue = referralId || (referralIdlocal != null ? referralIdlocal : "");
|
|
9796
9865
|
invitationHash = params.searchParams.get("invitation-hash") || null;
|
|
@@ -9799,7 +9868,7 @@ var getEvent = async (id, pk) => {
|
|
|
9799
9868
|
params: { pk, invitationHash },
|
|
9800
9869
|
headers: {
|
|
9801
9870
|
...publicRequest.defaults.headers.common,
|
|
9802
|
-
"Referer-Url": isBrowser ? document.referrer : "",
|
|
9871
|
+
"Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : "",
|
|
9803
9872
|
"Referrer-Id": isBrowser ? referralValue : ""
|
|
9804
9873
|
}
|
|
9805
9874
|
});
|
|
@@ -9809,9 +9878,9 @@ var getTickets = async (eventId, promoCode, pk) => {
|
|
|
9809
9878
|
const invitationHash = getQueryVariable("invitation-hash");
|
|
9810
9879
|
const referralId = getQueryVariable("ttf_r");
|
|
9811
9880
|
if (referralId) {
|
|
9812
|
-
|
|
9881
|
+
storage.setItem("promoter_id", referralId);
|
|
9813
9882
|
}
|
|
9814
|
-
const promoterId =
|
|
9883
|
+
const promoterId = storage.getItem("promoter_id");
|
|
9815
9884
|
const params = { pk };
|
|
9816
9885
|
if (invitationHash) {
|
|
9817
9886
|
params["invitation-hash"] = invitationHash;
|
|
@@ -9824,7 +9893,7 @@ var getTickets = async (eventId, promoCode, pk) => {
|
|
|
9824
9893
|
if (promoCode) {
|
|
9825
9894
|
headers2["Promotion-Event"] = String(eventId);
|
|
9826
9895
|
headers2["Promotion-Code"] = promoCode;
|
|
9827
|
-
|
|
9896
|
+
storage.removeItem("promoter_id");
|
|
9828
9897
|
}
|
|
9829
9898
|
const response = await publicRequest.get(`v1/event/${eventId}/tickets/`, {
|
|
9830
9899
|
params,
|
|
@@ -9854,9 +9923,9 @@ var getTimeSlotsByDate = async (eventId, date2, promoCode, pk) => {
|
|
|
9854
9923
|
const invitationHash = getQueryVariable("invitation-hash");
|
|
9855
9924
|
const referralId = getQueryVariable("ttf_r");
|
|
9856
9925
|
if (referralId) {
|
|
9857
|
-
|
|
9926
|
+
storage.setItem("promoter_id", referralId);
|
|
9858
9927
|
}
|
|
9859
|
-
const promoterId =
|
|
9928
|
+
const promoterId = storage.getItem("promoter_id");
|
|
9860
9929
|
const params = { pk };
|
|
9861
9930
|
if (invitationHash) {
|
|
9862
9931
|
params["invitation-hash"] = invitationHash;
|
|
@@ -9869,7 +9938,7 @@ var getTimeSlotsByDate = async (eventId, date2, promoCode, pk) => {
|
|
|
9869
9938
|
if (promoCode) {
|
|
9870
9939
|
headers2["Promotion-Event"] = String(eventId);
|
|
9871
9940
|
headers2["Promotion-Code"] = promoCode;
|
|
9872
|
-
|
|
9941
|
+
storage.removeItem("promoter_id");
|
|
9873
9942
|
}
|
|
9874
9943
|
const response = await publicRequest.get(`v1/event/${eventId}/timeslots`, {
|
|
9875
9944
|
params: {
|
|
@@ -9922,7 +9991,7 @@ var getOrderDetails = async (orderId) => {
|
|
|
9922
9991
|
};
|
|
9923
9992
|
var getPaymentData = async (hash) => {
|
|
9924
9993
|
const response = await publicRequest.get(`v1/order/${hash}/review`, {
|
|
9925
|
-
headers: { "Referer-Url": isBrowser ? document.referrer : "" }
|
|
9994
|
+
headers: { "Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : "" }
|
|
9926
9995
|
});
|
|
9927
9996
|
return response.data;
|
|
9928
9997
|
};
|
|
@@ -9930,7 +9999,7 @@ var handlePaymentSuccess = async (orderHash) => {
|
|
|
9930
9999
|
const response = await publicRequest.post(`v1/order/${orderHash}/success`, void 0, {
|
|
9931
10000
|
headers: {
|
|
9932
10001
|
...publicRequest.defaults.headers.common,
|
|
9933
|
-
"Referer-Url": isBrowser ? document.referrer : ""
|
|
10002
|
+
"Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : ""
|
|
9934
10003
|
}
|
|
9935
10004
|
});
|
|
9936
10005
|
return response.data;
|
|
@@ -9939,7 +10008,7 @@ var handleFreeSuccess = async (orderHash) => {
|
|
|
9939
10008
|
const response = await publicRequest.post(
|
|
9940
10009
|
`v1/order/${orderHash}/complete_free_registration`,
|
|
9941
10010
|
void 0,
|
|
9942
|
-
{ headers: { "Referer-Url": isBrowser ? document.referrer : "" } }
|
|
10011
|
+
{ headers: { "Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : "" } }
|
|
9943
10012
|
);
|
|
9944
10013
|
return response.data;
|
|
9945
10014
|
};
|
|
@@ -11876,7 +11945,7 @@ var Checkout = (0, import_react38.forwardRef)(
|
|
|
11876
11945
|
if (item.id === key) {
|
|
11877
11946
|
item.title = (_b2 = (_a3 = texts == null ? void 0 : texts.orderReviewItems) == null ? void 0 : _a3[key]) != null ? _b2 : item.title;
|
|
11878
11947
|
if (key === "price" || key === "total") {
|
|
11879
|
-
item.value =
|
|
11948
|
+
item.value = priceWithCurrency(value, currency);
|
|
11880
11949
|
} else {
|
|
11881
11950
|
item.value = value;
|
|
11882
11951
|
}
|
|
@@ -14452,7 +14521,7 @@ var TicketListItem2 = ({
|
|
|
14452
14521
|
const feesIncluded = ticket.feeIncluded ? feesIncludedText : feesExcludedText;
|
|
14453
14522
|
const showOldPrice = ticket.price !== ticket.oldPrice;
|
|
14454
14523
|
const isTicketFree = +ticket.price === 0;
|
|
14455
|
-
const ticketPrice = isSoldOut ? soldOutText : isTicketFree ? freeText :
|
|
14524
|
+
const ticketPrice = isSoldOut ? soldOutText : isTicketFree ? freeText : priceWithCurrency(ticket.price.toFixed(2).toString(), ticket.priceSymbol);
|
|
14456
14525
|
const maximumOption = (_a = (0, import_maxBy.default)(dropdownOptions, (o) => o.value)) == null ? void 0 : _a.value;
|
|
14457
14526
|
let rightContent = /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, {});
|
|
14458
14527
|
if (ticket.soldOut || ticket.sold_out || !ticket.displayTicket) {
|
|
@@ -14474,7 +14543,7 @@ var TicketListItem2 = ({
|
|
|
14474
14543
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_native90.Text, { style: [CartListItemStyles.ticketNumber, styles3 == null ? void 0 : styles3.ticketName], numberOfLines: 2, children: ticket.displayName.toUpperCase() || `${ticketText} ${ticketNumber}` }),
|
|
14475
14544
|
isSoldOut ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_native90.View, { style: [CartListItemStyles.soldOutContainer, styles3 == null ? void 0 : styles3.soldOutContainer], children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_native90.Text, { style: [CartListItemStyles.soldOut, styles3 == null ? void 0 : styles3.soldOutText], children: soldOutMessage }) }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
14476
14545
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_react_native90.View, { style: styles3 == null ? void 0 : styles3.pricesContainer, children: [
|
|
14477
|
-
showOldPrice && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_native90.Text, { style: [CartListItemStyles.oldPrice, styles3 == null ? void 0 : styles3.oldPrice], children:
|
|
14546
|
+
showOldPrice && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_native90.Text, { style: [CartListItemStyles.oldPrice, styles3 == null ? void 0 : styles3.oldPrice], children: priceWithCurrency((_b = ticket.oldPrice) == null ? void 0 : _b.toString(), ticket.priceSymbol) }),
|
|
14478
14547
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_native90.Text, { style: [CartListItemStyles.price, styles3 == null ? void 0 : styles3.price], children: ticketPrice })
|
|
14479
14548
|
] }),
|
|
14480
14549
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_native90.Text, { style: [CartListItemStyles.tax, styles3 == null ? void 0 : styles3.fees], children: feesIncluded.toUpperCase() })
|
|
@@ -15993,11 +16062,11 @@ var useCheckoutFlow = ({
|
|
|
15993
16062
|
updatedOrderItems.push({
|
|
15994
16063
|
id: ticket.ticket_type_id,
|
|
15995
16064
|
title: ticket.ticket_type_name,
|
|
15996
|
-
subtitle: `${ticket.quantity} x ${
|
|
16065
|
+
subtitle: `${ticket.quantity} x ${priceWithCurrency(
|
|
15997
16066
|
ticket.price_per_ticket,
|
|
15998
16067
|
currency
|
|
15999
16068
|
)}`,
|
|
16000
|
-
value:
|
|
16069
|
+
value: priceWithCurrency(ticket.total_price.toString(), currency)
|
|
16001
16070
|
});
|
|
16002
16071
|
});
|
|
16003
16072
|
}
|
|
@@ -16006,11 +16075,11 @@ var useCheckoutFlow = ({
|
|
|
16006
16075
|
updatedOrderItems.push({
|
|
16007
16076
|
id: `addon_${addon.add_on_name}`,
|
|
16008
16077
|
title: `${addon.add_on_name} (Add-on)`,
|
|
16009
|
-
subtitle: `${addon.quantity} x ${
|
|
16078
|
+
subtitle: `${addon.quantity} x ${priceWithCurrency(
|
|
16010
16079
|
addon.price_per_add_on,
|
|
16011
16080
|
currency
|
|
16012
16081
|
)}`,
|
|
16013
|
-
value:
|
|
16082
|
+
value: priceWithCurrency(addon.total_price.toString(), currency)
|
|
16014
16083
|
});
|
|
16015
16084
|
});
|
|
16016
16085
|
}
|
|
@@ -16018,13 +16087,13 @@ var useCheckoutFlow = ({
|
|
|
16018
16087
|
updatedOrderItems.push({
|
|
16019
16088
|
id: "tax",
|
|
16020
16089
|
title: cartPriceBreakdown.goods_tax_name || "Tax",
|
|
16021
|
-
value:
|
|
16090
|
+
value: priceWithCurrency(cartPriceBreakdown.goods_tax.toString(), currency)
|
|
16022
16091
|
});
|
|
16023
16092
|
}
|
|
16024
16093
|
updatedOrderItems.push({
|
|
16025
16094
|
id: "total",
|
|
16026
16095
|
title: "Total",
|
|
16027
|
-
value:
|
|
16096
|
+
value: priceWithCurrency(cartPriceBreakdown.total.toString(), currency)
|
|
16028
16097
|
});
|
|
16029
16098
|
setOrderItems(updatedOrderItems);
|
|
16030
16099
|
},
|
|
@@ -16126,14 +16195,14 @@ var useCheckoutFlow = ({
|
|
|
16126
16195
|
items.push({
|
|
16127
16196
|
id: "price",
|
|
16128
16197
|
title: "Ticket Price",
|
|
16129
|
-
value:
|
|
16198
|
+
value: priceWithCurrency(cartData.cart[0].price, currency)
|
|
16130
16199
|
});
|
|
16131
16200
|
}
|
|
16132
16201
|
const total = ((_m2 = (_l2 = cartData.cart) == null ? void 0 : _l2[0]) == null ? void 0 : _m2.price) || 0;
|
|
16133
16202
|
items.push({
|
|
16134
16203
|
id: "total",
|
|
16135
16204
|
title: "Total",
|
|
16136
|
-
value:
|
|
16205
|
+
value: priceWithCurrency(total, currency)
|
|
16137
16206
|
});
|
|
16138
16207
|
setOrderItems(items);
|
|
16139
16208
|
}
|
|
@@ -16403,7 +16472,7 @@ var AddonsContainer = ({
|
|
|
16403
16472
|
const priceWithFees = addonData.price || 0;
|
|
16404
16473
|
const addonCurrency = addonData.currency || currency;
|
|
16405
16474
|
const isAddonFree = Number(priceWithFees) === 0;
|
|
16406
|
-
const basePriceFormatted = isAddonFree ? "FREE" :
|
|
16475
|
+
const basePriceFormatted = isAddonFree ? "FREE" : priceWithCurrency((priceWithFees / 100).toString(), addonCurrency);
|
|
16407
16476
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_react_native95.View, { style: [customStyles == null ? void 0 : customStyles.addonItem], children: [
|
|
16408
16477
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_react_native95.View, { style: [customStyles == null ? void 0 : customStyles.addonRow], children: [
|
|
16409
16478
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_react_native95.View, { style: [customStyles == null ? void 0 : customStyles.addonInfo], children: [
|
|
@@ -18068,6 +18137,38 @@ var CheckoutProvider = ({ children }) => {
|
|
|
18068
18137
|
|
|
18069
18138
|
// src/index.tsx
|
|
18070
18139
|
var import_react_native101 = require("react-native");
|
|
18140
|
+
|
|
18141
|
+
// src/utils/storageAdapter.ts
|
|
18142
|
+
var import_react_native_mmkv = require("react-native-mmkv");
|
|
18143
|
+
var mmkvStorage = new import_react_native_mmkv.MMKV();
|
|
18144
|
+
var reactNativeStorageAdapter = {
|
|
18145
|
+
getItem: (key) => {
|
|
18146
|
+
try {
|
|
18147
|
+
const value = mmkvStorage.getString(key);
|
|
18148
|
+
return value != null ? value : null;
|
|
18149
|
+
} catch (error) {
|
|
18150
|
+
console.error(`[StorageAdapter] getItem error for key "${key}":`, error);
|
|
18151
|
+
return null;
|
|
18152
|
+
}
|
|
18153
|
+
},
|
|
18154
|
+
setItem: (key, value) => {
|
|
18155
|
+
try {
|
|
18156
|
+
mmkvStorage.set(key, value);
|
|
18157
|
+
} catch (error) {
|
|
18158
|
+
console.error(`[StorageAdapter] setItem error for key "${key}":`, error);
|
|
18159
|
+
}
|
|
18160
|
+
},
|
|
18161
|
+
removeItem: (key) => {
|
|
18162
|
+
try {
|
|
18163
|
+
mmkvStorage.delete(key);
|
|
18164
|
+
} catch (error) {
|
|
18165
|
+
console.error(`[StorageAdapter] removeItem error for key "${key}":`, error);
|
|
18166
|
+
}
|
|
18167
|
+
}
|
|
18168
|
+
};
|
|
18169
|
+
|
|
18170
|
+
// src/index.tsx
|
|
18171
|
+
storage.setAdapter(reactNativeStorageAdapter);
|
|
18071
18172
|
import_react_native101.LogBox.ignoreAllLogs();
|
|
18072
18173
|
var index_default = import_react_native101.NativeModules.TFCheckoutRNModule;
|
|
18073
18174
|
//# sourceMappingURL=index.js.map
|