pa-sdk-react-native 3.0.0 → 3.0.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/README.md +85 -73
- package/lib/api.d.ts +7 -7
- package/lib/api.js +11 -11
- package/lib/confirm.d.ts +18 -19
- package/lib/confirm.js +20 -21
- package/lib/errors.d.ts +6 -6
- package/lib/errors.generated.d.ts +1 -1
- package/lib/errors.generated.js +1 -1
- package/lib/errors.js +5 -5
- package/lib/index.d.ts +3 -3
- package/lib/index.js +9 -9
- package/lib/init.d.ts +8 -8
- package/lib/init.js +8 -8
- package/lib/locales.d.ts +7 -7
- package/lib/locales.generated.d.ts +2 -2
- package/lib/locales.generated.js +26 -26
- package/lib/locales.js +10 -10
- package/lib/poll.d.ts +3 -3
- package/lib/poll.js +4 -4
- package/lib/threeDs.d.ts +6 -6
- package/lib/threeDs.js +2 -2
- package/lib/threeDsHost.d.ts +2 -2
- package/lib/threeDsHost.js +3 -3
- package/lib/tokenize.d.ts +4 -4
- package/lib/tokenize.js +4 -4
- package/lib/types.d.ts +25 -26
- package/lib/types.js +4 -5
- package/lib/validator.d.ts +8 -8
- package/lib/validator.js +9 -10
- package/locales/ms-MY.json +24 -24
- package/native/android/build.gradle +4 -4
- package/native/android/src/main/AndroidManifest.xml +12 -11
- package/native/android/src/main/java/com/pasdk/reactnative/PaSdk3dsActivity.kt +9 -16
- package/native/android/src/main/java/com/pasdk/reactnative/PaSdk3dsModule.kt +3 -3
- package/native/ios/PaSdk3ds.swift +6 -6
- package/native/ios/PaSdk3dsModule.m +2 -2
- package/package.json +3 -3
- package/scripts/generate-errors.js +2 -2
- package/scripts/generate-locales.js +3 -3
package/lib/errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Typed errors
|
|
2
|
+
* Typed errors.
|
|
3
3
|
*
|
|
4
4
|
* Every rejection is a PaError carrying:
|
|
5
5
|
* - `code` — a stable code from the shared table (src/errors.generated.ts)
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* - `userMessage` — a localized user message the app may show directly
|
|
8
8
|
*
|
|
9
9
|
* Technical failures (network, not initialised, 3DS UI unavailable) reject
|
|
10
|
-
* with a PaError too — they are never reported as payment results
|
|
10
|
+
* with a PaError too — they are never reported as payment results.
|
|
11
11
|
*/
|
|
12
|
-
/** Localized user message for a shared-table code
|
|
12
|
+
/** Localized user message for a shared-table code. Falls back
|
|
13
13
|
* to `error.generic` when the code has no dedicated string. */
|
|
14
14
|
export declare function userMessageForCode(code: string, locale?: string | null): string;
|
|
15
15
|
export interface PaErrorOptions {
|
|
@@ -21,18 +21,18 @@ export interface PaErrorOptions {
|
|
|
21
21
|
cause?: unknown;
|
|
22
22
|
}
|
|
23
23
|
export declare class PaError extends Error {
|
|
24
|
-
/** Shared-table code
|
|
24
|
+
/** Shared-table code or a field code. */
|
|
25
25
|
readonly code: string;
|
|
26
26
|
/** English developer message from the shared table. */
|
|
27
27
|
readonly developerMessage: string;
|
|
28
|
-
/** Localized user message — the app shows this and logs `code
|
|
28
|
+
/** Localized user message — the app shows this and logs `code`. */
|
|
29
29
|
readonly userMessage: string;
|
|
30
30
|
/** True when this is a field-validation error rather than a payment error. */
|
|
31
31
|
readonly isFieldError: boolean;
|
|
32
32
|
constructor(code: string, options?: PaErrorOptions);
|
|
33
33
|
}
|
|
34
34
|
export declare function isPaError(value: unknown): value is PaError;
|
|
35
|
-
/** Thrown when the SDK is used before init()
|
|
35
|
+
/** Thrown when the SDK is used before init(). */
|
|
36
36
|
export declare class NotInitializedError extends PaError {
|
|
37
37
|
constructor();
|
|
38
38
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Table version: 1, generated_at: 2026-10-20T04:13:44+00:00.
|
|
5
5
|
*
|
|
6
6
|
* One code table shared by the server API, webhooks, the web SDK and this
|
|
7
|
-
* React Native SDK
|
|
7
|
+
* React Native SDK. Values are English developer
|
|
8
8
|
* messages; localized user messages live in the locale bundles.
|
|
9
9
|
*/
|
|
10
10
|
export declare const ERROR_TABLE_VERSION: number;
|
package/lib/errors.generated.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Table version: 1, generated_at: 2026-10-20T04:13:44+00:00.
|
|
7
7
|
*
|
|
8
8
|
* One code table shared by the server API, webhooks, the web SDK and this
|
|
9
|
-
* React Native SDK
|
|
9
|
+
* React Native SDK. Values are English developer
|
|
10
10
|
* messages; localized user messages live in the locale bundles.
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Typed errors
|
|
3
|
+
* Typed errors.
|
|
4
4
|
*
|
|
5
5
|
* Every rejection is a PaError carrying:
|
|
6
6
|
* - `code` — a stable code from the shared table (src/errors.generated.ts)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - `userMessage` — a localized user message the app may show directly
|
|
9
9
|
*
|
|
10
10
|
* Technical failures (network, not initialised, 3DS UI unavailable) reject
|
|
11
|
-
* with a PaError too — they are never reported as payment results
|
|
11
|
+
* with a PaError too — they are never reported as payment results.
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.NotInitializedError = exports.PaError = void 0;
|
|
@@ -16,7 +16,7 @@ exports.userMessageForCode = userMessageForCode;
|
|
|
16
16
|
exports.isPaError = isPaError;
|
|
17
17
|
const errors_generated_1 = require("./errors.generated");
|
|
18
18
|
const locales_1 = require("./locales");
|
|
19
|
-
/** Codes that are validation field codes
|
|
19
|
+
/** Codes that are validation field codes — user message key `field.<code>`. */
|
|
20
20
|
const FIELD_CODE_PREFIX = 'field.';
|
|
21
21
|
const FIELD_CODES = new Set([
|
|
22
22
|
'incomplete_number',
|
|
@@ -37,7 +37,7 @@ const LOCALIZED_ERROR_KEYS = new Set([
|
|
|
37
37
|
'origin_not_allowed',
|
|
38
38
|
'font_load_failed',
|
|
39
39
|
]);
|
|
40
|
-
/** Localized user message for a shared-table code
|
|
40
|
+
/** Localized user message for a shared-table code. Falls back
|
|
41
41
|
* to `error.generic` when the code has no dedicated string. */
|
|
42
42
|
function userMessageForCode(code, locale) {
|
|
43
43
|
const strings = (0, locales_1.getLocaleStrings)(locale);
|
|
@@ -68,7 +68,7 @@ exports.PaError = PaError;
|
|
|
68
68
|
function isPaError(value) {
|
|
69
69
|
return value instanceof PaError;
|
|
70
70
|
}
|
|
71
|
-
/** Thrown when the SDK is used before init()
|
|
71
|
+
/** Thrown when the SDK is used before init(). */
|
|
72
72
|
class NotInitializedError extends PaError {
|
|
73
73
|
constructor() {
|
|
74
74
|
super('internal_error', {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PA SDK React Native — public entry point.
|
|
3
3
|
*
|
|
4
|
-
* Headless card SDK for React Native
|
|
4
|
+
* Headless card SDK for React Native: the app builds its own
|
|
5
5
|
* card UI; the SDK provides validation, tokenization, confirm with built-in
|
|
6
6
|
* 3DS, save-card and multi-market merchant accounts.
|
|
7
7
|
*
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
*
|
|
18
18
|
* const result = await PaSdk.confirmWithCard({
|
|
19
19
|
* card: { cardNumber: '4242...', expiryMonth: 12, expiryYear: 29, cvc: '123' },
|
|
20
|
-
* intentToken, clientToken, // from
|
|
21
|
-
* idempotencyKey: myUuid,
|
|
20
|
+
* intentToken, clientToken, // from your server only
|
|
21
|
+
* idempotencyKey: myUuid,
|
|
22
22
|
* saveCard: saveChecked,
|
|
23
23
|
* onThreeDsWillPresent: () => hideLoadingOverlay(),
|
|
24
24
|
* });
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* PA SDK React Native — public entry point.
|
|
4
4
|
*
|
|
5
|
-
* Headless card SDK for React Native
|
|
5
|
+
* Headless card SDK for React Native: the app builds its own
|
|
6
6
|
* card UI; the SDK provides validation, tokenization, confirm with built-in
|
|
7
7
|
* 3DS, save-card and multi-market merchant accounts.
|
|
8
8
|
*
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
*
|
|
19
19
|
* const result = await PaSdk.confirmWithCard({
|
|
20
20
|
* card: { cardNumber: '4242...', expiryMonth: 12, expiryYear: 29, cvc: '123' },
|
|
21
|
-
* intentToken, clientToken, // from
|
|
22
|
-
* idempotencyKey: myUuid,
|
|
21
|
+
* intentToken, clientToken, // from your server only
|
|
22
|
+
* idempotencyKey: myUuid,
|
|
23
23
|
* saveCard: saveChecked,
|
|
24
24
|
* onThreeDsWillPresent: () => hideLoadingOverlay(),
|
|
25
25
|
* });
|
|
@@ -34,7 +34,7 @@ Object.defineProperty(exports, "getSdk", { enumerable: true, get: function () {
|
|
|
34
34
|
Object.defineProperty(exports, "getSdkOrNull", { enumerable: true, get: function () { return init_1.getSdkOrNull; } });
|
|
35
35
|
Object.defineProperty(exports, "updateLocale", { enumerable: true, get: function () { return init_1.updateLocale; } });
|
|
36
36
|
Object.defineProperty(exports, "deinitialize", { enumerable: true, get: function () { return init_1.deinitialize; } });
|
|
37
|
-
// validation
|
|
37
|
+
// validation
|
|
38
38
|
var validator_1 = require("./validator");
|
|
39
39
|
Object.defineProperty(exports, "detectBrand", { enumerable: true, get: function () { return validator_1.detectBrand; } });
|
|
40
40
|
Object.defineProperty(exports, "luhnValid", { enumerable: true, get: function () { return validator_1.luhnValid; } });
|
|
@@ -44,11 +44,11 @@ Object.defineProperty(exports, "validateCardNumber", { enumerable: true, get: fu
|
|
|
44
44
|
Object.defineProperty(exports, "validateCvc", { enumerable: true, get: function () { return validator_1.validateCvc; } });
|
|
45
45
|
Object.defineProperty(exports, "validateExpiry", { enumerable: true, get: function () { return validator_1.validateExpiry; } });
|
|
46
46
|
Object.defineProperty(exports, "cvcLengthsForBrand", { enumerable: true, get: function () { return validator_1.cvcLengthsForBrand; } });
|
|
47
|
-
// tokenization
|
|
47
|
+
// tokenization
|
|
48
48
|
var tokenize_1 = require("./tokenize");
|
|
49
49
|
Object.defineProperty(exports, "createElementSession", { enumerable: true, get: function () { return tokenize_1.createElementSession; } });
|
|
50
50
|
Object.defineProperty(exports, "tokenizeCard", { enumerable: true, get: function () { return tokenize_1.tokenizeCard; } });
|
|
51
|
-
// confirm
|
|
51
|
+
// confirm — both forms
|
|
52
52
|
var confirm_1 = require("./confirm");
|
|
53
53
|
Object.defineProperty(exports, "confirmWithToken", { enumerable: true, get: function () { return confirm_1.confirmWithToken; } });
|
|
54
54
|
Object.defineProperty(exports, "confirmWithCard", { enumerable: true, get: function () { return confirm_1.confirmWithCard; } });
|
|
@@ -60,13 +60,13 @@ var poll_1 = require("./poll");
|
|
|
60
60
|
Object.defineProperty(exports, "AppStateAwarePoller", { enumerable: true, get: function () { return poll_1.AppStateAwarePoller; } });
|
|
61
61
|
Object.defineProperty(exports, "pollUntil", { enumerable: true, get: function () { return poll_1.pollUntil; } });
|
|
62
62
|
Object.defineProperty(exports, "DEFAULT_POLLER_OPTIONS", { enumerable: true, get: function () { return poll_1.DEFAULT_POLLER_OPTIONS; } });
|
|
63
|
-
// errors
|
|
63
|
+
// errors
|
|
64
64
|
var errors_1 = require("./errors");
|
|
65
65
|
Object.defineProperty(exports, "PaError", { enumerable: true, get: function () { return errors_1.PaError; } });
|
|
66
66
|
Object.defineProperty(exports, "isPaError", { enumerable: true, get: function () { return errors_1.isPaError; } });
|
|
67
67
|
Object.defineProperty(exports, "userMessageForCode", { enumerable: true, get: function () { return errors_1.userMessageForCode; } });
|
|
68
68
|
Object.defineProperty(exports, "NotInitializedError", { enumerable: true, get: function () { return errors_1.NotInitializedError; } });
|
|
69
|
-
// locales
|
|
69
|
+
// locales
|
|
70
70
|
var locales_1 = require("./locales");
|
|
71
71
|
Object.defineProperty(exports, "DEFAULT_LOCALE", { enumerable: true, get: function () { return locales_1.DEFAULT_LOCALE; } });
|
|
72
72
|
Object.defineProperty(exports, "SUPPORTED_LOCALES", { enumerable: true, get: function () { return locales_1.SUPPORTED_LOCALES; } });
|
|
@@ -75,7 +75,7 @@ Object.defineProperty(exports, "getLocaleStrings", { enumerable: true, get: func
|
|
|
75
75
|
Object.defineProperty(exports, "normalizeLocale", { enumerable: true, get: function () { return locales_1.normalizeLocale; } });
|
|
76
76
|
Object.defineProperty(exports, "resolveBundle", { enumerable: true, get: function () { return locales_1.resolveBundle; } });
|
|
77
77
|
Object.defineProperty(exports, "setLocale", { enumerable: true, get: function () { return locales_1.setLocale; } });
|
|
78
|
-
// 3DS bridge + fallback host
|
|
78
|
+
// 3DS bridge + fallback host
|
|
79
79
|
var threeDs_1 = require("./threeDs");
|
|
80
80
|
Object.defineProperty(exports, "canPresentThreeDs", { enumerable: true, get: function () { return threeDs_1.canPresentThreeDs; } });
|
|
81
81
|
Object.defineProperty(exports, "closeThreeDs", { enumerable: true, get: function () { return threeDs_1.closeThreeDs; } });
|
package/lib/init.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SDK initialisation
|
|
2
|
+
* SDK initialisation.
|
|
3
3
|
*
|
|
4
4
|
* One initialisation serves multiple merchant accounts: `accounts` maps a
|
|
5
5
|
* market key (e.g. "HK", "MY", "SG", "TW") to that market's publishable
|
|
6
6
|
* merchantToken. Currency and country are per intent — never per init.
|
|
7
|
-
* Environment is selected once, from the app's build config
|
|
8
|
-
* No secret key is ever passed here — only publishable tokens
|
|
7
|
+
* Environment is selected once, from the app's build config.
|
|
8
|
+
* No secret key is ever passed here — only publishable tokens.
|
|
9
9
|
*/
|
|
10
10
|
import { ApiClient } from './api';
|
|
11
11
|
import type { Environment, InitOptions } from './types';
|
|
@@ -22,7 +22,7 @@ export interface PaSdkInstance {
|
|
|
22
22
|
/** Resolve the account for a market (or the default). */
|
|
23
23
|
accountFor(market?: string): PaAccount;
|
|
24
24
|
api: ApiClient;
|
|
25
|
-
/** 3DS return URL config
|
|
25
|
+
/** 3DS return URL config. */
|
|
26
26
|
threeDsReturnUrls?: {
|
|
27
27
|
scheme?: string;
|
|
28
28
|
universalLinkHost?: string;
|
|
@@ -31,17 +31,17 @@ export interface PaSdkInstance {
|
|
|
31
31
|
/**
|
|
32
32
|
* Initialise the SDK. Call once, early (app start / payment screen mount).
|
|
33
33
|
* Re-initialising replaces the previous configuration (useful for
|
|
34
|
-
* locale changes via destroy-and-re-init
|
|
34
|
+
* locale changes via destroy-and-re-init).
|
|
35
35
|
*
|
|
36
36
|
* @throws PaError `request_invalid` when options are malformed (never a
|
|
37
|
-
* payment result
|
|
37
|
+
* payment result).
|
|
38
38
|
*/
|
|
39
39
|
export declare function init(options: InitOptions): PaSdkInstance;
|
|
40
|
-
/** The current instance; throws NotInitializedError before init()
|
|
40
|
+
/** The current instance; throws NotInitializedError before init(). */
|
|
41
41
|
export declare function getSdk(): PaSdkInstance;
|
|
42
42
|
/** Like getSdk() but returns null instead of throwing. */
|
|
43
43
|
export declare function getSdkOrNull(): PaSdkInstance | null;
|
|
44
|
-
/** Change the locale at runtime without re-initialising
|
|
44
|
+
/** Change the locale at runtime without re-initialising. */
|
|
45
45
|
export declare function updateLocale(locale: string): void;
|
|
46
46
|
/** Drop the current configuration (e.g. logout). */
|
|
47
47
|
export declare function deinitialize(): void;
|
package/lib/init.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* SDK initialisation
|
|
3
|
+
* SDK initialisation.
|
|
4
4
|
*
|
|
5
5
|
* One initialisation serves multiple merchant accounts: `accounts` maps a
|
|
6
6
|
* market key (e.g. "HK", "MY", "SG", "TW") to that market's publishable
|
|
7
7
|
* merchantToken. Currency and country are per intent — never per init.
|
|
8
|
-
* Environment is selected once, from the app's build config
|
|
9
|
-
* No secret key is ever passed here — only publishable tokens
|
|
8
|
+
* Environment is selected once, from the app's build config.
|
|
9
|
+
* No secret key is ever passed here — only publishable tokens.
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.init = init;
|
|
@@ -21,10 +21,10 @@ let instance = null;
|
|
|
21
21
|
/**
|
|
22
22
|
* Initialise the SDK. Call once, early (app start / payment screen mount).
|
|
23
23
|
* Re-initialising replaces the previous configuration (useful for
|
|
24
|
-
* locale changes via destroy-and-re-init
|
|
24
|
+
* locale changes via destroy-and-re-init).
|
|
25
25
|
*
|
|
26
26
|
* @throws PaError `request_invalid` when options are malformed (never a
|
|
27
|
-
* payment result
|
|
27
|
+
* payment result).
|
|
28
28
|
*/
|
|
29
29
|
function init(options) {
|
|
30
30
|
if (!options || (options.environment !== 'production' && options.environment !== 'sandbox')) {
|
|
@@ -52,7 +52,7 @@ function init(options) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
if (options.locale) {
|
|
55
|
-
(0, locales_1.setLocale)(options.locale); //
|
|
55
|
+
(0, locales_1.setLocale)(options.locale); // accepted in any tag form
|
|
56
56
|
}
|
|
57
57
|
instance = {
|
|
58
58
|
environment: options.environment,
|
|
@@ -73,7 +73,7 @@ function init(options) {
|
|
|
73
73
|
};
|
|
74
74
|
return instance;
|
|
75
75
|
}
|
|
76
|
-
/** The current instance; throws NotInitializedError before init()
|
|
76
|
+
/** The current instance; throws NotInitializedError before init(). */
|
|
77
77
|
function getSdk() {
|
|
78
78
|
if (!instance) {
|
|
79
79
|
throw new errors_1.PaError('internal_error', {
|
|
@@ -86,7 +86,7 @@ function getSdk() {
|
|
|
86
86
|
function getSdkOrNull() {
|
|
87
87
|
return instance;
|
|
88
88
|
}
|
|
89
|
-
/** Change the locale at runtime without re-initialising
|
|
89
|
+
/** Change the locale at runtime without re-initialising. */
|
|
90
90
|
function updateLocale(locale) {
|
|
91
91
|
(0, locales_1.setLocale)(locale);
|
|
92
92
|
}
|
package/lib/locales.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Locale resolution
|
|
2
|
+
* Locale resolution.
|
|
3
3
|
*
|
|
4
|
-
* -
|
|
4
|
+
* - tags accepted in underscore or hyphen form, case-insensitively
|
|
5
5
|
* (`zh_HK`, `zh-HK`, `zh-hk`).
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
6
|
+
* - locale can be changed at runtime via setLocale() without reload.
|
|
7
|
+
* - unsupported / unknown locale never errors — fallback chain
|
|
8
8
|
* exact tag -> same language -> en-US.
|
|
9
|
-
* - zh_HK maps to zh-TW strings
|
|
9
|
+
* - zh_HK maps to zh-TW strings.
|
|
10
10
|
* - ms-MY (my_MY) ships incomplete and falls back to en-US per its _meta.
|
|
11
11
|
*/
|
|
12
12
|
import { type LocaleBundle, type LocaleKey, type LocaleMeta } from './locales.generated';
|
|
@@ -17,7 +17,7 @@ export declare const SUPPORTED_LOCALES: readonly ["en-US", "zh-TW", "zh-CN", "ms
|
|
|
17
17
|
export type SupportedLocale = (typeof SUPPORTED_LOCALES)[number];
|
|
18
18
|
/** Normalize any accepted tag form; returns null when unknown (never throws). */
|
|
19
19
|
export declare function normalizeLocale(tag: string | null | undefined): SupportedLocale | null;
|
|
20
|
-
/** The bundle for a tag with the
|
|
20
|
+
/** The bundle for a tag with the fallback chain applied: exact tag ->
|
|
21
21
|
* same language -> en-US. Unknown tags fall back to en-US silently.
|
|
22
22
|
* Incomplete bundles (ms-MY today) keep their non-empty strings and take the
|
|
23
23
|
* rest from the fallback, so no empty string ever reaches the UI. */
|
|
@@ -32,5 +32,5 @@ export interface LocaleStrings {
|
|
|
32
32
|
export declare function setLocale(tag: string | null | undefined): void;
|
|
33
33
|
export declare function getLocale(): string;
|
|
34
34
|
/** Localized strings for a tag (or the current runtime locale when omitted).
|
|
35
|
-
* Falls back along the
|
|
35
|
+
* Falls back along the fallback chain; never throws for unknown tags. */
|
|
36
36
|
export declare function getLocaleStrings(tag?: string | null): LocaleStrings;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* GENERATED FILE — do not edit by hand.
|
|
3
3
|
* Generated by scripts/generate-locales.js from locales/*.json.
|
|
4
4
|
*
|
|
5
|
-
* Locale coverage
|
|
6
|
-
* serves zh_HK/zh-HK), zh-CN (complete), ms-MY (my_MY —
|
|
5
|
+
* Locale coverage: en-US (complete), zh-TW (complete,
|
|
6
|
+
* serves zh_HK/zh-HK), zh-CN (complete), ms-MY (my_MY — complete,
|
|
7
7
|
* falls back to en-US at runtime until translations are supplied).
|
|
8
8
|
*/
|
|
9
9
|
export interface LocaleMeta {
|
package/lib/locales.generated.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* GENERATED FILE — do not edit by hand.
|
|
5
5
|
* Generated by scripts/generate-locales.js from locales/*.json.
|
|
6
6
|
*
|
|
7
|
-
* Locale coverage
|
|
8
|
-
* serves zh_HK/zh-HK), zh-CN (complete), ms-MY (my_MY —
|
|
7
|
+
* Locale coverage: en-US (complete), zh-TW (complete,
|
|
8
|
+
* serves zh_HK/zh-HK), zh-CN (complete), ms-MY (my_MY — complete,
|
|
9
9
|
* falls back to en-US at runtime until translations are supplied).
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -43,33 +43,33 @@ exports.LOCALE_BUNDLES = {
|
|
|
43
43
|
},
|
|
44
44
|
"ms-MY": {
|
|
45
45
|
"_meta": {
|
|
46
|
-
"name": "
|
|
46
|
+
"name": "Bahasa Melayu",
|
|
47
47
|
"canonical": "ms-MY",
|
|
48
48
|
"fallback": "en-US",
|
|
49
|
-
"complete":
|
|
49
|
+
"complete": true
|
|
50
50
|
},
|
|
51
|
-
"threeds.title": "",
|
|
52
|
-
"threeds.cancel": "",
|
|
53
|
-
"threeds.close": "",
|
|
54
|
-
"threeds.processing": "",
|
|
55
|
-
"threeds.redirecting": "",
|
|
56
|
-
"payment.processing": "",
|
|
57
|
-
"result.cancelled": "",
|
|
58
|
-
"error.generic": "",
|
|
59
|
-
"error.rate_limited": "",
|
|
60
|
-
"error.processing_timeout": "",
|
|
61
|
-
"error.sdk_load_failed": "",
|
|
62
|
-
"error.invalid_publishable_key": "",
|
|
63
|
-
"error.invalid_client_token": "",
|
|
64
|
-
"error.origin_not_allowed": "",
|
|
65
|
-
"error.font_load_failed": "",
|
|
66
|
-
"field.incomplete_number": "",
|
|
67
|
-
"field.invalid_number": "",
|
|
68
|
-
"field.incomplete_expiry": "",
|
|
69
|
-
"field.invalid_expiry": "",
|
|
70
|
-
"field.incomplete_cvc": "",
|
|
71
|
-
"field.invalid_cvc": "",
|
|
72
|
-
"field.unsupported_brand": ""
|
|
51
|
+
"threeds.title": "Pengesahan Selamat",
|
|
52
|
+
"threeds.cancel": "Batal",
|
|
53
|
+
"threeds.close": "Tutup",
|
|
54
|
+
"threeds.processing": "Memproses, sila tunggu...",
|
|
55
|
+
"threeds.redirecting": "Mengalihkan...",
|
|
56
|
+
"payment.processing": "Pembayaran sedang diproses...",
|
|
57
|
+
"result.cancelled": "Pembayaran dibatalkan",
|
|
58
|
+
"error.generic": "Pembayaran gagal, sila cuba lagi atau gunakan kad lain.",
|
|
59
|
+
"error.rate_limited": "Terlalu banyak percubaan, sila tunggu sebentar dan cuba lagi.",
|
|
60
|
+
"error.processing_timeout": "Pembayaran anda masih diproses. Kami akan mengesahkan keputusan tidak lama lagi.",
|
|
61
|
+
"error.sdk_load_failed": "Komponen pembayaran gagal dimuatkan, sila muat semula halaman.",
|
|
62
|
+
"error.invalid_publishable_key": "Konfigurasi peniaga tidak sah.",
|
|
63
|
+
"error.invalid_client_token": "Sesi pembayaran telah tamat. Sila cuba lagi.",
|
|
64
|
+
"error.origin_not_allowed": "Laman web ini tidak dibenarkan menggunakan komponen pembayaran.",
|
|
65
|
+
"error.font_load_failed": "Fon gagal dimuatkan, fon sistem digunakan sebagai gantian.",
|
|
66
|
+
"field.incomplete_number": "Masukkan nombor kad penuh anda",
|
|
67
|
+
"field.invalid_number": "Semak nombor kad anda",
|
|
68
|
+
"field.incomplete_expiry": "Masukkan tarikh luput penuh",
|
|
69
|
+
"field.invalid_expiry": "Semak tarikh luput",
|
|
70
|
+
"field.incomplete_cvc": "Masukkan kod keselamatan",
|
|
71
|
+
"field.invalid_cvc": "Semak kod keselamatan",
|
|
72
|
+
"field.unsupported_brand": "Jenis kad ini tidak diterima"
|
|
73
73
|
},
|
|
74
74
|
"zh-CN": {
|
|
75
75
|
"_meta": {
|
package/lib/locales.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Locale resolution
|
|
3
|
+
* Locale resolution.
|
|
4
4
|
*
|
|
5
|
-
* -
|
|
5
|
+
* - tags accepted in underscore or hyphen form, case-insensitively
|
|
6
6
|
* (`zh_HK`, `zh-HK`, `zh-hk`).
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
7
|
+
* - locale can be changed at runtime via setLocale() without reload.
|
|
8
|
+
* - unsupported / unknown locale never errors — fallback chain
|
|
9
9
|
* exact tag -> same language -> en-US.
|
|
10
|
-
* - zh_HK maps to zh-TW strings
|
|
10
|
+
* - zh_HK maps to zh-TW strings.
|
|
11
11
|
* - ms-MY (my_MY) ships incomplete and falls back to en-US per its _meta.
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -28,12 +28,12 @@ const ALIASES = {
|
|
|
28
28
|
'en-hk': 'en-US',
|
|
29
29
|
'zh': 'zh-TW',
|
|
30
30
|
'zh-tw': 'zh-TW',
|
|
31
|
-
'zh-hk': 'zh-TW', //
|
|
31
|
+
'zh-hk': 'zh-TW', // zh_HK maps to the zh-TW strings
|
|
32
32
|
'zh-cn': 'zh-CN',
|
|
33
33
|
'zh-hans': 'zh-CN',
|
|
34
34
|
'ms': 'ms-MY',
|
|
35
35
|
'ms-my': 'ms-MY',
|
|
36
|
-
'my-my': 'ms-MY', //
|
|
36
|
+
'my-my': 'ms-MY', // Malay tag
|
|
37
37
|
};
|
|
38
38
|
/** Normalize any accepted tag form; returns null when unknown (never throws). */
|
|
39
39
|
function normalizeLocale(tag) {
|
|
@@ -47,7 +47,7 @@ function normalizeLocale(tag) {
|
|
|
47
47
|
}
|
|
48
48
|
return ALIASES[norm] || null;
|
|
49
49
|
}
|
|
50
|
-
/** The bundle for a tag with the
|
|
50
|
+
/** The bundle for a tag with the fallback chain applied: exact tag ->
|
|
51
51
|
* same language -> en-US. Unknown tags fall back to en-US silently.
|
|
52
52
|
* Incomplete bundles (ms-MY today) keep their non-empty strings and take the
|
|
53
53
|
* rest from the fallback, so no empty string ever reaches the UI. */
|
|
@@ -73,7 +73,7 @@ function resolveBundle(tag) {
|
|
|
73
73
|
}
|
|
74
74
|
return { locale: exact, bundle: merged };
|
|
75
75
|
}
|
|
76
|
-
/** Runtime locale for user messages. Changed via setLocale()
|
|
76
|
+
/** Runtime locale for user messages. Changed via setLocale(). */
|
|
77
77
|
let currentLocale = exports.DEFAULT_LOCALE;
|
|
78
78
|
function setLocale(tag) {
|
|
79
79
|
currentLocale = normalizeLocale(tag) ? String(tag) : tag || exports.DEFAULT_LOCALE;
|
|
@@ -82,7 +82,7 @@ function getLocale() {
|
|
|
82
82
|
return currentLocale;
|
|
83
83
|
}
|
|
84
84
|
/** Localized strings for a tag (or the current runtime locale when omitted).
|
|
85
|
-
* Falls back along the
|
|
85
|
+
* Falls back along the fallback chain; never throws for unknown tags. */
|
|
86
86
|
function getLocaleStrings(tag) {
|
|
87
87
|
const effective = tag == null ? currentLocale : tag;
|
|
88
88
|
const { locale, bundle } = resolveBundle(effective);
|
package/lib/poll.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AppState-aware polling
|
|
2
|
+
* AppState-aware polling.
|
|
3
3
|
*
|
|
4
|
-
* Schedule: 2s x 15, then 5s x 12
|
|
4
|
+
* Schedule: 2s x 15, then 5s x 12. While the app is
|
|
5
5
|
* backgrounded (user switched to a banking app during 3DS, screen off, etc.)
|
|
6
6
|
* the poll timer is suspended and suspended time does NOT consume the
|
|
7
7
|
* budget — the budget is a number of polls, not wall-clock time. On return
|
|
8
8
|
* to the foreground polling resumes where it stopped.
|
|
9
9
|
*
|
|
10
10
|
* On budget exhaustion the poller resolves undefined and the caller maps
|
|
11
|
-
* that to `processing` — never `failed
|
|
11
|
+
* that to `processing` — never `failed`.
|
|
12
12
|
*/
|
|
13
13
|
export interface PollerOptions {
|
|
14
14
|
fastIntervalMs?: number;
|
package/lib/poll.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* AppState-aware polling
|
|
3
|
+
* AppState-aware polling.
|
|
4
4
|
*
|
|
5
|
-
* Schedule: 2s x 15, then 5s x 12
|
|
5
|
+
* Schedule: 2s x 15, then 5s x 12. While the app is
|
|
6
6
|
* backgrounded (user switched to a banking app during 3DS, screen off, etc.)
|
|
7
7
|
* the poll timer is suspended and suspended time does NOT consume the
|
|
8
8
|
* budget — the budget is a number of polls, not wall-clock time. On return
|
|
9
9
|
* to the foreground polling resumes where it stopped.
|
|
10
10
|
*
|
|
11
11
|
* On budget exhaustion the poller resolves undefined and the caller maps
|
|
12
|
-
* that to `processing` — never `failed
|
|
12
|
+
* that to `processing` — never `failed`.
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.AppStateAwarePoller = exports.DEFAULT_POLLER_OPTIONS = void 0;
|
|
@@ -137,7 +137,7 @@ class AppStateAwarePoller {
|
|
|
137
137
|
}
|
|
138
138
|
catch {
|
|
139
139
|
// A failed poll (e.g. a network blip) is not terminal — keep going
|
|
140
|
-
// within the budget; exhaustion maps to `processing
|
|
140
|
+
// within the budget; exhaustion maps to `processing`.
|
|
141
141
|
outcome = { done: false };
|
|
142
142
|
}
|
|
143
143
|
this.inFlight = false;
|
package/lib/threeDs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 3DS challenge presentation bridge
|
|
2
|
+
* 3DS challenge presentation bridge.
|
|
3
3
|
*
|
|
4
4
|
* Primary path: the SDK's own native modules
|
|
5
5
|
* - iOS: PaSdk3ds (Swift WKWebView view controller, see native/ios)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* (PaSdk3dsHost, backed by react-native-webview) can register itself here
|
|
16
16
|
* via setThreeDsPresenter().
|
|
17
17
|
*/
|
|
18
|
-
/** Strings the native chrome needs, already resolved for the runtime locale
|
|
18
|
+
/** Strings the native chrome needs, already resolved for the runtime locale. */
|
|
19
19
|
export interface ThreeDsStrings {
|
|
20
20
|
title: string;
|
|
21
21
|
cancel: string;
|
|
@@ -31,15 +31,15 @@ export interface ThreeDsParams {
|
|
|
31
31
|
[name: string]: string;
|
|
32
32
|
};
|
|
33
33
|
strings: ThreeDsStrings;
|
|
34
|
-
/** 3DS return URLs
|
|
34
|
+
/** 3DS return URLs — consumed by the SDK, not the app's handler. */
|
|
35
35
|
returnUrlScheme?: string;
|
|
36
36
|
returnUrlUniversalHost?: string;
|
|
37
37
|
}
|
|
38
38
|
export interface ThreeDsDismissal {
|
|
39
39
|
/** true when the user closed the challenge themselves -> result `cancelled`. */
|
|
40
40
|
cancelled: boolean;
|
|
41
|
-
/** Android only: the challenge returned via
|
|
42
|
-
* the SDK consumed the return
|
|
41
|
+
/** Android only: the challenge returned via the configured return scheme /
|
|
42
|
+
* universal link and the SDK consumed the return. */
|
|
43
43
|
returnUrlConsumed?: boolean;
|
|
44
44
|
}
|
|
45
45
|
export type ThreeDsPresenter = (params: ThreeDsParams) => Promise<ThreeDsDismissal>;
|
|
@@ -49,7 +49,7 @@ export declare function setThreeDsPresenter(presenter: ThreeDsPresenter | null):
|
|
|
49
49
|
export declare function canPresentThreeDs(): boolean;
|
|
50
50
|
/**
|
|
51
51
|
* Present the challenge. Fires `onWillPresent` immediately before the
|
|
52
|
-
* challenge appears (
|
|
52
|
+
* challenge appears (the app dismisses its loading overlay then).
|
|
53
53
|
* Resolves when the challenge is dismissed by the user (cancelled: true)
|
|
54
54
|
* or by closeThreeDs() after the server-side outcome was observed.
|
|
55
55
|
*/
|
package/lib/threeDs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* 3DS challenge presentation bridge
|
|
3
|
+
* 3DS challenge presentation bridge.
|
|
4
4
|
*
|
|
5
5
|
* Primary path: the SDK's own native modules
|
|
6
6
|
* - iOS: PaSdk3ds (Swift WKWebView view controller, see native/ios)
|
|
@@ -35,7 +35,7 @@ function canPresentThreeDs() {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Present the challenge. Fires `onWillPresent` immediately before the
|
|
38
|
-
* challenge appears (
|
|
38
|
+
* challenge appears (the app dismisses its loading overlay then).
|
|
39
39
|
* Resolves when the challenge is dismissed by the user (cancelled: true)
|
|
40
40
|
* or by closeThreeDs() after the server-side outcome was observed.
|
|
41
41
|
*/
|
package/lib/threeDsHost.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PaSdk3dsHost — pure-JS fallback for the SDK-presented 3DS challenge
|
|
3
|
-
*
|
|
2
|
+
* PaSdk3dsHost — pure-JS fallback for the SDK-presented 3DS challenge.
|
|
3
|
+
* Used only when the native module (native/ios, native/android) is
|
|
4
4
|
* not installed. Renders a full-screen Modal with a react-native-webview
|
|
5
5
|
* that POSTs the challenge payload to the challenge URL, mirroring the
|
|
6
6
|
* native presentation: cancel button, localized chrome, no swipe-to-dismiss.
|
package/lib/threeDsHost.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* PaSdk3dsHost — pure-JS fallback for the SDK-presented 3DS challenge
|
|
4
|
-
*
|
|
3
|
+
* PaSdk3dsHost — pure-JS fallback for the SDK-presented 3DS challenge.
|
|
4
|
+
* Used only when the native module (native/ios, native/android) is
|
|
5
5
|
* not installed. Renders a full-screen Modal with a react-native-webview
|
|
6
6
|
* that POSTs the challenge payload to the challenge URL, mirroring the
|
|
7
7
|
* native presentation: cancel button, localized chrome, no swipe-to-dismiss.
|
|
@@ -118,7 +118,7 @@ function PaSdk3dsHost() {
|
|
|
118
118
|
react_1.default.createElement(react_native_1.Text, { style: styles.cancelText }, strings.cancel))),
|
|
119
119
|
react_1.default.createElement(react_native_1.View, { style: styles.webContainer },
|
|
120
120
|
react_1.default.createElement(react_native_webview_1.WebView, { source: { html: buildPostHtml(challenge.params) }, originWhitelist: ['*'], javaScriptEnabled: true, domStorageEnabled: true, onLoadStart: () => setLoading(true), onLoadEnd: () => setLoading(false), onNavigationStateChange: (state) => {
|
|
121
|
-
//
|
|
121
|
+
// a navigation to the configured 3DS return URLs is the
|
|
122
122
|
// challenge ending — consume it here so the app's link handler
|
|
123
123
|
// never sees it, and let polling observe the server-side result.
|
|
124
124
|
const scheme = challenge.params.returnUrlScheme;
|
package/lib/tokenize.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Direct tokenization
|
|
2
|
+
* Direct tokenization.
|
|
3
3
|
*
|
|
4
|
-
* Card data goes from
|
|
5
|
-
* touches
|
|
4
|
+
* Card data goes from the app's UI through the SDK straight to PA and never
|
|
5
|
+
* touches your servers. Two calls:
|
|
6
6
|
* 1. createElementSession — POST /{merchantToken}/element-sessions
|
|
7
7
|
* 2. tokenizeCard — POST /tokenize
|
|
8
8
|
*/
|
|
9
9
|
import type { ApiClient } from './api';
|
|
10
10
|
import type { CardInput, TokenizeOutput } from './types';
|
|
11
11
|
/** Create a short-lived public session. `merchantToken` is the publishable
|
|
12
|
-
* credential of the (market-specific) merchant account
|
|
12
|
+
* credential of the (market-specific) merchant account. */
|
|
13
13
|
export declare function createElementSession(api: ApiClient, merchantToken: string): Promise<string>;
|
|
14
14
|
/** Tokenize a card. Creates the element session automatically when the
|
|
15
15
|
* caller does not already hold one. */
|