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.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) => {
|
|
@@ -9607,7 +9665,9 @@ var authorize2 = async (data) => {
|
|
|
9607
9665
|
return response.data;
|
|
9608
9666
|
};
|
|
9609
9667
|
var register = async (data) => {
|
|
9610
|
-
const response = await publicRequest.post("v1/oauth/register-rn", data
|
|
9668
|
+
const response = await publicRequest.post("v1/oauth/register-rn", data, {
|
|
9669
|
+
headers: { "Content-Type": "multipart/form-data" }
|
|
9670
|
+
});
|
|
9611
9671
|
return response.data;
|
|
9612
9672
|
};
|
|
9613
9673
|
var getProfileData = async () => {
|
|
@@ -9624,7 +9684,7 @@ var checkEmailExists = async (email) => {
|
|
|
9624
9684
|
const formData = new FormData();
|
|
9625
9685
|
formData.append("email", email);
|
|
9626
9686
|
formData.append("is_checkout_flow", "true");
|
|
9627
|
-
const baseUrl = ((_a = publicRequest.defaults.baseURL) == null ? void 0 : _a.replace("/api", "")) || "";
|
|
9687
|
+
const baseUrl = CONFIGS.BASE_URL || ((_a = publicRequest.defaults.baseURL) == null ? void 0 : _a.replace("/api", "")) || "";
|
|
9628
9688
|
const url = `${baseUrl}/ajax/contact-email`;
|
|
9629
9689
|
const response = await publicRequest.post(
|
|
9630
9690
|
url,
|
|
@@ -9669,12 +9729,14 @@ var logoutUser = async ({
|
|
|
9669
9729
|
try {
|
|
9670
9730
|
await logout();
|
|
9671
9731
|
onLogoutSuccess && onLogoutSuccess();
|
|
9732
|
+
storage.removeItem("user_data");
|
|
9672
9733
|
if (isBrowser) {
|
|
9673
|
-
window.localStorage.removeItem("user_data");
|
|
9674
9734
|
setIsLogged && setIsLogged(false);
|
|
9675
|
-
const event = new window.CustomEvent("tf-logout");
|
|
9676
9735
|
deleteCookieByName("X-TF-ECOMMERCE");
|
|
9677
|
-
|
|
9736
|
+
if (typeof document !== "undefined") {
|
|
9737
|
+
const event = new window.CustomEvent("tf-logout");
|
|
9738
|
+
document.dispatchEvent(event);
|
|
9739
|
+
}
|
|
9678
9740
|
}
|
|
9679
9741
|
} catch (e) {
|
|
9680
9742
|
onLogoutError && onLogoutError(e);
|
|
@@ -9693,9 +9755,18 @@ var getQueryVariable = (variable) => {
|
|
|
9693
9755
|
}
|
|
9694
9756
|
return false;
|
|
9695
9757
|
};
|
|
9758
|
+
var priceWithCurrency = (value = "", currency = "US$") => {
|
|
9759
|
+
const num = parseFloat(value);
|
|
9760
|
+
const safe = Number.isFinite(num) ? num : 0;
|
|
9761
|
+
const formatted = safe.toLocaleString("en-US", {
|
|
9762
|
+
minimumFractionDigits: 2,
|
|
9763
|
+
maximumFractionDigits: 2
|
|
9764
|
+
});
|
|
9765
|
+
return `${currency} ${formatted}`;
|
|
9766
|
+
};
|
|
9696
9767
|
publicRequest.interceptors.request.use((config) => {
|
|
9697
9768
|
var _a;
|
|
9698
|
-
const guestToken =
|
|
9769
|
+
const guestToken = storage.getItem("auth_guest_token");
|
|
9699
9770
|
if (guestToken) {
|
|
9700
9771
|
config.headers["Authorization-Guest"] = guestToken;
|
|
9701
9772
|
}
|
|
@@ -9703,7 +9774,7 @@ publicRequest.interceptors.request.use((config) => {
|
|
|
9703
9774
|
if (xtfCookie) {
|
|
9704
9775
|
config.headers["X-TF-ECOMMERCE"] = xtfCookie;
|
|
9705
9776
|
}
|
|
9706
|
-
const additionalCookiesHeaderValue = isBrowser ? (_a = document.cookie) != null ? _a : "" : "";
|
|
9777
|
+
const additionalCookiesHeaderValue = isBrowser && typeof document !== "undefined" ? (_a = document.cookie) != null ? _a : "" : "";
|
|
9707
9778
|
if (additionalCookiesHeaderValue !== "") {
|
|
9708
9779
|
config.headers["Additional-Cookies"] = additionalCookiesHeaderValue;
|
|
9709
9780
|
}
|
|
@@ -9722,8 +9793,8 @@ publicRequest.interceptors.response.use(
|
|
|
9722
9793
|
"headers.authorization-guest",
|
|
9723
9794
|
""
|
|
9724
9795
|
);
|
|
9725
|
-
if (
|
|
9726
|
-
|
|
9796
|
+
if (authGuestToken2) {
|
|
9797
|
+
storage.setItem("auth_guest_token", authGuestToken2);
|
|
9727
9798
|
publicRequest.setGuestToken(authGuestToken2);
|
|
9728
9799
|
}
|
|
9729
9800
|
const xtfCookie = (0, import_get2.default)(response, "headers.x-tf-ecommerce");
|
|
@@ -9737,8 +9808,8 @@ publicRequest.interceptors.response.use(
|
|
|
9737
9808
|
(error) => {
|
|
9738
9809
|
var _a;
|
|
9739
9810
|
if (((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) === 401) {
|
|
9811
|
+
storage.removeItem("user_data");
|
|
9740
9812
|
if (isBrowser) {
|
|
9741
|
-
window.localStorage.removeItem("user_data");
|
|
9742
9813
|
const errorType = (0, import_get2.default)(error, "response.data.error");
|
|
9743
9814
|
if (errorType === "invalid_token") {
|
|
9744
9815
|
window.location.href = "/";
|
|
@@ -9746,8 +9817,8 @@ publicRequest.interceptors.response.use(
|
|
|
9746
9817
|
}
|
|
9747
9818
|
}
|
|
9748
9819
|
const authGuestToken2 = (0, import_get2.default)(error, "response.headers.authorization-guest");
|
|
9749
|
-
if (
|
|
9750
|
-
|
|
9820
|
+
if (authGuestToken2) {
|
|
9821
|
+
storage.setItem("auth_guest_token", authGuestToken2);
|
|
9751
9822
|
publicRequest.setGuestToken(authGuestToken2);
|
|
9752
9823
|
}
|
|
9753
9824
|
return Promise.reject(error);
|
|
@@ -9760,7 +9831,7 @@ var addToCart2 = async (id, data) => {
|
|
|
9760
9831
|
{
|
|
9761
9832
|
headers: {
|
|
9762
9833
|
...publicRequest.defaults.headers.common,
|
|
9763
|
-
"Referer-Url": isBrowser ? document.referrer : ""
|
|
9834
|
+
"Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : ""
|
|
9764
9835
|
}
|
|
9765
9836
|
}
|
|
9766
9837
|
);
|
|
@@ -9790,7 +9861,7 @@ var getEvent = async (id, pk) => {
|
|
|
9790
9861
|
if (isBrowser) {
|
|
9791
9862
|
const params = new URL(`${window.location}`);
|
|
9792
9863
|
const referralId = params.searchParams.get("ttf_r") || "";
|
|
9793
|
-
const referral_key =
|
|
9864
|
+
const referral_key = storage.getItem("referral_key");
|
|
9794
9865
|
const [, referralIdlocal] = (referral_key || "").split(".");
|
|
9795
9866
|
referralValue = referralId || (referralIdlocal != null ? referralIdlocal : "");
|
|
9796
9867
|
invitationHash = params.searchParams.get("invitation-hash") || null;
|
|
@@ -9799,7 +9870,7 @@ var getEvent = async (id, pk) => {
|
|
|
9799
9870
|
params: { pk, invitationHash },
|
|
9800
9871
|
headers: {
|
|
9801
9872
|
...publicRequest.defaults.headers.common,
|
|
9802
|
-
"Referer-Url": isBrowser ? document.referrer : "",
|
|
9873
|
+
"Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : "",
|
|
9803
9874
|
"Referrer-Id": isBrowser ? referralValue : ""
|
|
9804
9875
|
}
|
|
9805
9876
|
});
|
|
@@ -9809,9 +9880,9 @@ var getTickets = async (eventId, promoCode, pk) => {
|
|
|
9809
9880
|
const invitationHash = getQueryVariable("invitation-hash");
|
|
9810
9881
|
const referralId = getQueryVariable("ttf_r");
|
|
9811
9882
|
if (referralId) {
|
|
9812
|
-
|
|
9883
|
+
storage.setItem("promoter_id", referralId);
|
|
9813
9884
|
}
|
|
9814
|
-
const promoterId =
|
|
9885
|
+
const promoterId = storage.getItem("promoter_id");
|
|
9815
9886
|
const params = { pk };
|
|
9816
9887
|
if (invitationHash) {
|
|
9817
9888
|
params["invitation-hash"] = invitationHash;
|
|
@@ -9824,7 +9895,7 @@ var getTickets = async (eventId, promoCode, pk) => {
|
|
|
9824
9895
|
if (promoCode) {
|
|
9825
9896
|
headers2["Promotion-Event"] = String(eventId);
|
|
9826
9897
|
headers2["Promotion-Code"] = promoCode;
|
|
9827
|
-
|
|
9898
|
+
storage.removeItem("promoter_id");
|
|
9828
9899
|
}
|
|
9829
9900
|
const response = await publicRequest.get(`v1/event/${eventId}/tickets/`, {
|
|
9830
9901
|
params,
|
|
@@ -9854,9 +9925,9 @@ var getTimeSlotsByDate = async (eventId, date2, promoCode, pk) => {
|
|
|
9854
9925
|
const invitationHash = getQueryVariable("invitation-hash");
|
|
9855
9926
|
const referralId = getQueryVariable("ttf_r");
|
|
9856
9927
|
if (referralId) {
|
|
9857
|
-
|
|
9928
|
+
storage.setItem("promoter_id", referralId);
|
|
9858
9929
|
}
|
|
9859
|
-
const promoterId =
|
|
9930
|
+
const promoterId = storage.getItem("promoter_id");
|
|
9860
9931
|
const params = { pk };
|
|
9861
9932
|
if (invitationHash) {
|
|
9862
9933
|
params["invitation-hash"] = invitationHash;
|
|
@@ -9869,7 +9940,7 @@ var getTimeSlotsByDate = async (eventId, date2, promoCode, pk) => {
|
|
|
9869
9940
|
if (promoCode) {
|
|
9870
9941
|
headers2["Promotion-Event"] = String(eventId);
|
|
9871
9942
|
headers2["Promotion-Code"] = promoCode;
|
|
9872
|
-
|
|
9943
|
+
storage.removeItem("promoter_id");
|
|
9873
9944
|
}
|
|
9874
9945
|
const response = await publicRequest.get(`v1/event/${eventId}/timeslots`, {
|
|
9875
9946
|
params: {
|
|
@@ -9922,7 +9993,7 @@ var getOrderDetails = async (orderId) => {
|
|
|
9922
9993
|
};
|
|
9923
9994
|
var getPaymentData = async (hash) => {
|
|
9924
9995
|
const response = await publicRequest.get(`v1/order/${hash}/review`, {
|
|
9925
|
-
headers: { "Referer-Url": isBrowser ? document.referrer : "" }
|
|
9996
|
+
headers: { "Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : "" }
|
|
9926
9997
|
});
|
|
9927
9998
|
return response.data;
|
|
9928
9999
|
};
|
|
@@ -9930,7 +10001,7 @@ var handlePaymentSuccess = async (orderHash) => {
|
|
|
9930
10001
|
const response = await publicRequest.post(`v1/order/${orderHash}/success`, void 0, {
|
|
9931
10002
|
headers: {
|
|
9932
10003
|
...publicRequest.defaults.headers.common,
|
|
9933
|
-
"Referer-Url": isBrowser ? document.referrer : ""
|
|
10004
|
+
"Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : ""
|
|
9934
10005
|
}
|
|
9935
10006
|
});
|
|
9936
10007
|
return response.data;
|
|
@@ -9939,7 +10010,7 @@ var handleFreeSuccess = async (orderHash) => {
|
|
|
9939
10010
|
const response = await publicRequest.post(
|
|
9940
10011
|
`v1/order/${orderHash}/complete_free_registration`,
|
|
9941
10012
|
void 0,
|
|
9942
|
-
{ headers: { "Referer-Url": isBrowser ? document.referrer : "" } }
|
|
10013
|
+
{ headers: { "Referer-Url": isBrowser && typeof document !== "undefined" ? document.referrer : "" } }
|
|
9943
10014
|
);
|
|
9944
10015
|
return response.data;
|
|
9945
10016
|
};
|
|
@@ -11876,7 +11947,7 @@ var Checkout = (0, import_react38.forwardRef)(
|
|
|
11876
11947
|
if (item.id === key) {
|
|
11877
11948
|
item.title = (_b2 = (_a3 = texts == null ? void 0 : texts.orderReviewItems) == null ? void 0 : _a3[key]) != null ? _b2 : item.title;
|
|
11878
11949
|
if (key === "price" || key === "total") {
|
|
11879
|
-
item.value =
|
|
11950
|
+
item.value = priceWithCurrency(value, currency);
|
|
11880
11951
|
} else {
|
|
11881
11952
|
item.value = value;
|
|
11882
11953
|
}
|
|
@@ -14452,7 +14523,7 @@ var TicketListItem2 = ({
|
|
|
14452
14523
|
const feesIncluded = ticket.feeIncluded ? feesIncludedText : feesExcludedText;
|
|
14453
14524
|
const showOldPrice = ticket.price !== ticket.oldPrice;
|
|
14454
14525
|
const isTicketFree = +ticket.price === 0;
|
|
14455
|
-
const ticketPrice = isSoldOut ? soldOutText : isTicketFree ? freeText :
|
|
14526
|
+
const ticketPrice = isSoldOut ? soldOutText : isTicketFree ? freeText : priceWithCurrency(ticket.price.toFixed(2).toString(), ticket.priceSymbol);
|
|
14456
14527
|
const maximumOption = (_a = (0, import_maxBy.default)(dropdownOptions, (o) => o.value)) == null ? void 0 : _a.value;
|
|
14457
14528
|
let rightContent = /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, {});
|
|
14458
14529
|
if (ticket.soldOut || ticket.sold_out || !ticket.displayTicket) {
|
|
@@ -14474,7 +14545,7 @@ var TicketListItem2 = ({
|
|
|
14474
14545
|
/* @__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
14546
|
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
14547
|
/* @__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:
|
|
14548
|
+
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
14549
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_native90.Text, { style: [CartListItemStyles.price, styles3 == null ? void 0 : styles3.price], children: ticketPrice })
|
|
14479
14550
|
] }),
|
|
14480
14551
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_native90.Text, { style: [CartListItemStyles.tax, styles3 == null ? void 0 : styles3.fees], children: feesIncluded.toUpperCase() })
|
|
@@ -15993,11 +16064,11 @@ var useCheckoutFlow = ({
|
|
|
15993
16064
|
updatedOrderItems.push({
|
|
15994
16065
|
id: ticket.ticket_type_id,
|
|
15995
16066
|
title: ticket.ticket_type_name,
|
|
15996
|
-
subtitle: `${ticket.quantity} x ${
|
|
16067
|
+
subtitle: `${ticket.quantity} x ${priceWithCurrency(
|
|
15997
16068
|
ticket.price_per_ticket,
|
|
15998
16069
|
currency
|
|
15999
16070
|
)}`,
|
|
16000
|
-
value:
|
|
16071
|
+
value: priceWithCurrency(ticket.total_price.toString(), currency)
|
|
16001
16072
|
});
|
|
16002
16073
|
});
|
|
16003
16074
|
}
|
|
@@ -16006,11 +16077,11 @@ var useCheckoutFlow = ({
|
|
|
16006
16077
|
updatedOrderItems.push({
|
|
16007
16078
|
id: `addon_${addon.add_on_name}`,
|
|
16008
16079
|
title: `${addon.add_on_name} (Add-on)`,
|
|
16009
|
-
subtitle: `${addon.quantity} x ${
|
|
16080
|
+
subtitle: `${addon.quantity} x ${priceWithCurrency(
|
|
16010
16081
|
addon.price_per_add_on,
|
|
16011
16082
|
currency
|
|
16012
16083
|
)}`,
|
|
16013
|
-
value:
|
|
16084
|
+
value: priceWithCurrency(addon.total_price.toString(), currency)
|
|
16014
16085
|
});
|
|
16015
16086
|
});
|
|
16016
16087
|
}
|
|
@@ -16018,13 +16089,13 @@ var useCheckoutFlow = ({
|
|
|
16018
16089
|
updatedOrderItems.push({
|
|
16019
16090
|
id: "tax",
|
|
16020
16091
|
title: cartPriceBreakdown.goods_tax_name || "Tax",
|
|
16021
|
-
value:
|
|
16092
|
+
value: priceWithCurrency(cartPriceBreakdown.goods_tax.toString(), currency)
|
|
16022
16093
|
});
|
|
16023
16094
|
}
|
|
16024
16095
|
updatedOrderItems.push({
|
|
16025
16096
|
id: "total",
|
|
16026
16097
|
title: "Total",
|
|
16027
|
-
value:
|
|
16098
|
+
value: priceWithCurrency(cartPriceBreakdown.total.toString(), currency)
|
|
16028
16099
|
});
|
|
16029
16100
|
setOrderItems(updatedOrderItems);
|
|
16030
16101
|
},
|
|
@@ -16126,14 +16197,14 @@ var useCheckoutFlow = ({
|
|
|
16126
16197
|
items.push({
|
|
16127
16198
|
id: "price",
|
|
16128
16199
|
title: "Ticket Price",
|
|
16129
|
-
value:
|
|
16200
|
+
value: priceWithCurrency(cartData.cart[0].price, currency)
|
|
16130
16201
|
});
|
|
16131
16202
|
}
|
|
16132
16203
|
const total = ((_m2 = (_l2 = cartData.cart) == null ? void 0 : _l2[0]) == null ? void 0 : _m2.price) || 0;
|
|
16133
16204
|
items.push({
|
|
16134
16205
|
id: "total",
|
|
16135
16206
|
title: "Total",
|
|
16136
|
-
value:
|
|
16207
|
+
value: priceWithCurrency(total, currency)
|
|
16137
16208
|
});
|
|
16138
16209
|
setOrderItems(items);
|
|
16139
16210
|
}
|
|
@@ -16403,7 +16474,7 @@ var AddonsContainer = ({
|
|
|
16403
16474
|
const priceWithFees = addonData.price || 0;
|
|
16404
16475
|
const addonCurrency = addonData.currency || currency;
|
|
16405
16476
|
const isAddonFree = Number(priceWithFees) === 0;
|
|
16406
|
-
const basePriceFormatted = isAddonFree ? "FREE" :
|
|
16477
|
+
const basePriceFormatted = isAddonFree ? "FREE" : priceWithCurrency((priceWithFees / 100).toString(), addonCurrency);
|
|
16407
16478
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_react_native95.View, { style: [customStyles == null ? void 0 : customStyles.addonItem], children: [
|
|
16408
16479
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_react_native95.View, { style: [customStyles == null ? void 0 : customStyles.addonRow], children: [
|
|
16409
16480
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_react_native95.View, { style: [customStyles == null ? void 0 : customStyles.addonInfo], children: [
|
|
@@ -18068,6 +18139,38 @@ var CheckoutProvider = ({ children }) => {
|
|
|
18068
18139
|
|
|
18069
18140
|
// src/index.tsx
|
|
18070
18141
|
var import_react_native101 = require("react-native");
|
|
18142
|
+
|
|
18143
|
+
// src/utils/storageAdapter.ts
|
|
18144
|
+
var import_react_native_mmkv = require("react-native-mmkv");
|
|
18145
|
+
var mmkvStorage = new import_react_native_mmkv.MMKV();
|
|
18146
|
+
var reactNativeStorageAdapter = {
|
|
18147
|
+
getItem: (key) => {
|
|
18148
|
+
try {
|
|
18149
|
+
const value = mmkvStorage.getString(key);
|
|
18150
|
+
return value != null ? value : null;
|
|
18151
|
+
} catch (error) {
|
|
18152
|
+
console.error(`[StorageAdapter] getItem error for key "${key}":`, error);
|
|
18153
|
+
return null;
|
|
18154
|
+
}
|
|
18155
|
+
},
|
|
18156
|
+
setItem: (key, value) => {
|
|
18157
|
+
try {
|
|
18158
|
+
mmkvStorage.set(key, value);
|
|
18159
|
+
} catch (error) {
|
|
18160
|
+
console.error(`[StorageAdapter] setItem error for key "${key}":`, error);
|
|
18161
|
+
}
|
|
18162
|
+
},
|
|
18163
|
+
removeItem: (key) => {
|
|
18164
|
+
try {
|
|
18165
|
+
mmkvStorage.delete(key);
|
|
18166
|
+
} catch (error) {
|
|
18167
|
+
console.error(`[StorageAdapter] removeItem error for key "${key}":`, error);
|
|
18168
|
+
}
|
|
18169
|
+
}
|
|
18170
|
+
};
|
|
18171
|
+
|
|
18172
|
+
// src/index.tsx
|
|
18173
|
+
storage.setAdapter(reactNativeStorageAdapter);
|
|
18071
18174
|
import_react_native101.LogBox.ignoreAllLogs();
|
|
18072
18175
|
var index_default = import_react_native101.NativeModules.TFCheckoutRNModule;
|
|
18073
18176
|
//# sourceMappingURL=index.js.map
|