oneentry 1.0.86 → 1.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -5447,6 +5447,48 @@ example: 12 <br>
|
|
|
5447
5447
|
|
|
5448
5448
|
## <h2 id="users"> Users </h2>
|
|
5449
5449
|
|
|
5450
|
+
You can store the data necessary for your application to work in a state object. When changing the user, add the necessary data to the state. When the user's data is subsequently received, it will contain a state object.
|
|
5451
|
+
|
|
5452
|
+
An example in which we add information to the user about how many orders he has made. Add a field "orderCount" with the value to the state object.
|
|
5453
|
+
|
|
5454
|
+
```js
|
|
5455
|
+
const data = {
|
|
5456
|
+
"formIdentifier": "reg",
|
|
5457
|
+
"authData": [
|
|
5458
|
+
{
|
|
5459
|
+
"marker": "password",
|
|
5460
|
+
"value": "12345"
|
|
5461
|
+
}
|
|
5462
|
+
],
|
|
5463
|
+
"formData": [
|
|
5464
|
+
{
|
|
5465
|
+
"marker": "last_name",
|
|
5466
|
+
"type": "string",
|
|
5467
|
+
"value": "Username"
|
|
5468
|
+
}
|
|
5469
|
+
],
|
|
5470
|
+
"notificationData": {
|
|
5471
|
+
"email": "example@oneentry.cloud",
|
|
5472
|
+
"phonePush": ["+99999999999"],
|
|
5473
|
+
"phoneSMS": "+99999999999"
|
|
5474
|
+
},
|
|
5475
|
+
"state": {
|
|
5476
|
+
"orderCount": 1
|
|
5477
|
+
}
|
|
5478
|
+
}
|
|
5479
|
+
|
|
5480
|
+
const value = await Users.updateUser(data)
|
|
5481
|
+
```
|
|
5482
|
+
|
|
5483
|
+
When the user's data is received, it will contain information about the number of orders
|
|
5484
|
+
|
|
5485
|
+
```js
|
|
5486
|
+
const value = await Users.getUser()
|
|
5487
|
+
|
|
5488
|
+
console.log(value.state.orderCount) // 1
|
|
5489
|
+
```
|
|
5490
|
+
|
|
5491
|
+
|
|
5450
5492
|
|
|
5451
5493
|
```js
|
|
5452
5494
|
const { Users } = defineOneEntry('your-url');
|
|
@@ -5470,7 +5512,10 @@ Example return:
|
|
|
5470
5512
|
"authProviderIdentifier": "email",
|
|
5471
5513
|
"groups": [
|
|
5472
5514
|
"group_1"
|
|
5473
|
-
]
|
|
5515
|
+
],
|
|
5516
|
+
"state": {
|
|
5517
|
+
"orderCount": 1
|
|
5518
|
+
}
|
|
5474
5519
|
}
|
|
5475
5520
|
```
|
|
5476
5521
|
<details>
|
|
@@ -5521,6 +5566,9 @@ const data = {
|
|
|
5521
5566
|
"email": "example@oneentry.cloud",
|
|
5522
5567
|
"phonePush": ["+99999999999"],
|
|
5523
5568
|
"phoneSMS": "+99999999999"
|
|
5569
|
+
},
|
|
5570
|
+
"state": {
|
|
5571
|
+
"orderCount": 1
|
|
5524
5572
|
}
|
|
5525
5573
|
}
|
|
5526
5574
|
|
package/dist/base/syncModules.js
CHANGED
|
@@ -53,7 +53,7 @@ class SyncModules {
|
|
|
53
53
|
if (Array.isArray(data)) {
|
|
54
54
|
return data.map(item => this._clearArray(item));
|
|
55
55
|
}
|
|
56
|
-
else {
|
|
56
|
+
else if (typeof data === 'object' && data) {
|
|
57
57
|
const normalizeData = {};
|
|
58
58
|
for (let key in data) {
|
|
59
59
|
if (Array.isArray(data[key])) {
|
|
@@ -77,6 +77,9 @@ class SyncModules {
|
|
|
77
77
|
}
|
|
78
78
|
return normalizeData;
|
|
79
79
|
}
|
|
80
|
+
else {
|
|
81
|
+
return data;
|
|
82
|
+
}
|
|
80
83
|
}
|
|
81
84
|
_normalizeAttr(data) {
|
|
82
85
|
if ('attributeValues' in data) {
|
package/dist/users/usersApi.d.ts
CHANGED
|
@@ -41,7 +41,8 @@ export default class UsersApi extends AsyncModules implements IUsers {
|
|
|
41
41
|
* "email": "example@oneentry.cloud",
|
|
42
42
|
* "phonePush": ["+99999999999"],
|
|
43
43
|
* "phoneSMS": "+99999999999"
|
|
44
|
-
* }
|
|
44
|
+
* },
|
|
45
|
+
* "state": {}
|
|
45
46
|
* }
|
|
46
47
|
*/
|
|
47
48
|
updateUser(data: IUserBody, langCode?: string): Promise<boolean>;
|
package/dist/users/usersApi.js
CHANGED
|
@@ -22,6 +22,7 @@ interface IUserEntity {
|
|
|
22
22
|
formIdentifier: string;
|
|
23
23
|
authProviderIdentifier: string;
|
|
24
24
|
groups: Array<string>;
|
|
25
|
+
state: Record<string, any>;
|
|
25
26
|
}
|
|
26
27
|
interface IUserBody {
|
|
27
28
|
formIdentifier: string;
|
|
@@ -36,5 +37,6 @@ interface IUserBody {
|
|
|
36
37
|
phonePush: Array<string>;
|
|
37
38
|
phoneSMS: string;
|
|
38
39
|
};
|
|
40
|
+
state: Record<string, any>;
|
|
39
41
|
}
|
|
40
42
|
export { IUsers, IUserEntity, IUserBody, };
|