oneentry 1.0.142 → 1.0.143

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 (149) hide show
  1. package/dist/admins/adminsApi.d.ts +50 -0
  2. package/dist/admins/adminsApi.js +65 -0
  3. package/dist/admins/adminsInterfaces.d.ts +98 -0
  4. package/dist/admins/adminsInterfaces.js +2 -0
  5. package/dist/admins/adminsSchemas.d.ts +30 -0
  6. package/dist/admins/adminsSchemas.js +27 -0
  7. package/dist/attribute-sets/attributeSetsApi.d.ts +63 -0
  8. package/dist/attribute-sets/attributeSetsApi.js +98 -0
  9. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +185 -0
  10. package/dist/attribute-sets/attributeSetsInterfaces.js +2 -0
  11. package/dist/attribute-sets/attributeSetsSchemas.d.ts +90 -0
  12. package/dist/attribute-sets/attributeSetsSchemas.js +74 -0
  13. package/dist/auth-provider/authProviderApi.d.ts +249 -0
  14. package/dist/auth-provider/authProviderApi.js +354 -0
  15. package/dist/auth-provider/authProviderSchemas.d.ts +131 -0
  16. package/dist/auth-provider/authProviderSchemas.js +82 -0
  17. package/dist/auth-provider/authProvidersInterfaces.d.ts +412 -0
  18. package/dist/auth-provider/authProvidersInterfaces.js +2 -0
  19. package/dist/base/asyncModules.d.ts +80 -0
  20. package/dist/base/asyncModules.js +448 -0
  21. package/dist/base/result.d.ts +39 -0
  22. package/dist/base/result.js +154 -0
  23. package/dist/base/stateModule.d.ts +41 -0
  24. package/dist/base/stateModule.js +128 -0
  25. package/dist/base/syncModules.d.ts +286 -0
  26. package/dist/base/syncModules.js +716 -0
  27. package/dist/base/utils.d.ts +197 -0
  28. package/dist/base/utils.js +2 -0
  29. package/dist/base/validation.d.ts +118 -0
  30. package/dist/base/validation.js +132 -0
  31. package/dist/blocks/blocksApi.d.ts +76 -0
  32. package/dist/blocks/blocksApi.js +188 -0
  33. package/dist/blocks/blocksInterfaces.d.ts +168 -0
  34. package/dist/blocks/blocksInterfaces.js +2 -0
  35. package/dist/blocks/blocksSchemas.d.ts +195 -0
  36. package/dist/blocks/blocksSchemas.js +43 -0
  37. package/dist/discounts/discountsApi.d.ts +56 -0
  38. package/dist/discounts/discountsApi.js +82 -0
  39. package/dist/discounts/discountsInterfaces.d.ts +145 -0
  40. package/dist/discounts/discountsInterfaces.js +2 -0
  41. package/dist/events/eventsApi.d.ts +60 -0
  42. package/dist/events/eventsApi.js +97 -0
  43. package/dist/events/eventsInterfaces.d.ts +87 -0
  44. package/dist/events/eventsInterfaces.js +2 -0
  45. package/dist/file-uploading/fileUploadingApi.d.ts +88 -0
  46. package/dist/file-uploading/fileUploadingApi.js +129 -0
  47. package/dist/file-uploading/fileUploadingInterfaces.d.ts +114 -0
  48. package/dist/file-uploading/fileUploadingInterfaces.js +2 -0
  49. package/dist/file-uploading/fileUploadingSchemas.d.ts +22 -0
  50. package/dist/file-uploading/fileUploadingSchemas.js +21 -0
  51. package/dist/forms/formsApi.d.ts +42 -0
  52. package/dist/forms/formsApi.js +57 -0
  53. package/dist/forms/formsInterfaces.d.ts +134 -0
  54. package/dist/forms/formsInterfaces.js +2 -0
  55. package/dist/forms/formsSchemas.d.ts +50 -0
  56. package/dist/forms/formsSchemas.js +31 -0
  57. package/dist/forms-data/formsDataApi.d.ts +106 -0
  58. package/dist/forms-data/formsDataApi.js +189 -0
  59. package/dist/forms-data/formsDataInterfaces.d.ts +522 -0
  60. package/dist/forms-data/formsDataInterfaces.js +2 -0
  61. package/dist/forms-data/formsDataSchemas.d.ts +115 -0
  62. package/dist/forms-data/formsDataSchemas.js +86 -0
  63. package/dist/general-types/generalTypesApi.d.ts +28 -0
  64. package/dist/general-types/generalTypesApi.js +38 -0
  65. package/dist/general-types/generalTypesInterfaces.d.ts +29 -0
  66. package/dist/general-types/generalTypesInterfaces.js +2 -0
  67. package/dist/general-types/generalTypesSchemas.d.ts +50 -0
  68. package/dist/general-types/generalTypesSchemas.js +35 -0
  69. package/dist/index.d.ts +100 -0
  70. package/dist/index.js +103 -0
  71. package/dist/integration-collections/integrationCollectionsApi.d.ts +163 -0
  72. package/dist/integration-collections/integrationCollectionsApi.js +220 -0
  73. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +313 -0
  74. package/dist/integration-collections/integrationCollectionsInterfaces.js +2 -0
  75. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +80 -0
  76. package/dist/integration-collections/integrationCollectionsSchemas.js +61 -0
  77. package/dist/locales/localesApi.d.ts +27 -0
  78. package/dist/locales/localesApi.js +37 -0
  79. package/dist/locales/localesInterfaces.d.ts +40 -0
  80. package/dist/locales/localesInterfaces.js +2 -0
  81. package/dist/locales/localesSchemas.d.ts +32 -0
  82. package/dist/locales/localesSchemas.js +26 -0
  83. package/dist/menus/menusApi.d.ts +29 -0
  84. package/dist/menus/menusApi.js +39 -0
  85. package/dist/menus/menusInterfaces.d.ts +87 -0
  86. package/dist/menus/menusInterfaces.js +3 -0
  87. package/dist/menus/menusSchemas.d.ts +16 -0
  88. package/dist/menus/menusSchemas.js +28 -0
  89. package/dist/orders/ordersApi.d.ts +149 -0
  90. package/dist/orders/ordersApi.js +203 -0
  91. package/dist/orders/ordersInterfaces.d.ts +520 -0
  92. package/dist/orders/ordersInterfaces.js +2 -0
  93. package/dist/orders/ordersSchemas.d.ts +120 -0
  94. package/dist/orders/ordersSchemas.js +101 -0
  95. package/dist/pages/pagesApi.d.ts +151 -0
  96. package/dist/pages/pagesApi.js +390 -0
  97. package/dist/pages/pagesInterfaces.d.ts +284 -0
  98. package/dist/pages/pagesInterfaces.js +2 -0
  99. package/dist/pages/pagesSchemas.d.ts +85 -0
  100. package/dist/pages/pagesSchemas.js +46 -0
  101. package/dist/payments/paymentsApi.d.ts +82 -0
  102. package/dist/payments/paymentsApi.js +121 -0
  103. package/dist/payments/paymentsInterfaces.d.ts +200 -0
  104. package/dist/payments/paymentsInterfaces.js +2 -0
  105. package/dist/payments/paymentsSchemas.d.ts +100 -0
  106. package/dist/payments/paymentsSchemas.js +65 -0
  107. package/dist/product-statuses/productStatusesApi.d.ts +47 -0
  108. package/dist/product-statuses/productStatusesApi.js +70 -0
  109. package/dist/product-statuses/productStatusesInterfaces.d.ts +62 -0
  110. package/dist/product-statuses/productStatusesInterfaces.js +2 -0
  111. package/dist/product-statuses/productStatusesSchemas.d.ts +34 -0
  112. package/dist/product-statuses/productStatusesSchemas.js +30 -0
  113. package/dist/products/productsApi.d.ts +365 -0
  114. package/dist/products/productsApi.js +459 -0
  115. package/dist/products/productsInterfaces.d.ts +577 -0
  116. package/dist/products/productsInterfaces.js +2 -0
  117. package/dist/products/productsSchemas.d.ts +200 -0
  118. package/dist/products/productsSchemas.js +98 -0
  119. package/dist/sitemap/sitemapApi.d.ts +35 -0
  120. package/dist/sitemap/sitemapApi.js +45 -0
  121. package/dist/sitemap/sitemapInterfaces.d.ts +40 -0
  122. package/dist/sitemap/sitemapInterfaces.js +2 -0
  123. package/dist/system/systemApi.d.ts +43 -0
  124. package/dist/system/systemApi.js +56 -0
  125. package/dist/system/systemInterfaces.d.ts +29 -0
  126. package/dist/system/systemInterfaces.js +2 -0
  127. package/dist/templates/templatesApi.d.ts +49 -0
  128. package/dist/templates/templatesApi.js +75 -0
  129. package/dist/templates/templatesInterfaces.d.ts +67 -0
  130. package/dist/templates/templatesInterfaces.js +2 -0
  131. package/dist/templates/templatesSchemas.d.ts +48 -0
  132. package/dist/templates/templatesSchemas.js +31 -0
  133. package/dist/templates-preview/templatesPreviewApi.d.ts +38 -0
  134. package/dist/templates-preview/templatesPreviewApi.js +53 -0
  135. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +119 -0
  136. package/dist/templates-preview/templatesPreviewInterfaces.js +2 -0
  137. package/dist/templates-preview/templatesPreviewSchemas.d.ts +83 -0
  138. package/dist/templates-preview/templatesPreviewSchemas.js +48 -0
  139. package/dist/users/usersApi.d.ts +143 -0
  140. package/dist/users/usersApi.js +171 -0
  141. package/dist/users/usersInterfaces.d.ts +229 -0
  142. package/dist/users/usersInterfaces.js +2 -0
  143. package/dist/users/usersSchemas.d.ts +38 -0
  144. package/dist/users/usersSchemas.js +28 -0
  145. package/dist/web-socket/wsApi.d.ts +25 -0
  146. package/dist/web-socket/wsApi.js +45 -0
  147. package/dist/web-socket/wsInterfaces.d.ts +16 -0
  148. package/dist/web-socket/wsInterfaces.js +2 -0
  149. package/package.json +3 -81
