oneentry 1.0.149 → 1.0.150

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 (49) hide show
  1. package/README.md +8 -0
  2. package/changelog.md +431 -0
  3. package/dist/base/asyncModules.js +13 -0
  4. package/dist/base/stateModule.d.ts +1 -0
  5. package/dist/base/stateModule.js +3 -0
  6. package/dist/base/syncModules.d.ts +30 -1
  7. package/dist/base/syncModules.js +102 -30
  8. package/dist/base/utils.d.ts +4 -1
  9. package/dist/blocks/blocksApi.d.ts +108 -2
  10. package/dist/blocks/blocksApi.js +148 -1
  11. package/dist/blocks/blocksInterfaces.d.ts +160 -2
  12. package/dist/blocks/blocksSchemas.d.ts +4 -0
  13. package/dist/events/eventsApi.d.ts +42 -1
  14. package/dist/events/eventsApi.js +67 -0
  15. package/dist/events/eventsInterfaces.d.ts +79 -1
  16. package/dist/filters/filtersApi.d.ts +31 -0
  17. package/dist/filters/filtersApi.js +40 -0
  18. package/dist/filters/filtersInterfaces.d.ts +56 -0
  19. package/dist/filters/filtersInterfaces.js +2 -0
  20. package/dist/filters/filtersSchemas.d.ts +32 -0
  21. package/dist/filters/filtersSchemas.js +29 -0
  22. package/dist/general-types/generalTypesSchemas.d.ts +16 -0
  23. package/dist/general-types/generalTypesSchemas.js +10 -1
  24. package/dist/index.d.ts +13 -0
  25. package/dist/index.js +10 -0
  26. package/dist/pages/pagesInterfaces.d.ts +2 -2
  27. package/dist/pages/pagesSchemas.d.ts +3 -3
  28. package/dist/pages/pagesSchemas.js +1 -1
  29. package/dist/products/productsApi.d.ts +19 -1
  30. package/dist/products/productsApi.js +29 -7
  31. package/dist/products/productsInterfaces.d.ts +30 -1
  32. package/dist/products/productsSchemas.d.ts +4 -0
  33. package/dist/products/productsSchemas.js +1 -0
  34. package/dist/subscriptions/subscriptionsApi.d.ts +69 -0
  35. package/dist/subscriptions/subscriptionsApi.js +102 -0
  36. package/dist/subscriptions/subscriptionsInterfaces.d.ts +90 -0
  37. package/dist/subscriptions/subscriptionsInterfaces.js +2 -0
  38. package/dist/subscriptions/subscriptionsSchemas.d.ts +20 -0
  39. package/dist/subscriptions/subscriptionsSchemas.js +23 -0
  40. package/dist/user-activity/userActivityApi.d.ts +30 -0
  41. package/dist/user-activity/userActivityApi.js +42 -0
  42. package/dist/user-activity/userActivityInterfaces.d.ts +42 -0
  43. package/dist/user-activity/userActivityInterfaces.js +2 -0
  44. package/dist/users/usersApi.d.ts +79 -1
  45. package/dist/users/usersApi.js +110 -0
  46. package/dist/users/usersInterfaces.d.ts +155 -1
  47. package/dist/users/usersSchemas.d.ts +40 -0
  48. package/dist/users/usersSchemas.js +34 -1
  49. package/package.json +3 -2
