tf-checkout-react-native 2.0.0-beta.10 → 2.0.0-beta.11
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/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +61 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4730,6 +4730,19 @@ var accountRewardsView = (data, t) => ({
|
|
|
4730
4730
|
}
|
|
4731
4731
|
})
|
|
4732
4732
|
});
|
|
4733
|
+
var presentDate = (date, fallback, locale, includeTime = false, timeZone = "UTC") => {
|
|
4734
|
+
try {
|
|
4735
|
+
return new Intl.DateTimeFormat(locale, {
|
|
4736
|
+
year: "numeric",
|
|
4737
|
+
month: "short",
|
|
4738
|
+
day: "numeric",
|
|
4739
|
+
timeZone,
|
|
4740
|
+
...includeTime ? { hour: "2-digit", minute: "2-digit" } : {}
|
|
4741
|
+
}).format(date);
|
|
4742
|
+
} catch (e) {
|
|
4743
|
+
return fallback;
|
|
4744
|
+
}
|
|
4745
|
+
};
|
|
4733
4746
|
var text = (value6) => {
|
|
4734
4747
|
if (typeof value6 !== "string")
|
|
4735
4748
|
throw new TypeError("Payment plan details are unavailable. Refresh your order.");
|
|
@@ -4802,17 +4815,7 @@ var accountPlanDate = (value6, locale, includeTime = false) => {
|
|
|
4802
4815
|
Number(match[5])
|
|
4803
4816
|
)
|
|
4804
4817
|
);
|
|
4805
|
-
|
|
4806
|
-
return new Intl.DateTimeFormat(locale, {
|
|
4807
|
-
year: "numeric",
|
|
4808
|
-
month: "short",
|
|
4809
|
-
day: "numeric",
|
|
4810
|
-
timeZone: "UTC",
|
|
4811
|
-
...includeTime ? { hour: "2-digit", minute: "2-digit" } : {}
|
|
4812
|
-
}).format(date);
|
|
4813
|
-
} catch (e) {
|
|
4814
|
-
return value6;
|
|
4815
|
-
}
|
|
4818
|
+
return presentDate(date, value6, locale, includeTime);
|
|
4816
4819
|
};
|
|
4817
4820
|
var decodeHtmlEntities = (text6) => decodeHTML(text6);
|
|
4818
4821
|
var BLOCK_ELEMENTS = /* @__PURE__ */ new Set([
|
|
@@ -5597,7 +5600,7 @@ var brandingLines = (identities = []) => identities.map(
|
|
|
5597
5600
|
)
|
|
5598
5601
|
).filter(Boolean);
|
|
5599
5602
|
var tripItemLines = (item, locale) => {
|
|
5600
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i
|
|
5603
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
5601
5604
|
const copy = tripCopy(locale);
|
|
5602
5605
|
const details = (_a2 = item.details) != null ? _a2 : {};
|
|
5603
5606
|
const lines = [
|
|
@@ -5609,23 +5612,53 @@ var tripItemLines = (item, locale) => {
|
|
|
5609
5612
|
if (room) lines.push(room);
|
|
5610
5613
|
const checkIn = (_c = details.check_in) != null ? _c : item.check_in;
|
|
5611
5614
|
const checkOut = (_d = details.check_out) != null ? _d : item.check_out;
|
|
5612
|
-
if (checkIn) lines.push(`${copy.check_in}: ${checkIn}`);
|
|
5613
|
-
if (checkOut) lines.push(`${copy.check_out}: ${checkOut}`);
|
|
5615
|
+
if (checkIn) lines.push(`${copy.check_in}: ${tripDate(checkIn, locale)}`);
|
|
5616
|
+
if (checkOut) lines.push(`${copy.check_out}: ${tripDate(checkOut, locale)}`);
|
|
5614
5617
|
for (const segment of (_e = details.itinerary) != null ? _e : []) {
|
|
5615
5618
|
lines.push(
|
|
5616
5619
|
`${(_f = segment.originCode) != null ? _f : ""} \u2192 ${(_g = segment.destinationCode) != null ? _g : ""}`,
|
|
5617
|
-
`${(
|
|
5620
|
+
`${tripDate(segment.departureTime, locale)} \xB7 ${tripDate(segment.arrivalTime, locale)}`
|
|
5618
5621
|
);
|
|
5619
5622
|
}
|
|
5620
|
-
const date = (
|
|
5621
|
-
if (date) lines.push(date);
|
|
5623
|
+
const date = (_h = details.provider_date_time) != null ? _h : details.dateTime;
|
|
5624
|
+
if (date) lines.push(tripDate(date, locale));
|
|
5622
5625
|
if (item.total !== null && item.total !== void 0)
|
|
5623
|
-
lines.push(`${copy.total}: ${item.total} ${(
|
|
5626
|
+
lines.push(`${copy.total}: ${item.total} ${(_i = item.currency) != null ? _i : ""}`);
|
|
5624
5627
|
return lines;
|
|
5625
5628
|
};
|
|
5626
5629
|
var tripSectionNames = (data) => ["tickets", "stays", "hotels", "flights", "activities"].filter(
|
|
5627
5630
|
(name) => data.sections[name] !== void 0
|
|
5628
5631
|
);
|
|
5632
|
+
var tripDate = (value6, locale, timeZone) => {
|
|
5633
|
+
if (!value6) return "";
|
|
5634
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(Z|[+-]\d{2}:\d{2})?)?$/.exec(
|
|
5635
|
+
value6
|
|
5636
|
+
);
|
|
5637
|
+
if (!match) return value6;
|
|
5638
|
+
const [year, month, day, hour, minute, second] = match.slice(1, 7).map((part) => Number(part != null ? part : 0));
|
|
5639
|
+
const wall = /* @__PURE__ */ new Date(0);
|
|
5640
|
+
wall.setUTCFullYear(year, month - 1, day);
|
|
5641
|
+
wall.setUTCHours(hour, minute, second, 0);
|
|
5642
|
+
if (wall.getUTCFullYear() !== year || wall.getUTCMonth() !== month - 1 || wall.getUTCDate() !== day || wall.getUTCHours() !== hour || wall.getUTCMinutes() !== minute || wall.getUTCSeconds() !== second)
|
|
5643
|
+
return value6;
|
|
5644
|
+
const offset = match[7];
|
|
5645
|
+
let offsetMinutes = 0;
|
|
5646
|
+
if (offset && offset !== "Z") {
|
|
5647
|
+
const hours = Number(offset.slice(1, 3)), minutes = Number(offset.slice(4, 6));
|
|
5648
|
+
if (hours > 23 || minutes > 59) return value6;
|
|
5649
|
+
offsetMinutes = (hours * 60 + minutes) * (offset[0] === "+" ? 1 : -1);
|
|
5650
|
+
}
|
|
5651
|
+
const includeTime = match[4] !== void 0;
|
|
5652
|
+
const local = presentDate(wall, value6, locale, includeTime);
|
|
5653
|
+
if (!timeZone || !offset) return local;
|
|
5654
|
+
return presentDate(
|
|
5655
|
+
new Date(wall.getTime() - offsetMinutes * 6e4),
|
|
5656
|
+
local,
|
|
5657
|
+
locale,
|
|
5658
|
+
includeTime,
|
|
5659
|
+
timeZone
|
|
5660
|
+
);
|
|
5661
|
+
};
|
|
5629
5662
|
var tripsView = (data, locale) => {
|
|
5630
5663
|
const copy = tripCopy(locale);
|
|
5631
5664
|
if (!isEventTrip(data)) {
|
|
@@ -5645,8 +5678,8 @@ var tripsView = (data, locale) => {
|
|
|
5645
5678
|
title: trip.name,
|
|
5646
5679
|
lines: [
|
|
5647
5680
|
...brandingLines(trip.branding),
|
|
5648
|
-
trip.starts_at,
|
|
5649
|
-
trip.ends_at,
|
|
5681
|
+
tripDate(trip.starts_at, locale, trip.timezone),
|
|
5682
|
+
tripDate(trip.ends_at, locale, trip.timezone),
|
|
5650
5683
|
trip.venue
|
|
5651
5684
|
].filter((line) => Boolean(line)),
|
|
5652
5685
|
actions: [{ label: copy.open, url: trip.trip_url }]
|
|
@@ -5657,7 +5690,11 @@ var tripsView = (data, locale) => {
|
|
|
5657
5690
|
}
|
|
5658
5691
|
return {
|
|
5659
5692
|
title: data.event.name,
|
|
5660
|
-
subtitle: [
|
|
5693
|
+
subtitle: [
|
|
5694
|
+
tripDate(data.event.starts_at, locale, data.event.timezone),
|
|
5695
|
+
tripDate(data.event.ends_at, locale, data.event.timezone),
|
|
5696
|
+
data.event.venue
|
|
5697
|
+
].filter(Boolean).join(" \xB7 "),
|
|
5661
5698
|
sections: tripSectionNames(data).map((name) => {
|
|
5662
5699
|
const section = data.sections[name];
|
|
5663
5700
|
if (!section) return null;
|
|
@@ -8819,7 +8856,7 @@ var readProfileBeforeConfirmation = async (beforeConfirmation, permit) => {
|
|
|
8819
8856
|
});
|
|
8820
8857
|
} catch (error) {
|
|
8821
8858
|
assertGuardedAdmission(permit);
|
|
8822
|
-
if (error instanceof TtfError && error.code === "ACCOUNT_COMPLETION_REQUIRED")
|
|
8859
|
+
if (error instanceof TtfError && (error.code === "ACCOUNT_COMPLETION_REQUIRED" || error.status === 403 && error.code === "ACCOUNT_REQUIRED"))
|
|
8823
8860
|
clearBuyerSession(epoch);
|
|
8824
8861
|
throw error;
|
|
8825
8862
|
} finally {
|
|
@@ -9150,7 +9187,8 @@ var registerWithOwner = async (fields, handoff) => {
|
|
|
9150
9187
|
var register = (fields) => registerWithOwner(fields);
|
|
9151
9188
|
var registerAccount = (input, handoff) => registerWithOwner(buildRegistrationFields(input), handoff);
|
|
9152
9189
|
var restorePassword = async (email) => {
|
|
9153
|
-
|
|
9190
|
+
const endpoint2 = getConfig().accountAuth ? ENDPOINTS.auth.accountRestorePassword : ENDPOINTS.auth.restorePassword;
|
|
9191
|
+
await post(endpoint2, { email });
|
|
9154
9192
|
};
|
|
9155
9193
|
var validateResetToken = async (token2) => {
|
|
9156
9194
|
await get(ENDPOINTS.auth.validateResetToken(token2));
|