@paydock/client-sdk 1.122.3-beta → 1.123.2-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +161 -5
- package/bundles/index.cjs +2472 -1735
- package/bundles/index.cjs.d.ts +314 -25
- package/bundles/index.mjs +2471 -1736
- package/bundles/index.mjs.d.ts +314 -25
- package/bundles/types/api/api-base.d.ts +1 -1
- package/bundles/types/api/api-base.d.ts.map +1 -1
- package/bundles/types/checkout/helpers/instruction-module.d.ts +1 -1
- package/bundles/types/checkout/helpers/instruction-module.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/index.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.fraud_service.show.d.ts +21 -0
- package/bundles/types/checkout/instructions/v1/instruction.fraud_service.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/additionals.d.ts +1 -1
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts +6 -4
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.cba.d.ts +8 -7
- package/bundles/types/configs/env/environment.cba.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.interface.d.ts +6 -6
- package/bundles/types/configs/env/environment.interface.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.paydock.d.ts +8 -7
- package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -1
- package/bundles/types/fraud-prevention/fraud-prevention.constants.d.ts +9 -0
- package/bundles/types/fraud-prevention/fraud-prevention.constants.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/fraud-prevention.events.d.ts +42 -0
- package/bundles/types/fraud-prevention/fraud-prevention.events.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts +163 -0
- package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/index.d.ts +3 -0
- package/bundles/types/fraud-prevention/index.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts +79 -0
- package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts +2 -0
- package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/resources/find-service-config.repository.d.ts +20 -0
- package/bundles/types/fraud-prevention/resources/find-service-config.repository.d.ts.map +1 -0
- package/bundles/types/helper/access-token.d.ts +1 -0
- package/bundles/types/helper/access-token.d.ts.map +1 -1
- package/bundles/types/helper/browser.d.ts.map +1 -1
- package/bundles/types/helper/deep-clone.d.ts +13 -0
- package/bundles/types/helper/deep-clone.d.ts.map +1 -0
- package/bundles/types/index-cba.d.ts +1 -0
- package/bundles/types/index-cba.d.ts.map +1 -1
- package/bundles/types/index.d.ts +2 -1
- package/bundles/types/index.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts +1 -1
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts.map +1 -1
- package/bundles/types/shared/device/device-info.service.d.ts +13 -0
- package/bundles/types/shared/device/device-info.service.d.ts.map +1 -0
- package/bundles/types/shared/http/authorization-strategy.d.ts +41 -0
- package/bundles/types/shared/http/authorization-strategy.d.ts.map +1 -0
- package/bundles/types/shared/http/http-fetcher.d.ts +29 -0
- package/bundles/types/shared/http/http-fetcher.d.ts.map +1 -0
- package/bundles/types/shared/http/http-fetcher.factory.d.ts +17 -0
- package/bundles/types/shared/http/http-fetcher.factory.d.ts.map +1 -0
- package/bundles/types/shared/http/http-request.d.ts +1 -1
- package/bundles/types/shared/http/http-request.d.ts.map +1 -1
- package/bundles/types/shared/http/http-response.dto.d.ts +19 -0
- package/bundles/types/shared/http/http-response.dto.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts +1 -1
- package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts.map +1 -1
- package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts.map +1 -1
- package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts.map +1 -1
- package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts.map +1 -1
- package/bundles/types/shared/shared.constants.d.ts +6 -0
- package/bundles/types/shared/shared.constants.d.ts.map +1 -0
- package/bundles/types/widget/configuration.d.ts +1 -1
- package/bundles/types/widget/configuration.d.ts.map +1 -1
- package/bundles/types/widget/html-widget.d.ts +14 -14
- package/bundles/types/widget/html-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +2472 -1735
- package/bundles/widget.umd.js.d.ts +314 -25
- package/bundles/widget.umd.js.min.d.ts +314 -25
- package/bundles/widget.umd.min.js +1 -1
- package/docs/api-widget.md +4 -4
- package/docs/fraud-prevention-examples.md +154 -0
- package/docs/fraud-prevention.md +0 -0
- package/docs/install/npm.example.md +1 -1
- package/package.json +17 -9
- package/slate.md +156 -1
- package/bundles/types/shared/http/index.d.ts +0 -2
- package/bundles/types/shared/http/index.d.ts.map +0 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type FraudPreventionProvider } from './fraud-prevention.constants';
|
|
2
|
+
declare const NAMESPACE = "fraudPrevention";
|
|
3
|
+
declare const TYPES: {
|
|
4
|
+
readonly FINGERPRINT_TOKEN_ERROR: "fingerprint-token-error";
|
|
5
|
+
readonly FINTERPRINT_TOKEN_READY: "fingerprint-token-ready";
|
|
6
|
+
};
|
|
7
|
+
declare const FRAUD_PREVENTION_EVENTS: {
|
|
8
|
+
readonly NAMESPACE: "fraudPrevention";
|
|
9
|
+
readonly TYPES: {
|
|
10
|
+
readonly FINGERPRINT_TOKEN_ERROR: "fingerprint-token-error";
|
|
11
|
+
readonly FINTERPRINT_TOKEN_READY: "fingerprint-token-ready";
|
|
12
|
+
};
|
|
13
|
+
readonly PROVIDERS: {
|
|
14
|
+
readonly FORTER: "forter";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type FraudPreventionEventType = (typeof TYPES)[keyof typeof TYPES];
|
|
18
|
+
type FraudPreventionEventFingerprintTokenReady = {
|
|
19
|
+
type: Extract<FraudPreventionEventType, 'fingerprint-token-ready'>;
|
|
20
|
+
provider: FraudPreventionProvider;
|
|
21
|
+
payload: {
|
|
22
|
+
token: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
type FraudPreventionEventFingerprintTokenError = {
|
|
26
|
+
type: Extract<FraudPreventionEventType, 'fingerprint-token-error'>;
|
|
27
|
+
provider: FraudPreventionProvider;
|
|
28
|
+
payload: {
|
|
29
|
+
code: 'unexpected_token_type';
|
|
30
|
+
message: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
type FraudPreventionEvent = FraudPreventionEventFingerprintTokenReady | FraudPreventionEventFingerprintTokenError;
|
|
34
|
+
interface IFraudPreventionEventMap {
|
|
35
|
+
[NAMESPACE]: CustomEvent<FraudPreventionEvent>;
|
|
36
|
+
}
|
|
37
|
+
declare global {
|
|
38
|
+
interface DocumentEventMap extends IFraudPreventionEventMap {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export { FRAUD_PREVENTION_EVENTS, type FraudPreventionProvider, type FraudPreventionEventType, type FraudPreventionEvent, };
|
|
42
|
+
//# sourceMappingURL=fraud-prevention.events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fraud-prevention.events.d.ts","sourceRoot":"","sources":["../../src/fraud-prevention/fraud-prevention.events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAa,MAAM,8BAA8B,CAAC;AAEvF,QAAA,MAAM,SAAS,oBAAoB,CAAC;AAEpC,QAAA,MAAM,KAAK;;;CAGD,CAAC;AAEX,QAAA,MAAM,uBAAuB;;;;;;;;;CAInB,CAAC;AAEX,KAAK,wBAAwB,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAC;AAEnE,KAAK,yCAAyC,GAAG;IAC/C,IAAI,EAAE,OAAO,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAC;IACnE,QAAQ,EAAE,uBAAuB,CAAC;IAClC,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,KAAK,yCAAyC,GAAG;IAC/C,IAAI,EAAE,OAAO,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAC;IACnE,QAAQ,EAAE,uBAAuB,CAAC;IAClC,OAAO,EAAE;QACP,IAAI,EAAE,uBAAuB,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,KAAK,oBAAoB,GACrB,yCAAyC,GACzC,yCAAyC,CAAC;AAE9C,UAAU,wBAAwB;IAChC,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,oBAAoB,CAAC,CAAC;CAChD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,gBAAiB,SAAQ,wBAAwB;KAAG;CAC/D;AAED,OAAO,EACL,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,GAC1B,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { type Mode } from './fraud-prevention.constants';
|
|
2
|
+
import type { FraudPreventionProvider } from './fraud-prevention.events';
|
|
3
|
+
import { ForterDeviceAgent } from './providers/forter/forter-device-agent.service';
|
|
4
|
+
type FraudPreventionConfig = {
|
|
5
|
+
mode: Mode;
|
|
6
|
+
environmentAlias?: string;
|
|
7
|
+
environmentId: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A class to manage integration fraud prevention integrations.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```js
|
|
15
|
+
* const fps = new FraudPreventionService({
|
|
16
|
+
* environmentId: 'production',
|
|
17
|
+
* mode: 'live',
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class FraudPreventionService {
|
|
22
|
+
private readonly environment;
|
|
23
|
+
private readonly httpFetcherFactory;
|
|
24
|
+
private readonly mode;
|
|
25
|
+
private authorizationStrategy;
|
|
26
|
+
private forterDeviceAgent;
|
|
27
|
+
/**
|
|
28
|
+
* @constructs
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} config - FraudPreventionService configuration object
|
|
31
|
+
* @param {string} config.mode - Environment mode, must be either 'test' or 'live'
|
|
32
|
+
* @param {string} config.environmentId - Environment identifier
|
|
33
|
+
* @param {string} [config.environmentAlias] - Optional environment alias for API requests
|
|
34
|
+
*/
|
|
35
|
+
constructor(config: FraudPreventionConfig);
|
|
36
|
+
/**
|
|
37
|
+
* Automatically detects and sets the authorization strategy the service should use
|
|
38
|
+
* based on the shape of the provided string.
|
|
39
|
+
*
|
|
40
|
+
* If the value is a JWT token, it will use an access token strategy, otherwise it will use
|
|
41
|
+
* a public key strategy.
|
|
42
|
+
*
|
|
43
|
+
* @param value - The authorization value (either JWT token or public key)
|
|
44
|
+
*
|
|
45
|
+
* @returns The FraudPreventionService instance for method chaining
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* // With JWT token
|
|
50
|
+
* fps.withAuthorization('eyJhbGciOiJIUzI1NiIs...');
|
|
51
|
+
*
|
|
52
|
+
* // With public key
|
|
53
|
+
* fps.withAuthorization('pk_example_...');
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
withAuthorization(value: string): FraudPreventionService;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the authorization strategy to use access token authentication.
|
|
59
|
+
*
|
|
60
|
+
* @param accessToken - The JWT access token
|
|
61
|
+
* @returns The FraudPreventionService instance for method chaining
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* fps.withAccessTokenStrategy('eyJhbGciOiJIUzI1NiIs...');
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
withAccessTokenStrategy(accessToken: string): FraudPreventionService;
|
|
70
|
+
/**
|
|
71
|
+
* Sets the authorization strategy to use public key authentication.
|
|
72
|
+
*
|
|
73
|
+
* @param publicKey - The public key
|
|
74
|
+
* @returns The FraudPreventionService instance for method chaining
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
*
|
|
78
|
+
* ```ts
|
|
79
|
+
* fps.withPublicKeyStrategy('pk_example_...');
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
withPublicKeyStrategy(publicKey: string): FraudPreventionService;
|
|
83
|
+
/**
|
|
84
|
+
* Initializes Forter integration with the provided configuration. This method injects
|
|
85
|
+
* Forter's JavaScript snippet into the page and starts tracking user behavior.
|
|
86
|
+
*
|
|
87
|
+
* @param {Object} config - Configuration object for Forter integration
|
|
88
|
+
* @param {string} [config.siteId] - Your Forter site ID or subsite merchant ID
|
|
89
|
+
* @param {string} [config.providerId] - Your Paydock integrated Forter Service ID.
|
|
90
|
+
* @param {boolean} [config.csp] - Set to true if your site uses Content-Security-Policies
|
|
91
|
+
*
|
|
92
|
+
* @throws If neither siteId nor providerId are provided in the configuration
|
|
93
|
+
* @throws If providerId fails to resolve to a siteId through Paydock integration services
|
|
94
|
+
*
|
|
95
|
+
* @returns Promise with existing FraudPreventionService instance
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
*
|
|
99
|
+
* ```js
|
|
100
|
+
* await fps.withForter({
|
|
101
|
+
* providerId: 'your-paydock-forter-service-id'
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
*
|
|
107
|
+
* ```js
|
|
108
|
+
* await fps.withForter({
|
|
109
|
+
* siteId: 'your-forter-site-id',
|
|
110
|
+
* });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
withForter(config: {
|
|
114
|
+
csp?: boolean;
|
|
115
|
+
} & ({
|
|
116
|
+
siteId: string;
|
|
117
|
+
providerId?: never;
|
|
118
|
+
} | {
|
|
119
|
+
siteId?: never;
|
|
120
|
+
providerId: string;
|
|
121
|
+
})): Promise<this>;
|
|
122
|
+
/**
|
|
123
|
+
* Returns the initialized Forter device agent instance if available.
|
|
124
|
+
*
|
|
125
|
+
* Make sure to call withForter() before accessing this getter.
|
|
126
|
+
*
|
|
127
|
+
* @returns {ForterDeviceAgent | null} The Forter device agent instance or null if not initialized
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
*
|
|
131
|
+
* ```js
|
|
132
|
+
* const fps = new FraudPreventionService();
|
|
133
|
+
*
|
|
134
|
+
* fps.withForter({
|
|
135
|
+
* siteId: 'your-site-id',
|
|
136
|
+
* mode: 'test'
|
|
137
|
+
* });
|
|
138
|
+
*
|
|
139
|
+
* const token = fps.forter?.token;
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
get forter(): ForterDeviceAgent | null;
|
|
143
|
+
/**
|
|
144
|
+
* Gets the credentials for a specific fraud prevention provider.
|
|
145
|
+
*
|
|
146
|
+
* Returns different credential types based on the selected provider.
|
|
147
|
+
*
|
|
148
|
+
* @param provider - The fraud prevention provider
|
|
149
|
+
* @param providerId - The ID of the provider instance
|
|
150
|
+
*
|
|
151
|
+
* @returns a tuple with shape [providerSpecificCredentials, error]
|
|
152
|
+
*/
|
|
153
|
+
getProviderCredentials<P extends FraudPreventionProvider>(provider: P, providerId: string): Promise<import("../shared/shared.constants").Result<P extends "forter" ? {
|
|
154
|
+
provider: "forter";
|
|
155
|
+
siteId: string;
|
|
156
|
+
subsiteId: string;
|
|
157
|
+
} : never, unknown>>;
|
|
158
|
+
private validateEnvironmentId;
|
|
159
|
+
private validateEnvironmentAlias;
|
|
160
|
+
private validateMode;
|
|
161
|
+
}
|
|
162
|
+
export {};
|
|
163
|
+
//# sourceMappingURL=fraud-prevention.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fraud-prevention.service.d.ts","sourceRoot":"","sources":["../../src/fraud-prevention/fraud-prevention.service.ts"],"names":[],"mappings":"AAaA,OAAO,EAAS,KAAK,IAAI,EAA0B,MAAM,8BAA8B,CAAC;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGnF,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAM;IAClC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;IACxD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAO;IAE5B,OAAO,CAAC,qBAAqB,CAAkD;IAC/E,OAAO,CAAC,iBAAiB,CAAkC;IAE3D;;;;;;;OAOG;gBACS,MAAM,EAAE,qBAAqB;IAmBzC;;;;;;;;;;;;;;;;;;;OAmBG;IACI,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,sBAAsB;IAQ/D;;;;;;;;;;;OAWG;IACI,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,sBAAsB;IAM3E;;;;;;;;;;;OAWG;IACI,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,sBAAsB;IAMvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACU,UAAU,CACrB,MAAM,EAAE;QACN,GAAG,CAAC,EAAE,OAAO,CAAC;KACf,GAAG,CACA;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,KAAK,CAAA;KAAE,GACtC;QAAE,MAAM,CAAC,EAAE,KAAK,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CACzC,GACA,OAAO,CAAC,IAAI,CAAC;IA2ChB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAW,MAAM,IAAI,iBAAiB,GAAG,IAAI,CAE5C;IAED;;;;;;;;;OASG;IACU,sBAAsB,CAAC,CAAC,SAAS,uBAAuB,EACnE,QAAQ,EAAE,CAAC,EACX,UAAU,EAAE,MAAM;;;;;IAOpB,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,YAAY;CAOrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fraud-prevention/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type Mode } from '../../fraud-prevention.constants';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for the Forter Device Agent
|
|
4
|
+
*
|
|
5
|
+
* @typedef {Object} ForterDeviceAgentConfig
|
|
6
|
+
* @property {string} siteId - Your Forter site ID or subsite merchant ID
|
|
7
|
+
* @property {boolean} csp - Set to true if your site uses Content-Security-Policy
|
|
8
|
+
* @property {'live' | 'test'} mode - Environment mode, must be either 'live' or 'test'
|
|
9
|
+
*/
|
|
10
|
+
export type ForterDeviceAgentConfig = {
|
|
11
|
+
siteId: string;
|
|
12
|
+
csp: boolean;
|
|
13
|
+
mode: Mode;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A class that manages Forter's device fingerprinting integration.
|
|
17
|
+
* It handles script injection and token management.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
*
|
|
21
|
+
* ```js
|
|
22
|
+
* const agent = new ForterDeviceAgent({
|
|
23
|
+
* siteId: 'your-site-id',
|
|
24
|
+
* csp: false,
|
|
25
|
+
* mode: 'test'
|
|
26
|
+
* }).init();
|
|
27
|
+
*
|
|
28
|
+
* // Later, access the token
|
|
29
|
+
* const token = agent.token;
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class ForterDeviceAgent {
|
|
33
|
+
private readonly config;
|
|
34
|
+
private cookieToken;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new instance of ForterDeviceAgent
|
|
37
|
+
*
|
|
38
|
+
* @param {ForterDeviceAgentConfig} config - Configuration object for Forter integration
|
|
39
|
+
*/
|
|
40
|
+
constructor(config: ForterDeviceAgentConfig);
|
|
41
|
+
/**
|
|
42
|
+
* Returns the current Forter token if available
|
|
43
|
+
*
|
|
44
|
+
* @returns {string | null} The Forter token or null if not yet available
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
*
|
|
48
|
+
* ```js
|
|
49
|
+
* const token = forterAgent.token;
|
|
50
|
+
* if (token) {
|
|
51
|
+
* // Use the token
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
get token(): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Initializes the Forter Device Agent by injecting the required script
|
|
58
|
+
* and setting up event listeners.
|
|
59
|
+
*
|
|
60
|
+
* @returns {ForterDeviceAgent} The current instance for method chaining
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
*
|
|
64
|
+
* ```js
|
|
65
|
+
* const agent = new ForterDeviceAgent(config).init();
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
init(): ForterDeviceAgent;
|
|
69
|
+
private emit;
|
|
70
|
+
private emitFingerprintTokenWrongTypeError;
|
|
71
|
+
private emitFingerprintTokenReady;
|
|
72
|
+
private getScriptContent;
|
|
73
|
+
private injectScript;
|
|
74
|
+
private subscribeSdkEvents;
|
|
75
|
+
private validateCsp;
|
|
76
|
+
private validateMode;
|
|
77
|
+
private validateSiteId;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=forter-device-agent.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forter-device-agent.service.d.ts","sourceRoot":"","sources":["../../../../src/fraud-prevention/providers/forter/forter-device-agent.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAe,MAAM,kCAAkC,CAAC;AAW1E;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD,OAAO,CAAC,WAAW,CAAuB;IAE1C;;;;OAIG;gBACS,MAAM,EAAE,uBAAuB;IAQ3C;;;;;;;;;;;;;OAaG;IACH,IAAW,KAAK,IAAI,MAAM,GAAG,IAAI,CAEhC;IAED;;;;;;;;;;;OAWG;IACI,IAAI,IAAI,iBAAiB;IAOhC,OAAO,CAAC,IAAI;IAQZ,OAAO,CAAC,kCAAkC;IAY1C,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,cAAc;CAOvB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const FORTER_SDK_SCRIPT_TEMPLATE = "\n(function () {\n var merchantConfig = {\n csp: %CSP%\n };\n\n var siteId = \"%SITE_ID%\";\n\n function t(t,e){for(var n=t.split(\"\"),r=0;r<n.length;++r)n[r]=String.fromCharCode(n[r].charCodeAt(0)+e);return n.join(\"\")}function e(e){return t(e,-_).replace(/%SN%/g,siteId)}function n(t){try{if(\"number\"==typeof t&&window.location&&window.location.pathname){for(var e=window.location.pathname.split(\"/\"),n=[],r=0;r<=Math.min(e.length-1,Math.abs(t));r++)n.push(e[r]);return n.join(\"/\")||\"/\"}}catch(t){}return\"/\"}function r(t){try{Q.ex=t,o()&&-1===Q.ex.indexOf(X.uB)&&(Q.ex+=X.uB),i()&&-1===Q.ex.indexOf(X.uBr)&&(Q.ex+=X.uBr),a()&&-1===Q.ex.indexOf(X.nIL)&&(Q.ex+=X.nIL),window.ftr__snp_cwc||(Q.ex+=X.s),B(Q)}catch(t){}}function o(){var t=\"no\"+\"op\"+\"fn\",e=\"g\"+\"a\",n=\"n\"+\"ame\";return window[e]&&window[e][n]===t}function i(){return!(!navigator.brave||\"function\"!=typeof navigator.brave.isBrave)}function a(){return document.currentScript&&document.currentScript.src}function c(t,e){function n(o){try{o.blockedURI===t&&(e(),document.removeEventListener(r,n))}catch(t){document.removeEventListener(r,n)}}var r=\"securitypolicyviolation\";document.addEventListener(r,n),setTimeout(function(){document.removeEventListener(r,n)},2*60*1e3)}function u(t,e,n,r){var o=!1;t=\"https://\"+t,c(t,function(){r(!0),o=!0});var i=document.createElement(\"script\");i.onerror=function(){if(!o)try{r(!1),o=!0}catch(t){}},i.onload=n,i.type=\"text/javascript\",i.id=\"ftr__script\",i.async=!0,i.src=t;var a=document.getElementsByTagName(\"script\")[0];a.parentNode.insertBefore(i,a)}function f(){tt(X.uDF),setTimeout(w,N,X.uDF)}function s(t,e,n,r){var o=!1,i=new XMLHttpRequest;if(c(\"https:\"+t,function(){n(new Error(\"CSP Violation\"),!0),o=!0}),\"//\"===t.slice(0,2)&&(t=\"https:\"+t),\"withCredentials\"in i)i.open(\"GET\",t,!0);else{if(\"undefined\"==typeof XDomainRequest)return;i=new XDomainRequest,i.open(\"GET\",t)}Object.keys(r).forEach(function(t){i.setRequestHeader(t,r[t])}),i.onload=function(){\"function\"==typeof e&&e(i)},i.onerror=function(t){if(\"function\"==typeof n&&!o)try{n(t,!1),o=!0}catch(t){}},i.onprogress=function(){},i.ontimeout=function(){\"function\"==typeof n&&n(\"tim\"+\"eo\"+\"ut\",!1)},setTimeout(function(){i.send()},0)}function d(t,siteId,e){function n(t){var e=t.toString(16);return e.length%2?\"0\"+e:e}function r(t){if(t<=0)return\"\";for(var e=\"0123456789abcdef\",n=\"\",r=0;r<t;r++)n+=e[Math.floor(Math.random()*e.length)];return n}function o(t){for(var e=\"\",r=0;r<t.length;r++)e+=n(t.charCodeAt(r));return e}function i(t){for(var e=t.split(\"\"),n=0;n<e.length;++n)e[n]=String.fromCharCode(255^e[n].charCodeAt(0));return e.join(\"\")}e=e?\"1\":\"0\";var a=[];return a.push(t),a.push(siteId),a.push(e),function(t){var e=40,n=\"\";return t.length<e/2&&(n=\",\"+r(e/2-t.length-1)),o(i(t+n))}(a.join(\",\"))}function h(){function t(){F&&(tt(X.dUAL),setTimeout(w,N,X.dUAL))}function e(t,e){r(e?X.uAS+X.uF+X.cP:X.uAS+X.uF),F=\"F\"+\"T\"+\"R\"+\"A\"+\"U\",setTimeout(w,N,X.uAS)}window.ftr__fdad(t,e)}function l(){function t(){F&&setTimeout(w,N,X.uDAD)}function e(t,e){r(e?X.uDS+X.uF+X.cP:X.uDS+X.uF),F=\"F\"+\"T\"+\"R\"+\"A\"+\"U\",setTimeout(w,N,X.uDS)}window.ftr__radd(t,e)}function w(t){try{var e;switch(t){case X.uFP:e=O;break;case X.uDF:e=M;break;default:e=F}if(!e)return;var n=function(){try{et(),r(t+X.uS)}catch(t){}},o=function(e){try{et(),Q.td=1*new Date-Q.ts,r(e?t+X.uF+X.cP:t+X.uF),t===X.uFP&&f(),t===X.uDF&&(I?l():h()),t!==X.uAS&&t!==X.dUAL||I||l(),t!==X.uDS&&t!==X.uDAD||I&&h()}catch(t){r(X.eUoe)}};if(e===\"F\"+\"T\"+\"R\"+\"A\"+\"U\")return void o();u(e,void 0,n,o)}catch(e){r(t+X.eTlu)}}var g=\"22ge:t7mj8unkn;1forxgiurqw1qhw2vwdwxv\",v=\"fort\",p=\"erTo\",m=\"ken\",_=3;window.ftr__config={m:merchantConfig,s:\"24\",si:siteId};var y=!1,U=!1,T=v+p+m,x=400*24*60,A=10,S={write:function(t,e,r,o){void 0===o&&(o=!0);var i=0;window.ftr__config&&window.ftr__config.m&&window.ftr__config.m.ckDepth&&(i=window.ftr__config.m.ckDepth);var a,c,u=n(i);if(r?(a=new Date,a.setTime(a.getTime()+60*r*1e3),c=\"; expires=\"+a.toGMTString()):c=\"\",!o)return void(document.cookie=escape(t)+\"=\"+escape(e)+c+\"; path=\"+u);for(var f=1,s=document.domain.split(\".\"),d=A,h=!0;h&&s.length>=f&&d>0;){var l=s.slice(-f).join(\".\");document.cookie=escape(t)+\"=\"+escape(e)+c+\"; path=\"+u+\"; domain=\"+l;var w=S.read(t);null!=w&&w==e||(l=\".\"+l,document.cookie=escape(t)+\"=\"+escape(e)+c+\"; path=\"+u+\"; domain=\"+l),h=-1===document.cookie.indexOf(t+\"=\"+e),f++,d--}},read:function(t){var e=null;try{for(var n=escape(t)+\"=\",r=document.cookie.split(\";\"),o=32,i=0;i<r.length;i++){for(var a=r[i];a.charCodeAt(0)===o;)a=a.substring(1,a.length);0===a.indexOf(n)&&(e=unescape(a.substring(n.length,a.length)))}}finally{return e}}},D=window.ftr__config.s;D+=\"ck\";var L=function(t){var e=!1,n=null,r=function(){try{if(!n||!e)return;n.remove&&\"function\"==typeof n.remove?n.remove():document.head.removeChild(n),e=!1}catch(t){}};document.head&&(!function(){n=document.createElement(\"link\"),n.setAttribute(\"rel\",\"pre\"+\"con\"+\"nect\"),n.setAttribute(\"cros\"+\"sori\"+\"gin\",\"anonymous\"),n.onload=r,n.onerror=r,n.setAttribute(\"href\",t),document.head.appendChild(n),e=!0}(),setTimeout(r,3e3))},E=e(g||\"22ge:t7mj8unkn;1forxgiurqw1qhw2vwdwxv\"),C=t(\"[0Uhtxhvw0LG\",-_),R=t(\"[0Fruuhodwlrq0LG\",-_),P=t(\"Li0Qrqh0Pdwfk\",-_),k=e(\"dss1vlwhshuirupdqfhwhvw1qhw\"),q=e(\"2241414142gqv0txhu|\"),F,b=\"fgq71iruwhu1frp\",M=e(\"(VQ(1\"+b+\"2vq2(VQ(2vfulsw1mv\"),V=e(\"(VQ(1\"+b+\"2vqV2(VQ(2vfulsw1mv\"),O;window.ftr__config&&window.ftr__config.m&&window.ftr__config.m.fpi&&(O=window.ftr__config.m.fpi+e(\"2vq2(VQ(2vfulsw1mv\"));var I=!1,N=10;window.ftr__startScriptLoad=1*new Date;var j=function(t){var e=\"ft\"+\"r:tok\"+\"enR\"+\"eady\";window.ftr__tt&&clearTimeout(window.ftr__tt),window.ftr__tt=setTimeout(function(){try{delete window.ftr__tt,t+=\"_tt\";var n=document.createEvent(\"Event\");n.initEvent(e,!1,!1),n.detail=t,document.dispatchEvent(n)}catch(t){}},1e3)},B=function(t){var e=function(t){return t||\"\"},n=e(t.id)+\"_\"+e(t.ts)+\"_\"+e(t.td)+\"_\"+e(t.ex)+\"_\"+e(D),r=x;!isNaN(window.ftr__config.m.ckTTL)&&window.ftr__config.m.ckTTL&&(r=window.ftr__config.m.ckTTL),S.write(T,n,r,!0),j(n),window.ftr__gt=n},G=function(){var t=S.read(T)||\"\",e=t.split(\"_\"),n=function(t){return e[t]||void 0};return{id:n(0),ts:n(1),td:n(2),ex:n(3),vr:n(4)}},H=function(){for(var t={},e=\"fgu\",n=[],r=0;r<256;r++)n[r]=(r<16?\"0\":\"\")+r.toString(16);var o=function(t,e,r,o,i){var a=i?\"-\":\"\";return n[255&t]+n[t>>8&255]+n[t>>16&255]+n[t>>24&255]+a+n[255&e]+n[e>>8&255]+a+n[e>>16&15|64]+n[e>>24&255]+a+n[63&r|128]+n[r>>8&255]+a+n[r>>16&255]+n[r>>24&255]+n[255&o]+n[o>>8&255]+n[o>>16&255]+n[o>>24&255]},i=function(){if(window.Uint32Array&&window.crypto&&window.crypto.getRandomValues){var t=new window.Uint32Array(4);return window.crypto.getRandomValues(t),{d0:t[0],d1:t[1],d2:t[2],d3:t[3]}}return{d0:4294967296*Math.random()>>>0,d1:4294967296*Math.random()>>>0,d2:4294967296*Math.random()>>>0,d3:4294967296*Math.random()>>>0}},a=function(){var t=\"\",e=function(t,e){for(var n=\"\",r=t;r>0;--r)n+=e.charAt(1e3*Math.random()%e.length);return n};return t+=e(2,\"0123456789\"),t+=e(1,\"123456789\"),t+=e(8,\"0123456789\")};return t.safeGenerateNoDash=function(){try{var t=i();return o(t.d0,t.d1,t.d2,t.d3,!1)}catch(t){try{return e+a()}catch(t){}}},t.isValidNumericalToken=function(t){return t&&t.toString().length<=11&&t.length>=9&&parseInt(t,10).toString().length<=11&&parseInt(t,10).toString().length>=9},t.isValidUUIDToken=function(t){return t&&32===t.toString().length&&/^[a-z0-9]+$/.test(t)},t.isValidFGUToken=function(t){return 0==t.indexOf(e)&&t.length>=12},t}(),X={uDF:\"UDF\",dUAL:\"dUAL\",uAS:\"UAS\",uDS:\"UDS\",uDAD:\"UDAD\",uFP:\"UFP\",mLd:\"1\",eTlu:\"2\",eUoe:\"3\",uS:\"4\",uF:\"9\",tmos:[\"T5\",\"T10\",\"T15\",\"T30\",\"T60\"],tmosSecs:[5,10,15,30,60],bIR:\"43\",uB:\"u\",uBr:\"b\",cP:\"c\",nIL:\"i\",s:\"s\"};try{var Q=G();try{Q.id&&(H.isValidNumericalToken(Q.id)||H.isValidUUIDToken(Q.id)||H.isValidFGUToken(Q.id))?window.ftr__ncd=!1:(Q.id=H.safeGenerateNoDash(),window.ftr__ncd=!0),Q.ts=window.ftr__startScriptLoad,B(Q),window.ftr__snp_cwc=!!S.read(T),window.ftr__snp_cwc||(M=V);for(var $=\"for\"+\"ter\"+\".co\"+\"m\",z=\"ht\"+\"tps://c\"+\"dn9.\"+$,J=\"ht\"+\"tps://\"+Q.id+\"-\"+siteId+\".cd\"+\"n.\"+$,K=\"http\"+\"s://cd\"+\"n3.\"+$,W=[z,J,K],Y=0;Y<W.length;Y++)L(W[Y]);var Z=new Array(X.tmosSecs.length),tt=function(t){for(var e=0;e<X.tmosSecs.length;e++)Z[e]=setTimeout(r,1e3*X.tmosSecs[e],t+X.tmos[e])},et=function(){for(var t=0;t<X.tmosSecs.length;t++)clearTimeout(Z[t])};window.ftr__fdad=function(e,n){if(!y){y=!0;var r={};r[P]=d(window.ftr__config.s,siteId,window.ftr__config.m.csp),s(E,function(n){try{var r=n.getAllResponseHeaders().toLowerCase();if(r.indexOf(R.toLowerCase())>=0){var o=n.getResponseHeader(R);window.ftr__altd2=t(atob(o),-_-1)}if(r.indexOf(C.toLowerCase())<0)return;var i=n.getResponseHeader(C),a=t(atob(i),-_-1);if(a){var c=a.split(\":\");if(c&&2===c.length){for(var u=c[0],f=c[1],s=\"\",d=0,h=0;d<20;++d)s+=d%3>0&&h<12?siteId.charAt(h++):Q.id.charAt(d);var l=f.split(\",\");if(l.length>1){var w=l[0],g=l[1];F=u+\"/\"+w+\".\"+s+\".\"+g}}}e()}catch(t){}},function(t,e){n&&n(t,e)},r)}},window.ftr__radd=function(t,e){function n(e){try{var n=e.response,r=function(t){function e(t,o,i){try{if(i>=n)return{name:\"\",nextOffsetToProcess:o,error:\"Max pointer dereference depth exceeded\"};for(var a=[],c=o,u=t.getUint8(c),f=0;f<r;){if(f++,192==(192&u)){var s=(63&u)<<8|t.getUint8(c+1),d=e(t,s,i+1);if(d.error)return d;var h=d.name;return a.push(h),{name:a.join(\".\"),nextOffsetToProcess:c+2}}if(!(u>0)){if(0!==u)return{name:\"\",nextOffsetToProcess:c,error:\"Unexpected length at the end of name: \"+u.toString()};return{name:a.join(\".\"),nextOffsetToProcess:c+1}}for(var l=\"\",w=1;w<=u;w++)l+=String.fromCharCode(t.getUint8(c+w));a.push(l),c+=u+1,u=t.getUint8(c)}return{name:\"\",nextOffsetToProcess:c,error:\"Max iterations exceeded\"}}catch(t){return{name:\"\",nextOffsetToProcess:o,error:\"Unexpected error while parsing response: \"+t.toString()}}}for(var n=4,r=100,o=16,i=new DataView(t),a=i.getUint16(0),c=i.getUint16(2),u=i.getUint16(4),f=i.getUint16(6),s=i.getUint16(8),d=i.getUint16(10),h=12,l=[],w=0;w<u;w++){var g=e(i,h,0);if(g.error)throw new Error(g.error);if(h=g.nextOffsetToProcess,!Number.isInteger(h))throw new Error(\"invalid returned offset\");var v=g.name,p=i.getUint16(h);h+=2;var m=i.getUint16(h);h+=2,l.push({qname:v,qtype:p,qclass:m})}for(var _=[],w=0;w<f;w++){var g=e(i,h,0);if(g.error)throw new Error(g.error);if(h=g.nextOffsetToProcess,!Number.isInteger(h))throw new Error(\"invalid returned offset\");var y=g.name,U=i.getUint16(h);if(U!==o)throw new Error(\"Unexpected record type: \"+U.toString());h+=2;var T=i.getUint16(h);h+=2;var x=i.getUint32(h);h+=4;var A=i.getUint16(h);h+=2;for(var S=\"\",D=h,L=0;D<h+A&&L<r;){L++;var E=i.getUint8(D);D+=1;S+=(new TextDecoder).decode(t.slice(D,D+E)),D+=E}if(L>=r)throw new Error(\"Max iterations exceeded while reading TXT data\");h+=A,_.push({name:y,type:U,class:T,ttl:x,data:S})}return{transactionId:a,flags:c,questionCount:u,answerCount:f,authorityCount:s,additionalCount:d,questions:l,answers:_}}(n);if(!r)throw new Error(\"Error parsing DNS response\");if(!(\"answers\"in r))throw new Error(\"Unexpected response\");var o=r.answers;if(0===o.length)throw new Error(\"No answers found\");var i=o[0].data;if(i=i.replace(/^\"(.*)\"$/,\"$1\"),decodedVal=function(t){var e=40,n=32,r=126;try{for(var o=atob(t),i=\"\",a=0;a<o.length;a++)i+=function(t){var o=t.charCodeAt(0),i=o-e;return i<n&&(i=r-(n-i)+1),String.fromCharCode(i)}(o[a]);return atob(i)}catch(t){return}}(i),!decodedVal)throw new Error(\"failed to decode the value\");var a=function(t){var e=\"_\"+\"D\"+\"L\"+\"M\"+\"_\",n=t.split(e);if(!(n.length<2)){var r=n[0],o=n[1];if(!(r.split(\".\").length-1<1))return{jURL:r,eURL:o}}}(decodedVal);if(!a)throw new Error(\"failed to parse the value\");var c=a.jURL,u=a.eURL;F=function(t){for(var e=\"\",n=0,r=0;n<20;++n)e+=n%3>0&&r<12?siteId.charAt(r++):Q.id.charAt(n);return t.replace(\"/PRM1\",\"\").replace(\"/PRM2\",\"/main.\").replace(\"/PRM3\",e).replace(\"/PRM4\",\".js\")}(c),window.ftr__altd3=u,t()}catch(t){}}function r(t,n){e&&e(t,n)}if(!U){window.ftr__config.m.dr===\"N\"+\"D\"+\"R\"&&e(new Error(\"N\"+\"D\"+\"R\"),!1),q&&k||e(new Error(\"D\"+\"P\"+\"P\"),!1),U=!0;try{var o=function(t){for(var e=new Uint8Array([0,0]),n=new Uint8Array([1,0]),r=new Uint8Array([0,1]),o=new Uint8Array([0,0]),i=new Uint8Array([0,0]),a=new Uint8Array([0,0]),c=t.split(\".\"),u=[],f=0;f<c.length;f++){var s=c[f];u.push(s.length);for(var d=0;d<s.length;d++)u.push(s.charCodeAt(d))}u.push(0);var h=16,l=new Uint8Array([0,h]),w=new Uint8Array([0,1]),g=new Uint8Array(e.length+n.length+r.length+o.length+i.length+a.length+u.length+l.length+w.length);return g.set(e,0),g.set(n,e.length),g.set(r,e.length+n.length),g.set(o,e.length+n.length+r.length),g.set(i,e.length+n.length+r.length+o.length),g.set(a,e.length+n.length+r.length+o.length+i.length),g.set(u,e.length+n.length+r.length+o.length+i.length+a.length),g.set(l,e.length+n.length+r.length+o.length+i.length+a.length+u.length),g.set(w,e.length+n.length+r.length+o.length+i.length+a.length+u.length+l.length),g}(k);!function(t,e,n,r,o){var i=!1,a=new XMLHttpRequest;if(c(\"https:\"+t,function(){o(new Error(\"CSP Violation\"),!0),i=!0}),\"//\"===t.slice(0,2)&&(t=\"https:\"+t),\"withCredentials\"in a)a.open(\"POST\",t,!0);else{if(\"undefined\"==typeof XDomainRequest)return;a=new XDomainRequest,a.open(\"POST\",t)}a.responseType=\"arraybuffer\",a.setRequestHeader(\"Content-Type\",e),a.onload=function(){\"function\"==typeof r&&r(a)},a.onerror=function(t){if(\"function\"==typeof o&&!i)try{o(t,!1),i=!0}catch(t){}},a.onprogress=function(){},a.ontimeout=function(){\"function\"==typeof o&&o(\"tim\"+\"eo\"+\"ut\",!1)},setTimeout(function(){a.send(n)},0)}(q,\"application/dns-message\",o,n,r)}catch(t){e(t,!1)}}};var nt=O?X.uFP:X.uDF;tt(nt),setTimeout(w,N,nt)}catch(t){r(X.mLd)}}catch(t){}}\n)();\n";
|
|
2
|
+
//# sourceMappingURL=forter-snippet-2025-02-06t14:19:34z.template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forter-snippet-2025-02-06t14:19:34z.template.d.ts","sourceRoot":"","sources":["../../../../../src/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,qybAUtC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HttpFetcher } from '../../shared/http/http-fetcher';
|
|
2
|
+
import type { Result } from '../../shared/shared.constants';
|
|
3
|
+
import { PROVIDERS } from '../fraud-prevention.constants';
|
|
4
|
+
import type { FraudPreventionProvider } from '../fraud-prevention.events';
|
|
5
|
+
export type ServiceConfigResource = {
|
|
6
|
+
type: string;
|
|
7
|
+
merchant: string;
|
|
8
|
+
username: string;
|
|
9
|
+
password: string;
|
|
10
|
+
certificate: string;
|
|
11
|
+
certificate_passphrase: string;
|
|
12
|
+
};
|
|
13
|
+
type ForterCredentials = {
|
|
14
|
+
provider: typeof PROVIDERS.FORTER;
|
|
15
|
+
siteId: string;
|
|
16
|
+
subsiteId: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function findServiceConfig<P extends FraudPreventionProvider>(httpFetcher: HttpFetcher, provider: P, providerId: string): Promise<Result<P extends typeof PROVIDERS.FORTER ? ForterCredentials : never, unknown>>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=find-service-config.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-service-config.repository.d.ts","sourceRoot":"","sources":["../../../src/fraud-prevention/resources/find-service-config.repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAKlE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,OAAO,SAAS,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAQF,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,uBAAuB,EACvE,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,CAAC,EACX,UAAU,EAAE,MAAM,GACjB,OAAO,CACR,MAAM,CAAC,CAAC,SAAS,OAAO,SAAS,CAAC,MAAM,GAAG,iBAAiB,GAAG,KAAK,EAAE,OAAO,CAAC,CAC/E,CAyBA"}
|
|
@@ -21,5 +21,6 @@ export declare class AccessToken {
|
|
|
21
21
|
static extractEnv<T>(body: IAccessToken['body']): T;
|
|
22
22
|
static validateJWTWhitelistedDomains(body: IAccessToken['body']): boolean;
|
|
23
23
|
static getAccessHeaderNameByToken(token: string): string;
|
|
24
|
+
static isJwt(value: string): boolean;
|
|
24
25
|
}
|
|
25
26
|
//# sourceMappingURL=access-token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-token.d.ts","sourceRoot":"","sources":["../../src/helper/access-token.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE;QACF,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACf,CAAC;IACF,IAAI,EAAE;QACF,GAAG,EAAE,MAAM,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB;;;CAG9B,CAAA;AAED,qBAAa,WAAW;WACN,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY;WAkBtC,WAAW,CAAC,CAAC,EAAE,IAAI,EAAC,YAAY,CAAC,MAAM,CAAC,GAAE,CAAC;WAQ3C,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC;WAS7C,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC;WAS5C,6BAA6B,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,OAAO;WAclE,0BAA0B,CAAC,KAAK,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"access-token.d.ts","sourceRoot":"","sources":["../../src/helper/access-token.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE;QACF,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACf,CAAC;IACF,IAAI,EAAE;QACF,GAAG,EAAE,MAAM,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB;;;CAG9B,CAAA;AAED,qBAAa,WAAW;WACN,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY;WAkBtC,WAAW,CAAC,CAAC,EAAE,IAAI,EAAC,YAAY,CAAC,MAAM,CAAC,GAAE,CAAC;WAQ3C,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC;WAS7C,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC;WAS5C,6BAA6B,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,OAAO;WAclE,0BAA0B,CAAC,KAAK,EAAE,MAAM;WAIxC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAI9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/helper/browser.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO;
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/helper/browser.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO;WAEJ,UAAU,IAAI,OAAO;WAMrB,WAAW,IAAI,OAAO;WAMtB,cAAc,IAAI,OAAO;WAIzB,WAAW,IAAI,MAAM;WAIrB,iBAAiB,IAAI,MAAM;WAI3B,cAAc,IAAI,MAAM;WA4BxB,aAAa,IAAI,OAAO;WAIxB,aAAa,IAAI,MAAM;WAIvB,eAAe,IAAI,MAAM;WAIzB,cAAc,IAAI,MAAM;WAIxB,cAAc,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CA0BlE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep clones a value.
|
|
3
|
+
*
|
|
4
|
+
* @param value - The value to clone.
|
|
5
|
+
* @param visited - A WeakMap to track visited objects.
|
|
6
|
+
* @returns A deep clone of the value.
|
|
7
|
+
*
|
|
8
|
+
* Warning: Only own enumerable properties of objects are cloned. Thus, not suitable for cloning custom instances with getters, setters, methods or static properties.
|
|
9
|
+
* Warning: Functions are cloned by reference.
|
|
10
|
+
* Warning: Circular references are cloned by reference.
|
|
11
|
+
*/
|
|
12
|
+
export declare function deepClone<T = any>(value: T, visited?: WeakMap<object, any>): T;
|
|
13
|
+
//# sourceMappingURL=deep-clone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-clone.d.ts","sourceRoot":"","sources":["../../src/helper/deep-clone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,uBAA6B,GAAG,CAAC,CA+DpF"}
|
|
@@ -2,6 +2,7 @@ export * from './api';
|
|
|
2
2
|
export * from './canvas-3ds';
|
|
3
3
|
export * from './checkout-button';
|
|
4
4
|
export * from './external-checkout';
|
|
5
|
+
export * from './fraud-prevention';
|
|
5
6
|
export * from './payment-source-widget';
|
|
6
7
|
export * from './payment-source';
|
|
7
8
|
export * from './secure-remote-commerce';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-cba.d.ts","sourceRoot":"","sources":["../src/index-cba.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAE7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index-cba.d.ts","sourceRoot":"","sources":["../src/index-cba.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAE7C,OAAO,EACL,OAAO,EACP,UAAU,EACV,KAAK,EACL,oBAAoB,EACpB,IAAI,EACJ,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
|
package/bundles/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './api';
|
|
|
2
2
|
export * from './canvas-3ds';
|
|
3
3
|
export * from './checkout-button';
|
|
4
4
|
export * from './external-checkout';
|
|
5
|
+
export * from './fraud-prevention';
|
|
5
6
|
export * from './payment-source-widget';
|
|
6
7
|
export * from './payment-source';
|
|
7
8
|
export * from './secure-remote-commerce';
|
|
@@ -12,7 +13,7 @@ export * from './checkout/index';
|
|
|
12
13
|
export * from './wallet-buttons-express';
|
|
13
14
|
export * from './paypal-data-collector';
|
|
14
15
|
export * from './paypal-save-payment-source';
|
|
15
|
-
export { ELEMENT, FORM_FIELD, STYLE, SUPPORTED_CARD_TYPES, TEXT, VAULT_DISPLAY_STYLE, type IPayPalMeta, type IStyles, type ITexts, type VaultDisplayStyle, IWalletMeta, } from './components/param';
|
|
16
|
+
export { ELEMENT, FORM_FIELD, STYLE, SUPPORTED_CARD_TYPES, TEXT, VAULT_DISPLAY_STYLE, type IPayPalMeta, type IStyles, type ITexts, type VaultDisplayStyle, type IWalletMeta, } from './components/param';
|
|
16
17
|
export { EVENT } from './components/iframe-event';
|
|
17
18
|
export { TRIGGER } from './components/trigger';
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAE7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAE7C,OAAO,EACL,OAAO,EACP,UAAU,EACV,KAAK,EACL,oBAAoB,EACpB,IAAI,EACJ,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click-to-pay-secure-remote-commerce.d.ts","sourceRoot":"","sources":["../../src/secure-remote-commerce/click-to-pay-secure-remote-commerce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"click-to-pay-secure-remote-commerce.d.ts","sourceRoot":"","sources":["../../src/secure-remote-commerce/click-to-pay-secure-remote-commerce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AACH,cAAM,UAAW,SAAQ,GAAG;IAEZ,SAAS,CAAC,eAAe,EAAE,MAAM;IAAE,SAAS,CAAC,UAAU,EAAE,MAAM;IAAE,SAAS,CAAC,0BAA0B,EAAE,MAAM;IAAE,SAAS,CAAC,IAAI,EAAE,eAAe;IAD1J,kBAAkB,aACI,eAAe,EAAE,MAAM,EAAY,UAAU,EAAE,MAAM,EAAY,0BAA0B,EAAE,MAAM,EAAY,IAAI,EAAE,eAAe;IAI1J;;;OAGG;IACI,IAAI,IAAI,IAAI;CAmBtB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the user agent from the browser.
|
|
3
|
+
*
|
|
4
|
+
* @returns {string} The user agent from the browser
|
|
5
|
+
*/
|
|
6
|
+
export declare function getDeviceUserAgent(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the device IP address from the API.
|
|
9
|
+
*
|
|
10
|
+
* @returns {Promise<string>} The device IP address
|
|
11
|
+
*/
|
|
12
|
+
export declare function getDeviceIpAddress(): Promise<string>;
|
|
13
|
+
//# sourceMappingURL=device-info.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-info.service.d.ts","sourceRoot":"","sources":["../../../src/shared/device/device-info.service.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAqB1D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { HttpFetcher } from './http-fetcher';
|
|
2
|
+
export declare abstract class AuthorizationStrategy {
|
|
3
|
+
abstract apply(httpFetch: HttpFetcher): void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Implementation of AuthorizationStrategy that uses an access token for authorization.
|
|
7
|
+
*
|
|
8
|
+
* This strategy configures the SDK Services and Widgets to use access token authentication.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AccessTokenStrategy extends AuthorizationStrategy {
|
|
11
|
+
private readonly accessToken;
|
|
12
|
+
/**
|
|
13
|
+
* @constructor Creates an instance of AuthorizationStrategy which enables authorization by access token
|
|
14
|
+
*
|
|
15
|
+
* @param accessToken
|
|
16
|
+
*/
|
|
17
|
+
constructor(accessToken: string);
|
|
18
|
+
apply(httpFetch: HttpFetcher): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Implementation of AuthorizationStrategy that preserves Services and Widgets in an anonymous state.
|
|
22
|
+
*/
|
|
23
|
+
export declare class AnonymousStrategy extends AuthorizationStrategy {
|
|
24
|
+
apply(_: HttpFetcher): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Implementation of AuthorizationStrategy that uses a public key for authorization.
|
|
28
|
+
*
|
|
29
|
+
* This strategy configures the SDK Services and Widgets to use public key authentication.
|
|
30
|
+
*/
|
|
31
|
+
export declare class PublicKeyStrategy extends AuthorizationStrategy {
|
|
32
|
+
private readonly publicKey;
|
|
33
|
+
/**
|
|
34
|
+
* @constructor Creates an instance of AuthorizationStrategy which enables authorization by public key
|
|
35
|
+
*
|
|
36
|
+
* @param publicKey
|
|
37
|
+
*/
|
|
38
|
+
constructor(publicKey: string);
|
|
39
|
+
apply(httpFetch: HttpFetcher): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=authorization-strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-strategy.d.ts","sourceRoot":"","sources":["../../../src/shared/http/authorization-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,8BAAsB,qBAAqB;aACzB,KAAK,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI;CACpD;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,qBAAqB;IAMhD,OAAO,CAAC,QAAQ,CAAC,WAAW;IALxC;;;;OAIG;gBAC0B,WAAW,EAAE,MAAM;IAUzC,KAAK,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI;CAG3C;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,qBAAqB;IACnD,KAAK,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI;CAGnC;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,qBAAqB;IAM9C,OAAO,CAAC,QAAQ,CAAC,SAAS;IALtC;;;;OAIG;gBAC0B,SAAS,EAAE,MAAM;IAUvC,KAAK,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI;CAG3C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type IReportError, type ReportErrorFn } from '../../shared/services/instrumentation/repositories';
|
|
2
|
+
import type { Result } from '../shared.constants';
|
|
3
|
+
type SerializablePrimitive = string | number | bigint | boolean | null;
|
|
4
|
+
type BodyInit = SerializablePrimitive | Record<string, SerializablePrimitive> | Array<SerializablePrimitive>;
|
|
5
|
+
export declare class HttpFetcher implements IReportError {
|
|
6
|
+
private baseUrl;
|
|
7
|
+
private body;
|
|
8
|
+
private headers;
|
|
9
|
+
constructor();
|
|
10
|
+
reportError: ReportErrorFn;
|
|
11
|
+
setAccessToken(accessToken: string): HttpFetcher;
|
|
12
|
+
setBaseUrl(baseUrl: string): HttpFetcher;
|
|
13
|
+
setBody<TBody extends BodyInit>(body: TBody): HttpFetcher;
|
|
14
|
+
setContentTypeJson(): HttpFetcher;
|
|
15
|
+
setContentTypeText(): HttpFetcher;
|
|
16
|
+
setHeaders(headers: HeadersInit): HttpFetcher;
|
|
17
|
+
setPublicKey(publicKey: string): HttpFetcher;
|
|
18
|
+
setSdkVersion(): HttpFetcher;
|
|
19
|
+
execute<S = unknown, E = unknown>(method: 'DELETE' | 'GET' | 'POST' | 'PUT' | 'PATCH', path: string): Promise<Result<{
|
|
20
|
+
statusCode: number;
|
|
21
|
+
body: S;
|
|
22
|
+
}, {
|
|
23
|
+
statusCode: number;
|
|
24
|
+
body: E;
|
|
25
|
+
}>>;
|
|
26
|
+
value(): Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=http-fetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-fetcher.d.ts","sourceRoot":"","sources":["../../../src/shared/http/http-fetcher.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,oDAAoD,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,KAAK,qBAAqB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAEvE,KAAK,QAAQ,GACT,qBAAqB,GACrB,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,GACrC,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAEjC,qBAAa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,IAAI,CAAW;IACvB,OAAO,CAAC,OAAO,CAAc;;IAQ7B,WAAW,EAAE,aAAa,CAExB;IAEK,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW;IAMhD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;IAMxC,OAAO,CAAC,KAAK,SAAS,QAAQ,EAAE,IAAI,EAAE,KAAK,GAAG,WAAW;IAgBzD,kBAAkB,IAAI,WAAW;IAMjC,kBAAkB,IAAI,WAAW;IAMjC,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW;IAM7C,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW;IAM5C,aAAa,IAAI,WAAW;IAStB,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAC3C,MAAM,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,EACnD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,CAAA;KAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC;IAyC7E,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAOxC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IEnvironment } from '../../configs/env';
|
|
2
|
+
import type { AuthorizationStrategy } from './authorization-strategy';
|
|
3
|
+
import { HttpFetcher } from './http-fetcher';
|
|
4
|
+
type AuthorizationStrategyRef = AuthorizationStrategy | (() => AuthorizationStrategy);
|
|
5
|
+
type HttpFetcherFactoryConfig = {
|
|
6
|
+
environment: IEnvironment;
|
|
7
|
+
authorizationStrategy: AuthorizationStrategyRef;
|
|
8
|
+
};
|
|
9
|
+
export declare class HttpFetcherFactory {
|
|
10
|
+
private environment;
|
|
11
|
+
private authorizationStrategyReference;
|
|
12
|
+
constructor(config: HttpFetcherFactoryConfig);
|
|
13
|
+
createFetcher(): HttpFetcher;
|
|
14
|
+
private get authorizationStrategyValue();
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=http-fetcher.factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-fetcher.factory.d.ts","sourceRoot":"","sources":["../../../src/shared/http/http-fetcher.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,KAAK,wBAAwB,GAAG,qBAAqB,GAAG,CAAC,MAAM,qBAAqB,CAAC,CAAC;AAEtF,KAAK,wBAAwB,GAAG;IAC9B,WAAW,EAAE,YAAY,CAAC;IAC1B,qBAAqB,EAAE,wBAAwB,CAAC;CACjD,CAAC;AAEF,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,8BAA8B,CAA2B;gBAErD,MAAM,EAAE,wBAAwB;IAKrC,aAAa,IAAI,WAAW;IAanC,OAAO,KAAK,0BAA0B,GAIrC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-request.d.ts","sourceRoot":"","sources":["../../../src/shared/http/http-request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-request.d.ts","sourceRoot":"","sources":["../../../src/shared/http/http-request.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,CAAC;AAC/C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,GAAG,CAAC;AAE1C,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAiB;IAEhC,OAAO;WAIO,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc;IAQrE,KAAK;IAIL,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAMrC,cAAc,CAAC,KAAK,EAAE,MAAM;IAI5B,YAAY,CAAC,KAAK,EAAE,MAAM;IAI1B,kBAAkB;IAIlB,aAAa;CAQrB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ApiCoreResponseFailure<T = never> = {
|
|
2
|
+
status: number;
|
|
3
|
+
error: {
|
|
4
|
+
message: string;
|
|
5
|
+
code: string;
|
|
6
|
+
details?: {
|
|
7
|
+
path: string;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type ApiCoreResponseSuccess<T> = {
|
|
13
|
+
status: number;
|
|
14
|
+
resource: {
|
|
15
|
+
type: string;
|
|
16
|
+
data: T;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=http-response.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-response.dto.d.ts","sourceRoot":"","sources":["../../../src/shared/http/http-response.dto.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,KAAK,IAAI;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE;YACR,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,CAAC,CAAC;KACT,CAAC;CACH,CAAC"}
|