oneentry 1.0.76 → 1.0.78
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 +40 -2
- package/dist/auth-provider/authProviderApi.d.ts +2 -1
- package/dist/auth-provider/authProviderApi.js +3 -2
- package/dist/auth-provider/authProvidersInterfaces.d.ts +1 -1
- package/dist/base/asyncModules.d.ts +1 -1
- package/dist/base/asyncModules.js +12 -2
- package/dist/events/eventsApi.d.ts +4 -0
- package/dist/events/eventsApi.js +4 -0
- package/dist/forms/formsInterfaces.d.ts +2 -0
- package/dist/orders/ordersInterfaces.d.ts +0 -1
- package/dist/pages/pagesApi.js +3 -3
- package/dist/payments/paymentsInterfaces.d.ts +0 -1
- package/dist/users/usersApi.d.ts +14 -0
- package/dist/users/usersApi.js +20 -0
- package/dist/users/usersInterfaces.d.ts +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -674,10 +674,10 @@ Example return:
|
|
|
674
674
|
true
|
|
675
675
|
```
|
|
676
676
|
|
|
677
|
-
### AuthProvider.changePassword(marker, userIdentifier, code, newPassword, repeatPassword)
|
|
677
|
+
### AuthProvider.changePassword(marker, userIdentifier, type, code, newPassword, repeatPassword)
|
|
678
678
|
|
|
679
679
|
```js
|
|
680
|
-
const value = await AuthProvider.changePassword('email', 'example@oneentry.cloud', 'EW32RF', 654321, 654321)
|
|
680
|
+
const value = await AuthProvider.changePassword('email', 'example@oneentry.cloud', 1, 'EW32RF', 654321, 654321)
|
|
681
681
|
```
|
|
682
682
|
|
|
683
683
|
> This method changes the password of an authorized user. If successful, it will return true.
|
|
@@ -1281,6 +1281,7 @@ Example return:
|
|
|
1281
1281
|
},
|
|
1282
1282
|
"processingData": "Unknown Type: ProcessingData",
|
|
1283
1283
|
"version": 10,
|
|
1284
|
+
"type": "data",
|
|
1284
1285
|
"identifier": "catalog",
|
|
1285
1286
|
"position": 192,
|
|
1286
1287
|
"attributes": [
|
|
@@ -1349,6 +1350,10 @@ default: marker <br>
|
|
|
1349
1350
|
*position number (for sorting)* <br>
|
|
1350
1351
|
example: 192 <br>
|
|
1351
1352
|
|
|
1353
|
+
**position:** string <br>
|
|
1354
|
+
*Form type* <br>
|
|
1355
|
+
example: 'data' <br>
|
|
1356
|
+
|
|
1352
1357
|
**attributes:** <br>
|
|
1353
1358
|
*array of attribute values from the used attribute set for displaying the form (taking into account the specified language)* <br>
|
|
1354
1359
|
example: List [ OrderedMap { "type": "list", "marker": "l1", "position": 2, "listTitles": List [ OrderedMap { "title": "red", "value": 1, "position": 1, "extendedValue": null, "extendedValueType": null }, OrderedMap { "title": "yellow", "value": 2, "position": 2, "extendedValue": null, "extendedValueType": null } ], "validators": OrderedMap {}, "localizeInfos": OrderedMap { "title": "l1" } } ] <br>
|
|
@@ -1382,6 +1387,7 @@ Example return:
|
|
|
1382
1387
|
},
|
|
1383
1388
|
"processingData": "Unknown Type: ProcessingData",
|
|
1384
1389
|
"version": 10,
|
|
1390
|
+
"type": "data",
|
|
1385
1391
|
"identifier": "catalog",
|
|
1386
1392
|
"position": 192,
|
|
1387
1393
|
"attributes": [
|
|
@@ -1449,6 +1455,10 @@ default: marker <br>
|
|
|
1449
1455
|
*position number (for sorting)* <br>
|
|
1450
1456
|
example: 192 <br>
|
|
1451
1457
|
|
|
1458
|
+
**position:** string <br>
|
|
1459
|
+
*Form type* <br>
|
|
1460
|
+
example: 'data' <br>
|
|
1461
|
+
|
|
1452
1462
|
**attributes:** <br>
|
|
1453
1463
|
*array of attribute values from the used attribute set for displaying the form (taking into account the specified language)* <br>
|
|
1454
1464
|
example: List [ OrderedMap { "type": "list", "marker": "l1", "position": 2, "listTitles": List [ OrderedMap { "title": "red", "value": 1, "position": 1, "extendedValue": null, "extendedValueType": null }, OrderedMap { "title": "yellow", "value": 2, "position": 2, "extendedValue": null, "extendedValueType": null } ], "validators": OrderedMap {}, "localizeInfos": OrderedMap { "title": "l1" } } ] <br>
|
|
@@ -5429,3 +5439,31 @@ example: List [ OrderedMap { "marker": "password", "value": "12345" } ] <br>
|
|
|
5429
5439
|
example: OrderedMap { "email": "example@oneentry.cloud", "phonePush": "", "phoneSMS": "+9999999999" } <br>
|
|
5430
5440
|
|
|
5431
5441
|
</details>
|
|
5442
|
+
|
|
5443
|
+
### Users.addFCMToken(token)
|
|
5444
|
+
|
|
5445
|
+
```js
|
|
5446
|
+
const value = await Users.addFCMToken('my-token')
|
|
5447
|
+
```
|
|
5448
|
+
|
|
5449
|
+
> This method adds FCM token for sending Push notifications. Return true in case of successful token update.
|
|
5450
|
+
|
|
5451
|
+
Example return:
|
|
5452
|
+
|
|
5453
|
+
```json
|
|
5454
|
+
true
|
|
5455
|
+
```
|
|
5456
|
+
|
|
5457
|
+
### Users.deleteFCMToken(token)
|
|
5458
|
+
|
|
5459
|
+
```js
|
|
5460
|
+
const value = await Users.deleteFCMToken('my-token')
|
|
5461
|
+
```
|
|
5462
|
+
|
|
5463
|
+
> This method delete FCM token for sending Push notifications. Return true in case of successful token deletion.
|
|
5464
|
+
|
|
5465
|
+
Example return:
|
|
5466
|
+
|
|
5467
|
+
```json
|
|
5468
|
+
true
|
|
5469
|
+
```
|
|
@@ -105,10 +105,11 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
|
|
|
105
105
|
* @param {string} marker - The text identifier of the authorization provider. Example - email
|
|
106
106
|
* @param {string} userIdentifier - The text identifier of the user's object (user login)
|
|
107
107
|
* @param {string} code - Service code
|
|
108
|
+
* @param {string} type - Operation type (1 - for changing password, 2 - for recovery)
|
|
108
109
|
* @param {string} newPassword - New password
|
|
109
110
|
* @param {string} [repeatPassword] - Optional variable contains repeat new password for validation
|
|
110
111
|
*/
|
|
111
|
-
changePassword(marker: string, userIdentifier: string, code: string, newPassword: string, repeatPassword?: string): Promise<boolean>;
|
|
112
|
+
changePassword(marker: string, userIdentifier: string, type: number, code: string, newPassword: string, repeatPassword?: string): Promise<boolean>;
|
|
112
113
|
/**
|
|
113
114
|
* Get all auth providers objects
|
|
114
115
|
* @param {string} [langCode] - Language code. Default "en_US"
|
|
@@ -60,7 +60,6 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
60
60
|
"eventIdentifier": eventIdentifier
|
|
61
61
|
};
|
|
62
62
|
const result = await this._fetchPost(`/marker/${marker}/users/generate-code`, data);
|
|
63
|
-
return result;
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
65
|
* User activation code verification. Returns true (if the code is correct) or false (if it is incorrect).
|
|
@@ -162,13 +161,15 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
162
161
|
* @param {string} marker - The text identifier of the authorization provider. Example - email
|
|
163
162
|
* @param {string} userIdentifier - The text identifier of the user's object (user login)
|
|
164
163
|
* @param {string} code - Service code
|
|
164
|
+
* @param {string} type - Operation type (1 - for changing password, 2 - for recovery)
|
|
165
165
|
* @param {string} newPassword - New password
|
|
166
166
|
* @param {string} [repeatPassword] - Optional variable contains repeat new password for validation
|
|
167
167
|
*/
|
|
168
|
-
async changePassword(marker, userIdentifier, code, newPassword, repeatPassword) {
|
|
168
|
+
async changePassword(marker, userIdentifier, type, code, newPassword, repeatPassword) {
|
|
169
169
|
const data = {
|
|
170
170
|
"userIdentifier": userIdentifier,
|
|
171
171
|
"code": code,
|
|
172
|
+
"type": type,
|
|
172
173
|
"password1": newPassword,
|
|
173
174
|
"password2": repeatPassword !== null && repeatPassword !== void 0 ? repeatPassword : newPassword
|
|
174
175
|
};
|
|
@@ -21,7 +21,7 @@ interface IAuthProvider {
|
|
|
21
21
|
auth(marker: string, data: IAuthPostBody): Promise<IAuthEntity>;
|
|
22
22
|
refresh(marker: string, token: string): Promise<IAuthEntity>;
|
|
23
23
|
logout(marker: string, token: string): Promise<boolean>;
|
|
24
|
-
changePassword(marker: string, userIdentifier: string, code: string, newPassword: string, repeatPassword?: string): Promise<boolean>;
|
|
24
|
+
changePassword(marker: string, userIdentifier: string, type: number, code: string, newPassword: string, repeatPassword?: string): Promise<boolean>;
|
|
25
25
|
getAuthProviders(langCode?: string, offset?: number, limit?: number): Promise<Array<IAuthProvidersEntity>>;
|
|
26
26
|
getMarker(marker: string, langCode?: string): Promise<IAuthProvidersEntity>;
|
|
27
27
|
}
|
|
@@ -7,7 +7,7 @@ export default abstract class AsyncModules extends SyncModules {
|
|
|
7
7
|
protected _url: string;
|
|
8
8
|
protected constructor(state: StateModule);
|
|
9
9
|
protected _fetchGet(path: string): Promise<any>;
|
|
10
|
-
protected _fetchPost(path: string, data
|
|
10
|
+
protected _fetchPost(path: string, data?: any): Promise<any>;
|
|
11
11
|
protected _fetchPut(path: string, data: any): Promise<any>;
|
|
12
12
|
protected _fetchDelete(path: string, data?: any): Promise<any>;
|
|
13
13
|
protected refreshToken(): Promise<boolean>;
|
|
@@ -45,7 +45,12 @@ class AsyncModules extends syncModules_1.default {
|
|
|
45
45
|
responseData += chunk;
|
|
46
46
|
});
|
|
47
47
|
res.on('end', () => {
|
|
48
|
-
|
|
48
|
+
try {
|
|
49
|
+
resolve(JSON.parse(responseData));
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
resolve(responseData);
|
|
53
|
+
}
|
|
49
54
|
});
|
|
50
55
|
});
|
|
51
56
|
req.on('error', (error) => {
|
|
@@ -157,7 +162,12 @@ class AsyncModules extends syncModules_1.default {
|
|
|
157
162
|
const error = await response.json();
|
|
158
163
|
throw error;
|
|
159
164
|
}
|
|
160
|
-
|
|
165
|
+
try {
|
|
166
|
+
return await response.json();
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
return response;
|
|
170
|
+
}
|
|
161
171
|
}
|
|
162
172
|
}
|
|
163
173
|
exports.default = AsyncModules;
|
|
@@ -10,6 +10,8 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
10
10
|
constructor(state: StateModule);
|
|
11
11
|
/**
|
|
12
12
|
* Subscribing to an event on a product.
|
|
13
|
+
*
|
|
14
|
+
* @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.
|
|
13
15
|
* @param marker - Event marker.
|
|
14
16
|
* @param userId - User id.
|
|
15
17
|
* @param productId - Product id.
|
|
@@ -17,6 +19,8 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
17
19
|
subscribeByMarker(marker: string, userId: number, productId: number): Promise<any>;
|
|
18
20
|
/**
|
|
19
21
|
* Unsubscribing to an event on a product.
|
|
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.
|
|
20
24
|
* @param marker - Event marker.
|
|
21
25
|
* @param userId - User id.
|
|
22
26
|
* @param productId - Product id.
|
package/dist/events/eventsApi.js
CHANGED
|
@@ -11,6 +11,8 @@ class EventsApi extends asyncModules_1.default {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Subscribing to an event on a product.
|
|
14
|
+
*
|
|
15
|
+
* @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.
|
|
14
16
|
* @param marker - Event marker.
|
|
15
17
|
* @param userId - User id.
|
|
16
18
|
* @param productId - Product id.
|
|
@@ -24,6 +26,8 @@ class EventsApi extends asyncModules_1.default {
|
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* Unsubscribing to an event on a product.
|
|
29
|
+
*
|
|
30
|
+
* @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.
|
|
27
31
|
* @param marker - Event marker.
|
|
28
32
|
* @param userId - User id.
|
|
29
33
|
* @param productId - Product id.
|
|
@@ -21,6 +21,7 @@ interface IForms {
|
|
|
21
21
|
* @property {object} processingData - Form data.
|
|
22
22
|
* @property {Array<IAttributes>} attribute - Array of attribute values from the used attribute set for displaying the form (taking into account the specified language)
|
|
23
23
|
* @property {number} version - The version number of the object.
|
|
24
|
+
* @property {string} type - Form type.
|
|
24
25
|
* @property {string} identifier - The textual identifier for the record field.
|
|
25
26
|
* @property {number} position - The position of the object.
|
|
26
27
|
*/
|
|
@@ -32,6 +33,7 @@ interface IFormsEntity {
|
|
|
32
33
|
localizeInfos: Record<string, any>;
|
|
33
34
|
templateId: number | null;
|
|
34
35
|
position: number;
|
|
36
|
+
type: string | null;
|
|
35
37
|
processingType: string;
|
|
36
38
|
version: number;
|
|
37
39
|
}
|
|
@@ -15,7 +15,6 @@ interface IOrdersApi {
|
|
|
15
15
|
updateOrderByMarkerAndId(marker: string, id: number, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
|
|
16
16
|
getAllOrders(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity>>;
|
|
17
17
|
getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersByMarkersEntity>>;
|
|
18
|
-
setAccessToken(accessToken: string): IOrdersApi;
|
|
19
18
|
}
|
|
20
19
|
/**
|
|
21
20
|
* @property {string} filename
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -113,7 +113,7 @@ class PageApi extends asyncModules_1.default {
|
|
|
113
113
|
if (normalizeResponse.type === 'forSimilarProductBlock') {
|
|
114
114
|
try {
|
|
115
115
|
await Blocks.getSimilarProducts(normalizeResponse.identifier, langCode).then((result) => {
|
|
116
|
-
normalizeResponse.similarProducts = result;
|
|
116
|
+
normalizeResponse.similarProducts = this._normalizeData(result);
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
catch {
|
|
@@ -123,7 +123,7 @@ class PageApi extends asyncModules_1.default {
|
|
|
123
123
|
else if (normalizeResponse.type === 'forProductBlock') {
|
|
124
124
|
try {
|
|
125
125
|
await Blocks.getProductsByBlockMarker(normalizeResponse.identifier, langCode).then((result) => {
|
|
126
|
-
normalizeResponse.products = result;
|
|
126
|
+
normalizeResponse.products = this._normalizeData(result);
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
catch {
|
|
@@ -131,7 +131,7 @@ class PageApi extends asyncModules_1.default {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
return normalizeResponse;
|
|
134
|
+
return this._normalizeData(normalizeResponse);
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
137
|
* Get settings for the page.
|
package/dist/users/usersApi.d.ts
CHANGED
|
@@ -45,4 +45,18 @@ export default class UsersApi extends AsyncModules implements IUsers {
|
|
|
45
45
|
* }
|
|
46
46
|
*/
|
|
47
47
|
updateUser(data: IUserBody, langCode?: string): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Adds FCM token for sending Push notification.
|
|
50
|
+
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} token - Cloud messaging token.
|
|
53
|
+
*/
|
|
54
|
+
addFCMToken(token: string): Promise<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Delete FCM token.
|
|
57
|
+
* @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.
|
|
58
|
+
*
|
|
59
|
+
* @param {string} token - Cloud messaging token.
|
|
60
|
+
*/
|
|
61
|
+
deleteFCMToken(token: string): Promise<boolean>;
|
|
48
62
|
}
|
package/dist/users/usersApi.js
CHANGED
|
@@ -54,5 +54,25 @@ class UsersApi extends asyncModules_1.default {
|
|
|
54
54
|
const result = await this._fetchPut('/me', this._normalizePostBody(data, langCode));
|
|
55
55
|
return result;
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Adds FCM token for sending Push notification.
|
|
59
|
+
* @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.
|
|
60
|
+
*
|
|
61
|
+
* @param {string} token - Cloud messaging token.
|
|
62
|
+
*/
|
|
63
|
+
async addFCMToken(token) {
|
|
64
|
+
const result = await this._fetchPost(`/me/fcm-token/${token}`);
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Delete FCM token.
|
|
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.
|
|
70
|
+
*
|
|
71
|
+
* @param {string} token - Cloud messaging token.
|
|
72
|
+
*/
|
|
73
|
+
async deleteFCMToken(token) {
|
|
74
|
+
const result = await this._fetchDelete(`/me/fcm-token/${token}`);
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
57
77
|
}
|
|
58
78
|
exports.default = UsersApi;
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { IAuthFormData } from "../auth-provider/authProvidersInterfaces";
|
|
2
|
+
import { FormDataType } from "../formsData/formsDataInterfaces";
|
|
2
3
|
/**
|
|
3
4
|
* Represents a interface object of Users Api.
|
|
4
5
|
*
|
|
5
6
|
* @property {function} subscribeByMarker - Getting the data of an authorized user.
|
|
6
7
|
* @property {function} unsubscribeByMarker - Updating a single user object.
|
|
8
|
+
* @property {function} addFCMToken - Adds FCM token for sending Push notification.
|
|
9
|
+
* @property {function} deleteFCMToken - Delete FCM token.
|
|
7
10
|
* @property {function} setAccessToken - Only for custom authorization. An intermediate method for setting up an access token.
|
|
8
11
|
*/
|
|
9
12
|
interface IUsers {
|
|
10
13
|
getUser(langCode?: string): Promise<IUserEntity>;
|
|
11
14
|
updateUser(data: IUserBody, langCode?: string): Promise<boolean>;
|
|
12
|
-
|
|
15
|
+
addFCMToken(token: string): Promise<boolean>;
|
|
16
|
+
deleteFCMToken(token: string): Promise<boolean>;
|
|
13
17
|
}
|
|
14
18
|
interface IUserEntity {
|
|
15
19
|
id: number;
|
|
16
20
|
identifier: string;
|
|
21
|
+
formData: Array<FormDataType>;
|
|
17
22
|
formIdentifier: string;
|
|
18
23
|
authProviderIdentifier: string;
|
|
19
24
|
groups: Array<string>;
|
|
@@ -28,7 +33,7 @@ interface IUserBody {
|
|
|
28
33
|
formData: IAuthFormData | Array<IAuthFormData>;
|
|
29
34
|
notificationData: {
|
|
30
35
|
email: string;
|
|
31
|
-
phonePush: string
|
|
36
|
+
phonePush: Array<string>;
|
|
32
37
|
phoneSMS: string;
|
|
33
38
|
};
|
|
34
39
|
}
|