@wirexapp/card-reveal-web 0.1.0-beta.0
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 +15 -0
- package/README.md +13 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/revealElement.d.ts +41 -0
- package/dist/revealElement.d.ts.map +1 -0
- package/dist/revealElement.js +42 -0
- package/dist/revealElement.js.map +1 -0
- package/package.json +42 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @wirexapp/card-reveal-web
|
|
2
|
+
|
|
3
|
+
## 0.1.0-beta.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1ff075a: Initial public beta of the Wirex PCI card SDK family: collect (top-up + OCT
|
|
8
|
+
destination), own-card reveal, 3DS step-up, React bindings, and the umbrella
|
|
9
|
+
package — all versioned in lockstep. Card data renders only inside
|
|
10
|
+
Wirex-served iframes; the packages are CHD-free loaders.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [1ff075a]
|
|
15
|
+
- @wirexapp/card-sdk-core@0.1.0-beta.0
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @wirexapp/card-reveal-web
|
|
2
|
+
|
|
3
|
+
Display an issued card's PAN / expiry / CVV inside Wirex-served PCI iframes. The frame
|
|
4
|
+
fetches the values directly from the Wirex API and renders them in place;
|
|
5
|
+
copy-to-clipboard runs inside the frame. The host page never sees the values. CHD-free
|
|
6
|
+
loader.
|
|
7
|
+
|
|
8
|
+
- `createCardReveal(sdk, config)` → `PciRevealElement { mount, destroy }`.
|
|
9
|
+
- Requires the user's bearer plus a fresh single-use `action_token` (wallet-signature
|
|
10
|
+
step-up) minted immediately before mounting.
|
|
11
|
+
|
|
12
|
+
React bindings: `@wirexapp/card-react`. Full partner docs: `partner-docs/` in the repo
|
|
13
|
+
(packages → card-reveal-web).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@wirexapp/card-reveal-web` — display an issued card's PAN / expiry / CVV
|
|
3
|
+
* inside Wirex-served iframes. The values render (and copy to clipboard) inside
|
|
4
|
+
* the frames only; the host page never sees them.
|
|
5
|
+
*/
|
|
6
|
+
import { type PciSdkConfig } from '@wirexapp/card-sdk-core';
|
|
7
|
+
import { PciRevealElement, type PciRevealElementConfig } from './revealElement.js';
|
|
8
|
+
export type { PciRevealAuth, PciRevealElementConfig } from './revealElement.js';
|
|
9
|
+
export { PciRevealElement } from './revealElement.js';
|
|
10
|
+
/** Create a reveal element bound to the given frame origin. */
|
|
11
|
+
export declare const createCardReveal: (sdk: PciSdkConfig, config: PciRevealElementConfig) => PciRevealElement;
|
|
12
|
+
export type * from '@wirexapp/card-sdk-core';
|
|
13
|
+
export { PciFrameRequestError } from '@wirexapp/card-sdk-core';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEnF,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,GAAI,KAAK,YAAY,EAAE,QAAQ,sBAAsB,KAAG,gBACzB,CAAC;AAI7D,mBAAmB,yBAAyB,CAAC;AAG7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@wirexapp/card-reveal-web` — display an issued card's PAN / expiry / CVV
|
|
3
|
+
* inside Wirex-served iframes. The values render (and copy to clipboard) inside
|
|
4
|
+
* the frames only; the host page never sees them.
|
|
5
|
+
*/
|
|
6
|
+
import { buildFrameUrl } from '@wirexapp/card-sdk-core';
|
|
7
|
+
import { PciRevealElement } from './revealElement.js';
|
|
8
|
+
export { PciRevealElement } from './revealElement.js';
|
|
9
|
+
/** Create a reveal element bound to the given frame origin. */
|
|
10
|
+
export const createCardReveal = (sdk, config) => new PciRevealElement(buildFrameUrl(sdk, 'reveal'), config);
|
|
11
|
+
// Value re-export so `error instanceof PciFrameRequestError` works when
|
|
12
|
+
// imported from this package.
|
|
13
|
+
export { PciFrameRequestError } from '@wirexapp/card-sdk-core';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAqB,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAA+B,MAAM,oBAAoB,CAAC;AAGnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAiB,EAAE,MAA8B,EAAoB,EAAE,CACtG,IAAI,gBAAgB,CAAC,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AAK7D,wEAAwE;AACxE,8BAA8B;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PciAppearance, PciFrameStrings, PciRevealField, PciRevealState } from '@wirexapp/card-sdk-core';
|
|
2
|
+
export interface PciRevealAuth {
|
|
3
|
+
getBearerToken: () => Promise<string>;
|
|
4
|
+
/** Cardholder identity headers (X-User-Email / X-User-Wallet). Per-user
|
|
5
|
+
* session data — a cross-origin frame cannot read it, so the host supplies
|
|
6
|
+
* it. The API base URL and X-Chain-Id are NOT here: they are the frame
|
|
7
|
+
* service's own config (`window.__WX_ENDPOINTS__`). */
|
|
8
|
+
userEmail?: string;
|
|
9
|
+
userWallet?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PciRevealElementConfig {
|
|
12
|
+
cardId: string;
|
|
13
|
+
/** One-shot step-up token minted by the host via the wallet-signature flow.
|
|
14
|
+
* By design: reveal authenticates with the caller's bearer + this existing
|
|
15
|
+
* `action_token` against `/v1/cards/:id/details|cvv`. Same model for Wirex
|
|
16
|
+
* apps and B2B partners; there is no separate reveal-session token. */
|
|
17
|
+
actionToken: string;
|
|
18
|
+
fetchDetails: boolean;
|
|
19
|
+
fetchCvv: boolean;
|
|
20
|
+
/** Exact rows to render, in order — one field per iframe. Overrides
|
|
21
|
+
* `fetchDetails`/`fetchCvv` (they're derived from the requested fields). */
|
|
22
|
+
fields?: PciRevealField[];
|
|
23
|
+
cardholderName?: string;
|
|
24
|
+
auth: PciRevealAuth;
|
|
25
|
+
appearance?: PciAppearance;
|
|
26
|
+
strings?: PciFrameStrings;
|
|
27
|
+
onStateChange?: (state: PciRevealState) => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Own-card reveal element. The frame fetches PAN/expiry/CVV directly from the
|
|
31
|
+
* BaaS API and renders them inside the iframe; copy-to-clipboard runs inside
|
|
32
|
+
* the frame too. The host page never sees the values.
|
|
33
|
+
*/
|
|
34
|
+
export declare class PciRevealElement {
|
|
35
|
+
private readonly config;
|
|
36
|
+
private readonly channel;
|
|
37
|
+
constructor(frameUrl: string, config: PciRevealElementConfig);
|
|
38
|
+
mount(container: HTMLElement): Promise<void>;
|
|
39
|
+
destroy(): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=revealElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revealElement.d.ts","sourceRoot":"","sources":["../src/revealElement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9G,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC;;;4DAGwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf;;;4EAGwE;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB;iFAC6E;IAC7E,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CACjD;AAED;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;gBAE9B,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB;IAQtD,KAAK,CAAC,SAAS,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBlD,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PciFrameChannel } from '@wirexapp/card-sdk-core';
|
|
2
|
+
/**
|
|
3
|
+
* Own-card reveal element. The frame fetches PAN/expiry/CVV directly from the
|
|
4
|
+
* BaaS API and renders them inside the iframe; copy-to-clipboard runs inside
|
|
5
|
+
* the frame too. The host page never sees the values.
|
|
6
|
+
*/
|
|
7
|
+
export class PciRevealElement {
|
|
8
|
+
constructor(frameUrl, config) {
|
|
9
|
+
this.config = config;
|
|
10
|
+
this.channel = new PciFrameChannel(frameUrl, {}, { allowClipboard: true });
|
|
11
|
+
this.channel.onMessage(message => {
|
|
12
|
+
if (message.type === 'reveal-state')
|
|
13
|
+
config.onStateChange?.(message.state);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async mount(container) {
|
|
17
|
+
await this.channel.mount(container);
|
|
18
|
+
await this.channel.request({
|
|
19
|
+
type: 'init',
|
|
20
|
+
config: {
|
|
21
|
+
mode: 'reveal',
|
|
22
|
+
auth: {
|
|
23
|
+
bearerToken: await this.config.auth.getBearerToken(),
|
|
24
|
+
userEmail: this.config.auth.userEmail,
|
|
25
|
+
userWallet: this.config.auth.userWallet,
|
|
26
|
+
},
|
|
27
|
+
cardId: this.config.cardId,
|
|
28
|
+
actionToken: this.config.actionToken,
|
|
29
|
+
fetchDetails: this.config.fetchDetails,
|
|
30
|
+
fetchCvv: this.config.fetchCvv,
|
|
31
|
+
fields: this.config.fields,
|
|
32
|
+
cardholderName: this.config.cardholderName,
|
|
33
|
+
appearance: this.config.appearance,
|
|
34
|
+
strings: this.config.strings,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
destroy() {
|
|
39
|
+
this.channel.destroy();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=revealElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revealElement.js","sourceRoot":"","sources":["../src/revealElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAgC1D;;;;GAIG;AACH,MAAM,OA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C,MAAM,CAAC,OAAO;aAC7B;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wirexapp/card-reveal-web",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Reveal an issued card's PAN/expiry/CVV inside Wirex-served PCI iframes; values never reach the host page. CHD-free loader.",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public",
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"module": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc -p tsconfig.build.json",
|
|
34
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
35
|
+
"clean": "rm -rf dist",
|
|
36
|
+
"typecheck": "yarn run -T tsc --noEmit",
|
|
37
|
+
"prepublishOnly": "yarn clean && yarn build"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@wirexapp/card-sdk-core": "0.1.0-beta.0"
|
|
41
|
+
}
|
|
42
|
+
}
|