@maxzima/wa-communicator 1.0.40 → 1.0.42

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.
@@ -1,5 +1,5 @@
1
1
  import { GTMEventEnum, GTMEventParamsEnum, LintrkActionTypeEnum, LintrkEventIdEnum } from "./../Enums/AccountTrackerEnum";
2
- type TLintrkOptions = {
2
+ export type TLintrkOptions = {
3
3
  conversation_id: LintrkEventIdEnum;
4
4
  };
5
5
  export type TAccountTrackerProps = {
@@ -12,15 +12,14 @@ export type TAccountTrackerEventParams = {
12
12
  export type TAccountTrackerGtmEventParamsMapping = {
13
13
  [event in GTMEventEnum]: TAccountTrackerGtmEventParams;
14
14
  };
15
- type TAccountTrackerGtmEventParams = TAccountTrackerGtmSignUpEventParams | TAccountTrackerGtmSignUpOnlineEventParams;
16
- type TAccountTrackerGtmSignUpEventParams = {
15
+ export type TAccountTrackerGtmEventParams = TAccountTrackerGtmSignUpEventParams | TAccountTrackerGtmSignUpOnlineEventParams;
16
+ export type TAccountTrackerGtmSignUpEventParams = {
17
17
  [GTMEventParamsEnum.GCLID]: string;
18
18
  [GTMEventParamsEnum.EMAIL]: string;
19
19
  [GTMEventParamsEnum.PHONE]: string;
20
20
  };
21
- type TAccountTrackerGtmSignUpOnlineEventParams = {
21
+ export type TAccountTrackerGtmSignUpOnlineEventParams = {
22
22
  [GTMEventParamsEnum.ORIGIN]: string;
23
23
  [GTMEventParamsEnum.SEND_TO]: string;
24
24
  [GTMEventParamsEnum.GCL_ID]: string;
25
25
  };
26
- export {};
@@ -1 +1 @@
1
- import { GTMEventParamsEnum } from "./../Enums/AccountTrackerEnum";
1
+ import { GTMEventEnum, GTMEventParamsEnum, LintrkActionTypeEnum, LintrkEventIdEnum } from "./../Enums/AccountTrackerEnum";
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { Communicator, AccountTracker } from "./engine";
2
2
  export { CommunicatorUpdateChallengeCustomErrorCodeEnum, CommunicatorVerifyChallengeCustomErrorCodeEnum, CommunicatorEmailCustomErrorCodeEnum, } from "./enums";
3
- export { type TChallenge, type TResponse, type TSignInByMobileResponse, type TSetupChallengeResponse, type TVerifyChallengeResponse, type TCreateSessionResponse, type TGetCurrentUserProfileResponseUser, } from "./types";
3
+ export type { TChallenge, TResponse, TSignInByMobileResponse, TSetupChallengeResponse, TVerifyChallengeResponse, TCreateSessionResponse, TGetCurrentUserProfileResponseUser, } from "./types";
package/jest.config.js CHANGED
@@ -2,17 +2,22 @@
2
2
  const { defaultsESM: tsjPreset } = require('ts-jest/presets');
3
3
 
4
4
  module.exports = {
5
+ preset: 'ts-jest/presets/default-esm',
5
6
  roots: ['<rootDir>/test'],
7
+ testEnvironment: 'node',
8
+ extensionsToTreatAsEsm: ['.ts'],
6
9
  testMatch: [
7
10
  '**/__tests__/**/*.+(ts|js)',
8
11
  '**/?(*.)+(spec).+(ts|js)',
9
12
  ],
10
13
  transform: {
11
- ...tsjPreset.transform,
14
+ '^.+\\.tsx?$': ['ts-jest', {
15
+ tsconfig: 'tsconfig.json',
16
+ useESM: true,
17
+ // isolatedModules: true,
18
+ }],
19
+ },
20
+ moduleNameMapper: {
21
+ '^src/(.*)$': '<rootDir>/src/$1',
12
22
  },
13
- globals: {
14
- 'ts-jest': {
15
- 'tsconfig': 'tsconfig.json'
16
- }
17
- }
18
23
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.40",
2
+ "version": "1.0.42",
3
3
  "name": "@maxzima/wa-communicator",
4
4
  "description": "",
5
5
  "author": "Noname",
@@ -36,23 +36,26 @@
36
36
  "size": "size-limit"
37
37
  },
38
38
  "devDependencies": {
39
- "@size-limit/preset-small-lib": "8.2.4",
40
- "@types/gtag.js": "0.0.10",
41
- "@types/jest": "28.1.8",
42
- "@typescript-eslint/eslint-plugin": "5.59.5",
43
- "@typescript-eslint/parser": "5.59.5",
39
+ "@size-limit/preset-small-lib": "11.2.0",
40
+ "@types/gtag.js": "0.0.20",
41
+ "@types/jest": "30.0.0",
42
+ "@typescript-eslint/eslint-plugin": "8.35.0",
43
+ "@typescript-eslint/parser": "8.35.0",
44
44
  "engine-version": "^1.0.2",
45
- "eslint": "8.40.0",
46
- "eslint-config-prettier": "8.8.0",
45
+ "eslint": "9.29.0",
46
+ "eslint-config-prettier": "10.1.5",
47
47
  "eslint-plugin-editorconfig": "4.0.3",
48
48
  "eslint-plugin-eslint-comments": "3.2.0",
49
- "eslint-plugin-import": "2.27.5",
50
- "eslint-plugin-prettier": "4.2.1",
51
- "jest": "28.1.3",
49
+ "eslint-plugin-import": "2.32.0",
50
+ "eslint-plugin-prettier": "5.5.1",
51
+ "jest": "30.0.3",
52
52
  "npm-run-all": "4.1.5",
53
- "prettier": "2.8.8",
54
- "size-limit": "8.2.4",
55
- "ts-jest": "28.0.8",
53
+ "prettier": "3.6.1",
54
+ "size-limit": "11.2.0",
55
+ "ts-jest": "29.4.0",
56
56
  "typescript": "5.8.3"
57
+ },
58
+ "dependencies": {
59
+ "tslib": "^2.8.1"
57
60
  }
58
61
  }
@@ -1,4 +1,4 @@
1
- import {GTMEventEnum, LintrkActionTypeEnum, LintrkEventIdEnum} from "./../Enums/AccountTrackerEnum";
1
+ import { GTMEventEnum, LintrkActionTypeEnum, LintrkEventIdEnum } from "./../Enums/AccountTrackerEnum";
2
2
  import type {
3
3
  TAccountTrackerEventParams,
4
4
  TAccountTrackerGtmEventParamsMapping,
@@ -4,7 +4,7 @@ import {
4
4
  LintrkEventIdEnum
5
5
  } from "./../Enums/AccountTrackerEnum";
6
6
 
7
- type TLintrkOptions = {
7
+ export type TLintrkOptions = {
8
8
  conversation_id: LintrkEventIdEnum;
9
9
  }
10
10
 
@@ -21,15 +21,15 @@ export type TAccountTrackerGtmEventParamsMapping = {
21
21
  [event in GTMEventEnum]: TAccountTrackerGtmEventParams;
22
22
  };
23
23
 
24
- type TAccountTrackerGtmEventParams = TAccountTrackerGtmSignUpEventParams | TAccountTrackerGtmSignUpOnlineEventParams;
24
+ export type TAccountTrackerGtmEventParams = TAccountTrackerGtmSignUpEventParams | TAccountTrackerGtmSignUpOnlineEventParams;
25
25
 
26
- type TAccountTrackerGtmSignUpEventParams = {
26
+ export type TAccountTrackerGtmSignUpEventParams = {
27
27
  [GTMEventParamsEnum.GCLID]: string;
28
28
  [GTMEventParamsEnum.EMAIL]: string;
29
29
  [GTMEventParamsEnum.PHONE]: string;
30
30
  }
31
31
 
32
- type TAccountTrackerGtmSignUpOnlineEventParams = {
32
+ export type TAccountTrackerGtmSignUpOnlineEventParams = {
33
33
  [GTMEventParamsEnum.ORIGIN]: string;
34
34
  [GTMEventParamsEnum.SEND_TO]: string;
35
35
  [GTMEventParamsEnum.GCL_ID]: string;
package/src/index.ts CHANGED
@@ -9,12 +9,12 @@ export {
9
9
  CommunicatorEmailCustomErrorCodeEnum,
10
10
  } from "./enums";
11
11
 
12
- export {
13
- type TChallenge,
14
- type TResponse,
15
- type TSignInByMobileResponse,
16
- type TSetupChallengeResponse,
17
- type TVerifyChallengeResponse,
18
- type TCreateSessionResponse,
19
- type TGetCurrentUserProfileResponseUser,
12
+ export type {
13
+ TChallenge,
14
+ TResponse,
15
+ TSignInByMobileResponse,
16
+ TSetupChallengeResponse,
17
+ TVerifyChallengeResponse,
18
+ TCreateSessionResponse,
19
+ TGetCurrentUserProfileResponseUser,
20
20
  } from "./types";
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`Communicator getHeaders headers with token 1`] = `
4
- Object {
4
+ {
5
5
  "Accept": "application/json, text/plain, */*",
6
6
  "Authorization": "Bearer _token_",
7
7
  "Content-Type": "application/json",
@@ -9,14 +9,14 @@ Object {
9
9
  `;
10
10
 
11
11
  exports[`Communicator getHeaders headers without token 1`] = `
12
- Object {
12
+ {
13
13
  "Accept": "application/json, text/plain, */*",
14
14
  "Content-Type": "application/json",
15
15
  }
16
16
  `;
17
17
 
18
18
  exports[`Communicator getMeta meta normal 1`] = `
19
- Object {
19
+ {
20
20
  "audit_source_type": "Backend",
21
21
  "browser_page_resolution": "800x600",
22
22
  "cookies_enabled": true,
@@ -32,8 +32,8 @@ exports[`Communicator processingQueryParams queryParams multi 1`] = `"queryParam
32
32
  exports[`Communicator processingQueryParams queryParams normal 1`] = `"queryParamKey1=queryParamValue1"`;
33
33
 
34
34
  exports[`Communicator requests createSession 1`] = `
35
- Object {
36
- "headers": Object {
35
+ {
36
+ "headers": {
37
37
  "Accept": "application/json, text/plain, */*",
38
38
  "Authorization": "Bearer _authToken_",
39
39
  "Content-Type": "application/json",
@@ -44,9 +44,9 @@ Object {
44
44
  `;
45
45
 
46
46
  exports[`Communicator requests emailUpdate 1`] = `
47
- Object {
48
- "body": "{\\"email\\":\\"test@test.com\\"}",
49
- "headers": Object {
47
+ {
48
+ "body": "{"email":"test@test.com"}",
49
+ "headers": {
50
50
  "Accept": "application/json, text/plain, */*",
51
51
  "Authorization": "Bearer _authToken_",
52
52
  "Content-Type": "application/json",
@@ -57,8 +57,8 @@ Object {
57
57
  `;
58
58
 
59
59
  exports[`Communicator requests getAssignedProducts 1`] = `
60
- Object {
61
- "headers": Object {
60
+ {
61
+ "headers": {
62
62
  "Accept": "application/json, text/plain, */*",
63
63
  "Authorization": "Bearer _accessToken_",
64
64
  "Content-Type": "application/json",
@@ -69,8 +69,8 @@ Object {
69
69
  `;
70
70
 
71
71
  exports[`Communicator requests getCurrentUserProfile 1`] = `
72
- Object {
73
- "headers": Object {
72
+ {
73
+ "headers": {
74
74
  "Accept": "application/json, text/plain, */*",
75
75
  "Authorization": "Bearer _accessToken_",
76
76
  "Content-Type": "application/json",
@@ -81,13 +81,13 @@ Object {
81
81
  `;
82
82
 
83
83
  exports[`Communicator requests getRestrictedCountries 1`] = `
84
- Object {
85
- "headers": Object {
84
+ {
85
+ "headers": {
86
86
  "Accept": "application/json, text/plain, */*",
87
87
  "Content-Type": "application/json",
88
88
  },
89
89
  "method": "GET",
90
- "queryParams": Object {
90
+ "queryParams": {
91
91
  "entity_type": "global",
92
92
  },
93
93
  "url": "https://google.com/access-control/restricted-countries",
@@ -95,8 +95,8 @@ Object {
95
95
  `;
96
96
 
97
97
  exports[`Communicator requests profileAssign 1`] = `
98
- Object {
99
- "headers": Object {
98
+ {
99
+ "headers": {
100
100
  "Accept": "application/json, text/plain, */*",
101
101
  "Authorization": "Bearer _accessToken_",
102
102
  "Content-Type": "application/json",
@@ -107,9 +107,9 @@ Object {
107
107
  `;
108
108
 
109
109
  exports[`Communicator requests registration 1`] = `
110
- Object {
111
- "body": "{\\"name\\":\\"_companyName_\\",\\"country_code\\":\\"CAN\\",\\"source\\":{\\"hash\\":\\"_hash_\\",\\"device_type\\":\\"mobile\\",\\"ga_id\\":\\"_gaId_\\",\\"origin\\":\\"_origin_\\",\\"gc_id\\":\\"_gcId_\\",\\"utm_source\\":\\"_utmSource_\\",\\"utm_medium\\":\\"_utmMedium_\\",\\"utm_campaign\\":\\"_utmCampaign_\\",\\"utm_term\\":\\"_utmTerm_\\"}}",
112
- "headers": Object {
110
+ {
111
+ "body": "{"name":"_companyName_","country_code":"CAN","source":{"hash":"_hash_","device_type":"mobile","ga_id":"_gaId_","origin":"_origin_","gc_id":"_gcId_","utm_source":"_utmSource_","utm_medium":"_utmMedium_","utm_campaign":"_utmCampaign_","utm_term":"_utmTerm_"}}",
112
+ "headers": {
113
113
  "Accept": "application/json, text/plain, */*",
114
114
  "Authorization": "Bearer _accessToken_",
115
115
  "Content-Type": "application/json",
@@ -120,9 +120,9 @@ Object {
120
120
  `;
121
121
 
122
122
  exports[`Communicator requests setStorageValues 1`] = `
123
- Object {
124
- "body": "{\\"seo_source\\":\\"_origin_\\"}",
125
- "headers": Object {
123
+ {
124
+ "body": "{"seo_source":"_origin_"}",
125
+ "headers": {
126
126
  "Accept": "application/json, text/plain, */*",
127
127
  "Authorization": "Bearer _accessToken_",
128
128
  "Content-Type": "application/json",
@@ -133,14 +133,14 @@ Object {
133
133
  `;
134
134
 
135
135
  exports[`Communicator requests setupChallenge 1`] = `
136
- Object {
137
- "headers": Object {
136
+ {
137
+ "headers": {
138
138
  "Accept": "application/json, text/plain, */*",
139
139
  "Authorization": "Bearer _authToken_",
140
140
  "Content-Type": "application/json",
141
141
  },
142
142
  "method": "GET",
143
- "queryParams": Object {
143
+ "queryParams": {
144
144
  "type": "email_otp",
145
145
  },
146
146
  "url": "https://google.com/sign-in/challenge",
@@ -148,22 +148,22 @@ Object {
148
148
  `;
149
149
 
150
150
  exports[`Communicator requests signIn 1`] = `
151
- Object {
152
- "body": "{\\"device_id\\":\\"ov4lNmyk7armoC5DMiOpL5hl846kVQgS\\",\\"meta\\":{\\"audit_source_type\\":\\"Backend\\",\\"browser_page_resolution\\":\\"800x600\\",\\"cookies_enabled\\":true,\\"ip\\":\\"127.0.0.1\\",\\"js_enabled\\":true,\\"language\\":\\"ENG\\",\\"user_agent\\":\\"_userAgent_\\"},\\"mobile\\":\\"+16234401486\\"}",
153
- "headers": Object {
151
+ {
152
+ "body": "{"device_id":"ov4lNmyk7armoC5DMiOpL5hl846kVQgS","meta":{"audit_source_type":"Backend","browser_page_resolution":"800x600","cookies_enabled":true,"ip":"127.0.0.1","js_enabled":true,"language":"ENG","user_agent":"_userAgent_"},"mobile":"+16234401486"}",
153
+ "headers": {
154
154
  "Accept": "application/json, text/plain, */*",
155
155
  "Content-Type": "application/json",
156
156
  },
157
157
  "method": "POST",
158
- "queryParams": Object {},
158
+ "queryParams": {},
159
159
  "url": "https://google.com/sign-in",
160
160
  }
161
161
  `;
162
162
 
163
163
  exports[`Communicator requests signInByApp 1`] = `
164
- Object {
165
- "body": "{\\"type\\":\\"out_of_band\\",\\"value\\":\\"123456\\",\\"request_id\\":\\"7ae2cefb-2f3b-4ecf-b478-67486aca2eaf\\"}",
166
- "headers": Object {
164
+ {
165
+ "body": "{"type":"out_of_band","value":"123456","request_id":"7ae2cefb-2f3b-4ecf-b478-67486aca2eaf"}",
166
+ "headers": {
167
167
  "Accept": "application/json, text/plain, */*",
168
168
  "Authorization": "Bearer _authToken_",
169
169
  "Content-Type": "application/json",
@@ -174,9 +174,9 @@ Object {
174
174
  `;
175
175
 
176
176
  exports[`Communicator requests signUp 1`] = `
177
- Object {
178
- "body": "{\\"locale\\":\\"en\\",\\"mobile\\":\\"+16234401486\\",\\"timezone_name\\":\\"Europe/Tallin\\"}",
179
- "headers": Object {
177
+ {
178
+ "body": "{"locale":"en","mobile":"+16234401486","timezone_name":"Europe/Tallin"}",
179
+ "headers": {
180
180
  "Accept": "application/json, text/plain, */*",
181
181
  "Content-Type": "application/json",
182
182
  },
@@ -186,9 +186,9 @@ Object {
186
186
  `;
187
187
 
188
188
  exports[`Communicator requests verifyChallenge 1`] = `
189
- Object {
190
- "body": "{\\"type\\":\\"email_otp\\",\\"value\\":\\"123456\\"}",
191
- "headers": Object {
189
+ {
190
+ "body": "{"type":"email_otp","value":"123456"}",
191
+ "headers": {
192
192
  "Accept": "application/json, text/plain, */*",
193
193
  "Authorization": "Bearer _authToken_",
194
194
  "Content-Type": "application/json",
package/tsconfig.json CHANGED
@@ -23,7 +23,8 @@
23
23
  "noUnusedParameters": true,
24
24
  "importHelpers": true,
25
25
  "sourceMap": false,
26
- // "verbatimModuleSyntax": true,
26
+ "verbatimModuleSyntax": true,
27
+ "isolatedModules": true,
27
28
  "paths": {
28
29
  "@root*": [
29
30
  "./src*",