@@ -0,0 +1,200 @@
1
+ import type { IError, ILocalizeInfo } from '../base/utils';
2
+ /**
3
+ * @interface IPaymentsApi
4
+ * @description This interface defines methods for managing payment sessions, accounts, and connected payment settings in the system.
5
+ */
6
+ interface IPaymentsApi {
7
+ /**
8
+ * Get list of payment sessions.
9
+ * @handleName getSessions
10
+ * @param {number} [offset] - Optional parameter for pagination. Default: 0.
11
+ * @param {number} [limit] - Optional parameter for pagination. Default: 30.
12
+ * @returns {ISessionsEntity} Returns an array of SessionEntity objects.
13
+ * @throws {IError} If there is an error during the fetch operation, it will return an error object.
14
+ * @description This method gets list of payment sessions. 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
+ getSessions(offset?: number, limit?: number): Promise<ISessionsEntity | IError>;
18
+ /**
19
+ * Get a single payment session object by its identifier.
20
+ * @handleName getSessionById
21
+ * @param {number} id - Identifier of the retrieved payment session object. Example: 12345.
22
+ * @returns {ISessionEntity} Returns a single payment session object.
23
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
24
+ * @description This method gets a single payment session object by its identifier. 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
+ getSessionById(id: number): Promise<ISessionEntity | IError>;
28
+ /**
29
+ * Get one payment session object by order identifier 🔐
30
+ * @handleName getSessionByOrderId
31
+ * @param {number} id - Order identifier. Example: 12345.
32
+ * @returns {ISessionEntity} Returns a single payment session object.
33
+ * @throws {IError} If there is an error during the fetch operation, it will return an error object.
34
+ * @description This method gets one payment session object by order identifier. This method requires user authorization.
35
+ * @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}.
36
+ */
37
+ getSessionByOrderId(id: number): Promise<ISessionEntity | ISessionEntity[] | IError>;
38
+ /**
39
+ * Creation of payment session.
40
+ * @handleName createSession
41
+ * @param {number} orderId - Order identifier. Example: 12345.
42
+ * @param {'session' | 'intent'} type - Session type. Possible values: "session" or "intent". Example: "session".
43
+ * @param {boolean} [automaticTaxEnabled] - Automatic calculation of the tax rate. Default: false.
44
+ * @returns {ICreateSessionEntity} Returns a single payment session object.
45
+ * @throws {IError} If there is an error during the fetch operation, it will return an error object.
46
+ * @description This method creates a payment session. This method requires user authorization.
47
+ * @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}.
48
+ */
49
+ createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ICreateSessionEntity | IError>;
50
+ /**
51
+ * Get all payment accounts as an array.
52
+ * @handleName getAccounts
53
+ * @returns {IAccountsEntity} Returns all created payment accounts as an array of PaymentAccountEntity objects.
54
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
55
+ * @description This method gets all payment accounts as an array. This method requires user authorization.
56
+ * @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}.
57
+ */
58
+ getAccounts(): Promise<IAccountsEntity[] | IError>;
59
+ /**
60
+ * Get a single payment account object by its identifier.
61
+ * @handleName getAccountById
62
+ * @param {number} id - Identifier of the retrieved payment account object. Example: 12345.
63
+ * @returns {IAccountsEntity} Returns a single payment account object.
64
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
65
+ * @description This method gets a single payment account object by its identifier. This method requires user authorization.
66
+ * @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}.
67
+ */
68
+ getAccountById(id: number): Promise<IAccountsEntity | IError>;
69
+ }
70
+ /**
71
+ * @interface ISessionsEntity
72
+ * @property {number} total - Total number of found records. Example: 100.
73
+ * @property {ISessionEntity[]} items - Array of session objects.
74
+ * @example
75
+ [
76
+ {
77
+ "id": 27,
78
+ "createdDate": "2025-06-04T04:38:32.849Z",
79
+ "updatedDate": "2025-06-04T04:38:32.849Z",
80
+ "type": "session",
81
+ "status": "waiting",
82
+ "paymentAccountId": 1,
83
+ "orderId": 55,
84
+ "paymentUrl": null
85
+ }
86
+ ]
87
+ * @description Represents a response from the payments API containing a total count and an array of session entities.
88
+ */
89
+ interface ISessionsEntity {
90
+ total: number;
91
+ items: ISessionEntity[];
92
+ }
93
+ /**
94
+ * @interface ISessionEntity
95
+ * @property {number} id - Object identifier. Example: 1764.
96
+ * @property {string} createdDate - Object creation date. Example: "2025-02-26T10:13:16.839Z".
97
+ * @property {string} updatedDate - Object modification date. Example: "2025-02-26T10:13:16.839Z".
98
+ * @property {string} type - Type may be 'session' or 'intent'. Example: "session".
99
+ * @property {string} status - Payment status. Example: "completed".
100
+ * @property {number} paymentAccountId - Payment account identifier. Example: 1.
101
+ * @property {number} orderId - Order identifier. Example: 1.
102
+ * @property {string | null} paymentUrl - payment link. Example: " https://www.sandbox.paypal.com/checkoutnow?token=9BE88048TU058770M".
103
+ * @property {number | null} [amount] - Amount of the payment session. Example: 100.
104
+ * @description This interface defines the structure of a session entity, including its quantity, amount, currency, name, and description.
105
+ */
106
+ interface ISessionEntity {
107
+ id: number;
108
+ createdDate: string;
109
+ updatedDate: string;
110
+ type: string;
111
+ status: string;
112
+ paymentAccountId: number;
113
+ orderId: number;
114
+ paymentUrl: string | null;
115
+ amount?: number | null;
116
+ }
117
+ /**
118
+ * @interface IIntent
119
+ * @property {number} amount - Amount of the payment intent. Example: 100.00.
120
+ * @property {string} currency - Currency of the payment intent. Example: "USD".
121
+ * @description This interface defines the structure of a payment intent, including its amount and currency.
122
+ */
123
+ interface IIntent {
124
+ amount: number;
125
+ currency: string;
126
+ }
127
+ /**
128
+ * @interface ISessionItem
129
+ * @property {number} id - Object identifier. Example: 12345.
130
+ * @property {string} updatedDate - Object modification date. Example: "2023-10-01T12:00:00Z".
131
+ * @property {string} type - Type may be 'session' or 'intent'. Example: 'session'.
132
+ * @property {number} orderId - Order identifier. Example: 12345.
133
+ * @property {number} paymentAccountId - Payment account object identifier. Example: 12345.
134
+ * @property {string} paymentUrl - Payment link. Example: "https://example.com/payment/12345".
135
+ * @property {string} clientSecret - Client secret key. Example: "sk_test_4eC39HqLyjWDarjtT1zdp7dc".
136
+ * @property {string} status - payment status. Example: "pending".
137
+ * @description This interface defines the structure of a session item, which includes identifiers, payment details, and status information.
138
+ */
139
+ interface ISessionItem {
140
+ id: number;
141
+ updatedDate: string;
142
+ type: 'session' | 'intent';
143
+ orderId: number;
144
+ paymentAccountId: number;
145
+ paymentUrl: string;
146
+ clientSecret: string;
147
+ status: string;
148
+ }
149
+ /**
150
+ * @interface ICreateSessionEntity
151
+ * @property {number} id - Object identifier. Example: 12345.
152
+ * @property {string} updatedDate - Object modification date. Example: "2023-10-01T12:00:00Z".
153
+ * @property {number} version - Version of the object. Example: 1.
154
+ * @property {string} identifier - Text identifier for the recording field. Example: "payment_12345".
155
+ * @property {string} paymentUrl - Payment link. Example: "https://example.com/payment/12345".
156
+ * @description This interface defines the structure of a session entity created during the payment process, including its identifiers, version, and payment URL.
157
+ */
158
+ interface ICreateSessionEntity {
159
+ id: number;
160
+ updatedDate: string;
161
+ version: number;
162
+ identifier: string;
163
+ paymentUrl: string;
164
+ }
165
+ /**
166
+ * @interface IAccountsEntity
167
+ * @property {number} id - Object identifier. Example: 12345.
168
+ * @property {ILocalizeInfo} localizeInfos - Json description of the payment account object.
169
+ * @property {string} identifier - Text identifier for the recording field. Example: "payment_12345".
170
+ * @property {'stripe' | 'custom'} type - Type may be 'stripe' or 'custom'. Example: 'stripe'.
171
+ * @property {boolean} isVisible - Visibility indicator of the payment account. Example: true.
172
+ * @property {boolean} isUsed - Usage indicator of the payment account. Example: false.
173
+ * @property {boolean} testMode - Indicates whether the payment account is in test mode. Example: true.
174
+ * @property {object} settings - Payment account settings. Example: {}.
175
+ * @property {object} [testSettings] - Test mode settings for the payment account. Example: {}.
176
+ * @property {string} updatedDate - Object modification date. Example: "2025-02-26T10:13:16.839Z".
177
+ * @description This interface defines the structure of a payment account entity, including its identifiers, localization information, type, visibility, and usage status.
178
+ */
179
+ interface IAccountsEntity {
180
+ id: number;
181
+ localizeInfos: ILocalizeInfo;
182
+ identifier: string;
183
+ type: 'stripe' | 'custom';
184
+ isVisible: boolean;
185
+ isUsed: boolean;
186
+ testMode: boolean;
187
+ settings: object;
188
+ testSettings?: {
189
+ cancelUrl?: string;
190
+ successUrl?: string;
191
+ sessionTimeout?: number;
192
+ stripeAccountId?: string;
193
+ stripeRedirectUrl?: string;
194
+ stripeOnboardingComplete?: boolean;
195
+ stripePublishableKey?: string;
196
+ status: string;
197
+ };
198
+ updatedDate: string;
199
+ }
200
+ export type { IAccountsEntity, ICreateSessionEntity, IIntent, IPaymentsApi, ISessionEntity, ISessionItem, ISessionsEntity, };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,100 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Payment session schema
4
+ * @description Zod schema for validating payment session responses
5
+ */
6
+ export declare const PaymentSessionSchema: z.ZodObject<{
7
+ id: z.ZodNumber;
8
+ orderId: z.ZodNumber;
9
+ amount: z.ZodNullable<z.ZodNumber>;
10
+ status: z.ZodString;
11
+ createdDate: z.ZodString;
12
+ updatedDate: z.ZodString;
13
+ type: z.ZodString;
14
+ paymentAccountId: z.ZodNumber;
15
+ paymentUrl: z.ZodNullable<z.ZodString>;
16
+ }, z.core.$strip>;
17
+ /**
18
+ * Payment sessions response schema
19
+ * @description Paginated response schema for payment sessions
20
+ */
21
+ export declare const PaymentSessionsResponseSchema: z.ZodObject<{
22
+ items: z.ZodArray<z.ZodObject<{
23
+ id: z.ZodNumber;
24
+ orderId: z.ZodNumber;
25
+ amount: z.ZodNullable<z.ZodNumber>;
26
+ status: z.ZodString;
27
+ createdDate: z.ZodString;
28
+ updatedDate: z.ZodString;
29
+ type: z.ZodString;
30
+ paymentAccountId: z.ZodNumber;
31
+ paymentUrl: z.ZodNullable<z.ZodString>;
32
+ }, z.core.$strip>>;
33
+ total: z.ZodNumber;
34
+ }, z.core.$strip>;
35
+ /**
36
+ * Single payment session response schema
37
+ * @description Schema for a single payment session or array of sessions by order
38
+ */
39
+ export declare const SinglePaymentSessionSchema: z.ZodUnion<readonly [z.ZodObject<{
40
+ id: z.ZodNumber;
41
+ orderId: z.ZodNumber;
42
+ amount: z.ZodNullable<z.ZodNumber>;
43
+ status: z.ZodString;
44
+ createdDate: z.ZodString;
45
+ updatedDate: z.ZodString;
46
+ type: z.ZodString;
47
+ paymentAccountId: z.ZodNumber;
48
+ paymentUrl: z.ZodNullable<z.ZodString>;
49
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
50
+ id: z.ZodNumber;
51
+ orderId: z.ZodNumber;
52
+ amount: z.ZodNullable<z.ZodNumber>;
53
+ status: z.ZodString;
54
+ createdDate: z.ZodString;
55
+ updatedDate: z.ZodString;
56
+ type: z.ZodString;
57
+ paymentAccountId: z.ZodNumber;
58
+ paymentUrl: z.ZodNullable<z.ZodString>;
59
+ }, z.core.$strip>>]>;
60
+ /**
61
+ * Payment account schema
62
+ * @description Schema for a payment account
63
+ */
64
+ export declare const PaymentAccountSchema: z.ZodObject<{
65
+ id: z.ZodNumber;
66
+ identifier: z.ZodString;
67
+ isVisible: z.ZodBoolean;
68
+ isUsed: z.ZodBoolean;
69
+ testMode: z.ZodBoolean;
70
+ type: z.ZodString;
71
+ settings: z.ZodRecord<z.ZodString, z.ZodAny>;
72
+ testSettings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
73
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
74
+ updatedDate: z.ZodString;
75
+ }, z.core.$strip>;
76
+ /**
77
+ * Payment accounts response schema
78
+ */
79
+ export declare const PaymentAccountsResponseSchema: z.ZodArray<z.ZodObject<{
80
+ id: z.ZodNumber;
81
+ identifier: z.ZodString;
82
+ isVisible: z.ZodBoolean;
83
+ isUsed: z.ZodBoolean;
84
+ testMode: z.ZodBoolean;
85
+ type: z.ZodString;
86
+ settings: z.ZodRecord<z.ZodString, z.ZodAny>;
87
+ testSettings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
88
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
89
+ updatedDate: z.ZodString;
90
+ }, z.core.$strip>>;
91
+ /**
92
+ * Create session response schema
93
+ */
94
+ export declare const CreateSessionResponseSchema: z.ZodObject<{
95
+ id: z.ZodNumber;
96
+ updatedDate: z.ZodString;
97
+ version: z.ZodNumber;
98
+ identifier: z.ZodString;
99
+ paymentUrl: z.ZodString;
100
+ }, z.core.$strip>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateSessionResponseSchema = exports.PaymentAccountsResponseSchema = exports.PaymentAccountSchema = exports.SinglePaymentSessionSchema = exports.PaymentSessionsResponseSchema = exports.PaymentSessionSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Payment session schema
7
+ * @description Zod schema for validating payment session responses
8
+ */
9
+ exports.PaymentSessionSchema = zod_1.z.object({
10
+ id: zod_1.z.number(),
11
+ orderId: zod_1.z.number(),
12
+ amount: zod_1.z.number().nullable(),
13
+ status: zod_1.z.string(),
14
+ createdDate: zod_1.z.string(),
15
+ updatedDate: zod_1.z.string(),
16
+ type: zod_1.z.string(),
17
+ paymentAccountId: zod_1.z.number(),
18
+ paymentUrl: zod_1.z.string().nullable(),
19
+ });
20
+ /**
21
+ * Payment sessions response schema
22
+ * @description Paginated response schema for payment sessions
23
+ */
24
+ exports.PaymentSessionsResponseSchema = zod_1.z.object({
25
+ items: zod_1.z.array(exports.PaymentSessionSchema),
26
+ total: zod_1.z.number(),
27
+ });
28
+ /**
29
+ * Single payment session response schema
30
+ * @description Schema for a single payment session or array of sessions by order
31
+ */
32
+ exports.SinglePaymentSessionSchema = zod_1.z.union([
33
+ exports.PaymentSessionSchema,
34
+ zod_1.z.array(exports.PaymentSessionSchema),
35
+ ]);
36
+ /**
37
+ * Payment account schema
38
+ * @description Schema for a payment account
39
+ */
40
+ exports.PaymentAccountSchema = zod_1.z.object({
41
+ id: zod_1.z.number(),
42
+ identifier: zod_1.z.string(),
43
+ isVisible: zod_1.z.boolean(),
44
+ isUsed: zod_1.z.boolean(),
45
+ testMode: zod_1.z.boolean(),
46
+ type: zod_1.z.string(),
47
+ settings: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
48
+ testSettings: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
49
+ localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
50
+ updatedDate: zod_1.z.string(),
51
+ });
52
+ /**
53
+ * Payment accounts response schema
54
+ */
55
+ exports.PaymentAccountsResponseSchema = zod_1.z.array(exports.PaymentAccountSchema);
56
+ /**
57
+ * Create session response schema
58
+ */
59
+ exports.CreateSessionResponseSchema = zod_1.z.object({
60
+ id: zod_1.z.number(),
61
+ updatedDate: zod_1.z.string(),
62
+ version: zod_1.z.number(),
63
+ identifier: zod_1.z.string(),
64
+ paymentUrl: zod_1.z.string(),
65
+ });
@@ -0,0 +1,47 @@
1
+ import AsyncModules from '../base/asyncModules';
2
+ import type StateModule from '../base/stateModule';
3
+ import type { IError } from '../base/utils';
4
+ import type { IProductStatusEntity, IProductStatusesApi } from './productStatusesInterfaces';
5
+ /**
6
+ * Controllers for working with product statuses
7
+ * @handle /api/content/product-statuses
8
+ * @description Controllers for working with product statuses
9
+ */
10
+ export default class ProductStatusesApi extends AsyncModules implements IProductStatusesApi {
11
+ protected state: StateModule;
12
+ protected _url: string;
13
+ /**
14
+ * Constructor
15
+ * @param {StateModule} state - State module instance
16
+ * @description Constructor initializes the ProductStatusesApi with a given state.
17
+ */
18
+ constructor(state: StateModule);
19
+ /**
20
+ * Search for all product status objects.
21
+ * @handleName getProductStatuses
22
+ * @param {string} [langCode] - Language code. Default: "en_US".
23
+ * @returns {Promise<IProductStatusEntity[] | IError>} Returns an array of product status objects.
24
+ * @throws {IError} When isShell=false and an error occurs during the fetch
25
+ * @description Search for all product status objects.
26
+ */
27
+ getProductStatuses(langCode?: string): Promise<IProductStatusEntity[] | IError>;
28
+ /**
29
+ * Search for a product status object by its textual identifier (marker).
30
+ * @handleName getProductsByStatusMarker
31
+ * @param {string} marker - Product marker. Example: "in_stock".
32
+ * @param {string} [langCode] - Language code. Default: "en_US".
33
+ * @returns {Promise<IProductStatusEntity | IError>} Returns a product status object.
34
+ * @throws {IError} When isShell=false and an error occurs during the fetch
35
+ * @description Search for a product status object by its textual identifier (marker).
36
+ */
37
+ getProductsByStatusMarker(marker: string, langCode?: string): Promise<IProductStatusEntity | IError>;
38
+ /**
39
+ * Check the existence of a textual identifier.
40
+ * @handleName validateMarker
41
+ * @param {string} marker - Product marker. Example: "in_stock".
42
+ * @returns {Promise<boolean | IError>} Returns true if the textual identifier (marker) exists or false if it doesn't.
43
+ * @throws {IError} When isShell=false and an error occurs during the fetch
44
+ * @description Check the existence of a textual identifier.
45
+ */
46
+ validateMarker(marker: string): Promise<boolean | IError>;
47
+ }
@@ -0,0 +1,70 @@
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
+ const productStatusesSchemas_1 = require("./productStatusesSchemas");
8
+ /**
9
+ * Controllers for working with product statuses
10
+ * @handle /api/content/product-statuses
11
+ * @description Controllers for working with product statuses
12
+ */
13
+ class ProductStatusesApi extends asyncModules_1.default {
14
+ /**
15
+ * Constructor
16
+ * @param {StateModule} state - State module instance
17
+ * @description Constructor initializes the ProductStatusesApi with a given state.
18
+ */
19
+ constructor(state) {
20
+ super(state);
21
+ this._url = state.url + '/api/content/product-statuses';
22
+ }
23
+ /**
24
+ * Search for all product status objects.
25
+ * @handleName getProductStatuses
26
+ * @param {string} [langCode] - Language code. Default: "en_US".
27
+ * @returns {Promise<IProductStatusEntity[] | IError>} Returns an array of product status objects.
28
+ * @throws {IError} When isShell=false and an error occurs during the fetch
29
+ * @description Search for all product status objects.
30
+ */
31
+ async getProductStatuses(langCode = this.state.lang) {
32
+ const result = await this._fetchGet('');
33
+ // Validate response if validation is enabled
34
+ const validated = this._validateResponse(result, productStatusesSchemas_1.ProductStatusesResponseSchema);
35
+ return this._normalizeData(validated, langCode);
36
+ }
37
+ /**
38
+ * Search for a product status object by its textual identifier (marker).
39
+ * @handleName getProductsByStatusMarker
40
+ * @param {string} marker - Product marker. Example: "in_stock".
41
+ * @param {string} [langCode] - Language code. Default: "en_US".
42
+ * @returns {Promise<IProductStatusEntity | IError>} Returns a product status object.
43
+ * @throws {IError} When isShell=false and an error occurs during the fetch
44
+ * @description Search for a product status object by its textual identifier (marker).
45
+ */
46
+ async getProductsByStatusMarker(marker, langCode = this.state.lang) {
47
+ const result = await this._fetchGet(`/marker/${marker}`);
48
+ // Validate response if validation is enabled
49
+ const validated = this._validateResponse(result, productStatusesSchemas_1.ProductStatusEntitySchema);
50
+ return this._normalizeData(validated, langCode);
51
+ }
52
+ /**
53
+ * Check the existence of a textual identifier.
54
+ * @handleName validateMarker
55
+ * @param {string} marker - Product marker. Example: "in_stock".
56
+ * @returns {Promise<boolean | IError>} Returns true if the textual identifier (marker) exists or false if it doesn't.
57
+ * @throws {IError} When isShell=false and an error occurs during the fetch
58
+ * @description Check the existence of a textual identifier.
59
+ */
60
+ async validateMarker(marker) {
61
+ const result = await this._fetchGet(`/marker-validation/${marker}`);
62
+ // Validate response if validation is enabled
63
+ const validated = this._validateResponse(result, productStatusesSchemas_1.ValidateMarkerResponseSchema);
64
+ // Extract the 'valid' boolean value from the response object
65
+ return typeof validated === 'object' && 'valid' in validated
66
+ ? validated.valid
67
+ : validated;
68
+ }
69
+ }
70
+ exports.default = ProductStatusesApi;
@@ -0,0 +1,62 @@
1
+ import type { IError, ILocalizeInfo } from '../base/utils';
2
+ /**
3
+ * @interface IProductStatuses
4
+ * @description This interface defines methods for retrieving and managing product statuses in the system.
5
+ */
6
+ interface IProductStatusesApi {
7
+ /**
8
+ * Search for all product status objects.
9
+ * @handleName getProductStatuses
10
+ * @param {string} [langCode] - Language code. Default: "en_US".
11
+ * @returns {IProductStatusEntity[]} Returns an array of product status objects.
12
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
13
+ * @description This method searches for all product status objects.
14
+ */
15
+ getProductStatuses(langCode: string): Promise<IProductStatusEntity[] | IError>;
16
+ /**
17
+ * Search for a product status object by its textual identifier (marker).
18
+ * @handleName getProductsByStatusMarker
19
+ * @param {string} marker - Product marker. Example: "in_stock".
20
+ * @param {string} [langCode] - Language code. Default: "en_US".
21
+ * @returns {IProductStatusEntity} Returns a product status object.
22
+ * @throws {IError} If there is an error during the fetch operation, it will return an error object.
23
+ * @description This method searches for a product status object by its textual identifier (marker).
24
+ */
25
+ getProductsByStatusMarker(marker: string, langCode: string): Promise<IProductStatusEntity | IError>;
26
+ /**
27
+ * Check the existence of a textual identifier.
28
+ * @handleName validateMarker
29
+ * @param {string} marker - Product marker. Example: "in_stock".
30
+ * @returns {boolean} Returns true if the textual identifier (marker) exists or false if it doesn't.
31
+ * @throws {IError} If there is an error during the fetch operation, it will return an error object.
32
+ * @description This method checks the existence of a textual identifier.
33
+ */
34
+ validateMarker(marker: string): Promise<boolean | IError>;
35
+ }
36
+ /**
37
+ * Product status entity structure
38
+ * @interface IProductStatusEntity
39
+ * @property {number} id - The unique identifier of the position. Example: 12345.
40
+ * @property {string} identifier - The textual identifier for the record field. Example: "in_stock".
41
+ * @property {ILocalizeInfo} localizeInfos - The name of the products statuses, taking into account localization.
42
+ * @example
43
+ {
44
+ "title": "Catalog",
45
+ "plainContent": "Content for catalog",
46
+ "htmlContent": "<b>Content for catalog</b>",
47
+ "menuTitle": "Catalog"
48
+ }
49
+ * @property {boolean} isDefault - Default status flag. Example: true.
50
+ * @property {number} version - The version number of the object. Example: 1.
51
+ * @property {number} position - Position number. Example: 1.
52
+ * @description This interface defines the structure of a product status entity, including its identifiers, localization information, position, and default status flag.
53
+ */
54
+ interface IProductStatusEntity {
55
+ id: number;
56
+ identifier: string;
57
+ localizeInfos: ILocalizeInfo;
58
+ isDefault: boolean;
59
+ version: number;
60
+ position: number;
61
+ }
62
+ export type { IProductStatusEntity, IProductStatusesApi };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Validation schemas for ProductStatuses module
3
+ * @description Zod schemas for validating product statuses-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Product status entity schema
8
+ * Includes all fields returned by the API
9
+ */
10
+ export declare const ProductStatusEntitySchema: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ identifier: z.ZodString;
13
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
14
+ isDefault: z.ZodBoolean;
15
+ version: z.ZodNumber;
16
+ position: z.ZodNumber;
17
+ }, z.core.$strip>;
18
+ /**
19
+ * Product statuses response schema (array of product statuses)
20
+ */
21
+ export declare const ProductStatusesResponseSchema: z.ZodArray<z.ZodObject<{
22
+ id: z.ZodNumber;
23
+ identifier: z.ZodString;
24
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
25
+ isDefault: z.ZodBoolean;
26
+ version: z.ZodNumber;
27
+ position: z.ZodNumber;
28
+ }, z.core.$strip>>;
29
+ /**
30
+ * Validate marker response schema (object with valid property)
31
+ */
32
+ export declare const ValidateMarkerResponseSchema: z.ZodObject<{
33
+ valid: z.ZodBoolean;
34
+ }, z.core.$strip>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidateMarkerResponseSchema = exports.ProductStatusesResponseSchema = exports.ProductStatusEntitySchema = void 0;
4
+ /**
5
+ * Validation schemas for ProductStatuses module
6
+ * @description Zod schemas for validating product statuses-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * Product status entity schema
11
+ * Includes all fields returned by the API
12
+ */
13
+ exports.ProductStatusEntitySchema = zod_1.z.object({
14
+ id: zod_1.z.number(),
15
+ identifier: zod_1.z.string(),
16
+ localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
17
+ isDefault: zod_1.z.boolean(),
18
+ version: zod_1.z.number(),
19
+ position: zod_1.z.number(),
20
+ });
21
+ /**
22
+ * Product statuses response schema (array of product statuses)
23
+ */
24
+ exports.ProductStatusesResponseSchema = zod_1.z.array(exports.ProductStatusEntitySchema);
25
+ /**
26
+ * Validate marker response schema (object with valid property)
27
+ */
28
+ exports.ValidateMarkerResponseSchema = zod_1.z.object({
29
+ valid: zod_1.z.boolean(),
30
+ });