@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
package/dist/react/index.cjs.js
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
|
|
6
|
+
/******************************************************************************
|
|
7
|
+
Copyright (c) Microsoft Corporation.
|
|
8
|
+
|
|
9
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
+
purpose with or without fee is hereby granted.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
+
***************************************************************************** */
|
|
20
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
24
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
25
|
+
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");
|
|
26
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
30
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
31
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
32
|
+
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");
|
|
33
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
37
|
+
var e = new Error(message);
|
|
38
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
39
|
+
};
|
|
40
|
+
|
|
6
41
|
const THEME_DEFAULT = {
|
|
7
42
|
base: {
|
|
8
43
|
color: '#1a1a2e',
|
|
@@ -954,6 +989,7 @@ function createSessionFetcher(url) {
|
|
|
954
989
|
};
|
|
955
990
|
}
|
|
956
991
|
|
|
992
|
+
var _OzVault_waxKey;
|
|
957
993
|
function isCardMetadata(v) {
|
|
958
994
|
if (!v || typeof v !== 'object')
|
|
959
995
|
return false;
|
|
@@ -997,6 +1033,11 @@ class OzVault {
|
|
|
997
1033
|
*/
|
|
998
1034
|
constructor(options, waxKey, tokenizationSessionId) {
|
|
999
1035
|
var _a, _b, _c, _d, _e;
|
|
1036
|
+
// Hard-private: JavaScript WeakMap-based enforcement (not just TypeScript
|
|
1037
|
+
// compile-time). Runtime code cannot read this via vault['waxKey'] or
|
|
1038
|
+
// (vault as any).waxKey — prevents wax key exfiltration if merchant-page
|
|
1039
|
+
// JS were somehow inspected at runtime (e.g. after an XSS).
|
|
1040
|
+
_OzVault_waxKey.set(this, '');
|
|
1000
1041
|
this.elements = new Map();
|
|
1001
1042
|
this.elementsByType = new Map();
|
|
1002
1043
|
this.bankElementsByType = new Map();
|
|
@@ -1022,7 +1063,7 @@ class OzVault {
|
|
|
1022
1063
|
this.loadErrorTimeoutId = null;
|
|
1023
1064
|
// Proactive wax refresh on visibility restore after long idle
|
|
1024
1065
|
this._hiddenAt = null;
|
|
1025
|
-
this
|
|
1066
|
+
__classPrivateFieldSet(this, _OzVault_waxKey, waxKey, "f");
|
|
1026
1067
|
this.tokenizationSessionId = tokenizationSessionId;
|
|
1027
1068
|
this.pubKey = options.pubKey;
|
|
1028
1069
|
// Strip trailing slash so URL construction never produces double-slash paths
|
|
@@ -1134,8 +1175,8 @@ class OzVault {
|
|
|
1134
1175
|
vault.destroy();
|
|
1135
1176
|
throw new OzError('Session fetch returned an empty key. Check your session endpoint response — it must return { sessionKey: "..." }.');
|
|
1136
1177
|
}
|
|
1137
|
-
// Static methods can access private fields of instances of the same class.
|
|
1138
|
-
vault
|
|
1178
|
+
// Static methods can access hard-private fields of instances of the same class.
|
|
1179
|
+
__classPrivateFieldSet(vault, _OzVault_waxKey, waxKey, "f");
|
|
1139
1180
|
vault._storedFetchWaxKey = resolvedFetchKey;
|
|
1140
1181
|
// If the tokenizer iframe fired OZ_FRAME_READY before fetchWaxKey resolved,
|
|
1141
1182
|
// the OZ_INIT sent at that point had an empty waxKey. Send a follow-up now
|
|
@@ -1652,7 +1693,7 @@ class OzVault {
|
|
|
1652
1693
|
isReady: this.tokenizerReady,
|
|
1653
1694
|
tokenizing: this._tokenizing,
|
|
1654
1695
|
destroyed: this._destroyed,
|
|
1655
|
-
waxKeyPresent: Boolean(this
|
|
1696
|
+
waxKeyPresent: Boolean(__classPrivateFieldGet(this, _OzVault_waxKey, "f")),
|
|
1656
1697
|
tokenizeSuccessCount: this._tokenizeSuccessCount,
|
|
1657
1698
|
maxTokenizeCalls: this._maxTokenizeCalls,
|
|
1658
1699
|
resetCount: this._resetCount,
|
|
@@ -1670,6 +1711,17 @@ class OzVault {
|
|
|
1670
1711
|
iframe.style.cssText = 'position:absolute;top:-9999px;left:-9999px;width:1px;height:1px;';
|
|
1671
1712
|
iframe.setAttribute('aria-hidden', 'true');
|
|
1672
1713
|
iframe.tabIndex = -1;
|
|
1714
|
+
// allow-scripts: JS runs. allow-same-origin: frame keeps its actual origin
|
|
1715
|
+
// (elements.ozura.com) so fetch() CORS requests carry the correct Origin
|
|
1716
|
+
// header. Without allow-same-origin the frame gets a null opaque origin and
|
|
1717
|
+
// the vault API's CORS policy would reject it.
|
|
1718
|
+
// NOT included: allow-top-navigation, allow-popups, allow-forms — prevents
|
|
1719
|
+
// a compromised tokenizer frame from navigating the merchant page or opening
|
|
1720
|
+
// popups even if the CDN bundle were somehow replaced.
|
|
1721
|
+
// Note: allow-scripts + allow-same-origin on a cross-origin iframe does NOT
|
|
1722
|
+
// expose window.parent — Same Origin Policy still applies between
|
|
1723
|
+
// elements.ozura.com and the merchant domain.
|
|
1724
|
+
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
|
|
1673
1725
|
const parentOrigin = typeof window !== 'undefined' ? window.location.origin : '';
|
|
1674
1726
|
iframe.src = `${this.frameBaseUrl}/frame/tokenizer-frame.html#vaultId=${encodeURIComponent(this.vaultId)}${parentOrigin ? `&parentOrigin=${encodeURIComponent(parentOrigin)}` : ''}`;
|
|
1675
1727
|
document.body.appendChild(iframe);
|
|
@@ -1805,7 +1857,7 @@ class OzVault {
|
|
|
1805
1857
|
// Deliver the wax key via OZ_INIT so the tokenizer stores it internally.
|
|
1806
1858
|
// If waxKey is still empty (fetchWaxKey hasn't resolved yet), it will be
|
|
1807
1859
|
// sent again from create() once the key is available.
|
|
1808
|
-
this.sendToTokenizer(Object.assign(Object.assign({ type: 'OZ_INIT', frameId: '__tokenizer__' }, (this
|
|
1860
|
+
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 }));
|
|
1809
1861
|
(_c = this._onReady) === null || _c === void 0 ? void 0 : _c.call(this);
|
|
1810
1862
|
this.log('tokenizer iframe ready', { protocolVersion: (_d = msg.__ozVersion) !== null && _d !== void 0 ? _d : null });
|
|
1811
1863
|
this.log('vault state', this.debugState());
|
|
@@ -2111,7 +2163,7 @@ class OzVault {
|
|
|
2111
2163
|
throw new OzError('fetchWaxKey returned an empty string during auto-refresh.', undefined, 'auth');
|
|
2112
2164
|
}
|
|
2113
2165
|
if (!this._destroyed) {
|
|
2114
|
-
this
|
|
2166
|
+
__classPrivateFieldSet(this, _OzVault_waxKey, newWaxKey, "f");
|
|
2115
2167
|
this.tokenizationSessionId = newSessionId;
|
|
2116
2168
|
this._tokenizeSuccessCount = 0;
|
|
2117
2169
|
}
|
|
@@ -2135,6 +2187,7 @@ class OzVault {
|
|
|
2135
2187
|
(_a = this.tokenizerWindow) === null || _a === void 0 ? void 0 : _a.postMessage(msg, this.frameOrigin, transfer !== null && transfer !== void 0 ? transfer : []);
|
|
2136
2188
|
}
|
|
2137
2189
|
}
|
|
2190
|
+
_OzVault_waxKey = new WeakMap();
|
|
2138
2191
|
|
|
2139
2192
|
const OzContext = react.createContext({
|
|
2140
2193
|
vault: null,
|