@paydock/client-sdk 1.144.0-beta → 1.145.0-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.
Files changed (53) hide show
  1. package/README.md +422 -31
  2. package/bundles/index.cjs +2476 -988
  3. package/bundles/index.cjs.d.ts +627 -431
  4. package/bundles/index.mjs +2476 -988
  5. package/bundles/index.mjs.d.ts +627 -431
  6. package/bundles/types/api/api-base.d.ts +15 -2
  7. package/bundles/types/api/api-base.d.ts.map +1 -1
  8. package/bundles/types/helper/browser.d.ts.map +1 -1
  9. package/bundles/types/helper/element-id.d.ts +3 -1
  10. package/bundles/types/helper/element-id.d.ts.map +1 -1
  11. package/bundles/types/helper/uuid.d.ts.map +1 -1
  12. package/bundles/types/open-wallets/apple-pay-open-wallet-button.d.ts +41 -0
  13. package/bundles/types/open-wallets/apple-pay-open-wallet-button.d.ts.map +1 -1
  14. package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts +10 -0
  15. package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts.map +1 -1
  16. package/bundles/types/open-wallets/base/service-config-cache.d.ts +23 -0
  17. package/bundles/types/open-wallets/base/service-config-cache.d.ts.map +1 -0
  18. package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts +33 -1
  19. package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts.map +1 -1
  20. package/bundles/types/open-wallets/index.d.ts +82 -1
  21. package/bundles/types/open-wallets/index.d.ts.map +1 -1
  22. package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-availability.interface.d.ts +41 -0
  23. package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-availability.interface.d.ts.map +1 -0
  24. package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts +1 -0
  25. package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts.map +1 -1
  26. package/bundles/types/open-wallets/interfaces/google-pay/google-pay-availability.interface.d.ts +25 -0
  27. package/bundles/types/open-wallets/interfaces/google-pay/google-pay-availability.interface.d.ts.map +1 -0
  28. package/bundles/types/open-wallets/interfaces/google-pay/index.d.ts +1 -0
  29. package/bundles/types/open-wallets/interfaces/google-pay/index.d.ts.map +1 -1
  30. package/bundles/types/open-wallets/interfaces/index.d.ts +3 -0
  31. package/bundles/types/open-wallets/interfaces/index.d.ts.map +1 -1
  32. package/bundles/types/open-wallets/interfaces/open-wallet-availability.interface.d.ts +31 -0
  33. package/bundles/types/open-wallets/interfaces/open-wallet-availability.interface.d.ts.map +1 -0
  34. package/bundles/types/open-wallets/services/apple-pay/apple-pay-availability.d.ts +58 -0
  35. package/bundles/types/open-wallets/services/apple-pay/apple-pay-availability.d.ts.map +1 -0
  36. package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts +8 -10
  37. package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts.map +1 -1
  38. package/bundles/types/open-wallets/services/apple-pay/index.d.ts +1 -0
  39. package/bundles/types/open-wallets/services/apple-pay/index.d.ts.map +1 -1
  40. package/bundles/types/open-wallets/services/google-pay/google-pay-availability.d.ts +53 -0
  41. package/bundles/types/open-wallets/services/google-pay/google-pay-availability.d.ts.map +1 -0
  42. package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts.map +1 -1
  43. package/bundles/types/open-wallets/services/google-pay/index.d.ts +1 -0
  44. package/bundles/types/open-wallets/services/google-pay/index.d.ts.map +1 -1
  45. package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts.map +1 -1
  46. package/bundles/widget.umd.js +2476 -988
  47. package/bundles/widget.umd.js.d.ts +627 -431
  48. package/bundles/widget.umd.js.min.d.ts +627 -431
  49. package/bundles/widget.umd.min.js +1 -1
  50. package/docs/open-wallet-buttons-examples.md +170 -2
  51. package/docs/open-wallet-buttons.md +252 -29
  52. package/package.json +15 -8
  53. package/slate.md +170 -2
@@ -133,223 +133,6 @@ declare class Env implements IEnvironment {
133
133
  private validateEnvironmentId;
134
134
  }
135
135
 
