oneentry 1.0.70 → 1.0.71

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
@@ -3538,23 +3538,10 @@ example: pi_3Oyz2kQWzXG1R23w144qG7o4_secret_OeScuCwTpHmyOM1atbm7pWJw2 <br>
3538
3538
  </details>
3539
3539
 
3540
3540
 
3541
- ### Payments.createSession(body)
3541
+ ### Payments.createSession(orderId, type, automaticTaxEnabled)
3542
3542
 
3543
3543
  ```js
3544
- const body = {
3545
- "lineItems": [
3546
- {
3547
- "quantity": 1,
3548
- "amount": 5,
3549
- "currency": "USD",
3550
- "name": "T-Shirt",
3551
- "description": "White T-Shirt"
3552
- }
3553
- ],
3554
- "orderId": 22
3555
- }
3556
-
3557
- const value = await Payments.createSession(body)
3544
+ const value = await Payments.createSession(1, 'session')
3558
3545
  ```
3559
3546
 
3560
3547
  > This method creation of a payment session. It returns a Promise that resolves to a payment session object.
@@ -5222,17 +5209,11 @@ Example return:
5222
5209
  [
5223
5210
  {
5224
5211
  "id": 1764,
5225
- "updatedDate": "2024-05-25T23:50:35.154Z",
5226
5212
  "version": 10,
5227
5213
  "identifier": "marker",
5228
- "generalType": {
5229
- "id": 4,
5230
- "type": "forCatalogPages"
5231
- },
5232
5214
  "generalTypeId": 4,
5233
5215
  "title": "Page template",
5234
5216
  "position": 0,
5235
- "positionId": 12,
5236
5217
  "generalTypeName": "forProductPreview"
5237
5218
  }
5238
5219
  ]
@@ -5244,8 +5225,6 @@ Example return:
5244
5225
  *object identifier* <br>
5245
5226
  example: 1764 <br>
5246
5227
 
5247
- **updatedDate:** string($date-time) <br>
5248
- *object's date of modification* <br>
5249
5228
 
5250
5229
  **version** number <br>
5251
5230
  *object's version number of modification* <br>
@@ -5255,10 +5234,6 @@ example: 10 <br>
5255
5234
  *textual identifier for a field in the record* <br>
5256
5235
  example: catalog <br>
5257
5236
 
5258
- **generalType:**: object <br>
5259
- *object type* <br>
5260
- example: OrderedMap { "id": 4, "type": "forCatalogPages" } <br>
5261
-
5262
5237
  **generalTypeId:** number <br>
5263
5238
  *type identifier* <br>
5264
5239
  example: 4 <br>
@@ -5271,11 +5246,6 @@ example: page template <br>
5271
5246
  *position number* <br>
5272
5247
  example: 0 <br>
5273
5248
 
5274
-
5275
- **positionId:** number <br>
5276
- *position object identifier* <br>
5277
- example: 12 <br>
5278
-
5279
5249
  **generalTypeName** string <br>
5280
5250
  *example: forProductPreview* <br>
5281
5251
  general type name <br>
@@ -5296,17 +5266,11 @@ Example return:
5296
5266
  [
5297
5267
  {
5298
5268
  "id": 1764,
5299
- "updatedDate": "2024-05-25T23:50:35.154Z",
5300
5269
  "version": 10,
5301
5270
  "identifier": "marker",
5302
- "generalType": {
5303
- "id": 4,
5304
- "type": "forCatalogPages"
5305
- },
5306
5271
  "generalTypeId": 4,
5307
5272
  "title": "Page template",
5308
5273
  "position": 0,
5309
- "positionId": 12,
5310
5274
  "generalTypeName": "forProductPreview"
5311
5275
  }
5312
5276
  ]
@@ -5318,8 +5282,6 @@ Example return:
5318
5282
  *object identifier* <br>
5319
5283
  example: 1764 <br>
5320
5284
 
5321
- **updatedDate:** string($date-time) <br>
5322
- *object's date of modification* <br>
5323
5285
 
5324
5286
  **version** number <br>
5325
5287
  *object's version number of modification* <br>
@@ -5329,10 +5291,6 @@ example: 10 <br>
5329
5291
  *textual identifier for a field in the record* <br>
5330
5292
  example: catalog <br>
5331
5293
 
5332
- **generalType:**: object <br>
5333
- *object type* <br>
5334
- example: OrderedMap { "id": 4, "type": "forCatalogPages" } <br>
5335
-
5336
5294
  **generalTypeId:** number <br>
5337
5295
  *type identifier* <br>
5338
5296
  example: 4 <br>
@@ -5345,10 +5303,6 @@ example: page template <br>
5345
5303
  *position number* <br>
5346
5304
  example: 0 <br>
5347
5305
 
5348
- **positionId:** number <br>
5349
- *position object identifier* <br>
5350
- example: 12 <br>
5351
-
5352
5306
  **generalTypeName** string <br>
5353
5307
  *example: forProductPreview* <br>
5354
5308
  general type name <br>
@@ -5370,17 +5324,10 @@ Example return:
5370
5324
  [
5371
5325
  {
5372
5326
  "id": 1764,
5373
- "updatedDate": "2024-05-25T23:50:35.154Z",
5374
5327
  "version": 10,
5375
5328
  "identifier": "marker",
5376
- "generalType": {
5377
- "id": 4,
5378
- "type": "forCatalogPages"
5379
- },
5380
5329
  "generalTypeId": 4,
5381
5330
  "title": "Page template",
5382
- "position": 0,
5383
- "positionId": 12,
5384
5331
  "generalTypeName": "forProductPreview"
5385
5332
  }
5386
5333
  ]
@@ -5392,9 +5339,6 @@ Example return:
5392
5339
  *object identifier* <br>
5393
5340
  example: 1764 <br>
5394
5341
 
