@ozura/elements 1.3.1-next.69 → 1.3.1-next.71
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/react/index.cjs.js +4 -1
- package/dist/react/index.cjs.js.map +1 -1
- package/dist/react/index.esm.js +4 -1
- package/dist/react/index.esm.js.map +1 -1
- package/dist/react/react/index.d.ts +20 -0
- package/dist/react/types/index.d.ts +15 -8
- package/dist/react/vue/index.d.ts +29 -3
- package/dist/server/types/index.d.ts +15 -8
- package/dist/server/vue/index.d.ts +29 -3
- package/dist/types/types/index.d.ts +15 -8
- package/dist/types/vue/index.d.ts +29 -3
- package/dist/vue/index.cjs.js +18 -3
- package/dist/vue/index.cjs.js.map +1 -1
- package/dist/vue/index.esm.js +18 -3
- package/dist/vue/index.esm.js.map +1 -1
- package/dist/vue/types/index.d.ts +15 -8
- package/dist/vue/vue/index.d.ts +29 -3
- package/package.json +1 -1
|
@@ -356,15 +356,22 @@ export interface TokenizeOptions {
|
|
|
356
356
|
}
|
|
357
357
|
/** Options for `vault.createBankToken()`. */
|
|
358
358
|
export interface BankTokenizeOptions {
|
|
359
|
-
/** Account holder first name. Required. */
|
|
360
|
-
firstName: string;
|
|
361
|
-
/** Account holder last name. Required. */
|
|
362
|
-
lastName: string;
|
|
363
359
|
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
|
|
360
|
+
* Account holder first name.
|
|
361
|
+
* Required when `billing` is not provided.
|
|
362
|
+
* @deprecated Pass firstName inside `billing` instead.
|
|
363
|
+
*/
|
|
364
|
+
firstName?: string;
|
|
365
|
+
/**
|
|
366
|
+
* Account holder last name.
|
|
367
|
+
* Required when `billing` is not provided.
|
|
368
|
+
* @deprecated Pass lastName inside `billing` instead.
|
|
369
|
+
*/
|
|
370
|
+
lastName?: string;
|
|
371
|
+
/**
|
|
372
|
+
* Billing details for the account holder. When provided, `billing.firstName`
|
|
373
|
+
* and `billing.lastName` take precedence over the top-level fields.
|
|
374
|
+
* The normalized details are echoed back in `BankTokenResponse.billing`.
|
|
368
375
|
*/
|
|
369
376
|
billing?: BillingDetails;
|
|
370
377
|
}
|
|
@@ -103,7 +103,9 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
103
103
|
default: undefined;
|
|
104
104
|
};
|
|
105
105
|
onLoadError: {
|
|
106
|
-
type: PropType<(
|
|
106
|
+
type: PropType<(info?: {
|
|
107
|
+
source: "tokenizer";
|
|
108
|
+
}) => void>;
|
|
107
109
|
default: undefined;
|
|
108
110
|
};
|
|
109
111
|
sessionLimit: {
|
|
@@ -158,7 +160,9 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
158
160
|
default: undefined;
|
|
159
161
|
};
|
|
160
162
|
onLoadError: {
|
|
161
|
-
type: PropType<(
|
|
163
|
+
type: PropType<(info?: {
|
|
164
|
+
source: "tokenizer";
|
|
165
|
+
}) => void>;
|
|
162
166
|
default: undefined;
|
|
163
167
|
};
|
|
164
168
|
sessionLimit: {
|
|
@@ -180,7 +184,9 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
180
184
|
maxTokenizeCalls: number;
|
|
181
185
|
sessionUrl: string;
|
|
182
186
|
getSessionKey: (sessionId: string) => Promise<string>;
|
|
183
|
-
onLoadError: (
|
|
187
|
+
onLoadError: (info?: {
|
|
188
|
+
source: "tokenizer";
|
|
189
|
+
}) => void;
|
|
184
190
|
onSessionRefresh: () => void;
|
|
185
191
|
onReady: () => void;
|
|
186
192
|
appearance: Appearance;
|
|
@@ -213,6 +219,26 @@ export interface UseOzElementsReturn {
|
|
|
213
219
|
* Clears all mounted element fields without destroying the vault.
|
|
214
220
|
*/
|
|
215
221
|
reset: () => void;
|
|
222
|
+
/**
|
|
223
|
+
* `true` when every mounted field has reported `complete && valid`.
|
|
224
|
+
* Use this to gate the pay button without wiring individual `@change`
|
|
225
|
+
* listeners — reacts in real time as the customer fills in fields.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* const { ready, isComplete, createToken } = useOzElements();
|
|
229
|
+
* // <button :disabled="!ready || !isComplete" @click="createToken()">Pay</button>
|
|
230
|
+
*/
|
|
231
|
+
isComplete: ComputedRef<boolean>;
|
|
232
|
+
/**
|
|
233
|
+
* `true` while `createToken()` or `createBankToken()` is in progress,
|
|
234
|
+
* including the transparent wax-key refresh phase. Use this to keep the
|
|
235
|
+
* pay button disabled and prevent double-submission.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* const { isTokenizing, createToken } = useOzElements();
|
|
239
|
+
* // <button :disabled="isTokenizing" @click="createToken()">Pay</button>
|
|
240
|
+
*/
|
|
241
|
+
isTokenizing: ComputedRef<boolean>;
|
|
216
242
|
}
|
|
217
243
|
/**
|
|
218
244
|
* Returns createToken, createBankToken, ready, initError, tokenizeCount, and reset.
|
|
@@ -356,15 +356,22 @@ export interface TokenizeOptions {
|
|
|
356
356
|
}
|
|
357
357
|
/** Options for `vault.createBankToken()`. */
|
|
358
358
|
export interface BankTokenizeOptions {
|
|
359
|
-
/** Account holder first name. Required. */
|
|
360
|
-
firstName: string;
|
|
361
|
-
/** Account holder last name. Required. */
|
|
362
|
-
lastName: string;
|
|
363
359
|
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
|
|
360
|
+
* Account holder first name.
|
|
361
|
+
* Required when `billing` is not provided.
|
|
362
|
+
* @deprecated Pass firstName inside `billing` instead.
|
|
363
|
+
*/
|
|
364
|
+
firstName?: string;
|
|
365
|
+
/**
|
|
366
|
+
* Account holder last name.
|
|
367
|
+
* Required when `billing` is not provided.
|
|
368
|
+
* @deprecated Pass lastName inside `billing` instead.
|
|
369
|
+
*/
|
|
370
|
+
lastName?: string;
|
|
371
|
+
/**
|
|
372
|
+
* Billing details for the account holder. When provided, `billing.firstName`
|
|
373
|
+
* and `billing.lastName` take precedence over the top-level fields.
|
|
374
|
+
* The normalized details are echoed back in `BankTokenResponse.billing`.
|
|
368
375
|
*/
|
|
369
376
|
billing?: BillingDetails;
|
|
370
377
|
}
|
|
@@ -103,7 +103,9 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
103
103
|
default: undefined;
|
|
104
104
|
};
|
|
105
105
|
onLoadError: {
|
|
106
|
-
type: PropType<(
|
|
106
|
+
type: PropType<(info?: {
|
|
107
|
+
source: "tokenizer";
|
|
108
|
+
}) => void>;
|
|
107
109
|
default: undefined;
|
|
108
110
|
};
|
|
109
111
|
sessionLimit: {
|
|
@@ -158,7 +160,9 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
158
160
|
default: undefined;
|
|
159
161
|
};
|
|
160
162
|
onLoadError: {
|
|
161
|
-
type: PropType<(
|
|
163
|
+
type: PropType<(info?: {
|
|
164
|
+
source: "tokenizer";
|
|
165
|
+
}) => void>;
|
|
162
166
|
default: undefined;
|
|
163
167
|
};
|
|
164
168
|
sessionLimit: {
|
|
@@ -184,7 +188,9 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
184
188
|
appearance: Appearance;
|
|
185
189
|
onSessionRefresh: () => void;
|
|
186
190
|
onReady: () => void;
|
|
187
|
-
onLoadError: (
|
|
191
|
+
onLoadError: (info?: {
|
|
192
|
+
source: "tokenizer";
|
|
193
|
+
}) => void;
|
|
188
194
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
189
195
|
export interface UseOzElementsReturn {
|
|
190
196
|
/**
|
|
@@ -213,6 +219,26 @@ export interface UseOzElementsReturn {
|
|
|
213
219
|
* Clears all mounted element fields without destroying the vault.
|
|
214
220
|
*/
|
|
215
221
|
reset: () => void;
|
|
222
|
+
/**
|
|
223
|
+
* `true` when every mounted field has reported `complete && valid`.
|
|
224
|
+
* Use this to gate the pay button without wiring individual `@change`
|
|
225
|
+
* listeners — reacts in real time as the customer fills in fields.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* const { ready, isComplete, createToken } = useOzElements();
|
|
229
|
+
* // <button :disabled="!ready || !isComplete" @click="createToken()">Pay</button>
|
|
230
|
+
*/
|
|
231
|
+
isComplete: ComputedRef<boolean>;
|
|
232
|
+
/**
|
|
233
|
+
* `true` while `createToken()` or `createBankToken()` is in progress,
|
|
234
|
+
* including the transparent wax-key refresh phase. Use this to keep the
|
|
235
|
+
* pay button disabled and prevent double-submission.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* const { isTokenizing, createToken } = useOzElements();
|
|
239
|
+
* // <button :disabled="isTokenizing" @click="createToken()">Pay</button>
|
|
240
|
+
*/
|
|
241
|
+
isTokenizing: ComputedRef<boolean>;
|
|
216
242
|
}
|
|
217
243
|
/**
|
|
218
244
|
* Returns createToken, createBankToken, ready, initError, tokenizeCount, and reset.
|
|
@@ -356,15 +356,22 @@ export interface TokenizeOptions {
|
|
|
356
356
|
}
|
|
357
357
|
/** Options for `vault.createBankToken()`. */
|
|
358
358
|
export interface BankTokenizeOptions {
|
|
359
|
-
/** Account holder first name. Required. */
|
|
360
|
-
firstName: string;
|
|
361
|
-
/** Account holder last name. Required. */
|
|
362
|
-
lastName: string;
|
|
363
359
|
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
|
|
360
|
+
* Account holder first name.
|
|
361
|
+
* Required when `billing` is not provided.
|
|
362
|
+
* @deprecated Pass firstName inside `billing` instead.
|
|
363
|
+
*/
|
|
364
|
+
firstName?: string;
|
|
365
|
+
/**
|
|
366
|
+
* Account holder last name.
|
|
367
|
+
* Required when `billing` is not provided.
|
|
368
|
+
* @deprecated Pass lastName inside `billing` instead.
|
|
369
|
+
*/
|
|
370
|
+
lastName?: string;
|
|
371
|
+
/**
|
|
372
|
+
* Billing details for the account holder. When provided, `billing.firstName`
|
|
373
|
+
* and `billing.lastName` take precedence over the top-level fields.
|
|
374
|
+
* The normalized details are echoed back in `BankTokenResponse.billing`.
|
|
368
375
|
*/
|
|
369
376
|
billing?: BillingDetails;
|
|
370
377
|
}
|
|
@@ -103,7 +103,9 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
103
103
|
default: undefined;
|
|
104
104
|
};
|
|
105
105
|
onLoadError: {
|
|
106
|
-
type: PropType<(
|
|
106
|
+
type: PropType<(info?: {
|
|
107
|
+
source: "tokenizer";
|
|
108
|
+
}) => void>;
|
|
107
109
|
default: undefined;
|
|
108
110
|
};
|
|
109
111
|
sessionLimit: {
|
|
@@ -158,7 +160,9 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
158
160
|
default: undefined;
|
|
159
161
|
};
|
|
160
162
|
onLoadError: {
|
|
161
|
-
type: PropType<(
|
|
163
|
+
type: PropType<(info?: {
|
|
164
|
+
source: "tokenizer";
|
|
165
|
+
}) => void>;
|
|
162
166
|
default: undefined;
|
|
163
167
|
};
|
|
164
168
|
sessionLimit: {
|
|
@@ -184,7 +188,9 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
|
|
|
184
188
|
appearance: Appearance;
|
|
185
189
|
onSessionRefresh: () => void;
|
|
186
190
|
onReady: () => void;
|
|
187
|
-
onLoadError: (
|
|
191
|
+
onLoadError: (info?: {
|
|
192
|
+
source: "tokenizer";
|
|
193
|
+
}) => void;
|
|
188
194
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
189
195
|
export interface UseOzElementsReturn {
|
|
190
196
|
/**
|
|
@@ -213,6 +219,26 @@ export interface UseOzElementsReturn {
|
|
|
213
219
|
* Clears all mounted element fields without destroying the vault.
|
|
214
220
|
*/
|
|
215
221
|
reset: () => void;
|
|
222
|
+
/**
|
|
223
|
+
* `true` when every mounted field has reported `complete && valid`.
|
|
224
|
+
* Use this to gate the pay button without wiring individual `@change`
|
|
225
|
+
* listeners — reacts in real time as the customer fills in fields.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* const { ready, isComplete, createToken } = useOzElements();
|
|
229
|
+
* // <button :disabled="!ready || !isComplete" @click="createToken()">Pay</button>
|
|
230
|
+
*/
|
|
231
|
+
isComplete: ComputedRef<boolean>;
|
|
232
|
+
/**
|
|
233
|
+
* `true` while `createToken()` or `createBankToken()` is in progress,
|
|
234
|
+
* including the transparent wax-key refresh phase. Use this to keep the
|
|
235
|
+
* pay button disabled and prevent double-submission.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* const { isTokenizing, createToken } = useOzElements();
|
|
239
|
+
* // <button :disabled="isTokenizing" @click="createToken()">Pay</button>
|
|
240
|
+
*/
|
|
241
|
+
isTokenizing: ComputedRef<boolean>;
|
|
216
242
|
}
|
|
217
243
|
/**
|
|
218
244
|
* Returns createToken, createBankToken, ready, initError, tokenizeCount, and reset.
|
package/dist/vue/index.cjs.js
CHANGED
|
@@ -2357,7 +2357,20 @@ const OzElements = vue.defineComponent({
|
|
|
2357
2357
|
vue.onMounted(() => {
|
|
2358
2358
|
const ac = new AbortController();
|
|
2359
2359
|
abortController = ac;
|
|
2360
|
-
|
|
2360
|
+
// Guard: onLoadError must fire at most once per mount cycle. It can be
|
|
2361
|
+
// triggered by two independent paths — the vault's iframe load timeout
|
|
2362
|
+
// (inside OzVault constructor) and the .catch below when create() rejects
|
|
2363
|
+
// after the timeout has already fired. Without this flag both paths would
|
|
2364
|
+
// call the callback, mirroring the same guard used in the React provider.
|
|
2365
|
+
let loadErrorFired = false;
|
|
2366
|
+
const fireLoadError = () => {
|
|
2367
|
+
var _a;
|
|
2368
|
+
if (loadErrorFired)
|
|
2369
|
+
return;
|
|
2370
|
+
loadErrorFired = true;
|
|
2371
|
+
(_a = props.onLoadError) === null || _a === void 0 ? void 0 : _a.call(props, { source: 'tokenizer' });
|
|
2372
|
+
};
|
|
2373
|
+
OzVault.create(Object.assign(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.onLoadError ? { onLoadError: fireLoadError } : {})), (props.debug ? { debug: props.debug } : {})), {
|
|
2361
2374
|
// Session lifecycle — wire refresh callback and reset tokenizeCount so the
|
|
2362
2375
|
// counter stays accurate across proactive key refreshes (mirrors React provider).
|
|
2363
2376
|
// Deferred by one microtask for the same reason as React: notifyTokenize fires
|
|
@@ -2380,7 +2393,7 @@ const OzElements = vue.defineComponent({
|
|
|
2380
2393
|
return;
|
|
2381
2394
|
initError.value = err instanceof Error ? err : new Error('OzVault.create() failed.');
|
|
2382
2395
|
if (props.onLoadError) {
|
|
2383
|
-
|
|
2396
|
+
fireLoadError();
|
|
2384
2397
|
}
|
|
2385
2398
|
else {
|
|
2386
2399
|
console.error('[OzElements] OzVault.create() failed. Provide an `onLoadError` prop to handle this gracefully.', err);
|
|
@@ -2428,7 +2441,9 @@ function useOzElements() {
|
|
|
2428
2441
|
return result;
|
|
2429
2442
|
};
|
|
2430
2443
|
const reset = () => { var _a; (_a = vault.value) === null || _a === void 0 ? void 0 : _a.reset(); };
|
|
2431
|
-
|
|
2444
|
+
const isComplete = vue.computed(() => { var _a, _b; return (_b = (_a = vault.value) === null || _a === void 0 ? void 0 : _a.isComplete) !== null && _b !== void 0 ? _b : false; });
|
|
2445
|
+
const isTokenizing = vue.computed(() => { var _a, _b; return (_b = (_a = vault.value) === null || _a === void 0 ? void 0 : _a.isTokenizing) !== null && _b !== void 0 ? _b : false; });
|
|
2446
|
+
return { createToken, createBankToken, ready, initError, tokenizeCount, reset, isComplete, isTokenizing };
|
|
2432
2447
|
}
|
|
2433
2448
|
function createFieldComponent(displayName, mountElement) {
|
|
2434
2449
|
return vue.defineComponent({
|