@paydock/client-sdk 1.108.1 → 1.108.2

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 (63) hide show
  1. package/README.md +29 -1
  2. package/bundles/index.cjs +28425 -7291
  3. package/bundles/index.cjs.d.ts +71 -5
  4. package/bundles/index.mjs +28425 -7291
  5. package/bundles/index.mjs.d.ts +71 -5
  6. package/bundles/types/api/api-base.d.ts +14 -6
  7. package/bundles/types/api/api-base.d.ts.map +1 -1
  8. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +3 -3
  9. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -1
  10. package/bundles/types/checkout-button/afterpay/afterpay.runner.d.ts +2 -0
  11. package/bundles/types/checkout-button/afterpay/afterpay.runner.d.ts.map +1 -1
  12. package/bundles/types/checkout-button/checkout-contextual-handler.d.ts +4 -0
  13. package/bundles/types/checkout-button/checkout-contextual-handler.d.ts.map +1 -1
  14. package/bundles/types/checkout-button/runner/contextual.runner.d.ts +2 -1
  15. package/bundles/types/checkout-button/runner/contextual.runner.d.ts.map +1 -1
  16. package/bundles/types/checkout-button/runner/popup.runner.d.ts +3 -3
  17. package/bundles/types/checkout-button/runner/popup.runner.d.ts.map +1 -1
  18. package/bundles/types/components/http-core.d.ts.map +1 -1
  19. package/bundles/types/components/param.d.ts +1 -0
  20. package/bundles/types/components/param.d.ts.map +1 -1
  21. package/bundles/types/configs/env/environment.cba.d.ts +1 -1
  22. package/bundles/types/configs/env/environment.cba.d.ts.map +1 -1
  23. package/bundles/types/configs/env/environment.paydock.d.ts +1 -1
  24. package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -1
  25. package/bundles/types/shared/http/http-request.d.ts +14 -0
  26. package/bundles/types/shared/http/http-request.d.ts.map +1 -0
  27. package/bundles/types/shared/http/index.d.ts +2 -0
  28. package/bundles/types/shared/http/index.d.ts.map +1 -0
  29. package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts +15 -0
  30. package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts.map +1 -0
  31. package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts +66 -0
  32. package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts.map +1 -0
  33. package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts +14 -0
  34. package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts.map +1 -0
  35. package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts +15 -0
  36. package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts.map +1 -0
  37. package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts +23 -0
  38. package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts.map +1 -0
  39. package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts +15 -0
  40. package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts.map +1 -0
  41. package/bundles/types/shared/services/instrumentation/repositories/index.d.ts +4 -0
  42. package/bundles/types/shared/services/instrumentation/repositories/index.d.ts.map +1 -0
  43. package/bundles/types/wallet-buttons/flypay-v2.wallet-service.d.ts.map +1 -1
  44. package/bundles/types/wallet-buttons/google.wallet-service.d.ts +4 -4
  45. package/bundles/types/wallet-buttons/google.wallet-service.d.ts.map +1 -1
  46. package/bundles/types/wallet-buttons/index.d.ts +1 -0
  47. package/bundles/types/wallet-buttons/index.d.ts.map +1 -1
  48. package/bundles/types/widget/configuration.d.ts.map +1 -1
  49. package/bundles/types/widget/html-multi-widget.d.ts +3 -3
  50. package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
  51. package/bundles/widget.umd.js +28425 -7291
  52. package/bundles/widget.umd.js.d.ts +71 -5
  53. package/bundles/widget.umd.js.min.d.ts +71 -5
  54. package/bundles/widget.umd.min.js +61 -2
  55. package/docs/wallet-buttons-examples.md +28 -1
  56. package/docs/wallet-buttons.md +1 -0
  57. package/examples/multi-html-widget/simple.html +2 -1
  58. package/package.json +21 -17
  59. package/slate.md +28 -1
  60. package/bundles/index.cjs.map +0 -1
  61. package/bundles/index.mjs.map +0 -1
  62. package/bundles/widget.umd.js.map +0 -1
  63. package/bundles/widget.umd.min.js.map +0 -1
