oneentry 1.0.159 → 1.0.161

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 (222) hide show
  1. package/README.md +2 -0
  2. package/changelog.md +56 -1
  3. package/dist/admins/adminsApi.d.ts +15 -1
  4. package/dist/admins/adminsApi.js +29 -0
  5. package/dist/admins/adminsInterfaces.d.ts +37 -1
  6. package/dist/base/lazySchema.d.ts +15 -0
  7. package/dist/base/lazySchema.js +20 -0
  8. package/dist/discounts/discountsApi.d.ts +14 -1
  9. package/dist/discounts/discountsApi.js +21 -0
  10. package/dist/discounts/discountsInterfaces.d.ts +27 -1
  11. package/dist/filters/filtersInterfaces.d.ts +2 -2
  12. package/dist/filters/filtersSchemas.d.ts +1 -1
  13. package/dist/filters/filtersSchemas.js +4 -1
  14. package/dist/forms-data/formsDataApi.d.ts +14 -1
  15. package/dist/forms-data/formsDataApi.js +21 -0
  16. package/dist/forms-data/formsDataInterfaces.d.ts +74 -1
  17. package/dist/index.d.ts +4 -0
  18. package/dist/index.js +3 -0
  19. package/dist/orders/ordersApi.d.ts +15 -1
  20. package/dist/orders/ordersApi.js +22 -0
  21. package/dist/orders/ordersInterfaces.d.ts +27 -1
  22. package/dist/pages/pagesApi.d.ts +14 -1
  23. package/dist/pages/pagesApi.js +21 -0
  24. package/dist/pages/pagesInterfaces.d.ts +38 -1
  25. package/dist/payments/paymentsInterfaces.d.ts +2 -2
  26. package/dist/products/productsInterfaces.d.ts +1 -1
  27. package/dist/search/searchApi.d.ts +35 -0
  28. package/dist/search/searchApi.js +86 -0
  29. package/dist/search/searchInterfaces.d.ts +94 -0
  30. package/dist/search/searchInterfaces.js +2 -0
  31. package/dist/search/searchSchemas.d.ts +73 -0
  32. package/dist/search/searchSchemas.js +44 -0
  33. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -2
  34. package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -2
  35. package/dist/templates-preview/templatesPreviewSchemas.js +0 -1
  36. package/dist/types.d.ts +35 -0
  37. package/dist/types.js +2 -0
  38. package/dist/users/usersApi.d.ts +15 -1
  39. package/dist/users/usersApi.js +22 -0
  40. package/dist/users/usersInterfaces.d.ts +39 -1
  41. package/dist/web-socket/lazySocket.d.ts +18 -0
  42. package/dist/web-socket/lazySocket.js +70 -0
  43. package/esm/admins/adminsApi.d.ts +66 -0
  44. package/esm/admins/adminsApi.js +90 -0
  45. package/esm/admins/adminsInterfaces.d.ts +137 -0
  46. package/esm/admins/adminsInterfaces.js +1 -0
  47. package/esm/admins/adminsSchemas.d.ts +48 -0
  48. package/esm/admins/adminsSchemas.js +31 -0
  49. package/esm/attribute-sets/attributeSetsApi.d.ts +67 -0
  50. package/esm/attribute-sets/attributeSetsApi.js +97 -0
  51. package/esm/attribute-sets/attributeSetsInterfaces.d.ts +285 -0
  52. package/esm/attribute-sets/attributeSetsInterfaces.js +1 -0
  53. package/esm/attribute-sets/attributeSetsSchemas.d.ts +84 -0
  54. package/esm/attribute-sets/attributeSetsSchemas.js +66 -0
  55. package/esm/auth-provider/authProviderApi.d.ts +262 -0
  56. package/esm/auth-provider/authProviderApi.js +362 -0
  57. package/esm/auth-provider/authProviderSchemas.d.ts +124 -0
  58. package/esm/auth-provider/authProviderSchemas.js +92 -0
  59. package/esm/auth-provider/authProvidersInterfaces.d.ts +430 -0
  60. package/esm/auth-provider/authProvidersInterfaces.js +1 -0
  61. package/esm/base/asyncModules.d.ts +123 -0
  62. package/esm/base/asyncModules.js +382 -0
  63. package/esm/base/lazySchema.d.ts +15 -0
  64. package/esm/base/lazySchema.js +17 -0
  65. package/esm/base/stateModule.d.ts +35 -0
  66. package/esm/base/stateModule.js +51 -0
  67. package/esm/base/syncModules.d.ts +245 -0
  68. package/esm/base/syncModules.js +555 -0
  69. package/esm/base/timeIntervals.d.ts +95 -0
  70. package/esm/base/timeIntervals.js +317 -0
  71. package/esm/base/utils.d.ts +354 -0
  72. package/esm/base/utils.js +1 -0
  73. package/esm/base/validation.d.ts +98 -0
  74. package/esm/base/validation.js +118 -0
  75. package/esm/blocks/blocksApi.d.ts +252 -0
  76. package/esm/blocks/blocksApi.js +394 -0
  77. package/esm/blocks/blocksInterfaces.d.ts +361 -0
  78. package/esm/blocks/blocksInterfaces.js +1 -0
  79. package/esm/blocks/blocksSchemas.d.ts +213 -0
  80. package/esm/blocks/blocksSchemas.js +40 -0
  81. package/esm/discounts/discountsApi.d.ts +94 -0
  82. package/esm/discounts/discountsApi.js +136 -0
  83. package/esm/discounts/discountsInterfaces.d.ts +293 -0
  84. package/esm/discounts/discountsInterfaces.js +1 -0
  85. package/esm/events/eventsApi.d.ts +108 -0
  86. package/esm/events/eventsApi.js +141 -0
  87. package/esm/events/eventsInterfaces.d.ts +176 -0
  88. package/esm/events/eventsInterfaces.js +1 -0
  89. package/esm/file-uploading/fileUploadingApi.d.ts +91 -0
  90. package/esm/file-uploading/fileUploadingApi.js +127 -0
  91. package/esm/file-uploading/fileUploadingInterfaces.d.ts +116 -0
  92. package/esm/file-uploading/fileUploadingInterfaces.js +1 -0
  93. package/esm/file-uploading/fileUploadingSchemas.d.ts +24 -0
  94. package/esm/file-uploading/fileUploadingSchemas.js +19 -0
  95. package/esm/filters/filtersApi.d.ts +32 -0
  96. package/esm/filters/filtersApi.js +36 -0
  97. package/esm/filters/filtersInterfaces.d.ts +56 -0
  98. package/esm/filters/filtersInterfaces.js +1 -0
  99. package/esm/filters/filtersSchemas.d.ts +32 -0
  100. package/esm/filters/filtersSchemas.js +29 -0
  101. package/esm/forms/formsApi.d.ts +44 -0
  102. package/esm/forms/formsApi.js +54 -0
  103. package/esm/forms/formsInterfaces.d.ts +237 -0
  104. package/esm/forms/formsInterfaces.js +1 -0
  105. package/esm/forms/formsSchemas.d.ts +56 -0
  106. package/esm/forms/formsSchemas.js +32 -0
  107. package/esm/forms-data/formsDataApi.d.ts +124 -0
  108. package/esm/forms-data/formsDataApi.js +210 -0
  109. package/esm/forms-data/formsDataInterfaces.d.ts +670 -0
  110. package/esm/forms-data/formsDataInterfaces.js +1 -0
  111. package/esm/forms-data/formsDataSchemas.d.ts +107 -0
  112. package/esm/forms-data/formsDataSchemas.js +83 -0
  113. package/esm/general-types/generalTypesApi.d.ts +29 -0
  114. package/esm/general-types/generalTypesApi.js +34 -0
  115. package/esm/general-types/generalTypesInterfaces.d.ts +29 -0
  116. package/esm/general-types/generalTypesInterfaces.js +1 -0
  117. package/esm/general-types/generalTypesSchemas.d.ts +68 -0
  118. package/esm/general-types/generalTypesSchemas.js +42 -0
  119. package/esm/index.d.ts +143 -0
  120. package/esm/index.js +124 -0
  121. package/esm/integration-collections/integrationCollectionsApi.d.ts +172 -0
  122. package/esm/integration-collections/integrationCollectionsApi.js +224 -0
  123. package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +317 -0
  124. package/esm/integration-collections/integrationCollectionsInterfaces.js +1 -0
  125. package/esm/integration-collections/integrationCollectionsSchemas.d.ts +84 -0
  126. package/esm/integration-collections/integrationCollectionsSchemas.js +60 -0
  127. package/esm/locales/localesApi.d.ts +28 -0
  128. package/esm/locales/localesApi.js +33 -0
  129. package/esm/locales/localesInterfaces.d.ts +40 -0
  130. package/esm/locales/localesInterfaces.js +1 -0
  131. package/esm/locales/localesSchemas.d.ts +32 -0
  132. package/esm/locales/localesSchemas.js +23 -0
  133. package/esm/menus/menusApi.d.ts +30 -0
  134. package/esm/menus/menusApi.js +35 -0
  135. package/esm/menus/menusInterfaces.d.ts +87 -0
  136. package/esm/menus/menusInterfaces.js +2 -0
  137. package/esm/menus/menusSchemas.d.ts +16 -0
  138. package/esm/menus/menusSchemas.js +25 -0
  139. package/esm/orders/ordersApi.d.ts +213 -0
  140. package/esm/orders/ordersApi.js +288 -0
  141. package/esm/orders/ordersInterfaces.d.ts +763 -0
  142. package/esm/orders/ordersInterfaces.js +1 -0
  143. package/esm/orders/ordersSchemas.d.ts +312 -0
  144. package/esm/orders/ordersSchemas.js +171 -0
  145. package/esm/package.json +4 -0
  146. package/esm/pages/pagesApi.d.ts +173 -0
  147. package/esm/pages/pagesApi.js +414 -0
  148. package/esm/pages/pagesInterfaces.d.ts +344 -0
  149. package/esm/pages/pagesInterfaces.js +1 -0
  150. package/esm/pages/pagesSchemas.d.ts +121 -0
  151. package/esm/pages/pagesSchemas.js +60 -0
  152. package/esm/payments/paymentsApi.d.ts +88 -0
  153. package/esm/payments/paymentsApi.js +122 -0
  154. package/esm/payments/paymentsInterfaces.d.ts +189 -0
  155. package/esm/payments/paymentsInterfaces.js +1 -0
  156. package/esm/payments/paymentsSchemas.d.ts +94 -0
  157. package/esm/payments/paymentsSchemas.js +53 -0
  158. package/esm/product-statuses/productStatusesApi.d.ts +50 -0
  159. package/esm/product-statuses/productStatusesApi.js +68 -0
  160. package/esm/product-statuses/productStatusesInterfaces.d.ts +62 -0
  161. package/esm/product-statuses/productStatusesInterfaces.js +1 -0
  162. package/esm/product-statuses/productStatusesSchemas.d.ts +34 -0
  163. package/esm/product-statuses/productStatusesSchemas.js +27 -0
  164. package/esm/products/productsApi.d.ts +366 -0
  165. package/esm/products/productsApi.js +468 -0
  166. package/esm/products/productsInterfaces.d.ts +723 -0
  167. package/esm/products/productsInterfaces.js +1 -0
  168. package/esm/products/productsSchemas.d.ts +234 -0
  169. package/esm/products/productsSchemas.js +121 -0
  170. package/esm/search/searchApi.d.ts +35 -0
  171. package/esm/search/searchApi.js +47 -0
  172. package/esm/search/searchInterfaces.d.ts +94 -0
  173. package/esm/search/searchInterfaces.js +1 -0
  174. package/esm/search/searchSchemas.d.ts +73 -0
  175. package/esm/search/searchSchemas.js +41 -0
  176. package/esm/sitemap/sitemapApi.d.ts +37 -0
  177. package/esm/sitemap/sitemapApi.js +41 -0
  178. package/esm/sitemap/sitemapInterfaces.d.ts +51 -0
  179. package/esm/sitemap/sitemapInterfaces.js +1 -0
  180. package/esm/subscriptions/subscriptionsApi.d.ts +74 -0
  181. package/esm/subscriptions/subscriptionsApi.js +90 -0
  182. package/esm/subscriptions/subscriptionsInterfaces.d.ts +111 -0
  183. package/esm/subscriptions/subscriptionsInterfaces.js +1 -0
  184. package/esm/subscriptions/subscriptionsSchemas.d.ts +46 -0
  185. package/esm/subscriptions/subscriptionsSchemas.js +38 -0
  186. package/esm/system/systemApi.d.ts +46 -0
  187. package/esm/system/systemApi.js +53 -0
  188. package/esm/system/systemInterfaces.d.ts +29 -0
  189. package/esm/system/systemInterfaces.js +1 -0
  190. package/esm/templates/templatesApi.d.ts +53 -0
  191. package/esm/templates/templatesApi.js +78 -0
  192. package/esm/templates/templatesInterfaces.d.ts +68 -0
  193. package/esm/templates/templatesInterfaces.js +1 -0
  194. package/esm/templates/templatesSchemas.d.ts +48 -0
  195. package/esm/templates/templatesSchemas.js +28 -0
  196. package/esm/templates-preview/templatesPreviewApi.d.ts +40 -0
  197. package/esm/templates-preview/templatesPreviewApi.js +50 -0
  198. package/esm/templates-preview/templatesPreviewInterfaces.d.ts +129 -0
  199. package/esm/templates-preview/templatesPreviewInterfaces.js +1 -0
  200. package/esm/templates-preview/templatesPreviewSchemas.d.ts +79 -0
  201. package/esm/templates-preview/templatesPreviewSchemas.js +43 -0
  202. package/esm/types.d.ts +35 -0
  203. package/esm/types.js +1 -0
  204. package/esm/user-activity/userActivityApi.d.ts +31 -0
  205. package/esm/user-activity/userActivityApi.js +37 -0
  206. package/esm/user-activity/userActivityInterfaces.d.ts +42 -0
  207. package/esm/user-activity/userActivityInterfaces.js +1 -0
  208. package/esm/users/usersApi.d.ts +249 -0
  209. package/esm/users/usersApi.js +312 -0
  210. package/esm/users/usersInterfaces.d.ts +419 -0
  211. package/esm/users/usersInterfaces.js +1 -0
  212. package/esm/users/usersSchemas.d.ts +72 -0
  213. package/esm/users/usersSchemas.js +55 -0
  214. package/esm/web-socket/lazySocket.d.ts +18 -0
  215. package/esm/web-socket/lazySocket.js +67 -0
  216. package/esm/web-socket/wsApi.d.ts +27 -0
  217. package/esm/web-socket/wsApi.js +43 -0
  218. package/esm/web-socket/wsInterfaces.d.ts +16 -0
  219. package/esm/web-socket/wsInterfaces.js +1 -0
  220. package/package.json +47 -2
  221. package/types.d.ts +1 -0
  222. package/types.js +1 -0
