oneentry 1.0.156 → 1.0.157

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 (39) hide show
  1. package/changelog.md +89 -0
  2. package/dist/attribute-sets/attributeSetsApi.js +4 -4
  3. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +1 -1
  4. package/dist/auth-provider/authProviderSchemas.d.ts +2 -0
  5. package/dist/auth-provider/authProviderSchemas.js +2 -0
  6. package/dist/auth-provider/authProvidersInterfaces.d.ts +4 -0
  7. package/dist/base/asyncModules.d.ts +18 -2
  8. package/dist/base/asyncModules.js +32 -8
  9. package/dist/base/syncModules.d.ts +36 -36
  10. package/dist/base/syncModules.js +60 -82
  11. package/dist/base/utils.d.ts +2 -2
  12. package/dist/forms/formsApi.js +2 -2
  13. package/dist/forms/formsInterfaces.d.ts +2 -2
  14. package/dist/forms-data/formsDataApi.js +2 -2
  15. package/dist/forms-data/formsDataInterfaces.d.ts +4 -4
  16. package/dist/integration-collections/integrationCollectionsApi.js +6 -6
  17. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +4 -0
  18. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +4 -0
  19. package/dist/integration-collections/integrationCollectionsSchemas.js +2 -0
  20. package/dist/menus/menusApi.js +1 -1
  21. package/dist/orders/ordersInterfaces.d.ts +10 -0
  22. package/dist/orders/ordersSchemas.d.ts +10 -0
  23. package/dist/orders/ordersSchemas.js +12 -0
  24. package/dist/pages/pagesApi.d.ts +4 -4
  25. package/dist/pages/pagesApi.js +10 -9
  26. package/dist/pages/pagesInterfaces.d.ts +14 -4
  27. package/dist/pages/pagesSchemas.d.ts +15 -0
  28. package/dist/pages/pagesSchemas.js +13 -1
  29. package/dist/products/productsApi.d.ts +4 -4
  30. package/dist/products/productsApi.js +12 -10
  31. package/dist/products/productsInterfaces.d.ts +16 -4
  32. package/dist/products/productsSchemas.d.ts +17 -0
  33. package/dist/products/productsSchemas.js +14 -1
  34. package/dist/subscriptions/subscriptionsApi.d.ts +4 -4
  35. package/dist/subscriptions/subscriptionsApi.js +3 -3
  36. package/dist/subscriptions/subscriptionsInterfaces.d.ts +26 -5
  37. package/dist/subscriptions/subscriptionsSchemas.d.ts +27 -1
  38. package/dist/subscriptions/subscriptionsSchemas.js +20 -2
  39. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RelatedProductsSchema = exports.ProductBlockSchema = exports.ProductsCountSchema = exports.SingleProductSchema = exports.ProductsResponseSchema = exports.ProductEntitySchema = exports.ProductImageSchema = exports.ProductPriceSchema = void 0;
3
+ exports.RelatedProductsSchema = exports.ProductBlockSchema = exports.ProductsCountSchema = exports.ProductSearchResponseSchema = exports.ProductSearchResultSchema = exports.SingleProductSchema = exports.ProductsResponseSchema = exports.ProductEntitySchema = exports.ProductImageSchema = exports.ProductPriceSchema = void 0;
4
4
  /**
5
5
  * Validation schemas for Products module
6
6
  * @description Zod schemas for validating products-related API responses
@@ -79,6 +79,19 @@ exports.ProductsResponseSchema = zod_1.z.object({
79
79
  * Single product response schema
80
80
  */
81
81
  exports.SingleProductSchema = exports.ProductEntitySchema;
82
+ /**
83
+ * Product search result schema
84
+ * Short card returned by the quick search endpoint
85
+ */
86
+ exports.ProductSearchResultSchema = zod_1.z.object({
87
+ id: zod_1.z.number(),
88
+ title: zod_1.z.string(),
89
+ pageId: zod_1.z.number(),
90
+ });
91
+ /**
92
+ * Product search response schema (array of short cards)
93
+ */
94
+ exports.ProductSearchResponseSchema = zod_1.z.array(exports.ProductSearchResultSchema);
82
95
  /**
83
96
  * Products count schema
84
97
  */
@@ -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 { ICancelSubscription, ICreatedSubscription, ISubscribe, ISubscriptionsApi } from './subscriptionsInterfaces';
4
+ import type { ICancelSubscription, ICreatedSubscription, ISubscribe, ISubscriptionEntity, ISubscriptionsApi } from './subscriptionsInterfaces';
5
5
  /**
6
6
  * Controllers for working with paid subscriptions.
7
7
  * @handle /api/content/subscriptions
@@ -41,15 +41,15 @@ export default class SubscriptionsApi extends AsyncModules implements ISubscript
41
41
  */
