oneentry 1.0.176 → 1.0.178

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.
Files changed (199) hide show
  1. package/README.md +12 -5
  2. package/changelog.md +116 -0
  3. package/dist/admins/adminsApi.js +2 -9
  4. package/dist/admins/adminsInterfaces.d.ts +5 -5
  5. package/dist/admins/adminsSchemas.d.ts +4 -4
  6. package/dist/admins/adminsSchemas.js +2 -2
  7. package/dist/attribute-sets/attributeSetsApi.d.ts +1 -1
  8. package/dist/attribute-sets/attributeSetsApi.js +4 -4
  9. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +65 -14
  10. package/dist/attribute-sets/attributeSetsSchemas.d.ts +8 -6
  11. package/dist/attribute-sets/attributeSetsSchemas.js +6 -9
  12. package/dist/auth-provider/authProviderApi.d.ts +4 -4
  13. package/dist/auth-provider/authProviderApi.js +90 -23
  14. package/dist/auth-provider/authProviderSchemas.d.ts +1 -0
  15. package/dist/auth-provider/authProviderSchemas.js +1 -0
  16. package/dist/auth-provider/authProvidersInterfaces.d.ts +8 -6
  17. package/dist/base/asyncModules.d.ts +62 -1
  18. package/dist/base/asyncModules.js +219 -37
  19. package/dist/base/stateModule.d.ts +2 -0
  20. package/dist/base/stateModule.js +22 -12
  21. package/dist/base/syncModules.d.ts +18 -10
  22. package/dist/base/syncModules.js +100 -29
  23. package/dist/base/utils.d.ts +26 -21
  24. package/dist/base/validation.d.ts +3 -3
  25. package/dist/base/validation.js +6 -7
  26. package/dist/blocks/blocksApi.d.ts +20 -17
  27. package/dist/blocks/blocksApi.js +82 -64
  28. package/dist/blocks/blocksInterfaces.d.ts +8 -8
  29. package/dist/discounts/discountsApi.d.ts +9 -7
  30. package/dist/discounts/discountsApi.js +16 -13
  31. package/dist/discounts/discountsInterfaces.d.ts +14 -10
  32. package/dist/events/eventsApi.d.ts +3 -3
  33. package/dist/events/eventsApi.js +3 -3
  34. package/dist/events/eventsInterfaces.d.ts +10 -14
  35. package/dist/file-uploading/fileUploadingApi.d.ts +4 -4
  36. package/dist/file-uploading/fileUploadingApi.js +13 -5
  37. package/dist/file-uploading/fileUploadingInterfaces.d.ts +5 -6
  38. package/dist/filters/filtersApi.js +2 -2
  39. package/dist/forms/formsApi.js +2 -2
  40. package/dist/forms/formsInterfaces.d.ts +1 -3
  41. package/dist/forms/formsSchemas.d.ts +3 -6
  42. package/dist/forms/formsSchemas.js +2 -4
  43. package/dist/forms-data/formsDataApi.d.ts +27 -1
  44. package/dist/forms-data/formsDataApi.js +119 -68
  45. package/dist/forms-data/formsDataInterfaces.d.ts +17 -13
  46. package/dist/general-types/generalTypesInterfaces.d.ts +1 -1
  47. package/dist/index.d.ts +7 -6
  48. package/dist/index.js +50 -7
  49. package/dist/integration-collections/integrationCollectionsApi.d.ts +15 -4
  50. package/dist/integration-collections/integrationCollectionsApi.js +41 -14
  51. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +8 -9
  52. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +0 -2
  53. package/dist/integration-collections/integrationCollectionsSchemas.js +0 -1
  54. package/dist/menus/menusApi.js +1 -1
  55. package/dist/orders/ordersApi.d.ts +1 -13
  56. package/dist/orders/ordersApi.js +21 -42
  57. package/dist/orders/ordersInterfaces.d.ts +21 -14
  58. package/dist/pages/pagesApi.d.ts +8 -6
  59. package/dist/pages/pagesApi.js +48 -33
  60. package/dist/pages/pagesInterfaces.d.ts +20 -16
  61. package/dist/pages/pagesSchemas.d.ts +0 -3
  62. package/dist/pages/pagesSchemas.js +0 -1
  63. package/dist/payments/paymentsApi.d.ts +10 -11
  64. package/dist/payments/paymentsApi.js +22 -18
  65. package/dist/payments/paymentsInterfaces.d.ts +12 -14
  66. package/dist/payments/paymentsSchemas.d.ts +21 -20
  67. package/dist/payments/paymentsSchemas.js +5 -8
  68. package/dist/product-statuses/productStatusesApi.d.ts +1 -1
  69. package/dist/product-statuses/productStatusesApi.js +3 -3
  70. package/dist/product-statuses/productStatusesInterfaces.d.ts +1 -4
  71. package/dist/products/productsApi.d.ts +50 -64
  72. package/dist/products/productsApi.js +79 -80
  73. package/dist/products/productsInterfaces.d.ts +59 -90
  74. package/dist/search/searchApi.d.ts +3 -2
  75. package/dist/search/searchApi.js +7 -4
  76. package/dist/search/searchInterfaces.d.ts +2 -1
  77. package/dist/sitemap/sitemapInterfaces.d.ts +10 -6
  78. package/dist/subscriptions/subscriptionsApi.d.ts +1 -1
  79. package/dist/subscriptions/subscriptionsApi.js +1 -1
  80. package/dist/subscriptions/subscriptionsInterfaces.d.ts +1 -1
  81. package/dist/system/systemApi.d.ts +2 -0
  82. package/dist/system/systemApi.js +2 -0
  83. package/dist/system/systemInterfaces.d.ts +2 -0
  84. package/dist/templates/templatesApi.d.ts +2 -2
  85. package/dist/templates/templatesApi.js +12 -11
  86. package/dist/templates/templatesInterfaces.d.ts +2 -2
  87. package/dist/templates-preview/templatesPreviewApi.js +2 -2
  88. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +23 -13
  89. package/dist/templates-preview/templatesPreviewSchemas.d.ts +7 -0
  90. package/dist/templates-preview/templatesPreviewSchemas.js +2 -0
  91. package/dist/user-groups/userGroupsApi.js +5 -5
  92. package/dist/user-groups/userGroupsSchemas.d.ts +4 -4
  93. package/dist/users/usersApi.d.ts +1 -1
  94. package/dist/users/usersApi.js +28 -15
  95. package/dist/users/usersInterfaces.d.ts +2 -9
  96. package/dist/web-socket/lazySocket.d.ts +6 -5
  97. package/dist/web-socket/lazySocket.js +212 -15
  98. package/dist/web-socket/wsApi.d.ts +7 -4
  99. package/dist/web-socket/wsApi.js +49 -12
  100. package/dist/web-socket/wsInterfaces.d.ts +41 -4
  101. package/esm/admins/adminsApi.js +2 -9
  102. package/esm/admins/adminsInterfaces.d.ts +5 -5
  103. package/esm/admins/adminsSchemas.d.ts +4 -4
  104. package/esm/admins/adminsSchemas.js +2 -2
  105. package/esm/attribute-sets/attributeSetsApi.d.ts +1 -1
  106. package/esm/attribute-sets/attributeSetsApi.js +4 -4
  107. package/esm/attribute-sets/attributeSetsInterfaces.d.ts +65 -14
  108. package/esm/attribute-sets/attributeSetsSchemas.d.ts +8 -6
  109. package/esm/attribute-sets/attributeSetsSchemas.js +6 -9
  110. package/esm/auth-provider/authProviderApi.d.ts +4 -4
  111. package/esm/auth-provider/authProviderApi.js +90 -23
  112. package/esm/auth-provider/authProviderSchemas.d.ts +1 -0
  113. package/esm/auth-provider/authProviderSchemas.js +1 -0
  114. package/esm/auth-provider/authProvidersInterfaces.d.ts +8 -6
  115. package/esm/base/asyncModules.d.ts +62 -1
  116. package/esm/base/asyncModules.js +219 -37
  117. package/esm/base/stateModule.d.ts +2 -0
  118. package/esm/base/stateModule.js +22 -12
  119. package/esm/base/syncModules.d.ts +18 -10
  120. package/esm/base/syncModules.js +99 -29
  121. package/esm/base/utils.d.ts +26 -21
  122. package/esm/base/validation.d.ts +3 -3
  123. package/esm/base/validation.js +6 -7
  124. package/esm/blocks/blocksApi.d.ts +20 -17
  125. package/esm/blocks/blocksApi.js +82 -64
  126. package/esm/blocks/blocksInterfaces.d.ts +8 -8
  127. package/esm/discounts/discountsApi.d.ts +9 -7
  128. package/esm/discounts/discountsApi.js +16 -13
  129. package/esm/discounts/discountsInterfaces.d.ts +14 -10
  130. package/esm/events/eventsApi.d.ts +3 -3
  131. package/esm/events/eventsApi.js +3 -3
  132. package/esm/events/eventsInterfaces.d.ts +10 -14
  133. package/esm/file-uploading/fileUploadingApi.d.ts +4 -4
  134. package/esm/file-uploading/fileUploadingApi.js +13 -5
  135. package/esm/file-uploading/fileUploadingInterfaces.d.ts +5 -6
  136. package/esm/filters/filtersApi.js +2 -2
  137. package/esm/forms/formsApi.js +2 -2
  138. package/esm/forms/formsInterfaces.d.ts +1 -3
  139. package/esm/forms/formsSchemas.d.ts +3 -6
  140. package/esm/forms/formsSchemas.js +2 -4
  141. package/esm/forms-data/formsDataApi.d.ts +27 -1
  142. package/esm/forms-data/formsDataApi.js +119 -68
  143. package/esm/forms-data/formsDataInterfaces.d.ts +17 -13
  144. package/esm/general-types/generalTypesInterfaces.d.ts +1 -1
  145. package/esm/index.d.ts +7 -6
  146. package/esm/index.js +50 -7
  147. package/esm/integration-collections/integrationCollectionsApi.d.ts +15 -4
  148. package/esm/integration-collections/integrationCollectionsApi.js +41 -14
  149. package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +8 -9
  150. package/esm/integration-collections/integrationCollectionsSchemas.d.ts +0 -2
  151. package/esm/integration-collections/integrationCollectionsSchemas.js +0 -1
  152. package/esm/menus/menusApi.js +1 -1
  153. package/esm/orders/ordersApi.d.ts +1 -13
  154. package/esm/orders/ordersApi.js +21 -42
  155. package/esm/orders/ordersInterfaces.d.ts +21 -14
  156. package/esm/pages/pagesApi.d.ts +8 -6
  157. package/esm/pages/pagesApi.js +48 -33
  158. package/esm/pages/pagesInterfaces.d.ts +20 -16
  159. package/esm/pages/pagesSchemas.d.ts +0 -3
  160. package/esm/pages/pagesSchemas.js +0 -1
  161. package/esm/payments/paymentsApi.d.ts +10 -11
  162. package/esm/payments/paymentsApi.js +22 -18
  163. package/esm/payments/paymentsInterfaces.d.ts +12 -14
  164. package/esm/payments/paymentsSchemas.d.ts +21 -20
  165. package/esm/payments/paymentsSchemas.js +5 -8
  166. package/esm/product-statuses/productStatusesApi.d.ts +1 -1
  167. package/esm/product-statuses/productStatusesApi.js +3 -3
  168. package/esm/product-statuses/productStatusesInterfaces.d.ts +1 -4
  169. package/esm/products/productsApi.d.ts +50 -64
  170. package/esm/products/productsApi.js +79 -80
  171. package/esm/products/productsInterfaces.d.ts +59 -90
  172. package/esm/search/searchApi.d.ts +3 -2
  173. package/esm/search/searchApi.js +7 -4
  174. package/esm/search/searchInterfaces.d.ts +2 -1
  175. package/esm/sitemap/sitemapInterfaces.d.ts +10 -6
  176. package/esm/subscriptions/subscriptionsApi.d.ts +1 -1
  177. package/esm/subscriptions/subscriptionsApi.js +1 -1
  178. package/esm/subscriptions/subscriptionsInterfaces.d.ts +1 -1
  179. package/esm/system/systemApi.d.ts +2 -0
  180. package/esm/system/systemApi.js +2 -0
  181. package/esm/system/systemInterfaces.d.ts +2 -0
  182. package/esm/templates/templatesApi.d.ts +2 -2
  183. package/esm/templates/templatesApi.js +11 -10
  184. package/esm/templates/templatesInterfaces.d.ts +2 -2
  185. package/esm/templates-preview/templatesPreviewApi.js +2 -2
  186. package/esm/templates-preview/templatesPreviewInterfaces.d.ts +23 -13
  187. package/esm/templates-preview/templatesPreviewSchemas.d.ts +7 -0
  188. package/esm/templates-preview/templatesPreviewSchemas.js +2 -0
  189. package/esm/user-groups/userGroupsApi.js +5 -5
  190. package/esm/user-groups/userGroupsSchemas.d.ts +4 -4
  191. package/esm/users/usersApi.d.ts +1 -1
  192. package/esm/users/usersApi.js +28 -15
  193. package/esm/users/usersInterfaces.d.ts +2 -9
  194. package/esm/web-socket/lazySocket.d.ts +6 -5
  195. package/esm/web-socket/lazySocket.js +212 -15
  196. package/esm/web-socket/wsApi.d.ts +7 -4
  197. package/esm/web-socket/wsApi.js +49 -12
  198. package/esm/web-socket/wsInterfaces.d.ts +41 -4
  199. package/package.json +2 -2