136
- type HttpRequestMethod = 'GET' | 'POST';
137
- type HttpRequestUrl = string | URL;
138
-
139
- type AgentPrototype = Pick<(typeof MicroAgent)['prototype'], 'addPageAction' | 'noticeError'>;
140
- type AgentMethodNames = keyof AgentPrototype;
141
- type AgentMethodParameters<T extends AgentMethodNames> = Parameters<AgentPrototype[T]>;
142
- type InstrumentationClient = {
143
- call<T extends AgentMethodNames>(method: T, ...args: AgentMethodParameters<T>): void;
144
- };
145
- declare class InstrumentationAgent extends MicroAgent {
146
- private static agent;
147
- private static available;
148
- private static initialized;
149
- private static readonly noopClient;
150
- private constructor();
151
- static get instance(): InstrumentationClient;
152
- isAvailable(): boolean;
153
- call: <T extends "addPageAction" | "noticeError">(method: T, ...args: AgentMethodParameters<T>) => void;
154
- }
155
-
156
- interface CustomEventDTO {
157
- environment: string;
158
- appId?: never;
159
- timestamp?: never;
160
- [x: string]: unknown;
161
- }
162
- interface ReportBaseContext {
163
- sdkVersion: string | null;
164
- description?: string;
165
- environment?: string;
166
- [x: string]: SerializableValue | undefined;
167
- }
168
- type SerializableValue = string | number | symbol | object | null;
169
-
170
- type ReportErrorFn = (repository: ErrorRepository, error: string | Error, ctx: ReportBaseContext & ({
171
- className: string;
172
- classMethod: string;
173
- functionName?: never;
174
- } | {
175
- className?: never;
176
- classMethod?: never;
177
- functionName: string;
178
- })) => void;
179
- declare class ErrorRepository {
180
- private readonly agent;
181
- constructor();
182
- createError(...args: Parameters<InstrumentationAgent['noticeError']>): Promise<void>;
183
- }
184
-
185
- type ReportEventFn = (repository: EventRepository, actionName: string, ctx: ReportBaseContext & CustomEventDTO) => void;
186
- declare class EventRepository {
187
- private readonly agent;
188
- constructor();
189
- createEvent(...args: Parameters<InstrumentationAgent['addPageAction']>): Promise<void>;
190
- }
191
-
192
- declare enum API_AUTH_TYPE {
193
- PUBLIC_KEY = 0,
194
- TOKEN = 1
195
- }
196
- declare class ApiBase {
197
- protected env: Env;
198
- auth: string;
199
- authType: API_AUTH_TYPE;
200
- constructor(auth: string, authType?: API_AUTH_TYPE);
201
- /**
202
- * Current method can change environment. By default environment = sandbox.
203
- * Also we can change domain alias for this environment. By default domain_alias = paydock.com
204
- *
205
- * @example
206
- * widget.setEnv('production');
207
- * @param {string} env - sandbox, production
208
- * @param {string} [alias] - Own domain alias
209
- */
210
- setEnv(env: string, alias?: string): ApiBase;
211
- requestObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req): Observable<Res>;
212
- private makeRequest;
213
- private onRequestLoad;
214
- private onRequestError;
215
- setAuthType(): API_AUTH_TYPE;
216
- getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
217
- config: XMLHttpRequest;
218
- send: (body: any, cb?: (data) => void, errorCb?: (data: any) => any) => void;
219
- };
220
- getClientPromise<Req extends object, Res>(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
221
- config: XMLHttpRequest;
222
- send: (body: Req) => Promise<Res>;
223
- };
224
- parser({ text, status }: {
225
- text: string;
226
- status: number;
227
- }, cb: any, errorCb: any): any;
228
- parserPromise<Res>({ text, status, }: {
229
- text: string;
230
- status: number;
231
- }): Promise<Res>;
232
- reportEvent: ReportEventFn;
233
- reportError: ReportErrorFn;
234
- protected newApiRequest(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): XMLHttpRequest;
235
- get ctx(): {
236
- sdkVersion: string;
237
- className: string;
238
- environment: string;
239
- };
240
- }
241
-
242
- /**
243
- * Interface for browser details response.
244
- * @interface BrowserDetails
245
- *
246
- * @param {string} [name]
247
- * @param {string} [java_enabled]
248
- * @param {string} [language]
249
- * @param {string} [screen_height]
250
- * @param {string} [screen_width]
251
- * @param {string} [time_zone]
252
- * @param {string} [color_depth]
253
- * */
254
- interface BrowserDetails {
255
- name: string;
256
- java_enabled: string;
257
- language: string;
258
- screen_height: string;
259
- screen_width: string;
260
- time_zone: string;
261
- color_depth: string;
262
- }
263
- /**
264
- * Class Api include method for working with paydock api
265
- * @constructor
266
- *
267
- * @param {string} publicKey - PayDock users public key
268
- * @example
269
- * var api = new Api('publicKey');
270
- *
271
- *
272
- **/
273
- declare class Api extends ApiBase {
274
- publicKey: String;
275
- /** @constructs */ constructor(publicKey: string);
276
- /**
277
- * Method for getting browser details
278
- *
279
- * @example
280
- * api.getBrowserDetails();
281
- *
282
- * @return {BrowserDetails} Browser details object
283
- */
284
- getBrowserDetails(): BrowserDetails;
285
- /**
286
- * Current method allows to work with charge related endpoints
287
- *
288
- * @example
289
- * api.charge();
290
- */
291
- charge(): ApiCharge;
292
- }
293
-
294
- /**
295
- * Decoded payload of the Standalone 3DS charge token (the JWT body) the SDK
296
- * receives in `Canvas3ds`'s constructor when the token format is `standalone_3ds`.
297
- *
298
- * This shape is set by the Paydock backend when minting the token. Integrators
299
- * who decode the token themselves can use this interface to type the result.
300
- */
301
- interface ITokenStandalone3DS {
302
- /** Optional merchant-side correlation identifier carried through from the original charge request. */
303
- external_id?: string;
304
- /** URL of the first iframe the SDK loads to bootstrap the 3DS provider's authentication flow. */
305
- initialization_url: string;
306
- /**
307
- * @deprecated No longer read by the Standalone 3DS flow. The field is kept
308
- * on the interface for backwards compatibility with tokens minted by older
309
- * API versions; it will be removed in a future major release. Prefer
310
- * `initialization_url` + `secondary_url`.
311
- */
312
- authorization_url?: string;
313
- /** Optional URL of a secondary iframe used by some providers (e.g. GPayments) for monitoring/polling alongside the main flow. */
314
- secondary_url?: string;
315
- /** The Paydock 3DS charge identifier this token authorizes. Echoed back in every event payload emitted during the flow. */
316
- charge_3ds_id: string;
317
- /** Identifier of the 3DS gateway the SDK should delegate to. Currently only `'GPayments'` is handled; other values fall through. */
318
- service_type: string;
319
- }
320
- declare class Standalone3dsService {
321
- protected container: Container;
322
- protected eventEmitter: EventEmitter;
323
- protected env: string;
324
- protected alias: string;
325
- constructor(container: Container, eventEmitter: any);
326
- load(token: string, options: {
327
- title: string;
328
- }): void;
329
- setEnv(env: string, alias?: string): void;
330
- }
331
-
332
- declare class IFrame {
333
- protected container: Container;
334
- constructor(container: Container);
335
- load(link: string, options?: {
336
- title?: string;
337
- attributes?: Record<string, string>;
338
- styles?: Record<string, string>;
339
- }, iframeClass?: string): void;
340
- loadFromHtml(content: string, options?: {
341
- title?: string;
342
- }, iframeClass?: string): void;
343
- remove(): void;
344
- show(): void;
345
- hide(saveSize?: boolean): void;
346
- isExist(): boolean;
347
- getElement(): HTMLIFrameElement;
348
- setStyle(property: string, value: string): void;
349
- setIframeHeight(iframeElement: HTMLIFrameElement, iFrameDocument: Document, selector: string): void;
350
- private setStyles;
351
- }
352
-
353
136
  /**
354
137
  * List of available form field validators dedicated to cards and their definition
355
138
  *
@@ -814,6 +597,9 @@ interface IWalletMeta {
814
597
  apple_pay_capabilities?: Array<'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable'>;
815
598
  }
816
599
 
600
+ type HttpRequestMethod = 'GET' | 'POST';
601
+ type HttpRequestUrl = string | URL;
602
+
817
603
  /**
818
604
  * List of available payment source types
819
605
  *
@@ -978,6 +764,97 @@ declare class Configuration {
978
764
  disableResultMessage(): void;
979
765
  }
980
766
 
767
+ declare class IFrame {
768
+ protected container: Container;
769
+ constructor(container: Container);
770
+ load(link: string, options?: {
771
+ title?: string;
772
+ attributes?: Record<string, string>;
773
+ styles?: Record<string, string>;
774
+ }, iframeClass?: string): void;
775
+ loadFromHtml(content: string, options?: {
776
+ title?: string;
777
+ }, iframeClass?: string): void;
778
+ remove(): void;
779
+ show(): void;
780
+ hide(saveSize?: boolean): void;
781
+ isExist(): boolean;
782
+ getElement(): HTMLIFrameElement;
783
+ setStyle(property: string, value: string): void;
784
+ setIframeHeight(iframeElement: HTMLIFrameElement, iFrameDocument: Document, selector: string): void;
785
+ private setStyles;
786
+ }
787
+
788
+ /**
789
+ * Contains basic information associated with the event.
790
+ *
791
+ * Including event (name), source of the message, purpose and a unique identifier
792
+ * for the event.
793
+ *
794
+ * @interface IEventData
795
+ *
796
+ * @param {string} event The name of the event.
797
+ * @param {string} message_source A system variable that identifies the event source.
798
+ * @param {string} purpose A system variable that states the purpose of the event.
799
+ * @param {string} [ref_id] Custom unique value that identifies result of processed operation.
800
+ */
801
+ interface IEventData$1 {
802
+ event: string;
803
+ message_source: string;
804
+ purpose: PURPOSE;
805
+ widget_id: string;
806
+ data?: any;
807
+ ref_id?: string;
808
+ error?: IEventError;
809
+ }
810
+ declare const EVENT$3: {
811
+ readonly AFTER_LOAD: "afterLoad";
812
+ readonly SUBMIT: "submit";
813
+ readonly FINISH: "finish";
814
+ readonly VALIDATION_ERROR: "validationError";
815
+ readonly SYSTEM_ERROR: "systemError";
816
+ readonly ERROR: "error";
817
+ /** @deprecated */
818
+ readonly CHECKOUT_SUCCESS: "checkoutSuccess";
819
+ readonly CHECKOUT_READY: "checkoutReady";
820
+ readonly CHECKOUT_ERROR: "checkoutError";
821
+ readonly CHECKOUT_COMPLETED: "checkoutCompleted";
822
+ readonly CHECKOUT_POPUP_OPEN: "checkoutPopupOpen";
823
+ readonly CHECKOUT_POPUP_CLOSE: "checkoutPopupClose";
824
+ readonly RECOGNITION_TOKEN_REQUESTED: "recognitionTokenRequested";
825
+ readonly RECOGNITION_TOKEN_DROPPED: "recognitionTokenDropped";
826
+ readonly VALIDATION: "validation";
827
+ readonly SELECT: "select";
828
+ readonly UNSELECT: "unselect";
829
+ readonly NEXT: "next";
830
+ readonly PREV: "prev";
831
+ readonly META_CHANGE: "metaChange";
832
+ readonly RESIZE: "resize";
833
+ readonly CHARGE_AUTH_SUCCESS: "chargeAuthSuccess";
834
+ readonly CHARGE_AUTH_REJECT: "chargeAuthReject";
835
+ readonly CHARGE_AUTH_CANCELLED: "chargeAuthCancelled";
836
+ readonly ADDITIONAL_DATA_SUCCESS: "additionalDataCollectSuccess";
837
+ readonly ADDITIONAL_DATA_REJECT: "additionalDataCollectReject";
838
+ readonly CHARGE_AUTH: "chargeAuth";
839
+ readonly DISPATCH_SUCCESS: "dispatchSuccess";
840
+ readonly DISPATCH_ERROR: "dispatchError";
841
+ };
842
+ type EventTypes = typeof EVENT$3[keyof typeof EVENT$3];
843
+ interface Listener {
844
+ event: string;
845
+ listener: (event: any) => void;
846
+ widget_id: string;
847
+ }
848
+ declare type Listeners = Listener[];
849
+ declare class IFrameEvent {
850
+ protected listeners: Listeners;
851
+ constructor(subject: Window | null);
852
+ emit(data: IEventData$1): void;
853
+ on<T>(eventName: string, widgetId: string, cb: (data: T) => void): void;
854
+ clear(): void;
855
+ private subscribe;
856
+ }
857
+
981
858
  interface ITriggerData {
982
859
  configuration_token?: string;
983
860
  tab_number?: number;
@@ -1123,104 +1000,17 @@ interface IElementStyleTitle {
1123
1000
  line_height?: string;
1124
1001
  font_weight?: string;
1125
1002
  padding?: string;
1126
- margin?: string;
1127
- }
1128
- interface IElementStyleTitleDescription {
1129
- color?: string;
1130
- text_decoration?: string;
1131
- font_size?: string;
1132
- font_family?: string;
1133
- line_height?: string;
1134
- font_weight?: string;
1135
- padding?: string;
1136
- margin?: string;
1137
- }
1138
-
1139
- /**
1140
- * Top-level classification of an error. Used by the SDK to route errors to the
1141
- * right category in instrumentation and to give consumers a coarse-grained
1142
- * tag for grouping/filtering. See {@link getErrorCategory} for the mapping
1143
- * between {@link ERROR_CAUSE} and {@link ERROR_CATEGORY}.
1144
- */
1145
- declare const ERROR_CATEGORY: {
1146
- /** SDK was misconfigured (missing keys, invalid options, etc.). */
1147
- readonly CONFIGURATION: "configuration";
1148
- /** Authentication or authorization failure. */
1149
- readonly IDENTITY: "identity_access_management";
1150
- /** SDK internal failure or upstream service problem. */
1151
- readonly INTERNAL: "internal";
1152
- /** Flow lifecycle event (user cancelled, aborted, etc.) — not a real fault. */
1153
- readonly PROCESS: "process";
1154
- /** Resource lookup failed or was rate-limited. */
1155
- readonly RESOURCE: "resource";
1156
- /** Invalid input or business-rule validation failure. */
1157
- readonly VALIDATION: "validation";
1158
- };
1159
- type ErrorCategory = (typeof ERROR_CATEGORY)[keyof typeof ERROR_CATEGORY];
1160
- /**
1161
- * Concrete cause of an error. More specific than {@link ERROR_CATEGORY} —
1162
- * useful for deciding programmatic responses (e.g. show a retry button only
1163
- * when `cause` is `'service_unreachable'` or `'server_busy'`).
1164
- */
1165
- declare const ERROR_CAUSE: {
1166
- /** Operation was aborted programmatically. */
1167
- readonly ABORTED: "aborted";
1168
- /** Caller has insufficient permissions for the operation. */
1169
- readonly ACCESS_FORBIDDEN: "access_forbidden";
1170
- /** Resource already exists when create was expected. */
1171
- readonly ALREADY_EXISTS: "already_exists";
1172
- /** User cancelled the flow (e.g. closed the wallet sheet). */
1173
- readonly CANCELED: "canceled";
1174
- /** SDK was instantiated or invoked with invalid configuration. */
1175
- readonly INVALID_CONFIGURATION: "invalid_configuration";
1176
- /** Input failed structural or business-rule validation. */
1177
- readonly INVALID_INPUT: "invalid_input";
1178
- /** Resource was not found by the backend. */
1179
- readonly NOT_FOUND: "not_found";
1180
- /** Operation is not supported in the current context or version. */
1181
- readonly NOT_IMPLEMENTED: "not_implemented";
1182
- /** Caller exceeded the allowed request rate. */
1183
- readonly RATE_LIMITED: "rate_limited";
1184
- /** Backend is healthy but currently overloaded — typically retryable. */
1185
- readonly SERVER_BUSY: "server_busy";
1186
- /** Backend or third-party service could not be reached — typically retryable. */
1187
- readonly SERVICE_UNREACHABLE: "service_unreachable";
1188
- /** Caller is not authenticated. */
1189
- readonly UNAUTHORIZED: "unauthorized";
1190
- /** Catch-all when no other cause applies. */
1191
- readonly UNKNOWN: "unknown_error";
1192
- /** Request was syntactically valid but semantically rejected. */
1193
- readonly UNPROCESSABLE_ENTITY: "unprocessable_entity";
1194
- };
1195
- type ErrorCause = (typeof ERROR_CAUSE)[keyof typeof ERROR_CAUSE];
1196
- /**
1197
- * Diagnostic detail attached to every {@link IEventError}.
1198
- * Useful for logging, surfacing user-facing messages, and correlating with
1199
- * server-side logs via `contextId`.
1200
- */
1201
- interface ErrorDetails {
1202
- /** Concrete cause classification (mirrors the top-level `cause` on `IEventError`). */
1203
- cause: ErrorCause;
1204
- /** Correlation identifier — typically a request id or trace id from the backend. Empty string when none is available. */
1205
- contextId: string;
1206
- /** Human-readable message safe to surface to developers (NOT necessarily safe for end-users). */
1207
- message: string;
1208
- /** ISO 8601 UTC timestamp captured at error creation time. */
1209
- timestamp: string;
1210
- }
1211
- /**
1212
- * Standard error envelope emitted by the SDK on event payloads (`IEventData.error`)
1213
- * and exposed publicly so integrators can `instanceof`/structurally narrow against it.
1214
- */
1215
- interface IEventError {
1216
- /** Concrete cause of the error. See {@link ERROR_CAUSE} for the full list. */
1217
- cause: ErrorCause;
1218
- /** Coarse-grained category derived from `cause`. See {@link ERROR_CATEGORY}. */
1219
- category: ErrorCategory;
1220
- /** Whether the operation can be retried as-is. Must be set explicitly by the producer; `EventError.create()` defaults it to `false`. The intended candidates for `true` are transient causes such as `service_unreachable` and `server_busy`. */
1221
- retryable: boolean;
1222
- /** Diagnostic detail (message, timestamp, correlation id). */
1223
- details: ErrorDetails;
1003
+ margin?: string;
1004
+ }
1005
+ interface IElementStyleTitleDescription {
1006
+ color?: string;
1007
+ text_decoration?: string;
1008
+ font_size?: string;
1009
+ font_family?: string;
1010
+ line_height?: string;
1011
+ font_weight?: string;
1012
+ padding?: string;
1013
+ margin?: string;
1224
1014
  }
1225
1015
 
1226
1016
  /**
@@ -2168,128 +1958,350 @@ declare class HtmlWidget extends HtmlMultiWidget {
2168
1958
  */
2169
1959
  setErrorRedirectUrl(url: string): void;
2170
1960
  /**
2171
- * Set list with widget form field, which will be shown in form. Also you can set the required validation for these fields
1961
+ * Set list with widget form field, which will be shown in form. Also you can set the required validation for these fields
1962
+ *
1963
+ * @example
1964
+ * widget.setFormFields(['phone', 'email', 'first_name*']);
1965
+ *
1966
+ * @param {string[]} fields - name of fields which can be shown in a widget.
1967
+ * If after a name of a field, you put “*”, this field will be required on client-side. (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) [FORM_FIELD]{@link FORM_FIELD}
1968
+ */
1969
+ setFormFields(fields: string[]): void;
1970
+ /**
1971
+ * The method to set the full configuration for the all specific form elements (visibility, required, label, placeholder, value)
1972
+ * You can also use the other method for the partial configuration like: setFormFields, setFormValues, setFormPlaceholder, setFormLabel
1973
+ *
1974
+ * @example
1975
+ * widget.setFormElements([
1976
+ * {
1977
+ * field: 'card_name*',
1978
+ * placeholder: 'Input your card holder name...',
1979
+ * label: 'Card Holder Name',
1980
+ * value: 'Houston',
1981
+ * },
1982
+ * {
1983
+ * field: 'email',
1984
+ * placeholder: 'Input your email, like test@example.com',
1985
+ * label: 'Email for the receipt',
1986
+ * value: 'predefined@email.com',
1987
+ * },
1988
+ * ])
1989
+ *
1990
+ * @param { Object[] } elements - List of elements
1991
+ * @param { string } elements[].field - Field name of element. If after a name of a field, you put “*”, this field will be required on client-side. (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) [FORM_FIELD]{@link FORM_FIELD}
1992
+ * @param { string } elements[].placeholder - Set custom placeholders in form fields
1993
+ * @param { string } elements[].label - Set a custom labels near the form field
1994
+ * @param { string } elements[].value - Set predefined values for the form field
1995
+ */
1996
+ setFormElements(elements: IFormElement[]): void;
1997
+ setFormElement(element: IFormElement): void;
1998
+ /**
1999
+ * The method to set meta information for the checkout page
2000
+ *
2001
+ * @example
2002
+ * config.setMeta({
2003
+ brand_name: 'paydock',
2004
+ reference: '15',
2005
+ email: 'wault@paydock.com'
2006
+ });
2007
+ *
2008
+ * @param {IPayPalMeta | IBamboraMeta} object - data which can be shown on checkout page [IPayPalMeta]{@link IPayPalMeta} [IBamboraMeta]{@link IBamboraMeta}
2009
+ */
2010
+ setMeta(meta: IPayPalMeta | IBamboraMeta): void;
2011
+ setGiftCardScheme(giftCardScheme: any, processingNetwork: any): void;
2012
+ disableResultMessage(): void;
2013
+ }
2014
+
2015
+ /**
2016
+ * Top-level classification of an error. Used by the SDK to route errors to the
2017
+ * right category in instrumentation and to give consumers a coarse-grained
2018
+ * tag for grouping/filtering. See {@link getErrorCategory} for the mapping
2019
+ * between {@link ERROR_CAUSE} and {@link ERROR_CATEGORY}.
2020
+ */
2021
+ declare const ERROR_CATEGORY: {
2022
+ /** SDK was misconfigured (missing keys, invalid options, etc.). */
2023
+ readonly CONFIGURATION: "configuration";
2024
+ /** Authentication or authorization failure. */
2025
+ readonly IDENTITY: "identity_access_management";
2026
+ /** SDK internal failure or upstream service problem. */
2027
+ readonly INTERNAL: "internal";
2028
+ /** Flow lifecycle event (user cancelled, aborted, etc.) — not a real fault. */
2029
+ readonly PROCESS: "process";
2030
+ /** Resource lookup failed or was rate-limited. */
2031
+ readonly RESOURCE: "resource";
2032
+ /** Invalid input or business-rule validation failure. */
2033
+ readonly VALIDATION: "validation";
2034
+ };
2035
+ type ErrorCategory = (typeof ERROR_CATEGORY)[keyof typeof ERROR_CATEGORY];
2036
+ /**
2037
+ * Concrete cause of an error. More specific than {@link ERROR_CATEGORY} —
2038
+ * useful for deciding programmatic responses (e.g. show a retry button only
2039
+ * when `cause` is `'service_unreachable'` or `'server_busy'`).
2040
+ */
2041
+ declare const ERROR_CAUSE: {
2042
+ /** Operation was aborted programmatically. */
2043
+ readonly ABORTED: "aborted";
2044
+ /** Caller has insufficient permissions for the operation. */
2045
+ readonly ACCESS_FORBIDDEN: "access_forbidden";
2046
+ /** Resource already exists when create was expected. */
2047
+ readonly ALREADY_EXISTS: "already_exists";
2048
+ /** User cancelled the flow (e.g. closed the wallet sheet). */
2049
+ readonly CANCELED: "canceled";
2050
+ /** SDK was instantiated or invoked with invalid configuration. */
2051
+ readonly INVALID_CONFIGURATION: "invalid_configuration";
2052
+ /** Input failed structural or business-rule validation. */
2053
+ readonly INVALID_INPUT: "invalid_input";
2054
+ /** Resource was not found by the backend. */
2055
+ readonly NOT_FOUND: "not_found";
2056
+ /** Operation is not supported in the current context or version. */
2057
+ readonly NOT_IMPLEMENTED: "not_implemented";
2058
+ /** Caller exceeded the allowed request rate. */
2059
+ readonly RATE_LIMITED: "rate_limited";
2060
+ /** Backend is healthy but currently overloaded — typically retryable. */
2061
+ readonly SERVER_BUSY: "server_busy";
2062
+ /** Backend or third-party service could not be reached — typically retryable. */
2063
+ readonly SERVICE_UNREACHABLE: "service_unreachable";
2064
+ /** Caller is not authenticated. */
2065
+ readonly UNAUTHORIZED: "unauthorized";
2066
+ /** Catch-all when no other cause applies. */
2067
+ readonly UNKNOWN: "unknown_error";
2068
+ /** Request was syntactically valid but semantically rejected. */
2069
+ readonly UNPROCESSABLE_ENTITY: "unprocessable_entity";
2070
+ };
2071
+ type ErrorCause = (typeof ERROR_CAUSE)[keyof typeof ERROR_CAUSE];
2072
+ /**
2073
+ * Diagnostic detail attached to every {@link IEventError}.
2074
+ * Useful for logging, surfacing user-facing messages, and correlating with
2075
+ * server-side logs via `contextId`.
2076
+ */
2077
+ interface ErrorDetails {
2078
+ /** Concrete cause classification (mirrors the top-level `cause` on `IEventError`). */
2079
+ cause: ErrorCause;
2080
+ /** Correlation identifier — typically a request id or trace id from the backend. Empty string when none is available. */
2081
+ contextId: string;
2082
+ /** Human-readable message safe to surface to developers (NOT necessarily safe for end-users). */
2083
+ message: string;
2084
+ /** ISO 8601 UTC timestamp captured at error creation time. */
2085
+ timestamp: string;
2086
+ }
2087
+ /**
2088
+ * Standard error envelope emitted by the SDK on event payloads (`IEventData.error`)
2089
+ * and exposed publicly so integrators can `instanceof`/structurally narrow against it.
2090
+ */
2091
+ interface IEventError {
2092
+ /** Concrete cause of the error. See {@link ERROR_CAUSE} for the full list. */
2093
+ cause: ErrorCause;
2094
+ /** Coarse-grained category derived from `cause`. See {@link ERROR_CATEGORY}. */
2095
+ category: ErrorCategory;
2096
+ /** Whether the operation can be retried as-is. Must be set explicitly by the producer; `EventError.create()` defaults it to `false`. The intended candidates for `true` are transient causes such as `service_unreachable` and `server_busy`. */
2097
+ retryable: boolean;
2098
+ /** Diagnostic detail (message, timestamp, correlation id). */
2099
+ details: ErrorDetails;
2100
+ }
2101
+
2102
+ type AgentPrototype = Pick<(typeof MicroAgent)['prototype'], 'addPageAction' | 'noticeError'>;
2103
+ type AgentMethodNames = keyof AgentPrototype;
2104
+ type AgentMethodParameters<T extends AgentMethodNames> = Parameters<AgentPrototype[T]>;
2105
+ type InstrumentationClient = {
2106
+ call<T extends AgentMethodNames>(method: T, ...args: AgentMethodParameters<T>): void;
2107
+ };
2108
+ declare class InstrumentationAgent extends MicroAgent {
2109
+ private static agent;
2110
+ private static available;
2111
+ private static initialized;
2112
+ private static readonly noopClient;
2113
+ private constructor();
2114
+ static get instance(): InstrumentationClient;
2115
+ isAvailable(): boolean;
2116
+ call: <T extends "addPageAction" | "noticeError">(method: T, ...args: AgentMethodParameters<T>) => void;
2117
+ }
2118
+
2119
+ interface CustomEventDTO {
2120
+ environment: string;
2121
+ appId?: never;
2122
+ timestamp?: never;
2123
+ [x: string]: unknown;
2124
+ }
2125
+ interface ReportBaseContext {
2126
+ sdkVersion: string | null;
2127
+ description?: string;
2128
+ environment?: string;
2129
+ [x: string]: SerializableValue | undefined;
2130
+ }
2131
+ type SerializableValue = string | number | symbol | object | null;
2132
+
2133
+ type ReportErrorFn = (repository: ErrorRepository, error: string | Error, ctx: ReportBaseContext & ({
2134
+ className: string;
2135
+ classMethod: string;
2136
+ functionName?: never;
2137
+ } | {
2138
+ className?: never;
2139
+ classMethod?: never;
2140
+ functionName: string;
2141
+ })) => void;
2142
+ declare class ErrorRepository {
2143
+ private readonly agent;
2144
+ constructor();
2145
+ createError(...args: Parameters<InstrumentationAgent['noticeError']>): Promise<void>;
2146
+ }
2147
+
2148
+ type ReportEventFn = (repository: EventRepository, actionName: string, ctx: ReportBaseContext & CustomEventDTO) => void;
2149
+ declare class EventRepository {
2150
+ private readonly agent;
2151
+ constructor();
2152
+ createEvent(...args: Parameters<InstrumentationAgent['addPageAction']>): Promise<void>;
2153
+ }
2154
+
2155
+ declare enum API_AUTH_TYPE {
2156
+ PUBLIC_KEY = 0,
2157
+ TOKEN = 1
2158
+ }
2159
+ declare class ApiBase {
2160
+ protected env: Env;
2161
+ auth: string;
2162
+ authType: API_AUTH_TYPE;
2163
+ constructor(auth: string, authType?: API_AUTH_TYPE);
2164
+ /**
2165
+ * Current method can change environment. By default environment = sandbox.
2166
+ * Also we can change domain alias for this environment. By default domain_alias = paydock.com
2167
+ *
2168
+ * @example
2169
+ * widget.setEnv('production');
2170
+ * @param {string} env - sandbox, production
2171
+ * @param {string} [alias] - Own domain alias
2172
+ */
2173
+ setEnv(env: string, alias?: string): ApiBase;
2174
+ requestObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req): Observable<Res>;
2175
+ private makeRequest;
2176
+ private onRequestLoad;
2177
+ private onRequestError;
2178
+ setAuthType(): API_AUTH_TYPE;
2179
+ getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
2180
+ config: XMLHttpRequest;
2181
+ send: (body: any, cb?: (data) => void, errorCb?: (data: any) => any) => void;
2182
+ };
2183
+ getClientPromise<Req extends object, Res>(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
2184
+ config: XMLHttpRequest;
2185
+ send: (body: Req) => Promise<Res>;
2186
+ };
2187
+ parser({ text, status }: {
2188
+ text: string;
2189
+ status: number;
2190
+ }, cb: any, errorCb: any): any;
2191
+ parserPromise<Res>({ text, status }: {
2192
+ text: string;
2193
+ status: number;
2194
+ }): Promise<Res>;
2195
+ /**
2196
+ * Wires the XHR failure events that `onload` does not cover. `onload` only
2197
+ * fires when an HTTP response is received (any status, including 4xx/5xx);
2198
+ * transport-level failures — a dropped connection, a failed CORS preflight,
2199
+ * an HTTP/2 protocol error, or a timeout — fire `onerror`/`ontimeout`/
2200
+ * `onabort` instead. Without these the request never settles and fails
2201
+ * silently (e.g. `onUnavailable` is never invoked for wallet callbacks).
2202
+ */
2203
+ protected attachFailureHandlers(request: XMLHttpRequest, onFailure: (error: {
2204
+ message: string;
2205
+ code: ErrorCause;
2206
+ }) => void): void;
2207
+ reportEvent: ReportEventFn;
2208
+ reportError: ReportErrorFn;
2209
+ protected newApiRequest(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): XMLHttpRequest;
2210
+ get ctx(): {
2211
+ sdkVersion: string;
2212
+ className: string;
2213
+ environment: string;
2214
+ };
2215
+ }
2216
+
2217
+ /**
2218
+ * Interface for browser details response.
2219
+ * @interface BrowserDetails
2220
+ *
2221
+ * @param {string} [name]
2222
+ * @param {string} [java_enabled]
2223
+ * @param {string} [language]
2224
+ * @param {string} [screen_height]
2225
+ * @param {string} [screen_width]
2226
+ * @param {string} [time_zone]
2227
+ * @param {string} [color_depth]
2228
+ * */
2229
+ interface BrowserDetails {
2230
+ name: string;
2231
+ java_enabled: string;
2232
+ language: string;
2233
+ screen_height: string;
2234
+ screen_width: string;
2235
+ time_zone: string;
2236
+ color_depth: string;
2237
+ }
2238
+ /**
2239
+ * Class Api include method for working with paydock api
2240
+ * @constructor
2241
+ *
2242
+ * @param {string} publicKey - PayDock users public key
2243
+ * @example
2244
+ * var api = new Api('publicKey');
2245
+ *
2246
+ *
2247
+ **/
2248
+ declare class Api extends ApiBase {
2249
+ publicKey: String;
2250
+ /** @constructs */ constructor(publicKey: string);
2251
+ /**
2252
+ * Method for getting browser details
2172
2253
  *
2173
2254
  * @example
2174
- * widget.setFormFields(['phone', 'email', 'first_name*']);
2255
+ * api.getBrowserDetails();
2175
2256
  *
2176
- * @param {string[]} fields - name of fields which can be shown in a widget.
2177
- * If after a name of a field, you put “*”, this field will be required on client-side. (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) [FORM_FIELD]{@link FORM_FIELD}
2257
+ * @return {BrowserDetails} Browser details object
2178
2258
  */
2179
- setFormFields(fields: string[]): void;
2259
+ getBrowserDetails(): BrowserDetails;
2180
2260
  /**
2181
- * The method to set the full configuration for the all specific form elements (visibility, required, label, placeholder, value)
2182
- * You can also use the other method for the partial configuration like: setFormFields, setFormValues, setFormPlaceholder, setFormLabel
2261
+ * Current method allows to work with charge related endpoints
2183
2262
  *
2184
2263
  * @example
2185
- * widget.setFormElements([
2186
- * {
2187
- * field: 'card_name*',
2188
- * placeholder: 'Input your card holder name...',
2189
- * label: 'Card Holder Name',
2190
- * value: 'Houston',
2191
- * },
2192
- * {
2193
- * field: 'email',
2194
- * placeholder: 'Input your email, like test@example.com',
2195
- * label: 'Email for the receipt',
2196
- * value: 'predefined@email.com',
2197
- * },
2198
- * ])
2199
- *
2200
- * @param { Object[] } elements - List of elements
2201
- * @param { string } elements[].field - Field name of element. If after a name of a field, you put “*”, this field will be required on client-side. (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) [FORM_FIELD]{@link FORM_FIELD}
2202
- * @param { string } elements[].placeholder - Set custom placeholders in form fields
2203
- * @param { string } elements[].label - Set a custom labels near the form field
2204
- * @param { string } elements[].value - Set predefined values for the form field
2264
+ * api.charge();
2205
2265
  */
2206
- setFormElements(elements: IFormElement[]): void;
2207
- setFormElement(element: IFormElement): void;
2208
- /**
2209
- * The method to set meta information for the checkout page
2210
- *
2211
- * @example
2212
- * config.setMeta({
2213
- brand_name: 'paydock',
2214
- reference: '15',
2215
- email: 'wault@paydock.com'
2216
- });
2217
- *
2218
- * @param {IPayPalMeta | IBamboraMeta} object - data which can be shown on checkout page [IPayPalMeta]{@link IPayPalMeta} [IBamboraMeta]{@link IBamboraMeta}
2219
- */
2220
- setMeta(meta: IPayPalMeta | IBamboraMeta): void;
2221
- setGiftCardScheme(giftCardScheme: any, processingNetwork: any): void;
2222
- disableResultMessage(): void;
2266
+ charge(): ApiCharge;
2223
2267
  }