42
42
  cancelSubscription(body: ICancelSubscription): Promise<boolean | IError>;
43
43
  /**
44
- * Get all available subscription markers.
44
+ * Get all available subscriptions.
45
45
  * @handleName getAllSubscriptions
46
- * @returns {Promise<string[] | IError>} Returns an array of available subscription markers.
46
+ * @returns {Promise<ISubscriptionEntity[] | IError>} Returns an array of available subscriptions.
47
47
  * @throws {IError} When isShell=false and an error occurs during the fetch
48
48
  * @description This method requires user authorization.
49
49
  * @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}.
50
50
  * @see {@link https://js-sdk.oneentry.cloud/docs/subscriptions/getAllSubscriptions getAllSubscriptions} documentation.
51
51
  */
52
- getAllSubscriptions(): Promise<string[] | IError>;
52
+ getAllSubscriptions(): Promise<ISubscriptionEntity[] | IError>;
53
53
  /**
54
54
  * Get markers of the user's active subscriptions.
55
55
  * @handleName getActiveSubscriptions
@@ -51,9 +51,9 @@ class SubscriptionsApi extends asyncModules_1.default {
51
51
  return this._fetchBoolean(() => this._fetchDelete(``, body));
52
52
  }
53
53
  /**
54
- * Get all available subscription markers.
54
+ * Get all available subscriptions.
55
55
  * @handleName getAllSubscriptions
56
- * @returns {Promise<string[] | IError>} Returns an array of available subscription markers.
56
+ * @returns {Promise<ISubscriptionEntity[] | IError>} Returns an array of available subscriptions.
57
57
  * @throws {IError} When isShell=false and an error occurs during the fetch
58
58
  * @description This method requires user authorization.
59
59
  * @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}.
@@ -61,7 +61,7 @@ class SubscriptionsApi extends asyncModules_1.default {
61
61
  */
62
62
  async getAllSubscriptions() {
63
63
  const data = await this._fetchGet(``);
64
- const validated = this._validateResponse(data, subscriptionsSchemas_1.SubscriptionMarkersSchema);
64
+ const validated = this._validateResponse(data, subscriptionsSchemas_1.SubscriptionsListSchema);
65
65
  return this._normalizeData(validated);
66
66
  }
67
67
  /**
@@ -1,4 +1,4 @@
1
- import type { IError } from '../base/utils';
1
+ import type { IError, ILocalizeInfo } from '../base/utils';
2
2
  /**
3
3
  * Interface for the Subscriptions API module.
4
4
  * @interface ISubscriptionsApi
@@ -26,14 +26,14 @@ interface ISubscriptionsApi {
26
26
  */
27
27
  cancelSubscription(body: ICancelSubscription): Promise<boolean | IError>;
28
28
  /**
29
- * Get all available subscription markers.
29
+ * Get all available subscriptions.
30
30
  * @handleName getAllSubscriptions
31
- * @returns {Promise<string[] | IError>} Returns an array of available subscription markers.
31
+ * @returns {Promise<ISubscriptionEntity[] | IError>} Returns an array of available subscriptions.
32
32
  * @throws {IError} When isShell=false and an error occurs during the fetch
33
33
  * @description This method requires user authorization.
34
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
35
  */
36
- getAllSubscriptions(): Promise<string[] | IError>;
36
+ getAllSubscriptions(): Promise<ISubscriptionEntity[] | IError>;
37
37
  /**
38
38
  * Get markers of the user's active subscriptions.
39
39
  * @handleName getActiveSubscriptions
@@ -87,4 +87,25 @@ interface ICreatedSubscription {
87
87
  paymentUrl: string;
88
88
  status: string;
89
89
  }
90
- export type { ICancelSubscription, ICreatedSubscription, ISubscribe, ISubscriptionsApi, };
90
+ /**
91
+ * Available subscription.
92
+ * @interface ISubscriptionEntity
93
+ * @property {number} id - Subscription identifier. Example: 1.
94
+ * @property {string} identifier - Subscription textual identifier (marker). Example: "test_subscription".
95
+ * @property {ILocalizeInfo} localizeInfos - Localized subscription info for the current language. Example: `{ title: "Test subscription" }`.
96
+ * @property {number[]} productIds - Identifiers of the products included in the subscription. Example: [3445].
97
+ * @property {number} periodInDays - Subscription period in days. Example: 30.
98
+ * @property {number} paymentAccountId - Identifier of the payment account the subscription is billed through. Example: 1.
99
+ * @property {boolean} isUsed - Indicates whether the subscription is in use. Example: false.
100
+ * @description Subscription configured in the project, returned by getAllSubscriptions.
101
+ */
102
+ interface ISubscriptionEntity {
103
+ id: number;
104
+ identifier: string;
105
+ localizeInfos: ILocalizeInfo;
106
+ productIds: number[];
107
+ periodInDays: number;
108
+ paymentAccountId: number;
109
+ isUsed: boolean;
110
+ }
111
+ export type { ICancelSubscription, ICreatedSubscription, ISubscribe, ISubscriptionEntity, ISubscriptionsApi, };
@@ -13,8 +13,34 @@ export declare const CreatedSubscriptionSchema: z.ZodObject<{
13
13
  paymentUrl: z.ZodString;
14
14
  status: z.ZodString;
15
15
  }, z.core.$strip>;
