@paydock/client-sdk 1.120.1 → 1.122.2-beta
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 +456 -33
- package/bundles/index.cjs +2686 -431
- package/bundles/index.cjs.d.ts +438 -37
- package/bundles/index.mjs +2686 -431
- package/bundles/index.mjs.d.ts +438 -37
- 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 +28 -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-template.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/checkout/layout-widgets/payment-template.d.ts +1 -1
- package/bundles/types/checkout/layout-widgets/payment-template.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/link.d.ts +1 -1
- package/bundles/types/components/link.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/components/wallet-background.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/flypay-v2.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/paypal.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/base.wallet-button-express.d.ts +70 -13
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts +3 -1
- package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/index.d.ts +114 -1
- package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts +30 -0
- package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts +21 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts +9 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts +13 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-response.interface.d.ts +9 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-response.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts +9 -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/constants/apple-pay-events.constant.d.ts +5 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-events.constant.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +8 -3
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-contact-editing-mode.type.d.ts +5 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-contact-editing-mode.type.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts +21 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts +21 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-sdk.interface.d.ts +164 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-sdk.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts +9 -3
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts.map +1 -0
- 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 +2688 -431
- package/bundles/widget.umd.js.d.ts +438 -37
- package/bundles/widget.umd.js.min.d.ts +438 -37
- 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 +291 -2
- 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;
|
|
@@ -3378,9 +3422,7 @@ interface IntentTokenPayload {
|
|
|
3378
3422
|
intent_id: string;
|
|
3379
3423
|
version: number;
|
|
3380
3424
|
env_alias: string;
|
|
3381
|
-
|
|
3382
|
-
declare class InstructionDebugger {
|
|
3383
|
-
constructor(selector: string, formSelector: string, version: number, instructionName: string, context: object, token?: string);
|
|
3425
|
+
whitelist_domains: string[];
|
|
3384
3426
|
}
|
|
3385
3427
|
/**
|
|
3386
3428
|
* Class CheckoutButton transform usual button into checkout
|
|
@@ -3401,15 +3443,27 @@ declare class Checkout {
|
|
|
3401
3443
|
protected container: Container;
|
|
3402
3444
|
protected intentTokenPayload: IntentTokenPayload;
|
|
3403
3445
|
protected api: ApiInternal;
|
|
3446
|
+
protected checkoutApi: ApiCheckoutInternal;
|
|
3404
3447
|
protected instructions: InstructionModule;
|
|
3405
3448
|
protected currentInstruction: InstructionDestroyable & InstructionHandleable;
|
|
3449
|
+
private timeoutTimer;
|
|
3450
|
+
private requestInFlight;
|
|
3451
|
+
private inTimeoutRange;
|
|
3452
|
+
private checkoutFinished;
|
|
3406
3453
|
constructor(formSelector: string, intentToken: string, debug?: boolean);
|
|
3454
|
+
fetchInstruction(): void;
|
|
3455
|
+
finaliseCheckout(): void;
|
|
3456
|
+
private setupTimeoutTimer;
|
|
3407
3457
|
private extractIntentTokenPayload;
|
|
3458
|
+
validateJWTWhitelistedDomains(whitelist_domains: string[]): boolean;
|
|
3408
3459
|
private ready;
|
|
3409
3460
|
private initContractVersion;
|
|
3410
|
-
private
|
|
3461
|
+
private isTimeoutInstruction;
|
|
3462
|
+
private handleInstruction;
|
|
3463
|
+
private handleTimeoutInstructions;
|
|
3464
|
+
private getInstructionFromResponse;
|
|
3465
|
+
private extractInstructionPayloadFromResponse;
|
|
3411
3466
|
private setEnv;
|
|
3412
|
-
private createWidgetStructure;
|
|
3413
3467
|
/**
|
|
3414
3468
|
* If the payment was successful, the function passed as parameter will be called.
|
|
3415
3469
|
* Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
@@ -3440,8 +3494,12 @@ declare class Checkout {
|
|
|
3440
3494
|
* });
|
|
3441
3495
|
*/
|
|
3442
3496
|
onPaymentExpired(handler: (data: IEventData$1) => void): () => void;
|
|
3497
|
+
createWidgetStructure(): void;
|
|
3443
3498
|
private setStyles;
|
|
3444
3499
|
}
|
|
3500
|
+
declare class InstructionDebugger {
|
|
3501
|
+
constructor(selector: string, formSelector: string, version: number, instructionName: string, context: object, token?: string);
|
|
3502
|
+
}
|
|
3445
3503
|
|
|
3446
3504
|
declare enum EVENT {
|
|
3447
3505
|
UNAVAILABLE = "unavailable",
|
|
@@ -3450,7 +3508,9 @@ declare enum EVENT {
|
|
|
3450
3508
|
PAYMENT_ERROR = "paymentError",
|
|
3451
3509
|
PAYMENT_IN_REVIEW = "paymentInReview",
|
|
3452
3510
|
ON_CLICK = "onClick",
|
|
3453
|
-
ON_CHECKOUT_CLOSE = "onCheckoutClose"
|
|
3511
|
+
ON_CHECKOUT_CLOSE = "onCheckoutClose",
|
|
3512
|
+
ON_SHIPPING_ADDRESS_CHANGE = "onShippingAddressChange",
|
|
3513
|
+
ON_SHIPPING_OPTIONS_CHANGE = "onShippingOptionsChange"
|
|
3454
3514
|
}
|
|
3455
3515
|
|
|
3456
3516
|
interface BaseEventData<T> {
|
|
@@ -3519,6 +3579,50 @@ interface BaseGatewayConfig<T> {
|
|
|
3519
3579
|
credentials?: T;
|
|
3520
3580
|
}
|
|
3521
3581
|
|
|
3582
|
+
interface ChargeWalletTokenMeta {
|
|
3583
|
+
charge: {
|
|
3584
|
+
id: string;
|
|
3585
|
+
amount: number;
|
|
3586
|
+
currency: string;
|
|
3587
|
+
capture?: boolean;
|
|
3588
|
+
reference?: string;
|
|
3589
|
+
shipping?: {
|
|
3590
|
+
amount?: number;
|
|
3591
|
+
currency?: string;
|
|
3592
|
+
address_line1?: string;
|
|
3593
|
+
address_line2?: string;
|
|
3594
|
+
address_line3?: string;
|
|
3595
|
+
address_city?: string;
|
|
3596
|
+
address_postcode?: string;
|
|
3597
|
+
address_state?: string;
|
|
3598
|
+
address_country?: string;
|
|
3599
|
+
address_company?: string;
|
|
3600
|
+
address_origin_postcode?: string;
|
|
3601
|
+
method?: string;
|
|
3602
|
+
type?: string;
|
|
3603
|
+
options?: Array<{
|
|
3604
|
+
id?: string;
|
|
3605
|
+
label?: string;
|
|
3606
|
+
detail?: string;
|
|
3607
|
+
amount?: string;
|
|
3608
|
+
currency?: string;
|
|
3609
|
+
type?: string;
|
|
3610
|
+
}>;
|
|
3611
|
+
contact?: {
|
|
3612
|
+
first_name?: string;
|
|
3613
|
+
last_name?: string;
|
|
3614
|
+
email?: string;
|
|
3615
|
+
phone?: string;
|
|
3616
|
+
phone2?: string;
|
|
3617
|
+
};
|
|
3618
|
+
};
|
|
3619
|
+
};
|
|
3620
|
+
gateway: {
|
|
3621
|
+
mode: string;
|
|
3622
|
+
type: string;
|
|
3623
|
+
};
|
|
3624
|
+
}
|
|
3625
|
+
|
|
3522
3626
|
interface BaseWalletMeta {
|
|
3523
3627
|
amount: number;
|
|
3524
3628
|
currency: string;
|
|
@@ -3528,14 +3632,63 @@ interface OnErrorEventData extends BaseEventData<Error> {
|
|
|
3528
3632
|
event: EVENT.ERROR;
|
|
3529
3633
|
}
|
|
3530
3634
|
|
|
3635
|
+
interface OnShippingAddressChangeEventData extends BaseEventData<AddressChangeEventData> {
|
|
3636
|
+
event: EVENT.ON_SHIPPING_ADDRESS_CHANGE;
|
|
3637
|
+
}
|
|
3638
|
+
interface AddressChangeEventData {
|
|
3639
|
+
address_postcode?: string;
|
|
3640
|
+
address_city?: string;
|
|
3641
|
+
address_state?: string;
|
|
3642
|
+
address_country?: string;
|
|
3643
|
+
address_line1?: string;
|
|
3644
|
+
address_line2?: string;
|
|
3645
|
+
contact?: {
|
|
3646
|
+
phone?: string;
|
|
3647
|
+
email?: string;
|
|
3648
|
+
first_name?: string;
|
|
3649
|
+
last_name?: string;
|
|
3650
|
+
};
|
|
3651
|
+
}
|
|
3652
|
+
|
|
3653
|
+
interface OnShippingOptionChangeEventData extends BaseEventData<ShippingOptionChangeEventData> {
|
|
3654
|
+
event: EVENT.ON_SHIPPING_OPTIONS_CHANGE;
|
|
3655
|
+
}
|
|
3656
|
+
interface ShippingOptionChangeEventData {
|
|
3657
|
+
shipping_option_id?: string;
|
|
3658
|
+
amount?: string;
|
|
3659
|
+
label?: string;
|
|
3660
|
+
detail?: string;
|
|
3661
|
+
}
|
|
3662
|
+
|
|
3663
|
+
interface OnShippingAddressChangeEventResponse {
|
|
3664
|
+
token?: string;
|
|
3665
|
+
error?: {
|
|
3666
|
+
code: 'address_error' | 'country_error' | 'state_error' | 'zip_error' | 'shipping_contact_invalid' | 'billing_contact_invalid' | string;
|
|
3667
|
+
field?: 'phone' | 'email' | 'name' | 'phonetic_name' | 'address_lines' | 'locality' | 'postal_code' | 'administrative_area' | 'country' | 'country_code';
|
|
3668
|
+
message?: string;
|
|
3669
|
+
};
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
interface OnShippingOptionChangeEventResponse {
|
|
3673
|
+
token?: string;
|
|
3674
|
+
label?: string;
|
|
3675
|
+
amount?: string;
|
|
3676
|
+
error?: {
|
|
3677
|
+
code: 'method_unavailable' | 'store_unavailable' | string;
|
|
3678
|
+
};
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
type ShippingEventToResponse<T> = T extends OnShippingAddressChangeEventData ? OnShippingAddressChangeEventResponse : T extends OnShippingOptionChangeEventData ? OnShippingOptionChangeEventResponse : never;
|
|
3682
|
+
|
|
3531
3683
|
declare abstract class BaseWalletButton<T extends BaseWalletMeta> {
|
|
3532
3684
|
protected container: Container;
|
|
3533
3685
|
protected api: ApiInternal;
|
|
3534
3686
|
protected env: string;
|
|
3535
3687
|
protected gatewayId: string;
|
|
3536
3688
|
protected meta: T;
|
|
3537
|
-
|
|
3538
|
-
|
|
3689
|
+
protected eventEmitter: EventEmitter;
|
|
3690
|
+
protected chargeWalletTokenMeta?: ChargeWalletTokenMeta;
|
|
3691
|
+
private onShippingOptionsChangeHandlerRegistered;
|
|
3539
3692
|
constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: T, requiredMetaFields: string[]);
|
|
3540
3693
|
private getApiAuthType;
|
|
3541
3694
|
/**
|
|
@@ -3653,6 +3806,52 @@ declare abstract class BaseWalletButton<T extends BaseWalletMeta> {
|
|
|
3653
3806
|
* @param {OnCheckoutCloseCallback} handler - Function to be called when the wallet checkout closes.
|
|
3654
3807
|
*/
|
|
3655
3808
|
onCheckoutClose(handler?: (err: OnCloseEventData) => void): Promise<unknown> | (() => void);
|
|
3809
|
+
/**
|
|
3810
|
+
* Callback for onShippingAddressChange method.
|
|
3811
|
+
*
|
|
3812
|
+
* @callback OnShippingAddressChangeCallback
|
|
3813
|
+
* @param {OnShippingAddressChangeEventData} data
|
|
3814
|
+
* @return {Promise<OnShippingAddressChangeEventResponse>} Address update result
|
|
3815
|
+
*/
|
|
3816
|
+
/**
|
|
3817
|
+
* If shipping address data is updated, the function passed as parameter will be called.
|
|
3818
|
+
* Use this method to listen for shipping address selection or input from customer when shipping is enabled.
|
|
3819
|
+
* The event handler needs to return a new token in case a backend to backend wallet update call was executed.
|
|
3820
|
+
* In addition, if any error occured, an error string must be supplied.
|
|
3821
|
+
* By default, the event handler will be processed successfuly if neither token nor error is returned.
|
|
3822
|
+
*
|
|
3823
|
+
* @example
|
|
3824
|
+
* button.onShippingAddressChange((data) => {
|
|
3825
|
+
* const responseData = await fetch('https://your-server.com/update-shipping-info');
|
|
3826
|
+
* return { error: null, token: responseData.walletToken };
|
|
3827
|
+
* });
|
|
3828
|
+
*
|
|
3829
|
+
* @param {OnShippingAddressChangeCallback} [handler] - Function to be called when the shipping address data is updated.
|
|
3830
|
+
*/
|
|
3831
|
+
onShippingAddressChange(handler?: (data: OnShippingAddressChangeEventData) => Promise<OnShippingAddressChangeEventResponse>): () => void;
|
|
3832
|
+
/**
|
|
3833
|
+
* Callback for onShippingOptionsChange method.
|
|
3834
|
+
*
|
|
3835
|
+
* @callback OnShippingOptionsChangeCallback
|
|
3836
|
+
* @param {OnShippingOptionChangeEventData} data
|
|
3837
|
+
* @return {Promise<OnShippingOptionChangeEventResponse>} Address update result
|
|
3838
|
+
*/
|
|
3839
|
+
/**
|
|
3840
|
+
* If shipping options data is updated, the function passed as parameter will be called.
|
|
3841
|
+
* Use this method to listen for shipping option selection from customer when shipping is enabled.
|
|
3842
|
+
* The event handler needs to return a new token in case a backend to backend wallet update call was executed.
|
|
3843
|
+
* In addition, if any error occured, an error string must be supplied.
|
|
3844
|
+
* By default, the event handler will be processed successfuly if neither token nor error is returned.
|
|
3845
|
+
*
|
|
3846
|
+
* @example
|
|
3847
|
+
* button.onShippingOptionsChange((data) => {
|
|
3848
|
+
* const responseData = await fetch('https://your-server.com/update-shipping-info');
|
|
3849
|
+
* return { error: null, token: responseData.walletToken };
|
|
3850
|
+
* });
|
|
3851
|
+
*
|
|
3852
|
+
* @param {OnShippingOptionsChangeCallback} [handler] - Function to be called when the shipping options data is updated.
|
|
3853
|
+
*/
|
|
3854
|
+
onShippingOptionsChange(handler?: (data: OnShippingOptionChangeEventData) => Promise<OnShippingOptionChangeEventResponse>): () => void;
|
|
3656
3855
|
/**
|
|
3657
3856
|
* Callback for onUnavailable method.
|
|
3658
3857
|
*
|
|
@@ -3702,7 +3901,10 @@ declare abstract class BaseWalletButton<T extends BaseWalletMeta> {
|
|
|
3702
3901
|
}>(data: U): Promise<T>;
|
|
3703
3902
|
protected executeWalletCapture<T>(data: WalletCaptureRequest): Promise<T>;
|
|
3704
3903
|
protected handleMerchantOnExpressButtonClickEvent(): Promise<void>;
|
|
3705
|
-
|
|
3904
|
+
protected handleMerchantOnShippingChangedEvent<T extends OnShippingAddressChangeEventData | OnShippingOptionChangeEventData>(eventData: T): Promise<ShippingEventToResponse<T>>;
|
|
3905
|
+
protected setWalletToken(token: string, opts?: {
|
|
3906
|
+
skipApiAuth: boolean;
|
|
3907
|
+
}): void;
|
|
3706
3908
|
protected handleCheckoutClose(): void;
|
|
3707
3909
|
protected handleOnUnavailable(): void;
|
|
3708
3910
|
protected handleOnError(error?: Error): void;
|
|
@@ -3714,6 +3916,26 @@ type ApplePayButtonStyle = 'black' | 'white' | 'white-outline';
|
|
|
3714
3916
|
|
|
3715
3917
|
type ApplePayButtonType = 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'plain' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up';
|
|
3716
3918
|
|
|
3919
|
+
declare enum ContactShippingEditingMode {
|
|
3920
|
+
AVAILABLE = "available",
|
|
3921
|
+
STORE_PICKUP = "store_pickup"
|
|
3922
|
+
}
|
|
3923
|
+
|
|
3924
|
+
interface AppleShippingType {
|
|
3925
|
+
contact: {
|
|
3926
|
+
email: string;
|
|
3927
|
+
phone: string;
|
|
3928
|
+
first_name: string;
|
|
3929
|
+
last_name: string;
|
|
3930
|
+
};
|
|
3931
|
+
address_line1: string;
|
|
3932
|
+
address_line2: string;
|
|
3933
|
+
address_city: string;
|
|
3934
|
+
address_postcode: string;
|
|
3935
|
+
address_state: string;
|
|
3936
|
+
address_country: string;
|
|
3937
|
+
}
|
|
3938
|
+
|
|
3717
3939
|
interface ApplePayWalletMeta extends BaseWalletMeta {
|
|
3718
3940
|
amount_label: string;
|
|
3719
3941
|
country: string;
|
|
@@ -3721,11 +3943,14 @@ interface ApplePayWalletMeta extends BaseWalletMeta {
|
|
|
3721
3943
|
supported_networks?: Array<'visa' | 'masterCard' | 'amex' | 'chinaUnionPay' | 'discover' | 'interac' | 'jcb' | 'privateLabel'>;
|
|
3722
3944
|
required_billing_contact_fields?: Array<'email' | 'name' | 'phone' | 'postalAddress'>;
|
|
3723
3945
|
required_shipping_contact_fields?: Array<'email' | 'phone'>;
|
|
3946
|
+
apple_pay_capabilities?: Array<'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable'>;
|
|
3724
3947
|
supported_countries?: string[];
|
|
3725
3948
|
style?: {
|
|
3726
3949
|
button_type?: ApplePayButtonType;
|
|
3727
3950
|
button_style?: ApplePayButtonStyle;
|
|
3728
3951
|
};
|
|
3952
|
+
shipping?: AppleShippingType;
|
|
3953
|
+
shipping_editing_mode?: ContactShippingEditingMode;
|
|
3729
3954
|
}
|
|
3730
3955
|
|
|
3731
3956
|
/**
|
|
@@ -3772,7 +3997,15 @@ declare class ApplePayWalletButtonExpress extends BaseWalletButton<ApplePayWalle
|
|
|
3772
3997
|
private onValidateMerchant;
|
|
3773
3998
|
private getMerchantSession;
|
|
3774
3999
|
private onPaymentAuthorized;
|
|
4000
|
+
private formatCapabilities;
|
|
3775
4001
|
private onCancelPayment;
|
|
4002
|
+
private parseShippingContact;
|
|
4003
|
+
private parseShippingMethod;
|
|
4004
|
+
private onApplePayShippingContactUpdate;
|
|
4005
|
+
private onApplePayShippingMethodUpdate;
|
|
4006
|
+
private parseShippingMethodUpdateEvent;
|
|
4007
|
+
private parseShippingContactUpdateEvent;
|
|
4008
|
+
private formatErrorFields;
|
|
3776
4009
|
}
|
|
3777
4010
|
|
|
3778
4011
|
interface PaypalWalletMeta extends BaseWalletMeta {
|
|
@@ -3806,6 +4039,169 @@ interface PaypalWalletMeta extends BaseWalletMeta {
|
|
|
3806
4039
|
};
|
|
3807
4040
|
}
|
|
3808
4041
|
|
|
4042
|
+
interface PayPalSDK {
|
|
4043
|
+
Buttons?: (options?: PayPalButtonsComponentOptions) => PayPalButtonsComponent;
|
|
4044
|
+
Messages?: (options?: PayPalMessagesComponentOptions) => PayPalMessagesComponent;
|
|
4045
|
+
FUNDING?: Record<string, FUNDING_SOURCE>;
|
|
4046
|
+
}
|
|
4047
|
+
interface PayPalButtonsComponentOptions {
|
|
4048
|
+
/**
|
|
4049
|
+
* Called on button click to set up a one-time payment. [createOrder docs](https://developer.paypal.com/docs/business/javascript-sdk/javascript-sdk-reference/#createorder).
|
|
4050
|
+
*/
|
|
4051
|
+
createOrder?: PayPalButtonCreateOrder;
|
|
4052
|
+
/**
|
|
4053
|
+
* Used for defining a standalone button.
|
|
4054
|
+
* Learn more about [configuring the funding source for standalone buttons](https://developer.paypal.com/docs/business/checkout/configure-payments/standalone-buttons/#4-funding-sources).
|
|
4055
|
+
*/
|
|
4056
|
+
fundingSource?: PayPalButtonFundingSource;
|
|
4057
|
+
/**
|
|
4058
|
+
* Called when finalizing the transaction. Often used to inform the buyer that the transaction is complete. [onApprove docs](https://developer.paypal.com/docs/business/javascript-sdk/javascript-sdk-reference/#onapprove).
|
|
4059
|
+
*/
|
|
4060
|
+
onApprove?: PayPalButtonOnApprove;
|
|
4061
|
+
/**
|
|
4062
|
+
* Called when the buyer cancels the transaction.
|
|
4063
|
+
* Often used to show the buyer a [cancellation page](https://developer.paypal.com/docs/business/checkout/add-capabilities/buyer-experience/#3-show-cancellation-page).
|
|
4064
|
+
*/
|
|
4065
|
+
onCancel?: PayPalButtonOnCancel;
|
|
4066
|
+
/**
|
|
4067
|
+
* Called when the button is clicked. Often used for [validation](https://developer.paypal.com/docs/checkout/integration-features/validation/).
|
|
4068
|
+
*/
|
|
4069
|
+
onClick?: PayPalButtonOnClick;
|
|
4070
|
+
/**
|
|
4071
|
+
* Catch all for errors preventing buyer checkout.
|
|
4072
|
+
* Often used to show the buyer an [error page](https://developer.paypal.com/docs/checkout/integration-features/handle-errors/).
|
|
4073
|
+
*/
|
|
4074
|
+
onError?: PayPalButtonOnError;
|
|
4075
|
+
/**
|
|
4076
|
+
* Called when the buyer selects a new shipping option on PayPal.
|
|
4077
|
+
*/
|
|
4078
|
+
onShippingOptionsChange?: PayPalButtonOnShippingOptionsChange;
|
|
4079
|
+
/**
|
|
4080
|
+
* Called when the buyer updates their shipping address on PayPal.
|
|
4081
|
+
*/
|
|
4082
|
+
onShippingAddressChange?: PayPalButtonOnShippingAddressChange;
|
|
4083
|
+
/**
|
|
4084
|
+
* [Styling options](https://developer.paypal.com/docs/business/checkout/reference/style-guide/#customize-the-payment-buttons) for customizing the button appearance.
|
|
4085
|
+
*/
|
|
4086
|
+
style?: PayPalButtonStyle;
|
|
4087
|
+
}
|
|
4088
|
+
interface PayPalButtonsComponent {
|
|
4089
|
+
close: () => Promise<void>;
|
|
4090
|
+
isEligible: () => boolean;
|
|
4091
|
+
render: (container: HTMLElement | string) => Promise<void>;
|
|
4092
|
+
updateProps: (props: PayPalButtonsComponentOptions) => Promise<void>;
|
|
4093
|
+
}
|
|
4094
|
+
type PayPalButtonCreateOrder = (data: CreateOrderData) => Promise<string>;
|
|
4095
|
+
interface CreateOrderData {
|
|
4096
|
+
paymentSource: FUNDING_SOURCE;
|
|
4097
|
+
}
|
|
4098
|
+
type PayPalButtonFundingSource = FUNDING_SOURCE;
|
|
4099
|
+
type FUNDING_SOURCE = 'paypal' | 'venmo' | 'applepay' | 'itau' | 'credit' | 'paylater' | 'card' | 'ideal' | 'sepa' | 'bancontact' | 'giropay' | 'sofort' | 'eps' | 'mybank' | 'p24' | 'verkkopankki' | 'payu' | 'blik' | 'trustly' | 'zimpler' | 'maxima' | 'oxxo' | 'boletobancario' | 'wechatpay' | 'mercadopago' | 'multibanco';
|
|
4100
|
+
type PayPalButtonOnApprove = (data: OnApproveData) => Promise<void>;
|
|
4101
|
+
interface OnApproveData {
|
|
4102
|
+
billingToken?: string | null;
|
|
4103
|
+
facilitatorAccessToken?: string;
|
|
4104
|
+
orderID: string;
|
|
4105
|
+
payerID?: string | null;
|
|
4106
|
+
paymentID?: string | null;
|
|
4107
|
+
subscriptionID?: string | null;
|
|
4108
|
+
authCode?: string | null;
|
|
4109
|
+
}
|
|
4110
|
+
type PayPalButtonOnCancel = (data: Record<string, unknown>) => void;
|
|
4111
|
+
type PayPalButtonOnClick = (data: Record<string, unknown>, actions: OnClickActions) => Promise<void> | void;
|
|
4112
|
+
interface OnClickActions {
|
|
4113
|
+
reject: () => Promise<void>;
|
|
4114
|
+
resolve: () => Promise<void>;
|
|
4115
|
+
}
|
|
4116
|
+
type PayPalButtonOnError = (err: Record<string, unknown>) => void;
|
|
4117
|
+
type PayPalButtonOnShippingOptionsChange = (data: OnShippingOptionsChangeData, actions: OnShippingOptionsChangeActions) => Promise<void>;
|
|
4118
|
+
interface OnShippingOptionsChangeData {
|
|
4119
|
+
orderID?: string;
|
|
4120
|
+
paymentID?: string;
|
|
4121
|
+
paymentToken?: string;
|
|
4122
|
+
errors: {
|
|
4123
|
+
METHOD_UNAVAILABLE: string;
|
|
4124
|
+
STORE_UNAVAILABLE: string;
|
|
4125
|
+
};
|
|
4126
|
+
selectedShippingOption?: CheckoutShippingOption;
|
|
4127
|
+
}
|
|
4128
|
+
interface CheckoutShippingOption {
|
|
4129
|
+
amount: CurrencyCodeAndValue;
|
|
4130
|
+
id?: string;
|
|
4131
|
+
label: string;
|
|
4132
|
+
selected: boolean;
|
|
4133
|
+
type: 'SHIPPING' | 'PICKUP';
|
|
4134
|
+
}
|
|
4135
|
+
interface CurrencyCodeAndValue {
|
|
4136
|
+
currencyCode: string;
|
|
4137
|
+
value: string;
|
|
4138
|
+
}
|
|
4139
|
+
interface OnShippingOptionsChangeActions {
|
|
4140
|
+
reject: (reason?: string) => Promise<void>;
|
|
4141
|
+
}
|
|
4142
|
+
type PayPalButtonOnShippingAddressChange = (data: OnShippingAddressChangeData, actions: OnShippingAddressChangeActions) => Promise<void>;
|
|
4143
|
+
interface OnShippingAddressChangeData {
|
|
4144
|
+
amount: CurrencyCodeAndValue;
|
|
4145
|
+
orderID?: string;
|
|
4146
|
+
paymentID?: string;
|
|
4147
|
+
paymentToken?: string;
|
|
4148
|
+
errors: {
|
|
4149
|
+
ADDRESS_ERROR: string;
|
|
4150
|
+
COUNTRY_ERROR: string;
|
|
4151
|
+
STATE_ERROR: string;
|
|
4152
|
+
ZIP_ERROR: string;
|
|
4153
|
+
};
|
|
4154
|
+
shippingAddress: {
|
|
4155
|
+
city: string;
|
|
4156
|
+
state: string;
|
|
4157
|
+
/** The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region. */
|
|
4158
|
+
countryCode: string;
|
|
4159
|
+
/**
|
|
4160
|
+
* The postal code, which is the zip code or equivalent.
|
|
4161
|
+
* Typically required for countries with a postal code or an equivalent.
|
|
4162
|
+
*/
|
|
4163
|
+
postalCode: string;
|
|
4164
|
+
};
|
|
4165
|
+
}
|
|
4166
|
+
interface OnShippingAddressChangeActions {
|
|
4167
|
+
reject: (reason?: string) => Promise<void>;
|
|
4168
|
+
}
|
|
4169
|
+
interface PayPalButtonStyle {
|
|
4170
|
+
borderRadius?: number;
|
|
4171
|
+
color?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
|
|
4172
|
+
disableMaxWidth?: boolean;
|
|
4173
|
+
height?: number;
|
|
4174
|
+
label?: 'paypal' | 'checkout' | 'buynow' | 'pay' | 'installment' | 'subscribe' | 'donate';
|
|
4175
|
+
layout?: 'vertical' | 'horizontal';
|
|
4176
|
+
shape?: 'rect' | 'pill' | 'sharp';
|
|
4177
|
+
tagline?: boolean;
|
|
4178
|
+
}
|
|
4179
|
+
interface PayPalMessagesComponentOptions {
|
|
4180
|
+
amount?: number | string;
|
|
4181
|
+
currency?: 'USD' | 'GBP' | 'EUR';
|
|
4182
|
+
style?: {
|
|
4183
|
+
layout?: 'text' | 'flex' | 'custom';
|
|
4184
|
+
color?: string;
|
|
4185
|
+
logo?: {
|
|
4186
|
+
type?: 'primary' | 'alternative' | 'inline' | 'none';
|
|
4187
|
+
position?: 'left' | 'right' | 'top';
|
|
4188
|
+
};
|
|
4189
|
+
text?: {
|
|
4190
|
+
color?: 'black' | 'white' | 'monochrome' | 'grayscale';
|
|
4191
|
+
size?: 10 | 11 | 12 | 13 | 14 | 15 | 16;
|
|
4192
|
+
align?: 'left' | 'center' | 'right';
|
|
4193
|
+
};
|
|
4194
|
+
ratio?: '1x1' | '1x4' | '8x1' | '20x1';
|
|
4195
|
+
};
|
|
4196
|
+
placement?: 'home' | 'category' | 'product' | 'cart' | 'payment';
|
|
4197
|
+
onApply?: (data: Record<string, unknown>) => void;
|
|
4198
|
+
onClick?: (data: Record<string, unknown>) => void;
|
|
4199
|
+
onRender?: (data: Record<string, unknown>) => void;
|
|
4200
|
+
}
|
|
4201
|
+
interface PayPalMessagesComponent {
|
|
4202
|
+
render: (container: HTMLElement | string) => Promise<void>;
|
|
4203
|
+
}
|
|
4204
|
+
|
|
3809
4205
|
/**
|
|
3810
4206
|
* Class PaypalWalletButtonExpress to work with Paypal Wallet.
|
|
3811
4207
|
*
|
|
@@ -3823,8 +4219,11 @@ interface PaypalWalletMeta extends BaseWalletMeta {
|
|
|
3823
4219
|
*/
|
|
3824
4220
|
declare class PaypalWalletButtonExpress extends BaseWalletButton<PaypalWalletMeta> {
|
|
3825
4221
|
private config;
|
|
3826
|
-
protected paypal:
|
|
3827
|
-
protected pendingApprovalPromise?: Promise<
|
|
4222
|
+
protected paypal: PayPalSDK;
|
|
4223
|
+
protected pendingApprovalPromise?: Promise<{
|
|
4224
|
+
status: string;
|
|
4225
|
+
}>;
|
|
4226
|
+
private shippingRequested;
|
|
3828
4227
|
/** @constructs */ constructor(selector: string, publicKeyOrAccessToken: string, gatewayId: string, meta: PaypalWalletMeta);
|
|
3829
4228
|
/**
|
|
3830
4229
|
* Initializes the availability checks and inserts the button if possible.
|
|
@@ -3848,6 +4247,8 @@ declare class PaypalWalletButtonExpress extends BaseWalletButton<PaypalWalletMet
|
|
|
3848
4247
|
private renderPaypalCommonComponent;
|
|
3849
4248
|
private renderPaypalStandaloneComponent;
|
|
3850
4249
|
private paypalSharedProps;
|
|
4250
|
+
private handleShippingAddressUpdate;
|
|
4251
|
+
private handleShippingOptionsUpdate;
|
|
3851
4252
|
}
|
|
3852
4253
|
|
|
3853
4254
|
declare enum ErrorCodes$1 {
|