oneentry 1.0.128 → 1.0.130

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 CHANGED
@@ -97,6 +97,7 @@ const api = defineOneEntry('https://my-project.oneentry.cloud', {
97
97
  auth: {
98
98
  refreshToken: localStorage.getItem('refreshToken'),
99
99
  saveFunction: tokenFunction,
100
+ providerMarker: 'email',
100
101
  },
101
102
  })
102
103
  ```
@@ -110,6 +111,7 @@ const api = defineOneEntry('https://my-project.oneentry.cloud', {
110
111
  auth: {
111
112
  customAuth: true,
112
113
  refreshToken: localStorage.getItem('refreshToken'),
114
+ providerMarker: 'email',
113
115
  },
114
116
  })
115
117
  ```
@@ -147,6 +149,7 @@ const api = defineOneEntry('your-url', {
147
149
  auth: {
148
150
  customAuth: false,
149
151
  userToken: 'rerfesh.token',
152
+ providerMarker: 'email',
150
153
  saveFunction: saveTokenFromLocalStorage,
151
154
  },
152
155
  })
@@ -23,7 +23,7 @@ export default class AdminsApi extends AsyncModules implements IAdmins {
23
23
  /**
24
24
  * Get all admins objects with filters.
25
25
  * @handleName getAdminsInfo
26
- * @param {AttributeType[]} body - Array of filter objects with search conditions. Default: []. Example:
26
+ * @param {AttributeType[]} [body] - Array of filter objects with search conditions. Default: []. Example:
27
27
  [
28
28
  {
29
29
  "attributeMarker": "num",
@@ -36,12 +36,12 @@ export default class AdminsApi extends AsyncModules implements IAdmins {
36
36
  "conditionValue": 3
37
37
  }
38
38
  ]
39
- * @param {string} body.attributeMarker - Text identifier (marker) of the attribute in the set. Example: "num".
40
- * @param {string} body.conditionMarker - Text identifier (marker) of the condition in the set. Example: "mth".
41
- * @param {string} body.conditionValue - Value of the condition. Example: 1.
42
- * @param {string} langCode - Language code. Default: "en_US".
43
- * @param {number} offset - Parameter for pagination. Default: 0.
44
- * @param {number} limit - Parameter for pagination. Default: 30.
39
+ * @param {string} [body.attributeMarker] - Text identifier (marker) of the attribute in the set. Example: "num".
40
+ * @param {string} [body.conditionMarker] - Text identifier (marker) of the condition in the set. Example: "mth".
41
+ * @param {string} [body.conditionValue] - Value of the condition. Example: 1.
42
+ * @param {string} [langCode] - Language code. Default: "en_US".
43
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
44
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
45
45
  * @returns {IAdminEntity[]} Returns an array of admin objects.
46
46
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
47
47
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
@@ -26,7 +26,7 @@ class AdminsApi extends asyncModules_1.default {
26
26
  /**
27
27
  * Get all admins objects with filters.
28
28
  * @handleName getAdminsInfo
29
- * @param {AttributeType[]} body - Array of filter objects with search conditions. Default: []. Example:
29
+ * @param {AttributeType[]} [body] - Array of filter objects with search conditions. Default: []. Example:
30
30
  [
31
31
  {
32
32
  "attributeMarker": "num",
@@ -39,12 +39,12 @@ class AdminsApi extends asyncModules_1.default {
39
39
  "conditionValue": 3
40
40
  }
41
41
  ]
42
- * @param {string} body.attributeMarker - Text identifier (marker) of the attribute in the set. Example: "num".
43
- * @param {string} body.conditionMarker - Text identifier (marker) of the condition in the set. Example: "mth".
44
- * @param {string} body.conditionValue - Value of the condition. Example: 1.
45
- * @param {string} langCode - Language code. Default: "en_US".
46
- * @param {number} offset - Parameter for pagination. Default: 0.
47
- * @param {number} limit - Parameter for pagination. Default: 30.
42
+ * @param {string} [body.attributeMarker] - Text identifier (marker) of the attribute in the set. Example: "num".
43
+ * @param {string} [body.conditionMarker] - Text identifier (marker) of the condition in the set. Example: "mth".
44
+ * @param {string} [body.conditionValue] - Value of the condition. Example: 1.
45
+ * @param {string} [langCode] - Language code. Default: "en_US".
46
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
47
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
48
48
  * @returns {IAdminEntity[]} Returns an array of admin objects.
49
49
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
50
50
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
@@ -9,18 +9,18 @@ interface IAdmins {
9
9
  * Get all admins objects with filters.
10
10
  * @handleName getAdminsInfo
11
11
  * @param {AttributeType[]} [body] - Array of filter objects with search conditions. Default: []. Example:
12
- [
13
- {
14
- "attributeMarker": "num",
15
- "conditionMarker": "mth",
16
- "conditionValue": 1
17
- },
18
- {
19
- "attributeMarker": "num",
20
- "conditionMarker": "lth",
21
- "conditionValue": 3
22
- }
23
- ]
12
+ [
13
+ {
14
+ "attributeMarker": "num",
15
+ "conditionMarker": "mth",
16
+ "conditionValue": 1
17
+ },
18
+ {
19
+ "attributeMarker": "num",
20
+ "conditionMarker": "lth",
21
+ "conditionValue": 3
22
+ }
23
+ ]
24
24
  * @param {string} [body.attributeMarker] - Text identifier (marker) of the attribute in the set. Example: "num".
25
25
  * @param {string} [body.conditionMarker] - Text identifier (marker) of the condition in the set. Example: "mth".
26
26
  * @param {string} [body.conditionValue] - Value of the condition. Example: 1.
@@ -209,7 +209,7 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
209
209
  getAuthProviderByMarker(marker: string, langCode?: string): Promise<IAuthProvidersEntity | IError>;
210
210
  /**
211
211
  * Getting active user sessions data.
212
- * @handleName getActiveSessions
212
+ * @handleName getActiveSessionsByMarker
213
213
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
214
214
  * @returns {IActiveSession[]} Returns an auth provider object.
215
215
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
@@ -297,7 +297,7 @@ class AuthProviderApi extends asyncModules_1.default {
297
297
  }
298
298
  /**
299
299
  * Getting active user sessions data.
300
- * @handleName getActiveSessions
300
+ * @handleName getActiveSessionsByMarker
301
301
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
302
302
  * @returns {IActiveSession[]} Returns an auth provider object.
303
303
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
@@ -428,9 +428,15 @@ interface IAuthPostBody {
428
428
  /**
429
429
  * Interface representing the active session data.
430
430
  * @interface IActiveSession
431
- * @property {string} os - The operating system of the active session. Example: "Win32".
432
- * @property {string} browser - The browser used in the active session. Example: "Node.js/22".
433
- * @property {string} location - The location of the active session. Example: "ru-RU".
431
+ * @property {object} deviceInfo - Information about the device used in the active session. Example:
432
+ {
433
+ "os": "Win32",
434
+ "browser": "Node.js/22",
435
+ "location": "ru-RU"
436
+ }
437
+ * @property {string} deviceInfo.os - The operating system of the active session. Example: "Win32".
438
+ * @property {string} deviceInfo.browser - The browser used in the active session. Example: "Node.js/22".
439
+ * @property {string} deviceInfo.location - The location of the active session. Example: "ru-RU".
434
440
  * @description This interface defines the structure of the body used in authentication requests, containing an array of authentication data.
435
441
  */
436
442
  interface IActiveSession {
@@ -237,12 +237,20 @@ class AsyncModules extends syncModules_1.default {
237
237
  * @description Define an asynchronous method 'refreshToken' that attempts to refresh the authentication token
238
238
  */
239
239
  async refreshToken() {
240
- // Perform a fetch request to the specified URL to refresh the token
241
- const response = await fetch(this.state.url +
242
- `/api/content/users-auth-providers/marker/email/users/refresh`, {
243
- // Use the POST method for the request
240
+ const url = this.state.url +
241
+ `/api/content/users-auth-providers/marker/` +
242
+ this.state.providerMarker +
243
+ `/users/refresh`;
244
+ /**
245
+ * Perform a fetch request to the specified URL to refresh the token
246
+ * @param {string} url - The URL to which the request will be sent
247
+ * @param {object} options - The options for the fetch request
248
+ * @param {string} options.method - The HTTP method to use for the request (default: 'POST')
249
+ * @param {object} options.headers - Set the necessary headers for the request
250
+ * @param {object} options.body - Send the current refresh token in the request body as a JSON string
251
+ */
252
+ const response = await fetch(url, {
244
253
  method: 'POST',
245
- // Set the necessary headers for the request
246
254
  headers: {
247
255
  // Indicate that the request body is in JSON format
248
256
  'Content-Type': 'application/json',
@@ -251,7 +259,6 @@ class AsyncModules extends syncModules_1.default {
251
259
  // Include the device fingerprint
252
260
  'x-device-metadata': this._getDeviceMetadata(),
253
261
  },
254
- // Send the current refresh token in the request body as a JSON string
255
262
  body: JSON.stringify({ refreshToken: this.state.refreshToken }),
256
263
  });
257
264
  // Check if the response status is OK (status code 200-299)
@@ -1,32 +1,32 @@
1
1
  /**
2
- * Result class for handling response data
3
- * @description Result class for handling response data
2
+ * Result class for handling response data.
3
+ * @description Result class for handling response data.
4
4
  */
5
5
  export default class Result {
6
6
  body: any;
7
7
  /**
8
- * Constructor that initializes the class with a given data
9
- * @param {Response | string} data - Response or string data
8
+ * Constructor that initializes the class with a given data.
9
+ * @param {Response | string} data - Response or string data.
10
10
  * @description Constructor that initializes the class with a given data, which can be of type Response or string.
11
11
  */
12
12
  constructor(data: Response | string);
13
13
  /**
14
14
  * Asynchronously converts the body to a blob and returns the current instance.
15
- * @returns {Promise<Result>} Current instance
15
+ * @returns {Promise<Result>} Current instance.
16
16
  * @description Asynchronously converts the body to a blob and returns the current instance.
17
17
  */
18
18
  blob(): Promise<Result>;
19
19
  /**
20
20
  * Asynchronously parses the body as JSON and returns the current instance.
21
- * @returns {Promise<Result>} Current instance
21
+ * @returns {Promise<Result>} Current instance.
22
22
  * @description Asynchronously parses the body as JSON and returns the current instance.
23
23
  */
24
24
  json(): Promise<Result>;
25
25
  /**
26
26
  * Recursively removes language-specific data from the provided data or the body.
27
- * @param {string} langCode - Language code
28
- * @param {any} [data] - Data to process
29
- * @returns {any} Processed data
27
+ * @param {string} langCode - Language code.
28
+ * @param {any} [data] - Data to process.
29
+ * @returns {any} Processed data.
30
30
  * @description Recursively removes language-specific data from the provided data or the body.
31
31
  */
32
32
  makeDataWithoutLang(langCode: string, data?: any): any;
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  /* eslint-disable no-restricted-syntax */
5
5
  /* eslint-disable @typescript-eslint/no-explicit-any */
6
6
  /**
7
- * Result class for handling response data
8
- * @description Result class for handling response data
7
+ * Result class for handling response data.
8
+ * @description Result class for handling response data.
9
9
  */
10
10
  class Result {
11
11
  /**
12
- * Constructor that initializes the class with a given data
13
- * @param {Response | string} data - Response or string data
12
+ * Constructor that initializes the class with a given data.
13
+ * @param {Response | string} data - Response or string data.
14
14
  * @description Constructor that initializes the class with a given data, which can be of type Response or string.
15
15
  */
16
16
  constructor(data) {
@@ -18,7 +18,7 @@ class Result {
18
18
  }
19
19
  /**
20
20
  * Asynchronously converts the body to a blob and returns the current instance.
21
- * @returns {Promise<Result>} Current instance
21
+ * @returns {Promise<Result>} Current instance.
22
22
  * @description Asynchronously converts the body to a blob and returns the current instance.
23
23
  */
24
24
  async blob() {
@@ -28,7 +28,7 @@ class Result {
28
28
  }
29
29
  /**
30
30
  * Asynchronously parses the body as JSON and returns the current instance.
31
- * @returns {Promise<Result>} Current instance
31
+ * @returns {Promise<Result>} Current instance.
32
32
  * @description Asynchronously parses the body as JSON and returns the current instance.
33
33
  */
34
34
  async json() {
@@ -41,9 +41,9 @@ class Result {
41
41
  }
42
42
  /**
43
43
  * Recursively removes language-specific data from the provided data or the body.
44
- * @param {string} langCode - Language code
45
- * @param {any} [data] - Data to process
46
- * @returns {any} Processed data
44
+ * @param {string} langCode - Language code.
45
+ * @param {any} [data] - Data to process.
46
+ * @returns {any} Processed data.
47
47
  * @description Recursively removes language-specific data from the provided data or the body.
48
48
  */
49
49
  makeDataWithoutLang(langCode, data) {
@@ -62,7 +62,7 @@ class Result {
62
62
  data[key] = data[key][langCode];
63
63
  }
64
64
  else if (typeof data[key] === 'object' && data[key] != null) {
65
- // If the value is an object, recursively process it
65
+ // If the value is an object, recursively process it.
66
66
  data[key] = this.makeDataWithoutLang(langCode, data[key]);
67
67
  }
68
68
  else if (Array.isArray(data[key])) {
@@ -1,7 +1,7 @@
1
1
  import type { IConfig, IError } from './utils';
2
2
  /**
3
- * State module for managing application state and configuration
4
- * @description State module for managing application state and configuration
3
+ * State module for managing application state and configuration.
4
+ * @description State module for managing application state and configuration.
5
5
  */
6
6
  export default class StateModule {
7
7
  url: string | undefined;
@@ -10,6 +10,7 @@ export default class StateModule {
10
10
  accessToken: string | undefined;
11
11
  traficLimit: boolean;
12
12
  refreshToken: string | undefined;
13
+ providerMarker: string;
13
14
  customAuth: boolean;
14
15
  _NO_FETCH: boolean;
15
16
  _https: any;
@@ -24,9 +25,9 @@ export default class StateModule {
24
25
  saveFunction: (param: string) => void | null;
25
26
  /**
26
27
  * Constructor for StateModule
27
- * @param {string} url - Base URL for API requests
28
- * @param {IConfig} config - Configuration object
29
- * @description Constructor for StateModule
28
+ * @param {string} url - Base URL for API requests.
29
+ * @param {IConfig} config - Configuration object.
30
+ * @description Constructor for StateModule.
30
31
  */
31
32
  constructor(url: string, config: IConfig);
32
33
  }
@@ -34,24 +34,25 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  /**
37
- * State module for managing application state and configuration
38
- * @description State module for managing application state and configuration
37
+ * State module for managing application state and configuration.
38
+ * @description State module for managing application state and configuration.
39
39
  */
40
40
  class StateModule {
41
41
  /**
42
42
  * Constructor for StateModule
43
- * @param {string} url - Base URL for API requests
44
- * @param {IConfig} config - Configuration object
45
- * @description Constructor for StateModule
43
+ * @param {string} url - Base URL for API requests.
44
+ * @param {IConfig} config - Configuration object.
45
+ * @description Constructor for StateModule.
46
46
  */
47
47
  constructor(url, config) {
48
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
48
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
49
49
  this.url = url;
50
50
  this.lang = (_a = config.langCode) !== null && _a !== void 0 ? _a : 'en_US';
51
51
  this.token = config.token;
52
52
  this.traficLimit = config.traficLimit || false;
53
53
  this.refreshToken = (_c = (_b = config.auth) === null || _b === void 0 ? void 0 : _b.refreshToken) !== null && _c !== void 0 ? _c : undefined;
54
- this.customAuth = (_e = (_d = config.auth) === null || _d === void 0 ? void 0 : _d.customAuth) !== null && _e !== void 0 ? _e : false;
54
+ this.providerMarker = (_e = (_d = config.auth) === null || _d === void 0 ? void 0 : _d.providerMarker) !== null && _e !== void 0 ? _e : 'email';
55
+ this.customAuth = (_g = (_f = config.auth) === null || _f === void 0 ? void 0 : _f.customAuth) !== null && _g !== void 0 ? _g : false;
55
56
  this.errorsFunctions = {
56
57
  '400': undefined,
57
58
  '401': undefined,
@@ -59,20 +60,20 @@ class StateModule {
59
60
  '404': undefined,
60
61
  '500': undefined,
61
62
  };
62
- this.saveFunction = (_g = (_f = config.auth) === null || _f === void 0 ? void 0 : _f.saveFunction) !== null && _g !== void 0 ? _g : null;
63
+ this.saveFunction = (_j = (_h = config.auth) === null || _h === void 0 ? void 0 : _h.saveFunction) !== null && _j !== void 0 ? _j : null;
63
64
  if (config.errors) {
64
- this.isShell = (_h = config.errors.isShell) !== null && _h !== void 0 ? _h : true;
65
+ this.isShell = (_k = config.errors.isShell) !== null && _k !== void 0 ? _k : true;
65
66
  if (config.errors.customErrors) {
66
67
  this.errorsFunctions['400'] =
67
- (_j = config.errors.customErrors['400']) !== null && _j !== void 0 ? _j : undefined;
68
+ (_l = config.errors.customErrors['400']) !== null && _l !== void 0 ? _l : undefined;
68
69
  this.errorsFunctions['401'] =
69
- (_k = config.errors.customErrors['401']) !== null && _k !== void 0 ? _k : undefined;
70
+ (_m = config.errors.customErrors['401']) !== null && _m !== void 0 ? _m : undefined;
70
71
  this.errorsFunctions['403'] =
71
- (_l = config.errors.customErrors['403']) !== null && _l !== void 0 ? _l : undefined;
72
+ (_o = config.errors.customErrors['403']) !== null && _o !== void 0 ? _o : undefined;
72
73
  this.errorsFunctions['404'] =
73
- (_m = config.errors.customErrors['404']) !== null && _m !== void 0 ? _m : undefined;
74
+ (_p = config.errors.customErrors['404']) !== null && _p !== void 0 ? _p : undefined;
74
75
  this.errorsFunctions['500'] =
75
- (_o = config.errors.customErrors['400']) !== null && _o !== void 0 ? _o : undefined;
76
+ (_q = config.errors.customErrors['400']) !== null && _q !== void 0 ? _q : undefined;
76
77
  }
77
78
  }
78
79
  else {
@@ -2,11 +2,16 @@ import type { IUploadingQuery } from '../file-uploading/fileUploadingInterfaces'
2
2
  import type { IProductsQuery } from '../products/productsInterfaces';
3
3
  import type StateModule from './stateModule';
4
4
  /**
5
- *
5
+ * Abstract class representing synchronization modules.
6
6
  */
7
7
  export default abstract class SyncModules {
8
+ /** Protected properties for state and URL */
8
9
  protected state: StateModule;
9
10
  protected _url: string;
11
+ /**
12
+ * Constructor to initialize state and URL.
13
+ * @param {StateModule} state - StateModule instance.
14
+ */
10
15
  protected constructor(state: StateModule);
11
16
  /**
12
17
  * Constructs the full URL path by appending the given path to the base URL.
@@ -30,7 +35,7 @@ export default abstract class SyncModules {
30
35
  /**
31
36
  * Normalizes the body of a POST request.
32
37
  * @param {any} body - The body to normalize.
33
- * @param {string} langCode - The language code for normalization.
38
+ * @param {string} [langCode] - The language code for normalization.
34
39
  * @returns {any} Normalized body.
35
40
  */
36
41
  protected _normalizePostBody(body: any, langCode?: string): any;
@@ -52,7 +57,7 @@ export default abstract class SyncModules {
52
57
  * @param {number} days - The number of days to add.
53
58
  * @returns {any} The new date with added days.
54
59
  */
55
- protected _addDays(date: Date, days: number): Date;
60
+ protected _addDays(date: Date, days: number): any;
56
61
  /**
57
62
  * Generates intervals for a specific date based on a schedule.
58
63
  * @param {Date} date - The date for which to generate intervals.
@@ -82,7 +87,7 @@ export default abstract class SyncModules {
82
87
  /**
83
88
  * Processes data after fetching or receiving it.
84
89
  * @param {any} data - The data to process.
85
- * @param {any} langCode - The language code for processing.
90
+ * @param {any} [langCode] - The language code for processing.
86
91
  * @returns {any} Processed data.
87
92
  */
88
93
  protected _dataPostProcess(data: any, langCode?: string): any;
@@ -94,7 +99,7 @@ export default abstract class SyncModules {
94
99
  setAccessToken(accessToken: string): any;
95
100
  /**
96
101
  * Sets the refresh token in the state.
97
- * @param {any} refreshToken - The refresh token to set.
102
+ * @param {string} refreshToken - The refresh token to set.
98
103
  * @returns {any} The instance of SyncModules for chaining.
99
104
  */
100
105
  setRefreshToken(refreshToken: string): any;
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // Abstract class representing synchronization modules
4
3
  /**
5
- *
4
+ * Abstract class representing synchronization modules.
6
5
  */
7
6
  class SyncModules {
8
- // Constructor to initialize state and URL
7
+ /**
8
+ * Constructor to initialize state and URL.
9
+ * @param {StateModule} state - StateModule instance.
10
+ */
9
11
  constructor(state) {
10
12
  /**
11
13
  * Sorts attributes by their positions.
@@ -73,7 +75,7 @@ class SyncModules {
73
75
  /**
74
76
  * Normalizes the body of a POST request.
75
77
  * @param {any} body - The body to normalize.
76
- * @param {string} langCode - The language code for normalization.
78
+ * @param {string} [langCode] - The language code for normalization.
77
79
  * @returns {any} Normalized body.
78
80
  */
79
81
  _normalizePostBody(body, langCode = this.state.lang) {
@@ -262,7 +264,7 @@ class SyncModules {
262
264
  * @returns {any} Normalized attributes.
263
265
  */
264
266
  _normalizeAttr(data) {
265
- // For regular attributes
267
+ // For regular attributes collections
266
268
  if ('attributeValues' in data) {
267
269
  for (const attr in data.attributeValues) {
268
270
  const d = data.attributeValues[attr];
@@ -305,12 +307,16 @@ class SyncModules {
305
307
  }
306
308
  return data;
307
309
  }
310
+ // !!! For single attribute
311
+ if ('attributes' in data) {
312
+ //
313
+ }
308
314
  return data;
309
315
  }
310
316
  /**
311
317
  * Processes data after fetching or receiving it.
312
318
  * @param {any} data - The data to process.
313
- * @param {any} langCode - The language code for processing.
319
+ * @param {any} [langCode] - The language code for processing.
314
320
  * @returns {any} Processed data.
315
321
  */
316
322
  _dataPostProcess(data, langCode = this.state.lang) {
@@ -329,7 +335,7 @@ class SyncModules {
329
335
  }
330
336
  /**
331
337
  * Sets the refresh token in the state.
332
- * @param {any} refreshToken - The refresh token to set.
338
+ * @param {string} refreshToken - The refresh token to set.
333
339
  * @returns {any} The instance of SyncModules for chaining.
334
340
  */
335
341
  setRefreshToken(refreshToken) {
@@ -377,6 +383,7 @@ class SyncModules {
377
383
  else {
378
384
  isPrivateBrowsing = true; // If localStorage is not available, likely private browsing
379
385
  }
386
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
380
387
  }
381
388
  catch (e) {
382
389
  isPrivateBrowsing = true; // Error during localStorage access indicates private browsing
@@ -3,11 +3,13 @@ type Types = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'si
3
3
  * @param {string} [token] - If your project is protected by a token, specify this token in this parameter.
4
4
  * @param {string} [langCode] - specify the default language to avoid specifying it in every request.
5
5
  * @param {boolean} [traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
6
- * @param {boolean} [auth] - An object with authorization settings
7
- * @param {boolean} [auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal
8
- * @param {boolean} [auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created
9
- * @param {boolean} [auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated
6
+ * @param {boolean} [auth] - An object with authorization settings.
7
+ * @param {boolean} [auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
8
+ * @param {boolean} [auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
9
+ * @param {boolean} [auth.providerMarker] - The marker of the provider, for example, email, google, facebook, etc. Default 'email';
10
+ * @param {boolean} [auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated.
10
11
  * @example
12
+ * ```ts
11
13
  * const saveToken = (token) => {
12
14
  * localStorage.setItem('refresh', token)
13
15
  * }
@@ -19,6 +21,7 @@ type Types = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'si
19
21
  * auth: {
20
22
  * customAuth: false,
21
23
  * refreshToken: 'user.refresh.token',
24
+ * providerMarker: 'email',
22
25
  * saveFunction: saveToken
23
26
  * },
24
27
  * errors: {
@@ -29,6 +32,7 @@ type Types = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'si
29
32
  * }
30
33
  * }
31
34
  * }
35
+ * ```
32
36
  */
33
37
  interface IConfig {
34
38
  token?: string;
@@ -37,6 +41,7 @@ interface IConfig {
37
41
  auth?: {
38
42
  customAuth?: boolean;
39
43
  refreshToken?: string;
44
+ providerMarker?: string;
40
45
  saveFunction?: (refreshToken: string) => void;
41
46
  };
42
47
  errors?: {
@@ -85,7 +90,7 @@ interface IAttributes {
85
90
  }
86
91
  /**
87
92
  * @interface ILocalizeInfos
88
- * @property {Record<string, ILocalizeInfo>} Localization information.
93
+ * @property {Record<string, ILocalizeInfo>} - Localization information.
89
94
  * @description Interface for localization information.
90
95
  */
91
96
  interface ILocalizeInfos {
@@ -93,7 +98,7 @@ interface ILocalizeInfos {
93
98
  }
94
99
  /**
95
100
  * Interface for localization information.
96
- * @property {Record<string, any>} Localization information.
101
+ * @property {Record<string, any>} - Localization information.
97
102
  * @description Interface for localization information.
98
103
  */
99
104
  interface ILocalizeInfo {
@@ -101,7 +106,7 @@ interface ILocalizeInfo {
101
106
  }
102
107
  /**
103
108
  * @interface IAttributeValues
104
- * @property {Record<string, IAttributeValue>} Attribute values.
109
+ * @property {Record<string, IAttributeValue>} - Attribute values.
105
110
  * @description Interface for attribute values.
106
111
  */
107
112
  interface IAttributeValues {
@@ -109,15 +114,21 @@ interface IAttributeValues {
109
114
  }
110
115
  /**
111
116
  * @interface IAttributeValue
112
- * @property {Record<string, any>} Attribute value.
117
+ * @property {Record<string, any>} - Attribute value.
113
118
  * @description Interface for attribute value.
114
119
  */
115
120
  interface IAttributeValue {
116
121
  [key: string]: any;
117
122
  }
118
- type AttributeType = IAttributeValue | IAttributeValues;
119
- type LangType = string | Array<string>;
120
- type LocalizeType = ILocalizeInfos | ILocalizeInfo;
123
+ /**
124
+ * @interface IError
125
+ * @property {string} message - Error message.
126
+ * @property {any} pageData - Page data.
127
+ * @property {number} statusCode - Status code.
128
+ * @property {string} timestamp - Timestamp.
129
+ * @property {Record<string, any>} - Attribute value.
130
+ * @description Interface for error.
131
+ */
121
132
  interface IError {
122
133
  message: string;
123
134
  pageData: any;
@@ -125,4 +136,16 @@ interface IError {
125
136
  timestamp: string;
126
137
  [key: string]: any;
127
138
  }
139
+ /**
140
+ * AttributeType
141
+ */
142
+ type AttributeType = IAttributeValue | IAttributeValues;
143
+ /**
144
+ * LangType
145
+ */
146
+ type LangType = string | Array<string>;
147
+ /**
148
+ * LocalizeType
149
+ */
150
+ type LocalizeType = ILocalizeInfos | ILocalizeInfo;
128
151
  export type { AttributeType, IAttributes, IAttributeValues, IConfig, IError, ILocalizeInfo, ILocalizeInfos, LangType, LocalizeType, Types, };
@@ -46,8 +46,20 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
46
46
  }
47
47
  ]
48
48
  }
49
+ * @param {string} body.formIdentifier - The identifier for the form. Example: "form".
50
+ * @param {FormDataType[]} body.formData - Form data. Example:
51
+ [
52
+ {
53
+ "marker": "name",
54
+ "type": "string",
55
+ "value": "Jack"
56
+ }
57
+ ]
58
+ * @param {string} body.formData.marker - The marker identifying the form field. Example: "name".
59
+ * @param {string} body.formData.type - The type of the form field. Example: "string".
60
+ * @param {string} body.formData.value - The value of the form field. Example: "Jack".
49
61
  * @param {string} [langCode] - Language code. Default: "en_US".
50
- * @returns {IPostFormResponse} Returns an object containing the created form data entry or an error object if there was an issue.
62
+ * @returns {IPostFormResponse} Returns an object containing the created form data entry and message.
51
63
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
52
64
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
53
65
  */
@@ -55,8 +55,20 @@ class FormsDataApi extends asyncModules_1.default {
55
55
  }
56
56
  ]
57
57
  }
58
+ * @param {string} body.formIdentifier - The identifier for the form. Example: "form".
59
+ * @param {FormDataType[]} body.formData - Form data. Example:
60
+ [
61
+ {
62
+ "marker": "name",
63
+ "type": "string",
64
+ "value": "Jack"
65
+ }
66
+ ]
67
+ * @param {string} body.formData.marker - The marker identifying the form field. Example: "name".
68
+ * @param {string} body.formData.type - The type of the form field. Example: "string".
69
+ * @param {string} body.formData.value - The value of the form field. Example: "Jack".
58
70
  * @param {string} [langCode] - Language code. Default: "en_US".
59
- * @returns {IPostFormResponse} Returns an object containing the created form data entry or an error object if there was an issue.
71
+ * @returns {IPostFormResponse} Returns an object containing the created form data entry and message.
60
72
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
61
73
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
62
74
  */
@@ -23,14 +23,18 @@ interface IFormsData {
23
23
  /**
24
24
  * Creating an object of data save information by form
25
25
  * @handleName postFormsData
26
- * @param {IBodyPostFormData} body - Request body. Example
26
+ * @param {IBodyPostFormData} body - Request body. Example:
27
27
  {
28
- "formIdentifier": "form",
28
+ "formIdentifier": "test-form",
29
+ "formModuleConfigId": 2,
30
+ "moduleEntityIdentifier": "blog",
31
+ "replayTo": null,
32
+ "status": "sent",
29
33
  "formData": [
30
34
  {
31
- "marker": "name",
32
- "type": "string",
33
- "value": "Jack"
35
+ "marker": "name",
36
+ "type": "string",
37
+ "value": "Test"
34
38
  }
35
39
  ]
36
40
  }
@@ -201,6 +205,23 @@ interface IFormsByMarkerDataEntity {
201
205
  * @interface IPostFormResponse
202
206
  * @property {string} actionMessage - Action message for the form data. Example: "Form submitted successfully".
203
207
  * @property {object} formData - Form data. Example:
208
+ {
209
+ "id": 42,
210
+ "formIdentifier": "contact_form",
211
+ "time": "2023-10-01T12:00:00Z",
212
+ "entityIdentifier": "blog",
213
+ "isUserAdmin": false,
214
+ "formModuleId": 2,
215
+ "parentId": null,
216
+ "userIdentifier": null,
217
+ "formData": [
218
+ {
219
+ "marker": "name",
220
+ "type": "string",
221
+ "value": "Jack"
222
+ }
223
+ ]
224
+ }
204
225
  * @property {number} formData.id - The unique identifier of the form page. Example: 12345.
205
226
  * @property {string} formData.formIdentifier - The identifier of the form. Example: "contact_form".
206
227
  * @property {string} formData.time - The time of the form submit. Example: "2023-10-01T12:00:00Z".
@@ -225,6 +246,7 @@ interface IPostFormResponse {
225
246
  formIdentifier: string;
226
247
  time: string;
227
248
  entityIdentifier: string;
249
+ fingerprint: string;
228
250
  isUserAdmin: boolean;
229
251
  formModuleId: number;
230
252
  userIdentifier: any;
@@ -1,5 +1,5 @@
1
- import type { BlockType } from 'blocks/blocksInterfaces';
2
1
  import type { IError } from '../base/utils';
2
+ import type { BlockType } from '../blocks/blocksInterfaces';
3
3
  /**
4
4
  * Interface for retrieving all general types in the system.
5
5
  * @interface IGeneralTypes
@@ -19,9 +19,9 @@ interface IGeneralTypes {
19
19
  /**
20
20
  * Represents a general type entity.
21
21
  * @interface IGeneralTypesEntity
22
- * @description Represents a general type entity with an identifier and a type.
23
22
  * @property {number} id - Type id. Example: 1.
24
23
  * @property {Types} type - Types enum. Example: "product", "category", "etc".
24
+ * @description Represents a general type entity with an identifier and a type.
25
25
  */
26
26
  interface IGeneralTypesEntity {
27
27
  id: number;
package/dist/index.d.ts CHANGED
@@ -63,6 +63,7 @@ interface IDefineApi {
63
63
  * @param {string} [config.auth] - An object with authorization settings.
64
64
  * @param {boolean} [config.auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
65
65
  * @param {string} [config.auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
66
+ * @param {string} [config.auth.providerMarker] - The marker of the authorization provider.
66
67
  * @param {string} [config.auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated.
67
68
  * @returns {IDefineApi} List of methods set.
68
69
  * @description Define API.
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ const wsApi_1 = __importDefault(require("./web-socket/wsApi"));
41
41
  * @param {string} [config.auth] - An object with authorization settings.
42
42
  * @param {boolean} [config.auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
43
43
  * @param {string} [config.auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
44
+ * @param {string} [config.auth.providerMarker] - The marker of the authorization provider.
44
45
  * @param {string} [config.auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated.
45
46
  * @returns {IDefineApi} List of methods set.
46
47
  * @description Define API.
@@ -178,14 +178,15 @@ interface IAccountsEntity {
178
178
  isUsed: boolean;
179
179
  testMode: boolean;
180
180
  settings: any;
181
- testSettings: {
182
- status: string;
181
+ testSettings?: {
183
182
  cancelUrl?: string;
184
183
  successUrl?: string;
185
184
  sessionTimeout?: number;
186
185
  stripeAccountId?: string;
187
186
  stripeRedirectUrl?: string;
188
187
  stripeOnboardingComplete?: boolean;
188
+ stripePublishableKey?: string;
189
+ status: string;
189
190
  };
190
191
  }
191
192
  export type { IAccountsEntity, ICreateSessionEntity, IIntent, IPaymentsApi, ISessionEntity, ISessionItem, ISessionsEntity, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.128",
3
+ "version": "1.0.130",
4
4
  "description": "OneEntry NPM package",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,6 +31,7 @@
31
31
  "templatespreview": "npx jest src/templates-preview/tests/templatespreview.spec.ts",
32
32
  "users": "npx jest src/users/tests/users.spec.ts",
33
33
  "lint": "npx eslint .",
34
+ "tsc": "npx tsc --noEmit --watch false",
34
35
  "lintFix": "npx eslint . --fix",
35
36
  "build": "npx tsc"
36
37
  },
@@ -47,23 +48,23 @@
47
48
  "@jest/globals": "^30.2.0",
48
49
  "@types/eslint-config-prettier": "^6.11.3",
49
50
  "@types/jest": "^30.0.0",
50
- "@types/node": "^24.6.2",
51
- "@typescript-eslint/eslint-plugin": "^8.45.0",
52
- "@typescript-eslint/parser": "^8.45.0",
51
+ "@types/node": "^24.7.2",
52
+ "@typescript-eslint/eslint-plugin": "^8.46.1",
53
+ "@typescript-eslint/parser": "^8.46.1",
53
54
  "eslint": "^9.37.0",
54
55
  "eslint-config-prettier": "^10.1.8",
55
56
  "eslint-plugin-import": "^2.32.0",
56
57
  "eslint-plugin-jest": "^29.0.1",
57
58
  "eslint-plugin-jest-extended": "^3.0.1",
58
- "eslint-plugin-jsdoc": "^60.8.2",
59
+ "eslint-plugin-jsdoc": "^61.1.4",
59
60
  "eslint-plugin-prettier": "^5.5.4",
60
61
  "eslint-plugin-simple-import-sort": "^12.1.1",
61
62
  "jest": "^30.2.0",
62
63
  "jest-extended": "^6.0.0",
63
- "jsdoc": "^4.0.4",
64
+ "jsdoc": "^4.0.5",
64
65
  "npm-run-all": "^4.1.5",
65
66
  "prettier": "^3.6.2",
66
- "ts-jest": "^29.4.4",
67
+ "ts-jest": "^29.4.5",
67
68
  "typescript": "^5.9.3"
68
69
  }
69
- }
70
+ }