@wirexapp/card-sdk-core 0.1.0-beta.0 → 0.1.0-beta.1
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/CHANGELOG.md +10 -0
- package/dist/frameUrl.d.ts +20 -11
- package/dist/frameUrl.d.ts.map +1 -1
- package/dist/frameUrl.js +18 -6
- package/dist/frameUrl.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @wirexapp/card-sdk-core
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 737c0f8: Named environments replace free-form frame origins: pass
|
|
8
|
+
`environment: 'dev' | 'uat' | 'prod'` (default `'prod'`) and the SDK resolves
|
|
9
|
+
the baked-in Wirex frame origin — origins are no longer partner input.
|
|
10
|
+
`frameOrigin` remains as an explicit local-development override that takes
|
|
11
|
+
precedence; unknown environments throw at creation time.
|
|
12
|
+
|
|
3
13
|
## 0.1.0-beta.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/dist/frameUrl.d.ts
CHANGED
|
@@ -2,19 +2,25 @@
|
|
|
2
2
|
* Frame-URL building shared by every capability package (topup / oct / reveal)
|
|
3
3
|
* and the umbrella `createPciSdk` factory.
|
|
4
4
|
*/
|
|
5
|
+
/** Named environment → the Wirex-operated frame origin baked into the SDK.
|
|
6
|
+
* Partners select an environment; they never supply origins. */
|
|
7
|
+
export type PciEnvironment = 'dev' | 'uat' | 'prod';
|
|
5
8
|
export interface PciSdkConfig {
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* boundary is the entire Same-Origin-Policy isolation the SDK relies on. There
|
|
11
|
-
* is deliberately no same-origin fallback — a same-origin frame would let
|
|
12
|
-
* host-page XSS read cardholder data, nullifying the SDK.
|
|
13
|
-
* TODO(pci-sdk): prod split — loader on `js.<domain>`, cookieless frames on
|
|
14
|
-
* `frames.<domain>` (docs/DESIGN.md §5.5.1).
|
|
10
|
+
* Which Wirex environment serves the frames. Defaults to `'prod'`. The
|
|
11
|
+
* origins are baked into the SDK on purpose: an origin is not partner
|
|
12
|
+
* input, so it can be neither mistyped nor redirected.
|
|
15
13
|
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
14
|
+
environment?: PciEnvironment;
|
|
15
|
+
/**
|
|
16
|
+
* LOCAL DEVELOPMENT / INTERNAL ONLY — overrides `environment` with an
|
|
17
|
+
* explicit frame origin (e.g. `http://localhost:4114` while developing the
|
|
18
|
+
* frames themselves). Never set this in a partner integration: the whole
|
|
19
|
+
* isolation model relies on the frames being served from a Wirex-operated
|
|
20
|
+
* origin, cross-origin to the host app.
|
|
21
|
+
*/
|
|
22
|
+
frameOrigin?: string;
|
|
23
|
+
/** Path prefix of the frame documents on the origin (the service serves
|
|
18
24
|
* them at the root, so this is empty by default). */
|
|
19
25
|
framePath?: string;
|
|
20
26
|
/**
|
|
@@ -29,7 +35,10 @@ export interface PciSdkConfig {
|
|
|
29
35
|
clientId?: string;
|
|
30
36
|
}
|
|
31
37
|
export type PciFrameDocument = 'collect' | 'collect-field' | 'reveal';
|
|
32
|
-
|
|
38
|
+
/** Resolve the frame origin: explicit `frameOrigin` override (local dev) wins,
|
|
39
|
+
* otherwise the named environment (default `'prod'`). Unknown environments
|
|
40
|
+
* throw — a misconfigured host must fail loudly, never fall back silently. */
|
|
41
|
+
export declare const resolveFrameOrigin: (config: PciSdkConfig) => string;
|
|
33
42
|
/** Build the URL of one frame document. `client` MUST be a query param, not the
|
|
34
43
|
* URL fragment: the frame host reads it server-side to emit the per-client
|
|
35
44
|
* `frame-ancestors` header, and the fragment is never sent to the server. The
|
package/dist/frameUrl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameUrl.d.ts","sourceRoot":"","sources":["../src/frameUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B
|
|
1
|
+
{"version":3,"file":"frameUrl.d.ts","sourceRoot":"","sources":["../src/frameUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;iEACiE;AACjE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAQpD,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;0DACsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,eAAe,GAAG,QAAQ,CAAC;AAEtE;;+EAE+E;AAC/E,eAAO,MAAM,kBAAkB,GAAI,QAAQ,YAAY,KAAG,MAUzD,CAAC;AAEF;;;2EAG2E;AAC3E,eAAO,MAAM,aAAa,GAAI,QAAQ,YAAY,EAAE,UAAU,gBAAgB,KAAG,MAKhF,CAAC"}
|
package/dist/frameUrl.js
CHANGED
|
@@ -2,20 +2,32 @@
|
|
|
2
2
|
* Frame-URL building shared by every capability package (topup / oct / reveal)
|
|
3
3
|
* and the umbrella `createPciSdk` factory.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const ENVIRONMENT_ORIGINS = {
|
|
6
|
+
dev: 'https://frames-dev.wirexapp.tech',
|
|
7
|
+
uat: 'https://frames.wirexapp.tech',
|
|
8
|
+
prod: 'https://frames.wirexapp.com',
|
|
9
|
+
};
|
|
10
|
+
/** Resolve the frame origin: explicit `frameOrigin` override (local dev) wins,
|
|
11
|
+
* otherwise the named environment (default `'prod'`). Unknown environments
|
|
12
|
+
* throw — a misconfigured host must fail loudly, never fall back silently. */
|
|
13
|
+
export const resolveFrameOrigin = (config) => {
|
|
14
|
+
if (config.frameOrigin)
|
|
15
|
+
return config.frameOrigin;
|
|
16
|
+
const environment = config.environment ?? 'prod';
|
|
17
|
+
const origin = ENVIRONMENT_ORIGINS[environment];
|
|
18
|
+
if (!origin) {
|
|
19
|
+
throw new Error(`PCI SDK: unknown environment "${environment}" — expected 'dev', 'uat' or 'prod'.`);
|
|
9
20
|
}
|
|
21
|
+
return origin;
|
|
10
22
|
};
|
|
11
23
|
/** Build the URL of one frame document. `client` MUST be a query param, not the
|
|
12
24
|
* URL fragment: the frame host reads it server-side to emit the per-client
|
|
13
25
|
* `frame-ancestors` header, and the fragment is never sent to the server. The
|
|
14
26
|
* channel/parent fragment is appended afterwards by `PciFrameChannel`. */
|
|
15
27
|
export const buildFrameUrl = (config, document) => {
|
|
16
|
-
|
|
28
|
+
const origin = resolveFrameOrigin(config);
|
|
17
29
|
const framePath = config.framePath ?? '';
|
|
18
30
|
const query = config.clientId ? `?client=${encodeURIComponent(config.clientId)}` : '';
|
|
19
|
-
return `${
|
|
31
|
+
return `${origin}${framePath}/${document}.html${query}`;
|
|
20
32
|
};
|
|
21
33
|
//# sourceMappingURL=frameUrl.js.map
|
package/dist/frameUrl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameUrl.js","sourceRoot":"","sources":["../src/frameUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"frameUrl.js","sourceRoot":"","sources":["../src/frameUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,mBAAmB,GAAmC;IAC1D,GAAG,EAAE,kCAAkC;IACvC,GAAG,EAAE,8BAA8B;IACnC,IAAI,EAAE,6BAA6B;CACpC,CAAC;AAkCF;;+EAE+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAoB,EAAU,EAAE;IACjE,IAAI,MAAM,CAAC,WAAW;QAAE,OAAO,MAAM,CAAC,WAAW,CAAC;IAClD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC;IACjD,MAAM,MAAM,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAChD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,iCAAiC,WAAW,sCAAsC,CACnF,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;2EAG2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAoB,EAAE,QAA0B,EAAU,EAAE;IACxF,MAAM,MAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACtF,OAAO,GAAG,MAAM,GAAG,SAAS,IAAI,QAAQ,QAAQ,KAAK,EAAE,CAAC;AAC1D,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export { PciCollectElement } from './collectElement.js';
|
|
|
14
14
|
export type { PciCollectField, PciCollectGroupConfig } from './collectGroup.js';
|
|
15
15
|
export { PciCollectGroup } from './collectGroup.js';
|
|
16
16
|
export { PciFrameChannel, PciFrameRequestError } from './frameChannel.js';
|
|
17
|
-
export type { PciFrameDocument, PciSdkConfig } from './frameUrl.js';
|
|
18
|
-
export {
|
|
17
|
+
export type { PciEnvironment, PciFrameDocument, PciSdkConfig } from './frameUrl.js';
|
|
18
|
+
export { buildFrameUrl, resolveFrameOrigin } from './frameUrl.js';
|
|
19
19
|
export type { PciAppearance, PciAppearanceVariables, PciBrandBadgeAppearance, PciCardBrand, PciCollectChangeState, PciCollectFieldInitConfig, PciCollectFieldName, PciCollectInitConfig, PciCollectProfile, PciFrameAuth, PciFrameError, PciFrameStrings, PciFrameToHostMessage, PciHostToFrameMessage, PciInitConfig, PciRevealField, PciRevealInitConfig, PciRevealState, PciRevealStatus, PciTokenizeOctRequest, PciTokenizeOctResult, PciTokenizeRequest, PciTokenizeTopUpRequest, PciTokenizeTopUpResult, } from './protocol.js';
|
|
20
20
|
export { PCI_PROTOCOL_VERSION } from './protocol.js';
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,4BAA4B,EAC5B,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,4BAA4B,EAC5B,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAClE,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
export { PciCollectElement } from './collectElement.js';
|
|
13
13
|
export { PciCollectGroup } from './collectGroup.js';
|
|
14
14
|
export { PciFrameChannel, PciFrameRequestError } from './frameChannel.js';
|
|
15
|
-
export {
|
|
15
|
+
export { buildFrameUrl, resolveFrameOrigin } from './frameUrl.js';
|
|
16
16
|
export { PCI_PROTOCOL_VERSION } from './protocol.js';
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AA2BlE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirexapp/card-sdk-core",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared foundation of the Wirex PCI card SDK: postMessage protocol, frame channel, frame-URL building, collect machinery. CHD-free.",
|
|
6
6
|
"license": "UNLICENSED",
|