@paydock/client-sdk 1.144.0-beta → 1.144.1-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/bundles/index.cjs +467 -419
- package/bundles/index.cjs.d.ts +392 -380
- package/bundles/index.mjs +467 -419
- package/bundles/index.mjs.d.ts +392 -380
- package/bundles/types/api/api-base.d.ts +15 -2
- package/bundles/types/api/api-base.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts.map +1 -1
- package/bundles/widget.umd.js +467 -419
- package/bundles/widget.umd.js.d.ts +392 -380
- package/bundles/widget.umd.js.min.d.ts +392 -380
- package/bundles/widget.umd.min.js +1 -1
- package/package.json +6 -2
package/bundles/index.cjs.d.ts
CHANGED
|
@@ -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,23 +764,114 @@ declare class Configuration {
|
|
|
978
764
|
disableResultMessage(): void;
|
|
979
765
|
}
|
|
980
766
|
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
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;
|
|
986
786
|
}
|
|
787
|
+
|
|
987
788
|
/**
|
|
988
|
-
*
|
|
989
|
-
* @interface ITriggerData
|
|
789
|
+
* Contains basic information associated with the event.
|
|
990
790
|
*
|
|
991
|
-
*
|
|
992
|
-
*
|
|
993
|
-
*
|
|
994
|
-
* @
|
|
995
|
-
*
|
|
996
|
-
|
|
997
|
-
*
|
|
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
|
+
|
|
858
|
+
interface ITriggerData {
|
|
859
|
+
configuration_token?: string;
|
|
860
|
+
tab_number?: number;
|
|
861
|
+
elements?: string;
|
|
862
|
+
form_values?: string;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Interface for classes that represent a trigger data.
|
|
866
|
+
* @interface ITriggerData
|
|
867
|
+
*
|
|
868
|
+
* @param {string} [configuration_token]
|
|
869
|
+
* @param {string} [tab_number]
|
|
870
|
+
* @param {string} [elements]
|
|
871
|
+
* @param {string} [form_values]
|
|
872
|
+
* */
|
|
873
|
+
/**
|
|
874
|
+
* List of available triggers
|
|
998
875
|
*
|
|
999
876
|
* @type {object}
|
|
1000
877
|
* @param {string} SUBMIT_FORM=submit_form
|
|
@@ -1136,93 +1013,6 @@ interface IElementStyleTitleDescription {
|
|
|
1136
1013
|
margin?: string;
|
|
1137
1014
|
}
|
|
1138
1015
|
|
|
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;
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
1016
|
/**
|
|
1227
1017
|
*
|
|
1228
1018
|
* Class MultiWidget include method for for creating iframe url
|
|
@@ -2223,73 +2013,295 @@ declare class HtmlWidget extends HtmlMultiWidget {
|
|
|
2223
2013
|
}
|
|
2224
2014
|
|
|
2225
2015
|
/**
|
|
2226
|
-
*
|
|
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
|
|
2227
2220
|
*
|
|
2228
|
-
*
|
|
2229
|
-
*
|
|
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
|
|
2230
2241
|
*
|
|
2231
|
-
* @
|
|
2242
|
+
* @param {string} publicKey - PayDock users public key
|
|
2243
|
+
* @example
|
|
2244
|
+
* var api = new Api('publicKey');
|
|
2232
2245
|
*
|
|
2233
|
-
*
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
*/
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
+
*
|
|
2247
|
+
**/
|
|
2248
|
+
declare class Api extends ApiBase {
|
|
2249
|
+
publicKey: String;
|
|
2250
|
+
/** @constructs */ constructor(publicKey: string);
|
|
2251
|
+
/**
|
|
2252
|
+
* Method for getting browser details
|
|
2253
|
+
*
|
|
2254
|
+
* @example
|
|
2255
|
+
* api.getBrowserDetails();
|
|
2256
|
+
*
|
|
2257
|
+
* @return {BrowserDetails} Browser details object
|
|
2258
|
+
*/
|
|
2259
|
+
getBrowserDetails(): BrowserDetails;
|
|
2260
|
+
/**
|
|
2261
|
+
* Current method allows to work with charge related endpoints
|
|
2262
|
+
*
|
|
2263
|
+
* @example
|
|
2264
|
+
* api.charge();
|
|
2265
|
+
*/
|
|
2266
|
+
charge(): ApiCharge;
|
|
2246
2267
|
}
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
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;
|
|
2268
|
+
|
|
2269
|
+
/**
|
|
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`.
|
|
2272
|
+
*
|
|
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.
|
|
2275
|
+
*/
|
|
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
|
|
2286
|
-
|
|
2287
|
-
protected
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
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
|
/**
|