oneentry 1.0.128 → 1.0.131
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 +3 -0
- package/dist/admins/adminsApi.d.ts +8 -8
- package/dist/admins/adminsApi.js +8 -8
- package/dist/admins/adminsInterfaces.d.ts +16 -15
- package/dist/attribute-sets/attributeSetsApi.d.ts +0 -4
- package/dist/attribute-sets/attributeSetsApi.js +0 -4
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +42 -32
- package/dist/auth-provider/authProviderApi.d.ts +19 -10
- package/dist/auth-provider/authProviderApi.js +19 -10
- package/dist/auth-provider/authProvidersInterfaces.d.ts +28 -12
- package/dist/base/asyncModules.js +13 -6
- package/dist/base/result.d.ts +9 -9
- package/dist/base/result.js +10 -10
- package/dist/base/stateModule.d.ts +6 -5
- package/dist/base/stateModule.js +15 -14
- package/dist/base/syncModules.d.ts +10 -5
- package/dist/base/syncModules.js +14 -7
- package/dist/base/utils.d.ts +34 -11
- package/dist/blocks/blocksApi.d.ts +0 -4
- package/dist/blocks/blocksApi.js +0 -4
- package/dist/config.d.ts +1 -1
- package/dist/config.js +3 -1
- package/dist/events/eventsApi.d.ts +6 -3
- package/dist/events/eventsApi.js +6 -3
- package/dist/events/eventsInterfaces.d.ts +2 -1
- package/dist/file-uploading/fileUploadingApi.d.ts +12 -6
- package/dist/file-uploading/fileUploadingApi.js +12 -6
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +10 -5
- package/dist/forms/formsApi.d.ts +4 -2
- package/dist/forms/formsApi.js +4 -2
- package/dist/forms/formsInterfaces.d.ts +2 -1
- package/dist/forms-data/formsDataApi.d.ts +28 -6
- package/dist/forms-data/formsDataApi.js +28 -6
- package/dist/forms-data/formsDataInterfaces.d.ts +64 -22
- package/dist/general-types/generalTypesInterfaces.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/integration-collections/integrationCollectionsApi.d.ts +10 -5
- package/dist/integration-collections/integrationCollectionsApi.js +10 -5
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +20 -10
- package/dist/menus/menusInterfaces.d.ts +8 -4
- package/dist/orders/ordersApi.d.ts +16 -8
- package/dist/orders/ordersApi.js +16 -8
- package/dist/orders/ordersInterfaces.d.ts +39 -18
- package/dist/pages/pagesApi.d.ts +2 -1
- package/dist/pages/pagesApi.js +2 -1
- package/dist/pages/pagesInterfaces.d.ts +10 -5
- package/dist/payments/paymentsApi.d.ts +20 -12
- package/dist/payments/paymentsApi.js +20 -12
- package/dist/payments/paymentsInterfaces.d.ts +28 -9
- package/dist/product-statuses/productStatusesInterfaces.d.ts +5 -4
- package/dist/products/productsApi.d.ts +28 -15
- package/dist/products/productsApi.js +28 -15
- package/dist/products/productsInterfaces.d.ts +33 -18
- package/dist/system/systemApi.d.ts +2 -1
- package/dist/system/systemApi.js +2 -1
- package/dist/templates/templatesInterfaces.d.ts +3 -2
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +8 -4
- package/dist/users/usersApi.d.ts +14 -7
- package/dist/users/usersApi.js +14 -7
- package/dist/users/usersInterfaces.d.ts +23 -11
- package/dist/web-socket/wsApi.d.ts +2 -1
- package/dist/web-socket/wsApi.js +2 -1
- package/package.json +9 -8
|
@@ -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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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)
|
package/dist/base/result.d.ts
CHANGED
|
@@ -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;
|
package/dist/base/result.js
CHANGED
|
@@ -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
|
}
|
package/dist/base/stateModule.js
CHANGED
|
@@ -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.
|
|
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 = (
|
|
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 = (
|
|
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
|
-
(
|
|
68
|
+
(_l = config.errors.customErrors['400']) !== null && _l !== void 0 ? _l : undefined;
|
|
68
69
|
this.errorsFunctions['401'] =
|
|
69
|
-
(
|
|
70
|
+
(_m = config.errors.customErrors['401']) !== null && _m !== void 0 ? _m : undefined;
|
|
70
71
|
this.errorsFunctions['403'] =
|
|
71
|
-
(
|
|
72
|
+
(_o = config.errors.customErrors['403']) !== null && _o !== void 0 ? _o : undefined;
|
|
72
73
|
this.errorsFunctions['404'] =
|
|
73
|
-
(
|
|
74
|
+
(_p = config.errors.customErrors['404']) !== null && _p !== void 0 ? _p : undefined;
|
|
74
75
|
this.errorsFunctions['500'] =
|
|
75
|
-
(
|
|
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):
|
|
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 {
|
|
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;
|
package/dist/base/syncModules.js
CHANGED
|
@@ -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
|
-
|
|
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 {
|
|
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
|
package/dist/base/utils.d.ts
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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, };
|
|
@@ -26,7 +26,6 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
26
26
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
27
27
|
* @returns {IBlocksResponse} Returns BlocksEntity object.
|
|
28
28
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
29
|
-
* @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.
|
|
30
29
|
*/
|
|
31
30
|
getBlocks(type?: BlockType, langCode?: string, offset?: number, limit?: number): Promise<IBlocksResponse | IError>;
|
|
32
31
|
/**
|
|
@@ -50,7 +49,6 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
50
49
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
51
50
|
* @returns {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
|
|
52
51
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
53
|
-
* @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.
|
|
54
52
|
*/
|
|
55
53
|
private getSimilarProducts;
|
|
56
54
|
/**
|
|
@@ -62,7 +60,6 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
62
60
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
63
61
|
* @returns {IProductsEntity[]} Return array of BlocksEntity object.
|
|
64
62
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
65
|
-
* @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.
|
|
66
63
|
*/
|
|
67
64
|
private getProductsByBlockMarker;
|
|
68
65
|
/**
|
|
@@ -72,7 +69,6 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
72
69
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
73
70
|
* @returns {ISearchBlock[]} Returns an array of ISearchBlock objects.
|
|
74
71
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
75
|
-
* @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.
|
|
76
72
|
*/
|
|
77
73
|
searchBlock(name: string, langCode?: string): Promise<ISearchBlock[] | IError>;
|
|
78
74
|
}
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -29,7 +29,6 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
29
29
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
30
30
|
* @returns {IBlocksResponse} Returns BlocksEntity object.
|
|
31
31
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
32
|
-
* @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.
|
|
33
32
|
*/
|
|
34
33
|
async getBlocks(type = '', langCode = this.state.lang, offset = 0, limit = 30) {
|
|
35
34
|
const response = await this._fetchPost(`?langCode=${langCode}&type=${type}&offset=${offset}&limit=${limit}`);
|
|
@@ -135,7 +134,6 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
135
134
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
136
135
|
* @returns {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
|
|
137
136
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
138
|
-
* @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.
|
|
139
137
|
*/
|
|
140
138
|
async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
141
139
|
const query = {
|
|
@@ -155,7 +153,6 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
155
153
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
156
154
|
* @returns {IProductsEntity[]} Return array of BlocksEntity object.
|
|
157
155
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
158
|
-
* @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.
|
|
159
156
|
*/
|
|
160
157
|
async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
161
158
|
const query = {
|
|
@@ -173,7 +170,6 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
173
170
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
174
171
|
* @returns {ISearchBlock[]} Returns an array of ISearchBlock objects.
|
|
175
172
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
176
|
-
* @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.
|
|
177
173
|
*/
|
|
178
174
|
async searchBlock(name, langCode = this.state.lang) {
|
|
179
175
|
const result = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const projectUrl = "https://
|
|
1
|
+
export declare const projectUrl = "https://js-sdk-tests.oneentry.cloud/";
|
|
2
2
|
export declare const projectToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk";
|
|
3
3
|
/**
|
|
4
4
|
* authData
|
package/dist/config.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.authData2 = exports.authData = exports.projectToken = exports.projectUrl = void 0;
|
|
4
|
-
|
|
4
|
+
// export const projectUrl = 'https://stage.oneentry.cloud';
|
|
5
|
+
// export const projectToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk';
|
|
6
|
+
exports.projectUrl = 'https://js-sdk-tests.oneentry.cloud/';
|
|
5
7
|
exports.projectToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk';
|
|
6
8
|
/**
|
|
7
9
|
* authData
|
|
@@ -29,7 +29,8 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
29
29
|
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
30
30
|
* @returns {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
|
|
31
31
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
32
|
-
* @description This method requires user authorization.
|
|
32
|
+
* @description This method requires user authorization.
|
|
33
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
33
34
|
*/
|
|
34
35
|
getAllSubscriptions(offset?: number, limit?: number): Promise<ISubscriptions | IError>;
|
|
35
36
|
/**
|
|
@@ -40,7 +41,8 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
40
41
|
* @param {string} [langCode] - Language code. Default: "en_US".=
|
|
41
42
|
* @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
|
|
42
43
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
43
|
-
* @description This method requires user authorization.
|
|
44
|
+
* @description This method requires user authorization.
|
|
45
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
44
46
|
*/
|
|
45
47
|
subscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
|
|
46
48
|
/**
|
|
@@ -51,7 +53,8 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
51
53
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
52
54
|
* @returns {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
|
|
53
55
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
54
|
-
* @description This method requires user authorization.
|
|
56
|
+
* @description This method requires user authorization.
|
|
57
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
55
58
|
*/
|
|
56
59
|
unsubscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
|
|
57
60
|
}
|
package/dist/events/eventsApi.js
CHANGED
|
@@ -34,7 +34,8 @@ class EventsApi extends asyncModules_1.default {
|
|
|
34
34
|
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
35
35
|
* @returns {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
|
|
36
36
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
37
|
-
* @description This method requires user authorization.
|
|
37
|
+
* @description This method requires user authorization.
|
|
38
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
38
39
|
*/
|
|
39
40
|
async getAllSubscriptions(offset = 0, limit = 30) {
|
|
40
41
|
const query = {
|
|
@@ -52,7 +53,8 @@ class EventsApi extends asyncModules_1.default {
|
|
|
52
53
|
* @param {string} [langCode] - Language code. Default: "en_US".=
|
|
53
54
|
* @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
|
|
54
55
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
55
|
-
* @description This method requires user authorization.
|
|
56
|
+
* @description This method requires user authorization.
|
|
57
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
56
58
|
*/
|
|
57
59
|
async subscribeByMarker(marker, productId, langCode = this.state.lang) {
|
|
58
60
|
const body = {
|
|
@@ -75,7 +77,8 @@ class EventsApi extends asyncModules_1.default {
|
|
|
75
77
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
76
78
|
* @returns {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
|
|
77
79
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
78
|
-
* @description This method requires user authorization.
|
|
80
|
+
* @description This method requires user authorization.
|
|
81
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
79
82
|
*/
|
|
80
83
|
async unsubscribeByMarker(marker, productId, langCode = this.state.lang) {
|
|
81
84
|
const body = {
|
|
@@ -42,7 +42,8 @@ interface IEvents {
|
|
|
42
42
|
* Represents a response from the events API containing a total count and an array of subscription items.
|
|
43
43
|
* @interface ISubscriptions
|
|
44
44
|
* @property {number} total - Total number of found records. Example: 100.
|
|
45
|
-
* @property {{ eventMarker: string; productId: number }[]} items - Array of subscription items, each containing an event marker and a product ID.
|
|
45
|
+
* @property {{ eventMarker: string; productId: number }[]} items - Array of subscription items, each containing an event marker and a product ID.
|
|
46
|
+
* @example
|
|
46
47
|
[
|
|
47
48
|
{
|
|
48
49
|
eventMarker: 'product_price_change',
|