2224
2268
 
2225
2269
  /**
2226
- * Contains basic information associated with the event.
2227
- *
2228
- * Including event (name), source of the message, purpose and a unique identifier
2229
- * for the event.
2230
- *
2231
- * @interface IEventData
2270
+ * Decoded payload of the Standalone 3DS charge token (the JWT body) the SDK
2271
+ * receives in `Canvas3ds`'s constructor when the token format is `standalone_3ds`.
2232
2272
  *
2233
- * @param {string} event The name of the event.
2234
- * @param {string} message_source A system variable that identifies the event source.
2235
- * @param {string} purpose A system variable that states the purpose of the event.
2236
- * @param {string} [ref_id] Custom unique value that identifies result of processed operation.
2273
+ * This shape is set by the Paydock backend when minting the token. Integrators
2274
+ * who decode the token themselves can use this interface to type the result.
2237
2275
  */
2238
- interface IEventData$1 {
2239
- event: string;
2240
- message_source: string;
2241
- purpose: PURPOSE;
2242
- widget_id: string;
2243
- data?: any;
2244
- ref_id?: string;
2245
- error?: IEventError;
2246
- }
2247
- declare const EVENT$3: {
2248
- readonly AFTER_LOAD: "afterLoad";
2249
- readonly SUBMIT: "submit";
2250
- readonly FINISH: "finish";
2251
- readonly VALIDATION_ERROR: "validationError";
2252
- readonly SYSTEM_ERROR: "systemError";
2253
- readonly ERROR: "error";
2254
- /** @deprecated */
2255
- readonly CHECKOUT_SUCCESS: "checkoutSuccess";
2256
- readonly CHECKOUT_READY: "checkoutReady";
2257
- readonly CHECKOUT_ERROR: "checkoutError";
2258
- readonly CHECKOUT_COMPLETED: "checkoutCompleted";
2259
- readonly CHECKOUT_POPUP_OPEN: "checkoutPopupOpen";
2260
- readonly CHECKOUT_POPUP_CLOSE: "checkoutPopupClose";
2261
- readonly RECOGNITION_TOKEN_REQUESTED: "recognitionTokenRequested";
2262
- readonly RECOGNITION_TOKEN_DROPPED: "recognitionTokenDropped";
2263
- readonly VALIDATION: "validation";
2264
- readonly SELECT: "select";
2265
- readonly UNSELECT: "unselect";
2266
- readonly NEXT: "next";
2267
- readonly PREV: "prev";
2268
- readonly META_CHANGE: "metaChange";
2269
- readonly RESIZE: "resize";
2270
- readonly CHARGE_AUTH_SUCCESS: "chargeAuthSuccess";
2271
- readonly CHARGE_AUTH_REJECT: "chargeAuthReject";
2272
- readonly CHARGE_AUTH_CANCELLED: "chargeAuthCancelled";
2273
- readonly ADDITIONAL_DATA_SUCCESS: "additionalDataCollectSuccess";
2274
- readonly ADDITIONAL_DATA_REJECT: "additionalDataCollectReject";
2275
- readonly CHARGE_AUTH: "chargeAuth";
2276
- readonly DISPATCH_SUCCESS: "dispatchSuccess";
2277
- readonly DISPATCH_ERROR: "dispatchError";
2278
- };
2279
- type EventTypes = typeof EVENT$3[keyof typeof EVENT$3];
2280
- interface Listener {
2281
- event: string;
2282
- listener: (event: any) => void;
2283
- widget_id: string;
2276
+ interface ITokenStandalone3DS {
2277
+ /** Optional merchant-side correlation identifier carried through from the original charge request. */
2278
+ external_id?: string;
2279
+ /** URL of the first iframe the SDK loads to bootstrap the 3DS provider's authentication flow. */
2280
+ initialization_url: string;
2281
+ /**
2282
+ * @deprecated No longer read by the Standalone 3DS flow. The field is kept
2283
+ * on the interface for backwards compatibility with tokens minted by older
2284
+ * API versions; it will be removed in a future major release. Prefer
2285
+ * `initialization_url` + `secondary_url`.
2286
+ */
2287
+ authorization_url?: string;
2288
+ /** Optional URL of a secondary iframe used by some providers (e.g. GPayments) for monitoring/polling alongside the main flow. */
2289
+ secondary_url?: string;
2290
+ /** The Paydock 3DS charge identifier this token authorizes. Echoed back in every event payload emitted during the flow. */
2291
+ charge_3ds_id: string;
2292
+ /** Identifier of the 3DS gateway the SDK should delegate to. Currently only `'GPayments'` is handled; other values fall through. */
2293
+ service_type: string;
2284
2294
  }
2285
- declare type Listeners = Listener[];
2286
- declare class IFrameEvent {
2287
- protected listeners: Listeners;
2288
- constructor(subject: Window | null);
2289
- emit(data: IEventData$1): void;
2290
- on<T>(eventName: string, widgetId: string, cb: (data: T) => void): void;
2291
- clear(): void;
2292
- private subscribe;
2295
+ declare class Standalone3dsService {
2296
+ protected container: Container;
2297
+ protected eventEmitter: EventEmitter;
2298
+ protected env: string;
2299
+ protected alias: string;
2300
+ constructor(container: Container, eventEmitter: any);
2301
+ load(token: string, options: {
2302
+ title: string;
2303
+ }): void;
2304
+ setEnv(env: string, alias?: string): void;
2293
2305
  }
2294
2306
 
2295
2307
  /**
@@ -3770,6 +3782,77 @@ declare enum ERROR_OPERATION {
3770
3782
  SHIPPING_UPDATE = "shipping_update"
3771
3783
  }
3772
3784
 
3785
+ /**
3786
+ * Base options shared by every wallet's static availability check
3787
+ * (e.g. `ApplePayOpenWalletButton.checkAvailability`). Wallet-specific option
3788
+ * interfaces extend this with their own fields.
3789
+ */
3790
+ interface OpenWalletAvailabilityOptions {
3791
+ /** Public key or access token used to fetch the service config when needed. */
3792
+ public_key_or_access_token?: string;
3793
+ /** Service ID — used with `public_key_or_access_token` to resolve the wallet configuration. */
3794
+ service_id?: string;
3795
+ /** Environment for the config fetch (e.g. `'sandbox'`). Defaults to the SDK default. */
3796
+ env?: string;
3797
+ /**
3798
+ * When `true`, performs only the cheap, network-free synchronous check and resolves
3799
+ * immediately — no config fetch, SDK load, or remote capability query.
3800
+ */
3801
+ sync?: boolean;
3802
+ }
3803
+ /**
3804
+ * Base result shared by every wallet's static availability check. Wallet-specific
3805
+ * result interfaces extend this with their own fields.
3806
+ */
3807
+ interface OpenWalletAvailabilityResult {
3808
+ /** Convenience verdict: the wallet is usable for a payment in the current context. */
3809
+ available: boolean;
3810
+ /** Whether the wallet is supported here at all (may be available via a fallback flow). */
3811
+ supported: boolean;
3812
+ /** Machine-readable reason when not available. */
3813
+ reason?: string;
3814
+ }
3815
+
3816
+ /**
3817
+ * Friendly capability tokens accepted as **input** — the same values used in
3818
+ * `ApplePayOpenWalletMeta.apple_pay_capabilities`. They declare which device
3819
+ * credential statuses should be treated as "available".
3820
+ */
3821
+ type ApplePayCapabilityToken = 'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable';
3822
+ /**
3823
+ * Device-reported credential status — the **output** of
3824
+ * `ApplePaySession.applePayCapabilities()`.
3825
+ */
3826
+ type ApplePayCredentialStatus = 'paymentCredentialsAvailable' | 'paymentCredentialStatusUnknown' | 'paymentCredentialsUnavailable' | 'applePayUnsupported';
3827
+ /**
3828
+ * Options for `ApplePayOpenWalletButton.checkAvailability`. Provide `merchant_id`
3829
+ * directly to skip the network call, **or** provide `public_key_or_access_token` +
3830
+ * `service_id` to have the SDK resolve the merchant identifier from the service config.
3831
+ */
3832
+ interface ApplePayAvailabilityOptions extends OpenWalletAvailabilityOptions {
3833
+ /** Apple merchant identifier. Provide this OR (`public_key_or_access_token` + `service_id`). */
3834
+ merchant_id?: string;
3835
+ /**
3836
+ * Device credential statuses that count as available. Defaults to
3837
+ * `['credentials_available', 'credentials_status_unknown']` — `credentials_status_unknown`
3838
+ * is what third-party / cross-device (QR) browsers report, so the default keeps Apple Pay
3839
+ * visible outside Safari.
3840
+ */
3841
+ apple_pay_capabilities?: ApplePayCapabilityToken[];
3842
+ }
3843
+ /** Result of `ApplePayOpenWalletButton.checkAvailability`. */
3844
+ interface ApplePayAvailabilityResult extends OpenWalletAvailabilityResult {
3845
+ /**
3846
+ * Whether a **native, same-device** Apple Pay session is present right now
3847
+ * (`ApplePaySession` exists and `canMakePayments()` is `true`). Apple does not expose
3848
+ * the transport directly, so use this to infer it: `available && has_native_session` ⇒
3849
+ * native sheet likely; `available && !has_native_session` ⇒ cross-device / QR handoff likely.
3850
+ */
3851
+ has_native_session: boolean;
3852
+ /** The raw device-reported credential status. Undefined when unsupported or not queried. */
3853
+ payment_credential_status?: ApplePayCredentialStatus;
3854
+ }
3855
+
3773
3856
  /**
3774
3857
  * Events emitted during the OpenWallet payment lifecycle.
3775
3858
  */
@@ -3921,6 +4004,30 @@ interface OnCancelEventData extends OpenWalletBaseEvent {
3921
4004
  event: EVENT$1.CHECKOUT_CLOSE;
3922
4005
  }
3923
4006
 
4007
+ /**
4008
+ * Options for `GooglePayOpenWalletButton.checkAvailability`. Extends
4009
+ * {@link OpenWalletAvailabilityOptions}. All fields are optional — Google Pay's
4010
+ * `isReadyToPay` check does not require a merchant identifier. Provide
4011
+ * `public_key_or_access_token` + `service_id` to validate that the service is a Google Pay
4012
+ * service (and resolve the merchant id), or `merchant_id` directly.
4013
+ */
4014
+ interface GooglePayAvailabilityOptions extends OpenWalletAvailabilityOptions {
4015
+ /**
4016
+ * Google Pay gateway merchant identifier. Optional — `isReadyToPay` does not require it;
4017
+ * when omitted the readiness check still runs.
4018
+ */
4019
+ merchant_id?: string;
4020
+ }
4021
+ /** Result of `GooglePayOpenWalletButton.checkAvailability`. */
4022
+ interface GooglePayAvailabilityResult extends OpenWalletAvailabilityResult {
4023
+ /**
4024
+ * Google's `isReadyToPay` `paymentMethodPresent` — whether the buyer already has a
4025
+ * payment method usable with Google Pay. `undefined` when not reported (e.g. the
4026
+ * synchronous check, or browsers where it is not surfaced).
4027
+ */
4028
+ payment_method_present?: boolean;
4029
+ }
4030
+
3924
4031
  /**
3925
4032
  * Base metadata required to configure an OpenWallet button.
3926
4033
  */
@@ -4189,6 +4296,16 @@ declare abstract class OpenWalletButtons<TMeta extends OpenWalletMeta = OpenWall
4189
4296
  abstract readonly walletType: WalletType;
4190
4297
  /** @private */
4191
4298
  constructor(selector: string, publicKeyOrAccessToken: string, serviceId: string, meta: TMeta);
4299
+ /**
4300
+ * Invalidates the cached service configuration whenever an error or unavailable
4301
+ * event fires, so the next `load()` re-fetches a fresh config. The cache is keyed
4302
+ * on the service ID with a 1-day TTL; clearing it on failure means a config that
4303
+ * changed server-side (and caused the failure) is not reused until the TTL expires.
4304
+ * Registered once per button, independently of any merchant-registered handlers.
4305
+ *
4306
+ * @private
4307
+ */
4308
+ private registerCacheInvalidationOnError;
4192
4309
  /**
4193
4310
  * Creates the wallet-specific service instance for this button.
4194
4311
  * Each concrete subclass implements this to instantiate its specific wallet service.
@@ -5050,11 +5167,6 @@ type ApplePayButtonStyle$1 = 'black' | 'white' | 'white-outline';
5050
5167
 
5051
5168
  type ApplePayButtonType$1 = 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'plain' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up';
5052
5169
 
5053
- declare global {
5054
- interface Window {
5055
- ApplePaySession: ApplePaySession;
5056
- }
5057
- }
5058
5170
  /** Styling configuration for the Apple Pay button. */
5059
5171
  interface ApplePayOpenWalletMetaStyles extends OpenWalletMetaStyles {
5060
5172
  /** Variant displayed on the button (e.g. `'buy'`, `'donate'`, `'plain'`, `'check-out'`). */
@@ -5115,12 +5227,24 @@ interface ApplePayOpenWalletMeta extends OpenWalletMeta, Omit<ApplePayPaymentReq
5115
5227
  /** Visual styling for the Apple Pay button. */
5116
5228
  style?: ApplePayOpenWalletMetaStyles;
5117
5229
  /**
5118
- * Device capabilities allowed for the wallet button to be considered available.
5119
- * Used as a relaxation knob for testing — defaults to `['paymentCredentialsAvailable']` only.
5230
+ * Device credential statuses that make the button render. Defaults to
5231
+ * `['credentials_available', 'credentials_status_unknown']`:
5232
+ * - `credentials_available` — the device has a confirmed Apple Pay card ready to use.
5233
+ * - `credentials_status_unknown` — a local card can't be confirmed, but Apple Pay can
5234
+ * still proceed (e.g. the cross-device flow where the buyer completes payment on their
5235
+ * iPhone via QR, used by Chrome, Edge and Firefox).
5236
+ * The button renders when the device's reported status is in this list. Narrow to
5237
+ * `['credentials_available']` to require a confirmed local card.
5120
5238
  */
5121
5239
  apple_pay_capabilities?: Array<'credentials_available' | 'credentials_status_unknown' | 'credentials_unavailable'>;
5122
5240
  }
5123
5241
 
5242
+ declare global {
5243
+ interface Window {
5244
+ ApplePaySession: ApplePaySession;
5245
+ }
5246
+ }
5247
+
5124
5248
  /**
5125
5249
  * @classdesc Apple Pay wallet button that creates One-Time Tokens (OTT) via Apple Pay.
5126
5250
  *
@@ -5159,6 +5283,46 @@ interface ApplePayOpenWalletMeta extends OpenWalletMeta, Omit<ApplePayPaymentReq
5159
5283
  declare class ApplePayOpenWalletButton extends OpenWalletButtons<ApplePayOpenWalletMeta> {
5160
5284
  /** @private */
5161
5285
  readonly walletType: WalletType;
5286
+ /**
5287
+ * Checks Apple Pay availability **without instantiating the button** — the single,
5288
+ * authoritative, cross-browser-aware availability entry point.
5289
+ *
5290
+ * Resolves the merchant identifier (either supplied directly or fetched from the
5291
+ * service configuration), loads Apple's web SDK if needed, then queries
5292
+ * `ApplePaySession.applePayCapabilities()`. Returns a convenience `available` verdict
5293
+ * (computed against `apple_pay_capabilities`), the raw device-reported
5294
+ * `payment_credential_status`, and `has_native_session` so callers can infer the transport:
5295
+ * `available && has_native_session` ⇒ native sheet likely; `available && !has_native_session`
5296
+ * ⇒ cross-device / QR handoff likely.
5297
+ *
5298
+ * Pass `{ sync: true }` for a cheap, network-free native same-device pre-check that
5299
+ * resolves immediately (see {@link ApplePayAvailabilityOptions.sync}).
5300
+ *
5301
+ * @param {ApplePayAvailabilityOptions} [options] - Merchant context, allowed capabilities, and mode.
5302
+ * @returns {Promise<ApplePayAvailabilityResult>} The availability result.
5303
+ *
5304
+ * @example
5305
+ * // Lightest path — no network, when you already know the merchant identifier:
5306
+ * const result = await ApplePayOpenWalletButton.checkAvailability({ merchant_id });
5307
+ *
5308
+ * @example
5309
+ * // Resolve the merchant identifier from the service configuration:
5310
+ * const result = await ApplePayOpenWalletButton.checkAvailability({
5311
+ * public_key_or_access_token,
5312
+ * service_id,
5313
+ * env: 'sandbox',
5314
+ * });
5315
+ * if (result.available) {
5316
+ * // Render the Apple Pay button (native sheet or cross-device QR, per has_native_session).
5317
+ * } else {
5318
+ * console.log('Unavailable:', result.reason, result.payment_credential_status);
5319
+ * }
5320
+ *
5321
+ * @example
5322
+ * // Synchronous native-only fast check (no network / SDK load):
5323
+ * const { has_native_session } = await ApplePayOpenWalletButton.checkAvailability({ sync: true });
5324
+ */
5325
+ static checkAvailability(options?: ApplePayAvailabilityOptions): Promise<ApplePayAvailabilityResult>;
5162
5326
  /**
5163
5327
  * Validates Apple Pay-specific required metadata fields.
5164
5328
  * Apple Pay requires `amount_label` and `store_name` to be present and strings.
@@ -5330,6 +5494,38 @@ interface GooglePayCardConfig {
5330
5494
  declare class GooglePayOpenWalletButton extends OpenWalletButtons<GooglePayOpenWalletMeta> {
5331
5495
  /** @private */
5332
5496
  readonly walletType: WalletType;
5497
+ /**
5498
+ * Checks Google Pay availability **without instantiating the button** — the static
5499
+ * availability entry point.
5500
+ *
5501
+ * Loads the Google Pay JS SDK if needed, then runs `PaymentsClient.isReadyToPay()` using
5502
+ * the **default** card configuration (a button instance with a custom `card_config` may
5503
+ * produce a different result). All options are optional — unlike Apple Pay, Google Pay's
5504
+ * readiness check does not require a merchant identifier; supplying `service_id` +
5505
+ * `public_key_or_access_token` additionally validates that the service is a Google Pay service.
5506
+ *
5507
+ * Pass `{ sync: true }` for a cheap, network-free check that only reports whether the
5508
+ * Google Pay JS API is already present (see {@link GooglePayAvailabilityOptions.sync}).
5509
+ *
5510
+ * @param {GooglePayAvailabilityOptions} [options] - Optional merchant context and mode.
5511
+ * @returns {Promise<GooglePayAvailabilityResult>} The availability result.
5512
+ *
5513
+ * @example
5514
+ * // Simplest form — no merchant context needed:
5515
+ * const result = await GooglePayOpenWalletButton.checkAvailability();
5516
+ * if (result.available) {
5517
+ * // Render the Google Pay button.
5518
+ * }
5519
+ *
5520
+ * @example
5521
+ * // Validate the service is a Google Pay service while checking:
5522
+ * const result = await GooglePayOpenWalletButton.checkAvailability({
5523
+ * public_key_or_access_token,
5524
+ * service_id,
5525
+ * env: 'sandbox',
5526
+ * });
5527
+ */
5528
+ static checkAvailability(options?: GooglePayAvailabilityOptions): Promise<GooglePayAvailabilityResult>;
5333
5529
  /**
5334
5530
  * Validates Google Pay-specific required metadata fields.
5335
5531
  * Google Pay has no additional required fields beyond the base (amount, currency, country).
@@ -7244,4 +7440,4 @@ declare global {
7244
7440
  }
7245
7441
 
7246
7442
  export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayOpenWalletButton, ApplePayWalletButtonExpress, CANVAS_3DS_EVENT, CHECKOUT_BUTTON_EVENT, EVENT$2 as CHECKOUT_EVENT, Canvas3ds, Canvas3dsTokenFormat, Checkout, CheckoutActionCode, ClickToPay, Configuration, ContactShippingEditingMode, ELEMENT, ERROR_OPERATION, EVENT$3 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD, FRAUD_PREVENTION_EVENTS, FraudPreventionService, GooglePayOpenWalletButton, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, InstructionDebugger, MultiWidget, OpenWalletButtons, PAYMENT_EXPIRED, PAYMENT_FAILURE, PAYMENT_SUCCESSFUL, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE, SUPPORTED_CARD_TYPES, TEXT, TOKEN_TYPE, TRIGGER, TYPE, VAULT_DISPLAY_STYLE, VaultDisplayWidget, EVENT as WALLET_BUTTONS_EXPRESS_EVENT, WALLET_TYPES, WalletButtons, ZipmoneyCheckoutButton };
7247
- export type { ApplePayButtonStyle, ApplePayButtonType, ApplePayOpenWalletMeta, ApplePayWalletMeta, AppleShippingType, BaseWalletMeta, Billing, Canvas3dsAuthPayload, Canvas3dsChargeAuthEventPayload, Canvas3dsErrorEventPayload, Canvas3dsErrorPayload, Canvas3dsEventMap, Canvas3dsEventName, CheckoutIntentTokenPayload, CheckoutPaymentExpiredPayload, CheckoutPaymentFailurePayload, CheckoutPaymentSuccessPayload, CheckoutResponse, CreateOTTData, CreateOTTRequest, CreateOTTResponse, CreateSessionRequest, CreateSessionResponse, EventTypes, FraudPreventionEvent, FraudPreventionEventType, FraudPreventionProvider, GooglePayCardConfig, GooglePayOpenWalletMeta, GooglePayOpenWalletMetaStyles, HandleResponseInterface, IApplePayShippingOption, ICheckout, IClickToPayMeta, IDetails, IElementStyleInput, IEventAfterLoadData, IEventCheckoutFinishData, IEventData$1 as IEventData, IEventError, IEventFinishData, IEventMetaData, IEventSizeData, IFormValidation, IOpenWalletProvider, IPayPalMeta, IStyles$1 as IStyles, ITexts, ITokenStandalone3DS, IWalletMeta, IWalletOnClickEvent, IWalletPaymentSuccessfulEvent, IWalletUnavailableEvent, IWalletUpdateData, IWalletUpdateEvent, OTTResponse, OnCancelEventData, OnClickEventData$1 as OnClickEventData, OnCreateOTTErrorEventData, OnCreateOTTErrorPayload, OnCreateOTTSuccessPayload, OnCreateOTTSuccessfulEventData, OnErrorEventData$1 as OnErrorEventData, OnErrorPayload, OnLoadedEventData, OnUnavailableDetails, OnUnavailableEventData$1 as OnUnavailableEventData, OnUnavailablePayload, OpenWalletBaseEvent, OpenWalletDataEvent, OpenWalletEventType, OpenWalletMeta, PaypalWalletMeta, ProcessAuthenticationResponse, Shipping, VaultDisplayStyle, OnClickEventData as WalletExpressOnClickEventData, OnCloseEventData as WalletExpressOnCloseEventData, OnErrorEventData as WalletExpressOnErrorEventData, OnPaymentErrorEventData as WalletExpressOnPaymentErrorEventData, OnPaymentInReviewEventData as WalletExpressOnPaymentInReviewEventData, OnPaymentSuccessfulEventData as WalletExpressOnPaymentSuccessfulEventData, OnShippingAddressChangeEventData as WalletExpressOnShippingAddressChangeEventData, OnShippingAddressChangeEventResponse as WalletExpressOnShippingAddressChangeEventResponse, OnShippingOptionChangeEventData as WalletExpressOnShippingOptionChangeEventData, OnShippingOptionChangeEventResponse as WalletExpressOnShippingOptionChangeEventResponse, OnUnavailableEventData as WalletExpressOnUnavailableEventData, WalletType, WidgetEventMap, WidgetEventName };
7443
+ export type { ApplePayAvailabilityOptions, ApplePayAvailabilityResult, ApplePayButtonStyle, ApplePayButtonType, ApplePayCapabilityToken, ApplePayCredentialStatus, ApplePayOpenWalletMeta, ApplePayWalletMeta, AppleShippingType, BaseWalletMeta, Billing, Canvas3dsAuthPayload, Canvas3dsChargeAuthEventPayload, Canvas3dsErrorEventPayload, Canvas3dsErrorPayload, Canvas3dsEventMap, Canvas3dsEventName, CheckoutIntentTokenPayload, CheckoutPaymentExpiredPayload, CheckoutPaymentFailurePayload, CheckoutPaymentSuccessPayload, CheckoutResponse, CreateOTTData, CreateOTTRequest, CreateOTTResponse, CreateSessionRequest, CreateSessionResponse, EventTypes, FraudPreventionEvent, FraudPreventionEventType, FraudPreventionProvider, GooglePayAvailabilityOptions, GooglePayAvailabilityResult, GooglePayCardConfig, GooglePayOpenWalletMeta, GooglePayOpenWalletMetaStyles, HandleResponseInterface, IApplePayShippingOption, ICheckout, IClickToPayMeta, IDetails, IElementStyleInput, IEventAfterLoadData, IEventCheckoutFinishData, IEventData$1 as IEventData, IEventError, IEventFinishData, IEventMetaData, IEventSizeData, IFormValidation, IOpenWalletProvider, IPayPalMeta, IStyles$1 as IStyles, ITexts, ITokenStandalone3DS, IWalletMeta, IWalletOnClickEvent, IWalletPaymentSuccessfulEvent, IWalletUnavailableEvent, IWalletUpdateData, IWalletUpdateEvent, OTTResponse, OnCancelEventData, OnClickEventData$1 as OnClickEventData, OnCreateOTTErrorEventData, OnCreateOTTErrorPayload, OnCreateOTTSuccessPayload, OnCreateOTTSuccessfulEventData, OnErrorEventData$1 as OnErrorEventData, OnErrorPayload, OnLoadedEventData, OnUnavailableDetails, OnUnavailableEventData$1 as OnUnavailableEventData, OnUnavailablePayload, OpenWalletAvailabilityOptions, OpenWalletAvailabilityResult, OpenWalletBaseEvent, OpenWalletDataEvent, OpenWalletEventType, OpenWalletMeta, PaypalWalletMeta, ProcessAuthenticationResponse, Shipping, VaultDisplayStyle, OnClickEventData as WalletExpressOnClickEventData, OnCloseEventData as WalletExpressOnCloseEventData, OnErrorEventData as WalletExpressOnErrorEventData, OnPaymentErrorEventData as WalletExpressOnPaymentErrorEventData, OnPaymentInReviewEventData as WalletExpressOnPaymentInReviewEventData, OnPaymentSuccessfulEventData as WalletExpressOnPaymentSuccessfulEventData, OnShippingAddressChangeEventData as WalletExpressOnShippingAddressChangeEventData, OnShippingAddressChangeEventResponse as WalletExpressOnShippingAddressChangeEventResponse, OnShippingOptionChangeEventData as WalletExpressOnShippingOptionChangeEventData, OnShippingOptionChangeEventResponse as WalletExpressOnShippingOptionChangeEventResponse, OnUnavailableEventData as WalletExpressOnUnavailableEventData, WalletType, WidgetEventMap, WidgetEventName };