@@ -0,0 +1,90 @@
1
+ import type { IError } from '../base/utils';
2
+ /**
3
+ * Interface for the Subscriptions API module.
4
+ * @interface ISubscriptionsApi
5
+ * @description This interface defines methods for managing paid subscriptions: creating, cancelling, recovering, and listing available/active subscriptions.
6
+ */
7
+ interface ISubscriptionsApi {
8
+ /**
9
+ * Create a new subscription and get a payment session for it.
10
+ * @handleName subscribe
11
+ * @param {ISubscribe} body - Subscription body. Example: `{ marker: "premium" }`.
12
+ * @returns {Promise<ICreatedSubscription | IError>} Returns the created payment session for the subscription.
13
+ * @throws {IError} When isShell=false and an error occurs during the fetch
14
+ * @description This method requires user authorization.
15
+ * @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}.
16
+ */
17
+ subscribe(body: ISubscribe): Promise<ICreatedSubscription | IError>;
18
+ /**
19
+ * Cancel a subscription.
20
+ * @handleName cancelSubscription
21
+ * @param {ICancelSubscription} body - Subscription body. Example: `{ marker: "premium" }`.
22
+ * @returns {Promise<boolean | IError>} Returns true if the subscription was cancelled, or an error object if there was an issue.
23
+ * @throws {IError} When isShell=false and an error occurs during the fetch
24
+ * @description This method requires user authorization.
25
+ * @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}.
26
+ */
27
+ cancelSubscription(body: ICancelSubscription): Promise<boolean | IError>;
28
+ /**
29
+ * Get all available subscription markers.
30
+ * @handleName getAllSubscriptions
31
+ * @returns {Promise<string[] | IError>} Returns an array of available subscription markers.
32
+ * @throws {IError} When isShell=false and an error occurs during the fetch
33
+ * @description This method requires user authorization.
34
+ * @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}.
35
+ */
36
+ getAllSubscriptions(): Promise<string[] | IError>;
37
+ /**
38
+ * Get markers of the user's active subscriptions.
39
+ * @handleName getActiveSubscriptions
40
+ * @returns {Promise<string[] | IError>} Returns an array of active subscription markers.
41
+ * @throws {IError} When isShell=false and an error occurs during the fetch
42
+ * @description This method requires user authorization.
43
+ * @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}.
44
+ */
45
+ getActiveSubscriptions(): Promise<string[] | IError>;
46
+ /**
47
+ * Recover a subscription through the Stripe Billing Portal.
48
+ * @handleName recoverSubscriptions
49
+ * @param {ICancelSubscription} body - Subscription body. Example: `{ marker: "premium" }`.
50
+ * @returns {Promise<boolean | IError>} Returns true if the recovery request was accepted, or an error object if there was an issue.
51
+ * @throws {IError} When isShell=false and an error occurs during the fetch
52
+ * @description This method requires user authorization.
53
+ * @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}.
54
+ */
55
+ recoverSubscriptions(body: ICancelSubscription): Promise<boolean | IError>;
56
+ }
57
+ /**
58
+ * Body for creating a subscription.
59
+ * @interface ISubscribe
60
+ * @property {string} marker - Subscription marker. Example: "premium".
61
+ * @description Body for creating a subscription.
62
+ */
63
+ interface ISubscribe {
64
+ marker: string;
65
+ }
66
+ /**
67
+ * Body for cancelling or recovering a subscription.
68
+ * @interface ICancelSubscription
69
+ * @property {string} marker - Subscription marker. Example: "premium".
70
+ * @description Body for cancelling or recovering a subscription.
71
+ */
72
+ interface ICancelSubscription {
73
+ marker: string;
74
+ }
75
+ /**
76
+ * Created subscription payment session.
77
+ * @interface ICreatedSubscription
78
+ * @property {number} id - Payment session identifier. Example: 1.
79
+ * @property {number} amount - Amount to be paid. Example: 100.
80
+ * @property {string} paymentUrl - Payment page URL. Example: "https://checkout.stripe.com/c/pay/...".
81
+ * @property {string} status - Payment session status. Example: "waiting".
82
+ * @description Created subscription payment session returned after subscribing.
83
+ */
84
+ interface ICreatedSubscription {
85
+ id: number;
86
+ amount: number;
87
+ paymentUrl: string;
88
+ status: string;
89
+ }
90
+ export type { ICancelSubscription, ICreatedSubscription, ISubscribe, ISubscriptionsApi, };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Validation schemas for Subscriptions module
3
+ * @description Zod schemas for validating subscriptions-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Created subscription schema
8
+ * @description Schema for the payment session returned after creating a subscription
9
+ */
10
+ export declare const CreatedSubscriptionSchema: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ amount: z.ZodNumber;
13
+ paymentUrl: z.ZodString;
14
+ status: z.ZodString;
15
+ }, z.core.$strip>;
16
+ /**
17
+ * Subscription markers schema
18
+ * @description Schema for arrays of subscription markers (available and active subscriptions)
19
+ */
20
+ export declare const SubscriptionMarkersSchema: z.ZodArray<z.ZodString>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubscriptionMarkersSchema = exports.CreatedSubscriptionSchema = void 0;
4
+ /**
5
+ * Validation schemas for Subscriptions module
6
+ * @description Zod schemas for validating subscriptions-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * Created subscription schema
11
+ * @description Schema for the payment session returned after creating a subscription
12
+ */
13
+ exports.CreatedSubscriptionSchema = zod_1.z.object({
14
+ id: zod_1.z.number(),
15
+ amount: zod_1.z.number(),
16
+ paymentUrl: zod_1.z.string(),
17
+ status: zod_1.z.string(),
18
+ });
19
+ /**
20
+ * Subscription markers schema
21
+ * @description Schema for arrays of subscription markers (available and active subscriptions)
22
+ */
23
+ exports.SubscriptionMarkersSchema = zod_1.z.array(zod_1.z.string());
@@ -0,0 +1,30 @@
1
+ import AsyncModules from '../base/asyncModules';
2
+ import type StateModule from '../base/stateModule';
3
+ import type { IError } from '../base/utils';
4
+ import type { ITrackActivity, IUserActivityApi } from './userActivityInterfaces';
5
+ /**
6
+ * Controllers for working with user activity.
7
+ * @handle /api/content/user-activity
8
+ * @class UserActivityApi
9
+ * @augments AsyncModules
10
+ * @implements {IUserActivityApi}
11
+ * @description This class provides methods to track user/guest activity events.
12
+ */
13
+ export default class UserActivityApi extends AsyncModules implements IUserActivityApi {
14
+ protected state: StateModule;
15
+ protected _url: string;
16
+ /**
17
+ * Constructor for UserActivityApi class.
18
+ * @param {StateModule} state - The state module.
19
+ */
20
+ constructor(state: StateModule);
21
+ /**
22
+ * Track a user or guest activity event.
23
+ * @handleName trackUserActivity
24
+ * @param {ITrackActivity} body - Activity event body. Example: `{ type: "product_view", productId: 12345 }`.
25
+ * @returns {Promise<boolean | IError>} Returns true if the event was recorded, or an error object if there was an issue.
26
+ * @throws {IError} When isShell=false and an error occurs during the fetch
27
+ * @description Records an activity event for the current authorized user or guest.
28
+ */
29
+ trackUserActivity(body: ITrackActivity): Promise<boolean | IError>;
30
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const asyncModules_1 = __importDefault(require("../base/asyncModules"));
7
+ /**
8
+ * Controllers for working with user activity.
9
+ * @handle /api/content/user-activity
10
+ * @class UserActivityApi
11
+ * @augments AsyncModules
12
+ * @implements {IUserActivityApi}
13
+ * @description This class provides methods to track user/guest activity events.
14
+ */
15
+ class UserActivityApi extends asyncModules_1.default {
16
+ /**
17
+ * Constructor for UserActivityApi class.
18
+ * @param {StateModule} state - The state module.
19
+ */
20
+ constructor(state) {
21
+ super(state);
22
+ this._url = state.url + '/api/content/user-activity';
23
+ }
24
+ /**
25
+ * Track a user or guest activity event.
26
+ * @handleName trackUserActivity
27
+ * @param {ITrackActivity} body - Activity event body. Example: `{ type: "product_view", productId: 12345 }`.
28
+ * @returns {Promise<boolean | IError>} Returns true if the event was recorded, or an error object if there was an issue.
29
+ * @throws {IError} When isShell=false and an error occurs during the fetch
30
+ * @description Records an activity event for the current authorized user or guest.
31
+ */
32
+ async trackUserActivity(body) {
33
+ try {
34
+ await this._fetchPost(`/track`, body);
35
+ return true;
36
+ }
37
+ catch (e) {
38
+ return e;
39
+ }
40
+ }
41
+ }
42
+ exports.default = UserActivityApi;
@@ -0,0 +1,42 @@
1
+ import type { IError } from '../base/utils';
2
+ /**
3
+ * Interface for the UserActivity API module.
4
+ * @interface IUserActivityApi
5
+ * @description This interface defines methods for tracking user/guest activity events.
6
+ */
7
+ interface IUserActivityApi {
8
+ /**
9
+ * Track a user or guest activity event.
10
+ * @handleName trackUserActivity
11
+ * @param {ITrackActivity} body - Activity event body. Example: `{ type: "product_view", productId: 12345 }`.
12
+ * @returns {Promise<boolean | IError>} Returns true if the event was recorded, or an error object if there was an issue.
13
+ * @throws {IError} When isShell=false and an error occurs during the fetch
14
+ * @description Records an activity event for the current authorized user or guest.
15
+ */
16
+ trackUserActivity(body: ITrackActivity): Promise<boolean | IError>;
17
+ }
18
+ /**
19
+ * User activity event type.
20
+ * @description Type of the tracked user activity event.
21
+ */
22
+ type TUserActivityType = 'product_view' | 'page_view' | 'category_view' | 'search' | 'product_add_to_cart' | 'product_remove_from_cart' | 'product_add_to_wishlist' | 'product_remove_from_wishlist' | 'product_purchase' | 'product_rating';
23
+ /**
24
+ * Body for tracking a user activity event.
25
+ * @interface ITrackActivity
26
+ * @property {TUserActivityType} type - Activity event type. Example: "product_view".
27
+ * @property {number} [productId] - Product identifier. Example: 12345.
28
+ * @property {number} [pageId] - Page identifier (for page_view, category_view). Example: 7.
29
+ * @property {number} [categoryId] - Legacy category identifier. Example: 67.
30
+ * @property {string} [query] - Search query (for type=search). Example: "iphone case".
31
+ * @property {Record<string, unknown>} [meta] - Arbitrary meta information (source block, A/B variant, scroll-depth).
32
+ * @description Body for tracking a user activity event.
33
+ */
34
+ interface ITrackActivity {
35
+ type: TUserActivityType;
36
+ productId?: number;
37
+ pageId?: number;
38
+ categoryId?: number;
39
+ query?: string;
40
+ meta?: Record<string, unknown>;
41
+ }
42
+ export type { ITrackActivity, IUserActivityApi, TUserActivityType };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
3
  import type { IError } from '../base/utils';
4
- import type { IUserBody, IUserEntity, IUsersApi } from './usersInterfaces';
4
+ import type { ICartAddItem, ICartResponse, ICartSet, IUserBody, IUserEntity, IUsersApi, IWishlistAddItem, IWishlistResponse, IWishlistSet } from './usersInterfaces';
5
5
  /**
6
6
  * Controllers for working with users
7
7
  * @handle /api/content/users
@@ -140,4 +140,82 @@ export default class UsersApi extends AsyncModules implements IUsersApi {
140
140
  * @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}.
141
141
  */
142
142
  deleteFCMToken(token: string): Promise<boolean | IError>;
143
+ /**
144
+ * Get the current user's or guest's cart.
145
+ * @handleName getCart
146
+ * @returns {Promise<ICartResponse | IError>} Returns the cart with its items and total.
147
+ * @throws {IError} When isShell=false and an error occurs during the fetch
148
+ * @description This method requires user authorization (or a guest context).
149
+ * @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}.
150
+ */
151
+ getCart(): Promise<ICartResponse | IError>;
152
+ /**
153
+ * Replace the current user's or guest's cart.
154
+ * @handleName setCart
155
+ * @param {ICartSet} body - New cart contents. Example: `{ items: [{ productId: 1, qty: 2 }] }`.
156
+ * @returns {Promise<ICartResponse | IError>} Returns the updated cart.
157
+ * @throws {IError} When isShell=false and an error occurs during the fetch
158
+ * @description This method requires user authorization (or a guest context).
159
+ * @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}.
160
+ */
161
+ setCart(body: ICartSet): Promise<ICartResponse | IError>;
162
+ /**
163
+ * Add an item to the cart (or update qty of an existing one).
164
+ * @handleName addCartItem
165
+ * @param {ICartAddItem} body - Item to add. Example: `{ productId: 1, qty: 2 }`.
166
+ * @returns {Promise<ICartResponse | IError>} Returns the updated cart.
167
+ * @throws {IError} When isShell=false and an error occurs during the fetch
168
+ * @description This method requires user authorization (or a guest context).
169
+ * @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}.
170
+ */
171
+ addCartItem(body: ICartAddItem): Promise<ICartResponse | IError>;
172
+ /**
173
+ * Remove an item from the cart.
174
+ * @handleName removeCartItem
175
+ * @param {number} productId - Product identifier. Example: 12345.
176
+ * @returns {Promise<ICartResponse | IError>} Returns the updated cart.
177
+ * @throws {IError} When isShell=false and an error occurs during the fetch
178
+ * @description This method requires user authorization (or a guest context).
179
+ * @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}.
180
+ */
181
+ removeCartItem(productId: number): Promise<ICartResponse | IError>;
182
+ /**
183
+ * Get the current user's or guest's wishlist.
184
+ * @handleName getWishlist
185
+ * @returns {Promise<IWishlistResponse | IError>} Returns the wishlist with its items and total.
186
+ * @throws {IError} When isShell=false and an error occurs during the fetch
187
+ * @description This method requires user authorization (or a guest context).
188
+ * @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}.
189
+ */
190
+ getWishlist(): Promise<IWishlistResponse | IError>;
191
+ /**
192
+ * Replace the current user's or guest's wishlist.
193
+ * @handleName setWishlist
194
+ * @param {IWishlistSet} body - New wishlist contents. Example: `{ items: [{ productId: 1 }] }`.
195
+ * @returns {Promise<IWishlistResponse | IError>} Returns the updated wishlist.
196
+ * @throws {IError} When isShell=false and an error occurs during the fetch
197
+ * @description This method requires user authorization (or a guest context).
198
+ * @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}.
199
+ */
200
+ setWishlist(body: IWishlistSet): Promise<IWishlistResponse | IError>;
201
+ /**
202
+ * Add an item to the wishlist.
203
+ * @handleName addWishlistItem
204
+ * @param {IWishlistAddItem} body - Item to add. Example: `{ productId: 1 }`.
205
+ * @returns {Promise<IWishlistResponse | IError>} Returns the updated wishlist.
206
+ * @throws {IError} When isShell=false and an error occurs during the fetch
207
+ * @description This method requires user authorization (or a guest context).
208
+ * @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}.
209
+ */
210
+ addWishlistItem(body: IWishlistAddItem): Promise<IWishlistResponse | IError>;
211
+ /**
212
+ * Remove an item from the wishlist.
213
+ * @handleName removeWishlistItem
214
+ * @param {number} productId - Product identifier. Example: 12345.
215
+ * @returns {Promise<IWishlistResponse | IError>} Returns the updated wishlist.
216
+ * @throws {IError} When isShell=false and an error occurs during the fetch
217
+ * @description This method requires user authorization (or a guest context).
218
+ * @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}.
219
+ */
220
+ removeWishlistItem(productId: number): Promise<IWishlistResponse | IError>;
143
221
  }
