oneentry 1.0.110 → 1.0.112
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 +20 -20
- package/dist/base/asyncModules.d.ts +42 -0
- package/dist/base/asyncModules.js +42 -0
- package/dist/base/syncModules.d.ts +93 -0
- package/dist/base/syncModules.js +160 -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 +26 -25
package/README.md
CHANGED
|
@@ -401,7 +401,7 @@ Example return:
|
|
|
401
401
|
"id": 1764,
|
|
402
402
|
"updatedDate": "2025-01-31T21:53:39.276Z",
|
|
403
403
|
"version": 10,
|
|
404
|
-
"identifier": "
|
|
404
|
+
"identifier": "my_id",
|
|
405
405
|
"title": "Set for pages",
|
|
406
406
|
"schema": {
|
|
407
407
|
"attribute1": {
|
|
@@ -409,7 +409,7 @@ Example return:
|
|
|
409
409
|
"type": "string",
|
|
410
410
|
"isPrice": false,
|
|
411
411
|
"original": true,
|
|
412
|
-
"identifier": "
|
|
412
|
+
"identifier": "string",
|
|
413
413
|
"localizeInfos": {
|
|
414
414
|
"en_US": {
|
|
415
415
|
"title": "String"
|
|
@@ -460,7 +460,7 @@ Example return:
|
|
|
460
460
|
>
|
|
461
461
|
>**schema:** Record<string, string> <br>
|
|
462
462
|
>*Schema JSON description (attributes used by the set) of the attribute set* <br>
|
|
463
|
-
>example: OrderedMap { "attribute1": OrderedMap { "id": 1, "type": "string", "isPrice": false, "original": true, "identifier": "
|
|
463
|
+
>example: OrderedMap { "attribute1": OrderedMap { "id": 1, "type": "string", "isPrice": false, "original": true, "identifier": "string", "localizeInfos": OrderedMap { "en_US": OrderedMap { "title": "String" } } } } <br>
|
|
464
464
|
>
|
|
465
465
|
>**title:** string <br>
|
|
466
466
|
>*Attribute set name* <br>
|
|
@@ -722,7 +722,7 @@ Example return:
|
|
|
722
722
|
"type": "string",
|
|
723
723
|
"isPrice": false,
|
|
724
724
|
"original": true,
|
|
725
|
-
"identifier": "
|
|
725
|
+
"identifier": "string",
|
|
726
726
|
"localizeInfos": {
|
|
727
727
|
"en_US": {
|
|
728
728
|
"title": "String"
|
|
@@ -764,7 +764,7 @@ Example return:
|
|
|
764
764
|
>
|
|
765
765
|
>**schema*:** Record<string, string> <br>
|
|
766
766
|
>*Schema JSON description (attributes used by the set) of the attribute set* <br>
|
|
767
|
-
>example: OrderedMap { "attribute1": OrderedMap { "id": 1, "type": "string", "isPrice": false, "original": true, "identifier": "
|
|
767
|
+
>example: OrderedMap { "attribute1": OrderedMap { "id": 1, "type": "string", "isPrice": false, "original": true, "identifier": "string", "localizeInfos": OrderedMap { "en_US": OrderedMap { "title": "String" } } } } <br>
|
|
768
768
|
>
|
|
769
769
|
>**isVisible*:** boolean <br>
|
|
770
770
|
>*Visibility flag of the set* <br>
|
|
@@ -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,106 @@ 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
|
+
* Function to add days to a date
|
|
56
|
+
*
|
|
57
|
+
* @param date
|
|
58
|
+
* @param days
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
protected _addDays(date: string | number | Date, days: number): Date;
|
|
62
|
+
/**
|
|
63
|
+
* Function to generate intervals for a specific date
|
|
64
|
+
*
|
|
65
|
+
* @param date
|
|
66
|
+
* @param schedule
|
|
67
|
+
* @param utcIntervals
|
|
68
|
+
*/
|
|
69
|
+
protected _generateIntervalsForDate(date: string | number | Date, schedule: {
|
|
70
|
+
inEveryWeek: any;
|
|
71
|
+
times: any[];
|
|
72
|
+
inEveryMonth: any;
|
|
73
|
+
}, utcIntervals: any[][]): void;
|
|
74
|
+
/**
|
|
75
|
+
* Add TimeIntervals to schedules
|
|
76
|
+
*
|
|
77
|
+
* @param schedules
|
|
78
|
+
* @returns schedules with timeIntervals
|
|
79
|
+
*/
|
|
80
|
+
protected _addTimeIntervalsToSchedules(schedules: any[]): any[];
|
|
81
|
+
/**
|
|
82
|
+
* normalizeAttr
|
|
83
|
+
*
|
|
84
|
+
* @param data
|
|
85
|
+
* @returns normalized Attrs
|
|
86
|
+
*/
|
|
13
87
|
protected _normalizeAttr(data: any): any;
|
|
88
|
+
/**
|
|
89
|
+
* dataPostProcess
|
|
90
|
+
*
|
|
91
|
+
* @param data
|
|
92
|
+
* @param langCode
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
14
95
|
protected _dataPostProcess(data: any, langCode?: string): any;
|
|
96
|
+
/**
|
|
97
|
+
* setAccessToken
|
|
98
|
+
*
|
|
99
|
+
* @param accessToken
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
15
102
|
setAccessToken(accessToken: string): this;
|
|
103
|
+
/**
|
|
104
|
+
* setRefreshToken
|
|
105
|
+
*
|
|
106
|
+
* @param refreshToken
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
16
109
|
setRefreshToken(refreshToken: string): this;
|
|
17
110
|
}
|
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,147 @@ class SyncModules {
|
|
|
84
123
|
return data;
|
|
85
124
|
}
|
|
86
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Function to add days to a date
|
|
128
|
+
*
|
|
129
|
+
* @param date
|
|
130
|
+
* @param days
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
133
|
+
_addDays(date, days) {
|
|
134
|
+
const result = new Date(date);
|
|
135
|
+
result.setUTCDate(result.getUTCDate() + days);
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Function to generate intervals for a specific date
|
|
140
|
+
*
|
|
141
|
+
* @param date
|
|
142
|
+
* @param schedule
|
|
143
|
+
* @param utcIntervals
|
|
144
|
+
*/
|
|
145
|
+
_generateIntervalsForDate(date, schedule, utcIntervals) {
|
|
146
|
+
// Generate intervals based on weekly repetition
|
|
147
|
+
if (schedule.inEveryWeek) {
|
|
148
|
+
for (let week = 0; week < 4; week++) {
|
|
149
|
+
schedule.times.forEach((timeRange) => {
|
|
150
|
+
const [startTime, endTime] = timeRange;
|
|
151
|
+
const intervalStart = this._addDays(date, week * 7);
|
|
152
|
+
intervalStart.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
|
|
153
|
+
const intervalEnd = this._addDays(date, week * 7);
|
|
154
|
+
intervalEnd.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
|
|
155
|
+
utcIntervals.push([
|
|
156
|
+
intervalStart.toISOString(),
|
|
157
|
+
intervalEnd.toISOString(),
|
|
158
|
+
]);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// Generate intervals based on monthly repetition
|
|
163
|
+
if (schedule.inEveryMonth) {
|
|
164
|
+
for (let month = 0; month < 12; month++) {
|
|
165
|
+
schedule.times.forEach((timeRange) => {
|
|
166
|
+
const [startTime, endTime] = timeRange;
|
|
167
|
+
const intervalStart = new Date(date);
|
|
168
|
+
intervalStart.setUTCMonth(intervalStart.getUTCMonth() + month);
|
|
169
|
+
intervalStart.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
|
|
170
|
+
const intervalEnd = new Date(date);
|
|
171
|
+
intervalEnd.setUTCMonth(intervalEnd.getUTCMonth() + month);
|
|
172
|
+
intervalEnd.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
|
|
173
|
+
utcIntervals.push([
|
|
174
|
+
intervalStart.toISOString(),
|
|
175
|
+
intervalEnd.toISOString(),
|
|
176
|
+
]);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Add TimeIntervals to schedules
|
|
183
|
+
*
|
|
184
|
+
* @param schedules
|
|
185
|
+
* @returns schedules with timeIntervals
|
|
186
|
+
*/
|
|
187
|
+
_addTimeIntervalsToSchedules(schedules) {
|
|
188
|
+
schedules.forEach((scheduleGroup) => {
|
|
189
|
+
scheduleGroup.values.forEach((schedule) => {
|
|
190
|
+
const utcIntervals = [];
|
|
191
|
+
const startDate = new Date(schedule.dates[0]);
|
|
192
|
+
const endDate = new Date(schedule.dates[1]);
|
|
193
|
+
// Check if the dates are the same
|
|
194
|
+
const isSameDay = startDate.toISOString() === endDate.toISOString();
|
|
195
|
+
// If the dates are the same, process only the first date
|
|
196
|
+
if (isSameDay) {
|
|
197
|
+
this._generateIntervalsForDate(startDate, schedule, utcIntervals);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
// Otherwise, process each day in the range
|
|
201
|
+
for (let currentDate = new Date(startDate); currentDate <= endDate; currentDate = this._addDays(currentDate, 1)) {
|
|
202
|
+
this._generateIntervalsForDate(currentDate, schedule, utcIntervals);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// Add calculated intervals to the new field timeIntervals
|
|
206
|
+
schedule.timeIntervals = utcIntervals;
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
return schedules;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* normalizeAttr
|
|
213
|
+
*
|
|
214
|
+
* @param data
|
|
215
|
+
* @returns normalized Attrs
|
|
216
|
+
*/
|
|
87
217
|
_normalizeAttr(data) {
|
|
88
218
|
if ('attributeValues' in data) {
|
|
89
219
|
for (const attr in data.attributeValues) {
|
|
220
|
+
// normalize numbers
|
|
90
221
|
if (data.attributeValues[attr].type === 'integer' ||
|
|
91
222
|
data.attributeValues[attr].type === 'float') {
|
|
92
223
|
data.attributeValues[attr].value = Number(data.attributeValues[attr].value);
|
|
93
224
|
}
|
|
225
|
+
// add timeIntervals
|
|
226
|
+
if (data.attributeValues[attr].type === 'timeInterval') {
|
|
227
|
+
const schedules = data.attributeValues[attr].value;
|
|
228
|
+
const result = this._addTimeIntervalsToSchedules(schedules);
|
|
229
|
+
data.attributeValues[attr].value = result;
|
|
230
|
+
}
|
|
94
231
|
}
|
|
232
|
+
return {
|
|
233
|
+
...data,
|
|
234
|
+
attributeValues: this._sortAttributes(data.attributeValues),
|
|
235
|
+
};
|
|
95
236
|
}
|
|
96
237
|
return data;
|
|
97
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* dataPostProcess
|
|
241
|
+
*
|
|
242
|
+
* @param data
|
|
243
|
+
* @param langCode
|
|
244
|
+
* @returns
|
|
245
|
+
*/
|
|
98
246
|
_dataPostProcess(data, langCode = this.state.lang) {
|
|
99
247
|
const normalize = this._normalizeData(data, langCode);
|
|
100
248
|
const result = this._clearArray(normalize);
|
|
101
249
|
return result;
|
|
102
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* setAccessToken
|
|
253
|
+
*
|
|
254
|
+
* @param accessToken
|
|
255
|
+
* @returns
|
|
256
|
+
*/
|
|
103
257
|
setAccessToken(accessToken) {
|
|
104
258
|
this.state.accessToken = accessToken;
|
|
105
259
|
return this;
|
|
106
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* setRefreshToken
|
|
263
|
+
*
|
|
264
|
+
* @param refreshToken
|
|
265
|
+
* @returns
|
|
266
|
+
*/
|
|
107
267
|
setRefreshToken(refreshToken) {
|
|
108
268
|
this.state.refreshToken = refreshToken;
|
|
109
269
|
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,34 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneentry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.112",
|
|
4
4
|
"description": "OneEntry NPM package",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"files": [
|
|
8
9
|
"/dist"
|
|
9
10
|
],
|
|
10
11
|
"scripts": {
|
|
11
12
|
"productionBuild": "run-s lint testAll build readme",
|
|
12
13
|
"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",
|
|
14
|
+
"admins": "npx jest src/admins/tests/admins.spec.ts",
|
|
15
|
+
"attributesets": "npx jest src/attribute-sets/tests/attributesets.spec.ts",
|
|
16
|
+
"authProvider": "npx jest src/auth-provider/tests/authProvider.spec.ts",
|
|
17
|
+
"blocks": "npx jest src/blocks/tests/blocks.spec.ts",
|
|
18
|
+
"fileuploading": "npx jest src/file-uploading/tests/fileuploading.spec.ts",
|
|
19
|
+
"forms": "npx jest src/forms/tests/forms.spec.ts",
|
|
20
|
+
"formsdata": "npx jest src/formsData/tests/formsdata.spec.ts",
|
|
21
|
+
"generaltypes": "npx jest src/general-types/tests/generaltypes.spec.ts",
|
|
22
|
+
"integrationcollections": "npx jest src/integration-collections/tests/integrationcollections.spec.ts",
|
|
23
|
+
"locales": "npx jest src/locales/tests/locales.spec.ts",
|
|
24
|
+
"menus": "npx jest src/menus/tests/menus.spec.ts",
|
|
25
|
+
"orders": "npx jest src/orders/tests/orders.spec.ts",
|
|
26
|
+
"pages": "npx jest src/pages/tests/pages.spec.ts",
|
|
27
|
+
"payments": "npx jest src/payments/tests/payments.spec.ts",
|
|
28
|
+
"productstatuses": "npx jest src/product-statuses/tests/productstatuses.spec.ts",
|
|
29
|
+
"products": "npx jest src/products/tests/products.spec.ts",
|
|
30
|
+
"templates": "npx jest src/templates/tests/templates.spec.ts",
|
|
31
|
+
"templatespreview": "npx jest src/templates-preview/tests/templatespreview.spec.ts",
|
|
32
|
+
"users": "npx jest src/users/tests/users.spec.ts",
|
|
32
33
|
"lint": "npx eslint",
|
|
33
34
|
"build": "npx tsc",
|
|
34
35
|
"readme": "node ./src/readme.js"
|
|
@@ -47,9 +48,9 @@
|
|
|
47
48
|
"@microsoft/tsdoc": "^0.15.1",
|
|
48
49
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
49
50
|
"@types/jest": "^29.5.14",
|
|
50
|
-
"@types/node": "^22.13.
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
52
|
-
"@typescript-eslint/parser": "^8.
|
|
51
|
+
"@types/node": "^22.13.4",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
53
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
53
54
|
"eslint": "^8.57.1",
|
|
54
55
|
"eslint-config-prettier": "^10.0.1",
|
|
55
56
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -58,8 +59,8 @@
|
|
|
58
59
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
59
60
|
"jest": "^29.7.0",
|
|
60
61
|
"npm-run-all": "^4.1.5",
|
|
61
|
-
"prettier": "^3.
|
|
62
|
+
"prettier": "^3.5.1",
|
|
62
63
|
"ts-jest": "^29.2.5",
|
|
63
64
|
"typescript": "^5.7.3"
|
|
64
65
|
}
|
|
65
|
-
}
|
|
66
|
+
}
|