oneentry 1.0.87 → 1.0.89

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
 
@@ -1,3 +1,4 @@
1
+ import { AttributeType } from "../base/utils";
1
2
  /**
2
3
  * Represents a interface object of Admins Api.
3
4
  *
@@ -38,7 +39,7 @@ interface IPosition {
38
39
  */
39
40
  interface IAdminEntity {
40
41
  attributeSetId: number | null;
41
- attributeValues: Record<string, any>;
42
+ attributeValues: AttributeType;
42
43
  id: number;
43
44
  identifier: string;
44
45
  isSync: boolean;
@@ -163,7 +163,7 @@ class AsyncModules extends syncModules_1.default {
163
163
  return await secondResponse.json();
164
164
  }
165
165
  }
166
- throw response;
166
+ return response;
167
167
  }
168
168
  }
169
169
  catch (e) {
@@ -66,23 +66,6 @@ interface IAttributeValue {
66
66
  [key: string]: any;
67
67
  }
68
68
  type AttributeType = IAttributeValues | IAttributeValue;
69
- interface IAttributeSetEntity {
70
- id: number;
71
- updatedDate: string;
72
- version: number;
73
- identifier: string;
74
- typeId: number;
75
- localizeInfos: LocalizeType;
76
- schema: Record<string, any>;
77
- position: {
78
- id: number;
79
- objectId: number;
80
- objectType: string;
81
- position: number | string;
82
- };
83
- positionId: number | string;
84
- isVisible: boolean;
85
- }
86
69
  type LangType = string | Array<string>;
87
70
  type LocalizeType = ILocalizeInfos | ILocalizeInfo;
88
71
  interface IError {
@@ -92,4 +75,4 @@ interface IError {
92
75
  timestamp: string;
93
76
  [key: string]: any;
94
77
  }
95
- export { LocalizeType, ILocalizeInfos, ILocalizeInfo, Types, IAttributeSetEntity, LangType, AttributeType, IAttributeValues, IAttributes, IConfig, IError };
78
+ export { LocalizeType, ILocalizeInfos, ILocalizeInfo, Types, LangType, AttributeType, IAttributeValues, IAttributes, IConfig, IError };
@@ -1,3 +1,4 @@
1
+ import { AttributeType } from "../base/utils";
1
2
  import { IProductsEntity } from "../products/productsInterfaces";
2
3
  /**
3
4
  * Represents a interface object of Blocks Api.
@@ -18,7 +19,7 @@ interface IBlocksResponse {
18
19
  items: Array<IBlockEntity>;
19
20
  }
20
21
  interface IBlockEntity {
21
- attributeValues: Record<string, any>;
22
+ attributeValues: AttributeType;
22
23
  id: number;
23
24
  identifier: string;
24
25
  isVisible: boolean;
@@ -1,4 +1,4 @@
1
- import { IAttributes, LangType, Types } from "../base/utils";
1
+ import { AttributeType, IAttributes, LangType, Types } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of Pages Api.
4
4
  *
@@ -90,7 +90,7 @@ interface IPositionBlock {
90
90
  position: number;
91
91
  isSync: boolean;
92
92
  isVisible: boolean;
93
- attributeValues: Record<string, any>;
93
+ attributeValues: AttributeType;
94
94
  attributeSetIdentifier: string | null;
95
95
  type: string;
96
96
  templateIdentifier: string | null;
@@ -118,7 +118,7 @@ interface IPositionBlock {
118
118
  */
119
119
  interface IPagesEntity {
120
120
  attributeSetIdentifier: string;
121
- attributeValues: Record<string, any>;
121
+ attributeValues: AttributeType;
122
122
  childrenCount?: number;
123
123
  config?: Record<string, number>;
124
124
  depth: number;
@@ -1,4 +1,4 @@
1
- import { LangType, Types } from "../base/utils";
1
+ import { AttributeType, LangType, Types } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of Products Api.
4
4
  *
@@ -66,6 +66,8 @@ interface IProductsQuery {
66
66
  * @property {string | null} conditionMarker - Id of the filter condition by which the values are filtered, default null.
67
67
  * @property {string | null} attributeMarker - The text identifier of the indexed attribute by which values are filtered, default null.
68
68
  * @property {Array<string> | null} pageUrl - Url of the category page object.
69
+ * @property {string | null} statusMarker - Text identifier of the product page status (default not set).
70
+ * @property {string | null} title - Product name.
69
71
  */
70
72
  interface IFilterParams {
71
73
  attributeMarker: string;
@@ -82,6 +84,8 @@ interface IFilterParams {
82
84
  conditionMarker?: 'in' | 'nin' | 'eq' | 'neq' | 'mth' | 'lth' | 'exs' | 'nexs' | null;
83
85
  conditionValue: number | string | null;
84
86
  pageUrl?: Array<string> | null;
87
+ statusMarker?: string;
88
+ title?: string;
85
89
  }
86
90
  /**
87
91
  * Represents a product entity object.
@@ -120,7 +124,7 @@ interface IProductsEntity {
120
124
  templateIdentifier: string | null;
121
125
  shortDescTemplateIdentifier: string;
122
126
  statusLocalizeInfos: Record<string, any>;
123
- attributeValues: Record<string, any>;
127
+ attributeValues: AttributeType;
124
128
  position: number;
125
129
  sku: string | null;
126
130
  }
@@ -168,6 +172,6 @@ interface IProductBlock {
168
172
  templateIdentifier: string | null;
169
173
  isVisible: boolean;
170
174
  isSync: boolean;
171
- attributeValues: Record<string, any>;
175
+ attributeValues: AttributeType;
172
176
  }
173
177
  export { IFilterParams, IProductsQuery, IProductApi, IProductsEntity, IProductsInfo, IProductInfo, IProductBlock, IProductEntity, IProductsResponse };
@@ -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>;
@@ -45,7 +45,8 @@ class UsersApi extends asyncModules_1.default {
45
45
  * "email": "example@oneentry.cloud",
46
46
  * "phonePush": ["+99999999999"],
47
47
  * "phoneSMS": "+99999999999"
48
- * }
48
+ * },
49
+ * "state": {}
49
50
  * }
50
51
  */
51
52
  async updateUser(data, langCode = this.state.lang) {
@@ -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, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.87",
3
+ "version": "1.0.89",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",