@@ -167,5 +167,115 @@ class UsersApi extends asyncModules_1.default {
167
167
  const result = await this._fetchDelete(`/me/fcm-token/${token}`);
168
168
  return result;
169
169
  }
170
+ /**
171
+ * Get the current user's or guest's cart.
172
+ * @handleName getCart
173
+ * @returns {Promise<ICartResponse | IError>} Returns the cart with its items and total.
174
+ * @throws {IError} When isShell=false and an error occurs during the fetch
175
+ * @description This method requires user authorization (or a guest context).
176
+ * @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}.
177
+ */
178
+ async getCart() {
179
+ const result = await this._fetchGet('/me/cart');
180
+ const validated = this._validateResponse(result, usersSchemas_1.CartResponseSchema);
181
+ return this._normalizeData(validated);
182
+ }
183
+ /**
184
+ * Replace the current user's or guest's cart.
185
+ * @handleName setCart
186
+ * @param {ICartSet} body - New cart contents. Example: `{ items: [{ productId: 1, qty: 2 }] }`.
187
+ * @returns {Promise<ICartResponse | IError>} Returns the updated cart.
188
+ * @throws {IError} When isShell=false and an error occurs during the fetch
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
+ async setCart(body) {
193
+ const result = await this._fetchPut('/me/cart', body);
194
+ const validated = this._validateResponse(result, usersSchemas_1.CartResponseSchema);
195
+ return this._normalizeData(validated);
196
+ }
197
+ /**
198
+ * Add an item to the cart (or update qty of an existing one).
199
+ * @handleName addCartItem
200
+ * @param {ICartAddItem} body - Item to add. Example: `{ productId: 1, qty: 2 }`.
201
+ * @returns {Promise<ICartResponse | IError>} Returns the updated cart.
202
+ * @throws {IError} When isShell=false and an error occurs during the fetch
203
+ * @description This method requires user authorization (or a guest context).
204
+ * @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}.
205
+ */
206
+ async addCartItem(body) {
207
+ const result = await this._fetchPost('/me/cart/items', body);
208
+ const validated = this._validateResponse(result, usersSchemas_1.CartResponseSchema);
209
+ return this._normalizeData(validated);
210
+ }
211
+ /**
212
+ * Remove an item from the cart.
213
+ * @handleName removeCartItem
214
+ * @param {number} productId - Product identifier. Example: 12345.
215
+ * @returns {Promise<ICartResponse | IError>} Returns the updated cart.
216
+ * @throws {IError} When isShell=false and an error occurs during the fetch
217
+ * @description This method requires user authorization (or a guest context).
218
+ * @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}.
219
+ */
220
+ async removeCartItem(productId) {
221
+ const result = await this._fetchDelete(`/me/cart/items/${productId}`);
222
+ const validated = this._validateResponse(result, usersSchemas_1.CartResponseSchema);
223
+ return this._normalizeData(validated);
224
+ }
225
+ /**
226
+ * Get the current user's or guest's wishlist.
227
+ * @handleName getWishlist
228
+ * @returns {Promise<IWishlistResponse | IError>} Returns the wishlist with its items and total.
229
+ * @throws {IError} When isShell=false and an error occurs during the fetch
230
+ * @description This method requires user authorization (or a guest context).
231
+ * @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}.
232
+ */
233
+ async getWishlist() {
234
+ const result = await this._fetchGet('/me/wishlist');
235
+ const validated = this._validateResponse(result, usersSchemas_1.WishlistResponseSchema);
236
+ return this._normalizeData(validated);
237
+ }
238
+ /**
239
+ * Replace the current user's or guest's wishlist.
240
+ * @handleName setWishlist
241
+ * @param {IWishlistSet} body - New wishlist contents. Example: `{ items: [{ productId: 1 }] }`.
242
+ * @returns {Promise<IWishlistResponse | IError>} Returns the updated wishlist.
243
+ * @throws {IError} When isShell=false and an error occurs during the fetch
244
+ * @description This method requires user authorization (or a guest context).
245
+ * @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}.
246
+ */
247
+ async setWishlist(body) {
248
+ const result = await this._fetchPut('/me/wishlist', body);
249
+ const validated = this._validateResponse(result, usersSchemas_1.WishlistResponseSchema);
250
+ return this._normalizeData(validated);
251
+ }
252
+ /**
253
+ * Add an item to the wishlist.
254
+ * @handleName addWishlistItem
255
+ * @param {IWishlistAddItem} body - Item to add. Example: `{ productId: 1 }`.
256
+ * @returns {Promise<IWishlistResponse | IError>} Returns the updated wishlist.
257
+ * @throws {IError} When isShell=false and an error occurs during the fetch
258
+ * @description This method requires user authorization (or a guest context).
259
+ * @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}.
260
+ */
261
+ async addWishlistItem(body) {
262
+ const result = await this._fetchPost('/me/wishlist/items', body);
263
+ const validated = this._validateResponse(result, usersSchemas_1.WishlistResponseSchema);
264
+ return this._normalizeData(validated);
265
+ }
266
+ /**
267
+ * Remove an item from the wishlist.
268
+ * @handleName removeWishlistItem
269
+ * @param {number} productId - Product identifier. Example: 12345.
270
+ * @returns {Promise<IWishlistResponse | IError>} Returns the updated wishlist.
271
+ * @throws {IError} When isShell=false and an error occurs during the fetch
272
+ * @description This method requires user authorization (or a guest context).
273
+ * @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}.
274
+ */
275
+ async removeWishlistItem(productId) {
276
+ const result = await this._fetchDelete(`/me/wishlist/items/${productId}`);
277
+ const validated = this._validateResponse(result, usersSchemas_1.WishlistResponseSchema);
278
+ return this._normalizeData(validated);
279
+ }
170
280
  }
