@metamask/claims-controller 0.1.0 → 0.3.0
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/CHANGELOG.md +24 -1
- package/dist/ClaimsController.cjs +88 -1
- package/dist/ClaimsController.cjs.map +1 -1
- package/dist/ClaimsController.d.cts +34 -3
- package/dist/ClaimsController.d.cts.map +1 -1
- package/dist/ClaimsController.d.mts +34 -3
- package/dist/ClaimsController.d.mts.map +1 -1
- package/dist/ClaimsController.mjs +90 -3
- package/dist/ClaimsController.mjs.map +1 -1
- package/dist/ClaimsService.cjs +24 -5
- package/dist/ClaimsService.cjs.map +1 -1
- package/dist/ClaimsService.d.cts +15 -5
- package/dist/ClaimsService.d.cts.map +1 -1
- package/dist/ClaimsService.d.mts +15 -5
- package/dist/ClaimsService.d.mts.map +1 -1
- package/dist/ClaimsService.mjs +25 -6
- package/dist/ClaimsService.mjs.map +1 -1
- package/dist/constants.cjs +16 -7
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +9 -5
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +9 -5
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +15 -6
- package/dist/constants.mjs.map +1 -1
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +35 -4
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +35 -4
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClaimsService.cjs","sourceRoot":"","sources":["../src/ClaimsService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAIA,+
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e;QACb,OAAO,GAAG,8BAAkB,CAAC,uBAAA,IAAI,0BAAK,CAAC,EAAE,CAAC;IAC5C,CAAC;CACF;AAhKD,sCAgKC","sourcesContent":["import type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport type { Hex } from '@metamask/utils';\n\nimport {\n CLAIMS_API_URL_MAP,\n ClaimsServiceErrorMessages,\n SERVICE_NAME,\n} from './constants';\nimport type { Env } from './constants';\nimport type {\n Claim,\n ClaimsConfigurationsResponse,\n GenerateSignatureMessageResponse,\n} from './types';\n\nexport type ClaimsServiceFetchClaimsConfigurationsAction = {\n type: `${typeof SERVICE_NAME}:fetchClaimsConfigurations`;\n handler: ClaimsService['fetchClaimsConfigurations'];\n};\n\nexport type ClaimsServiceGetClaimsAction = {\n type: `${typeof SERVICE_NAME}:getClaims`;\n handler: ClaimsService['getClaims'];\n};\n\nexport type ClaimsServiceGetClaimByIdAction = {\n type: `${typeof SERVICE_NAME}:getClaimById`;\n handler: ClaimsService['getClaimById'];\n};\n\nexport type ClaimsServiceGetRequestHeadersAction = {\n type: `${typeof SERVICE_NAME}:getRequestHeaders`;\n handler: ClaimsService['getRequestHeaders'];\n};\n\nexport type ClaimsServiceGetClaimsApiUrlAction = {\n type: `${typeof SERVICE_NAME}:getClaimsApiUrl`;\n handler: ClaimsService['getClaimsApiUrl'];\n};\n\nexport type ClaimsServiceGenerateMessageForClaimSignatureAction = {\n type: `${typeof SERVICE_NAME}:generateMessageForClaimSignature`;\n handler: ClaimsService['generateMessageForClaimSignature'];\n};\n\nexport type ClaimsServiceActions =\n | ClaimsServiceFetchClaimsConfigurationsAction\n | ClaimsServiceGetClaimsAction\n | ClaimsServiceGetClaimByIdAction\n | ClaimsServiceGetRequestHeadersAction\n | ClaimsServiceGetClaimsApiUrlAction\n | ClaimsServiceGenerateMessageForClaimSignatureAction;\n\nexport type AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerToken;\n\nexport type ClaimsServiceEvents = never;\n\nexport type ClaimsServiceMessenger = Messenger<\n typeof SERVICE_NAME,\n ClaimsServiceActions | AllowedActions\n>;\n\nexport type ClaimsServiceConfig = {\n env: Env;\n messenger: ClaimsServiceMessenger;\n fetchFunction: typeof fetch;\n};\n\nexport class ClaimsService {\n readonly name = SERVICE_NAME; // required for Modular Initialization\n\n readonly #env: Env;\n\n readonly #fetch: typeof fetch;\n\n readonly #messenger: ClaimsServiceMessenger;\n\n constructor({ env, messenger, fetchFunction }: ClaimsServiceConfig) {\n this.#env = env;\n this.#messenger = messenger;\n this.#fetch = fetchFunction;\n\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:fetchClaimsConfigurations`,\n this.fetchClaimsConfigurations.bind(this),\n );\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:getClaims`,\n this.getClaims.bind(this),\n );\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:getClaimById`,\n this.getClaimById.bind(this),\n );\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:getRequestHeaders`,\n this.getRequestHeaders.bind(this),\n );\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:getClaimsApiUrl`,\n this.getClaimsApiUrl.bind(this),\n );\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:generateMessageForClaimSignature`,\n this.generateMessageForClaimSignature.bind(this),\n );\n }\n\n /**\n * Fetch required configurations for the claims service.\n *\n * @returns The required configurations for the claims service.\n */\n async fetchClaimsConfigurations(): Promise<ClaimsConfigurationsResponse> {\n const headers = await this.getRequestHeaders();\n const url = `${this.getClaimsApiUrl()}/configurations`;\n const response = await this.#fetch(url, {\n headers,\n });\n\n if (!response.ok) {\n throw new Error(\n ClaimsServiceErrorMessages.FAILED_TO_FETCH_CONFIGURATIONS,\n );\n }\n\n const configurations = await response.json();\n return configurations;\n }\n\n /**\n * Get the claims for the current user.\n *\n * @returns The claims for the current user.\n */\n async getClaims(): Promise<Claim[]> {\n const headers = await this.getRequestHeaders();\n const url = `${this.getClaimsApiUrl()}/claims`;\n const response = await this.#fetch(url, {\n headers,\n });\n\n if (!response.ok) {\n throw new Error(ClaimsServiceErrorMessages.FAILED_TO_GET_CLAIMS);\n }\n\n const claims = await response.json();\n return claims;\n }\n\n /**\n * Get the claim by id.\n *\n * @param id - The id of the claim to get.\n * @returns The claim by id.\n */\n async getClaimById(id: string): Promise<Claim> {\n const headers = await this.getRequestHeaders();\n const url = `${this.getClaimsApiUrl()}/claims/byId/${id}`;\n const response = await this.#fetch(url, {\n headers,\n });\n\n if (!response.ok) {\n throw new Error(ClaimsServiceErrorMessages.FAILED_TO_GET_CLAIM_BY_ID);\n }\n\n const claim = await response.json();\n return claim;\n }\n\n /**\n * Generate a message to be signed by the user for the claim request.\n *\n * @param chainId - The chain id of the claim.\n * @param walletAddress - The impacted wallet address of the claim.\n * @returns The message for the claim signature.\n */\n async generateMessageForClaimSignature(\n chainId: number,\n walletAddress: Hex,\n ): Promise<GenerateSignatureMessageResponse> {\n const headers = await this.getRequestHeaders();\n const url = `${this.getClaimsApiUrl()}/signature/generateMessage`;\n const response = await this.#fetch(url, {\n method: 'POST',\n headers: {\n ...headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n chainId,\n walletAddress,\n }),\n });\n\n if (!response.ok) {\n throw new Error(\n ClaimsServiceErrorMessages.SIGNATURE_MESSAGE_GENERATION_FAILED,\n );\n }\n\n const message = await response.json();\n return message;\n }\n\n /**\n * Create the headers for the current request.\n *\n * @returns The headers for the current request.\n */\n async getRequestHeaders(): Promise<Record<string, string>> {\n const bearerToken = await this.#messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return {\n Authorization: `Bearer ${bearerToken}`,\n };\n }\n\n /**\n * Get the URL for the claims API for the current environment.\n *\n * @returns The URL for the claims API for the current environment.\n */\n getClaimsApiUrl(): string {\n return `${CLAIMS_API_URL_MAP[this.#env]}`;\n }\n}\n"]}
|
package/dist/ClaimsService.d.cts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { Messenger } from "@metamask/messenger";
|
|
2
2
|
import type { AuthenticationController } from "@metamask/profile-sync-controller";
|
|
3
3
|
import type { Hex } from "@metamask/utils";
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
4
|
+
import { SERVICE_NAME } from "./constants.cjs";
|
|
5
|
+
import type { Env } from "./constants.cjs";
|
|
6
|
+
import type { Claim, ClaimsConfigurationsResponse, GenerateSignatureMessageResponse } from "./types.cjs";
|
|
7
|
+
export type ClaimsServiceFetchClaimsConfigurationsAction = {
|
|
8
|
+
type: `${typeof SERVICE_NAME}:fetchClaimsConfigurations`;
|
|
9
|
+
handler: ClaimsService['fetchClaimsConfigurations'];
|
|
10
|
+
};
|
|
6
11
|
export type ClaimsServiceGetClaimsAction = {
|
|
7
12
|
type: `${typeof SERVICE_NAME}:getClaims`;
|
|
8
13
|
handler: ClaimsService['getClaims'];
|
|
@@ -23,7 +28,7 @@ export type ClaimsServiceGenerateMessageForClaimSignatureAction = {
|
|
|
23
28
|
type: `${typeof SERVICE_NAME}:generateMessageForClaimSignature`;
|
|
24
29
|
handler: ClaimsService['generateMessageForClaimSignature'];
|
|
25
30
|
};
|
|
26
|
-
export type ClaimsServiceActions = ClaimsServiceGetClaimsAction | ClaimsServiceGetClaimByIdAction | ClaimsServiceGetRequestHeadersAction | ClaimsServiceGetClaimsApiUrlAction | ClaimsServiceGenerateMessageForClaimSignatureAction;
|
|
31
|
+
export type ClaimsServiceActions = ClaimsServiceFetchClaimsConfigurationsAction | ClaimsServiceGetClaimsAction | ClaimsServiceGetClaimByIdAction | ClaimsServiceGetRequestHeadersAction | ClaimsServiceGetClaimsApiUrlAction | ClaimsServiceGenerateMessageForClaimSignatureAction;
|
|
27
32
|
export type AllowedActions = AuthenticationController.AuthenticationControllerGetBearerToken;
|
|
28
33
|
export type ClaimsServiceEvents = never;
|
|
29
34
|
export type ClaimsServiceMessenger = Messenger<typeof SERVICE_NAME, ClaimsServiceActions | AllowedActions>;
|
|
@@ -36,6 +41,12 @@ export declare class ClaimsService {
|
|
|
36
41
|
#private;
|
|
37
42
|
readonly name = "ClaimsService";
|
|
38
43
|
constructor({ env, messenger, fetchFunction }: ClaimsServiceConfig);
|
|
44
|
+
/**
|
|
45
|
+
* Fetch required configurations for the claims service.
|
|
46
|
+
*
|
|
47
|
+
* @returns The required configurations for the claims service.
|
|
48
|
+
*/
|
|
49
|
+
fetchClaimsConfigurations(): Promise<ClaimsConfigurationsResponse>;
|
|
39
50
|
/**
|
|
40
51
|
* Get the claims for the current user.
|
|
41
52
|
*
|
|
@@ -60,10 +71,9 @@ export declare class ClaimsService {
|
|
|
60
71
|
/**
|
|
61
72
|
* Create the headers for the current request.
|
|
62
73
|
*
|
|
63
|
-
* @param contentType - The content type of the request. Defaults to 'application/json'.
|
|
64
74
|
* @returns The headers for the current request.
|
|
65
75
|
*/
|
|
66
|
-
getRequestHeaders(
|
|
76
|
+
getRequestHeaders(): Promise<Record<string, string>>;
|
|
67
77
|
/**
|
|
68
78
|
* Get the URL for the claims API for the current environment.
|
|
69
79
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClaimsService.d.cts","sourceRoot":"","sources":["../src/ClaimsService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,0CAA0C;AAClF,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C,OAAO,EAGL,
|
|
1
|
+
{"version":3,"file":"ClaimsService.d.cts","sourceRoot":"","sources":["../src/ClaimsService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,0CAA0C;AAClF,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C,OAAO,EAGL,YAAY,EACb,wBAAoB;AACrB,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAoB;AACvC,O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AAoB,GAAG,cAAc,CACtC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,GAAG,CAAC;IACT,SAAS,EAAE,sBAAsB,CAAC;IAClC,aAAa,EAAE,OAAO,KAAK,CAAC;CAC7B,CAAC;AAEF,qBAAa,aAAa;;IACxB,QAAQ,CAAC,IAAI,mBAAgB;gBAQjB,EAAE,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,mBAAmB;IA+BlE;;;;OAIG;IACG,yBAAyB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAiBxE;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAenC;;;;;OAKG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAe9C;;;;;;OAMG;IACG,gCAAgC,CACpC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,GAAG,GACjB,OAAO,CAAC,gCAAgC,CAAC;IAyB5C;;;;OAIG;IACG,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAS1D;;;;OAIG;IACH,eAAe,IAAI,MAAM;CAG1B"}
|
package/dist/ClaimsService.d.mts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { Messenger } from "@metamask/messenger";
|
|
2
2
|
import type { AuthenticationController } from "@metamask/profile-sync-controller";
|
|
3
3
|
import type { Hex } from "@metamask/utils";
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
4
|
+
import { SERVICE_NAME } from "./constants.mjs";
|
|
5
|
+
import type { Env } from "./constants.mjs";
|
|
6
|
+
import type { Claim, ClaimsConfigurationsResponse, GenerateSignatureMessageResponse } from "./types.mjs";
|
|
7
|
+
export type ClaimsServiceFetchClaimsConfigurationsAction = {
|
|
8
|
+
type: `${typeof SERVICE_NAME}:fetchClaimsConfigurations`;
|
|
9
|
+
handler: ClaimsService['fetchClaimsConfigurations'];
|
|
10
|
+
};
|
|
6
11
|
export type ClaimsServiceGetClaimsAction = {
|
|
7
12
|
type: `${typeof SERVICE_NAME}:getClaims`;
|
|
8
13
|
handler: ClaimsService['getClaims'];
|
|
@@ -23,7 +28,7 @@ export type ClaimsServiceGenerateMessageForClaimSignatureAction = {
|
|
|
23
28
|
type: `${typeof SERVICE_NAME}:generateMessageForClaimSignature`;
|
|
24
29
|
handler: ClaimsService['generateMessageForClaimSignature'];
|
|
25
30
|
};
|
|
26
|
-
export type ClaimsServiceActions = ClaimsServiceGetClaimsAction | ClaimsServiceGetClaimByIdAction | ClaimsServiceGetRequestHeadersAction | ClaimsServiceGetClaimsApiUrlAction | ClaimsServiceGenerateMessageForClaimSignatureAction;
|
|
31
|
+
export type ClaimsServiceActions = ClaimsServiceFetchClaimsConfigurationsAction | ClaimsServiceGetClaimsAction | ClaimsServiceGetClaimByIdAction | ClaimsServiceGetRequestHeadersAction | ClaimsServiceGetClaimsApiUrlAction | ClaimsServiceGenerateMessageForClaimSignatureAction;
|
|
27
32
|
export type AllowedActions = AuthenticationController.AuthenticationControllerGetBearerToken;
|
|
28
33
|
export type ClaimsServiceEvents = never;
|
|
29
34
|
export type ClaimsServiceMessenger = Messenger<typeof SERVICE_NAME, ClaimsServiceActions | AllowedActions>;
|
|
@@ -36,6 +41,12 @@ export declare class ClaimsService {
|
|
|
36
41
|
#private;
|
|
37
42
|
readonly name = "ClaimsService";
|
|
38
43
|
constructor({ env, messenger, fetchFunction }: ClaimsServiceConfig);
|
|
44
|
+
/**
|
|
45
|
+
* Fetch required configurations for the claims service.
|
|
46
|
+
*
|
|
47
|
+
* @returns The required configurations for the claims service.
|
|
48
|
+
*/
|
|
49
|
+
fetchClaimsConfigurations(): Promise<ClaimsConfigurationsResponse>;
|
|
39
50
|
/**
|
|
40
51
|
* Get the claims for the current user.
|
|
41
52
|
*
|
|
@@ -60,10 +71,9 @@ export declare class ClaimsService {
|
|
|
60
71
|
/**
|
|
61
72
|
* Create the headers for the current request.
|
|
62
73
|
*
|
|
63
|
-
* @param contentType - The content type of the request. Defaults to 'application/json'.
|
|
64
74
|
* @returns The headers for the current request.
|
|
65
75
|
*/
|
|
66
|
-
getRequestHeaders(
|
|
76
|
+
getRequestHeaders(): Promise<Record<string, string>>;
|
|
67
77
|
/**
|
|
68
78
|
* Get the URL for the claims API for the current environment.
|
|
69
79
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClaimsService.d.mts","sourceRoot":"","sources":["../src/ClaimsService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,0CAA0C;AAClF,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C,OAAO,EAGL,
|
|
1
|
+
{"version":3,"file":"ClaimsService.d.mts","sourceRoot":"","sources":["../src/ClaimsService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,0CAA0C;AAClF,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C,OAAO,EAGL,YAAY,EACb,wBAAoB;AACrB,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAoB;AACvC,OAAO,KAAK,EACV,KAAK,EACL,4BAA4B,EAC5B,gCAAgC,EACjC,oBAAgB;AAEjB,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,GAAG,OAAO,YAAY,4BAA4B,CAAC;IACzD,OAAO,EAAE,aAAa,CAAC,2BAA2B,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,GAAG,OAAO,YAAY,YAAY,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,GAAG,OAAO,YA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C;IAenC;;;;;OAKG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAe9C;;;;;;OAMG;IACG,gCAAgC,CACpC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,GAAG,GACjB,OAAO,CAAC,gCAAgC,CAAC;IAyB5C;;;;OAIG;IACG,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAS1D;;;;OAIG;IACH,eAAe,IAAI,MAAM;CAG1B"}
|
package/dist/ClaimsService.mjs
CHANGED
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _ClaimsService_env, _ClaimsService_fetch, _ClaimsService_messenger;
|
|
13
|
-
import {
|
|
13
|
+
import { CLAIMS_API_URL_MAP, ClaimsServiceErrorMessages, SERVICE_NAME } from "./constants.mjs";
|
|
14
14
|
export class ClaimsService {
|
|
15
15
|
constructor({ env, messenger, fetchFunction }) {
|
|
16
16
|
this.name = SERVICE_NAME; // required for Modular Initialization
|
|
@@ -20,12 +20,30 @@ export class ClaimsService {
|
|
|
20
20
|
__classPrivateFieldSet(this, _ClaimsService_env, env, "f");
|
|
21
21
|
__classPrivateFieldSet(this, _ClaimsService_messenger, messenger, "f");
|
|
22
22
|
__classPrivateFieldSet(this, _ClaimsService_fetch, fetchFunction, "f");
|
|
23
|
+
__classPrivateFieldGet(this, _ClaimsService_messenger, "f").registerActionHandler(`${SERVICE_NAME}:fetchClaimsConfigurations`, this.fetchClaimsConfigurations.bind(this));
|
|
23
24
|
__classPrivateFieldGet(this, _ClaimsService_messenger, "f").registerActionHandler(`${SERVICE_NAME}:getClaims`, this.getClaims.bind(this));
|
|
24
25
|
__classPrivateFieldGet(this, _ClaimsService_messenger, "f").registerActionHandler(`${SERVICE_NAME}:getClaimById`, this.getClaimById.bind(this));
|
|
25
26
|
__classPrivateFieldGet(this, _ClaimsService_messenger, "f").registerActionHandler(`${SERVICE_NAME}:getRequestHeaders`, this.getRequestHeaders.bind(this));
|
|
26
27
|
__classPrivateFieldGet(this, _ClaimsService_messenger, "f").registerActionHandler(`${SERVICE_NAME}:getClaimsApiUrl`, this.getClaimsApiUrl.bind(this));
|
|
27
28
|
__classPrivateFieldGet(this, _ClaimsService_messenger, "f").registerActionHandler(`${SERVICE_NAME}:generateMessageForClaimSignature`, this.generateMessageForClaimSignature.bind(this));
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Fetch required configurations for the claims service.
|
|
32
|
+
*
|
|
33
|
+
* @returns The required configurations for the claims service.
|
|
34
|
+
*/
|
|
35
|
+
async fetchClaimsConfigurations() {
|
|
36
|
+
const headers = await this.getRequestHeaders();
|
|
37
|
+
const url = `${this.getClaimsApiUrl()}/configurations`;
|
|
38
|
+
const response = await __classPrivateFieldGet(this, _ClaimsService_fetch, "f").call(this, url, {
|
|
39
|
+
headers,
|
|
40
|
+
});
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
throw new Error(ClaimsServiceErrorMessages.FAILED_TO_FETCH_CONFIGURATIONS);
|
|
43
|
+
}
|
|
44
|
+
const configurations = await response.json();
|
|
45
|
+
return configurations;
|
|
46
|
+
}
|
|
29
47
|
/**
|
|
30
48
|
* Get the claims for the current user.
|
|
31
49
|
*
|
|
@@ -72,8 +90,11 @@ export class ClaimsService {
|
|
|
72
90
|
const headers = await this.getRequestHeaders();
|
|
73
91
|
const url = `${this.getClaimsApiUrl()}/signature/generateMessage`;
|
|
74
92
|
const response = await __classPrivateFieldGet(this, _ClaimsService_fetch, "f").call(this, url, {
|
|
75
|
-
headers,
|
|
76
93
|
method: 'POST',
|
|
94
|
+
headers: {
|
|
95
|
+
...headers,
|
|
96
|
+
'Content-Type': 'application/json',
|
|
97
|
+
},
|
|
77
98
|
body: JSON.stringify({
|
|
78
99
|
chainId,
|
|
79
100
|
walletAddress,
|
|
@@ -88,14 +109,12 @@ export class ClaimsService {
|
|
|
88
109
|
/**
|
|
89
110
|
* Create the headers for the current request.
|
|
90
111
|
*
|
|
91
|
-
* @param contentType - The content type of the request. Defaults to 'application/json'.
|
|
92
112
|
* @returns The headers for the current request.
|
|
93
113
|
*/
|
|
94
|
-
async getRequestHeaders(
|
|
114
|
+
async getRequestHeaders() {
|
|
95
115
|
const bearerToken = await __classPrivateFieldGet(this, _ClaimsService_messenger, "f").call('AuthenticationController:getBearerToken');
|
|
96
116
|
return {
|
|
97
117
|
Authorization: `Bearer ${bearerToken}`,
|
|
98
|
-
'Content-Type': contentType,
|
|
99
118
|
};
|
|
100
119
|
}
|
|
101
120
|
/**
|
|
@@ -104,7 +123,7 @@ export class ClaimsService {
|
|
|
104
123
|
* @returns The URL for the claims API for the current environment.
|
|
105
124
|
*/
|
|
106
125
|
getClaimsApiUrl() {
|
|
107
|
-
return `${
|
|
126
|
+
return `${CLAIMS_API_URL_MAP[__classPrivateFieldGet(this, _ClaimsService_env, "f")]}`;
|
|
108
127
|
}
|
|
109
128
|
}
|
|
110
129
|
_ClaimsService_env = new WeakMap(), _ClaimsService_fetch = new WeakMap(), _ClaimsService_messenger = new WeakMap();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClaimsService.mjs","sourceRoot":"","sources":["../src/ClaimsService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"ClaimsService.mjs","sourceRoot":"","sources":["../src/ClaimsService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACb,wBAAoB;AA8DrB,MAAM,OAAO,aAAa;IASxB,YAAY,EAAE,GAAG,EAAE,SAAS,EAAE,aAAa,EAAuB;QARzD,SAAI,GAAG,YAAY,CAAC,CAAC,sCAAsC;QAE3D,qCAAU;QA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CAAC,IAAI,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gCAAgC,CACpC,OAAe,EACf,aAAkB;QAElB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC/C,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,eAAe,EAAE,4BAA4B,CAAC;QAClE,MAAM,QAAQ,GAAG,MAAM,uBAAA,IAAI,4BAAO,MAAX,IAAI,EAAQ,GAAG,EAAE;YACtC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,GAAG,OAAO;gBACV,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,OAAO;gBACP,aAAa;aACd,CAAC;SACH,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,0BAA0B,CAAC,mCAAmC,CAC/D,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB;QACrB,MAAM,WAAW,GAAG,MAAM,uBAAA,IAAI,gCAAW,CAAC,IAAI,CAC5C,yCAAyC,CAC1C,CAAC;QACF,OAAO;YACL,aAAa,EAAE,UAAU,WAAW,EAAE;SACvC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,eAAe;QACb,OAAO,GAAG,kBAAkB,CAAC,uBAAA,IAAI,0BAAK,CAAC,EAAE,CAAC;IAC5C,CAAC;CACF","sourcesContent":["import type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport type { Hex } from '@metamask/utils';\n\nimport {\n CLAIMS_API_URL_MAP,\n ClaimsServiceErrorMessages,\n SERVICE_NAME,\n} from './constants';\nimport type { Env } from './constants';\nimport type {\n Claim,\n ClaimsConfigurationsResponse,\n GenerateSignatureMessageResponse,\n} from './types';\n\nexport type ClaimsServiceFetchClaimsConfigurationsAction = {\n type: `${typeof SERVICE_NAME}:fetchClaimsConfigurations`;\n handler: ClaimsService['fetchClaimsConfigurations'];\n};\n\nexport type ClaimsServiceGetClaimsAction = {\n type: `${typeof SERVICE_NAME}:getClaims`;\n handler: ClaimsService['getClaims'];\n};\n\nexport type ClaimsServiceGetClaimByIdAction = {\n type: `${typeof SERVICE_NAME}:getClaimById`;\n handler: ClaimsService['getClaimById'];\n};\n\nexport type ClaimsServiceGetRequestHeadersAction = {\n type: `${typeof SERVICE_NAME}:getRequestHeaders`;\n handler: ClaimsService['getRequestHeaders'];\n};\n\nexport type ClaimsServiceGetClaimsApiUrlAction = {\n type: `${typeof SERVICE_NAME}:getClaimsApiUrl`;\n handler: ClaimsService['getClaimsApiUrl'];\n};\n\nexport type ClaimsServiceGenerateMessageForClaimSignatureAction = {\n type: `${typeof SERVICE_NAME}:generateMessageForClaimSignature`;\n handler: ClaimsService['generateMessageForClaimSignature'];\n};\n\nexport type ClaimsServiceActions =\n | ClaimsServiceFetchClaimsConfigurationsAction\n | ClaimsServiceGetClaimsAction\n | ClaimsServiceGetClaimByIdAction\n | ClaimsServiceGetRequestHeadersAction\n | ClaimsServiceGetClaimsApiUrlAction\n | ClaimsServiceGenerateMessageForClaimSignatureAction;\n\nexport type AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerToken;\n\nexport type ClaimsServiceEvents = never;\n\nexport type ClaimsServiceMessenger = Messenger<\n typeof SERVICE_NAME,\n ClaimsServiceActions | AllowedActions\n>;\n\nexport type ClaimsServiceConfig = {\n env: Env;\n messenger: ClaimsServiceMessenger;\n fetchFunction: typeof fetch;\n};\n\nexport class ClaimsService {\n readonly name = SERVICE_NAME; // required for Modular Initialization\n\n readonly #env: Env;\n\n readonly #fetch: typeof fetch;\n\n readonly #messenger: ClaimsServiceMessenger;\n\n constructor({ env, messenger, fetchFunction }: ClaimsServiceConfig) {\n this.#env = env;\n this.#messenger = messenger;\n this.#fetch = fetchFunction;\n\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:fetchClaimsConfigurations`,\n this.fetchClaimsConfigurations.bind(this),\n );\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:getClaims`,\n this.getClaims.bind(this),\n );\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:getClaimById`,\n this.getClaimById.bind(this),\n );\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:getRequestHeaders`,\n this.getRequestHeaders.bind(this),\n );\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:getClaimsApiUrl`,\n this.getClaimsApiUrl.bind(this),\n );\n this.#messenger.registerActionHandler(\n `${SERVICE_NAME}:generateMessageForClaimSignature`,\n this.generateMessageForClaimSignature.bind(this),\n );\n }\n\n /**\n * Fetch required configurations for the claims service.\n *\n * @returns The required configurations for the claims service.\n */\n async fetchClaimsConfigurations(): Promise<ClaimsConfigurationsResponse> {\n const headers = await this.getRequestHeaders();\n const url = `${this.getClaimsApiUrl()}/configurations`;\n const response = await this.#fetch(url, {\n headers,\n });\n\n if (!response.ok) {\n throw new Error(\n ClaimsServiceErrorMessages.FAILED_TO_FETCH_CONFIGURATIONS,\n );\n }\n\n const configurations = await response.json();\n return configurations;\n }\n\n /**\n * Get the claims for the current user.\n *\n * @returns The claims for the current user.\n */\n async getClaims(): Promise<Claim[]> {\n const headers = await this.getRequestHeaders();\n const url = `${this.getClaimsApiUrl()}/claims`;\n const response = await this.#fetch(url, {\n headers,\n });\n\n if (!response.ok) {\n throw new Error(ClaimsServiceErrorMessages.FAILED_TO_GET_CLAIMS);\n }\n\n const claims = await response.json();\n return claims;\n }\n\n /**\n * Get the claim by id.\n *\n * @param id - The id of the claim to get.\n * @returns The claim by id.\n */\n async getClaimById(id: string): Promise<Claim> {\n const headers = await this.getRequestHeaders();\n const url = `${this.getClaimsApiUrl()}/claims/byId/${id}`;\n const response = await this.#fetch(url, {\n headers,\n });\n\n if (!response.ok) {\n throw new Error(ClaimsServiceErrorMessages.FAILED_TO_GET_CLAIM_BY_ID);\n }\n\n const claim = await response.json();\n return claim;\n }\n\n /**\n * Generate a message to be signed by the user for the claim request.\n *\n * @param chainId - The chain id of the claim.\n * @param walletAddress - The impacted wallet address of the claim.\n * @returns The message for the claim signature.\n */\n async generateMessageForClaimSignature(\n chainId: number,\n walletAddress: Hex,\n ): Promise<GenerateSignatureMessageResponse> {\n const headers = await this.getRequestHeaders();\n const url = `${this.getClaimsApiUrl()}/signature/generateMessage`;\n const response = await this.#fetch(url, {\n method: 'POST',\n headers: {\n ...headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n chainId,\n walletAddress,\n }),\n });\n\n if (!response.ok) {\n throw new Error(\n ClaimsServiceErrorMessages.SIGNATURE_MESSAGE_GENERATION_FAILED,\n );\n }\n\n const message = await response.json();\n return message;\n }\n\n /**\n * Create the headers for the current request.\n *\n * @returns The headers for the current request.\n */\n async getRequestHeaders(): Promise<Record<string, string>> {\n const bearerToken = await this.#messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return {\n Authorization: `Bearer ${bearerToken}`,\n };\n }\n\n /**\n * Get the URL for the claims API for the current environment.\n *\n * @returns The URL for the claims API for the current environment.\n */\n getClaimsApiUrl(): string {\n return `${CLAIMS_API_URL_MAP[this.#env]}`;\n }\n}\n"]}
|
package/dist/constants.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DEFAULT_CLAIMS_CONFIGURATIONS = exports.ClaimsServiceErrorMessages = exports.ClaimsControllerErrorMessages = exports.CLAIMS_API_URL_MAP = exports.ClaimStatusEnum = exports.Env = exports.SERVICE_NAME = exports.CONTROLLER_NAME = void 0;
|
|
4
|
+
const controller_utils_1 = require("@metamask/controller-utils");
|
|
4
5
|
exports.CONTROLLER_NAME = 'ClaimsController';
|
|
5
6
|
exports.SERVICE_NAME = 'ClaimsService';
|
|
6
7
|
var Env;
|
|
@@ -16,8 +17,10 @@ var ClaimStatusEnum;
|
|
|
16
17
|
// submitted to Intercom
|
|
17
18
|
ClaimStatusEnum["SUBMITTED"] = "submitted";
|
|
18
19
|
// in progress by Intercom
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- to match the API response format
|
|
19
21
|
ClaimStatusEnum["IN_PROGRESS"] = "in_progress";
|
|
20
22
|
// waiting for customer reply
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- to match the API response format
|
|
21
24
|
ClaimStatusEnum["WAITING_FOR_CUSTOMER"] = "waiting_for_customer";
|
|
22
25
|
// approved by Intercom
|
|
23
26
|
ClaimStatusEnum["APPROVED"] = "approved";
|
|
@@ -26,25 +29,31 @@ var ClaimStatusEnum;
|
|
|
26
29
|
// unknown status
|
|
27
30
|
ClaimStatusEnum["UNKNOWN"] = "unknown";
|
|
28
31
|
})(ClaimStatusEnum || (exports.ClaimStatusEnum = ClaimStatusEnum = {}));
|
|
29
|
-
exports.
|
|
32
|
+
exports.CLAIMS_API_URL_MAP = {
|
|
30
33
|
[Env.DEV]: 'https://claims.dev-api.cx.metamask.io',
|
|
31
34
|
[Env.UAT]: 'https://claims.uat-api.cx.metamask.io',
|
|
32
35
|
[Env.PRD]: 'https://claims.api.cx.metamask.io',
|
|
33
36
|
};
|
|
34
|
-
var HttpContentTypeHeader;
|
|
35
|
-
(function (HttpContentTypeHeader) {
|
|
36
|
-
HttpContentTypeHeader["APPLICATION_JSON"] = "application/json";
|
|
37
|
-
HttpContentTypeHeader["MULTIPART_FORM_DATA"] = "multipart/form-data";
|
|
38
|
-
})(HttpContentTypeHeader || (exports.HttpContentTypeHeader = HttpContentTypeHeader = {}));
|
|
39
37
|
exports.ClaimsControllerErrorMessages = {
|
|
40
38
|
CLAIM_ALREADY_SUBMITTED: 'Claim already submitted',
|
|
41
39
|
INVALID_CLAIM_SIGNATURE: 'Invalid claim signature',
|
|
42
40
|
INVALID_SIGNATURE_MESSAGE: 'Invalid signature message',
|
|
43
41
|
};
|
|
44
42
|
exports.ClaimsServiceErrorMessages = {
|
|
43
|
+
FAILED_TO_FETCH_CONFIGURATIONS: 'Failed to fetch claims configurations',
|
|
45
44
|
FAILED_TO_GET_CLAIMS: 'Failed to get claims',
|
|
46
45
|
FAILED_TO_GET_CLAIM_BY_ID: 'Failed to get claim by id',
|
|
47
46
|
SIGNATURE_MESSAGE_GENERATION_FAILED: 'Failed to generate message for claim signature',
|
|
48
47
|
CLAIM_SIGNATURE_VERIFICATION_REQUEST_FAILED: 'Failed to verify claim signature',
|
|
49
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Default claims configurations.
|
|
51
|
+
*/
|
|
52
|
+
exports.DEFAULT_CLAIMS_CONFIGURATIONS = {
|
|
53
|
+
validSubmissionWindowDays: 21,
|
|
54
|
+
supportedNetworks: [
|
|
55
|
+
controller_utils_1.ChainId[controller_utils_1.BuiltInNetworkName.Mainnet],
|
|
56
|
+
controller_utils_1.ChainId[controller_utils_1.BuiltInNetworkName.LineaMainnet],
|
|
57
|
+
],
|
|
58
|
+
};
|
|
50
59
|
//# sourceMappingURL=constants.cjs.map
|
package/dist/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,iEAAyE;AAE5D,QAAA,eAAe,GAAG,kBAAkB,CAAC;AAErC,QAAA,YAAY,GAAG,eAAe,CAAC;AAE5C,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,kBAAW,CAAA;AACb,CAAC,EAJW,GAAG,mBAAH,GAAG,QAId;AAED,IAAY,eAiBX;AAjBD,WAAY,eAAe;IACzB,4CAA4C;IAC5C,sCAAmB,CAAA;IACnB,wBAAwB;IACxB,0CAAuB,CAAA;IACvB,0BAA0B;IAC1B,oGAAoG;IACpG,8CAA2B,CAAA;IAC3B,6BAA6B;IAC7B,oGAAoG;IACpG,gEAA6C,CAAA;IAC7C,uBAAuB;IACvB,wCAAqB,CAAA;IACrB,uBAAuB;IACvB,wCAAqB,CAAA;IACrB,iBAAiB;IACjB,sCAAmB,CAAA;AACrB,CAAC,EAjBW,eAAe,+BAAf,eAAe,QAiB1B;AAEY,QAAA,kBAAkB,GAAwB;IACrD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,uCAAuC;IAClD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,uCAAuC;IAClD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,mCAAmC;CAC/C,CAAC;AAEW,QAAA,6BAA6B,GAAG;IAC3C,uBAAuB,EAAE,yBAAyB;IAClD,uBAAuB,EAAE,yBAAyB;IAClD,yBAAyB,EAAE,2BAA2B;CACvD,CAAC;AAEW,QAAA,0BAA0B,GAAG;IACxC,8BAA8B,EAAE,uCAAuC;IACvE,oBAAoB,EAAE,sBAAsB;IAC5C,yBAAyB,EAAE,2BAA2B;IACtD,mCAAmC,EACjC,gDAAgD;IAClD,2CAA2C,EACzC,kCAAkC;CACrC,CAAC;AAEF;;GAEG;AACU,QAAA,6BAA6B,GAAG;IAC3C,yBAAyB,EAAE,EAAE;IAC7B,iBAAiB,EAAE;QACjB,0BAAO,CAAC,qCAAkB,CAAC,OAAO,CAAC;QACnC,0BAAO,CAAC,qCAAkB,CAAC,YAAY,CAAC;KACzC;CACF,CAAC","sourcesContent":["import { BuiltInNetworkName, ChainId } from '@metamask/controller-utils';\n\nexport const CONTROLLER_NAME = 'ClaimsController';\n\nexport const SERVICE_NAME = 'ClaimsService';\n\nexport enum Env {\n DEV = 'dev',\n UAT = 'uat',\n PRD = 'prd',\n}\n\nexport enum ClaimStatusEnum {\n // created but not yet submitted to Intercom\n CREATED = 'created',\n // submitted to Intercom\n SUBMITTED = 'submitted',\n // in progress by Intercom\n // eslint-disable-next-line @typescript-eslint/naming-convention -- to match the API response format\n IN_PROGRESS = 'in_progress',\n // waiting for customer reply\n // eslint-disable-next-line @typescript-eslint/naming-convention -- to match the API response format\n WAITING_FOR_CUSTOMER = 'waiting_for_customer',\n // approved by Intercom\n APPROVED = 'approved',\n // rejected by Intercom\n REJECTED = 'rejected',\n // unknown status\n UNKNOWN = 'unknown',\n}\n\nexport const CLAIMS_API_URL_MAP: Record<Env, string> = {\n [Env.DEV]: 'https://claims.dev-api.cx.metamask.io',\n [Env.UAT]: 'https://claims.uat-api.cx.metamask.io',\n [Env.PRD]: 'https://claims.api.cx.metamask.io',\n};\n\nexport const ClaimsControllerErrorMessages = {\n CLAIM_ALREADY_SUBMITTED: 'Claim already submitted',\n INVALID_CLAIM_SIGNATURE: 'Invalid claim signature',\n INVALID_SIGNATURE_MESSAGE: 'Invalid signature message',\n};\n\nexport const ClaimsServiceErrorMessages = {\n FAILED_TO_FETCH_CONFIGURATIONS: 'Failed to fetch claims configurations',\n FAILED_TO_GET_CLAIMS: 'Failed to get claims',\n FAILED_TO_GET_CLAIM_BY_ID: 'Failed to get claim by id',\n SIGNATURE_MESSAGE_GENERATION_FAILED:\n 'Failed to generate message for claim signature',\n CLAIM_SIGNATURE_VERIFICATION_REQUEST_FAILED:\n 'Failed to verify claim signature',\n};\n\n/**\n * Default claims configurations.\n */\nexport const DEFAULT_CLAIMS_CONFIGURATIONS = {\n validSubmissionWindowDays: 21,\n supportedNetworks: [\n ChainId[BuiltInNetworkName.Mainnet],\n ChainId[BuiltInNetworkName.LineaMainnet],\n ],\n};\n"]}
|
package/dist/constants.d.cts
CHANGED
|
@@ -14,20 +14,24 @@ export declare enum ClaimStatusEnum {
|
|
|
14
14
|
REJECTED = "rejected",
|
|
15
15
|
UNKNOWN = "unknown"
|
|
16
16
|
}
|
|
17
|
-
export declare const
|
|
18
|
-
export declare enum HttpContentTypeHeader {
|
|
19
|
-
APPLICATION_JSON = "application/json",
|
|
20
|
-
MULTIPART_FORM_DATA = "multipart/form-data"
|
|
21
|
-
}
|
|
17
|
+
export declare const CLAIMS_API_URL_MAP: Record<Env, string>;
|
|
22
18
|
export declare const ClaimsControllerErrorMessages: {
|
|
23
19
|
CLAIM_ALREADY_SUBMITTED: string;
|
|
24
20
|
INVALID_CLAIM_SIGNATURE: string;
|
|
25
21
|
INVALID_SIGNATURE_MESSAGE: string;
|
|
26
22
|
};
|
|
27
23
|
export declare const ClaimsServiceErrorMessages: {
|
|
24
|
+
FAILED_TO_FETCH_CONFIGURATIONS: string;
|
|
28
25
|
FAILED_TO_GET_CLAIMS: string;
|
|
29
26
|
FAILED_TO_GET_CLAIM_BY_ID: string;
|
|
30
27
|
SIGNATURE_MESSAGE_GENERATION_FAILED: string;
|
|
31
28
|
CLAIM_SIGNATURE_VERIFICATION_REQUEST_FAILED: string;
|
|
32
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Default claims configurations.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_CLAIMS_CONFIGURATIONS: {
|
|
34
|
+
validSubmissionWindowDays: number;
|
|
35
|
+
supportedNetworks: ("0x1" | "0xe708")[];
|
|
36
|
+
};
|
|
33
37
|
//# sourceMappingURL=constants.d.cts.map
|
package/dist/constants.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAElD,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAE5C,oBAAY,GAAG;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,oBAAY,eAAe;IAEzB,OAAO,YAAY;IAEnB,SAAS,cAAc;IAGvB,WAAW,gBAAgB;IAG3B,oBAAoB,yBAAyB;IAE7C,QAAQ,aAAa;IAErB,QAAQ,aAAa;IAErB,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAIlD,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;CAIzC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;CAQtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;CAMzC,CAAC"}
|
package/dist/constants.d.mts
CHANGED
|
@@ -14,20 +14,24 @@ export declare enum ClaimStatusEnum {
|
|
|
14
14
|
REJECTED = "rejected",
|
|
15
15
|
UNKNOWN = "unknown"
|
|
16
16
|
}
|
|
17
|
-
export declare const
|
|
18
|
-
export declare enum HttpContentTypeHeader {
|
|
19
|
-
APPLICATION_JSON = "application/json",
|
|
20
|
-
MULTIPART_FORM_DATA = "multipart/form-data"
|
|
21
|
-
}
|
|
17
|
+
export declare const CLAIMS_API_URL_MAP: Record<Env, string>;
|
|
22
18
|
export declare const ClaimsControllerErrorMessages: {
|
|
23
19
|
CLAIM_ALREADY_SUBMITTED: string;
|
|
24
20
|
INVALID_CLAIM_SIGNATURE: string;
|
|
25
21
|
INVALID_SIGNATURE_MESSAGE: string;
|
|
26
22
|
};
|
|
27
23
|
export declare const ClaimsServiceErrorMessages: {
|
|
24
|
+
FAILED_TO_FETCH_CONFIGURATIONS: string;
|
|
28
25
|
FAILED_TO_GET_CLAIMS: string;
|
|
29
26
|
FAILED_TO_GET_CLAIM_BY_ID: string;
|
|
30
27
|
SIGNATURE_MESSAGE_GENERATION_FAILED: string;
|
|
31
28
|
CLAIM_SIGNATURE_VERIFICATION_REQUEST_FAILED: string;
|
|
32
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Default claims configurations.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_CLAIMS_CONFIGURATIONS: {
|
|
34
|
+
validSubmissionWindowDays: number;
|
|
35
|
+
supportedNetworks: ("0x1" | "0xe708")[];
|
|
36
|
+
};
|
|
33
37
|
//# sourceMappingURL=constants.d.mts.map
|
package/dist/constants.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAElD,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAE5C,oBAAY,GAAG;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,oBAAY,eAAe;IAEzB,OAAO,YAAY;IAEnB,SAAS,cAAc;IAGvB,WAAW,gBAAgB;IAG3B,oBAAoB,yBAAyB;IAE7C,QAAQ,aAAa;IAErB,QAAQ,aAAa;IAErB,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAIlD,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;CAIzC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;CAQtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;CAMzC,CAAC"}
|
package/dist/constants.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BuiltInNetworkName, ChainId } from "@metamask/controller-utils";
|
|
1
2
|
export const CONTROLLER_NAME = 'ClaimsController';
|
|
2
3
|
export const SERVICE_NAME = 'ClaimsService';
|
|
3
4
|
export var Env;
|
|
@@ -13,8 +14,10 @@ export var ClaimStatusEnum;
|
|
|
13
14
|
// submitted to Intercom
|
|
14
15
|
ClaimStatusEnum["SUBMITTED"] = "submitted";
|
|
15
16
|
// in progress by Intercom
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- to match the API response format
|
|
16
18
|
ClaimStatusEnum["IN_PROGRESS"] = "in_progress";
|
|
17
19
|
// waiting for customer reply
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- to match the API response format
|
|
18
21
|
ClaimStatusEnum["WAITING_FOR_CUSTOMER"] = "waiting_for_customer";
|
|
19
22
|
// approved by Intercom
|
|
20
23
|
ClaimStatusEnum["APPROVED"] = "approved";
|
|
@@ -23,25 +26,31 @@ export var ClaimStatusEnum;
|
|
|
23
26
|
// unknown status
|
|
24
27
|
ClaimStatusEnum["UNKNOWN"] = "unknown";
|
|
25
28
|
})(ClaimStatusEnum || (ClaimStatusEnum = {}));
|
|
26
|
-
export const
|
|
29
|
+
export const CLAIMS_API_URL_MAP = {
|
|
27
30
|
[Env.DEV]: 'https://claims.dev-api.cx.metamask.io',
|
|
28
31
|
[Env.UAT]: 'https://claims.uat-api.cx.metamask.io',
|
|
29
32
|
[Env.PRD]: 'https://claims.api.cx.metamask.io',
|
|
30
33
|
};
|
|
31
|
-
export var HttpContentTypeHeader;
|
|
32
|
-
(function (HttpContentTypeHeader) {
|
|
33
|
-
HttpContentTypeHeader["APPLICATION_JSON"] = "application/json";
|
|
34
|
-
HttpContentTypeHeader["MULTIPART_FORM_DATA"] = "multipart/form-data";
|
|
35
|
-
})(HttpContentTypeHeader || (HttpContentTypeHeader = {}));
|
|
36
34
|
export const ClaimsControllerErrorMessages = {
|
|
37
35
|
CLAIM_ALREADY_SUBMITTED: 'Claim already submitted',
|
|
38
36
|
INVALID_CLAIM_SIGNATURE: 'Invalid claim signature',
|
|
39
37
|
INVALID_SIGNATURE_MESSAGE: 'Invalid signature message',
|
|
40
38
|
};
|
|
41
39
|
export const ClaimsServiceErrorMessages = {
|
|
40
|
+
FAILED_TO_FETCH_CONFIGURATIONS: 'Failed to fetch claims configurations',
|
|
42
41
|
FAILED_TO_GET_CLAIMS: 'Failed to get claims',
|
|
43
42
|
FAILED_TO_GET_CLAIM_BY_ID: 'Failed to get claim by id',
|
|
44
43
|
SIGNATURE_MESSAGE_GENERATION_FAILED: 'Failed to generate message for claim signature',
|
|
45
44
|
CLAIM_SIGNATURE_VERIFICATION_REQUEST_FAILED: 'Failed to verify claim signature',
|
|
46
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Default claims configurations.
|
|
48
|
+
*/
|
|
49
|
+
export const DEFAULT_CLAIMS_CONFIGURATIONS = {
|
|
50
|
+
validSubmissionWindowDays: 21,
|
|
51
|
+
supportedNetworks: [
|
|
52
|
+
ChainId[BuiltInNetworkName.Mainnet],
|
|
53
|
+
ChainId[BuiltInNetworkName.LineaMainnet],
|
|
54
|
+
],
|
|
55
|
+
};
|
|
47
56
|
//# sourceMappingURL=constants.mjs.map
|
package/dist/constants.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC;AAE5C,MAAM,CAAN,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,kBAAW,CAAA;AACb,CAAC,EAJW,GAAG,KAAH,GAAG,QAId;AAED,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,mCAAmC;AAEzE,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC;AAE5C,MAAM,CAAN,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,kBAAW,CAAA;AACb,CAAC,EAJW,GAAG,KAAH,GAAG,QAId;AAED,MAAM,CAAN,IAAY,eAiBX;AAjBD,WAAY,eAAe;IACzB,4CAA4C;IAC5C,sCAAmB,CAAA;IACnB,wBAAwB;IACxB,0CAAuB,CAAA;IACvB,0BAA0B;IAC1B,oGAAoG;IACpG,8CAA2B,CAAA;IAC3B,6BAA6B;IAC7B,oGAAoG;IACpG,gEAA6C,CAAA;IAC7C,uBAAuB;IACvB,wCAAqB,CAAA;IACrB,uBAAuB;IACvB,wCAAqB,CAAA;IACrB,iBAAiB;IACjB,sCAAmB,CAAA;AACrB,CAAC,EAjBW,eAAe,KAAf,eAAe,QAiB1B;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,uCAAuC;IAClD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,uCAAuC;IAClD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,mCAAmC;CAC/C,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,uBAAuB,EAAE,yBAAyB;IAClD,uBAAuB,EAAE,yBAAyB;IAClD,yBAAyB,EAAE,2BAA2B;CACvD,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,8BAA8B,EAAE,uCAAuC;IACvE,oBAAoB,EAAE,sBAAsB;IAC5C,yBAAyB,EAAE,2BAA2B;IACtD,mCAAmC,EACjC,gDAAgD;IAClD,2CAA2C,EACzC,kCAAkC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,yBAAyB,EAAE,EAAE;IAC7B,iBAAiB,EAAE;QACjB,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC;QACnC,OAAO,CAAC,kBAAkB,CAAC,YAAY,CAAC;KACzC;CACF,CAAC","sourcesContent":["import { BuiltInNetworkName, ChainId } from '@metamask/controller-utils';\n\nexport const CONTROLLER_NAME = 'ClaimsController';\n\nexport const SERVICE_NAME = 'ClaimsService';\n\nexport enum Env {\n DEV = 'dev',\n UAT = 'uat',\n PRD = 'prd',\n}\n\nexport enum ClaimStatusEnum {\n // created but not yet submitted to Intercom\n CREATED = 'created',\n // submitted to Intercom\n SUBMITTED = 'submitted',\n // in progress by Intercom\n // eslint-disable-next-line @typescript-eslint/naming-convention -- to match the API response format\n IN_PROGRESS = 'in_progress',\n // waiting for customer reply\n // eslint-disable-next-line @typescript-eslint/naming-convention -- to match the API response format\n WAITING_FOR_CUSTOMER = 'waiting_for_customer',\n // approved by Intercom\n APPROVED = 'approved',\n // rejected by Intercom\n REJECTED = 'rejected',\n // unknown status\n UNKNOWN = 'unknown',\n}\n\nexport const CLAIMS_API_URL_MAP: Record<Env, string> = {\n [Env.DEV]: 'https://claims.dev-api.cx.metamask.io',\n [Env.UAT]: 'https://claims.uat-api.cx.metamask.io',\n [Env.PRD]: 'https://claims.api.cx.metamask.io',\n};\n\nexport const ClaimsControllerErrorMessages = {\n CLAIM_ALREADY_SUBMITTED: 'Claim already submitted',\n INVALID_CLAIM_SIGNATURE: 'Invalid claim signature',\n INVALID_SIGNATURE_MESSAGE: 'Invalid signature message',\n};\n\nexport const ClaimsServiceErrorMessages = {\n FAILED_TO_FETCH_CONFIGURATIONS: 'Failed to fetch claims configurations',\n FAILED_TO_GET_CLAIMS: 'Failed to get claims',\n FAILED_TO_GET_CLAIM_BY_ID: 'Failed to get claim by id',\n SIGNATURE_MESSAGE_GENERATION_FAILED:\n 'Failed to generate message for claim signature',\n CLAIM_SIGNATURE_VERIFICATION_REQUEST_FAILED:\n 'Failed to verify claim signature',\n};\n\n/**\n * Default claims configurations.\n */\nexport const DEFAULT_CLAIMS_CONFIGURATIONS = {\n validSubmissionWindowDays: 21,\n supportedNetworks: [\n ChainId[BuiltInNetworkName.Mainnet],\n ChainId[BuiltInNetworkName.LineaMainnet],\n ],\n};\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClaimsControllerErrorMessages = exports.Env = exports.ClaimStatusEnum = exports.ClaimsService = exports.getDefaultClaimsControllerState = exports.ClaimsController = void 0;
|
|
3
|
+
exports.CLAIMS_API_URL_MAP = exports.ClaimsServiceErrorMessages = exports.DEFAULT_CLAIMS_CONFIGURATIONS = exports.ClaimsControllerErrorMessages = exports.Env = exports.ClaimStatusEnum = exports.ClaimsService = exports.getDefaultClaimsControllerState = exports.ClaimsController = void 0;
|
|
4
4
|
var ClaimsController_1 = require("./ClaimsController.cjs");
|
|
5
5
|
Object.defineProperty(exports, "ClaimsController", { enumerable: true, get: function () { return ClaimsController_1.ClaimsController; } });
|
|
6
6
|
Object.defineProperty(exports, "getDefaultClaimsControllerState", { enumerable: true, get: function () { return ClaimsController_1.getDefaultClaimsControllerState; } });
|
|
@@ -10,4 +10,7 @@ var constants_1 = require("./constants.cjs");
|
|
|
10
10
|
Object.defineProperty(exports, "ClaimStatusEnum", { enumerable: true, get: function () { return constants_1.ClaimStatusEnum; } });
|
|
11
11
|
Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return constants_1.Env; } });
|
|
12
12
|
Object.defineProperty(exports, "ClaimsControllerErrorMessages", { enumerable: true, get: function () { return constants_1.ClaimsControllerErrorMessages; } });
|
|
13
|
+
Object.defineProperty(exports, "DEFAULT_CLAIMS_CONFIGURATIONS", { enumerable: true, get: function () { return constants_1.DEFAULT_CLAIMS_CONFIGURATIONS; } });
|
|
14
|
+
Object.defineProperty(exports, "ClaimsServiceErrorMessages", { enumerable: true, get: function () { return constants_1.ClaimsServiceErrorMessages; } });
|
|
15
|
+
Object.defineProperty(exports, "CLAIMS_API_URL_MAP", { enumerable: true, get: function () { return constants_1.CLAIMS_API_URL_MAP; } });
|
|
13
16
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2DAG4B;AAF1B,oHAAA,gBAAgB,OAAA;AAChB,mIAAA,+BAA+B,OAAA;
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2DAG4B;AAF1B,oHAAA,gBAAgB,OAAA;AAChB,mIAAA,+BAA+B,OAAA;AAoBjC,qDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAatB,6CAOqB;AANnB,4GAAA,eAAe,OAAA;AACf,gGAAA,GAAG,OAAA;AACH,0HAAA,6BAA6B,OAAA;AAC7B,0HAAA,6BAA6B,OAAA;AAC7B,uHAAA,0BAA0B,OAAA;AAC1B,+GAAA,kBAAkB,OAAA","sourcesContent":["export {\n ClaimsController,\n getDefaultClaimsControllerState,\n} from './ClaimsController';\n\nexport type {\n ClaimsControllerGetStateAction,\n ClaimsControllerActions,\n ClaimsControllerStateChangeEvent,\n ClaimsControllerMessenger,\n} from './ClaimsController';\n\nexport type {\n Claim,\n ClaimsControllerState,\n Attachment,\n ClaimsConfigurations,\n CreateClaimRequest,\n SubmitClaimConfig,\n ClaimDraft,\n} from './types';\n\nexport { ClaimsService } from './ClaimsService';\n\nexport type {\n ClaimsServiceFetchClaimsConfigurationsAction,\n ClaimsServiceGetClaimsAction,\n ClaimsServiceGetRequestHeadersAction,\n ClaimsServiceGetClaimsApiUrlAction,\n ClaimsServiceGetClaimByIdAction,\n ClaimsServiceGenerateMessageForClaimSignatureAction,\n ClaimsServiceActions,\n ClaimsServiceMessenger,\n} from './ClaimsService';\n\nexport {\n ClaimStatusEnum,\n Env,\n ClaimsControllerErrorMessages,\n DEFAULT_CLAIMS_CONFIGURATIONS,\n ClaimsServiceErrorMessages,\n CLAIMS_API_URL_MAP,\n} from './constants';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ClaimsController, getDefaultClaimsControllerState, } from "./ClaimsController.cjs";
|
|
2
2
|
export type { ClaimsControllerGetStateAction, ClaimsControllerActions, ClaimsControllerStateChangeEvent, ClaimsControllerMessenger, } from "./ClaimsController.cjs";
|
|
3
|
-
export type { Claim, ClaimsControllerState, Attachment } from "./types.cjs";
|
|
3
|
+
export type { Claim, ClaimsControllerState, Attachment, ClaimsConfigurations, CreateClaimRequest, SubmitClaimConfig, ClaimDraft, } from "./types.cjs";
|
|
4
4
|
export { ClaimsService } from "./ClaimsService.cjs";
|
|
5
|
-
export type { ClaimsServiceGetClaimsAction, ClaimsServiceGetRequestHeadersAction, ClaimsServiceGetClaimsApiUrlAction, ClaimsServiceGetClaimByIdAction, ClaimsServiceGenerateMessageForClaimSignatureAction, ClaimsServiceActions, ClaimsServiceMessenger, } from "./ClaimsService.cjs";
|
|
6
|
-
export { ClaimStatusEnum, Env, ClaimsControllerErrorMessages, } from "./constants.cjs";
|
|
5
|
+
export type { ClaimsServiceFetchClaimsConfigurationsAction, ClaimsServiceGetClaimsAction, ClaimsServiceGetRequestHeadersAction, ClaimsServiceGetClaimsApiUrlAction, ClaimsServiceGetClaimByIdAction, ClaimsServiceGenerateMessageForClaimSignatureAction, ClaimsServiceActions, ClaimsServiceMessenger, } from "./ClaimsService.cjs";
|
|
6
|
+
export { ClaimStatusEnum, Env, ClaimsControllerErrorMessages, DEFAULT_CLAIMS_CONFIGURATIONS, ClaimsServiceErrorMessages, CLAIMS_API_URL_MAP, } from "./constants.cjs";
|
|
7
7
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,+BAA2B;AAE5B,YAAY,EACV,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,yBAAyB,GAC1B,+BAA2B;AAE5B,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,+BAA2B;AAE5B,YAAY,EACV,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,yBAAyB,GAC1B,+BAA2B;AAE5B,YAAY,EACV,KAAK,EACL,qBAAqB,EACrB,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,GACX,oBAAgB;AAEjB,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD,YAAY,EACV,4CAA4C,EAC5C,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EAClC,+BAA+B,EAC/B,mDAAmD,EACnD,oBAAoB,EACpB,sBAAsB,GACvB,4BAAwB;AAEzB,OAAO,EACL,eAAe,EACf,GAAG,EACH,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,kBAAkB,GACnB,wBAAoB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ClaimsController, getDefaultClaimsControllerState, } from "./ClaimsController.mjs";
|
|
2
2
|
export type { ClaimsControllerGetStateAction, ClaimsControllerActions, ClaimsControllerStateChangeEvent, ClaimsControllerMessenger, } from "./ClaimsController.mjs";
|
|
3
|
-
export type { Claim, ClaimsControllerState, Attachment } from "./types.mjs";
|
|
3
|
+
export type { Claim, ClaimsControllerState, Attachment, ClaimsConfigurations, CreateClaimRequest, SubmitClaimConfig, ClaimDraft, } from "./types.mjs";
|
|
4
4
|
export { ClaimsService } from "./ClaimsService.mjs";
|
|
5
|
-
export type { ClaimsServiceGetClaimsAction, ClaimsServiceGetRequestHeadersAction, ClaimsServiceGetClaimsApiUrlAction, ClaimsServiceGetClaimByIdAction, ClaimsServiceGenerateMessageForClaimSignatureAction, ClaimsServiceActions, ClaimsServiceMessenger, } from "./ClaimsService.mjs";
|
|
6
|
-
export { ClaimStatusEnum, Env, ClaimsControllerErrorMessages, } from "./constants.mjs";
|
|
5
|
+
export type { ClaimsServiceFetchClaimsConfigurationsAction, ClaimsServiceGetClaimsAction, ClaimsServiceGetRequestHeadersAction, ClaimsServiceGetClaimsApiUrlAction, ClaimsServiceGetClaimByIdAction, ClaimsServiceGenerateMessageForClaimSignatureAction, ClaimsServiceActions, ClaimsServiceMessenger, } from "./ClaimsService.mjs";
|
|
6
|
+
export { ClaimStatusEnum, Env, ClaimsControllerErrorMessages, DEFAULT_CLAIMS_CONFIGURATIONS, ClaimsServiceErrorMessages, CLAIMS_API_URL_MAP, } from "./constants.mjs";
|
|
7
7
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,+BAA2B;AAE5B,YAAY,EACV,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,yBAAyB,GAC1B,+BAA2B;AAE5B,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,+BAA2B;AAE5B,YAAY,EACV,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,yBAAyB,GAC1B,+BAA2B;AAE5B,YAAY,EACV,KAAK,EACL,qBAAqB,EACrB,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,GACX,oBAAgB;AAEjB,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD,YAAY,EACV,4CAA4C,EAC5C,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EAClC,+BAA+B,EAC/B,mDAAmD,EACnD,oBAAoB,EACpB,sBAAsB,GACvB,4BAAwB;AAEzB,OAAO,EACL,eAAe,EACf,GAAG,EACH,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,kBAAkB,GACnB,wBAAoB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ClaimsController, getDefaultClaimsControllerState } from "./ClaimsController.mjs";
|
|
2
2
|
export { ClaimsService } from "./ClaimsService.mjs";
|
|
3
|
-
export { ClaimStatusEnum, Env, ClaimsControllerErrorMessages } from "./constants.mjs";
|
|
3
|
+
export { ClaimStatusEnum, Env, ClaimsControllerErrorMessages, DEFAULT_CLAIMS_CONFIGURATIONS, ClaimsServiceErrorMessages, CLAIMS_API_URL_MAP } from "./constants.mjs";
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAChC,+BAA2B;
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAChC,+BAA2B;AAmB5B,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAahD,OAAO,EACL,eAAe,EACf,GAAG,EACH,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,kBAAkB,EACnB,wBAAoB","sourcesContent":["export {\n ClaimsController,\n getDefaultClaimsControllerState,\n} from './ClaimsController';\n\nexport type {\n ClaimsControllerGetStateAction,\n ClaimsControllerActions,\n ClaimsControllerStateChangeEvent,\n ClaimsControllerMessenger,\n} from './ClaimsController';\n\nexport type {\n Claim,\n ClaimsControllerState,\n Attachment,\n ClaimsConfigurations,\n CreateClaimRequest,\n SubmitClaimConfig,\n ClaimDraft,\n} from './types';\n\nexport { ClaimsService } from './ClaimsService';\n\nexport type {\n ClaimsServiceFetchClaimsConfigurationsAction,\n ClaimsServiceGetClaimsAction,\n ClaimsServiceGetRequestHeadersAction,\n ClaimsServiceGetClaimsApiUrlAction,\n ClaimsServiceGetClaimByIdAction,\n ClaimsServiceGenerateMessageForClaimSignatureAction,\n ClaimsServiceActions,\n ClaimsServiceMessenger,\n} from './ClaimsService';\n\nexport {\n ClaimStatusEnum,\n Env,\n ClaimsControllerErrorMessages,\n DEFAULT_CLAIMS_CONFIGURATIONS,\n ClaimsServiceErrorMessages,\n CLAIMS_API_URL_MAP,\n} from './constants';\n"]}
|