@@ -1,3 +1,5 @@
1
+ import { MicroAgent } from '@newrelic/browser-agent/loaders/micro-agent';
2
+
1
3
  declare class ApiCharge {
2
4
  protected api: Api;
3
5
  constructor(api: Api);
@@ -54,6 +56,57 @@ declare class Env implements IEnvironment {
54
56
  private isValidMode;
55
57
  }
56
58
 
59
+ type HttpRequestMethod = 'DELETE' | 'GET' | 'OPTIONS' | 'POST' | 'PUT';
60
+
61
+ type AgentPrototype = Pick<(typeof MicroAgent)['prototype'], 'addPageAction' | 'noticeError'>;
62
+ type AgentMethodNames = keyof AgentPrototype;
63
+ type AgentMethodParameters<T extends AgentMethodNames> = Parameters<AgentPrototype[T]>;
64
+ declare class InstrumentationAgent extends MicroAgent {
65
+ private static agent;
66
+ private static available;
67
+ private static initialized;
68
+ private constructor();
69
+ static get instance(): InstrumentationAgent;
70
+ isAvailable(): boolean;
71
+ call: <T extends "addPageAction" | "noticeError">(method: T, ...args: AgentMethodParameters<T>) => void;
72
+ }
73
+
74
+ interface CustomEventDTO {
75
+ environment: string;
76
+ appId?: never;
77
+ timestamp?: never;
78
+ [x: string]: unknown;
79
+ }
80
+ interface ReportBaseContext {
81
+ environment: string;
82
+ sdkVersion: string | null;
83
+ description?: string;
84
+ [x: string]: SerializableValue | undefined;
85
+ }
86
+ type SerializableValue = string | number | symbol | object | null;
87
+
88
+ type ReportErrorFn = (repository: ErrorRepository, error: string | Error, ctx: ReportBaseContext & ({
89
+ className: string;
90
+ classMethod: string;
91
+ functionName?: never;
92
+ } | {
93
+ className?: never;
94
+ classMethod?: never;
95
+ functionName: string;
96
+ })) => void;
97
+ declare class ErrorRepository {
98
+ private readonly agent;
99
+ constructor();
100
+ createError(...args: Parameters<InstrumentationAgent['noticeError']>): Promise<void>;
101
+ }
102
+
103
+ type ReportEventFn = (repository: EventRepository, actionName: string, ctx: ReportBaseContext & CustomEventDTO) => void;
104
+ declare class EventRepository {
105
+ private readonly agent;
106
+ constructor();
107
+ createEvent(...args: Parameters<InstrumentationAgent['addPageAction']>): Promise<void>;
108
+ }
109
+
57
110
  declare enum API_AUTH_TYPE {
58
111
  PUBLIC_KEY = 0,
59
112
  TOKEN = 1
@@ -74,11 +127,11 @@ declare class ApiBase {
74
127
  */
75
128
  setEnv(env: string, alias?: string): ApiBase;
76
129
  setAuthType(): API_AUTH_TYPE;
77
- getClient(method: 'GET' | 'POST', link: string): {
130
+ getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
78
131
  config: XMLHttpRequest;
79
- send: (body: any, cb?: (data: any) => void, errorCb?: (data: any) => void) => void;
132
+ send: (body: any, cb?: (data) => void, errorCb?: (data: any) => any) => void;
80
133
  };
81
- getClientPromise<Req extends object, Res>(method: 'GET' | 'POST', link: string): {
134
+ getClientPromise<Req extends object, Res>(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
82
135
  config: XMLHttpRequest;
83
136
  send: (body: Req) => Promise<Res>;
84
137
  };
@@ -90,7 +143,14 @@ declare class ApiBase {
90
143
  text: string;
91
144
  status: number;
92
145
  }): Promise<Res>;
93
- setAuthHeader(request: XMLHttpRequest): void;
146
+ reportEvent: ReportEventFn;
147
+ reportError: ReportErrorFn;
148
+ protected newApiRequest(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): XMLHttpRequest;
149
+ protected get ctx(): {
150
+ sdkVersion: string;
151
+ className: string;
152
+ environment: string;
153
+ };
94
154
  }
95
155
 
96
156
  interface BrowserDetails {
@@ -560,6 +620,7 @@ interface IWalletMeta {
560
620
  refresh_token?: string;
561
621
  style?: WalletStyles;
562
622
  wallets?: WALLET_TYPE[];
623
+ client_id?: string;
563
624
  }
564
625
 
565
626
  declare class Link {
@@ -1092,13 +1153,18 @@ interface IRunner {
1092
1153
  setEnv(env: string, alias?: string): void;
1093
1154
  }
1094
1155
 
1156
+ interface IDispatcherData {
1157
+ message_source: string;
1158
+ event: string;
1159
+ }
1160
+
1095
1161
  interface IContextualRunner extends IRunner {
1096
1162
  run(): void;
1097
1163
  isRunning(): boolean;
1098
1164
  continue(): void;
1099
1165
  stop(): void;
1100
1166
  onStop(cb: () => void): void;
1101
- onCheckout(event: string, cb: (checkout: ICheckout) => void): void;
1167
+ onCheckout<T extends IDispatcherData>(event: string, cb: (checkout: ICheckout, data?: T) => void): void;
1102
1168
  setBackgroundTitle(text: string): void;
1103
1169
  setBackgroundDescription(text: string): void;
1104
1170
  turnOffBackdrop(): void;
@@ -1,3 +1,5 @@
1
+ import { MicroAgent } from '@newrelic/browser-agent/loaders/micro-agent';
2
+
1
3
  declare class ApiCharge {
2
4
  protected api: Api;
3
5
  constructor(api: Api);
@@ -54,6 +56,57 @@ declare class Env implements IEnvironment {
54
56
  private isValidMode;
55
57
  }
56
58
 
59
+ type HttpRequestMethod = 'DELETE' | 'GET' | 'OPTIONS' | 'POST' | 'PUT';
60
+
61
+ type AgentPrototype = Pick<(typeof MicroAgent)['prototype'], 'addPageAction' | 'noticeError'>;
62
+ type AgentMethodNames = keyof AgentPrototype;
63
+ type AgentMethodParameters<T extends AgentMethodNames> = Parameters<AgentPrototype[T]>;
64
+ declare class InstrumentationAgent extends MicroAgent {
65
+ private static agent;
66
+ private static available;
67
+ private static initialized;
68
+ private constructor();
69
+ static get instance(): InstrumentationAgent;
70
+ isAvailable(): boolean;
71
+ call: <T extends "addPageAction" | "noticeError">(method: T, ...args: AgentMethodParameters<T>) => void;
72
+ }
73
+
74
+ interface CustomEventDTO {
75
+ environment: string;
76
+ appId?: never;
77
+ timestamp?: never;
78
+ [x: string]: unknown;
79
+ }
80
+ interface ReportBaseContext {
81
+ environment: string;
82
+ sdkVersion: string | null;
83
+ description?: string;
84
+ [x: string]: SerializableValue | undefined;
85
+ }
86
+ type SerializableValue = string | number | symbol | object | null;
87
+
88
+ type ReportErrorFn = (repository: ErrorRepository, error: string | Error, ctx: ReportBaseContext & ({
89
+ className: string;
90
+ classMethod: string;
91
+ functionName?: never;
92
+ } | {
93
+ className?: never;
94
+ classMethod?: never;
95
+ functionName: string;
96
+ })) => void;
97
+ declare class ErrorRepository {
98
+ private readonly agent;
99
+ constructor();
100
+ createError(...args: Parameters<InstrumentationAgent['noticeError']>): Promise<void>;
101
+ }
102
+
103
+ type ReportEventFn = (repository: EventRepository, actionName: string, ctx: ReportBaseContext & CustomEventDTO) => void;
104
+ declare class EventRepository {
105
+ private readonly agent;
106
+ constructor();
107
+ createEvent(...args: Parameters<InstrumentationAgent['addPageAction']>): Promise<void>;
108
+ }
109
+
57
110
  declare enum API_AUTH_TYPE {
58
111
  PUBLIC_KEY = 0,
59
112
  TOKEN = 1
@@ -74,11 +127,11 @@ declare class ApiBase {
74
127
  */
75
128
  setEnv(env: string, alias?: string): ApiBase;
76
129
  setAuthType(): API_AUTH_TYPE;
77
- getClient(method: 'GET' | 'POST', link: string): {
130
+ getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
78
131
  config: XMLHttpRequest;
79
- send: (body: any, cb?: (data: any) => void, errorCb?: (data: any) => void) => void;
132
+ send: (body: any, cb?: (data) => void, errorCb?: (data: any) => any) => void;
80
133
  };
81
- getClientPromise<Req extends object, Res>(method: 'GET' | 'POST', link: string): {
134
+ getClientPromise<Req extends object, Res>(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
82
135
  config: XMLHttpRequest;
83
136
  send: (body: Req) => Promise<Res>;
84
137
  };
@@ -90,7 +143,14 @@ declare class ApiBase {
90
143
  text: string;
91
144
  status: number;
92
145
  }): Promise<Res>;
93
- setAuthHeader(request: XMLHttpRequest): void;
146
+ reportEvent: ReportEventFn;
147
+ reportError: ReportErrorFn;
148
+ protected newApiRequest(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): XMLHttpRequest;
149
+ protected get ctx(): {
150
+ sdkVersion: string;
151
+ className: string;
152
+ environment: string;
153
+ };
94
154
  }
95
155
 
96
156
  interface BrowserDetails {
@@ -560,6 +620,7 @@ interface IWalletMeta {
560
620
  refresh_token?: string;
561
621
  style?: WalletStyles;
562
622
  wallets?: WALLET_TYPE[];
623
+ client_id?: string;
563
624
  }
564
625
 
565
626
  declare class Link {
@@ -1092,13 +1153,18 @@ interface IRunner {
1092
1153
  setEnv(env: string, alias?: string): void;
1093
1154
  }
1094
1155
 
1156
+ interface IDispatcherData {
1157
+ message_source: string;
1158
+ event: string;
1159
+ }
1160
+
1095
1161
  interface IContextualRunner extends IRunner {
1096
1162
  run(): void;
1097
1163
  isRunning(): boolean;
1098
1164
  continue(): void;
1099
1165
  stop(): void;
1100
1166
  onStop(cb: () => void): void;
1101
- onCheckout(event: string, cb: (checkout: ICheckout) => void): void;
1167
+ onCheckout<T extends IDispatcherData>(event: string, cb: (checkout: ICheckout, data?: T) => void): void;
1102
1168
  setBackgroundTitle(text: string): void;
1103
1169
  setBackgroundDescription(text: string): void;
1104
1170
  turnOffBackdrop(): void;