@paydock/client-sdk 1.120.1 → 1.121.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/README.md +173 -32
- package/bundles/index.cjs +633 -352
- package/bundles/index.cjs.d.ts +89 -31
- package/bundles/index.mjs +633 -352
- package/bundles/index.mjs.d.ts +89 -31
- package/bundles/types/api/api-base.d.ts +6 -6
- package/bundles/types/api/api-base.d.ts.map +1 -1
- package/bundles/types/api/api-checkout-internal.d.ts +2 -2
- package/bundles/types/api/api-checkout-internal.d.ts.map +1 -1
- package/bundles/types/api/api.d.ts +9 -9
- package/bundles/types/api/api.d.ts.map +1 -1
- package/bundles/types/checkout/checkout.d.ts +26 -7
- package/bundles/types/checkout/checkout.d.ts.map +1 -1
- package/bundles/types/checkout/helpers/instruction-handler.d.ts +6 -4
- package/bundles/types/checkout/helpers/instruction-handler.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.apple_pay_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.canvas_3ds.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.disable_payment_method_event.emit.d.ts +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.disable_payment_method_event.emit.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.google_pay_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.merchant_event.emit.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.paypal_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/additionals.d.ts +1 -1
- package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts +2 -1
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +1 -1
- package/bundles/types/components/iframe-event.d.ts +3 -8
- package/bundles/types/components/iframe-event.d.ts.map +1 -1
- package/bundles/types/components/param.d.ts +7 -0
- package/bundles/types/components/param.d.ts.map +1 -1
- package/bundles/types/helper/event-error.d.ts +55 -0
- package/bundles/types/helper/event-error.d.ts.map +1 -0
- package/bundles/types/helper/process-event-error.d.ts +9 -0
- package/bundles/types/helper/process-event-error.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/index.d.ts +6 -1
- package/bundles/types/wallet-buttons/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts +2 -0
- package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts +2 -2
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts +2 -0
- package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/index.d.ts +5 -0
- package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts +2 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts +1 -3
- package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/widget/configuration.d.ts.map +1 -1
- package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
- package/bundles/types/widget/multi-widget.d.ts +11 -3
- package/bundles/types/widget/multi-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +633 -352
- package/bundles/widget.umd.js.d.ts +89 -31
- package/bundles/widget.umd.js.min.d.ts +89 -31
- package/bundles/widget.umd.min.js +1 -1
- package/docs/api-widget.md +38 -0
- package/docs/api-wrapper.md +3 -36
- package/docs/wallet-buttons-examples.md +4 -2
- package/docs/wallet-buttons-express.md +8 -1
- package/docs/wallet-buttons.md +3 -1
- package/docs/widget-examples.md +120 -28
- package/package.json +2 -2
- package/slate.md +124 -30
- package/bundles/types/helper/custom-error.d.ts +0 -8
- package/bundles/types/helper/custom-error.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/helpers/apple-pay.helper.d.ts +0 -3
- package/bundles/types/wallet-buttons/helpers/apple-pay.helper.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Observable
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
2
|
import { MicroAgent } from '@newrelic/browser-agent/loaders/micro-agent';
|
|
3
3
|
|
|
4
4
|
declare class ApiCharge {
|
|
@@ -117,7 +117,6 @@ declare class ApiBase {
|
|
|
117
117
|
protected env: Env;
|
|
118
118
|
auth: string;
|
|
119
119
|
authType: API_AUTH_TYPE;
|
|
120
|
-
private stoppedPooling;
|
|
121
120
|
constructor(auth: string, authType?: API_AUTH_TYPE);
|
|
122
121
|
/**
|
|
123
122
|
* Current method can change environment. By default environment = sandbox.
|
|
@@ -129,9 +128,10 @@ declare class ApiBase {
|
|
|
129
128
|
* @param {string} [alias] - Own domain alias
|
|
130
129
|
*/
|
|
131
130
|
setEnv(env: string, alias?: string): ApiBase;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
requestObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req): Observable<Res>;
|
|
132
|
+
private makeRequest;
|
|
133
|
+
private onRequestLoad;
|
|
134
|
+
private onRequestError;
|
|
135
135
|
setAuthType(): API_AUTH_TYPE;
|
|
136
136
|
getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
137
137
|
config: XMLHttpRequest;
|
|
@@ -145,7 +145,7 @@ declare class ApiBase {
|
|
|
145
145
|
text: string;
|
|
146
146
|
status: number;
|
|
147
147
|
}, cb: any, errorCb: any): any;
|
|
148
|
-
parserPromise<Res>({ text, status }: {
|
|
148
|
+
parserPromise<Res>({ text, status, }: {
|
|
149
149
|
text: string;
|
|
150
150
|
status: number;
|
|
151
151
|
}): Promise<Res>;
|
|
@@ -159,15 +159,6 @@ declare class ApiBase {
|
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
interface BrowserDetails {
|
|
163
|
-
name: string;
|
|
164
|
-
java_enabled: string;
|
|
165
|
-
language: string;
|
|
166
|
-
screen_height: string;
|
|
167
|
-
screen_width: string;
|
|
168
|
-
time_zone: string;
|
|
169
|
-
color_depth: string;
|
|
170
|
-
}
|
|
171
162
|
/**
|
|
172
163
|
* Interface for browser details response.
|
|
173
164
|
* @interface BrowserDetails
|
|
@@ -180,6 +171,15 @@ interface BrowserDetails {
|
|
|
180
171
|
* @param {string} [time_zone]
|
|
181
172
|
* @param {string} [color_depth]
|
|
182
173
|
* */
|
|
174
|
+
interface BrowserDetails {
|
|
175
|
+
name: string;
|
|
176
|
+
java_enabled: string;
|
|
177
|
+
language: string;
|
|
178
|
+
screen_height: string;
|
|
179
|
+
screen_width: string;
|
|
180
|
+
time_zone: string;
|
|
181
|
+
color_depth: string;
|
|
182
|
+
}
|
|
183
183
|
/**
|
|
184
184
|
* Class Api include method for working with paydock api
|
|
185
185
|
* @constructor
|
|
@@ -453,6 +453,7 @@ interface IParams extends IStyles$1, ITexts, ICommonParams {
|
|
|
453
453
|
language?: string;
|
|
454
454
|
vault_display_token?: string;
|
|
455
455
|
sdk_origin?: boolean;
|
|
456
|
+
hide_ui_errors?: boolean;
|
|
456
457
|
}
|
|
457
458
|
interface ICountryPhoneMask {
|
|
458
459
|
preferred_countries?: string[];
|
|
@@ -591,6 +592,7 @@ declare enum WALLET_TYPE {
|
|
|
591
592
|
}
|
|
592
593
|
interface ApplePayStyles {
|
|
593
594
|
button_type?: 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'plain' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up';
|
|
595
|
+
button_style?: 'black' | 'white' | 'white-outline';
|
|
594
596
|
}
|
|
595
597
|
interface GooglePayStyles {
|
|
596
598
|
button_type?: 'book' | 'buy' | 'checkout' | 'donate' | 'order' | 'pay' | 'plain' | 'subscribe';
|
|
@@ -631,6 +633,7 @@ interface IWalletMeta {
|
|
|
631
633
|
style?: WalletStyles;
|
|
632
634
|
wallets?: WALLET_TYPE[];
|
|
633
635
|
client_id?: string;
|
|
636
|
+
apple_pay_capabilities?: Array<'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable'>;
|
|
634
637
|
}
|
|
635
638
|
|
|
636
639
|
declare class Link {
|
|
@@ -940,6 +943,45 @@ interface IElementStyleTitleDescription {
|
|
|
940
943
|
margin?: string;
|
|
941
944
|
}
|
|
942
945
|
|
|
946
|
+
declare const ERROR_CATEGORY: {
|
|
947
|
+
readonly CONFIGURATION: "configuration";
|
|
948
|
+
readonly IDENTITY: "identity_access_management";
|
|
949
|
+
readonly INTERNAL: "internal";
|
|
950
|
+
readonly PROCESS: "process";
|
|
951
|
+
readonly RESOURCE: "resource";
|
|
952
|
+
readonly VALIDATION: "validation";
|
|
953
|
+
};
|
|
954
|
+
type ErrorCategory = (typeof ERROR_CATEGORY)[keyof typeof ERROR_CATEGORY];
|
|
955
|
+
declare const ERROR_CAUSE: {
|
|
956
|
+
readonly ABORTED: "aborted";
|
|
957
|
+
readonly ACCESS_FORBIDDEN: "access_forbidden";
|
|
958
|
+
readonly ALREADY_EXISTS: "already_exists";
|
|
959
|
+
readonly CANCELED: "canceled";
|
|
960
|
+
readonly INVALID_CONFIGURATION: "invalid_configuration";
|
|
961
|
+
readonly INVALID_INPUT: "invalid_input";
|
|
962
|
+
readonly NOT_FOUND: "not_found";
|
|
963
|
+
readonly NOT_IMPLEMENTED: "not_implemented";
|
|
964
|
+
readonly RATE_LIMITED: "rate_limited";
|
|
965
|
+
readonly SERVER_BUSY: "server_busy";
|
|
966
|
+
readonly SERVICE_UNREACHABLE: "service_unreachable";
|
|
967
|
+
readonly UNAUTHORIZED: "unauthorized";
|
|
968
|
+
readonly UNKNOWN: "unknown_error";
|
|
969
|
+
readonly UNPROCESSABLE_ENTITY: "unprocessable_entity";
|
|
970
|
+
};
|
|
971
|
+
type ErrorCause = (typeof ERROR_CAUSE)[keyof typeof ERROR_CAUSE];
|
|
972
|
+
interface ErrorDetails {
|
|
973
|
+
cause: ErrorCause;
|
|
974
|
+
contextId: string;
|
|
975
|
+
message: string;
|
|
976
|
+
timestamp: string;
|
|
977
|
+
}
|
|
978
|
+
interface IEventError {
|
|
979
|
+
cause: ErrorCause;
|
|
980
|
+
category: ErrorCategory;
|
|
981
|
+
retryable: boolean;
|
|
982
|
+
details: ErrorDetails;
|
|
983
|
+
}
|
|
984
|
+
|
|
943
985
|
/**
|
|
944
986
|
*
|
|
945
987
|
* Class MultiWidget include method for for creating iframe url
|
|
@@ -1133,6 +1175,13 @@ declare class MultiWidget {
|
|
|
1133
1175
|
* @param {boolean} validateCardNumberInput - [validateCardNumberInput=false] - using this param you allow validation for card number input on supported card types
|
|
1134
1176
|
*/
|
|
1135
1177
|
setSupportedCardIcons(elements: string[], validateCardNumberInput?: boolean): void;
|
|
1178
|
+
/**
|
|
1179
|
+
* Current method can hide prevent the widget from showing the error messages
|
|
1180
|
+
*
|
|
1181
|
+
* @example
|
|
1182
|
+
* widget.hideUiErrors('id');
|
|
1183
|
+
*/
|
|
1184
|
+
hideUiErrors(): void;
|
|
1136
1185
|
/**
|
|
1137
1186
|
* Current method can change environment. By default environment = sandbox.
|
|
1138
1187
|
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
@@ -1164,7 +1213,7 @@ declare class MultiWidget {
|
|
|
1164
1213
|
*/
|
|
1165
1214
|
setLanguage(code: any): void;
|
|
1166
1215
|
getLink(): Link;
|
|
1167
|
-
protected handleErrorEvent(
|
|
1216
|
+
protected handleErrorEvent(event: EventTypes, error: IEventError, purpose: PURPOSE): void;
|
|
1168
1217
|
}
|
|
1169
1218
|
|
|
1170
1219
|
interface ITriggerData {
|
|
@@ -1660,6 +1709,7 @@ interface IEventData$1 {
|
|
|
1660
1709
|
widget_id: string;
|
|
1661
1710
|
data?: any;
|
|
1662
1711
|
ref_id?: string;
|
|
1712
|
+
error?: IEventError;
|
|
1663
1713
|
}
|
|
1664
1714
|
declare const EVENT$1: {
|
|
1665
1715
|
readonly AFTER_LOAD: "afterLoad";
|
|
@@ -1694,13 +1744,6 @@ declare const EVENT$1: {
|
|
|
1694
1744
|
readonly DISPATCH_ERROR: "dispatchError";
|
|
1695
1745
|
};
|
|
1696
1746
|
type EventTypes = typeof EVENT$1[keyof typeof EVENT$1];
|
|
1697
|
-
interface IErrorEvent {
|
|
1698
|
-
event: EventTypes;
|
|
1699
|
-
status?: number;
|
|
1700
|
-
data: {
|
|
1701
|
-
_message: string;
|
|
1702
|
-
} & Record<string, any>;
|
|
1703
|
-
}
|
|
1704
1747
|
interface Listener {
|
|
1705
1748
|
event: string;
|
|
1706
1749
|
listener: (event: any) => void;
|
|
@@ -2732,7 +2775,7 @@ interface GetConfigResponse {
|
|
|
2732
2775
|
declare class ApiCheckoutInternal {
|
|
2733
2776
|
protected api: ApiInternal;
|
|
2734
2777
|
constructor(api: ApiInternal);
|
|
2735
|
-
instructions(
|
|
2778
|
+
instructions(): Observable<object>;
|
|
2736
2779
|
private getInstructionLink;
|
|
2737
2780
|
callback(payload: Object): Promise<Object>;
|
|
2738
2781
|
status(id: string): Promise<Object>;
|
|
@@ -3347,7 +3390,7 @@ declare class WalletButtons {
|
|
|
3347
3390
|
private setupAuthTokensChangedCallback;
|
|
3348
3391
|
}
|
|
3349
3392
|
|
|
3350
|
-
type Instruction = new (selector: string, formSelector: string, api: ApiInternal) => InstructionHandler & InstructionDestroyable & InstructionDecorated;
|
|
3393
|
+
type Instruction = new (selector: string, formSelector: string, api: ApiInternal, checkoutWidget: Checkout) => InstructionHandler & InstructionDestroyable & InstructionDecorated;
|
|
3351
3394
|
interface InstructionHandleable {
|
|
3352
3395
|
handle(payload: object, eventEmitter: EventEmitter): void;
|
|
3353
3396
|
}
|
|
@@ -3361,7 +3404,8 @@ declare abstract class InstructionHandler implements InstructionHandleable, Inst
|
|
|
3361
3404
|
selector: string;
|
|
3362
3405
|
formSelector: string;
|
|
3363
3406
|
api: ApiInternal;
|
|
3364
|
-
|
|
3407
|
+
protected checkoutWidget?: Checkout;
|
|
3408
|
+
constructor(selector: string, formSelector: string, api: ApiInternal, checkoutWidget?: Checkout);
|
|
3365
3409
|
instruction: string;
|
|
3366
3410
|
abstract handle(context: object, eventEmitter?: any): void;
|
|
3367
3411
|
abstract destroy(): void;
|
|
@@ -3379,9 +3423,6 @@ interface IntentTokenPayload {
|
|
|
3379
3423
|
version: number;
|
|
3380
3424
|
env_alias: string;
|
|
3381
3425
|
}
|
|
3382
|
-
declare class InstructionDebugger {
|
|
3383
|
-
constructor(selector: string, formSelector: string, version: number, instructionName: string, context: object, token?: string);
|
|
3384
|
-
}
|
|
3385
3426
|
/**
|
|
3386
3427
|
* Class CheckoutButton transform usual button into checkout
|
|
3387
3428
|
*
|
|
@@ -3401,15 +3442,26 @@ declare class Checkout {
|
|
|
3401
3442
|
protected container: Container;
|
|
3402
3443
|
protected intentTokenPayload: IntentTokenPayload;
|
|
3403
3444
|
protected api: ApiInternal;
|
|
3445
|
+
protected checkoutApi: ApiCheckoutInternal;
|
|
3404
3446
|
protected instructions: InstructionModule;
|
|
3405
3447
|
protected currentInstruction: InstructionDestroyable & InstructionHandleable;
|
|
3448
|
+
private timeoutTimer;
|
|
3449
|
+
private requestInFlight;
|
|
3450
|
+
private inTimeoutRange;
|
|
3451
|
+
private checkoutFinished;
|
|
3406
3452
|
constructor(formSelector: string, intentToken: string, debug?: boolean);
|
|
3453
|
+
fetchInstruction(): void;
|
|
3454
|
+
finaliseCheckout(): void;
|
|
3455
|
+
private setupTimeoutTimer;
|
|
3407
3456
|
private extractIntentTokenPayload;
|
|
3408
3457
|
private ready;
|
|
3409
3458
|
private initContractVersion;
|
|
3410
|
-
private
|
|
3459
|
+
private isTimeoutInstruction;
|
|
3460
|
+
private handleInstruction;
|
|
3461
|
+
private handleTimeoutInstructions;
|
|
3462
|
+
private getInstructionFromResponse;
|
|
3463
|
+
private extractInstructionPayloadFromResponse;
|
|
3411
3464
|
private setEnv;
|
|
3412
|
-
private createWidgetStructure;
|
|
3413
3465
|
/**
|
|
3414
3466
|
* If the payment was successful, the function passed as parameter will be called.
|
|
3415
3467
|
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
@@ -3440,8 +3492,12 @@ declare class Checkout {
|
|
|
3440
3492
|
* });
|
|
3441
3493
|
*/
|
|
3442
3494
|
onPaymentExpired(handler: (data: IEventData$1) => void): () => void;
|
|
3495
|
+
createWidgetStructure(): void;
|
|
3443
3496
|
private setStyles;
|
|
3444
3497
|
}
|
|
3498
|
+
declare class InstructionDebugger {
|
|
3499
|
+
constructor(selector: string, formSelector: string, version: number, instructionName: string, context: object, token?: string);
|
|
3500
|
+
}
|
|
3445
3501
|
|
|
3446
3502
|
declare enum EVENT {
|
|
3447
3503
|
UNAVAILABLE = "unavailable",
|
|
@@ -3721,6 +3777,7 @@ interface ApplePayWalletMeta extends BaseWalletMeta {
|
|
|
3721
3777
|
supported_networks?: Array<'visa' | 'masterCard' | 'amex' | 'chinaUnionPay' | 'discover' | 'interac' | 'jcb' | 'privateLabel'>;
|
|
3722
3778
|
required_billing_contact_fields?: Array<'email' | 'name' | 'phone' | 'postalAddress'>;
|
|
3723
3779
|
required_shipping_contact_fields?: Array<'email' | 'phone'>;
|
|
3780
|
+
apple_pay_capabilities?: Array<'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable'>;
|
|
3724
3781
|
supported_countries?: string[];
|
|
3725
3782
|
style?: {
|
|
3726
3783
|
button_type?: ApplePayButtonType;
|
|
@@ -3772,6 +3829,7 @@ declare class ApplePayWalletButtonExpress extends BaseWalletButton<ApplePayWalle
|
|
|
3772
3829
|
private onValidateMerchant;
|
|
3773
3830
|
private getMerchantSession;
|
|
3774
3831
|
private onPaymentAuthorized;
|
|
3832
|
+
private formatCapabilities;
|
|
3775
3833
|
private onCancelPayment;
|
|
3776
3834
|
}
|
|
3777
3835
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Observable
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
2
|
import { MicroAgent } from '@newrelic/browser-agent/loaders/micro-agent';
|
|
3
3
|
|
|
4
4
|
declare class ApiCharge {
|
|
@@ -117,7 +117,6 @@ declare class ApiBase {
|
|
|
117
117
|
protected env: Env;
|
|
118
118
|
auth: string;
|
|
119
119
|
authType: API_AUTH_TYPE;
|
|
120
|
-
private stoppedPooling;
|
|
121
120
|
constructor(auth: string, authType?: API_AUTH_TYPE);
|
|
122
121
|
/**
|
|
123
122
|
* Current method can change environment. By default environment = sandbox.
|
|
@@ -129,9 +128,10 @@ declare class ApiBase {
|
|
|
129
128
|
* @param {string} [alias] - Own domain alias
|
|
130
129
|
*/
|
|
131
130
|
setEnv(env: string, alias?: string): ApiBase;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
requestObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req): Observable<Res>;
|
|
132
|
+
private makeRequest;
|
|
133
|
+
private onRequestLoad;
|
|
134
|
+
private onRequestError;
|
|
135
135
|
setAuthType(): API_AUTH_TYPE;
|
|
136
136
|
getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
137
137
|
config: XMLHttpRequest;
|
|
@@ -145,7 +145,7 @@ declare class ApiBase {
|
|
|
145
145
|
text: string;
|
|
146
146
|
status: number;
|
|
147
147
|
}, cb: any, errorCb: any): any;
|
|
148
|
-
parserPromise<Res>({ text, status }: {
|
|
148
|
+
parserPromise<Res>({ text, status, }: {
|
|
149
149
|
text: string;
|
|
150
150
|
status: number;
|
|
151
151
|
}): Promise<Res>;
|
|
@@ -159,15 +159,6 @@ declare class ApiBase {
|
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
interface BrowserDetails {
|
|
163
|
-
name: string;
|
|
164
|
-
java_enabled: string;
|
|
165
|
-
language: string;
|
|
166
|
-
screen_height: string;
|
|
167
|
-
screen_width: string;
|
|
168
|
-
time_zone: string;
|
|
169
|
-
color_depth: string;
|
|
170
|
-
}
|
|
171
162
|
/**
|
|
172
163
|
* Interface for browser details response.
|
|
173
164
|
* @interface BrowserDetails
|
|
@@ -180,6 +171,15 @@ interface BrowserDetails {
|
|
|
180
171
|
* @param {string} [time_zone]
|
|
181
172
|
* @param {string} [color_depth]
|
|
182
173
|
* */
|
|
174
|
+
interface BrowserDetails {
|
|
175
|
+
name: string;
|
|
176
|
+
java_enabled: string;
|
|
177
|
+
language: string;
|
|
178
|
+
screen_height: string;
|
|
179
|
+
screen_width: string;
|
|
180
|
+
time_zone: string;
|
|
181
|
+
color_depth: string;
|
|
182
|
+
}
|
|
183
183
|
/**
|
|
184
184
|
* Class Api include method for working with paydock api
|
|
185
185
|
* @constructor
|
|
@@ -453,6 +453,7 @@ interface IParams extends IStyles$1, ITexts, ICommonParams {
|
|
|
453
453
|
language?: string;
|
|
454
454
|
vault_display_token?: string;
|
|
455
455
|
sdk_origin?: boolean;
|
|
456
|
+
hide_ui_errors?: boolean;
|
|
456
457
|
}
|
|
457
458
|
interface ICountryPhoneMask {
|
|
458
459
|
preferred_countries?: string[];
|
|
@@ -591,6 +592,7 @@ declare enum WALLET_TYPE {
|
|
|
591
592
|
}
|
|
592
593
|
interface ApplePayStyles {
|
|
593
594
|
button_type?: 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'plain' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up';
|
|
595
|
+
button_style?: 'black' | 'white' | 'white-outline';
|
|
594
596
|
}
|
|
595
597
|
interface GooglePayStyles {
|
|
596
598
|
button_type?: 'book' | 'buy' | 'checkout' | 'donate' | 'order' | 'pay' | 'plain' | 'subscribe';
|
|
@@ -631,6 +633,7 @@ interface IWalletMeta {
|
|
|
631
633
|
style?: WalletStyles;
|
|
632
634
|
wallets?: WALLET_TYPE[];
|
|
633
635
|
client_id?: string;
|
|
636
|
+
apple_pay_capabilities?: Array<'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable'>;
|
|
634
637
|
}
|
|
635
638
|
|
|
636
639
|
declare class Link {
|
|
@@ -940,6 +943,45 @@ interface IElementStyleTitleDescription {
|
|
|
940
943
|
margin?: string;
|
|
941
944
|
}
|
|
942
945
|
|
|
946
|
+
declare const ERROR_CATEGORY: {
|
|
947
|
+
readonly CONFIGURATION: "configuration";
|
|
948
|
+
readonly IDENTITY: "identity_access_management";
|
|
949
|
+
readonly INTERNAL: "internal";
|
|
950
|
+
readonly PROCESS: "process";
|
|
951
|
+
readonly RESOURCE: "resource";
|
|
952
|
+
readonly VALIDATION: "validation";
|
|
953
|
+
};
|
|
954
|
+
type ErrorCategory = (typeof ERROR_CATEGORY)[keyof typeof ERROR_CATEGORY];
|
|
955
|
+
declare const ERROR_CAUSE: {
|
|
956
|
+
readonly ABORTED: "aborted";
|
|
957
|
+
readonly ACCESS_FORBIDDEN: "access_forbidden";
|
|
958
|
+
readonly ALREADY_EXISTS: "already_exists";
|
|
959
|
+
readonly CANCELED: "canceled";
|
|
960
|
+
readonly INVALID_CONFIGURATION: "invalid_configuration";
|
|
961
|
+
readonly INVALID_INPUT: "invalid_input";
|
|
962
|
+
readonly NOT_FOUND: "not_found";
|
|
963
|
+
readonly NOT_IMPLEMENTED: "not_implemented";
|
|
964
|
+
readonly RATE_LIMITED: "rate_limited";
|
|
965
|
+
readonly SERVER_BUSY: "server_busy";
|
|
966
|
+
readonly SERVICE_UNREACHABLE: "service_unreachable";
|
|
967
|
+
readonly UNAUTHORIZED: "unauthorized";
|
|
968
|
+
readonly UNKNOWN: "unknown_error";
|
|
969
|
+
readonly UNPROCESSABLE_ENTITY: "unprocessable_entity";
|
|
970
|
+
};
|
|
971
|
+
type ErrorCause = (typeof ERROR_CAUSE)[keyof typeof ERROR_CAUSE];
|
|
972
|
+
interface ErrorDetails {
|
|
973
|
+
cause: ErrorCause;
|
|
974
|
+
contextId: string;
|
|
975
|
+
message: string;
|
|
976
|
+
timestamp: string;
|
|
977
|
+
}
|
|
978
|
+
interface IEventError {
|
|
979
|
+
cause: ErrorCause;
|
|
980
|
+
category: ErrorCategory;
|
|
981
|
+
retryable: boolean;
|
|
982
|
+
details: ErrorDetails;
|
|
983
|
+
}
|
|
984
|
+
|
|
943
985
|
/**
|
|
944
986
|
*
|
|
945
987
|
* Class MultiWidget include method for for creating iframe url
|
|
@@ -1133,6 +1175,13 @@ declare class MultiWidget {
|
|
|
1133
1175
|
* @param {boolean} validateCardNumberInput - [validateCardNumberInput=false] - using this param you allow validation for card number input on supported card types
|
|
1134
1176
|
*/
|
|
1135
1177
|
setSupportedCardIcons(elements: string[], validateCardNumberInput?: boolean): void;
|
|
1178
|
+
/**
|
|
1179
|
+
* Current method can hide prevent the widget from showing the error messages
|
|
1180
|
+
*
|
|
1181
|
+
* @example
|
|
1182
|
+
* widget.hideUiErrors('id');
|
|
1183
|
+
*/
|
|
1184
|
+
hideUiErrors(): void;
|
|
1136
1185
|
/**
|
|
1137
1186
|
* Current method can change environment. By default environment = sandbox.
|
|
1138
1187
|
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
@@ -1164,7 +1213,7 @@ declare class MultiWidget {
|
|
|
1164
1213
|
*/
|
|
1165
1214
|
setLanguage(code: any): void;
|
|
1166
1215
|
getLink(): Link;
|
|
1167
|
-
protected handleErrorEvent(
|
|
1216
|
+
protected handleErrorEvent(event: EventTypes, error: IEventError, purpose: PURPOSE): void;
|
|
1168
1217
|
}
|
|
1169
1218
|
|
|
1170
1219
|
interface ITriggerData {
|
|
@@ -1660,6 +1709,7 @@ interface IEventData$1 {
|
|
|
1660
1709
|
widget_id: string;
|
|
1661
1710
|
data?: any;
|
|
1662
1711
|
ref_id?: string;
|
|
1712
|
+
error?: IEventError;
|
|
1663
1713
|
}
|
|
1664
1714
|
declare const EVENT$1: {
|
|
1665
1715
|
readonly AFTER_LOAD: "afterLoad";
|
|
@@ -1694,13 +1744,6 @@ declare const EVENT$1: {
|
|
|
1694
1744
|
readonly DISPATCH_ERROR: "dispatchError";
|
|
1695
1745
|
};
|
|
1696
1746
|
type EventTypes = typeof EVENT$1[keyof typeof EVENT$1];
|
|
1697
|
-
interface IErrorEvent {
|
|
1698
|
-
event: EventTypes;
|
|
1699
|
-
status?: number;
|
|
1700
|
-
data: {
|
|
1701
|
-
_message: string;
|
|
1702
|
-
} & Record<string, any>;
|
|
1703
|
-
}
|
|
1704
1747
|
interface Listener {
|
|
1705
1748
|
event: string;
|
|
1706
1749
|
listener: (event: any) => void;
|
|
@@ -2732,7 +2775,7 @@ interface GetConfigResponse {
|
|
|
2732
2775
|
declare class ApiCheckoutInternal {
|
|
2733
2776
|
protected api: ApiInternal;
|
|
2734
2777
|
constructor(api: ApiInternal);
|
|
2735
|
-
instructions(
|
|
2778
|
+
instructions(): Observable<object>;
|
|
2736
2779
|
private getInstructionLink;
|
|
2737
2780
|
callback(payload: Object): Promise<Object>;
|
|
2738
2781
|
status(id: string): Promise<Object>;
|
|
@@ -3347,7 +3390,7 @@ declare class WalletButtons {
|
|
|
3347
3390
|
private setupAuthTokensChangedCallback;
|
|
3348
3391
|
}
|
|
3349
3392
|
|
|
3350
|
-
type Instruction = new (selector: string, formSelector: string, api: ApiInternal) => InstructionHandler & InstructionDestroyable & InstructionDecorated;
|
|
3393
|
+
type Instruction = new (selector: string, formSelector: string, api: ApiInternal, checkoutWidget: Checkout) => InstructionHandler & InstructionDestroyable & InstructionDecorated;
|
|
3351
3394
|
interface InstructionHandleable {
|
|
3352
3395
|
handle(payload: object, eventEmitter: EventEmitter): void;
|
|
3353
3396
|
}
|
|
@@ -3361,7 +3404,8 @@ declare abstract class InstructionHandler implements InstructionHandleable, Inst
|
|
|
3361
3404
|
selector: string;
|
|
3362
3405
|
formSelector: string;
|
|
3363
3406
|
api: ApiInternal;
|
|
3364
|
-
|
|
3407
|
+
protected checkoutWidget?: Checkout;
|
|
3408
|
+
constructor(selector: string, formSelector: string, api: ApiInternal, checkoutWidget?: Checkout);
|
|
3365
3409
|
instruction: string;
|
|
3366
3410
|
abstract handle(context: object, eventEmitter?: any): void;
|
|
3367
3411
|
abstract destroy(): void;
|
|
@@ -3379,9 +3423,6 @@ interface IntentTokenPayload {
|
|
|
3379
3423
|
version: number;
|
|
3380
3424
|
env_alias: string;
|
|
3381
3425
|
}
|
|
3382
|
-
declare class InstructionDebugger {
|
|
3383
|
-
constructor(selector: string, formSelector: string, version: number, instructionName: string, context: object, token?: string);
|
|
3384
|
-
}
|
|
3385
3426
|
/**
|
|
3386
3427
|
* Class CheckoutButton transform usual button into checkout
|
|
3387
3428
|
*
|
|
@@ -3401,15 +3442,26 @@ declare class Checkout {
|
|
|
3401
3442
|
protected container: Container;
|
|
3402
3443
|
protected intentTokenPayload: IntentTokenPayload;
|
|
3403
3444
|
protected api: ApiInternal;
|
|
3445
|
+
protected checkoutApi: ApiCheckoutInternal;
|
|
3404
3446
|
protected instructions: InstructionModule;
|
|
3405
3447
|
protected currentInstruction: InstructionDestroyable & InstructionHandleable;
|
|
3448
|
+
private timeoutTimer;
|
|
3449
|
+
private requestInFlight;
|
|
3450
|
+
private inTimeoutRange;
|
|
3451
|
+
private checkoutFinished;
|
|
3406
3452
|
constructor(formSelector: string, intentToken: string, debug?: boolean);
|
|
3453
|
+
fetchInstruction(): void;
|
|
3454
|
+
finaliseCheckout(): void;
|
|
3455
|
+
private setupTimeoutTimer;
|
|
3407
3456
|
private extractIntentTokenPayload;
|
|
3408
3457
|
private ready;
|
|
3409
3458
|
private initContractVersion;
|
|
3410
|
-
private
|
|
3459
|
+
private isTimeoutInstruction;
|
|
3460
|
+
private handleInstruction;
|
|
3461
|
+
private handleTimeoutInstructions;
|
|
3462
|
+
private getInstructionFromResponse;
|
|
3463
|
+
private extractInstructionPayloadFromResponse;
|
|
3411
3464
|
private setEnv;
|
|
3412
|
-
private createWidgetStructure;
|
|
3413
3465
|
/**
|
|
3414
3466
|
* If the payment was successful, the function passed as parameter will be called.
|
|
3415
3467
|
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
@@ -3440,8 +3492,12 @@ declare class Checkout {
|
|
|
3440
3492
|
* });
|
|
3441
3493
|
*/
|
|
3442
3494
|
onPaymentExpired(handler: (data: IEventData$1) => void): () => void;
|
|
3495
|
+
createWidgetStructure(): void;
|
|
3443
3496
|
private setStyles;
|
|
3444
3497
|
}
|
|
3498
|
+
declare class InstructionDebugger {
|
|
3499
|
+
constructor(selector: string, formSelector: string, version: number, instructionName: string, context: object, token?: string);
|
|
3500
|
+
}
|
|
3445
3501
|
|
|
3446
3502
|
declare enum EVENT {
|
|
3447
3503
|
UNAVAILABLE = "unavailable",
|
|
@@ -3721,6 +3777,7 @@ interface ApplePayWalletMeta extends BaseWalletMeta {
|
|
|
3721
3777
|
supported_networks?: Array<'visa' | 'masterCard' | 'amex' | 'chinaUnionPay' | 'discover' | 'interac' | 'jcb' | 'privateLabel'>;
|
|
3722
3778
|
required_billing_contact_fields?: Array<'email' | 'name' | 'phone' | 'postalAddress'>;
|
|
3723
3779
|
required_shipping_contact_fields?: Array<'email' | 'phone'>;
|
|
3780
|
+
apple_pay_capabilities?: Array<'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable'>;
|
|
3724
3781
|
supported_countries?: string[];
|
|
3725
3782
|
style?: {
|
|
3726
3783
|
button_type?: ApplePayButtonType;
|
|
@@ -3772,6 +3829,7 @@ declare class ApplePayWalletButtonExpress extends BaseWalletButton<ApplePayWalle
|
|
|
3772
3829
|
private onValidateMerchant;
|
|
3773
3830
|
private getMerchantSession;
|
|
3774
3831
|
private onPaymentAuthorized;
|
|
3832
|
+
private formatCapabilities;
|
|
3775
3833
|
private onCancelPayment;
|
|
3776
3834
|
}
|
|
3777
3835
|
|