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.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -5240,6 +5240,19 @@ var accountRewardsView = (data, t) => ({
|
|
|
5240
5240
|
}
|
|
5241
5241
|
})
|
|
5242
5242
|
});
|
|
5243
|
+
var presentDate = (date, fallback, locale, includeTime = false, timeZone = "UTC") => {
|
|
5244
|
+
try {
|
|
5245
|
+
return new Intl.DateTimeFormat(locale, {
|
|
5246
|
+
year: "numeric",
|
|
5247
|
+
month: "short",
|
|
5248
|
+
day: "numeric",
|
|
5249
|
+
timeZone,
|
|
5250
|
+
...includeTime ? { hour: "2-digit", minute: "2-digit" } : {}
|
|
5251
|
+
}).format(date);
|
|
5252
|
+
} catch (e) {
|
|
5253
|
+
return fallback;
|
|
5254
|
+
}
|
|
5255
|
+
};
|
|
5243
5256
|
var text = (value6) => {
|
|
5244
5257
|
if (typeof value6 !== "string")
|
|
5245
5258
|
throw new TypeError("Payment plan details are unavailable. Refresh your order.");
|
|
@@ -5312,17 +5325,7 @@ var accountPlanDate = (value6, locale, includeTime = false) => {
|
|
|
5312
5325
|
Number(match[5])
|
|
5313
5326
|
)
|
|
5314
5327
|
);
|
|
5315
|
-
|
|
5316
|
-
return new Intl.DateTimeFormat(locale, {
|
|
5317
|
-
year: "numeric",
|
|
5318
|
-
month: "short",
|
|
5319
|
-
day: "numeric",
|
|
5320
|
-
timeZone: "UTC",
|
|
5321
|
-
...includeTime ? { hour: "2-digit", minute: "2-digit" } : {}
|
|
5322
|
-
}).format(date);
|
|
5323
|
-
} catch (e) {
|
|
5324
|
-
return value6;
|
|
5325
|
-
}
|
|
5328
|
+
return presentDate(date, value6, locale, includeTime);
|
|
5326
5329
|
};
|
|
5327
5330
|
var decodeHtmlEntities = (text6) => (0, import_entities2.decodeHTML)(text6);
|
|
5328
5331
|
var BLOCK_ELEMENTS = /* @__PURE__ */ new Set([
|
|
@@ -6107,7 +6110,7 @@ var brandingLines = (identities = []) => identities.map(
|
|
|
6107
6110
|
)
|
|
6108
6111
|
).filter(Boolean);
|
|
6109
6112
|
var tripItemLines = (item, locale) => {
|
|
6110
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i
|
|
6113
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
6111
6114
|
const copy = tripCopy(locale);
|
|
6112
6115
|
const details = (_a2 = item.details) != null ? _a2 : {};
|
|
6113
6116
|
const lines = [
|
|
@@ -6119,23 +6122,53 @@ var tripItemLines = (item, locale) => {
|
|
|
6119
6122
|
if (room) lines.push(room);
|
|
6120
6123
|
const checkIn = (_c = details.check_in) != null ? _c : item.check_in;
|
|
6121
6124
|
const checkOut = (_d = details.check_out) != null ? _d : item.check_out;
|
|
6122
|
-
if (checkIn) lines.push(`${copy.check_in}: ${checkIn}`);
|
|
6123
|
-
if (checkOut) lines.push(`${copy.check_out}: ${checkOut}`);
|
|
6125
|
+
if (checkIn) lines.push(`${copy.check_in}: ${tripDate(checkIn, locale)}`);
|
|
6126
|
+
if (checkOut) lines.push(`${copy.check_out}: ${tripDate(checkOut, locale)}`);
|
|
6124
6127
|
for (const segment of (_e = details.itinerary) != null ? _e : []) {
|
|
6125
6128
|
lines.push(
|
|
6126
6129
|
`${(_f = segment.originCode) != null ? _f : ""} \u2192 ${(_g = segment.destinationCode) != null ? _g : ""}`,
|
|
6127
|
-
`${(
|
|
6130
|
+
`${tripDate(segment.departureTime, locale)} \xB7 ${tripDate(segment.arrivalTime, locale)}`
|
|
6128
6131
|
);
|
|
6129
6132
|
}
|
|
6130
|
-
const date = (
|
|
6131
|
-
if (date) lines.push(date);
|
|
6133
|
+
const date = (_h = details.provider_date_time) != null ? _h : details.dateTime;
|
|
6134
|
+
if (date) lines.push(tripDate(date, locale));
|
|
6132
6135
|
if (item.total !== null && item.total !== void 0)
|
|
6133
|
-
lines.push(`${copy.total}: ${item.total} ${(
|
|
6136
|
+
lines.push(`${copy.total}: ${item.total} ${(_i = item.currency) != null ? _i : ""}`);
|
|
6134
6137
|
return lines;
|
|
6135
6138
|
};
|
|
6136
6139
|
var tripSectionNames = (data) => ["tickets", "stays", "hotels", "flights", "activities"].filter(
|
|
6137
6140
|
(name) => data.sections[name] !== void 0
|
|
6138
6141
|
);
|
|
6142
|
+
var tripDate = (value6, locale, timeZone) => {
|
|
6143
|
+
if (!value6) return "";
|
|
6144
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(Z|[+-]\d{2}:\d{2})?)?$/.exec(
|
|
6145
|
+
value6
|
|
6146
|
+
);
|
|
6147
|
+
if (!match) return value6;
|
|
6148
|
+
const [year, month, day, hour, minute, second] = match.slice(1, 7).map((part) => Number(part != null ? part : 0));
|
|
6149
|
+
const wall = /* @__PURE__ */ new Date(0);
|
|
6150
|
+
wall.setUTCFullYear(year, month - 1, day);
|
|
6151
|
+
wall.setUTCHours(hour, minute, second, 0);
|
|
6152
|
+
if (wall.getUTCFullYear() !== year || wall.getUTCMonth() !== month - 1 || wall.getUTCDate() !== day || wall.getUTCHours() !== hour || wall.getUTCMinutes() !== minute || wall.getUTCSeconds() !== second)
|
|
6153
|
+
return value6;
|
|
6154
|
+
const offset = match[7];
|
|
6155
|
+
let offsetMinutes = 0;
|
|
6156
|
+
if (offset && offset !== "Z") {
|
|
6157
|
+
const hours = Number(offset.slice(1, 3)), minutes = Number(offset.slice(4, 6));
|
|
6158
|
+
if (hours > 23 || minutes > 59) return value6;
|
|
6159
|
+
offsetMinutes = (hours * 60 + minutes) * (offset[0] === "+" ? 1 : -1);
|
|
6160
|
+
}
|
|
6161
|
+
const includeTime = match[4] !== void 0;
|
|
6162
|
+
const local = presentDate(wall, value6, locale, includeTime);
|
|
6163
|
+
if (!timeZone || !offset) return local;
|
|
6164
|
+
return presentDate(
|
|
6165
|
+
new Date(wall.getTime() - offsetMinutes * 6e4),
|
|
6166
|
+
local,
|
|
6167
|
+
locale,
|
|
6168
|
+
includeTime,
|
|
6169
|
+
timeZone
|
|
6170
|
+
);
|
|
6171
|
+
};
|
|
6139
6172
|
var tripsView = (data, locale) => {
|
|
6140
6173
|
const copy = tripCopy(locale);
|
|
6141
6174
|
if (!isEventTrip(data)) {
|
|
@@ -6155,8 +6188,8 @@ var tripsView = (data, locale) => {
|
|
|
6155
6188
|
title: trip.name,
|
|
6156
6189
|
lines: [
|
|
6157
6190
|
...brandingLines(trip.branding),
|
|
6158
|
-
trip.starts_at,
|
|
6159
|
-
trip.ends_at,
|
|
6191
|
+
tripDate(trip.starts_at, locale, trip.timezone),
|
|
6192
|
+
tripDate(trip.ends_at, locale, trip.timezone),
|
|
6160
6193
|
trip.venue
|
|
6161
6194
|
].filter((line) => Boolean(line)),
|
|
6162
6195
|
actions: [{ label: copy.open, url: trip.trip_url }]
|
|
@@ -6167,7 +6200,11 @@ var tripsView = (data, locale) => {
|
|
|
6167
6200
|
}
|
|
6168
6201
|
return {
|
|
6169
6202
|
title: data.event.name,
|
|
6170
|
-
subtitle: [
|
|
6203
|
+
subtitle: [
|
|
6204
|
+
tripDate(data.event.starts_at, locale, data.event.timezone),
|
|
6205
|
+
tripDate(data.event.ends_at, locale, data.event.timezone),
|
|
6206
|
+
data.event.venue
|
|
6207
|
+
].filter(Boolean).join(" \xB7 "),
|
|
6171
6208
|
sections: tripSectionNames(data).map((name) => {
|
|
6172
6209
|
const section = data.sections[name];
|
|
6173
6210
|
if (!section) return null;
|
|
@@ -9329,7 +9366,7 @@ var readProfileBeforeConfirmation = async (beforeConfirmation, permit) => {
|
|
|
9329
9366
|
});
|
|
9330
9367
|
} catch (error) {
|
|
9331
9368
|
assertGuardedAdmission(permit);
|
|
9332
|
-
if (error instanceof TtfError && error.code === "ACCOUNT_COMPLETION_REQUIRED")
|
|
9369
|
+
if (error instanceof TtfError && (error.code === "ACCOUNT_COMPLETION_REQUIRED" || error.status === 403 && error.code === "ACCOUNT_REQUIRED"))
|
|
9333
9370
|
clearBuyerSession(epoch);
|
|
9334
9371
|
throw error;
|
|
9335
9372
|
} finally {
|
|
@@ -9660,7 +9697,8 @@ var registerWithOwner = async (fields, handoff) => {
|
|
|
9660
9697
|
var register = (fields) => registerWithOwner(fields);
|
|
9661
9698
|
var registerAccount = (input, handoff) => registerWithOwner(buildRegistrationFields(input), handoff);
|
|
9662
9699
|
var restorePassword = async (email) => {
|
|
9663
|
-
|
|
9700
|
+
const endpoint2 = getConfig().accountAuth ? ENDPOINTS.auth.accountRestorePassword : ENDPOINTS.auth.restorePassword;
|
|
9701
|
+
await post(endpoint2, { email });
|
|
9664
9702
|
};
|
|
9665
9703
|
var validateResetToken = async (token2) => {
|
|
9666
9704
|
await get(ENDPOINTS.auth.validateResetToken(token2));
|