@@ -0,0 +1,419 @@
1
+ import type { IAuthData, IAuthFormData, INotificationData } from '../auth-provider/authProvidersInterfaces.js';
2
+ import type { IError, IRating } from '../base/utils.js';
3
+ import type { IFormConfig } from '../forms/formsInterfaces.js';
4
+ import type { FormDataType } from '../forms-data/formsDataInterfaces.js';
5
+ /**
6
+ * Interface representing user-related operations.
7
+ * @interface IUsersApi
8
+ * @description This interface defines methods for managing user data and handling Firebase Cloud Messaging tokens.
9
+ */
10
+ interface IUsersApi {
11
+ /**
12
+ * Retrieves the data of an authorized user.
13
+ * @handleName getUser
14
+ * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
15
+ * @returns {IUserEntity} A promise resolving to the user entity or an error.
16
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
17
+ * @description This method requires user authorization.
18
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
19
+ */
20
+ getUser(langCode?: string): Promise<IUserEntity | IError>;
21
+ /**
22
+ * Updating a single user object.
23
+ * @handleName updateUser
24
+ * @param {IUserBody} body - Request body.
25
+ * @example
26
+ {
27
+ "formIdentifier": "reg",
28
+ "authData": [
29
+ {
30
+ "marker": "email_reg",
31
+ "value": "your-email@oneentery.cloud"
32
+ },
33
+ {
34
+ "marker": "password_reg",
35
+ "value": "12345"
36
+ }
37
+ ],
38
+ "formData": [
39
+ {
40
+ "marker": "last_name",
41
+ "type": "string",
42
+ "value": "Username"
43
+ }
44
+ ],
45
+ "notificationData": {
46
+ "email": "example@oneentry.cloud",
47
+ "phonePush": ["+99999999999"],
48
+ "phoneSMS": "+99999999999"
49
+ },
50
+ "state": {}
51
+ }
52
+ * @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg_form".
53
+ * @param {string} body.authData - Contains authentication credentials for the user. Example:
54
+ * @example
55
+ [
56
+ {
57
+ "marker": "email_reg",
58
+ "value": "example@oneentry.cloud"
59
+ },
60
+ {
61
+ "marker": "password_reg",
62
+ "value": "password"
63
+ }
64
+ ]
65
+ * @param {string} body.authData[index].marker - Identifies the field being used. Example: "email_reg".
66
+ * @param {string} body.authData[index].value - Contains the value of the field. Example: "example@oneentry.cloud".
67
+ * @param {string} body.formData - Contains additional data for the user.
68
+ * @example
69
+ [
70
+ {
71
+ "marker": "last_name",
72
+ "type": "string",
73
+ "value": "Username"
74
+ }
75
+ ]
76
+ * @param {string} body.formData[index].marker - The marker of the field. Example: "last_name".
77
+ * @param {string} body.formData[index].type - The type of the field. Example: "string".
78
+ * @param {string} body.formData[index].value - The value of the field. Example: "Username".
79
+ * @param {string} body.notificationData - The notification data.
80
+ * @example
81
+ {
82
+ "email": "example@oneentry.cloud",
83
+ "phonePush": ["+99999999999"],
84
+ "phoneSMS": "+99999999999"
85
+ }
86
+ * @param {string} body.notificationData.email - The email address of the user. Example: "example@oneentry.cloud".
87
+ * @param {string} body.notificationData.phonePush - An array of phone numbers for push notifications. Example: ["+99999999999"].
88
+ * @param {string} body.notificationData.phoneSMS - The phone number for SMS notifications. Example: "+99999999999".
89
+ * @param {string} [langCode] - Language code. Default: "en_US".
90
+ * @returns {boolean} Returns `true` if the user object was successfully updated; otherwise, returns an error object.
91
+ * @throws {IError} If there is an error during the fetch operation, it will return an error object.
92
+ * @description This method updates the user's data. This method requires user authorization.
93
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
94
+ * @see For more information about {@link https://doc.oneentry.cloud/docs/forms/create-form registration forms}, see the documentation in the {@link https://doc.oneentry.cloud/docs/forms/create-form forms configuration section}.
95
+ */
96
+ updateUser(body: IUserBody, langCode?: string): Promise<boolean | IError>;
97
+ /**
98
+ * Archiving one user object (marked for deletion).
99
+ * @handleName archiveUser
100
+ * @returns {boolean} A promise resolving to true if successful, or an error.
101
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
102
+ * @description This method archives a user object (marks it for deletion). This method requires user authorization.
103
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
104
+ */
105
+ archiveUser(): Promise<boolean | IError>;
106
+ /**
107
+ * Deletes the user from the system.
108
+ * @handleName deleteUser
109
+ * @returns {boolean} A promise resolving to true if successful, or an error.
110
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
111
+ * @description This method deletes the user from the system. This method requires user authorization.
112
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
113
+ */
114
+ deleteUser(): Promise<boolean | IError>;
115
+ /**
116
+ * Adds an FCM token for sending push notifications.
117
+ * @handleName addFCMToken
118
+ * @param {string} token - The FCM token to be added. Example: "fcm_token_1234567890abcdefg".
119
+ * @returns {boolean} A promise resolving to true if successful, or an error.
120
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
121
+ * @description This method adds an FCM token for sending push notifications. This method requires user authorization.
122
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
123
+ */
124
+ addFCMToken(token: string): Promise<boolean | IError>;
125
+ /**
126
+ * Deletes an existing FCM token.
127
+ * @handleName deleteFCMToken
128
+ * @param {string} token - The FCM token to be deleted. Example: "fcm_token_1234567890abcdefg".
129
+ * @returns {boolean} A promise resolving to true if successful, or an error.
130
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
131
+ * @description This method deletes an existing FCM token. This method requires user authorization.
132
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
133
+ */
134
+ deleteFCMToken(token: string): Promise<boolean | IError>;
135
+ /**
136
+ * Get the current user's or guest's cart.
137
+ * @handleName getCart
138
+ * @returns {Promise<ICartResponse | IError>} A promise resolving to the cart with its items and total, or an error.
139
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
140
+ * @description This method requires user authorization (or a guest context).
141
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
142
+ */
143
+ getCart(): Promise<ICartResponse | IError>;
144
+ /**
145
+ * Replace the current user's or guest's cart.
146
+ * @handleName setCart
147
+ * @param {ICartSet} body - New cart contents. Example: `{ items: [{ productId: 1, qty: 2 }] }`.
148
+ * @returns {Promise<ICartResponse | IError>} A promise resolving to the updated cart, or an error.
149
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
150
+ * @description This method requires user authorization (or a guest context).
151
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
152
+ */
153
+ setCart(body: ICartSet): Promise<ICartResponse | IError>;
154
+ /**
155
+ * Add an item to the cart (or update qty of an existing one).
156
+ * @handleName addCartItem
157
+ * @param {ICartAddItem} body - Item to add. Example: `{ productId: 1, qty: 2 }`.
158
+ * @returns {Promise<ICartResponse | IError>} A promise resolving to the updated cart, or an error.
159
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
160
+ * @description This method requires user authorization (or a guest context).
161
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
162
+ */
163
+ addCartItem(body: ICartAddItem): Promise<ICartResponse | IError>;
164
+ /**
165
+ * Remove an item from the cart.
166
+ * @handleName removeCartItem
167
+ * @param {number} productId - Product identifier. Example: 12345.
168
+ * @returns {Promise<ICartResponse | IError>} A promise resolving to the updated cart, or an error.
169
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
170
+ * @description This method requires user authorization (or a guest context).
171
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
172
+ */
173
+ removeCartItem(productId: number): Promise<ICartResponse | IError>;
174
+ /**
175
+ * Get the current user's or guest's wishlist.
176
+ * @handleName getWishlist
177
+ * @returns {Promise<IWishlistResponse | IError>} A promise resolving to the wishlist with its items and total, or an error.
178
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
179
+ * @description This method requires user authorization (or a guest context).
180
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
181
+ */
182
+ getWishlist(): Promise<IWishlistResponse | IError>;
183
+ /**
184
+ * Replace the current user's or guest's wishlist.
185
+ * @handleName setWishlist
186
+ * @param {IWishlistSet} body - New wishlist contents. Example: `{ items: [{ productId: 1 }] }`.
187
+ * @returns {Promise<IWishlistResponse | IError>} A promise resolving to the updated wishlist, or an error.
188
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
189
+ * @description This method requires user authorization (or a guest context).
190
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
191
+ */
192
+ setWishlist(body: IWishlistSet): Promise<IWishlistResponse | IError>;
193
+ /**
194
+ * Add an item to the wishlist.
195
+ * @handleName addWishlistItem
196
+ * @param {IWishlistAddItem} body - Item to add. Example: `{ productId: 1 }`.
197
+ * @returns {Promise<IWishlistResponse | IError>} A promise resolving to the updated wishlist, or an error.
198
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
199
+ * @description This method requires user authorization (or a guest context).
200
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
201
+ */
202
+ addWishlistItem(body: IWishlistAddItem): Promise<IWishlistResponse | IError>;
203
+ /**
204
+ * Remove an item from the wishlist.
205
+ * @handleName removeWishlistItem
206
+ * @param {number} productId - Product identifier. Example: 12345.
207
+ * @returns {Promise<IWishlistResponse | IError>} A promise resolving to the updated wishlist, or an error.
208
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
209
+ * @description This method requires user authorization (or a guest context).
210
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
211
+ */
212
+ removeWishlistItem(productId: number): Promise<IWishlistResponse | IError>;
213
+ /**
214
+ * Semantic (vector) search for users.
215
+ * @handleName getUsersByVectorSearch
216
+ * @param {IUsersVectorSearch} body - Vector search body. Example: `{ queryText: "john" }`.
217
+ * @param {string} [langCode] - Language code. Default: "en_US".
218
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
219
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
220
+ * @returns {Promise<IUsersResponse | IError>} A promise resolving to a users response (items + total), or an error.
221
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
222
+ * @description This method performs a semantic (vector) search for users. It requires user authorization.
223
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
224
+ */
225
+ getUsersByVectorSearch(body: IUsersVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IUsersResponse | IError>;
226
+ }
227
+ /**
228
+ * Body for semantic (vector) user search.
229
+ * @interface IUsersVectorSearch
230
+ * @property {string} queryText - Natural-language search query. Example: "john".
231
+ * @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2). Example: 0.3.
232
+ * @property {number} [maxHits] - Top-K candidates fetched before pagination. Default: 100. Max: 500. Example: 10.
233
+ * @property {boolean} [debug] - When true, each returned item gets a `distance` field. Example: false.
234
+ * @description Body for the users vector/search endpoint.
235
+ */
236
+ interface IUsersVectorSearch {
237
+ queryText: string;
238
+ vectorDistanceThreshold?: number;
239
+ maxHits?: number;
240
+ debug?: boolean;
241
+ }
242
+ /**
243
+ * @interface IUsersResponse
244
+ * @property {IUserEntity[]} items - Array of found user objects.
245
+ * @property {number} total - Total number of found records. Example: 100.
246
+ * @description This interface defines the structure of a response containing multiple user entities, including the total count and an array of user items.
247
+ */
248
+ interface IUsersResponse {
249
+ items: IUserEntity[];
250
+ total: number;
251
+ }
252
+ /**
253
+ * @interface IUserEntity
254
+ * @property {number} id - Object identifier. Example: 12345.
255
+ * @property {string} identifier - Text identifier for record field. Example: "user_12345".
256
+ * @property {string} authProviderIdentifier - Text identifier of the authentication provider. Example: "auth_provider_12345".
257
+ * @property {FormDataType[]} formData - Array of data form objects with the following values.
258
+ * @example
259
+ [
260
+ {
261
+ "marker": "last_name",
262
+ "type": "string",
263
+ "value": "Username"
264
+ }
265
+ ]
266
+ * @property {string} formIdentifier - Text identifier of the form. Example: "form_12345".
267
+ * @property {string} total - Total value. Example: "0".
268
+ * @property {Array<string | number>} groups - Array of user groups.
269
+ * @example
270
+ [
271
+ "group_1",
272
+ "group_2"
273
+ ]
274
+ * @property {object} state - Object containing additional user state information.
275
+ * @example
276
+ {
277
+ "key": "value"
278
+ }
279
+ * @property {Array<IFormConfig>} [moduleFormConfigs] - Optional array of form configuration objects associated with the user.
280
+ * @property {IRating} [rating] - Rating data.
281
+ * @description Represents a user entity with various properties, including identifiers, form data, and user groups.
282
+ */
283
+ interface IUserEntity {
284
+ id: number;
285
+ identifier: string;
286
+ authProviderIdentifier: string;
287
+ formData: FormDataType[];
288
+ formIdentifier: string;
289
+ total: string;
290
+ groups: Array<string | number>;
291
+ state: Record<string, unknown>;
292
+ moduleFormConfigs?: Array<IFormConfig>;
293
+ rating?: IRating;
294
+ }
295
+ /**
296
+ * @interface IUserBody
297
+ * @property {string} formIdentifier - Text identifier of the form. Example: "form_12345".
298
+ * @property {string} [langCode] - Language code for localization. Default: "en_US".
299
+ * @property {IAuthData[]} [authData] - Array of authentication data objects with markers and values.
300
+ * @example
301
+ [
302
+ {
303
+ "marker": "password",
304
+ "value": "12345"
305
+ }
306
+ ]
307
+ * @property {IAuthFormData | IAuthFormData[]} [formData] - Form data object or array of form data objects.
308
+ * @example
309
+ [
310
+ {
311
+ "marker": "first_name",
312
+ "type": "string",
313
+ "value": "John"
314
+ },
315
+ {
316
+ "marker": "last_name",
317
+ "type": "string",
318
+ "value": "Doe"
319
+ }
320
+ ]
321
+ * @property {object} [notificationData] - Object containing notification data, including email and phone information.
322
+ * @example
323
+ {
324
+ "email": "example@oneentry.cloud",
325
+ "phonePush": ["+99999999999"],
326
+ "phoneSMS": "+99999999999"
327
+ }
328
+ * @property {object} [state] - Object containing additional state information.
329
+ * @example
330
+ {
331
+ "key": "value"
332
+ }
333
+ * @description Represents the body of a user request, including form identifiers, authentication data, form data, notification data, and state information.
334
+ */
335
+ interface IUserBody {
336
+ formIdentifier: string;
337
+ langCode?: string;
338
+ authData?: IAuthData[];
339
+ formData?: IAuthFormData | IAuthFormData[];
340
+ notificationData?: INotificationData;
341
+ state?: Record<string, unknown>;
342
+ }
343
+ /**
344
+ * @interface ICartItem
345
+ * @property {number} productId - Product identifier. Example: 1.
346
+ * @property {number} qty - Quantity of the product in the cart. Example: 2.
347
+ * @property {string} [addedAt] - ISO date when the item was added. Example: "2026-05-30T10:00:00.000Z".
348
+ * @description A single cart item.
349
+ */
350
+ interface ICartItem {
351
+ productId: number;
352
+ qty: number;
353
+ addedAt?: string;
354
+ }
355
+ /**
356
+ * @interface ICartResponse
357
+ * @property {ICartItem[]} items - Cart items.
358
+ * @property {number} total - Total number of items in the cart. Example: 3.
359
+ * @description The user's or guest's cart.
360
+ */
361
+ interface ICartResponse {
362
+ items: ICartItem[];
363
+ total: number;
364
+ }
365
+ /**
366
+ * @interface ICartSet
367
+ * @property {ICartItem[]} items - New cart items. Example: `[{ productId: 1, qty: 2 }]`.
368
+ * @description Body for replacing the whole cart.
369
+ */
370
+ interface ICartSet {
371
+ items: ICartItem[];
372
+ }
373
+ /**
374
+ * @interface ICartAddItem
375
+ * @property {number} productId - Product identifier. Example: 1.
376
+ * @property {number} qty - Quantity to add. Example: 2.
377
+ * @description Body for adding a single item to the cart.
378
+ */
379
+ interface ICartAddItem {
380
+ productId: number;
381
+ qty: number;
382
+ }
383
+ /**
384
+ * @interface IWishlistItem
385
+ * @property {number} productId - Product identifier. Example: 1.
386
+ * @property {string} [addedAt] - ISO date when the item was added. Example: "2026-05-30T10:00:00.000Z".
387
+ * @description A single wishlist item.
388
+ */
389
+ interface IWishlistItem {
390
+ productId: number;
391
+ addedAt?: string;
392
+ }
393
+ /**
394
+ * @interface IWishlistResponse
395
+ * @property {IWishlistItem[]} items - Wishlist items.
396
+ * @property {number} total - Total number of items in the wishlist. Example: 3.
397
+ * @description The user's or guest's wishlist.
398
+ */
399
+ interface IWishlistResponse {
400
+ items: IWishlistItem[];
401
+ total: number;
402
+ }
403
+ /**
404
+ * @interface IWishlistSet
405
+ * @property {IWishlistItem[]} items - New wishlist items. Example: `[{ productId: 1 }]`.
406
+ * @description Body for replacing the whole wishlist.
407
+ */
408
+ interface IWishlistSet {
409
+ items: IWishlistItem[];
410
+ }
411
+ /**
412
+ * @interface IWishlistAddItem
413
+ * @property {number} productId - Product identifier. Example: 1.
414
+ * @description Body for adding a single item to the wishlist.
415
+ */
416
+ interface IWishlistAddItem {
417
+ productId: number;
418
+ }
419
+ export type { ICartAddItem, ICartItem, ICartResponse, ICartSet, IUserBody, IUserEntity, IUsersApi, IUsersResponse, IUsersVectorSearch, IWishlistAddItem, IWishlistItem, IWishlistResponse, IWishlistSet, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Validation schemas for Users module
3
+ * @description Zod schemas for validating users-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * User response schema (extends base UserEntitySchema)
8
+ * formData can be array or object (inherited from UserEntitySchema)
9
+ */
10
+ export declare const UserResponseSchema: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ identifier: z.ZodString;
13
+ authProviderIdentifier: z.ZodString;
14
+ formData: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
15
+ formIdentifier: z.ZodString;
16
+ total: z.ZodString;
17
+ groups: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
18
+ state: z.ZodRecord<z.ZodString, z.ZodAny>;
19
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
20
+ rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
21
+ }, z.core.$strip>;
22
+ /**
23
+ * Update user response schema (returns true on success)
24
+ */
25
+ export declare const UpdateUserResponseSchema: z.ZodBoolean;
26
+ /**
27
+ * Delete user response schema
28
+ */
29
+ export declare const DeleteUserResponseSchema: z.ZodObject<{
30
+ success: z.ZodBoolean;
31
+ message: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strip>;
33
+ /**
34
+ * Cart item schema
35
+ * @description Schema for a single cart item
36
+ */
37
+ export declare const CartItemSchema: z.ZodObject<{
38
+ productId: z.ZodNumber;
39
+ qty: z.ZodNumber;
40
+ addedAt: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strip>;
42
+ /**
43
+ * Cart response schema
44
+ * @description Schema for the user's or guest's cart
45
+ */
46
+ export declare const CartResponseSchema: z.ZodObject<{
47
+ items: z.ZodArray<z.ZodObject<{
48
+ productId: z.ZodNumber;
49
+ qty: z.ZodNumber;
50
+ addedAt: z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strip>>;
52
+ total: z.ZodNumber;
53
+ }, z.core.$strip>;
54
+ /**
55
+ * Wishlist item schema
56
+ * @description Schema for a single wishlist item
57
+ */
58
+ export declare const WishlistItemSchema: z.ZodObject<{
59
+ productId: z.ZodNumber;
60
+ addedAt: z.ZodOptional<z.ZodString>;
61
+ }, z.core.$strip>;
62
+ /**
63
+ * Wishlist response schema
64
+ * @description Schema for the user's or guest's wishlist
65
+ */
66
+ export declare const WishlistResponseSchema: z.ZodObject<{
67
+ items: z.ZodArray<z.ZodObject<{
68
+ productId: z.ZodNumber;
69
+ addedAt: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strip>>;
71
+ total: z.ZodNumber;
72
+ }, z.core.$strip>;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Validation schemas for Users module
3
+ * @description Zod schemas for validating users-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ import { UserEntitySchema } from '../base/validation.js';
7
+ /**
8
+ * User response schema (extends base UserEntitySchema)
9
+ * formData can be array or object (inherited from UserEntitySchema)
10
+ */
11
+ export const UserResponseSchema = UserEntitySchema;
12
+ /**
13
+ * Update user response schema (returns true on success)
14
+ */
15
+ export const UpdateUserResponseSchema = z.boolean();
16
+ /**
17
+ * Delete user response schema
18
+ */
19
+ export const DeleteUserResponseSchema = z.object({
20
+ success: z.boolean(),
21
+ message: z.string().optional(),
22
+ });
23
+ /**
24
+ * Cart item schema
25
+ * @description Schema for a single cart item
26
+ */
27
+ export const CartItemSchema = z.object({
28
+ productId: z.number(),
29
+ qty: z.number(),
30
+ addedAt: z.string().optional(),
31
+ });
32
+ /**
33
+ * Cart response schema
34
+ * @description Schema for the user's or guest's cart
35
+ */
36
+ export const CartResponseSchema = z.object({
37
+ items: z.array(CartItemSchema),
38
+ total: z.number(),
39
+ });
40
+ /**
41
+ * Wishlist item schema
42
+ * @description Schema for a single wishlist item
43
+ */
44
+ export const WishlistItemSchema = z.object({
45
+ productId: z.number(),
46
+ addedAt: z.string().optional(),
47
+ });
48
+ /**
49
+ * Wishlist response schema
50
+ * @description Schema for the user's or guest's wishlist
51
+ */
52
+ export const WishlistResponseSchema = z.object({
53
+ items: z.array(WishlistItemSchema),
54
+ total: z.number(),
55
+ });
@@ -0,0 +1,18 @@
1
+ import type { Socket } from 'socket.io-client';
2
+ /**
3
+ * Wraps a not-yet-loaded Socket.io socket in a synchronous stand-in.
4
+ *
5
+ * `WS.connect()` is synchronous and returns a `Socket`, so `socket.io-client` would have to
6
+ * be imported statically — putting ~41 kB into every bundle, including those that never open
7
+ * a socket. This keeps the signature by returning a proxy immediately: calls made on it are
8
+ * queued and replayed onto the real socket as soon as the chunk resolves, and every later
9
+ * call passes straight through.
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.
12
+ * @description Listener registration is what matters for ordering, and it is safe: the queue is
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.
17
+ */
18
+ export default function createLazySocket(createSocket: () => Promise<Socket>): Socket;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Properties readable before the real socket exists.
3
+ * @description Their values match what Socket.io itself reports for a socket that
4
+ * has been created but has not connected yet, so reading them early is not a lie.
5
+ */
6
+ const PENDING_STATE = {
7
+ id: undefined,
8
+ connected: false,
9
+ disconnected: true,
10
+ active: false,
11
+ recovered: false,
12
+ };
13
+ /**
14
+ * Wraps a not-yet-loaded Socket.io socket in a synchronous stand-in.
15
+ *
16
+ * `WS.connect()` is synchronous and returns a `Socket`, so `socket.io-client` would have to
17
+ * be imported statically — putting ~41 kB into every bundle, including those that never open
18
+ * a socket. This keeps the signature by returning a proxy immediately: calls made on it are
19
+ * queued and replayed onto the real socket as soon as the chunk resolves, and every later
20
+ * call passes straight through.
21
+ * @param {() => Promise<Socket>} createSocket - Loads Socket.io and creates the socket.
22
+ * @returns {Socket} Stand-in usable exactly like the socket it will become.
23
+ * @description Listener registration is what matters for ordering, and it is safe: the queue is
24
+ * replayed in the same tick the socket is created, before the connection can deliver anything.
25
+ * The one visible difference is that methods returning a value (e.g. `listeners()`) cannot answer
26
+ * before the chunk arrives — they return the proxy instead. Reading state (`id`, `connected`, …)
27
+ * is accurate, and awaiting `socket.io` or other nested objects is only possible once loaded.
28
+ */
29
+ export default function createLazySocket(createSocket) {
30
+ let socket;
31
+ const queued = [];
32
+ const loading = createSocket().then((created) => {
33
+ // Replay before returning: the connection cannot emit anything until this tick ends,
34
+ // so no event registered through the proxy can be missed.
35
+ for (const { method, args } of queued) {
36
+ created[method](...args);
37
+ }
38
+ queued.length = 0;
39
+ socket = created;
40
+ return created;
41
+ });
42
+ // A failed chunk load must not surface as an unhandled rejection
43
+ loading.catch((error) => {
44
+ // eslint-disable-next-line no-undef, no-console
45
+ console.error('OneEntry SDK: failed to load socket.io-client', error);
46
+ });
47
+ const proxy = new Proxy({}, {
48
+ get(_target, property) {
49
+ if (socket) {
50
+ const value = socket[property];
51
+ return typeof value === 'function' ? value.bind(socket) : value;
52
+ }
53
+ // Never look thenable: returning a function for `then` would make `await socket` hang
54
+ if (property === 'then' || typeof property === 'symbol') {
55
+ return undefined;
56
+ }
57
+ if (property in PENDING_STATE) {
58
+ return PENDING_STATE[property];
59
+ }
60
+ return (...args) => {
61
+ queued.push({ method: property, args });
62
+ return proxy;
63
+ };
64
+ },
65
+ });
66
+ return proxy;
67
+ }
@@ -0,0 +1,27 @@
1
+ import type { Socket } from 'socket.io-client';
2
+ import AsyncModules from '../base/asyncModules.js';
3
+ import type StateModule from '../base/stateModule.js';
4
+ import type { IWS } from './wsInterfaces.js';
5
+ /**
6
+ * Controllers for working with users
7
+ * @handle /api/content/ws
8
+ */
9
+ export default class WsApi extends AsyncModules implements IWS {
10
+ protected state: StateModule;
11
+ protected _url: string;
12
+ /**
13
+ * Constructor
14
+ * @param {StateModule} state - StateModule
15
+ */
16
+ constructor(state: StateModule);
17
+ /**
18
+ * Creates an instance of an object Socket.io with a connection.
19
+ * @handleName connect
20
+ * @returns {Socket} Returns a Socket instance.
21
+ * @description Creates an instance of an object Socket.io with a connection. This method requires user authorization.
22
+ * Socket.io is imported on demand, so projects that never open a socket do not bundle it; the returned
23
+ * value is usable immediately either way (see `createLazySocket`).
24
+ * @see {@link https://js-sdk.oneentry.cloud/docs/web-socket/connect connect} documentation.
25
+ */
26
+ connect(): Socket;
27
+ }