171
281
  exports.default = UsersApi;
@@ -132,6 +132,84 @@ interface IUsersApi {
132
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
133
  */
134
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>;
135
213
  }
136
214
  /**
137
215
  * @interface IUserEntity
@@ -224,4 +302,80 @@ interface IUserBody {
224
302
  notificationData?: INotificationData;
225
303
  state?: Record<string, unknown>;
226
304
  }
227
- export type { IUserBody, IUserEntity, IUsersApi };
305
+ /**
306
+ * @interface ICartItem
307
+ * @property {number} productId - Product identifier. Example: 1.
308
+ * @property {number} qty - Quantity of the product in the cart. Example: 2.
309
+ * @property {string} [addedAt] - ISO date when the item was added. Example: "2026-05-30T10:00:00.000Z".
310
+ * @description A single cart item.
311
+ */
312
+ interface ICartItem {
313
+ productId: number;
314
+ qty: number;
315
+ addedAt?: string;
316
+ }
317
+ /**
318
+ * @interface ICartResponse
319
+ * @property {ICartItem[]} items - Cart items.
320
+ * @property {number} total - Total number of items in the cart. Example: 3.
321
+ * @description The user's or guest's cart.
322
+ */
323
+ interface ICartResponse {
324
+ items: ICartItem[];
325
+ total: number;
326
+ }
327
+ /**
328
+ * @interface ICartSet
329
+ * @property {ICartItem[]} items - New cart items. Example: `[{ productId: 1, qty: 2 }]`.
330
+ * @description Body for replacing the whole cart.
331
+ */
332
+ interface ICartSet {
333
+ items: ICartItem[];
334
+ }
335
+ /**
336
+ * @interface ICartAddItem
337
+ * @property {number} productId - Product identifier. Example: 1.
338
+ * @property {number} qty - Quantity to add. Example: 2.
339
+ * @description Body for adding a single item to the cart.
340
+ */
341
+ interface ICartAddItem {
342
+ productId: number;
343
+ qty: number;
344
+ }
345
+ /**
346
+ * @interface IWishlistItem
347
+ * @property {number} productId - Product identifier. Example: 1.
348
+ * @property {string} [addedAt] - ISO date when the item was added. Example: "2026-05-30T10:00:00.000Z".
349
+ * @description A single wishlist item.
350
+ */
351
+ interface IWishlistItem {
352
+ productId: number;
353
+ addedAt?: string;
354
+ }
355
+ /**
356
+ * @interface IWishlistResponse
357
+ * @property {IWishlistItem[]} items - Wishlist items.
358
+ * @property {number} total - Total number of items in the wishlist. Example: 3.
359
+ * @description The user's or guest's wishlist.
360
+ */
361
+ interface IWishlistResponse {
362
+ items: IWishlistItem[];
363
+ total: number;
364
+ }
365
+ /**
366
+ * @interface IWishlistSet
367
+ * @property {IWishlistItem[]} items - New wishlist items. Example: `[{ productId: 1 }]`.
368
+ * @description Body for replacing the whole wishlist.
369
+ */
370
+ interface IWishlistSet {
371
+ items: IWishlistItem[];
372
+ }
373
+ /**
374
+ * @interface IWishlistAddItem
375
+ * @property {number} productId - Product identifier. Example: 1.
376
+ * @description Body for adding a single item to the wishlist.
377
+ */
378
+ interface IWishlistAddItem {
379
+ productId: number;
380
+ }
381
+ export type { ICartAddItem, ICartItem, ICartResponse, ICartSet, IUserBody, IUserEntity, IUsersApi, IWishlistAddItem, IWishlistItem, IWishlistResponse, IWishlistSet, };