@ozura/elements 1.2.4-next.52 → 1.2.4-next.54
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/oz-elements.esm.js +59 -6
- package/dist/oz-elements.esm.js.map +1 -1
- package/dist/oz-elements.umd.js +59 -6
- package/dist/oz-elements.umd.js.map +1 -1
- package/dist/react/index.cjs.js +59 -6
- package/dist/react/index.cjs.js.map +1 -1
- package/dist/react/index.esm.js +59 -6
- package/dist/react/index.esm.js.map +1 -1
- package/dist/react/sdk/OzVault.d.ts +1 -1
- package/dist/react/vue/index.d.ts +48 -0
- package/dist/server/sdk/OzVault.d.ts +1 -1
- package/dist/server/vue/index.d.ts +48 -0
- package/dist/types/sdk/OzVault.d.ts +1 -1
- package/dist/types/vue/index.d.ts +48 -0
- package/dist/vue/index.cjs.js +79 -7
- package/dist/vue/index.cjs.js.map +1 -1
- package/dist/vue/index.esm.js +79 -7
- package/dist/vue/index.esm.js.map +1 -1
- package/dist/vue/sdk/OzVault.d.ts +1 -1
- package/dist/vue/vue/index.d.ts +48 -0
- package/package.json +1 -1
|
@@ -34,6 +34,18 @@ export interface OzElementsProps {
|
|
|
34
34
|
appearance?: Appearance;
|
|
35
35
|
loadTimeoutMs?: number;
|
|
36
36
|
debug?: boolean;
|
|
37
|
+
/** Called when the vault automatically refreshes the session key after exhausting the tokenize budget. */
|
|
38
|
+
onSessionRefresh?: () => void;
|
|
39
|
+
/** Called once when the vault tokenizer and all mounted field iframes are ready. */
|
|
40
|
+
onReady?: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* Maximum number of tokenize calls before the vault proactively refreshes the session.
|
|
43
|
+
* Must match the `sessionLimit` passed to `createSession()` on your server.
|
|
44
|
+
* Pass `null` to disable the limit. Defaults to 3.
|
|
45
|
+
*/
|
|
46
|
+
sessionLimit?: number | null;
|
|
47
|
+
/** @deprecated Use `sessionLimit` instead. */
|
|
48
|
+
maxTokenizeCalls?: number;
|
|
37
49
|
}
|
|
38
50
|
/**
|
|
39
51
|
* Creates and owns an OzVault instance for the lifetime of this component.
|
|
@@ -72,6 +84,22 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
72
84
|
type: BooleanConstructor;
|
|
73
85
|
default: undefined;
|
|
74
86
|
};
|
|
87
|
+
onSessionRefresh: {
|
|
88
|
+
type: PropType<() => void>;
|
|
89
|
+
default: undefined;
|
|
90
|
+
};
|
|
91
|
+
onReady: {
|
|
92
|
+
type: PropType<() => void>;
|
|
93
|
+
default: undefined;
|
|
94
|
+
};
|
|
95
|
+
sessionLimit: {
|
|
96
|
+
type: PropType<number | null>;
|
|
97
|
+
default: undefined;
|
|
98
|
+
};
|
|
99
|
+
maxTokenizeCalls: {
|
|
100
|
+
type: NumberConstructor;
|
|
101
|
+
default: undefined;
|
|
102
|
+
};
|
|
75
103
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
76
104
|
[key: string]: any;
|
|
77
105
|
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "ready"[], "ready", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -107,6 +135,22 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
107
135
|
type: BooleanConstructor;
|
|
108
136
|
default: undefined;
|
|
109
137
|
};
|
|
138
|
+
onSessionRefresh: {
|
|
139
|
+
type: PropType<() => void>;
|
|
140
|
+
default: undefined;
|
|
141
|
+
};
|
|
142
|
+
onReady: {
|
|
143
|
+
type: PropType<() => void>;
|
|
144
|
+
default: undefined;
|
|
145
|
+
};
|
|
146
|
+
sessionLimit: {
|
|
147
|
+
type: PropType<number | null>;
|
|
148
|
+
default: undefined;
|
|
149
|
+
};
|
|
150
|
+
maxTokenizeCalls: {
|
|
151
|
+
type: NumberConstructor;
|
|
152
|
+
default: undefined;
|
|
153
|
+
};
|
|
110
154
|
}>> & Readonly<{
|
|
111
155
|
onReady?: ((...args: any[]) => any) | undefined;
|
|
112
156
|
}>, {
|
|
@@ -114,9 +158,13 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
114
158
|
fonts: FontSource[];
|
|
115
159
|
loadTimeoutMs: number;
|
|
116
160
|
frameBaseUrl: string;
|
|
161
|
+
maxTokenizeCalls: number;
|
|
162
|
+
sessionLimit: number | null;
|
|
117
163
|
sessionUrl: string;
|
|
118
164
|
getSessionKey: (sessionId: string) => Promise<string>;
|
|
119
165
|
appearance: Appearance;
|
|
166
|
+
onSessionRefresh: () => void;
|
|
167
|
+
onReady: () => void;
|
|
120
168
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
121
169
|
export interface UseOzElementsReturn {
|
|
122
170
|
/**
|
|
@@ -34,6 +34,18 @@ export interface OzElementsProps {
|
|
|
34
34
|
appearance?: Appearance;
|
|
35
35
|
loadTimeoutMs?: number;
|
|
36
36
|
debug?: boolean;
|
|
37
|
+
/** Called when the vault automatically refreshes the session key after exhausting the tokenize budget. */
|
|
38
|
+
onSessionRefresh?: () => void;
|
|
39
|
+
/** Called once when the vault tokenizer and all mounted field iframes are ready. */
|
|
40
|
+
onReady?: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* Maximum number of tokenize calls before the vault proactively refreshes the session.
|
|
43
|
+
* Must match the `sessionLimit` passed to `createSession()` on your server.
|
|
44
|
+
* Pass `null` to disable the limit. Defaults to 3.
|
|
45
|
+
*/
|
|
46
|
+
sessionLimit?: number | null;
|
|
47
|
+
/** @deprecated Use `sessionLimit` instead. */
|
|
48
|
+
maxTokenizeCalls?: number;
|
|
37
49
|
}
|
|
38
50
|
/**
|
|
39
51
|
* Creates and owns an OzVault instance for the lifetime of this component.
|
|
@@ -72,6 +84,22 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
72
84
|
type: BooleanConstructor;
|
|
73
85
|
default: undefined;
|
|
74
86
|
};
|
|
87
|
+
onSessionRefresh: {
|
|
88
|
+
type: PropType<() => void>;
|
|
89
|
+
default: undefined;
|
|
90
|
+
};
|
|
91
|
+
onReady: {
|
|
92
|
+
type: PropType<() => void>;
|
|
93
|
+
default: undefined;
|
|
94
|
+
};
|
|
95
|
+
sessionLimit: {
|
|
96
|
+
type: PropType<number | null>;
|
|
97
|
+
default: undefined;
|
|
98
|
+
};
|
|
99
|
+
maxTokenizeCalls: {
|
|
100
|
+
type: NumberConstructor;
|
|
101
|
+
default: undefined;
|
|
102
|
+
};
|
|
75
103
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
76
104
|
[key: string]: any;
|
|
77
105
|
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "ready"[], "ready", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -107,6 +135,22 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
107
135
|
type: BooleanConstructor;
|
|
108
136
|
default: undefined;
|
|
109
137
|
};
|
|
138
|
+
onSessionRefresh: {
|
|
139
|
+
type: PropType<() => void>;
|
|
140
|
+
default: undefined;
|
|
141
|
+
};
|
|
142
|
+
onReady: {
|
|
143
|
+
type: PropType<() => void>;
|
|
144
|
+
default: undefined;
|
|
145
|
+
};
|
|
146
|
+
sessionLimit: {
|
|
147
|
+
type: PropType<number | null>;
|
|
148
|
+
default: undefined;
|
|
149
|
+
};
|
|
150
|
+
maxTokenizeCalls: {
|
|
151
|
+
type: NumberConstructor;
|
|
152
|
+
default: undefined;
|
|
153
|
+
};
|
|
110
154
|
}>> & Readonly<{
|
|
111
155
|
onReady?: ((...args: any[]) => any) | undefined;
|
|
112
156
|
}>, {
|
|
@@ -114,9 +158,13 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
114
158
|
fonts: FontSource[];
|
|
115
159
|
loadTimeoutMs: number;
|
|
116
160
|
frameBaseUrl: string;
|
|
161
|
+
maxTokenizeCalls: number;
|
|
162
|
+
sessionLimit: number | null;
|
|
117
163
|
sessionUrl: string;
|
|
118
164
|
getSessionKey: (sessionId: string) => Promise<string>;
|
|
119
165
|
appearance: Appearance;
|
|
166
|
+
onSessionRefresh: () => void;
|
|
167
|
+
onReady: () => void;
|
|
120
168
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
121
169
|
export interface UseOzElementsReturn {
|
|
122
170
|
/**
|
package/dist/vue/index.cjs.js
CHANGED
|
@@ -2,6 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
var vue = require('vue');
|
|
4
4
|
|
|
5
|
+
/******************************************************************************
|
|
6
|
+
Copyright (c) Microsoft Corporation.
|
|
7
|
+
|
|
8
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
+
purpose with or without fee is hereby granted.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
+
***************************************************************************** */
|
|
19
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
23
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
24
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
25
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
29
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
30
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
31
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
32
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
36
|
+
var e = new Error(message);
|
|
37
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
38
|
+
};
|
|
39
|
+
|
|
5
40
|
const THEME_DEFAULT = {
|
|
6
41
|
base: {
|
|
7
42
|
color: '#1a1a2e',
|
|
@@ -953,6 +988,7 @@ function createSessionFetcher(url) {
|
|
|
953
988
|
};
|
|
954
989
|
}
|
|
955
990
|
|
|
991
|
+
var _OzVault_waxKey;
|
|
956
992
|
function isCardMetadata(v) {
|
|
957
993
|
if (!v || typeof v !== 'object')
|
|
958
994
|
return false;
|
|
@@ -996,6 +1032,11 @@ class OzVault {
|
|
|
996
1032
|
*/
|
|
997
1033
|
constructor(options, waxKey, tokenizationSessionId) {
|
|
998
1034
|
var _a, _b, _c, _d, _e;
|
|
1035
|
+
// Hard-private: JavaScript WeakMap-based enforcement (not just TypeScript
|
|
1036
|
+
// compile-time). Runtime code cannot read this via vault['waxKey'] or
|
|
1037
|
+
// (vault as any).waxKey — prevents wax key exfiltration if merchant-page
|
|
1038
|
+
// JS were somehow inspected at runtime (e.g. after an XSS).
|
|
1039
|
+
_OzVault_waxKey.set(this, '');
|
|
999
1040
|
this.elements = new Map();
|
|
1000
1041
|
this.elementsByType = new Map();
|
|
1001
1042
|
this.bankElementsByType = new Map();
|
|
@@ -1021,7 +1062,7 @@ class OzVault {
|
|
|
1021
1062
|
this.loadErrorTimeoutId = null;
|
|
1022
1063
|
// Proactive wax refresh on visibility restore after long idle
|
|
1023
1064
|
this._hiddenAt = null;
|
|
1024
|
-
this
|
|
1065
|
+
__classPrivateFieldSet(this, _OzVault_waxKey, waxKey, "f");
|
|
1025
1066
|
this.tokenizationSessionId = tokenizationSessionId;
|
|
1026
1067
|
this.pubKey = options.pubKey;
|
|
1027
1068
|
// Strip trailing slash so URL construction never produces double-slash paths
|
|
@@ -1133,8 +1174,8 @@ class OzVault {
|
|
|
1133
1174
|
vault.destroy();
|
|
1134
1175
|
throw new OzError('Session fetch returned an empty key. Check your session endpoint response — it must return { sessionKey: "..." }.');
|
|
1135
1176
|
}
|
|
1136
|
-
// Static methods can access private fields of instances of the same class.
|
|
1137
|
-
vault
|
|
1177
|
+
// Static methods can access hard-private fields of instances of the same class.
|
|
1178
|
+
__classPrivateFieldSet(vault, _OzVault_waxKey, waxKey, "f");
|
|
1138
1179
|
vault._storedFetchWaxKey = resolvedFetchKey;
|
|
1139
1180
|
// If the tokenizer iframe fired OZ_FRAME_READY before fetchWaxKey resolved,
|
|
1140
1181
|
// the OZ_INIT sent at that point had an empty waxKey. Send a follow-up now
|
|
@@ -1651,7 +1692,7 @@ class OzVault {
|
|
|
1651
1692
|
isReady: this.tokenizerReady,
|
|
1652
1693
|
tokenizing: this._tokenizing,
|
|
1653
1694
|
destroyed: this._destroyed,
|
|
1654
|
-
waxKeyPresent: Boolean(this
|
|
1695
|
+
waxKeyPresent: Boolean(__classPrivateFieldGet(this, _OzVault_waxKey, "f")),
|
|
1655
1696
|
tokenizeSuccessCount: this._tokenizeSuccessCount,
|
|
1656
1697
|
maxTokenizeCalls: this._maxTokenizeCalls,
|
|
1657
1698
|
resetCount: this._resetCount,
|
|
@@ -1669,6 +1710,17 @@ class OzVault {
|
|
|
1669
1710
|
iframe.style.cssText = 'position:absolute;top:-9999px;left:-9999px;width:1px;height:1px;';
|
|
1670
1711
|
iframe.setAttribute('aria-hidden', 'true');
|
|
1671
1712
|
iframe.tabIndex = -1;
|
|
1713
|
+
// allow-scripts: JS runs. allow-same-origin: frame keeps its actual origin
|
|
1714
|
+
// (elements.ozura.com) so fetch() CORS requests carry the correct Origin
|
|
1715
|
+
// header. Without allow-same-origin the frame gets a null opaque origin and
|
|
1716
|
+
// the vault API's CORS policy would reject it.
|
|
1717
|
+
// NOT included: allow-top-navigation, allow-popups, allow-forms — prevents
|
|
1718
|
+
// a compromised tokenizer frame from navigating the merchant page or opening
|
|
1719
|
+
// popups even if the CDN bundle were somehow replaced.
|
|
1720
|
+
// Note: allow-scripts + allow-same-origin on a cross-origin iframe does NOT
|
|
1721
|
+
// expose window.parent — Same Origin Policy still applies between
|
|
1722
|
+
// elements.ozura.com and the merchant domain.
|
|
1723
|
+
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
|
|
1672
1724
|
const parentOrigin = typeof window !== 'undefined' ? window.location.origin : '';
|
|
1673
1725
|
iframe.src = `${this.frameBaseUrl}/frame/tokenizer-frame.html#vaultId=${encodeURIComponent(this.vaultId)}${parentOrigin ? `&parentOrigin=${encodeURIComponent(parentOrigin)}` : ''}`;
|
|
1674
1726
|
document.body.appendChild(iframe);
|
|
@@ -1804,7 +1856,7 @@ class OzVault {
|
|
|
1804
1856
|
// Deliver the wax key via OZ_INIT so the tokenizer stores it internally.
|
|
1805
1857
|
// If waxKey is still empty (fetchWaxKey hasn't resolved yet), it will be
|
|
1806
1858
|
// sent again from create() once the key is available.
|
|
1807
|
-
this.sendToTokenizer(Object.assign(Object.assign({ type: 'OZ_INIT', frameId: '__tokenizer__' }, (this
|
|
1859
|
+
this.sendToTokenizer(Object.assign(Object.assign({ type: 'OZ_INIT', frameId: '__tokenizer__' }, (__classPrivateFieldGet(this, _OzVault_waxKey, "f") ? { waxKey: __classPrivateFieldGet(this, _OzVault_waxKey, "f") } : {})), { debug: this._debug }));
|
|
1808
1860
|
(_c = this._onReady) === null || _c === void 0 ? void 0 : _c.call(this);
|
|
1809
1861
|
this.log('tokenizer iframe ready', { protocolVersion: (_d = msg.__ozVersion) !== null && _d !== void 0 ? _d : null });
|
|
1810
1862
|
this.log('vault state', this.debugState());
|
|
@@ -2110,7 +2162,7 @@ class OzVault {
|
|
|
2110
2162
|
throw new OzError('fetchWaxKey returned an empty string during auto-refresh.', undefined, 'auth');
|
|
2111
2163
|
}
|
|
2112
2164
|
if (!this._destroyed) {
|
|
2113
|
-
this
|
|
2165
|
+
__classPrivateFieldSet(this, _OzVault_waxKey, newWaxKey, "f");
|
|
2114
2166
|
this.tokenizationSessionId = newSessionId;
|
|
2115
2167
|
this._tokenizeSuccessCount = 0;
|
|
2116
2168
|
}
|
|
@@ -2134,6 +2186,7 @@ class OzVault {
|
|
|
2134
2186
|
(_a = this.tokenizerWindow) === null || _a === void 0 ? void 0 : _a.postMessage(msg, this.frameOrigin, transfer !== null && transfer !== void 0 ? transfer : []);
|
|
2135
2187
|
}
|
|
2136
2188
|
}
|
|
2189
|
+
_OzVault_waxKey = new WeakMap();
|
|
2137
2190
|
|
|
2138
2191
|
/**
|
|
2139
2192
|
* @ozura/elements/vue — Vue 3 wrapper for OzElements.
|
|
@@ -2177,6 +2230,10 @@ const OzElements = vue.defineComponent({
|
|
|
2177
2230
|
appearance: { type: Object, default: undefined },
|
|
2178
2231
|
loadTimeoutMs: { type: Number, default: undefined },
|
|
2179
2232
|
debug: { type: Boolean, default: undefined },
|
|
2233
|
+
onSessionRefresh: { type: Function, default: undefined },
|
|
2234
|
+
onReady: { type: Function, default: undefined },
|
|
2235
|
+
sessionLimit: { type: Number, default: undefined },
|
|
2236
|
+
maxTokenizeCalls: { type: Number, default: undefined },
|
|
2180
2237
|
},
|
|
2181
2238
|
emits: ['ready'],
|
|
2182
2239
|
setup(props, { slots, emit }) {
|
|
@@ -2188,15 +2245,20 @@ const OzElements = vue.defineComponent({
|
|
|
2188
2245
|
const notifyMount = () => { mountedCount.value++; };
|
|
2189
2246
|
let readyEmitted = false;
|
|
2190
2247
|
const notifyReady = () => {
|
|
2248
|
+
var _a;
|
|
2191
2249
|
readyCount.value++;
|
|
2192
2250
|
if (!readyEmitted && mountedCount.value > 0 && readyCount.value >= mountedCount.value) {
|
|
2193
2251
|
readyEmitted = true;
|
|
2194
2252
|
emit('ready');
|
|
2253
|
+
(_a = props.onReady) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
2195
2254
|
}
|
|
2196
2255
|
};
|
|
2197
2256
|
const notifyUnmount = () => {
|
|
2198
2257
|
mountedCount.value = Math.max(0, mountedCount.value - 1);
|
|
2199
2258
|
readyCount.value = Math.max(0, readyCount.value - 1);
|
|
2259
|
+
// A field leaving means the form is no longer fully ready. Reset the gate
|
|
2260
|
+
// so 'ready' fires again once all fields are back up.
|
|
2261
|
+
readyEmitted = false;
|
|
2200
2262
|
};
|
|
2201
2263
|
const notifyTokenize = () => { tokenizeCount.value++; };
|
|
2202
2264
|
vue.provide(OZ_KEY, {
|
|
@@ -2215,7 +2277,17 @@ const OzElements = vue.defineComponent({
|
|
|
2215
2277
|
vue.onMounted(() => {
|
|
2216
2278
|
const ac = new AbortController();
|
|
2217
2279
|
abortController = ac;
|
|
2218
|
-
OzVault.create(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ pubKey: props.pubKey }, (props.sessionUrl ? { sessionUrl: props.sessionUrl } : {})), (props.getSessionKey ? { getSessionKey: props.getSessionKey } : {})), (props.frameBaseUrl ? { frameBaseUrl: props.frameBaseUrl } : {})), (props.fonts ? { fonts: props.fonts } : {})), (props.appearance ? { appearance: props.appearance } : {})), (props.loadTimeoutMs !== undefined ? { loadTimeoutMs: props.loadTimeoutMs } : {})), (props.debug ? { debug: props.debug } : {})),
|
|
2280
|
+
OzVault.create(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ pubKey: props.pubKey }, (props.sessionUrl ? { sessionUrl: props.sessionUrl } : {})), (props.getSessionKey ? { getSessionKey: props.getSessionKey } : {})), (props.frameBaseUrl ? { frameBaseUrl: props.frameBaseUrl } : {})), (props.fonts ? { fonts: props.fonts } : {})), (props.appearance ? { appearance: props.appearance } : {})), (props.loadTimeoutMs !== undefined ? { loadTimeoutMs: props.loadTimeoutMs } : {})), (props.debug ? { debug: props.debug } : {})), {
|
|
2281
|
+
// Session lifecycle — wire refresh callback and reset tokenizeCount so the
|
|
2282
|
+
// counter stays accurate across proactive key refreshes (mirrors React provider).
|
|
2283
|
+
// Deferred by one microtask for the same reason as React: notifyTokenize fires
|
|
2284
|
+
// in the same tick as the refresh trigger, so resetting synchronously would
|
|
2285
|
+
// race the increment. The microtask ensures the increment lands first.
|
|
2286
|
+
onSessionRefresh: () => {
|
|
2287
|
+
var _a;
|
|
2288
|
+
Promise.resolve().then(() => { tokenizeCount.value = 0; });
|
|
2289
|
+
(_a = props.onSessionRefresh) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
2290
|
+
} }), (props.sessionLimit !== undefined ? { sessionLimit: props.sessionLimit } : {})), (props.maxTokenizeCalls !== undefined ? { maxTokenizeCalls: props.maxTokenizeCalls } : {})), ac.signal).then(v => {
|
|
2219
2291
|
if (ac.signal.aborted) {
|
|
2220
2292
|
v.destroy();
|
|
2221
2293
|
return;
|