16
+ /**
17
+ * Subscription entity schema
18
+ * @description Schema for an available subscription as returned by the API (localizeInfos kept as a locale map)
19
+ */
20
+ export declare const SubscriptionEntitySchema: z.ZodObject<{
21
+ id: z.ZodNumber;
22
+ identifier: z.ZodString;
23
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
24
+ productIds: z.ZodArray<z.ZodNumber>;
25
+ periodInDays: z.ZodNumber;
26
+ paymentAccountId: z.ZodNumber;
27
+ isUsed: z.ZodBoolean;
28
+ }, z.core.$strip>;
29
+ /**
30
+ * Subscriptions list schema
31
+ * @description Schema for the array of available subscriptions returned by getAllSubscriptions
32
+ */
33
+ export declare const SubscriptionsListSchema: z.ZodArray<z.ZodObject<{
34
+ id: z.ZodNumber;
35
+ identifier: z.ZodString;
36
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
37
+ productIds: z.ZodArray<z.ZodNumber>;
38
+ periodInDays: z.ZodNumber;
39
+ paymentAccountId: z.ZodNumber;
40
+ isUsed: z.ZodBoolean;
41
+ }, z.core.$strip>>;
16
42
  /**
17
43
  * Subscription markers schema
18
- * @description Schema for arrays of subscription markers (available and active subscriptions)
44
+ * @description Schema for the array of active subscription markers returned by getActiveSubscriptions
19
45
  */
20
46
  export declare const SubscriptionMarkersSchema: z.ZodArray<z.ZodString>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscriptionMarkersSchema = exports.CreatedSubscriptionSchema = void 0;
3
+ exports.SubscriptionMarkersSchema = exports.SubscriptionsListSchema = exports.SubscriptionEntitySchema = exports.CreatedSubscriptionSchema = void 0;
4
4
  /**
5
5
  * Validation schemas for Subscriptions module
6
6
  * @description Zod schemas for validating subscriptions-related API responses
@@ -16,8 +16,26 @@ exports.CreatedSubscriptionSchema = zod_1.z.object({
16
16
  paymentUrl: zod_1.z.string(),
17
17
  status: zod_1.z.string(),
18
18
  });
19
+ /**
20
+ * Subscription entity schema
21
+ * @description Schema for an available subscription as returned by the API (localizeInfos kept as a locale map)
22
+ */
23
+ exports.SubscriptionEntitySchema = zod_1.z.object({
24
+ id: zod_1.z.number(),
25
+ identifier: zod_1.z.string(),
26
+ localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
27
+ productIds: zod_1.z.array(zod_1.z.number()),
28
+ periodInDays: zod_1.z.number(),
29
+ paymentAccountId: zod_1.z.number(),
30
+ isUsed: zod_1.z.boolean(),
31
+ });
32
+ /**
33
+ * Subscriptions list schema
34
+ * @description Schema for the array of available subscriptions returned by getAllSubscriptions
35
+ */
36
+ exports.SubscriptionsListSchema = zod_1.z.array(exports.SubscriptionEntitySchema);
19
37
  /**
20
38
  * Subscription markers schema
21
- * @description Schema for arrays of subscription markers (available and active subscriptions)
39
+ * @description Schema for the array of active subscription markers returned by getActiveSubscriptions
22
40
  */
23
41
  exports.SubscriptionMarkersSchema = zod_1.z.array(zod_1.z.string());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.156",
3
+ "version": "1.0.157",
4
4
  "description": "OneEntry NPM package",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",