@@ -17,7 +17,7 @@ interface ITemplatesApi {
17
17
  /**
18
18
  * Get template objects by type.
19
19
  * @handleName getTemplateByType
20
- * @param {BlockType} type - Type of templates to fetch. Example: "product".
20
+ * @param {BlockType} type - Type of templates to fetch. Example: "product_block". A type with no templates gives an empty array.
21
21
  * @param {string} [langCode] - Language code. Default: "en_US".
22
22
  * @returns {ITemplateEntity[]} Array of `ITemplateEntity` objects of the given type.
23
23
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
@@ -44,7 +44,7 @@ interface ITemplatesApi {
44
44
  * @property {number} generalTypeId - ID of the general type. Example: 67890.
45
45
  * @property {string} identifier - Text identifier (marker) of the object. Example: "template_12345".
46
46
  * @property {number} version - Version number of the object; changes with each update. Example: 1.
47
- * @property {BlockType} generalTypeName - General type name. Example: "product".
47
+ * @property {BlockType} generalTypeName - General type name. Example: "product_block".
48
48
  * @property {IAttributeValues} attributeValues - Attribute values keyed by marker; an empty object when there are none.
49
49
  * @example
50
50
  {
@@ -64,7 +64,7 @@ class TemplatePreviewsApi extends asyncModules_1.default {
64
64
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates-preview/getTemplatePreviews getTemplatePreviews} documentation.
65
65
  */
66
66
  async getTemplatePreviews(langCode = this.state.lang) {
67
- const result = await this._fetchGet(`?langCode=${langCode}`);
67
+ const result = await this._fetchGet(`?langCode=${encodeURIComponent(langCode)}`);
68
68
  // Validate response if validation is enabled
69
69
  const validated = await this._validateResponse(result, schema('TemplatePreviewsResponseSchema'));
70
70
  return this._normalizeData(validated, langCode);
@@ -80,7 +80,7 @@ class TemplatePreviewsApi extends asyncModules_1.default {
80
80
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates-preview/getTemplatePreviewByMarker getTemplatePreviewByMarker} documentation.
81
81
  */
82
82
  async getTemplatePreviewByMarker(marker, langCode = this.state.lang) {
83
- const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
83
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${encodeURIComponent(langCode)}`);
84
84
  // Validate response if validation is enabled
85
85
  const validated = await this._validateResponse(result, schema('TemplatePreviewEntitySchema'));
86
86
  return this._normalizeData(validated, langCode);
@@ -27,46 +27,52 @@ interface ITemplatesPreviewApi {
27
27
  * @interface ITemplatesPreviewEntity
28
28
  * @property {number} id - ID of the object. Example: 3.
29
29
  * @property {string} title - Name of the preview template. Example: "Product Template".
30
- * @property {object} proportions - Preview proportions: the horizontal, vertical and square variants.
30
+ * @property {object} proportions - Preview proportions: the horizontal, vertical and square variants under `default`.
31
31
  * @example
32
32
  {
33
33
  "default": {
34
34
  "horizontal": {
35
35
  "width": 234,
36
36
  "height": 324,
37
- "alignmentType": "middleBottom"
37
+ "alignmentType": "middleBottom",
38
+ "weight": 234
38
39
  },
39
40
  "vertical": {
40
41
  "width": 2,
41
42
  "height": 3,
42
- "alignmentType": "leftTop"
43
+ "alignmentType": "leftTop",
44
+ "weight": 2
43
45
  },
44
46
  "square": {
45
- "side": 3,
46
- "alignmentType": "leftTop"
47
- }
47
+ "side": 360,
48
+ "alignmentType": "middleMiddle"
49
+ },
50
+ "default": true
48
51
  }
49
52
  }
50
- * @property {IProportion | null} proportions.horizontal - Horizontal proportion of the preview.
53
+ * @property {IProportion | null} proportions.default.horizontal - Horizontal proportion of the preview.
51
54
  * @example
52
55
  {
53
56
  "width": 234,
54
57
  "height": 324,
55
- "alignmentType": "middleBottom"
58
+ "alignmentType": "middleBottom",
59
+ "weight": 234
56
60
  }
57
- * @property {IProportion | null} proportions.vertical - Vertical variant of the preview, or `null`.
61
+ * @property {IProportion | null} proportions.default.vertical - Vertical variant of the preview, or `null`.
58
62
  * @example
59
63
  {
60
64
  "width": 2,
61
65
  "height": 3,
62
- "alignmentType": "leftTop"
66
+ "alignmentType": "leftTop",
67
+ "weight": 2
63
68
  }
64
- * @property {ISquare} proportions.square - Square variant of the preview.
69
+ * @property {ISquare} proportions.default.square - Square variant of the preview.
65
70
  * @example
66
71
  {
67
- "side": 3,
68
- "alignmentType": "leftTop"
72
+ "side": 360,
73
+ "alignmentType": "middleMiddle"
69
74
  }
75
+ * @property {boolean} [proportions.default.default] - Whether these are the default proportions. Example: true.
70
76
  * @property {string} identifier - Text identifier (marker) of the object. Example: "preview-templates"
71
77
  * @property {number} version - Version number of the object; changes with each update. Example: 1.
72
78
  * @property {number} position - Position of the object, used for sorting. Example: 1.
@@ -95,12 +101,14 @@ interface ITemplatesPreviewProportions {
95
101
  * @property {IProportion | null} horizontal - Horizontal layout proportion, or null when not configured.
96
102
  * @property {IProportion | null} vertical - Vertical layout proportion, or null when not configured.
97
103
  * @property {ISquare} square - Square layout proportion.
104
+ * @property {boolean} [default] - Whether these are the default proportions. Example: true.
98
105
  * @description Layout proportion variants of a template preview.
99
106
  */
100
107
  interface ITemplatesPreviewProportionVariants {
101
108
  horizontal: IProportion | null;
102
109
  vertical: IProportion | null;
103
110
  square: ISquare;
111
+ default?: boolean;
104
112
  }
105
113
  /**
106
114
  * The `IProportion` interface defines the structure of a proportion object used in template previews.
@@ -108,12 +116,14 @@ interface ITemplatesPreviewProportionVariants {
108
116
  * @property {string | number | null} width - Width of the preview. Example: 100.
109
117
  * @property {string | number | null} height - Height of the preview. Example: 200.
110
118
  * @property {string} alignmentType - Alignment of the preview, such as `center`. Example: "center".
119
+ * @property {number | null} [weight] - Weight of the proportion; the API sends the width value. Example: 234.
111
120
  * @description Represents a proportion object used in template previews.
112
121
  */
113
122
  interface IProportion {
114
123
  width: number | null;
115
124
  height: number | null;
116
125
  alignmentType: string;
126
+ weight?: number | null;
117
127
  }
118
128
  /**
119
129
  * The `ISquare` interface defines the structure of a square proportion object used in template previews.
@@ -10,6 +10,7 @@ export declare const ProportionSchema: z.ZodObject<{
10
10
  width: z.ZodNullable<z.ZodNumber>;
11
11
  height: z.ZodNullable<z.ZodNumber>;
12
12
  alignmentType: z.ZodString;
13
+ weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
13
14
  }, z.core.$strip>;
14
15
  /**
15
16
  * Square schema
@@ -31,16 +32,19 @@ export declare const TemplatePreviewEntitySchema: z.ZodObject<{
31
32
  width: z.ZodNullable<z.ZodNumber>;
32
33
  height: z.ZodNullable<z.ZodNumber>;
33
34
  alignmentType: z.ZodString;
35
+ weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
34
36
  }, z.core.$strip>>;
35
37
  vertical: z.ZodNullable<z.ZodObject<{
36
38
  width: z.ZodNullable<z.ZodNumber>;
37
39
  height: z.ZodNullable<z.ZodNumber>;
38
40
  alignmentType: z.ZodString;
41
+ weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
39
42
  }, z.core.$strip>>;
40
43
  square: z.ZodObject<{
41
44
  side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
42
45
  alignmentType: z.ZodString;
43
46
  }, z.core.$strip>;
47
+ default: z.ZodOptional<z.ZodBoolean>;
44
48
  }, z.core.$strip>;
45
49
  }, z.core.$strip>;
46
50
  identifier: z.ZodString;
@@ -60,16 +64,19 @@ export declare const TemplatePreviewsResponseSchema: z.ZodArray<z.ZodObject<{
60
64
  width: z.ZodNullable<z.ZodNumber>;
61
65
  height: z.ZodNullable<z.ZodNumber>;
62
66
  alignmentType: z.ZodString;
67
+ weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
63
68
  }, z.core.$strip>>;
64
69
  vertical: z.ZodNullable<z.ZodObject<{
65
70
  width: z.ZodNullable<z.ZodNumber>;
66
71
  height: z.ZodNullable<z.ZodNumber>;
67
72
  alignmentType: z.ZodString;
73
+ weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
68
74
  }, z.core.$strip>>;
69
75
  square: z.ZodObject<{
70
76
  side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
71
77
  alignmentType: z.ZodString;
72
78
  }, z.core.$strip>;
79
+ default: z.ZodOptional<z.ZodBoolean>;
73
80
  }, z.core.$strip>;
74
81
  }, z.core.$strip>;
75
82
  identifier: z.ZodString;
@@ -13,6 +13,7 @@ exports.ProportionSchema = zod_1.z.object({
13
13
  width: zod_1.z.number().nullable(),
14
14
  height: zod_1.z.number().nullable(),
15
15
  alignmentType: zod_1.z.string(),
16
+ weight: zod_1.z.number().nullable().optional(),
16
17
  });
17
18
  /**
18
19
  * Square schema
@@ -33,6 +34,7 @@ exports.TemplatePreviewEntitySchema = zod_1.z.object({
33
34
  horizontal: exports.ProportionSchema.nullable(),
34
35
  vertical: exports.ProportionSchema.nullable(),
35
36
  square: exports.SquareSchema,
37
+ default: zod_1.z.boolean().optional(),
36
38
  }),
37
39
  }),
38
40
  identifier: zod_1.z.string(),
@@ -72,7 +72,7 @@ class UserGroupsApi extends asyncModules_1.default {
72
72
  * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroups getUserGroups} documentation.
73
73
  */
74
74
  async getUserGroups(langCode = this.state.lang) {
75
- const result = await this._fetchGet(`/?langCode=${langCode}`);
75
+ const result = await this._fetchGet(`/?langCode=${encodeURIComponent(langCode)}`);
76
76
  // Validate response if validation is enabled
77
77
  const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
78
78
  return this._normalizeData(validated, langCode);
@@ -87,7 +87,7 @@ class UserGroupsApi extends asyncModules_1.default {
87
87
  * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getRootUserGroups getRootUserGroups} documentation.
88
88
  */
89
89
  async getRootUserGroups(langCode = this.state.lang) {
90
- const result = await this._fetchGet(`/root?langCode=${langCode}`);
90
+ const result = await this._fetchGet(`/root?langCode=${encodeURIComponent(langCode)}`);
91
91
  // Validate response if validation is enabled
92
92
  const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
93
93
  return this._normalizeData(validated, langCode);
@@ -103,7 +103,7 @@ class UserGroupsApi extends asyncModules_1.default {
103
103
  * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroupById getUserGroupById} documentation.
104
104
  */
105
105
  async getUserGroupById(id, langCode = this.state.lang) {
106
- const result = await this._fetchGet(`/${id}?langCode=${langCode}`);
106
+ const result = await this._fetchGet(`/${this._pathSegment(String(id))}?langCode=${encodeURIComponent(langCode)}`);
107
107
  // Validate response if validation is enabled
108
108
  const validated = await this._validateResponse(result, schema('UserGroupEntitySchema'));
109
109
  return this._normalizeData(validated, langCode);
@@ -119,7 +119,7 @@ class UserGroupsApi extends asyncModules_1.default {
119
119
  * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroupByMarker getUserGroupByMarker} documentation.
120
120
  */
121
121
  async getUserGroupByMarker(marker, langCode = this.state.lang) {
122
- const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
122
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${encodeURIComponent(langCode)}`);
123
123
  // Validate response if validation is enabled
124
124
  const validated = await this._validateResponse(result, schema('UserGroupEntitySchema'));
125
125
  return this._normalizeData(validated, langCode);
@@ -136,7 +136,7 @@ class UserGroupsApi extends asyncModules_1.default {
136
136
  * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getChildUserGroupsByMarker getChildUserGroupsByMarker} documentation.
137
137
  */
138
138
  async getChildUserGroupsByMarker(marker, langCode = this.state.lang) {
139
- const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/children?langCode=${langCode}`);
139
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/children?langCode=${encodeURIComponent(langCode)}`);
140
140
  // Validate response if validation is enabled
141
141
  const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
142
142
  return this._normalizeData(validated, langCode);
@@ -17,11 +17,11 @@ export declare const UserGroupEntitySchema: z.ZodObject<{
17
17
  localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodObject<{
18
18
  title: z.ZodString;
19
19
  content: z.ZodOptional<z.ZodString>;
20
- menuTitle: z.ZodOptional<z.ZodString>;
20
+ menuTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
21
  }, z.core.$strip>>, z.ZodObject<{
22
22
  title: z.ZodString;
23
23
  content: z.ZodOptional<z.ZodString>;
24
- menuTitle: z.ZodOptional<z.ZodString>;
24
+ menuTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
25
  }, z.core.$strip>]>;
26
26
  isVisible: z.ZodBoolean;
27
27
  childrenCount: z.ZodString;
@@ -40,11 +40,11 @@ export declare const UserGroupsResponseSchema: z.ZodArray<z.ZodObject<{
40
40
  localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodObject<{
41
41
  title: z.ZodString;
42
42
  content: z.ZodOptional<z.ZodString>;
43
- menuTitle: z.ZodOptional<z.ZodString>;
43
+ menuTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
44
  }, z.core.$strip>>, z.ZodObject<{
45
45
  title: z.ZodString;
46
46
  content: z.ZodOptional<z.ZodString>;
47
- menuTitle: z.ZodOptional<z.ZodString>;
47
+ menuTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
48
  }, z.core.$strip>]>;
49
49
  isVisible: z.ZodBoolean;
50
50
  childrenCount: z.ZodString;
@@ -58,7 +58,7 @@ export default class UsersApi extends AsyncModules implements IUsersApi {
58
58
  },
59
59
  "state": {}
60
60
  }
61
- * @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg_form".
61
+ * @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg".
62
62
  * @param {string} body.authData - Contains authentication credentials for the user. Example:
63
63
  * @example
64
64
  [
@@ -65,10 +65,21 @@ class UsersApi extends asyncModules_1.default {
65
65
  * @see {@link https://js-sdk.oneentry.cloud/docs/users/getUser getUser} documentation.
66
66
  */
67
67
  async getUser(langCode = this.state.lang) {
68
- const result = await this._fetchGet(`/me?langCode=${langCode}`);
68
+ const result = await this._fetchGet(`/me?langCode=${encodeURIComponent(langCode)}`);
69
69
  // Validate response if validation is enabled
70
70
  const validated = await this._validateResponse(result, schema('UserResponseSchema'));
71
- return this._normalizeData(validated);
71
+ // `state` is the caller's own data, stored as written: the normalizer took a
72
+ // `{ en_US: … }` map in it for a localization and `{ type, value }` for an attribute.
73
+ // It is kept out of the normalization altogether — `{ attributes: { x: 's' } }`
74
+ // in it made `getUser` throw a TypeError.
75
+ if (validated &&
76
+ typeof validated === 'object' &&
77
+ !this._isErrorResponse(validated) &&
78
+ 'state' in validated) {
79
+ const { state, ...rest } = validated;
80
+ return { ...this._normalizeData(rest, langCode), state };
81
+ }
82
+ return this._normalizeData(validated, langCode);
72
83
  }
73
84
  /**
74
85
  * Updating a single user object.
@@ -101,7 +112,7 @@ class UsersApi extends asyncModules_1.default {
101
112
  },
102
113
  "state": {}
103
114
  }
104
- * @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg_form".
115
+ * @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg".
105
116
  * @param {string} body.authData - Contains authentication credentials for the user. Example:
106
117
  * @example
107
118
  [
@@ -149,8 +160,13 @@ class UsersApi extends asyncModules_1.default {
149
160
  async updateUser(body, langCode = this.state.lang) {
150
161
  // The language goes onto our own copy; the caller's body is left alone (CMS-909).
151
162
  const payload = 'langCode' in body ? body : { ...body, langCode };
152
- const result = await this._fetchPut('/me', this._normalizePostBody(payload, langCode));
153
- const validated = await this._validateResponse(result, schema('UpdateUserResponseSchema'));
163
+ // formData is wrapped under the language of the body: a `langCode: 'ru_RU'` in the
164
+ // body used to be sent with the fields under `en_US`
165
+ const bodyLang = payload.langCode || langCode;
166
+ const result = await this._fetchPut('/me', this._normalizePostBody(payload, bodyLang));
167
+ // An empty 2xx body comes back as `{}`; the method declares `true`. Read before
168
+ // validation: in strict mode the boolean schema turned that success into a 422
169
+ const validated = await this._validateResponse(this._asBoolean(result), schema('UpdateUserResponseSchema'));
154
170
  return validated;
155
171
  }
156
172
  /**
@@ -163,8 +179,8 @@ class UsersApi extends asyncModules_1.default {
163
179
  * @see {@link https://js-sdk.oneentry.cloud/docs/users/archiveUser archiveUser} documentation.
164
180
  */
165
181
  async archiveUser() {
166
- const result = await this._fetchDelete('/me');
167
- return result;
182
+ // An empty 2xx body came back as `{}`; the method declares `true`
183
+ return this._fetchBoolean(() => this._fetchDelete('/me'));
168
184
  }
169
185
  /**
170
186
  * Delete a single user.
@@ -176,8 +192,7 @@ class UsersApi extends asyncModules_1.default {
176
192
  * @see {@link https://js-sdk.oneentry.cloud/docs/users/deleteUser deleteUser} documentation.
177
193
  */
178
194
  async deleteUser() {
179
- const result = await this._fetchDelete('/me/account');
180
- return result;
195
+ return this._fetchBoolean(() => this._fetchDelete('/me/account'));
181
196
  }
182
197
  /**
183
198
  * Adds an FCM (Firebase Cloud Messaging) token for sending push notifications.
@@ -190,8 +205,7 @@ class UsersApi extends asyncModules_1.default {
190
205
  * @see {@link https://js-sdk.oneentry.cloud/docs/users/addFCMToken addFCMToken} documentation.
191
206
  */
192
207
  async addFCMToken(token) {
193
- const result = await this._fetchPost(`/me/fcm-token/${token}`);
194
- return result;
208
+ return this._fetchBoolean(() => this._fetchPost(`/me/fcm-token/${this._pathSegment(token)}`));
195
209
  }
196
210
  /**
197
211
  * Deletes an FCM (Firebase Cloud Messaging) token.
@@ -204,8 +218,7 @@ class UsersApi extends asyncModules_1.default {
204
218
  * @see {@link https://js-sdk.oneentry.cloud/docs/users/deleteFCMToken deleteFCMToken} documentation.
205
219
  */
206
220
  async deleteFCMToken(token) {
207
- const result = await this._fetchDelete(`/me/fcm-token/${token}`);
208
- return result;
221
+ return this._fetchBoolean(() => this._fetchDelete(`/me/fcm-token/${this._pathSegment(token)}`));
209
222
  }
210
223
  /**
211
224
  * Get the current user's or guest's cart.
@@ -262,7 +275,7 @@ class UsersApi extends asyncModules_1.default {
262
275
  * @see {@link https://js-sdk.oneentry.cloud/docs/users/removeCartItem removeCartItem} documentation.
263
276
  */
264
277
  async removeCartItem(productId) {
265
- const result = await this._fetchDelete(`/me/cart/items/${productId}`);
278
+ const result = await this._fetchDelete(`/me/cart/items/${this._pathSegment(String(productId))}`);
266
279
  const validated = await this._validateResponse(result, schema('CartResponseSchema'));
267
280
  return this._normalizeData(validated);
268
281
  }
@@ -321,7 +334,7 @@ class UsersApi extends asyncModules_1.default {
321
334
  * @see {@link https://js-sdk.oneentry.cloud/docs/users/removeWishlistItem removeWishlistItem} documentation.
322
335
  */
323
336
  async removeWishlistItem(productId) {
324
- const result = await this._fetchDelete(`/me/wishlist/items/${productId}`);
337
+ const result = await this._fetchDelete(`/me/wishlist/items/${this._pathSegment(String(productId))}`);
325
338
  const validated = await this._validateResponse(result, schema('WishlistResponseSchema'));
326
339
  return this._normalizeData(validated);
327
340
  }
@@ -49,7 +49,7 @@ interface IUsersApi {
49
49
  },
50
50
  "state": {}
51
51
  }
52
- * @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg_form".
52
+ * @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg".
53
53
  * @param {string} body.authData - Contains authentication credentials for the user. Example:
54
54
  * @example
55
55
  [
@@ -264,13 +264,7 @@ interface IUsersResponse {
264
264
  }
265
265
  ]
266
266
  * @property {string} formIdentifier - Marker of the form. Example: "form_12345".
267
- * @property {string} [total] - Deprecated, do not rely on it. A service counter that leaks into the response of a single user: always `"1"`, it carries no data about the user. The API reference does not describe it, and the field may disappear from the response. Example: "1".
268
- * @property {Array<string | number>} groups - User groups.
269
- * @example
270
- [
271
- "group_1",
272
- "group_2"
273
- ]
267
+ * @property {Array<string | number>} groups - IDs of the user groups the user belongs to (numbers on the API). Example: [1].
274
268
  * @property {object} state - Custom key-value data stored with the user.
275
269
  * @example
276
270
  {
@@ -288,7 +282,6 @@ interface IUserEntity {
288
282
  formData: FormDataType[];
289
283
  formIdentifier: string;
290
284
  /** @deprecated Service counter leaking into the response, always `"1"`; the field may disappear. */
291
- total?: string;
292
285
  groups: Array<string | number>;
293
286
  state: Record<string, unknown>;
294
287
  moduleFormConfigs?: Array<IFormConfig>;
@@ -8,11 +8,12 @@ import type { Socket } from 'socket.io-client';
8
8
  * queued and replayed onto the real socket as soon as the chunk resolves, and every later
9
9
  * call passes straight through.
10
10
  * @param {() => Promise<Socket>} createSocket - Loads Socket.io and creates the socket.
11
- * @returns {Socket} Stand-in usable exactly like the socket it will become.
11
+ * @returns {Socket} Stand-in usable like the socket it will become.
12
12
  * @description Listener registration is what matters for ordering, and it is safe: the queue is
13
13
  * replayed in the same tick the socket is created, before the connection can deliver anything.
14
- * The one visible difference is that methods returning a value (e.g. `listeners()`) cannot answer
15
- * before the chunk arrives — they return the proxy instead. Reading state (`id`, `connected`, …)
16
- * is accurate, and awaiting `socket.io` or other nested objects is only possible once loaded.
14
+ * Before the chunk arrives: `emitWithAck` returns a Promise settled by the real socket,
15
+ * `hasListeners`/`listeners` answer from the queued listeners, `socket.io.on(…)` and `volatile` are
16
+ * queued, assignments (e.g. `socket.auth = …`) are applied to the real socket, and other properties
17
+ * read `undefined`. A failed chunk load is reported to the `connect_error` listeners.
17
18
  */
18
- export default function createLazySocket(createSocket: () => Promise<Socket>): Socket;
19
+ export default function createLazySocket<S extends Socket = Socket>(createSocket: () => Promise<S>): S;