5395
- **updatedDate:** string($date-time) <br>
5396
- *object's date of modification* <br>
5397
-
5398
5342
  **version** number <br>
5399
5343
  *object's version number of modification* <br>
5400
5344
  example: 10 <br>
@@ -5403,10 +5347,6 @@ example: 10 <br>
5403
5347
  *textual identifier for a field in the record* <br>
5404
5348
  example: catalog <br>
5405
5349
 
5406
- **generalType:**: object <br>
5407
- *object type* <br>
5408
- example: OrderedMap { "id": 4, "type": "forCatalogPages" } <br>
5409
-
5410
5350
  **generalTypeId:** number <br>
5411
5351
  *type identifier* <br>
5412
5352
  example: 4 <br>
@@ -5419,9 +5359,6 @@ example: page template <br>
5419
5359
  *position number* <br>
5420
5360
  example: 0 <br>
5421
5361
 
5422
- **positionId:** number <br>
5423
- *position object identifier* <br>
5424
- example: 12 <br>
5425
5362
 
5426
5363
  **generalTypeName** string <br>
5427
5364
  *example: forProductPreview* <br>
@@ -5453,7 +5390,7 @@ Example return:
5453
5390
  [
5454
5391
  {
5455
5392
  "id": 1764,
5456
- "updatedDate": "2023-12-05T12:44:55.663Z",
5393
+ "updatedDate": "2024-06-13T08:45:59.805Z",
5457
5394
  "version": 10,
5458
5395
  "identifier": "marker",
5459
5396
  "proportion": {
@@ -5461,24 +5398,21 @@ Example return:
5461
5398
  "height": 200,
5462
5399
  "weight": 10,
5463
5400
  "marker": "horizontal",
5464
- "title": "Horizontal",
5465
5401
  "alignmentType": "left"
5466
5402
  },
5467
5403
  "vertical": {
5468
5404
  "height": 10,
5469
5405
  "weight": 200,
5470
5406
  "marker": "vertical",
5471
- "title": "Vertical",
5472
5407
  "alignmentType": "left"
5473
5408
  },
5474
5409
  "square": {
5475
5410
  "marker": "square",
5476
- "title": "Square",
5477
5411
  "slide": 3,
5478
5412
  "alignmentType": "center"
5479
5413
  }
5480
5414
  },
5481
- "title": "Page Template",
5415
+ "title": "Page template",
5482
5416
  "position": 0
5483
5417
  }
5484
5418
  ]
@@ -5524,7 +5458,7 @@ example: 12 <br>
5524
5458
  ### TemplatePreviews.getTemplatesPreviewById(id)
5525
5459
 
5526
5460
  ```js
5527
- const value = await TemplatePreviews.getTemplatePreviewById(1)
5461
+ const value = await TemplatePreviews.getTemplatePreviewById(1764)
5528
5462
  ```
5529
5463
 
5530
5464
  > This method retrieves a single template object based on its identifier (id) from the API. It returns a Promise that resolves to a TemplatePreviewsEntity object.
@@ -5542,25 +5476,22 @@ Example return:
5542
5476
  "height": 200,
5543
5477
  "weight": 10,
5544
5478
  "marker": "horizontal",
5545
- "title": "Horizontal",
5546
5479
  "alignmentType": "left"
5547
5480
  },
5548
5481
  "vertical": {
5549
5482
  "height": 10,
5550
5483
  "weight": 200,
5551
5484
  "marker": "vertical",
5552
- "title": "Vertical",
5553
5485
  "alignmentType": "left"
5554
5486
  },
5555
5487
  "square": {
5556
5488
  "marker": "square",
5557
- "title": "Square",
5558
5489
  "slide": 3,
5559
5490
  "alignmentType": "center"
5560
5491
  }
5561
5492
  },
5562
5493
  "title": "Page Template",
5563
- "position": 0
5494
+ "positionId": 0
5564
5495
  }
5565
5496
  ```
5566
5497
  <details>
@@ -5615,31 +5546,28 @@ Example return:
5615
5546
  "id": 1764,
5616
5547
  "updatedDate": "2023-12-05T12:44:20.008Z",
5617
5548
  "version": 10,
5618
- "identifier": "marker",
5549
+ "identifier": "my-marker",
5619
5550
  "proportion": {
5620
5551
  "horizontal": {
5621
5552
  "height": 200,
5622
5553
  "weight": 10,
5623
5554
  "marker": "horizontal",
5624
- "title": "Horizontal",
5625
5555
  "alignmentType": "left"
5626
5556
  },
5627
5557
  "vertical": {
5628
5558
  "height": 10,
5629
5559
  "weight": 200,
5630
5560
  "marker": "vertical",
5631
- "title": "Vertical",
5632
5561
  "alignmentType": "left"
5633
5562
  },
5634
5563
  "square": {
5635
5564
  "marker": "square",
5636
- "title": "Square",
5637
5565
  "slide": 3,
5638
5566
  "alignmentType": "center"
5639
5567
  }
5640
5568
  },
5641
5569
  "title": "Page Template",
5642
- "position": 0
5570
+ "positionId": 0
5643
5571
  }
5644
5572
  ```
5645
5573
  <details>
