@ozura/elements 1.2.4-next.56 → 1.2.4-next.57

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.
@@ -26,7 +26,9 @@
26
26
  import { type Ref, type PropType, type ComputedRef } from 'vue';
27
27
  import type { TokenizeOptions, TokenResponse, BankTokenizeOptions, BankTokenResponse, FontSource, Appearance } from '../types';
28
28
  export interface OzElementsProps {
29
- pubKey: string;
29
+ /** Omit when using a test vault key from a Test project at ozuravault.com.
30
+ * Required for production vault keys. */
31
+ pubKey?: string;
30
32
  sessionUrl?: string;
31
33
  getSessionKey?: (sessionId: string) => Promise<string>;
32
34
  frameBaseUrl?: string;
@@ -54,7 +56,7 @@ export interface OzElementsProps {
54
56
  export declare const OzElements: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
55
57
  pubKey: {
56
58
  type: StringConstructor;
57
- required: true;
59
+ default: undefined;
58
60
  };
59
61
  sessionUrl: {
60
62
  type: StringConstructor;
@@ -105,7 +107,7 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
105
107
  }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "ready"[], "ready", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
106
108
  pubKey: {
107
109
  type: StringConstructor;
108
- required: true;
110
+ default: undefined;
109
111
  };
110
112
  sessionUrl: {
111
113
  type: StringConstructor;
@@ -156,6 +158,7 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
156
158
  }>, {
157
159
  debug: boolean;
158
160
  fonts: FontSource[];
161
+ pubKey: string;
159
162
  loadTimeoutMs: number;
160
163
  frameBaseUrl: string;
161
164
  maxTokenizeCalls: number;
@@ -9,7 +9,7 @@ import { ElementType, BankElementType, ElementOptions, VaultOptions, TokenizeOpt
9
9
  * @example
10
10
  * // Recommended — pass sessionUrl and let the SDK call your backend automatically
11
11
  * const vault = await OzVault.create({
12
- * pubKey: 'pk_prod_...', // or 'pk_test_...' for test mode
12
+ * pubKey: 'pk_prod_...', // omit for test vault keys; required for production
13
13
  * sessionUrl: '/api/oz-session', // backend endpoint that calls ozura.createSession()
14
14
  * });
15
15
  * const cardNum = vault.createElement('cardNumber');
@@ -152,9 +152,13 @@ export interface Appearance {
152
152
  variables?: AppearanceVariables;
153
153
  }
154
154
  export interface VaultOptions {
155
- /** System pub key required for tokenization. Obtain from Ozura admin.
156
- * Sent as the `X-Pub-Key` header on tokenize requests. */
157
- pubKey: string;
155
+ /** System pub key required for tokenization with production vault keys.
156
+ * Sent as the `X-Pub-Key` header on tokenize requests.
157
+ *
158
+ * **Omit when using a test vault key** (from a Test project at ozuravault.com).
159
+ * Test keys do not require a pub key — the vault recognizes them and tokenizes
160
+ * without the header. For production keys this is required. */
161
+ pubKey?: string;
158
162
  /**
159
163
  * URL of your backend session endpoint. The simplest way to connect the SDK
160
164
  * to your server — just pass the path and the SDK handles everything else.
@@ -26,7 +26,9 @@
26
26
  import { type Ref, type PropType, type ComputedRef } from 'vue';
27
27
  import type { TokenizeOptions, TokenResponse, BankTokenizeOptions, BankTokenResponse, FontSource, Appearance } from '../types';
28
28
  export interface OzElementsProps {
29
- pubKey: string;
29
+ /** Omit when using a test vault key from a Test project at ozuravault.com.
30
+ * Required for production vault keys. */
31
+ pubKey?: string;
30
32
  sessionUrl?: string;
31
33
  getSessionKey?: (sessionId: string) => Promise<string>;
32
34
  frameBaseUrl?: string;
@@ -54,7 +56,7 @@ export interface OzElementsProps {
54
56
  export declare const OzElements: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
55
57
  pubKey: {
56
58
  type: StringConstructor;
57
- required: true;
59
+ default: undefined;
58
60
  };
59
61
  sessionUrl: {
60
62
  type: StringConstructor;
@@ -105,7 +107,7 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
105
107
  }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "ready"[], "ready", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
106
108
  pubKey: {
107
109
  type: StringConstructor;
108
- required: true;
110
+ default: undefined;
109
111
  };
110
112
  sessionUrl: {
111
113
  type: StringConstructor;
@@ -156,6 +158,7 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
156
158
  }>, {
157
159
  debug: boolean;
158
160
  fonts: FontSource[];
161
+ pubKey: string;
159
162
  loadTimeoutMs: number;
160
163
  frameBaseUrl: string;
161
164
  maxTokenizeCalls: number;
@@ -9,7 +9,7 @@ import { ElementType, BankElementType, ElementOptions, VaultOptions, TokenizeOpt
9
9
  * @example
10
10
  * // Recommended — pass sessionUrl and let the SDK call your backend automatically
11
11
  * const vault = await OzVault.create({
12
- * pubKey: 'pk_prod_...', // or 'pk_test_...' for test mode
12
+ * pubKey: 'pk_prod_...', // omit for test vault keys; required for production
13
13
  * sessionUrl: '/api/oz-session', // backend endpoint that calls ozura.createSession()
14
14
  * });
15
15
  * const cardNum = vault.createElement('cardNumber');
@@ -152,9 +152,13 @@ export interface Appearance {
152
152
  variables?: AppearanceVariables;
153
153
  }
154
154
  export interface VaultOptions {
155
- /** System pub key required for tokenization. Obtain from Ozura admin.
156
- * Sent as the `X-Pub-Key` header on tokenize requests. */
157
- pubKey: string;
155
+ /** System pub key required for tokenization with production vault keys.
156
+ * Sent as the `X-Pub-Key` header on tokenize requests.
157
+ *
158
+ * **Omit when using a test vault key** (from a Test project at ozuravault.com).
159
+ * Test keys do not require a pub key — the vault recognizes them and tokenizes
160
+ * without the header. For production keys this is required. */
161
+ pubKey?: string;
158
162
  /**
159
163
  * URL of your backend session endpoint. The simplest way to connect the SDK
160
164
  * to your server — just pass the path and the SDK handles everything else.
@@ -26,7 +26,9 @@
26
26
  import { type Ref, type PropType, type ComputedRef } from 'vue';
27
27
  import type { TokenizeOptions, TokenResponse, BankTokenizeOptions, BankTokenResponse, FontSource, Appearance } from '../types';
28
28
  export interface OzElementsProps {
29
- pubKey: string;
29
+ /** Omit when using a test vault key from a Test project at ozuravault.com.
30
+ * Required for production vault keys. */
31
+ pubKey?: string;
30
32
  sessionUrl?: string;
31
33
  getSessionKey?: (sessionId: string) => Promise<string>;
32
34
  frameBaseUrl?: string;
@@ -54,7 +56,7 @@ export interface OzElementsProps {
54
56
  export declare const OzElements: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
55
57
  pubKey: {
56
58
  type: StringConstructor;
57
- required: true;
59
+ default: undefined;
58
60
  };
59
61
  sessionUrl: {
60
62
  type: StringConstructor;
@@ -105,7 +107,7 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
105
107
  }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "ready"[], "ready", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
106
108
  pubKey: {
107
109
  type: StringConstructor;
108
- required: true;
110
+ default: undefined;
109
111
  };
110
112
  sessionUrl: {
111
113
  type: StringConstructor;
@@ -156,6 +158,7 @@ export declare const OzElements: import("vue").DefineComponent<import("vue").Ext
156
158
  }>, {
157
159
  debug: boolean;
158
160
  fonts: FontSource[];
161
+ pubKey: string;
159
162
  loadTimeoutMs: number;
160
163
  frameBaseUrl: string;
161
164
  maxTokenizeCalls: number;
@@ -1036,7 +1036,7 @@ const DEFAULT_FRAME_BASE_URL = "https://lively-hill-097170c0f.4.azurestaticapps.
1036
1036
  * @example
1037
1037
  * // Recommended — pass sessionUrl and let the SDK call your backend automatically
1038
1038
  * const vault = await OzVault.create({
1039
- * pubKey: 'pk_prod_...', // or 'pk_test_...' for test mode
1039
+ * pubKey: 'pk_prod_...', // omit for test vault keys; required for production
1040
1040
  * sessionUrl: '/api/oz-session', // backend endpoint that calls ozura.createSession()
1041
1041
  * });
1042
1042
  * const cardNum = vault.createElement('cardNumber');
@@ -1144,8 +1144,15 @@ class OzVault {
1144
1144
  * @throws {OzError} if the session fetch fails, times out, or returns an empty string.
1145
1145
  */
1146
1146
  static async create(options, signal) {
1147
- if (!options.pubKey || !options.pubKey.trim()) {
1148
- throw new OzError('pubKey is required in options. Obtain your public key from the Ozura admin.');
1147
+ // pubKey is optional — test vault keys (from a Test project on the vault)
1148
+ // do not require a pub key. Production keys do. If provided, it must be
1149
+ // non-empty after trimming; if omitted entirely, warn but continue.
1150
+ if (options.pubKey !== undefined && !options.pubKey.trim()) {
1151
+ throw new OzError('pubKey must be a non-empty string. Omit the option entirely to use a test vault key.');
1152
+ }
1153
+ if (options.pubKey === undefined) {
1154
+ console.warn('[OzVault] pubKey not provided — this only works with a test vault key from a Test project on the vault. ' +
1155
+ 'For production, set pubKey to your pk_live_... or pk_prod_... value.');
1149
1156
  }
1150
1157
  // Normalize the session callback. Priority: sessionUrl > getSessionKey > fetchWaxKey (deprecated).
1151
1158
  // This allows merchants to use the clean new API without touching legacy code.
@@ -1354,6 +1361,7 @@ class OzVault {
1354
1361
  const requestId = `req-${uuid()}`;
1355
1362
  this.log('createBankToken() called');
1356
1363
  return new Promise((resolve, reject) => {
1364
+ var _a;
1357
1365
  const resetCountAtStart = this._resetCount;
1358
1366
  const cleanup = () => {
1359
1367
  if (this._resetCount === resetCountAtStart)
@@ -1374,7 +1382,7 @@ class OzVault {
1374
1382
  type: 'OZ_BANK_TOKENIZE',
1375
1383
  requestId,
1376
1384
  tokenizationSessionId: this.tokenizationSessionId,
1377
- pubKey: this.pubKey,
1385
+ pubKey: (_a = this.pubKey) !== null && _a !== void 0 ? _a : '',
1378
1386
  firstName: options.firstName.trim(),
1379
1387
  lastName: options.lastName.trim(),
1380
1388
  fieldCount: readyBankElements.length,
@@ -1473,6 +1481,7 @@ class OzVault {
1473
1481
  billingPresent: Boolean(options.billing),
1474
1482
  });
1475
1483
  return new Promise((resolve, reject) => {
1484
+ var _a;
1476
1485
  // Capture the reset generation so cleanup() only zeros _tokenizing when it
1477
1486
  // still belongs to this invocation — not a newer one that started after a reset.
1478
1487
  const resetCountAtStart = this._resetCount;
@@ -1497,7 +1506,7 @@ class OzVault {
1497
1506
  type: 'OZ_TOKENIZE',
1498
1507
  requestId,
1499
1508
  tokenizationSessionId: this.tokenizationSessionId,
1500
- pubKey: this.pubKey,
1509
+ pubKey: (_a = this.pubKey) !== null && _a !== void 0 ? _a : '',
1501
1510
  firstName,
1502
1511
  lastName,
1503
1512
  fieldCount: readyElements.length,
@@ -1945,6 +1954,7 @@ class OzVault {
1945
1954
  if (willRefresh) {
1946
1955
  const resetCountAtRetry = this._resetCount;
1947
1956
  this.refreshWaxKey().then(() => {
1957
+ var _a;
1948
1958
  if (this._destroyed) {
1949
1959
  pending.reject(new OzError('Vault destroyed during wax key refresh.'));
1950
1960
  return;
@@ -1977,7 +1987,7 @@ class OzVault {
1977
1987
  type: 'OZ_TOKENIZE',
1978
1988
  requestId: newRequestId,
1979
1989
  tokenizationSessionId: this.tokenizationSessionId,
1980
- pubKey: this.pubKey,
1990
+ pubKey: (_a = this.pubKey) !== null && _a !== void 0 ? _a : '',
1981
1991
  firstName: pending.firstName,
1982
1992
  lastName: pending.lastName,
1983
1993
  fieldCount: pending.fieldCount,
@@ -2021,6 +2031,7 @@ class OzVault {
2021
2031
  if (this.isRefreshableAuthError(errorCode, raw) && !bankPending.retried && this._storedFetchWaxKey) {
2022
2032
  const resetCountAtRetry = this._resetCount;
2023
2033
  this.refreshWaxKey().then(() => {
2034
+ var _a;
2024
2035
  if (this._destroyed) {
2025
2036
  bankPending.reject(new OzError('Vault destroyed during wax key refresh.'));
2026
2037
  return;
@@ -2043,7 +2054,7 @@ class OzVault {
2043
2054
  type: 'OZ_BANK_TOKENIZE',
2044
2055
  requestId: newRequestId,
2045
2056
  tokenizationSessionId: this.tokenizationSessionId,
2046
- pubKey: this.pubKey,
2057
+ pubKey: (_a = this.pubKey) !== null && _a !== void 0 ? _a : '',
2047
2058
  firstName: bankPending.firstName,
2048
2059
  lastName: bankPending.lastName,
2049
2060
  fieldCount: bankPending.fieldCount,
@@ -2244,7 +2255,7 @@ const OZ_KEY = Symbol('oz-elements');
2244
2255
  const OzElements = vue.defineComponent({
2245
2256
  name: 'OzElements',
2246
2257
  props: {
2247
- pubKey: { type: String, required: true },
2258
+ pubKey: { type: String, default: undefined },
2248
2259
  sessionUrl: { type: String, default: undefined },
2249
2260
  getSessionKey: { type: Function, default: undefined },
2250
2261
  frameBaseUrl: { type: String, default: undefined },