oneentry 1.0.144 → 1.0.146
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.
- package/dist/admins/adminsInterfaces.d.ts +3 -0
- package/dist/admins/adminsSchemas.d.ts +2 -0
- package/dist/admins/adminsSchemas.js +2 -1
- package/dist/attribute-sets/attributeSetsSchemas.d.ts +0 -2
- package/dist/attribute-sets/attributeSetsSchemas.js +0 -3
- package/dist/auth-provider/authProviderSchemas.d.ts +27 -36
- package/dist/auth-provider/authProviderSchemas.js +17 -6
- package/dist/auth-provider/authProvidersInterfaces.d.ts +15 -10
- package/dist/base/syncModules.js +17 -5
- package/dist/base/utils.d.ts +15 -1
- package/dist/base/validation.d.ts +10 -30
- package/dist/base/validation.js +10 -17
- package/dist/blocks/blocksSchemas.d.ts +68 -100
- package/dist/discounts/discountsApi.d.ts +7 -7
- package/dist/discounts/discountsApi.js +3 -3
- package/dist/discounts/discountsInterfaces.d.ts +31 -15
- package/dist/forms/formsInterfaces.d.ts +19 -3
- package/dist/forms/formsSchemas.d.ts +3 -0
- package/dist/forms/formsSchemas.js +1 -0
- package/dist/forms-data/formsDataInterfaces.d.ts +3 -3
- package/dist/forms-data/formsDataSchemas.d.ts +4 -12
- package/dist/forms-data/formsDataSchemas.js +3 -3
- package/dist/orders/ordersApi.d.ts +4 -4
- package/dist/orders/ordersApi.js +2 -2
- package/dist/orders/ordersInterfaces.d.ts +21 -8
- package/dist/orders/ordersSchemas.d.ts +49 -34
- package/dist/orders/ordersSchemas.js +38 -29
- package/dist/pages/pagesSchemas.d.ts +7 -1
- package/dist/pages/pagesSchemas.js +5 -1
- package/dist/payments/paymentsApi.d.ts +3 -3
- package/dist/payments/paymentsApi.js +2 -2
- package/dist/payments/paymentsInterfaces.d.ts +5 -41
- package/dist/payments/paymentsSchemas.d.ts +8 -14
- package/dist/payments/paymentsSchemas.js +3 -12
- package/dist/products/productsSchemas.d.ts +68 -100
- package/dist/products/productsSchemas.js +17 -19
- package/dist/sitemap/sitemapApi.d.ts +4 -4
- package/dist/sitemap/sitemapApi.js +1 -1
- package/dist/sitemap/sitemapInterfaces.d.ts +30 -21
- package/dist/users/usersInterfaces.d.ts +3 -3
- package/dist/users/usersSchemas.d.ts +8 -14
- package/dist/users/usersSchemas.js +1 -4
- package/package.json +2 -2
|
@@ -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 {
|
|
4
|
+
import type { IBonusBalanceEntity, IBonusTransactionEntity, IBonusTransactionType, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse, IDiscountType } from './discountsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with events
|
|
7
7
|
* @handle /api/content/events
|
|
@@ -28,12 +28,12 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
28
28
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
29
29
|
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
30
30
|
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
31
|
-
* @param {
|
|
31
|
+
* @param {IDiscountType} [type] - Optional parameter to filter discounts by type.
|
|
32
32
|
* @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
|
|
33
33
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
34
34
|
* @description Fetches all discounts from the server.
|
|
35
35
|
*/
|
|
36
|
-
getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?:
|
|
36
|
+
getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?: IDiscountType): Promise<IDiscountsResponse | IError>;
|
|
37
37
|
/**
|
|
38
38
|
* Get discount by marker
|
|
39
39
|
* @handleName getDiscountByMarker
|
|
@@ -47,14 +47,14 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
47
47
|
/**
|
|
48
48
|
* Get bonus balance of the current user.
|
|
49
49
|
* @handleName getBonusBalance
|
|
50
|
-
* @returns {Promise<
|
|
50
|
+
* @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
|
|
51
51
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
52
52
|
*/
|
|
53
|
-
getBonusBalance(): Promise<
|
|
53
|
+
getBonusBalance(): Promise<IBonusBalanceEntity | IError>;
|
|
54
54
|
/**
|
|
55
55
|
* Get bonus transaction history of the current user.
|
|
56
56
|
* @handleName getBonusHistory
|
|
57
|
-
* @param {
|
|
57
|
+
* @param {IBonusTransactionType} [type] - Transaction type filter.
|
|
58
58
|
* @param {string} [dateFrom] - Start date filter.
|
|
59
59
|
* @param {string} [dateTo] - End date filter.
|
|
60
60
|
* @param {number} [discountId] - Discount id filter.
|
|
@@ -63,7 +63,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
63
63
|
* @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
|
|
64
64
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
65
65
|
*/
|
|
66
|
-
getBonusHistory(type?:
|
|
66
|
+
getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
|
|
67
67
|
/**
|
|
68
68
|
* Validate discounts coupon
|
|
69
69
|
* @handleName validateDiscountsCoupon
|
|
@@ -31,7 +31,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
31
31
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
32
32
|
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
33
33
|
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
34
|
-
* @param {
|
|
34
|
+
* @param {IDiscountType} [type] - Optional parameter to filter discounts by type.
|
|
35
35
|
* @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
|
|
36
36
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
37
37
|
* @description Fetches all discounts from the server.
|
|
@@ -66,7 +66,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
66
66
|
/**
|
|
67
67
|
* Get bonus balance of the current user.
|
|
68
68
|
* @handleName getBonusBalance
|
|
69
|
-
* @returns {Promise<
|
|
69
|
+
* @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
|
|
70
70
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
71
71
|
*/
|
|
72
72
|
async getBonusBalance() {
|
|
@@ -76,7 +76,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
76
76
|
/**
|
|
77
77
|
* Get bonus transaction history of the current user.
|
|
78
78
|
* @handleName getBonusHistory
|
|
79
|
-
* @param {
|
|
79
|
+
* @param {IBonusTransactionType} [type] - Transaction type filter.
|
|
80
80
|
* @param {string} [dateFrom] - Start date filter.
|
|
81
81
|
* @param {string} [dateTo] - End date filter.
|
|
82
82
|
* @param {number} [discountId] - Discount id filter.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { IError } from '../base/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Discount type.
|
|
4
|
+
*/
|
|
5
|
+
type IDiscountType = 'DISCOUNT' | 'BONUS' | 'PERSONAL_DISCOUNT';
|
|
2
6
|
/**
|
|
3
7
|
* Interface for the Discounts API module.
|
|
4
8
|
* @interface IDiscountsApi
|
|
@@ -10,12 +14,12 @@ interface IDiscountsApi {
|
|
|
10
14
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
11
15
|
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
12
16
|
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
13
|
-
* @param {
|
|
17
|
+
* @param {IDiscountType} [type] - Optional parameter to filter discounts by type.
|
|
14
18
|
* @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
|
|
15
19
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
16
20
|
* @description Fetches all discounts from the server.
|
|
17
21
|
*/
|
|
18
|
-
getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?:
|
|
22
|
+
getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?: IDiscountType): Promise<IDiscountsResponse | IError>;
|
|
19
23
|
/**
|
|
20
24
|
* Get discount by marker
|
|
21
25
|
* @handleName getDiscountByMarker
|
|
@@ -38,10 +42,10 @@ interface IDiscountsApi {
|
|
|
38
42
|
/**
|
|
39
43
|
* Get bonus balance of the current user.
|
|
40
44
|
* @handleName getBonusBalance
|
|
41
|
-
* @returns {Promise<
|
|
45
|
+
* @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
|
|
42
46
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
43
47
|
*/
|
|
44
|
-
getBonusBalance(): Promise<
|
|
48
|
+
getBonusBalance(): Promise<IBonusBalanceEntity | IError>;
|
|
45
49
|
/**
|
|
46
50
|
* Get bonus transaction history of the current user.
|
|
47
51
|
* @handleName getBonusHistory
|
|
@@ -54,18 +58,18 @@ interface IDiscountsApi {
|
|
|
54
58
|
* @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
|
|
55
59
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
56
60
|
*/
|
|
57
|
-
getBonusHistory(type?:
|
|
61
|
+
getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
60
64
|
* Query parameters for fetching discounts.
|
|
61
65
|
* @interface IDiscountsQuery
|
|
62
|
-
* @property {
|
|
66
|
+
* @property {IDiscountType} [type] - Filter discounts by type.
|
|
63
67
|
* @property {string} langCode - The language code for localization. Example: "en_US".
|
|
64
68
|
* @property {number} [offset] - Offset for pagination. Default: 0.
|
|
65
69
|
* @property {number} [limit] - Limit for pagination. Default: 30.
|
|
66
70
|
*/
|
|
67
71
|
interface IDiscountsQuery {
|
|
68
|
-
type?:
|
|
72
|
+
type?: IDiscountType;
|
|
69
73
|
langCode: string;
|
|
70
74
|
offset?: number;
|
|
71
75
|
limit?: number;
|
|
@@ -88,7 +92,7 @@ interface IDiscountCondition {
|
|
|
88
92
|
* @property {object} [localizeInfos] - The name of the discount.
|
|
89
93
|
* @property {number} [version] - The version of the discount.
|
|
90
94
|
* @property {string} [identifier] - The identifier of the discount.
|
|
91
|
-
* @property {
|
|
95
|
+
* @property {IDiscountType} type - The type of the discount.
|
|
92
96
|
* @property {string} [startDate] - The start date of the discount.
|
|
93
97
|
* @property {string} [endDate] - The end date of the discount.
|
|
94
98
|
* @property {Record<string, unknown>} [discountValue] - The value of the discount.
|
|
@@ -102,6 +106,8 @@ interface IDiscountCondition {
|
|
|
102
106
|
* @property {object} [attributeValues] - The attribute values of the discount.
|
|
103
107
|
* @property {string} [attributeSetIdentifier] - The identifier of the attribute set.
|
|
104
108
|
* @property {Record<string, unknown>} [bonusEvent] - Bonus event configuration.
|
|
109
|
+
* @property {number} [position] - Position number for sorting. Example: 1.
|
|
110
|
+
* @property {number | string} [total] - Total count of related entries. Example: "1".
|
|
105
111
|
*/
|
|
106
112
|
interface IDiscountsEntity {
|
|
107
113
|
id: number;
|
|
@@ -109,7 +115,7 @@ interface IDiscountsEntity {
|
|
|
109
115
|
localizeInfos?: object;
|
|
110
116
|
version?: number;
|
|
111
117
|
identifier?: string;
|
|
112
|
-
type:
|
|
118
|
+
type: IDiscountType;
|
|
113
119
|
startDate?: string;
|
|
114
120
|
endDate?: string;
|
|
115
121
|
discountValue?: Record<string, unknown>;
|
|
@@ -123,6 +129,8 @@ interface IDiscountsEntity {
|
|
|
123
129
|
attributeValues?: object;
|
|
124
130
|
attributeSetIdentifier?: string;
|
|
125
131
|
bonusEvent?: Record<string, unknown>;
|
|
132
|
+
position?: number;
|
|
133
|
+
total?: number | string;
|
|
126
134
|
}
|
|
127
135
|
/**
|
|
128
136
|
* Paginated response for discounts list.
|
|
@@ -167,10 +175,10 @@ interface IDiscountByMarkerQuery {
|
|
|
167
175
|
/**
|
|
168
176
|
*
|
|
169
177
|
*/
|
|
170
|
-
type
|
|
178
|
+
type IBonusTransactionType = 'ACCRUAL' | 'USAGE' | 'REDUCE' | 'REVERSAL_ACCRUAL' | 'REVERSAL_USAGE' | 'EXPIRATION';
|
|
171
179
|
/**
|
|
172
180
|
* @interface IBonusHistoryQuery
|
|
173
|
-
* @property {
|
|
181
|
+
* @property {IBonusTransactionType} [type] - Transaction type filter.
|
|
174
182
|
* @property {string} [dateFrom] - Start date filter.
|
|
175
183
|
* @property {string} [dateTo] - End date filter.
|
|
176
184
|
* @property {number} [discountId] - Discount id filter.
|
|
@@ -178,7 +186,7 @@ type BonusTransactionType = 'ACCRUAL' | 'USAGE' | 'REDUCE' | 'REVERSAL_ACCRUAL'
|
|
|
178
186
|
* @property {boolean} [isAdmin] - Admin filter.
|
|
179
187
|
*/
|
|
180
188
|
interface IBonusHistoryQuery {
|
|
181
|
-
type?:
|
|
189
|
+
type?: IBonusTransactionType;
|
|
182
190
|
dateFrom?: string;
|
|
183
191
|
dateTo?: string;
|
|
184
192
|
discountId?: number;
|
|
@@ -189,7 +197,7 @@ interface IBonusHistoryQuery {
|
|
|
189
197
|
* @interface IBonusTransactionEntity
|
|
190
198
|
* @property {number} balanceId - Balance id.
|
|
191
199
|
* @property {number} amount - Transaction amount.
|
|
192
|
-
* @property {
|
|
200
|
+
* @property {IBonusTransactionType} type - Transaction type.
|
|
193
201
|
* @property {number} [discountId] - Discount id.
|
|
194
202
|
* @property {number} [moduleId] - Module id.
|
|
195
203
|
* @property {string} [entityIdentifier] - Entity identifier.
|
|
@@ -203,7 +211,7 @@ interface IBonusHistoryQuery {
|
|
|
203
211
|
interface IBonusTransactionEntity {
|
|
204
212
|
balanceId: number;
|
|
205
213
|
amount: number;
|
|
206
|
-
type:
|
|
214
|
+
type: IBonusTransactionType;
|
|
207
215
|
discountId?: number;
|
|
208
216
|
moduleId?: number;
|
|
209
217
|
entityIdentifier?: string;
|
|
@@ -214,4 +222,12 @@ interface IBonusTransactionEntity {
|
|
|
214
222
|
expiresAt?: string;
|
|
215
223
|
createdAt?: string;
|
|
216
224
|
}
|
|
217
|
-
|
|
225
|
+
/**
|
|
226
|
+
* @interface IBonusBalanceEntity
|
|
227
|
+
* @description Represents the balance of bonus points.
|
|
228
|
+
* @property {number} balance - The balance of bonus points. Example: 100
|
|
229
|
+
*/
|
|
230
|
+
interface IBonusBalanceEntity {
|
|
231
|
+
balance: number;
|
|
232
|
+
}
|
|
233
|
+
export type { IBonusBalanceEntity, IBonusHistoryQuery, IBonusTransactionEntity, IBonusTransactionType, ICouponValidationResult, IDiscountByMarkerQuery, IDiscountCondition, IDiscountsApi, IDiscountsEntity, IDiscountsQuery, IDiscountsResponse, IDiscountsValidateCoupon, IDiscountType, };
|
|
@@ -70,11 +70,13 @@ interface IFromPages {
|
|
|
70
70
|
* @property {string} identifier - The textual identifier for the record field. Example: "form_contact_us".
|
|
71
71
|
* @property {string} processingType - Type of form processing. Example: "async".
|
|
72
72
|
* @property {number | null} templateId - The identifier of the template used by the form, or null if no template is used. Example: 6789.
|
|
73
|
-
* @property {IAttributes[] | Record<string, any>} attributes - The attributes of the form, which can be an array of attribute objects or a record of key-value pairs.
|
|
73
|
+
* @property {IAttributes[] | Record<string, any>} [attributes] - The attributes of the form, which can be an array of attribute objects or a record of key-value pairs.
|
|
74
74
|
* @example
|
|
75
75
|
{
|
|
76
76
|
"key": "value"
|
|
77
77
|
}
|
|
78
|
+
* @property {number | string} [total] - Total count of related entries. Example: "1".
|
|
79
|
+
* @property {IFormConfig[]} [moduleFormConfigs] - Array of module form configurations associated with the form.
|
|
78
80
|
* @description This interface defines the structure of a form entity, including its identifiers, attributes, and processing data.
|
|
79
81
|
*/
|
|
80
82
|
interface IFormsEntity {
|
|
@@ -87,7 +89,9 @@ interface IFormsEntity {
|
|
|
87
89
|
identifier: string;
|
|
88
90
|
processingType: string;
|
|
89
91
|
templateId: number | null;
|
|
90
|
-
attributes
|
|
92
|
+
attributes?: IAttributes[] | Record<string, unknown>;
|
|
93
|
+
total?: number | string;
|
|
94
|
+
moduleFormConfigs?: IFormConfig[];
|
|
91
95
|
}
|
|
92
96
|
/**
|
|
93
97
|
* Represents the structure of a form configuration.
|
|
@@ -108,7 +112,13 @@ interface IFormsEntity {
|
|
|
108
112
|
* @property {string[]} [nestedEntityIdentifiers] - An array of nested entity identifier strings (only in products/pages API). Example: ["catalog"].
|
|
109
113
|
* @property {string[]} [exceptionIds] - An array of exception identifiers.
|
|
110
114
|
* @property {number} [formDataCount] - Total count of form data entries (only in products/pages API). Example: 306.
|
|
111
|
-
* @property {Record<string, number>} [entityFormDataCount] - Form data count per entity identifier (only in products/pages API). Example: {"catalog": 306}
|
|
115
|
+
* @property {Record<string, number>} [entityFormDataCount] - Form data count per entity identifier (only in products/pages API). Example: `{"catalog": 306}`.
|
|
116
|
+
* @property {boolean | null} [isRating] - Indicates whether this form config is for ratings. Example: null.
|
|
117
|
+
* @property {boolean | null} [isAnonymous] - Indicates whether anonymous submissions are allowed. Example: null.
|
|
118
|
+
* @property {boolean | null} [allowHalfRatings] - Indicates whether half ratings are allowed. Example: null.
|
|
119
|
+
* @property {boolean | null} [allowRerating] - Indicates whether re-rating is allowed. Example: null.
|
|
120
|
+
* @property {number | null} [maxRatingScale] - Maximum rating scale value. Example: 5.
|
|
121
|
+
* @property {string} [ratingCalculation] - Rating calculation method. Example: "average".
|
|
112
122
|
* @description This interface defines the structure of a form configuration, including its identifiers, module association, and entity identifiers. Different APIs return different field variants.
|
|
113
123
|
*/
|
|
114
124
|
interface IFormConfig {
|
|
@@ -130,6 +140,12 @@ interface IFormConfig {
|
|
|
130
140
|
exceptionIds?: string[];
|
|
131
141
|
formDataCount?: number;
|
|
132
142
|
entityFormDataCount?: Record<string, number>;
|
|
143
|
+
isRating?: boolean | null;
|
|
144
|
+
isAnonymous?: boolean | null;
|
|
145
|
+
allowHalfRatings?: boolean | null;
|
|
146
|
+
allowRerating?: boolean | null;
|
|
147
|
+
maxRatingScale?: number | null;
|
|
148
|
+
ratingCalculation?: string;
|
|
133
149
|
}
|
|
134
150
|
/**
|
|
135
151
|
* Represents the paginated response structure for forms.
|
|
@@ -13,6 +13,7 @@ export declare const FormEntitySchema: z.ZodObject<{
|
|
|
13
13
|
type: z.ZodNullable<z.ZodString>;
|
|
14
14
|
attributeSetId: z.ZodNullable<z.ZodNumber>;
|
|
15
15
|
templateId: z.ZodNullable<z.ZodNumber>;
|
|
16
|
+
total: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
16
17
|
attributes: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
|
|
17
18
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
18
19
|
}, z.core.$strip>;
|
|
@@ -31,6 +32,7 @@ export declare const FormsResponseSchema: z.ZodObject<{
|
|
|
31
32
|
type: z.ZodNullable<z.ZodString>;
|
|
32
33
|
attributeSetId: z.ZodNullable<z.ZodNumber>;
|
|
33
34
|
templateId: z.ZodNullable<z.ZodNumber>;
|
|
35
|
+
total: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
34
36
|
attributes: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
|
|
35
37
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
36
38
|
}, z.core.$strip>>;
|
|
@@ -48,6 +50,7 @@ export declare const SingleFormSchema: z.ZodObject<{
|
|
|
48
50
|
type: z.ZodNullable<z.ZodString>;
|
|
49
51
|
attributeSetId: z.ZodNullable<z.ZodNumber>;
|
|
50
52
|
templateId: z.ZodNullable<z.ZodNumber>;
|
|
53
|
+
total: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
51
54
|
attributes: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
|
|
52
55
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
53
56
|
}, z.core.$strip>;
|
|
@@ -16,6 +16,7 @@ exports.FormEntitySchema = zod_1.z.object({
|
|
|
16
16
|
type: zod_1.z.string().nullable(),
|
|
17
17
|
attributeSetId: zod_1.z.number().nullable(),
|
|
18
18
|
templateId: zod_1.z.number().nullable(),
|
|
19
|
+
total: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]).optional(),
|
|
19
20
|
attributes: zod_1.z
|
|
20
21
|
.union([zod_1.z.array(zod_1.z.any()), zod_1.z.record(zod_1.z.string(), zod_1.z.any())])
|
|
21
22
|
.optional(),
|
|
@@ -241,10 +241,9 @@ interface IFormsByMarkerDataEntity {
|
|
|
241
241
|
"value": "Jack"
|
|
242
242
|
}
|
|
243
243
|
]
|
|
244
|
-
* @property {string} actionMessage - Action message for the form data. Example: "Form submitted successfully".
|
|
244
|
+
* @property {string} actionMessage - Action message for the form data (can be localized). Example: "Form submitted successfully".
|
|
245
245
|
*/
|
|
246
246
|
interface IPostFormResponse {
|
|
247
|
-
actionMessage: string;
|
|
248
247
|
formData: {
|
|
249
248
|
id: number;
|
|
250
249
|
formIdentifier: string;
|
|
@@ -255,8 +254,9 @@ interface IPostFormResponse {
|
|
|
255
254
|
formModuleId: number;
|
|
256
255
|
userIdentifier: string | null;
|
|
257
256
|
parentId: number | null;
|
|
258
|
-
formData: FormDataType[]
|
|
257
|
+
formData: FormDataType[] | Record<string, any>;
|
|
259
258
|
};
|
|
259
|
+
actionMessage: string;
|
|
260
260
|
}
|
|
261
261
|
/**
|
|
262
262
|
* Represents the structure of the response after updating form data.
|
|
@@ -27,11 +27,7 @@ export declare const FormByMarkerDataEntitySchema: z.ZodObject<{
|
|
|
27
27
|
marker: z.ZodString;
|
|
28
28
|
type: z.ZodString;
|
|
29
29
|
value: z.ZodAny;
|
|
30
|
-
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.
|
|
31
|
-
marker: z.ZodString;
|
|
32
|
-
type: z.ZodString;
|
|
33
|
-
value: z.ZodAny;
|
|
34
|
-
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>>]>;
|
|
30
|
+
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
35
31
|
attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
32
|
time: z.ZodUnion<readonly [z.ZodDate, z.ZodString]>;
|
|
37
33
|
entityIdentifier: z.ZodOptional<z.ZodString>;
|
|
@@ -57,11 +53,7 @@ export declare const FormsByMarkerDataResponseSchema: z.ZodObject<{
|
|
|
57
53
|
marker: z.ZodString;
|
|
58
54
|
type: z.ZodString;
|
|
59
55
|
value: z.ZodAny;
|
|
60
|
-
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.
|
|
61
|
-
marker: z.ZodString;
|
|
62
|
-
type: z.ZodString;
|
|
63
|
-
value: z.ZodAny;
|
|
64
|
-
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>>]>;
|
|
56
|
+
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
65
57
|
attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
58
|
time: z.ZodUnion<readonly [z.ZodDate, z.ZodString]>;
|
|
67
59
|
entityIdentifier: z.ZodOptional<z.ZodString>;
|
|
@@ -85,8 +77,8 @@ export declare const PostFormResponseSchema: z.ZodObject<{
|
|
|
85
77
|
fingerprint: z.ZodString;
|
|
86
78
|
isUserAdmin: z.ZodBoolean;
|
|
87
79
|
formModuleId: z.ZodNumber;
|
|
88
|
-
userIdentifier: z.
|
|
89
|
-
parentId: z.
|
|
80
|
+
userIdentifier: z.ZodNullable<z.ZodString>;
|
|
81
|
+
parentId: z.ZodNullable<z.ZodNumber>;
|
|
90
82
|
formData: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
91
83
|
marker: z.ZodString;
|
|
92
84
|
type: z.ZodString;
|
|
@@ -31,7 +31,7 @@ exports.FormByMarkerDataEntitySchema = zod_1.z.object({
|
|
|
31
31
|
userIdentifier: zod_1.z.string().nullish(),
|
|
32
32
|
formData: zod_1.z.union([
|
|
33
33
|
zod_1.z.array(exports.FormDataTypeSchema),
|
|
34
|
-
zod_1.z.record(zod_1.z.string(), zod_1.z.
|
|
34
|
+
zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
35
35
|
]),
|
|
36
36
|
attributeSetIdentifier: zod_1.z.string().nullish(),
|
|
37
37
|
time: zod_1.z.union([zod_1.z.date(), zod_1.z.string()]),
|
|
@@ -61,8 +61,8 @@ exports.PostFormResponseSchema = zod_1.z.object({
|
|
|
61
61
|
fingerprint: zod_1.z.string(),
|
|
62
62
|
isUserAdmin: zod_1.z.boolean(),
|
|
63
63
|
formModuleId: zod_1.z.number(),
|
|
64
|
-
userIdentifier: zod_1.z.
|
|
65
|
-
parentId: zod_1.z.
|
|
64
|
+
userIdentifier: zod_1.z.string().nullable(),
|
|
65
|
+
parentId: zod_1.z.number().nullable(),
|
|
66
66
|
formData: zod_1.z.union([
|
|
67
67
|
zod_1.z.array(exports.FormDataTypeSchema),
|
|
68
68
|
zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
@@ -160,16 +160,16 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
160
160
|
* @handleName createRefundRequest
|
|
161
161
|
* @param {number} id - Order id. Example: 1.
|
|
162
162
|
* @param {ICreateRefundRequest} body - Refund request body.
|
|
163
|
-
* @returns {Promise<
|
|
163
|
+
* @returns {Promise<boolean | IError>} Returns true if the refund request was created successfully.
|
|
164
164
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
165
165
|
*/
|
|
166
|
-
createRefundRequest(id: number, body: ICreateRefundRequest): Promise<
|
|
166
|
+
createRefundRequest(id: number, body: ICreateRefundRequest): Promise<boolean | IError>;
|
|
167
167
|
/**
|
|
168
168
|
* Cancel a refund request for an order.
|
|
169
169
|
* @handleName cancelRefundRequest
|
|
170
170
|
* @param {number} id - Order id. Example: 1.
|
|
171
|
-
* @returns {Promise<
|
|
171
|
+
* @returns {Promise<boolean | IError>} Returns true if the refund request was cancelled successfully.
|
|
172
172
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
173
173
|
*/
|
|
174
|
-
cancelRefundRequest(id: number): Promise<
|
|
174
|
+
cancelRefundRequest(id: number): Promise<boolean | IError>;
|
|
175
175
|
}
|
package/dist/orders/ordersApi.js
CHANGED
|
@@ -219,7 +219,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
219
219
|
* @handleName createRefundRequest
|
|
220
220
|
* @param {number} id - Order id. Example: 1.
|
|
221
221
|
* @param {ICreateRefundRequest} body - Refund request body.
|
|
222
|
-
* @returns {Promise<
|
|
222
|
+
* @returns {Promise<boolean | IError>} Returns true if the refund request was created successfully.
|
|
223
223
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
224
224
|
*/
|
|
225
225
|
async createRefundRequest(id, body) {
|
|
@@ -233,7 +233,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
233
233
|
* Cancel a refund request for an order.
|
|
234
234
|
* @handleName cancelRefundRequest
|
|
235
235
|
* @param {number} id - Order id. Example: 1.
|
|
236
|
-
* @returns {Promise<
|
|
236
|
+
* @returns {Promise<boolean | IError>} Returns true if the refund request was cancelled successfully.
|
|
237
237
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
238
238
|
*/
|
|
239
239
|
async cancelRefundRequest(id) {
|
|
@@ -146,18 +146,18 @@ interface IOrdersApi {
|
|
|
146
146
|
* @handleName createRefundRequest
|
|
147
147
|
* @param {number} id - Order id.
|
|
148
148
|
* @param {ICreateRefundRequest} body - Refund request body.
|
|
149
|
-
* @returns {Promise<
|
|
149
|
+
* @returns {Promise<boolean | IError>} Returns true if the refund request was created successfully.
|
|
150
150
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
151
151
|
*/
|
|
152
|
-
createRefundRequest(id: number, body: ICreateRefundRequest): Promise<
|
|
152
|
+
createRefundRequest(id: number, body: ICreateRefundRequest): Promise<boolean | IError>;
|
|
153
153
|
/**
|
|
154
154
|
* Cancel a refund request for an order.
|
|
155
155
|
* @handleName cancelRefundRequest
|
|
156
156
|
* @param {number} id - Order id.
|
|
157
|
-
* @returns {Promise<
|
|
157
|
+
* @returns {Promise<boolean | IError>} Returns order entity.
|
|
158
158
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
159
159
|
*/
|
|
160
|
-
cancelRefundRequest(id: number): Promise<
|
|
160
|
+
cancelRefundRequest(id: number): Promise<boolean | IError>;
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* Interface for the orders storage object.
|
|
@@ -493,15 +493,17 @@ interface IOrderByMarkerEntity {
|
|
|
493
493
|
* @property {number} [id] - Status identifier. Example: 1.
|
|
494
494
|
* @property {object} [localizeInfos] - Localized information for the status.
|
|
495
495
|
* @property {string} [identifier] - Text identifier of the status. Example: "inProgress".
|
|
496
|
-
* @property {
|
|
496
|
+
* @property {number} [position] - Position of the status. Example: 1.
|
|
497
497
|
* @property {boolean} [isUsed] - Whether the status is in use. Example: true.
|
|
498
|
+
* @property {boolean} [isDefault] - Whether the status is the default status. Example: true.
|
|
498
499
|
*/
|
|
499
500
|
interface IOrderStatus {
|
|
500
501
|
id?: number;
|
|
501
502
|
localizeInfos?: object;
|
|
502
503
|
identifier?: string;
|
|
503
|
-
position?:
|
|
504
|
+
position?: number;
|
|
504
505
|
isUsed?: boolean;
|
|
506
|
+
isDefault?: boolean;
|
|
505
507
|
}
|
|
506
508
|
/**
|
|
507
509
|
* Interface representing a product in an order preview.
|
|
@@ -583,11 +585,22 @@ interface IRefundRequest {
|
|
|
583
585
|
orderStorage: unknown;
|
|
584
586
|
user: unknown;
|
|
585
587
|
}
|
|
588
|
+
/**
|
|
589
|
+
* @interface IRefundProduct
|
|
590
|
+
* @description Refund details for a single product.
|
|
591
|
+
* @property {number} quantity - Quantity of the product to refund. Example: 1.
|
|
592
|
+
*/
|
|
593
|
+
interface IRefundProduct {
|
|
594
|
+
quantity: number;
|
|
595
|
+
}
|
|
586
596
|
/**
|
|
587
597
|
* @interface ICreateRefundRequest
|
|
588
598
|
* @description Body for creating a refund request.
|
|
599
|
+
* @property {Record<string, IRefundProduct>} products - Map of product id to refund details. Example: `{ "146": { "quantity": 1 } }`.
|
|
600
|
+
* @property {string} [note] - Optional note for the refund request. Example: "test".
|
|
589
601
|
*/
|
|
590
602
|
interface ICreateRefundRequest {
|
|
591
|
-
|
|
603
|
+
products: Record<string, IRefundProduct>;
|
|
604
|
+
note?: string;
|
|
592
605
|
}
|
|
593
|
-
export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderStatus, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundRequest, };
|
|
606
|
+
export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderStatus, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundProduct, IRefundRequest, };
|
|
@@ -21,19 +21,19 @@ export declare const OrderItemSchema: z.ZodObject<{
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const OrderEntitySchema: z.ZodObject<{
|
|
23
23
|
id: z.ZodNumber;
|
|
24
|
-
storageId: z.
|
|
25
|
-
createdDate: z.
|
|
24
|
+
storageId: z.ZodNumber;
|
|
25
|
+
createdDate: z.ZodString;
|
|
26
26
|
statusIdentifier: z.ZodOptional<z.ZodString>;
|
|
27
27
|
formIdentifier: z.ZodOptional<z.ZodString>;
|
|
28
|
-
formData: z.
|
|
29
|
-
attributeSetIdentifier: z.
|
|
30
|
-
totalSum: z.
|
|
31
|
-
currency: z.
|
|
32
|
-
paymentAccountIdentifier: z.
|
|
33
|
-
paymentAccountLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
34
|
-
paymentUrl: z.ZodNullable<z.
|
|
35
|
-
products: z.
|
|
36
|
-
isCompleted: z.ZodNullable<z.
|
|
28
|
+
formData: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
29
|
+
attributeSetIdentifier: z.ZodOptional<z.ZodString>;
|
|
30
|
+
totalSum: z.ZodString;
|
|
31
|
+
currency: z.ZodString;
|
|
32
|
+
paymentAccountIdentifier: z.ZodOptional<z.ZodString>;
|
|
33
|
+
paymentAccountLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
+
paymentUrl: z.ZodNullable<z.ZodString>;
|
|
35
|
+
products: z.ZodArray<z.ZodAny>;
|
|
36
|
+
isCompleted: z.ZodNullable<z.ZodBoolean>;
|
|
37
37
|
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
/**
|
|
@@ -43,19 +43,19 @@ export declare const OrderEntitySchema: z.ZodObject<{
|
|
|
43
43
|
export declare const OrdersResponseSchema: z.ZodObject<{
|
|
44
44
|
items: z.ZodArray<z.ZodObject<{
|
|
45
45
|
id: z.ZodNumber;
|
|
46
|
-
storageId: z.
|
|
47
|
-
createdDate: z.
|
|
46
|
+
storageId: z.ZodNumber;
|
|
47
|
+
createdDate: z.ZodString;
|
|
48
48
|
statusIdentifier: z.ZodOptional<z.ZodString>;
|
|
49
49
|
formIdentifier: z.ZodOptional<z.ZodString>;
|
|
50
|
-
formData: z.
|
|
51
|
-
attributeSetIdentifier: z.
|
|
52
|
-
totalSum: z.
|
|
53
|
-
currency: z.
|
|
54
|
-
paymentAccountIdentifier: z.
|
|
55
|
-
paymentAccountLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
56
|
-
paymentUrl: z.ZodNullable<z.
|
|
57
|
-
products: z.
|
|
58
|
-
isCompleted: z.ZodNullable<z.
|
|
50
|
+
formData: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
51
|
+
attributeSetIdentifier: z.ZodOptional<z.ZodString>;
|
|
52
|
+
totalSum: z.ZodString;
|
|
53
|
+
currency: z.ZodString;
|
|
54
|
+
paymentAccountIdentifier: z.ZodOptional<z.ZodString>;
|
|
55
|
+
paymentAccountLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
56
|
+
paymentUrl: z.ZodNullable<z.ZodString>;
|
|
57
|
+
products: z.ZodArray<z.ZodAny>;
|
|
58
|
+
isCompleted: z.ZodNullable<z.ZodBoolean>;
|
|
59
59
|
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
60
60
|
}, z.core.$strip>>;
|
|
61
61
|
total: z.ZodNumber;
|
|
@@ -97,13 +97,20 @@ export declare const OrdersStorageResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
97
97
|
*/
|
|
98
98
|
export declare const CreateOrderResponseSchema: z.ZodObject<{
|
|
99
99
|
id: z.ZodNumber;
|
|
100
|
-
formIdentifier: z.
|
|
101
|
-
paymentAccountIdentifier: z.
|
|
102
|
-
formData: z.
|
|
103
|
-
products: z.
|
|
104
|
-
currency: z.
|
|
105
|
-
totalSum: z.
|
|
100
|
+
formIdentifier: z.ZodString;
|
|
101
|
+
paymentAccountIdentifier: z.ZodString;
|
|
102
|
+
formData: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
103
|
+
products: z.ZodArray<z.ZodAny>;
|
|
104
|
+
currency: z.ZodString;
|
|
105
|
+
totalSum: z.ZodNumber;
|
|
106
106
|
createdDate: z.ZodOptional<z.ZodString>;
|
|
107
|
+
statusIdentifier: z.ZodOptional<z.ZodString>;
|
|
108
|
+
couponCode: z.ZodOptional<z.ZodString>;
|
|
109
|
+
additionalDiscountsMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
110
|
+
discountConfig: z.ZodOptional<z.ZodUnknown>;
|
|
111
|
+
bonusAmount: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
bonusApplied: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
totalDue: z.ZodOptional<z.ZodNumber>;
|
|
107
114
|
}, z.core.$strip>;
|
|
108
115
|
/**
|
|
109
116
|
* Update order response schema
|
|
@@ -111,10 +118,18 @@ export declare const CreateOrderResponseSchema: z.ZodObject<{
|
|
|
111
118
|
*/
|
|
112
119
|
export declare const UpdateOrderResponseSchema: z.ZodObject<{
|
|
113
120
|
id: z.ZodNumber;
|
|
114
|
-
formIdentifier: z.
|
|
115
|
-
paymentAccountIdentifier: z.
|
|
116
|
-
formData: z.
|
|
117
|
-
products: z.
|
|
118
|
-
currency: z.
|
|
119
|
-
totalSum: z.
|
|
121
|
+
formIdentifier: z.ZodString;
|
|
122
|
+
paymentAccountIdentifier: z.ZodString;
|
|
123
|
+
formData: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
124
|
+
products: z.ZodArray<z.ZodAny>;
|
|
125
|
+
currency: z.ZodString;
|
|
126
|
+
totalSum: z.ZodNumber;
|
|
127
|
+
createdDate: z.ZodOptional<z.ZodString>;
|
|
128
|
+
statusIdentifier: z.ZodOptional<z.ZodString>;
|
|
129
|
+
couponCode: z.ZodOptional<z.ZodString>;
|
|
130
|
+
additionalDiscountsMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
131
|
+
discountConfig: z.ZodOptional<z.ZodUnknown>;
|
|
132
|
+
bonusAmount: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
bonusApplied: z.ZodOptional<z.ZodNumber>;
|
|
134
|
+
totalDue: z.ZodOptional<z.ZodNumber>;
|
|
120
135
|
}, z.core.$strip>;
|