oneentry 1.0.110 → 1.0.111
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 +15 -15
- package/dist/base/asyncModules.d.ts +42 -0
- package/dist/base/asyncModules.js +42 -0
- package/dist/base/syncModules.d.ts +73 -0
- package/dist/base/syncModules.js +137 -0
- package/dist/pages/pagesApi.js +4 -4
- package/dist/users/usersApi.d.ts +3 -4
- package/dist/users/usersApi.js +4 -11
- package/package.json +20 -20
package/README.md
CHANGED
|
@@ -1293,7 +1293,7 @@ const value = await AuthProvider.signUp('email', body)
|
|
|
1293
1293
|
>
|
|
1294
1294
|
>**formData:** FormDataLangType <br>
|
|
1295
1295
|
>*Data submitted by the form* <br>
|
|
1296
|
-
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "
|
|
1296
|
+
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "marker_1", "value": "Name" } ] } <br>
|
|
1297
1297
|
>
|
|
1298
1298
|
>**notificationData:** UserNotificationDataType <br>
|
|
1299
1299
|
>*data for notifying the user* <br>
|
|
@@ -1378,7 +1378,7 @@ Example return:
|
|
|
1378
1378
|
>
|
|
1379
1379
|
>**formData:** FormDataLangType <br>
|
|
1380
1380
|
>*Data submitted by the form* <br>
|
|
1381
|
-
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "
|
|
1381
|
+
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "marker_1", "value": "Name" } ] } <br>
|
|
1382
1382
|
>
|
|
1383
1383
|
>**notificationData:** UserNotificationDataType <br>
|
|
1384
1384
|
>*data for notifying the user* <br>
|
|
@@ -2954,7 +2954,7 @@ Example return:
|
|
|
2954
2954
|
>
|
|
2955
2955
|
>**formData:** FormDataLangType <br>
|
|
2956
2956
|
>*Data submitted by the form* <br>
|
|
2957
|
-
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "
|
|
2957
|
+
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "marker_1", "value": "Name" } ] } <br>
|
|
2958
2958
|
>
|
|
2959
2959
|
>**attributeSetIdentifier:** string <br>
|
|
2960
2960
|
>*text identifier (marker) of the used attribute set* <br>
|
|
@@ -2998,7 +2998,7 @@ const value = await FormData.postFormsData(body)
|
|
|
2998
2998
|
>
|
|
2999
2999
|
>**formData:** FormDataLangType <br>
|
|
3000
3000
|
>*Data submitted by the form* <br>
|
|
3001
|
-
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "
|
|
3001
|
+
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "marker_1", "type": "string", "value": "Name" } ] } <br>
|
|
3002
3002
|
>
|
|
3003
3003
|
></details>
|
|
3004
3004
|
|
|
@@ -3036,7 +3036,7 @@ Example return:
|
|
|
3036
3036
|
>
|
|
3037
3037
|
>**formData:** FormDataLangType <br>
|
|
3038
3038
|
>*Data submitted by the form* <br>
|
|
3039
|
-
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "
|
|
3039
|
+
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "marker_1", "value": "Name" } ] } <br>
|
|
3040
3040
|
><br>
|
|
3041
3041
|
></details>
|
|
3042
3042
|
|
|
@@ -3112,7 +3112,7 @@ Example return:
|
|
|
3112
3112
|
>
|
|
3113
3113
|
>**formData:** FormDataLangType <br>
|
|
3114
3114
|
>*Data submitted by the form* <br>
|
|
3115
|
-
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "
|
|
3115
|
+
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "marker_1", "value": "Name" } ] } <br>
|
|
3116
3116
|
>
|
|
3117
3117
|
>**attributeSetIdentifier:** string <br>
|
|
3118
3118
|
>*text identifier (marker) of the used attribute set* <br>
|
|
@@ -3483,7 +3483,7 @@ Example return:
|
|
|
3483
3483
|
"formData": {
|
|
3484
3484
|
"en_US": [
|
|
3485
3485
|
{
|
|
3486
|
-
"marker": "
|
|
3486
|
+
"marker": "marker_1",
|
|
3487
3487
|
"type": "string",
|
|
3488
3488
|
"value": "Title"
|
|
3489
3489
|
}
|
|
@@ -3515,7 +3515,7 @@ Example return:
|
|
|
3515
3515
|
>
|
|
3516
3516
|
>**formData:** FormDataLangType <br>
|
|
3517
3517
|
>*Data submitted by the form attached to the collection* <br>
|
|
3518
|
-
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "
|
|
3518
|
+
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "marker_1", "type": "string", "value": "Title" } ] } <br>
|
|
3519
3519
|
><br>
|
|
3520
3520
|
></details>
|
|
3521
3521
|
|
|
@@ -3593,7 +3593,7 @@ Example return:
|
|
|
3593
3593
|
>
|
|
3594
3594
|
>**formData:** FormDataLangType <br>
|
|
3595
3595
|
>*Data submitted by the form attached to the collection* <br>
|
|
3596
|
-
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "
|
|
3596
|
+
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "marker_1", "type": "string", "value": "Name" } ] } <br>
|
|
3597
3597
|
><br>
|
|
3598
3598
|
></details>
|
|
3599
3599
|
|
|
@@ -3657,7 +3657,7 @@ Example return:
|
|
|
3657
3657
|
"formData": {
|
|
3658
3658
|
"en_US": [
|
|
3659
3659
|
{
|
|
3660
|
-
"marker": "
|
|
3660
|
+
"marker": "marker_1",
|
|
3661
3661
|
"type": "string",
|
|
3662
3662
|
"value": "Name"
|
|
3663
3663
|
}
|
|
@@ -3675,7 +3675,7 @@ Example return:
|
|
|
3675
3675
|
>
|
|
3676
3676
|
>**formData:** FormDataLangType <br>
|
|
3677
3677
|
>*Data submitted by the form attached to the collection* <br>
|
|
3678
|
-
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "
|
|
3678
|
+
>example: OrderedMap { "en_US": List [ OrderedMap { "marker": "marker_1", "type": "string", "value": "Name" } ] } <br>
|
|
3679
3679
|
><br>
|
|
3680
3680
|
></details>
|
|
3681
3681
|
|
|
@@ -4312,7 +4312,7 @@ Example return:
|
|
|
4312
4312
|
"statusIdentifier": "inprogress",
|
|
4313
4313
|
"formData": [
|
|
4314
4314
|
{
|
|
4315
|
-
"marker": "
|
|
4315
|
+
"marker": "marker_1",
|
|
4316
4316
|
"type": "string",
|
|
4317
4317
|
"value": "Name"
|
|
4318
4318
|
}
|
|
@@ -4457,7 +4457,7 @@ Example return:
|
|
|
4457
4457
|
"statusIdentifier": "inprogress",
|
|
4458
4458
|
"formData": [
|
|
4459
4459
|
{
|
|
4460
|
-
"marker": "
|
|
4460
|
+
"marker": "marker_1",
|
|
4461
4461
|
"type": "string",
|
|
4462
4462
|
"value": "Name"
|
|
4463
4463
|
}
|
|
@@ -5146,7 +5146,7 @@ Example return:
|
|
|
5146
5146
|
"attributeSetIdentifier": "block",
|
|
5147
5147
|
"version": 0,
|
|
5148
5148
|
"position": 2,
|
|
5149
|
-
"identifier": "
|
|
5149
|
+
"identifier": "test_identifier",
|
|
5150
5150
|
"type": "forTextBlock",
|
|
5151
5151
|
"templateIdentifier": null,
|
|
5152
5152
|
"isVisible": true,
|
|
@@ -5253,7 +5253,7 @@ Example return:
|
|
|
5253
5253
|
"attributes": [
|
|
5254
5254
|
{
|
|
5255
5255
|
"type": "list",
|
|
5256
|
-
"marker": "
|
|
5256
|
+
"marker": "list_marker",
|
|
5257
5257
|
"position": 2,
|
|
5258
5258
|
"listTitles": [
|
|
5259
5259
|
{
|
|
@@ -6,11 +6,53 @@ export default abstract class AsyncModules extends SyncModules {
|
|
|
6
6
|
protected _https: any;
|
|
7
7
|
protected _url: string;
|
|
8
8
|
protected constructor(state: StateModule);
|
|
9
|
+
/**
|
|
10
|
+
* fetchGet
|
|
11
|
+
*
|
|
12
|
+
* @param path
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
9
15
|
protected _fetchGet(path: string): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* fetchPost
|
|
18
|
+
*
|
|
19
|
+
* @param path
|
|
20
|
+
* @param data
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
10
23
|
protected _fetchPost(path: string, data?: any): Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* fetchPut
|
|
26
|
+
* @param path
|
|
27
|
+
* @param data
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
11
30
|
protected _fetchPut(path: string, data: any): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* _fetchDelete
|
|
33
|
+
* @param path
|
|
34
|
+
* @param data
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
12
37
|
protected _fetchDelete(path: string, data?: any): Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* refreshToken
|
|
40
|
+
*
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
13
43
|
protected refreshToken(): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* makeOptions
|
|
46
|
+
* @param method
|
|
47
|
+
* @param data
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
14
50
|
private makeOptions;
|
|
51
|
+
/**
|
|
52
|
+
* browserResponse
|
|
53
|
+
* @param path
|
|
54
|
+
* @param options
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
15
57
|
private browserResponse;
|
|
16
58
|
}
|
|
@@ -14,6 +14,12 @@ class AsyncModules extends syncModules_1.default {
|
|
|
14
14
|
this._NO_FETCH = state._NO_FETCH;
|
|
15
15
|
this._https = (_a = state._https) !== null && _a !== void 0 ? _a : null;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* fetchGet
|
|
19
|
+
*
|
|
20
|
+
* @param path
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
17
23
|
async _fetchGet(path) {
|
|
18
24
|
const options = this.makeOptions('GET');
|
|
19
25
|
if (!this._NO_FETCH) {
|
|
@@ -36,6 +42,13 @@ class AsyncModules extends syncModules_1.default {
|
|
|
36
42
|
});
|
|
37
43
|
}
|
|
38
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* fetchPost
|
|
47
|
+
*
|
|
48
|
+
* @param path
|
|
49
|
+
* @param data
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
39
52
|
async _fetchPost(path, data) {
|
|
40
53
|
const options = this.makeOptions('POST', data);
|
|
41
54
|
if (!this._NO_FETCH) {
|
|
@@ -66,6 +79,12 @@ class AsyncModules extends syncModules_1.default {
|
|
|
66
79
|
});
|
|
67
80
|
}
|
|
68
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* fetchPut
|
|
84
|
+
* @param path
|
|
85
|
+
* @param data
|
|
86
|
+
* @returns
|
|
87
|
+
*/
|
|
69
88
|
async _fetchPut(path, data) {
|
|
70
89
|
const options = this.makeOptions('PUT', data);
|
|
71
90
|
if (!this._NO_FETCH) {
|
|
@@ -90,6 +109,12 @@ class AsyncModules extends syncModules_1.default {
|
|
|
90
109
|
});
|
|
91
110
|
}
|
|
92
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* _fetchDelete
|
|
114
|
+
* @param path
|
|
115
|
+
* @param data
|
|
116
|
+
* @returns
|
|
117
|
+
*/
|
|
93
118
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
94
119
|
async _fetchDelete(path, data) {
|
|
95
120
|
const options = this.makeOptions('DELETE');
|
|
@@ -113,6 +138,11 @@ class AsyncModules extends syncModules_1.default {
|
|
|
113
138
|
});
|
|
114
139
|
}
|
|
115
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* refreshToken
|
|
143
|
+
*
|
|
144
|
+
* @returns
|
|
145
|
+
*/
|
|
116
146
|
async refreshToken() {
|
|
117
147
|
const response = await fetch(this.state.url +
|
|
118
148
|
`/api/content/users-auth-providers/marker/email/users/refresh`, {
|
|
@@ -136,6 +166,12 @@ class AsyncModules extends syncModules_1.default {
|
|
|
136
166
|
return false;
|
|
137
167
|
}
|
|
138
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* makeOptions
|
|
171
|
+
* @param method
|
|
172
|
+
* @param data
|
|
173
|
+
* @returns
|
|
174
|
+
*/
|
|
139
175
|
makeOptions(method, data) {
|
|
140
176
|
const options = {
|
|
141
177
|
method: method,
|
|
@@ -155,6 +191,12 @@ class AsyncModules extends syncModules_1.default {
|
|
|
155
191
|
}
|
|
156
192
|
return options;
|
|
157
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* browserResponse
|
|
196
|
+
* @param path
|
|
197
|
+
* @param options
|
|
198
|
+
* @returns
|
|
199
|
+
*/
|
|
158
200
|
async browserResponse(path, options) {
|
|
159
201
|
try {
|
|
160
202
|
const response = await fetch(this._getFullPath(path), options);
|
|
@@ -5,13 +5,86 @@ export default abstract class SyncModules {
|
|
|
5
5
|
protected state: StateModule;
|
|
6
6
|
protected _url: string;
|
|
7
7
|
protected constructor(state: StateModule);
|
|
8
|
+
/**
|
|
9
|
+
* getFullPath
|
|
10
|
+
*
|
|
11
|
+
* @param path
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
8
14
|
protected _getFullPath(path: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* queryParamsToString
|
|
17
|
+
*
|
|
18
|
+
* @param query
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
9
21
|
protected _queryParamsToString(query: IProductsQuery | IUploadingQuery | any): string;
|
|
22
|
+
/**
|
|
23
|
+
* normalizeData
|
|
24
|
+
*
|
|
25
|
+
* @param data
|
|
26
|
+
* @param langCode
|
|
27
|
+
* @returns normalized data
|
|
28
|
+
*/
|
|
10
29
|
protected _normalizeData(data: any, langCode?: string): any;
|
|
30
|
+
/**
|
|
31
|
+
* normalizePostBody
|
|
32
|
+
*
|
|
33
|
+
* @param body
|
|
34
|
+
* @param langCode
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
11
37
|
protected _normalizePostBody(body: any, langCode?: string): any;
|
|
38
|
+
/**
|
|
39
|
+
* clearArray
|
|
40
|
+
*
|
|
41
|
+
* @param data
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
12
44
|
protected _clearArray(data: Record<string, any>): any;
|
|
45
|
+
/**
|
|
46
|
+
* sortAttributes
|
|
47
|
+
*
|
|
48
|
+
* @param data
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
protected _sortAttributes: (data: any) => {
|
|
52
|
+
[k: string]: unknown;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* addTimeIntervalsToSchedules
|
|
56
|
+
*
|
|
57
|
+
* @param schedules
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
protected _addTimeIntervalsToSchedules(schedules: any[]): any[];
|
|
61
|
+
/**
|
|
62
|
+
* normalizeAttr
|
|
63
|
+
*
|
|
64
|
+
* @param data
|
|
65
|
+
* @returns normalized Attrs
|
|
66
|
+
*/
|
|
13
67
|
protected _normalizeAttr(data: any): any;
|
|
68
|
+
/**
|
|
69
|
+
* dataPostProcess
|
|
70
|
+
*
|
|
71
|
+
* @param data
|
|
72
|
+
* @param langCode
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
14
75
|
protected _dataPostProcess(data: any, langCode?: string): any;
|
|
76
|
+
/**
|
|
77
|
+
* setAccessToken
|
|
78
|
+
*
|
|
79
|
+
* @param accessToken
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
15
82
|
setAccessToken(accessToken: string): this;
|
|
83
|
+
/**
|
|
84
|
+
* setRefreshToken
|
|
85
|
+
*
|
|
86
|
+
* @param refreshToken
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
16
89
|
setRefreshToken(refreshToken: string): this;
|
|
17
90
|
}
|
package/dist/base/syncModules.js
CHANGED
|
@@ -2,12 +2,31 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class SyncModules {
|
|
4
4
|
constructor(state) {
|
|
5
|
+
/**
|
|
6
|
+
* sortAttributes
|
|
7
|
+
*
|
|
8
|
+
* @param data
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
this._sortAttributes = (data) => Object.fromEntries(Object.entries(data).sort(([, a], [, b]) => a.position - b.position));
|
|
5
12
|
this.state = state;
|
|
6
13
|
this._url = state.url;
|
|
7
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* getFullPath
|
|
17
|
+
*
|
|
18
|
+
* @param path
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
8
21
|
_getFullPath(path) {
|
|
9
22
|
return this._url + path;
|
|
10
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* queryParamsToString
|
|
26
|
+
*
|
|
27
|
+
* @param query
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
11
30
|
_queryParamsToString(query) {
|
|
12
31
|
let result = '';
|
|
13
32
|
for (const key in query) {
|
|
@@ -17,6 +36,13 @@ class SyncModules {
|
|
|
17
36
|
}
|
|
18
37
|
return result.slice(0, result.length - 1);
|
|
19
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* normalizeData
|
|
41
|
+
*
|
|
42
|
+
* @param data
|
|
43
|
+
* @param langCode
|
|
44
|
+
* @returns normalized data
|
|
45
|
+
*/
|
|
20
46
|
_normalizeData(data, langCode = this.state.lang) {
|
|
21
47
|
if (Array.isArray(data)) {
|
|
22
48
|
return this._normalizeAttr(data.map((item) => this._normalizeData(item, langCode)));
|
|
@@ -43,6 +69,13 @@ class SyncModules {
|
|
|
43
69
|
return data;
|
|
44
70
|
}
|
|
45
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* normalizePostBody
|
|
74
|
+
*
|
|
75
|
+
* @param body
|
|
76
|
+
* @param langCode
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
46
79
|
_normalizePostBody(body, langCode = this.state.lang) {
|
|
47
80
|
const formData = {};
|
|
48
81
|
formData[langCode] = Array.isArray(body.formData)
|
|
@@ -51,6 +84,12 @@ class SyncModules {
|
|
|
51
84
|
body.formData = formData;
|
|
52
85
|
return body;
|
|
53
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* clearArray
|
|
89
|
+
*
|
|
90
|
+
* @param data
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
54
93
|
_clearArray(data) {
|
|
55
94
|
if (Array.isArray(data)) {
|
|
56
95
|
return data.map((item) => this._clearArray(item));
|
|
@@ -84,26 +123,124 @@ class SyncModules {
|
|
|
84
123
|
return data;
|
|
85
124
|
}
|
|
86
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* addTimeIntervalsToSchedules
|
|
128
|
+
*
|
|
129
|
+
* @param schedules
|
|
130
|
+
* @returns
|
|
131
|
+
*/
|
|
132
|
+
_addTimeIntervalsToSchedules(schedules) {
|
|
133
|
+
// Function to add days
|
|
134
|
+
function addDays(date, days) {
|
|
135
|
+
const result = new Date(date);
|
|
136
|
+
result.setUTCDate(result.getUTCDate() + days);
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
// Function to add months
|
|
140
|
+
function addMonths(date, months) {
|
|
141
|
+
const result = new Date(date);
|
|
142
|
+
result.setUTCMonth(result.getUTCMonth() + months);
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
schedules.forEach((scheduleGroup) => {
|
|
146
|
+
scheduleGroup.values.forEach((schedule) => {
|
|
147
|
+
const utcIntervals = [];
|
|
148
|
+
const baseDate = new Date(schedule.dates[0]); // We use the first date as the base date
|
|
149
|
+
// Generate intervals based on weekly repetition
|
|
150
|
+
if (schedule.inEveryWeek) {
|
|
151
|
+
for (let week = 0; week < 4; week++) {
|
|
152
|
+
schedule.times.forEach((timeRange) => {
|
|
153
|
+
const [startTime, endTime] = timeRange;
|
|
154
|
+
const startDate = addDays(baseDate, week * 7);
|
|
155
|
+
startDate.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
|
|
156
|
+
const endDate = addDays(baseDate, week * 7);
|
|
157
|
+
endDate.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
|
|
158
|
+
utcIntervals.push([
|
|
159
|
+
startDate.toISOString(),
|
|
160
|
+
endDate.toISOString(),
|
|
161
|
+
]);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Generate intervals based on monthly repetition
|
|
166
|
+
if (schedule.inEveryMonth) {
|
|
167
|
+
for (let month = 0; month < 12; month++) {
|
|
168
|
+
// Предполагаем 12 месяцев в году
|
|
169
|
+
schedule.times.forEach((timeRange) => {
|
|
170
|
+
const [startTime, endTime] = timeRange;
|
|
171
|
+
const startDate = addMonths(baseDate, month);
|
|
172
|
+
startDate.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
|
|
173
|
+
const endDate = addMonths(baseDate, month);
|
|
174
|
+
endDate.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
|
|
175
|
+
utcIntervals.push([
|
|
176
|
+
startDate.toISOString(),
|
|
177
|
+
endDate.toISOString(),
|
|
178
|
+
]);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// Add the calculated intervals to the new timeIntervals field
|
|
183
|
+
schedule.timeIntervals = utcIntervals;
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
return schedules;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* normalizeAttr
|
|
190
|
+
*
|
|
191
|
+
* @param data
|
|
192
|
+
* @returns normalized Attrs
|
|
193
|
+
*/
|
|
87
194
|
_normalizeAttr(data) {
|
|
88
195
|
if ('attributeValues' in data) {
|
|
89
196
|
for (const attr in data.attributeValues) {
|
|
197
|
+
// normalize numbers
|
|
90
198
|
if (data.attributeValues[attr].type === 'integer' ||
|
|
91
199
|
data.attributeValues[attr].type === 'float') {
|
|
92
200
|
data.attributeValues[attr].value = Number(data.attributeValues[attr].value);
|
|
93
201
|
}
|
|
202
|
+
// add timeIntervals
|
|
203
|
+
if (data.attributeValues[attr].type === 'timeInterval') {
|
|
204
|
+
const schedules = data.attributeValues[attr].value;
|
|
205
|
+
const result = this._addTimeIntervalsToSchedules(schedules);
|
|
206
|
+
data.attributeValues[attr].value = result;
|
|
207
|
+
}
|
|
94
208
|
}
|
|
209
|
+
return {
|
|
210
|
+
...data,
|
|
211
|
+
attributeValues: this._sortAttributes(data.attributeValues),
|
|
212
|
+
};
|
|
95
213
|
}
|
|
96
214
|
return data;
|
|
97
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* dataPostProcess
|
|
218
|
+
*
|
|
219
|
+
* @param data
|
|
220
|
+
* @param langCode
|
|
221
|
+
* @returns
|
|
222
|
+
*/
|
|
98
223
|
_dataPostProcess(data, langCode = this.state.lang) {
|
|
99
224
|
const normalize = this._normalizeData(data, langCode);
|
|
100
225
|
const result = this._clearArray(normalize);
|
|
101
226
|
return result;
|
|
102
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* setAccessToken
|
|
230
|
+
*
|
|
231
|
+
* @param accessToken
|
|
232
|
+
* @returns
|
|
233
|
+
*/
|
|
103
234
|
setAccessToken(accessToken) {
|
|
104
235
|
this.state.accessToken = accessToken;
|
|
105
236
|
return this;
|
|
106
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* setRefreshToken
|
|
240
|
+
*
|
|
241
|
+
* @param refreshToken
|
|
242
|
+
* @returns
|
|
243
|
+
*/
|
|
107
244
|
setRefreshToken(refreshToken) {
|
|
108
245
|
this.state.refreshToken = refreshToken;
|
|
109
246
|
return this;
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -56,8 +56,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
56
56
|
* @returns Returns PageEntity object
|
|
57
57
|
*/
|
|
58
58
|
async getPageByUrl(url, langCode = this.state.lang) {
|
|
59
|
-
const
|
|
60
|
-
return this._normalizeData(
|
|
59
|
+
const data = await this._fetchGet(`/url/${url}?langCode=${langCode}`);
|
|
60
|
+
return this._normalizeData(data, langCode);
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Get child pages object with information as an array.
|
|
@@ -68,8 +68,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
68
68
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
|
|
69
69
|
*/
|
|
70
70
|
async getChildPagesByParentUrl(url, langCode = this.state.lang) {
|
|
71
|
-
const
|
|
72
|
-
return this._normalizeData(
|
|
71
|
+
const data = await this._fetchGet(`/${url}/children?langCode=${langCode}`);
|
|
72
|
+
return this._normalizeData(data, langCode);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Get all blocks by page url.
|
package/dist/users/usersApi.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export default class UsersApi extends AsyncModules implements IUsers {
|
|
|
19
19
|
getUser(langCode?: string): Promise<IUserEntity | IError>;
|
|
20
20
|
/**
|
|
21
21
|
* Updating a single user object.
|
|
22
|
+
*
|
|
22
23
|
* @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.
|
|
23
24
|
*
|
|
24
25
|
* @param {object} [body] - Request body.
|
|
@@ -49,13 +50,11 @@ export default class UsersApi extends AsyncModules implements IUsers {
|
|
|
49
50
|
updateUser(body: IUserBody, langCode?: string): Promise<boolean | IError>;
|
|
50
51
|
/**
|
|
51
52
|
* Delete a single user object.
|
|
52
|
-
* @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
53
|
*
|
|
54
|
-
* @
|
|
55
|
-
* @param {string} [langCode] - Optional language field
|
|
54
|
+
* @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.
|
|
56
55
|
*
|
|
57
56
|
*/
|
|
58
|
-
deleteUser(
|
|
57
|
+
deleteUser(): Promise<boolean | IError>;
|
|
59
58
|
/**
|
|
60
59
|
* Adds FCM token for sending Push notification.
|
|
61
60
|
*
|
package/dist/users/usersApi.js
CHANGED
|
@@ -25,6 +25,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Updating a single user object.
|
|
28
|
+
*
|
|
28
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.
|
|
29
30
|
*
|
|
30
31
|
* @param {object} [body] - Request body.
|
|
@@ -64,20 +65,12 @@ class UsersApi extends asyncModules_1.default {
|
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
66
67
|
* Delete a single user object.
|
|
67
|
-
* @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.
|
|
68
68
|
*
|
|
69
|
-
* @
|
|
70
|
-
* @param {string} [langCode] - Optional language field
|
|
69
|
+
* @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.
|
|
71
70
|
*
|
|
72
71
|
*/
|
|
73
|
-
async deleteUser(
|
|
74
|
-
|
|
75
|
-
body['langCode'] = langCode;
|
|
76
|
-
const result = await this._fetchDelete('/me',
|
|
77
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
78
|
-
body.hasOwnProperty('formData')
|
|
79
|
-
? this._normalizePostBody(body, langCode)
|
|
80
|
-
: body);
|
|
72
|
+
async deleteUser() {
|
|
73
|
+
const result = await this._fetchDelete('/me');
|
|
81
74
|
return result;
|
|
82
75
|
}
|
|
83
76
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneentry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.111",
|
|
4
4
|
"description": "OneEntry NPM package",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,25 +10,25 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"productionBuild": "run-s lint testAll build readme",
|
|
12
12
|
"testAll": "run-s admins attributesets authProvider blocks fileuploading forms formsdata generaltypes integrationcollections locales menus orders pages payments payments productstatuses products templates templatespreview users",
|
|
13
|
-
"admins": "npx jest src/admins/admins.spec.ts",
|
|
14
|
-
"attributesets": "npx jest src/attribute-sets/attributesets.spec.ts",
|
|
15
|
-
"authProvider": "npx jest src/auth-provider/authProvider.spec.ts",
|
|
16
|
-
"blocks": "npx jest src/blocks/blocks.spec.ts",
|
|
17
|
-
"fileuploading": "npx jest src/file-uploading/fileuploading.spec.ts",
|
|
18
|
-
"forms": "npx jest src/forms/forms.spec.ts",
|
|
19
|
-
"formsdata": "npx jest src/formsData/formsdata.spec.ts",
|
|
20
|
-
"generaltypes": "npx jest src/general-types/generaltypes.spec.ts",
|
|
21
|
-
"integrationcollections": "npx jest src/integration-collections/integrationcollections.spec.ts",
|
|
22
|
-
"locales": "npx jest src/locales/locales.spec.ts",
|
|
23
|
-
"menus": "npx jest src/menus/menus.spec.ts",
|
|
24
|
-
"orders": "npx jest src/orders/orders.spec.ts",
|
|
25
|
-
"pages": "npx jest src/pages/pages.spec.ts",
|
|
26
|
-
"payments": "npx jest src/payments/payments.spec.ts",
|
|
27
|
-
"productstatuses": "npx jest src/product-statuses/productstatuses.spec.ts",
|
|
28
|
-
"products": "npx jest src/products/products.spec.ts",
|
|
29
|
-
"templates": "npx jest src/templates/templates.spec.ts",
|
|
30
|
-
"templatespreview": "npx jest src/templates-preview/templatespreview.spec.ts",
|
|
31
|
-
"users": "npx jest src/users/users.spec.ts",
|
|
13
|
+
"admins": "npx jest src/admins/tests/admins.spec.ts",
|
|
14
|
+
"attributesets": "npx jest src/attribute-sets/tests/attributesets.spec.ts",
|
|
15
|
+
"authProvider": "npx jest src/auth-provider/tests/authProvider.spec.ts",
|
|
16
|
+
"blocks": "npx jest src/blocks/tests/blocks.spec.ts",
|
|
17
|
+
"fileuploading": "npx jest src/file-uploading/tests/fileuploading.spec.ts",
|
|
18
|
+
"forms": "npx jest src/forms/tests/forms.spec.ts",
|
|
19
|
+
"formsdata": "npx jest src/formsData/tests/formsdata.spec.ts",
|
|
20
|
+
"generaltypes": "npx jest src/general-types/tests/generaltypes.spec.ts",
|
|
21
|
+
"integrationcollections": "npx jest src/integration-collections/tests/integrationcollections.spec.ts",
|
|
22
|
+
"locales": "npx jest src/locales/tests/locales.spec.ts",
|
|
23
|
+
"menus": "npx jest src/menus/tests/menus.spec.ts",
|
|
24
|
+
"orders": "npx jest src/orders/tests/orders.spec.ts",
|
|
25
|
+
"pages": "npx jest src/pages/tests/pages.spec.ts",
|
|
26
|
+
"payments": "npx jest src/payments/tests/payments.spec.ts",
|
|
27
|
+
"productstatuses": "npx jest src/product-statuses/tests/productstatuses.spec.ts",
|
|
28
|
+
"products": "npx jest src/products/tests/products.spec.ts",
|
|
29
|
+
"templates": "npx jest src/templates/tests/templates.spec.ts",
|
|
30
|
+
"templatespreview": "npx jest src/templates-preview/tests/templatespreview.spec.ts",
|
|
31
|
+
"users": "npx jest src/users/tests/users.spec.ts",
|
|
32
32
|
"lint": "npx eslint",
|
|
33
33
|
"build": "npx tsc",
|
|
34
34
|
"readme": "node ./src/readme.js"
|