@ozura/elements 1.0.2-next.9 → 1.1.0-next.21
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 +167 -21
- package/dist/frame/element-frame.js +56 -15
- package/dist/frame/element-frame.js.map +1 -1
- package/dist/frame/tokenizer-frame.js +4 -1
- package/dist/frame/tokenizer-frame.js.map +1 -1
- package/dist/oz-elements.esm.js +201 -14
- package/dist/oz-elements.esm.js.map +1 -1
- package/dist/oz-elements.umd.js +201 -14
- package/dist/oz-elements.umd.js.map +1 -1
- package/dist/react/frame/elementFrame.d.ts +9 -0
- package/dist/react/index.cjs.js +210 -20
- package/dist/react/index.cjs.js.map +1 -1
- package/dist/react/index.esm.js +210 -20
- package/dist/react/index.esm.js.map +1 -1
- package/dist/react/react/index.d.ts +28 -1
- package/dist/react/sdk/OzVault.d.ts +49 -0
- package/dist/react/types/index.d.ts +18 -0
- package/dist/server/frame/elementFrame.d.ts +9 -0
- package/dist/server/sdk/OzVault.d.ts +49 -0
- package/dist/server/types/index.d.ts +18 -0
- package/dist/types/frame/elementFrame.d.ts +9 -0
- package/dist/types/sdk/OzVault.d.ts +49 -0
- package/dist/types/types/index.d.ts +18 -0
- package/package.json +1 -1
|
@@ -44,6 +44,8 @@ export declare class OzVault {
|
|
|
44
44
|
private tokenizerReady;
|
|
45
45
|
private _tokenizing;
|
|
46
46
|
private _destroyed;
|
|
47
|
+
private _resetCount;
|
|
48
|
+
private _debug;
|
|
47
49
|
private _tokenizeSuccessCount;
|
|
48
50
|
private _maxTokenizeCalls;
|
|
49
51
|
private boundHandleMessage;
|
|
@@ -155,6 +157,29 @@ export declare class OzVault {
|
|
|
155
157
|
* Returns a token and cvcSession that can be passed to the Ozura Pay API.
|
|
156
158
|
*/
|
|
157
159
|
createToken(options?: TokenizeOptions): Promise<TokenResponse>;
|
|
160
|
+
/**
|
|
161
|
+
* Clears all mounted element fields without tearing down the vault.
|
|
162
|
+
*
|
|
163
|
+
* Call this after a failed payment (e.g. card declined) to let the customer
|
|
164
|
+
* re-enter their details. The vault instance, tokenizer iframe, wax key, and
|
|
165
|
+
* tokenization budget counter are all preserved — no network calls are made.
|
|
166
|
+
*
|
|
167
|
+
* **Wax key session model:** by design, one wax key covers the full checkout
|
|
168
|
+
* session. The default `max_tokenize_calls: 3` supports two declined attempts
|
|
169
|
+
* and one final attempt on the same key. Do not call `vault.destroy()` and
|
|
170
|
+
* recreate the vault between declines — that unnecessarily re-mints the key
|
|
171
|
+
* and discards the remaining budget.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* try {
|
|
175
|
+
* const { token, cvcSession } = await vault.createToken({ billing });
|
|
176
|
+
* await chargeCard(token, cvcSession);
|
|
177
|
+
* } catch (err) {
|
|
178
|
+
* vault.reset(); // clear fields; let customer re-enter
|
|
179
|
+
* showError(err.message);
|
|
180
|
+
* }
|
|
181
|
+
*/
|
|
182
|
+
reset(): void;
|
|
158
183
|
/**
|
|
159
184
|
* Tears down the vault: removes all element iframes, the tokenizer iframe,
|
|
160
185
|
* and the global message listener. Call this when the checkout component
|
|
@@ -172,6 +197,30 @@ export declare class OzVault {
|
|
|
172
197
|
* while avoiding spurious refreshes for brief tab-switches.
|
|
173
198
|
*/
|
|
174
199
|
private handleVisibilityChange;
|
|
200
|
+
/**
|
|
201
|
+
* Emits a `[OzVault]`-prefixed entry to `console.log`. No-op when `debug` is
|
|
202
|
+
* not set. Never called with sensitive values — callers use presence flags only.
|
|
203
|
+
*/
|
|
204
|
+
private log;
|
|
205
|
+
/**
|
|
206
|
+
* Returns a plain-object snapshot of the vault's current internal state.
|
|
207
|
+
* Safe to attach to bug reports — no wax keys, tokens, or billing data included.
|
|
208
|
+
*
|
|
209
|
+
* Available on all vault instances regardless of whether `debug` was enabled.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* console.log(vault.debugState());
|
|
213
|
+
* // {
|
|
214
|
+
* // vaultId: 'vault-abc123',
|
|
215
|
+
* // isReady: true,
|
|
216
|
+
* // tokenizing: null,
|
|
217
|
+
* // destroyed: false,
|
|
218
|
+
* // waxKeyPresent: true,
|
|
219
|
+
* // elements: ['cardNumber', 'expirationDate', 'cvv'],
|
|
220
|
+
* // ...
|
|
221
|
+
* // }
|
|
222
|
+
*/
|
|
223
|
+
debugState(): Record<string, unknown>;
|
|
175
224
|
private mountTokenizerFrame;
|
|
176
225
|
private handleMessage;
|
|
177
226
|
/**
|
|
@@ -256,6 +256,24 @@ export interface VaultOptions {
|
|
|
256
256
|
* }
|
|
257
257
|
*/
|
|
258
258
|
appearance?: Appearance;
|
|
259
|
+
/**
|
|
260
|
+
* Enables structured debug logging to the browser console.
|
|
261
|
+
*
|
|
262
|
+
* When `true`, the vault emits a `[OzVault]`-prefixed `console.log` entry at
|
|
263
|
+
* every meaningful lifecycle event: vault creation, tokenizer readiness, element
|
|
264
|
+
* readiness, field changes, tokenization start/result/error, wax key refresh,
|
|
265
|
+
* tab-visibility refreshes, `reset()`, and `destroy()`.
|
|
266
|
+
*
|
|
267
|
+
* **No sensitive data is ever logged.** Wax keys, tokens, CVC sessions, and
|
|
268
|
+
* billing fields are represented only as boolean presence flags. Frame IDs and
|
|
269
|
+
* request IDs are truncated. Output is safe to paste directly into bug reports.
|
|
270
|
+
*
|
|
271
|
+
* Use `vault.debugState()` to capture a full snapshot of internal state at any
|
|
272
|
+
* point, regardless of whether `debug` is enabled.
|
|
273
|
+
*
|
|
274
|
+
* @default false
|
|
275
|
+
*/
|
|
276
|
+
debug?: boolean;
|
|
259
277
|
}
|
|
260
278
|
/** Billing address. All string fields are validated to 1–50 characters. */
|
|
261
279
|
export interface BillingAddress {
|
|
@@ -27,6 +27,7 @@ export declare class ElementFrame {
|
|
|
27
27
|
private cvvMaxLength;
|
|
28
28
|
private _composing;
|
|
29
29
|
private _appliedBaseStyleKeys;
|
|
30
|
+
private _appliedStateStyleKeys;
|
|
30
31
|
private containerEl;
|
|
31
32
|
private inputEl;
|
|
32
33
|
private iconEl;
|
|
@@ -53,6 +54,14 @@ export declare class ElementFrame {
|
|
|
53
54
|
private applyOptions;
|
|
54
55
|
private applyStyles;
|
|
55
56
|
private static readonly PLACEHOLDER_INPUT_ID;
|
|
57
|
+
/** Clears all CSS properties that were applied from a state-style bucket
|
|
58
|
+
* (focus, complete, or invalid), then restores any that exist in the base
|
|
59
|
+
* style so that base values are not lost when transitioning between states. */
|
|
60
|
+
private clearStateStyles;
|
|
61
|
+
/** Clears stale state styles then re-applies the correct state bucket based
|
|
62
|
+
* on current focus and validity. Used after a base-style update so the
|
|
63
|
+
* on-screen state visual stays accurate without requiring user interaction. */
|
|
64
|
+
private reapplyStateStyles;
|
|
56
65
|
private applyPlaceholderStyles;
|
|
57
66
|
private fontsInjected;
|
|
58
67
|
private injectFonts;
|
|
@@ -44,6 +44,8 @@ export declare class OzVault {
|
|
|
44
44
|
private tokenizerReady;
|
|
45
45
|
private _tokenizing;
|
|
46
46
|
private _destroyed;
|
|
47
|
+
private _resetCount;
|
|
48
|
+
private _debug;
|
|
47
49
|
private _tokenizeSuccessCount;
|
|
48
50
|
private _maxTokenizeCalls;
|
|
49
51
|
private boundHandleMessage;
|
|
@@ -155,6 +157,29 @@ export declare class OzVault {
|
|
|
155
157
|
* Returns a token and cvcSession that can be passed to the Ozura Pay API.
|
|
156
158
|
*/
|
|
157
159
|
createToken(options?: TokenizeOptions): Promise<TokenResponse>;
|
|
160
|
+
/**
|
|
161
|
+
* Clears all mounted element fields without tearing down the vault.
|
|
162
|
+
*
|
|
163
|
+
* Call this after a failed payment (e.g. card declined) to let the customer
|
|
164
|
+
* re-enter their details. The vault instance, tokenizer iframe, wax key, and
|
|
165
|
+
* tokenization budget counter are all preserved — no network calls are made.
|
|
166
|
+
*
|
|
167
|
+
* **Wax key session model:** by design, one wax key covers the full checkout
|
|
168
|
+
* session. The default `max_tokenize_calls: 3` supports two declined attempts
|
|
169
|
+
* and one final attempt on the same key. Do not call `vault.destroy()` and
|
|
170
|
+
* recreate the vault between declines — that unnecessarily re-mints the key
|
|
171
|
+
* and discards the remaining budget.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* try {
|
|
175
|
+
* const { token, cvcSession } = await vault.createToken({ billing });
|
|
176
|
+
* await chargeCard(token, cvcSession);
|
|
177
|
+
* } catch (err) {
|
|
178
|
+
* vault.reset(); // clear fields; let customer re-enter
|
|
179
|
+
* showError(err.message);
|
|
180
|
+
* }
|
|
181
|
+
*/
|
|
182
|
+
reset(): void;
|
|
158
183
|
/**
|
|
159
184
|
* Tears down the vault: removes all element iframes, the tokenizer iframe,
|
|
160
185
|
* and the global message listener. Call this when the checkout component
|
|
@@ -172,6 +197,30 @@ export declare class OzVault {
|
|
|
172
197
|
* while avoiding spurious refreshes for brief tab-switches.
|
|
173
198
|
*/
|
|
174
199
|
private handleVisibilityChange;
|
|
200
|
+
/**
|
|
201
|
+
* Emits a `[OzVault]`-prefixed entry to `console.log`. No-op when `debug` is
|
|
202
|
+
* not set. Never called with sensitive values — callers use presence flags only.
|
|
203
|
+
*/
|
|
204
|
+
private log;
|
|
205
|
+
/**
|
|
206
|
+
* Returns a plain-object snapshot of the vault's current internal state.
|
|
207
|
+
* Safe to attach to bug reports — no wax keys, tokens, or billing data included.
|
|
208
|
+
*
|
|
209
|
+
* Available on all vault instances regardless of whether `debug` was enabled.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* console.log(vault.debugState());
|
|
213
|
+
* // {
|
|
214
|
+
* // vaultId: 'vault-abc123',
|
|
215
|
+
* // isReady: true,
|
|
216
|
+
* // tokenizing: null,
|
|
217
|
+
* // destroyed: false,
|
|
218
|
+
* // waxKeyPresent: true,
|
|
219
|
+
* // elements: ['cardNumber', 'expirationDate', 'cvv'],
|
|
220
|
+
* // ...
|
|
221
|
+
* // }
|
|
222
|
+
*/
|
|
223
|
+
debugState(): Record<string, unknown>;
|
|
175
224
|
private mountTokenizerFrame;
|
|
176
225
|
private handleMessage;
|
|
177
226
|
/**
|
|
@@ -256,6 +256,24 @@ export interface VaultOptions {
|
|
|
256
256
|
* }
|
|
257
257
|
*/
|
|
258
258
|
appearance?: Appearance;
|
|
259
|
+
/**
|
|
260
|
+
* Enables structured debug logging to the browser console.
|
|
261
|
+
*
|
|
262
|
+
* When `true`, the vault emits a `[OzVault]`-prefixed `console.log` entry at
|
|
263
|
+
* every meaningful lifecycle event: vault creation, tokenizer readiness, element
|
|
264
|
+
* readiness, field changes, tokenization start/result/error, wax key refresh,
|
|
265
|
+
* tab-visibility refreshes, `reset()`, and `destroy()`.
|
|
266
|
+
*
|
|
267
|
+
* **No sensitive data is ever logged.** Wax keys, tokens, CVC sessions, and
|
|
268
|
+
* billing fields are represented only as boolean presence flags. Frame IDs and
|
|
269
|
+
* request IDs are truncated. Output is safe to paste directly into bug reports.
|
|
270
|
+
*
|
|
271
|
+
* Use `vault.debugState()` to capture a full snapshot of internal state at any
|
|
272
|
+
* point, regardless of whether `debug` is enabled.
|
|
273
|
+
*
|
|
274
|
+
* @default false
|
|
275
|
+
*/
|
|
276
|
+
debug?: boolean;
|
|
259
277
|
}
|
|
260
278
|
/** Billing address. All string fields are validated to 1–50 characters. */
|
|
261
279
|
export interface BillingAddress {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozura/elements",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0-next.21",
|
|
4
4
|
"description": "PCI-compliant card tokenization SDK for the Ozura Vault — collect card data in iframe-isolated fields and tokenize without PCI scope",
|
|
5
5
|
"main": "dist/oz-elements.umd.js",
|
|
6
6
|
"module": "dist/oz-elements.esm.js",
|