tf-checkout-react-native 2.0.0-beta.21 → 2.0.0-beta.22
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/README.md +60 -22
- package/dist/index.d.mts +83 -61
- package/dist/index.d.ts +83 -61
- package/dist/index.js +50 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -5
- package/src/configure.ts +40 -10
- package/src/index.tsx +5 -2
- package/src/useCheckout.ts +1 -1
- package/src/storage.ts +0 -26
package/dist/index.mjs
CHANGED
|
@@ -9537,10 +9537,23 @@ var getVerificationInfo = async () => get(ENDPOINTS.auth.verificationInfo);
|
|
|
9537
9537
|
var updateVerificationStatus = async () => patch(ENDPOINTS.auth.verify, {
|
|
9538
9538
|
data: { attributes: { verification: { verificationStatus: "PENDING" } } }
|
|
9539
9539
|
});
|
|
9540
|
-
var logout = async () => {
|
|
9540
|
+
var logout = async (options = {}) => {
|
|
9541
|
+
const device = options.pushDevice;
|
|
9542
|
+
if (device !== void 0 && (device === null || typeof device !== "object" || Array.isArray(device) || typeof device.appId !== "string" || !/^[a-z][a-z0-9_-]{0,63}$/.test(device.appId) || typeof device.token !== "string" || !device.token || device.token.length > 4096 || /[^\x21-\x7e]/.test(device.token) || device.registration !== void 0 && (typeof device.registration !== "string" || !/^[1-9][0-9]{0,19}:[0-9]{1,20}$/.test(device.registration))))
|
|
9543
|
+
throw new TtfError(
|
|
9544
|
+
"This device could not be removed securely.",
|
|
9545
|
+
0,
|
|
9546
|
+
"VALIDATION_ERROR"
|
|
9547
|
+
);
|
|
9548
|
+
const headers = device ? {
|
|
9549
|
+
"X-TF-Push-App": device.appId,
|
|
9550
|
+
"X-TF-Push-Token": device.token,
|
|
9551
|
+
...device.registration ? { "X-TF-Push-Registration": device.registration } : {}
|
|
9552
|
+
} : void 0;
|
|
9541
9553
|
const epoch = advanceSessionEpoch();
|
|
9542
9554
|
try {
|
|
9543
|
-
await del(ENDPOINTS.auth.session);
|
|
9555
|
+
if (headers) await del(ENDPOINTS.auth.session, { headers });
|
|
9556
|
+
else await del(ENDPOINTS.auth.session);
|
|
9544
9557
|
} finally {
|
|
9545
9558
|
if (epoch === getSessionEpoch()) clearSession();
|
|
9546
9559
|
}
|
|
@@ -25336,39 +25349,42 @@ var useCheckout2 = (opts = {}) => {
|
|
|
25336
25349
|
};
|
|
25337
25350
|
};
|
|
25338
25351
|
|
|
25339
|
-
// src/storage.ts
|
|
25340
|
-
import { MMKV } from "react-native-mmkv";
|
|
25341
|
-
var createMmkvStorage = (id2 = "tf-checkout") => {
|
|
25342
|
-
const mmkv = new MMKV({ id: id2 });
|
|
25343
|
-
return {
|
|
25344
|
-
getItem: (key5) => {
|
|
25345
|
-
var _a2;
|
|
25346
|
-
return (_a2 = mmkv.getString(key5)) != null ? _a2 : null;
|
|
25347
|
-
},
|
|
25348
|
-
setItem: (key5, value6) => mmkv.set(key5, value6),
|
|
25349
|
-
removeItem: (key5) => mmkv.delete(key5)
|
|
25350
|
-
};
|
|
25351
|
-
};
|
|
25352
|
-
|
|
25353
25352
|
// src/configure.ts
|
|
25354
|
-
var
|
|
25355
|
-
|
|
25356
|
-
|
|
25357
|
-
|
|
25358
|
-
|
|
25359
|
-
|
|
25360
|
-
|
|
25361
|
-
withCredentials: false,
|
|
25362
|
-
// Native owns no browser cookie jar. Ask the canonical session owner to
|
|
25363
|
-
// return its guest carrier and resume that exact carrier on later requests.
|
|
25364
|
-
auth: () => {
|
|
25365
|
-
var _a2;
|
|
25366
|
-
return {
|
|
25367
|
-
...(_a2 = config.auth) == null ? void 0 : _a2.call(config),
|
|
25368
|
-
"X-TF-Session-Mode": "header-only"
|
|
25369
|
-
};
|
|
25353
|
+
var requireStorage = (storage) => {
|
|
25354
|
+
if (!storage || typeof storage !== "object" || Array.isArray(storage) || ["getItem", "setItem", "removeItem"].some(
|
|
25355
|
+
(method) => typeof storage[method] !== "function" || Object.prototype.toString.call(storage[method]) === "[object AsyncFunction]"
|
|
25356
|
+
) || storage.flush !== void 0 && typeof storage.flush !== "function") {
|
|
25357
|
+
throw new Error(
|
|
25358
|
+
"Ticket Fairy native checkout requires a synchronous storage adapter. Pass storage backed by iOS Keychain or Android Keystore; hydrate an async-backed mirror before configuration and await flush() after credential changes."
|
|
25359
|
+
);
|
|
25370
25360
|
}
|
|
25371
|
-
}
|
|
25361
|
+
};
|
|
25362
|
+
var configureCheckout = (config) => {
|
|
25363
|
+
requireStorage(config == null ? void 0 : config.storage);
|
|
25364
|
+
configure({
|
|
25365
|
+
cookieAuth: true,
|
|
25366
|
+
...config,
|
|
25367
|
+
// NSURLSession/RCTNetworking would otherwise accept Set-Cookie outside
|
|
25368
|
+
// the SDK epoch guard. Only the SDK's header-backed jar owns native auth.
|
|
25369
|
+
withCredentials: false,
|
|
25370
|
+
// Native owns no browser cookie jar. Ask the canonical session owner to
|
|
25371
|
+
// return its guest carrier and resume that exact carrier on later requests.
|
|
25372
|
+
auth: () => {
|
|
25373
|
+
var _a2, _b;
|
|
25374
|
+
return {
|
|
25375
|
+
...Object.fromEntries(
|
|
25376
|
+
Object.entries((_b = (_a2 = config.auth) == null ? void 0 : _a2.call(config)) != null ? _b : {}).filter(
|
|
25377
|
+
([name]) => name.toLowerCase() !== "cache-control"
|
|
25378
|
+
)
|
|
25379
|
+
),
|
|
25380
|
+
"X-TF-Session-Mode": "header-only",
|
|
25381
|
+
// Account/ticket responses must not be saved by the native HTTP cache.
|
|
25382
|
+
// Revalidate any older cached response as well as forbidding a new store.
|
|
25383
|
+
"Cache-Control": "no-store, no-cache"
|
|
25384
|
+
};
|
|
25385
|
+
}
|
|
25386
|
+
});
|
|
25387
|
+
};
|
|
25372
25388
|
|
|
25373
25389
|
// src/ui/Field.tsx
|
|
25374
25390
|
import { useMemo as useMemo20, useState as useState36 } from "react";
|
|
@@ -35024,7 +35040,7 @@ export {
|
|
|
35024
35040
|
clearCheckoutGuestSession,
|
|
35025
35041
|
clearSession,
|
|
35026
35042
|
computeRadialTreeLayout,
|
|
35027
|
-
configure,
|
|
35043
|
+
configureCheckout as configure,
|
|
35028
35044
|
configureCheckout,
|
|
35029
35045
|
confirmBundlePaymentWith,
|
|
35030
35046
|
confirmInstallmentsHasNextAction,
|
|
@@ -35042,7 +35058,6 @@ export {
|
|
|
35042
35058
|
createInstallmentChoices,
|
|
35043
35059
|
createLiveScope,
|
|
35044
35060
|
createMemoryStorage,
|
|
35045
|
-
createMmkvStorage,
|
|
35046
35061
|
createOwnedElements,
|
|
35047
35062
|
createPaymentMarks,
|
|
35048
35063
|
createProviderPages,
|
|
@@ -35129,7 +35144,6 @@ export {
|
|
|
35129
35144
|
mirroredHolderDraft,
|
|
35130
35145
|
missingCheckoutDetails,
|
|
35131
35146
|
missingRequiredAddOns,
|
|
35132
|
-
mmkvStorageAdapter,
|
|
35133
35147
|
mountKeyedField,
|
|
35134
35148
|
nativeStripeErrorOutcome,
|
|
35135
35149
|
newBundleIdempotencyKey,
|