@@ -5668,7 +5596,7 @@ example: OrderedMap { "horizontal": OrderedMap { "height": 200, "weight": 10, "m
5668
5596
  *template name* <br>
5669
5597
  example: page template <br>
5670
5598
 
5671
- **position** object <br>
5599
+ **positionId** object <br>
5672
5600
  *position number* <br>
5673
5601
  example: 0 <br>
5674
5602
 
@@ -12,7 +12,7 @@ export default class AttributesSetsApi extends AsyncModules implements IAttribut
12
12
  * Get all attributes with data from the attribute sets.
13
13
  *
14
14
  * @param {string} marker - Attribute marker.
15
- * @param {string} langCode - Language code.
15
+ * @param {string} [langCode] - Language code.
16
16
  *
17
17
  * @returns Returns an array of AttributeInSet objects.
18
18
  */
@@ -22,7 +22,7 @@ export default class AttributesSetsApi extends AsyncModules implements IAttribut
22
22
  *
23
23
  * @param {string} attributeMarker - Text identifier (marker) of the attribute in the set.
24
24
  * @param {string} setMarker - Text identifier (marker) of the attribute set.
25
- * @param {string} langCode - Language code.
25
+ * @param {string} [langCode] - Language code.
26
26
  *
27
27
  * @returns Returns a AttributeInSet object.
28
28
  */
@@ -13,7 +13,7 @@ class AttributesSetsApi extends asyncModules_1.default {
13
13
  * Get all attributes with data from the attribute sets.
14
14
  *
15
15
  * @param {string} marker - Attribute marker.
16
- * @param {string} langCode - Language code.
16
+ * @param {string} [langCode] - Language code.
17
17
  *
18
18
  * @returns Returns an array of AttributeInSet objects.
19
19
  */
@@ -26,7 +26,7 @@ class AttributesSetsApi extends asyncModules_1.default {
26
26
  *
27
27
  * @param {string} attributeMarker - Text identifier (marker) of the attribute in the set.
28
28
  * @param {string} setMarker - Text identifier (marker) of the attribute set.
29
- * @param {string} langCode - Language code.
29
+ * @param {string} [langCode] - Language code.
30
30
  *
31
31
  * @returns Returns a AttributeInSet object.
32
32
  */
@@ -80,6 +80,7 @@ interface IAuthProvidersEntity {
80
80
  isCheckCode: boolean;
81
81
  type: string;
82
82
  formIdentifier: string | null;
83
+ position: number | null;
83
84
  }
84
85
  interface IAuthPostBody {
85
86
  authData: Array<{
@@ -8,10 +8,14 @@ class AsyncModules extends syncModules_1.default {
8
8
  this.state = state;
9
9
  this._NO_FETCH = !!(typeof process === 'object' && process.versions);
10
10
  try {
11
- this._https = this._NO_FETCH ? require('https') : null;
11
+ try {
12
+ this._https = this._NO_FETCH ? require('https') : null;
13
+ }
14
+ catch (e) {
15
+ this._https = null;
16
+ }
12
17
  }
13
18
  catch (e) {
14
- this._https = null;
15
19
  }
16
20
  }
17
21
  async _fetchGet(path) {
@@ -6,7 +6,7 @@ class StateModule {
6
6
  this.url = url;
7
7
  this.lang = (_a = config.langCode) !== null && _a !== void 0 ? _a : 'en_US';
8
8
  this.token = config.token;
9
- this.multipleResponse = !!((_b = config.traficLimit) !== null && _b !== void 0 ? _b : false);
9
+ this.multipleResponse = !!((_b = config.traficLimit) !== null && _b !== void 0 ? _b : true);
10
10
  this.refreshToken = (_d = (_c = config.auth) === null || _c === void 0 ? void 0 : _c.refreshToken) !== null && _d !== void 0 ? _d : undefined;
11
11
  this.customAuth = (_f = (_e = config.auth) === null || _e === void 0 ? void 0 : _e.customAuth) !== null && _f !== void 0 ? _f : false;
12
12
  this.saveFunction = (_h = (_g = config.auth) === null || _g === void 0 ? void 0 : _g.saveFunction) !== null && _h !== void 0 ? _h : null;
@@ -30,6 +30,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
30
30
  * formData: {
31
31
  * marker: 'test',
32
32
  * value: 'Test',
33
+ * type: 'string'
33
34
  * },
34
35
  * }
35
36
  *
@@ -34,6 +34,7 @@ class FormsDataApi extends asyncModules_1.default {
34
34
  * formData: {
35
35
  * marker: 'test',
36
36
  * value: 'Test',
37
+ * type: 'string'
37
38
  * },
38
39
  * }
39
40
  *
@@ -43,7 +44,7 @@ class FormsDataApi extends asyncModules_1.default {
43
44
  const formData = {};
44
45
  formData[langCode] = Array.isArray(data.formData) ? data.formData : [data.formData];
45
46
  data.formData = formData;
46
- const result = await this._fetchPost('', JSON.stringify(data));
47
+ const result = await this._fetchPost(``, data);
47
48
  return this._dataPostProcess(result);
48
49
  }
49
50
  /**
@@ -68,7 +68,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
68
68
  * "currency": "USD"
69
69
  * }
70
70
  */
71
- updateOrderByMarkerAndId(marker: string, id: string, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
71
+ updateOrderByMarkerAndId(marker: string, id: number, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
72
72
  /**
73
73
  * Getting all the order storage objects
74
74
  * @param {number} [langCode] Optional language field
@@ -79,6 +79,9 @@ class OrdersApi extends asyncModules_1.default {
79
79
  * }
80
80
  */
81
81
  async updateOrderByMarkerAndId(marker, id, data, langCode = this.state.lang) {
82
+ const formData = {};
83
+ formData[langCode] = Array.isArray(data.formData) ? data.formData : [data.formData];
84
+ data.formData = formData;
82
85
  const result = await this._fetchPut(`/marker/${marker}/orders/${id}?langCode=${langCode}`, data);
83
86
  return this._normalizeData(result);
84
87
  }
@@ -11,7 +11,7 @@
11
11
  interface IOrdersApi {
12
12
  getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity>;
13
13
  createOrder(marker: string, data: IOrderData): Promise<IBaseOrdersEntity>;
14
- updateOrderByMarkerAndId(marker: string, id: string, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
14
+ updateOrderByMarkerAndId(marker: string, id: number, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
15
15
  getAllOrders(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity>>;
16
16
  getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersByMarkersEntity>>;
17
17
  }
@@ -66,14 +66,13 @@ interface IOrderProductData {
66
66
  * @property {string} createdDate - Date when the order was created.
67
67
  */
68
68
  interface IBaseOrdersEntity {
69
- statusIdentifier: string;
70
69
  formIdentifier: string;
71
70
  paymentAccountIdentifier: string;
72
71
  formData: Array<IOrdersFormData>;
73
72
  products: Array<IOrderProductData>;
74
73
  totalSum: string;
75
74
  currency: string;
76
- createdDate: string;
75
+ id: number;
77
76
  }
78
77
  /**
79
78
  * @interface
@@ -83,6 +82,7 @@ interface IBaseOrdersEntity {
83
82
  * @property {number} generalTypeId - Type identifier.
84
83
  * @property {string} formIdentifier - Textual identifier for the form used by the order storage.
85
84
  * @property {Array<{identifier:string}>} paymentAccountIdentifiers - Array of textual identifiers of payment accounts used by the order storage.
85
+ * @property {number | null} position
86
86
  */
87
87
  interface IOrdersEntity {
88
88
  id: number;
@@ -93,6 +93,7 @@ interface IOrdersEntity {
93
93
  paymentAccountIdentifiers: Array<{
94
94
  identifier: string;
95
95
  }>;
96
+ position: number | null;
96
97
  }
97
98
  /**
98
99
  * @interface
@@ -114,7 +115,6 @@ interface IOrderData {
114
115
  * @property {Array<IOrdersFormData>} formData - Data submitted by the form linked to the order store.
115
116
  * @property {Array<IOrderProducts>} products - Array of products added to order.
116
117
  * @property {string} totalSum - Total order amount.
117
- * @property {number} price - Price order.
118
118
  * @property {string} currency - Currency used to pay for the order.
119
119
  * @property {string} createdDate - Date when the order was created.
120
120
  * @property {string} paymentAccountIdentifier - Textual identifier for the order payment.
@@ -122,6 +122,7 @@ interface IOrderData {
122
122
  * @property {boolean} isHistory - Indicates that the order has been saved in the order history.
123
123
  */
124
124
  interface IOrdersByMarkersEntity {
125
+ attributeSetIdentifier: string;
125
126
  statusIdentifier: string;
126
127
  formIdentifier: string;
127
128
  formData: Array<IOrdersFormData>;
@@ -129,9 +130,10 @@ interface IOrdersByMarkersEntity {
129
130
  totalSum: string;
130
131
  currency: string;
131
132
  createdDate: string;
132
- price: number;
133
+ position: number;
133
134
  paymentAccountIdentifier: string;
134
135
  paymentAccountLocalizeInfos: Record<string, any>;
135
136
  isHistory: boolean;
137
+ id: number;
136
138
  }
137
139
  export { IOrdersEntity, IBaseOrdersEntity, IOrderProducts, IPicture, IOrdersApi, IOrderData, IOrderProductData, IOrdersFormData, IOrdersByMarkersEntity };
@@ -169,8 +169,17 @@ class PageApi extends asyncModules_1.default {
169
169
  * @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
170
170
  */
171
171
  async searchPage(name, langCode = this.state.lang) {
172
- const result = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
173
- return this._normalizeData(result, langCode);
172
+ const searchPages = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
173
+ if (this.state.multipleResponse) {
174
+ const pageList = [];
175
+ await Promise.all(searchPages.map(async (page) => {
176
+ await this.getPageById(page.id, langCode).then((result) => {
177
+ pageList.push(result);
178
+ });
179
+ }));
180
+ return this._dataPostProcess(pageList, langCode);
181
+ }
182
+ return this._normalizeData(searchPages, langCode);
174
183
  }
175
184
  }
176
185
  exports.default = PageApi;
@@ -76,40 +76,24 @@ interface IPositionForm {
76
76
  * @property {number} id - The identifier of the object.
77
77
  * @property {number} version - The version number of the object.
78
78
  * @property {string} identifier - The textual identifier for the record field.
79
- * @property {number} attributeSetId - The identifier of the attribute set being used.
80
79
  * @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
81
- * @property {object} customSettings - Custom settings for different types of blocks.
82
80
  * @property {number} position - The position of the object.
83
81
  * @property {boolean} isSync - Indication of page indexing.
84
82
  * @property {Record<string, any>} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
85
83
  * @property {Types} type - Page type.
86
- * @property {string} templateIdentifier - User id of the linked template.
87
84
  */
88
85
  interface IPositionBlock {
89
86
  id: number;
90
87
  version: number;
91
88
  identifier: string;
92
- attributeSetId: number;
93
89
  localizeInfos: Record<string, any>;
94
- customSettings: {
95
- sliderDelay: number;
96
- sliderDelayType: string;
97
- productQuantity: number;
98
- productSortType: string;
99
- productSortOrder: string;
100
- productCountElementsPerRow: number;
101
- similarProductRules: Array<{
102
- property: string;
103
- includes: string;
104
- keywords: string;
105
- strict: string;
106
- }>;
107
- };
108
90
  position: number;
109
91
  isSync: boolean;
92
+ isVisible: boolean;
110
93
  attributeValues: Record<string, any>;
111
94
  type: string;
112
95
  templateIdentifier: string | null;
96
+ countElementsPerRow: number;
113
97
  }
114
98
  /**
115
99
  * Represents an object with various properties.
@@ -1,5 +1,5 @@
1
1
  import AsyncModules from "../base/asyncModules";
2
- import { IPaymentsApi, ISessionEntity, IConnectedEntity, IAccountsEntity, ISessionBody } from "./paymentsInterfaces";
2
+ import { IPaymentsApi, ISessionEntity, IConnectedEntity, IAccountsEntity } from "./paymentsInterfaces";
3
3
  import StateModule from "../base/stateModule";
4
4
  /**
5
5
  * Controllers for working with payments
@@ -28,25 +28,13 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
28
28
  /**
29
29
  * Creation of payment session.
30
30
  *
31
- * @param {ISessionBody} body - Object for creating a payment
32
- *
33
- * @example
34
- * {
35
- * "lineItems": [
36
- * {
37
- * "quantity": 1,
38
- * "amount": 5,
39
- * "currency": "USD",
40
- * "name": "T-Shirt",
41
- * "description": "White T-Shirt"
42
- * }
43
- * ],
44
- * "orderId": 22
45
- * }
31
+ * @param {number} orderId - Order identifier
32
+ * @param {'session' | 'intent'} type - Session type
33
+ * @param {boolean} automaticTaxEnabled - Automatic calculation of the tax rate
46
34
  *
47
35
  * @returns Returns a single payment session object.
48
36
  */
49
- createSession(body: ISessionBody): Promise<ISessionEntity>;
37
+ createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ISessionEntity>;
50
38
  /**
51
39
  * Get payment settings.
52
40
  *
@@ -35,26 +35,17 @@ class PaymentsApi extends asyncModules_1.default {
35
35
  /**
36
36
  * Creation of payment session.
37
37
  *
38
- * @param {ISessionBody} body - Object for creating a payment
39
- *
40
- * @example
41
- * {
42
- * "lineItems": [
43
- * {
44
- * "quantity": 1,
45
- * "amount": 5,
46
- * "currency": "USD",
47
- * "name": "T-Shirt",
48
- * "description": "White T-Shirt"
49
- * }
50
- * ],
51
- * "orderId": 22
52
- * }
38
+ * @param {number} orderId - Order identifier
39
+ * @param {'session' | 'intent'} type - Session type
40
+ * @param {boolean} automaticTaxEnabled - Automatic calculation of the tax rate
53
41
  *
54
42
  * @returns Returns a single payment session object.
55
43
  */
56
- async createSession(body) {
57
- const result = await this._fetchPost('/sessions', body);
44
+ async createSession(orderId, type, automaticTaxEnabled) {
45
+ const result = await this._fetchPost('/sessions', {
46
+ type,
47
+ orderId
48
+ });
58
49
  return result;
59
50
  }
60
51
  /**
@@ -92,7 +83,7 @@ class PaymentsApi extends asyncModules_1.default {
92
83
  * @returns Returns true (in case of successful execution) or false (in case of unsuccessful execution)
93
84
  */
94
85
  async webhookStripe() {
95
- const result = await this._fetchPost('/webhook/stripe', null);
86
+ const result = await this._fetchPost('/webhook/stripe', {});
96
87
  return result;
97
88
  }
98
89
  }
@@ -13,7 +13,7 @@
13
13
  interface IPaymentsApi {
14
14
  getSessions(limit: number, offset: number): Promise<Array<ISessionEntity>>;
15
15
  getSessionById(id: number): Promise<ISessionEntity>;
16
- createSession(body: ISessionBody): Promise<ISessionEntity>;
16
+ createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ISessionEntity>;
17
17
  getConnected(): Promise<IConnectedEntity | null>;
18
18
  getAccounts(): Promise<Array<IAccountsEntity>>;
19
19
  getAccountById(id: number): Promise<IAccountsEntity>;
@@ -103,8 +103,6 @@ interface IConnectedEntity {
103
103
  /**
104
104
  * @interface
105
105
  * @property {number} id - Object identifier.
106
- * @property {string} updatedDate - Object modification date.
107
- * @property {number} version - Object modification version number.
108
106
  * @property {string} identifier - Text identifier for the recording field.
109
107
  * @property {Record<string, any>} localizeInfos - Json description of the payment account object.
110
108
  * @property {string} type - Type may be 'stripe', 'paypal' or 'custom'.
@@ -112,8 +110,6 @@ interface IConnectedEntity {
112
110
  */
113
111
  interface IAccountsEntity {
114
112
  id: number;
115
- updatedDate: string;
116
- version: number;
117
113
  identifier: string;
118
114
  localizeInfos: Record<string, any>;
119
115
  type: 'stripe' | 'paypal' | 'custom';
@@ -18,7 +18,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
18
18
  /**
19
19
  * Search for a product status object by identifier.
20
20
  *
21
- * @param {number} [id] - Status id
21
+ * @param {number} id - Status id
22
22
  * @param {string} [langCode] - Optional parameter language code
23
23
  *
24
24
  * @returns Returns a product status object
@@ -27,7 +27,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
27
27
  /**
28
28
  * Search for a product status object by its textual identifier (marker).
29
29
  *
30
- * @param {string} [marker] - Product marker
30
+ * @param {string} marker - Product marker
31
31
  * @param {string} [langCode] - Optional parameter language code
32
32
  *
33
33
  * @returns Returns a product status object
@@ -36,7 +36,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
36
36
  /**
37
37
  * Check the existence of a textual identifier.
38
38
  *
39
- * @param {string} [marker] - Product marker
39
+ * @param {string} marker - Product marker
40
40
  *
41
41
  * @returns Returns true if the textual identifier (marker) exists or false if it doesn't
42
42
  */
@@ -22,7 +22,7 @@ class ProductStatusesApi extends asyncModules_1.default {
22
22
  /**
23
23
  * Search for a product status object by identifier.
24
24
  *
25
- * @param {number} [id] - Status id
25
+ * @param {number} id - Status id
26
26
  * @param {string} [langCode] - Optional parameter language code
27
27
  *
28
28
  * @returns Returns a product status object
@@ -34,7 +34,7 @@ class ProductStatusesApi extends asyncModules_1.default {
34
34
  /**
35
35
  * Search for a product status object by its textual identifier (marker).
36
36
  *
37
- * @param {string} [marker] - Product marker
37
+ * @param {string} marker - Product marker
38
38
  * @param {string} [langCode] - Optional parameter language code
39
39
  *
40
40
  * @returns Returns a product status object
@@ -46,7 +46,7 @@ class ProductStatusesApi extends asyncModules_1.default {
46
46
  /**
47
47
  * Check the existence of a textual identifier.
48
48
  *
49
- * @param {string} [marker] - Product marker
49
+ * @param {string} marker - Product marker
50
50
  *
51
51
  * @returns Returns true if the textual identifier (marker) exists or false if it doesn't
52
52
  */
@@ -1,7 +1,6 @@
1
- import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity, IProductInfo } from './productsInterfaces';
1
+ import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity, IProductInfo, IProductBlock } from './productsInterfaces';
2
2
  import AsyncModules from '../base/asyncModules';
3
3
  import StateModule from "../base/stateModule";
4
- import { IBlocksResponse } from "../blocks/blocksInterfaces";
5
4
  /**
6
5
  * Controllers for working with product pages
7
6
  */
@@ -128,6 +127,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
128
127
  /**
129
128
  * Search for information about products and prices for the selected category.
130
129
  * @param {string} url - Page url.
130
+ * @param {string} langCode - Language code.
131
131
  * @param {IProductsQuery} [userQuery] - Optional set query parameters.
132
132
  * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
133
133
  *
@@ -147,7 +147,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
147
147
  *
148
148
  * @returns Array with ProductInformation objects
149
149
  */
150
- getProductsPriceByPageUrl(url: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
150
+ getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
151
151
  /**
152
152
  * Search for all products with pagination for the selected category.
153
153
  * @param {Array<IFilterParams>} body - Request body.
@@ -228,7 +228,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
228
228
  * @param {number} id - Product id
229
229
  *
230
230
  */
231
- getProductBlockById(id: number): Promise<Array<IBlocksResponse>>;
231
+ getProductBlockById(id: number): Promise<Array<IProductBlock>>;
232
232
  /**
233
233
  * Quick search for product page objects with limited output.
234
234
  *
@@ -66,7 +66,7 @@ class ProductApi extends asyncModules_1.default {
66
66
  */
67
67
  async getProducts(body = [], langCode = this.state.lang, userQuery) {
68
68
  const query = { ...this._defaultQuery, ...userQuery, langCode };
69
- const result = await this._fetchPost(`/all?langCode=${langCode}&` + this._queryParamsToString(query), body);
69
+ const result = await this._fetchPost(`/all?` + this._queryParamsToString(query), body);
70
70
  return this._dataPostProcess(result.items, langCode);
71
71
  }
72
72
  /**
@@ -150,6 +150,7 @@ class ProductApi extends asyncModules_1.default {
150
150
  /**
151
151
  * Search for information about products and prices for the selected category.
152
152
  * @param {string} url - Page url.
153
+ * @param {string} langCode - Language code.
153
154
  * @param {IProductsQuery} [userQuery] - Optional set query parameters.
154
155
  * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
155
156
  *
@@ -169,8 +170,8 @@ class ProductApi extends asyncModules_1.default {
169
170
  *
170
171
  * @returns Array with ProductInformation objects
171
172
  */
172
- async getProductsPriceByPageUrl(url, userQuery) {
173
- const query = { ...this._defaultQuery, ...userQuery };
173
+ async getProductsPriceByPageUrl(url, langCode = this.state.lang, userQuery) {
174
+ const query = { ...this._defaultQuery, ...userQuery, langCode };
174
175
  const result = await this._fetchGet(`/page/${url}/prices?` + this._queryParamsToString(query));
175
176
  return result.items;
176
177
  }
@@ -1,5 +1,4 @@
1
- import { LangType } from "../base/utils";
2
- import { IBlocksResponse } from "../blocks/blocksInterfaces";
1
+ import { LangType, Types } from "../base/utils";
3
2
  /**
4
3
  * Represents an interface object of Products Api.
5
4
  *
@@ -25,11 +24,11 @@ interface IProductApi {
25
24
  getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
26
25
  getProductsEmptyPage(langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
27
26
  getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
28
- getProductsPriceByPageUrl(url: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
27
+ getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
29
28
  getProductsByPageUrl(url: string, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
30
- getRelatedProductsById(id: number, langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
31
- getProductById(id: number, langCode: LangType): Promise<IProductsEntity>;
32
- getProductBlockById(id: number): Promise<Array<IBlocksResponse>>;
29
+ getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
30
+ getProductById(id: number, langCode: string): Promise<IProductsEntity>;
31
+ getProductBlockById(id: number): Promise<Array<IProductBlock>>;
33
32
  searchProduct(name: string, langCode: string): Promise<Array<IProductsEntity>>;
34
33
  }
35
34
  /**
@@ -122,7 +121,6 @@ interface IProductsEntity {
122
121
  blocks?: string | Array<string>;
123
122
  isVisible: boolean;
124
123
  statusId: number | null;
125
- relatedIds: number[];
126
124
  attributeSetId: number;
127
125
  isSync: number | boolean;
128
126
  price: number;
@@ -138,4 +136,34 @@ interface IProductInfo {
138
136
  id: number;
139
137
  price: number;
140
138
  }
141
- export { IFilterParams, IProductsQuery, IProductApi, IProductsEntity, IProductInfo };
139
+ interface IProductBlock {
140
+ id: number;
141
+ attributeSetId: number | null;
142
+ localizeInfos: Record<string, any>;
143
+ version: number;
144
+ position: number;
145
+ identifier: string;
146
+ type: Types;
147
+ customSettings: {
148
+ sliderDelay: number;
149
+ sliderDelayType: string;
150
+ productConfig: {
151
+ quantity: number;
152
+ sortType: string;
153
+ sortOrder: string;
154
+ countElementsPerRow: number;
155
+ };
156
+ similarProductRules: Array<{
157
+ property: string;
158
+ includes: string;
159
+ keywords: string;
160
+ strict: string;
161
+ }>;
162
+ condition: Record<string, any>;
163
+ };
164
+ templateIdentifier: string | null;
165
+ isVisible: boolean;
166
+ isSync: boolean;
167
+ attributeValues: Record<string, any>;
168
+ }
169
+ export { IFilterParams, IProductsQuery, IProductApi, IProductsEntity, IProductInfo, IProductBlock };
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
- import { ITemplatesApi, ITemplateEntity, ITemplateList } from './templatesInterfaces';
2
+ import { ITemplatesApi, ITemplateEntity } from './templatesInterfaces';
3
+ import { Types } from "../base/utils";
3
4
  import StateModule from "../base/stateModule";
4
- import { BlockType } from "../blocks/blocksInterfaces";
5
5
  /**
6
6
  * Controllers for working with template objects
7
7
  */
@@ -15,22 +15,22 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
15
15
  *
16
16
  * @returns Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
17
17
  */
18
- getAllTemplates(langCode?: string): Promise<ITemplateList>;
18
+ getAllTemplates(langCode?: string): Promise<Record<Types, ITemplateEntity>>;
19
19
  /**
20
20
  * Get template objects by type.
21
21
  *
22
- * @param {BlockType} type - Product marker
22
+ * @param {Types} type - Product marker
23
23
  * @param {string} [langCode] - Optional parameter language code
24
24
  *
25
25
  * @returns Returns a TemplateEntity object
26
26
  */
27
- getTemplateByType(type: BlockType): Promise<Array<ITemplateEntity>>;
27
+ getTemplateByType(type: Types): Promise<Array<ITemplateEntity>>;
28
28
  /**
29
29
  * Get one template object by id.
30
30
  *
31
- * @param {string} id - Template id
31
+ * @param {number} id - Template id
32
32
  *
33
33
  * @returns Returns a TemplateEntity object
34
34
  */
35
- getTemplateById(id: string): Promise<ITemplateList>;
35
+ getTemplateById(id: number): Promise<Record<Types, ITemplateEntity>>;
36
36
  }
@@ -26,7 +26,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
26
26
  /**
27
27
  * Get template objects by type.
28
28
  *
29
- * @param {BlockType} type - Product marker
29
+ * @param {Types} type - Product marker
30
30
  * @param {string} [langCode] - Optional parameter language code
31
31
  *
32
32
  * @returns Returns a TemplateEntity object
@@ -38,7 +38,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
38
38
  /**
39
39
  * Get one template object by id.
40
40
  *
41
- * @param {string} id - Template id
41
+ * @param {number} id - Template id
42
42
  *
43
43
  * @returns Returns a TemplateEntity object
44
44
  */
@@ -1,6 +1,4 @@
1
- import { IGeneralTypesEntity } from "../general-types/generalTypesInterfaces";
2
1
  import { Types } from "../base/utils";
3
- import { BlockType } from "../blocks/blocksInterfaces";
4
2
  /**
5
3
  * Represents an interface object of Templates Api.
6
4
  *
@@ -9,39 +7,30 @@ import { BlockType } from "../blocks/blocksInterfaces";
9
7
  * @property {function} getTemplateById - Get one template object by id.
10
8
  */
11
9
  interface ITemplatesApi {
12
- getAllTemplates(langCode: string): Promise<ITemplateList>;
13
- getTemplateByType(type: BlockType, langCode: string): Promise<Array<ITemplateEntity>>;
14
- getTemplateById(id: string): Promise<ITemplateList>;
10
+ getAllTemplates(langCode: string): Promise<Record<Types, ITemplateEntity>>;
11
+ getTemplateByType(type: Types, langCode: string): Promise<Array<ITemplateEntity>>;
12
+ getTemplateById(id: number): Promise<Record<Types, ITemplateEntity>>;
15
13
  }
16
14
  /**
17
15
  * Represents a template entity object.
18
16
  *
19
17
  * @interface
20
18
  * @property {number} id - The unique identifier of the position.
21
- * @property {Date | string} updateDate - The date of last updated.
22
19
  * @property {number} version - The version number of the object.
23
20
  * @property {string} identifier - The textual identifier for the record field.
24
- * @property {IGeneralTypesEntity} generalType - General type Entity object.
25
21
  * @property {number} generalTypeId - General type Entity id.
26
22
  * @property {string} title - The name of the template.
27
23
  * @property {number} position - The position of the object.
28
- * @property {number | string} positionId - Id of the item object.
29
24
  * @property {Types} generalTypeName - General type name.
30
25
  *
31
26
  */
32
27
  interface ITemplateEntity {
33
28
  id: number;
34
- updateDate?: string | Date;
35
29
  version: number;
36
30
  identifier: string;
37
- generalType?: IGeneralTypesEntity;
38
31
  generalTypeId: number;
39
32
  title: string;
40
33
  position: number;
41
- positionId?: number;
42
34
  generalTypeName: Types;
43
35
  }
44
- interface ITemplateList {
45
- [key: string]: ITemplateEntity;
46
- }
47
- export { ITemplatesApi, ITemplateEntity, ITemplateList };
36
+ export { ITemplatesApi, ITemplateEntity, };
@@ -1,5 +1,5 @@
1
1
  import AsyncModules from "../base/asyncModules";
2
- import { ITemplatesPreview, ITemplatesPreviewEntity } from "./templatesPreviewInterfaces";
2
+ import { ITemplatesPreview, ITemplatesPreviewEntity, ITemplatePreviewEntity } from "./templatesPreviewInterfaces";
3
3
  import StateModule from "../base/stateModule";
4
4
  /**
5
5
  * Controllers for working with template objects for preview
@@ -23,7 +23,7 @@ export default class TemplatePreviewsApi extends AsyncModules implements ITempla
23
23
  *
24
24
  * @returns Returns a TemplatePreviewsEntity object
25
25
  */
26
- getTemplatePreviewById(id: number, langCode?: string): Promise<ITemplatesPreviewEntity>;
26
+ getTemplatePreviewById(id: number, langCode?: string): Promise<ITemplatePreviewEntity>;
27
27
  /**
28
28
  * Get one template object by marker.
29
29
  *
@@ -32,5 +32,5 @@ export default class TemplatePreviewsApi extends AsyncModules implements ITempla
32
32
  *
33
33
  * @returns Returns a TemplatePreviewsEntity object
34
34
  */
35
- getTemplatePreviewByMarker(marker: string, langCode?: string): Promise<ITemplatesPreviewEntity>;
35
+ getTemplatePreviewByMarker(marker: string, langCode?: string): Promise<ITemplatePreviewEntity>;
36
36
  }
@@ -9,8 +9,8 @@
9
9
  */
10
10
  interface ITemplatesPreview {
11
11
  getTemplatePreviews(langCode: string): Promise<Array<ITemplatesPreviewEntity>>;
12
- getTemplatePreviewById(id: number, langCode: string): Promise<ITemplatesPreviewEntity>;
13
- getTemplatePreviewByMarker(marker: string, langCode: string): Promise<ITemplatesPreviewEntity>;
12
+ getTemplatePreviewById(id: number, langCode: string): Promise<ITemplatePreviewEntity>;
13
+ getTemplatePreviewByMarker(marker: string, langCode: string): Promise<ITemplatePreviewEntity>;
14
14
  }
15
15
  /**
16
16
  * Represents a template preview entity object.
@@ -37,17 +37,40 @@ interface ITemplatesPreviewEntity {
37
37
  title: string;
38
38
  position: number;
39
39
  }
40
+ /**
41
+ * Represents a template preview entity object.
42
+ *
43
+ * @interface
44
+ * @property {number} id - The unique identifier of the position.
45
+ * @property {Date | string} updatedDate - The date of last updated.
46
+ * @property {string} identifier - The textual identifier for the record field.
47
+ * @property {object} proportion - Object contains info by proportion template preview.
48
+ * @property {Record<string, any>} localizeInfos - The name of the template, taking into account localization.
49
+ * @property {number} position - The position of the object.
50
+ *
51
+ */
52
+ interface ITemplatePreviewEntity {
53
+ id: number;
54
+ updatedDate: string | Date;
55
+ version: number;
56
+ identifier: string;
57
+ proportion: {
58
+ horizontal: IProportion | null;
59
+ vertical: IProportion | null;
60
+ square: ISquare;
61
+ };
62
+ title: string;
63
+ position: number;
64
+ }
40
65
  interface IProportion {
41
66
  height: number | null;
42
67
  weight: number | null;
43
68
  marker: string;
44
- title: string;
45
69
  alignmentType: string;
46
70
  }
47
71
  interface ISquare {
48
72
  marker: string;
49
- title: string;
50
73
  slide: number;
51
74
  alignmentType: string;
52
75
  }
53
- export { ITemplatesPreview, ITemplatesPreviewEntity, ISquare, IProportion, };
76
+ export { ITemplatesPreview, ITemplatesPreviewEntity, ISquare, IProportion, ITemplatePreviewEntity };
@@ -39,5 +39,5 @@ export default class UsersApi extends AsyncModules implements IUsers {
39
39
  * }
40
40
  * }
41
41
  */
42
- updateUser(data: IUserBody, langCode?: string): Promise<any>;
42
+ updateUser(data: IUserBody, langCode?: string): Promise<boolean>;
43
43
  }
@@ -44,7 +44,9 @@ class UsersApi extends asyncModules_1.default {
44
44
  * }
45
45
  */
46
46
  async updateUser(data, langCode = this.state.lang) {
47
- const result = await this._fetchPut('', this._normalizePostBody(data));
47
+ if (!('langCode' in data))
48
+ data['langCode'] = langCode;
49
+ const result = await this._fetchPut('/me', this._normalizePostBody(data, langCode));
48
50
  return result;
49
51
  }
50
52
  }
@@ -7,7 +7,7 @@ import { IAuthFormData } from "../auth-provider/authProvidersInterfaces";
7
7
  */
8
8
  interface IUsers {
9
9
  getUser(langCode?: string): Promise<IUserEntity>;
10
- updateUser(data: IUserBody, langCode?: string): Promise<any>;
10
+ updateUser(data: IUserBody, langCode?: string): Promise<boolean>;
11
11
  }
12
12
  interface IUserEntity {
13
13
  id: number;
@@ -18,13 +18,16 @@ interface IUserEntity {
18
18
  }
19
19
  interface IUserBody {
20
20
  formIdentifier: string;
21
+ langCode?: string;
21
22
  authData: Array<{
22
- marker: 'login' | 'password';
23
+ marker: string;
23
24
  value: string;
24
25
  }>;
25
26
  formData: IAuthFormData | Array<IAuthFormData>;
26
27
  notificationData: {
27
- [key: string]: string;
28
+ email: string;
29
+ phonePush: string;
30
+ phoneSMS: string;
28
31
  };
29
32
  }
30
33
  export { IUsers, IUserEntity, IUserBody, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.70",
3
+ "version": "1.0.71",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "bin": {
14
14
  "oneentry": "./configure.js"
15
15
  },
16
- "author": "ONEENTRY PORTAL CO.",
16
+ "author": "ONEENTRY ",
17
17
  "license": "ISC",
18
18
  "dependencies": {
19
19
  "jsdoc": "^4.0.2"