oneentry 1.0.152 → 1.0.153
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/changelog.md +12 -0
- package/dist/admins/adminsApi.d.ts +2 -1
- package/dist/admins/adminsApi.js +2 -1
- package/dist/admins/adminsInterfaces.d.ts +1 -1
- package/dist/attribute-sets/attributeSetsApi.d.ts +4 -0
- package/dist/attribute-sets/attributeSetsApi.js +4 -0
- package/dist/auth-provider/authProviderApi.d.ts +14 -1
- package/dist/auth-provider/authProviderApi.js +14 -1
- package/dist/base/asyncModules.d.ts +11 -0
- package/dist/base/asyncModules.js +19 -0
- package/dist/blocks/blocksApi.d.ts +34 -1
- package/dist/blocks/blocksApi.js +69 -62
- package/dist/discounts/discountsApi.d.ts +5 -0
- package/dist/discounts/discountsApi.js +5 -0
- package/dist/events/eventsApi.d.ts +7 -0
- package/dist/events/eventsApi.js +11 -28
- package/dist/file-uploading/fileUploadingApi.d.ts +4 -1
- package/dist/file-uploading/fileUploadingApi.js +4 -1
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +1 -1
- package/dist/filters/filtersApi.d.ts +1 -0
- package/dist/filters/filtersApi.js +1 -0
- package/dist/forms/formsApi.d.ts +2 -0
- package/dist/forms/formsApi.js +2 -0
- package/dist/forms-data/formsDataApi.d.ts +5 -0
- package/dist/forms-data/formsDataApi.js +5 -0
- package/dist/general-types/generalTypesApi.d.ts +1 -0
- package/dist/general-types/generalTypesApi.js +1 -0
- package/dist/integration-collections/integrationCollectionsApi.d.ts +10 -1
- package/dist/integration-collections/integrationCollectionsApi.js +10 -1
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +1 -1
- package/dist/locales/localesApi.d.ts +1 -0
- package/dist/locales/localesApi.js +1 -0
- package/dist/menus/menusApi.d.ts +1 -0
- package/dist/menus/menusApi.js +1 -0
- package/dist/orders/ordersApi.d.ts +25 -1
- package/dist/orders/ordersApi.js +36 -12
- package/dist/orders/ordersInterfaces.d.ts +4 -2
- package/dist/pages/pagesApi.d.ts +9 -0
- package/dist/pages/pagesApi.js +33 -38
- package/dist/pages/pagesInterfaces.d.ts +5 -0
- package/dist/payments/paymentsApi.d.ts +6 -0
- package/dist/payments/paymentsApi.js +6 -0
- package/dist/product-statuses/productStatusesApi.d.ts +3 -0
- package/dist/product-statuses/productStatusesApi.js +3 -0
- package/dist/products/productsApi.d.ts +14 -0
- package/dist/products/productsApi.js +14 -0
- package/dist/products/productsInterfaces.d.ts +2 -2
- package/dist/sitemap/sitemapApi.d.ts +2 -0
- package/dist/sitemap/sitemapApi.js +2 -0
- package/dist/subscriptions/subscriptionsApi.d.ts +5 -0
- package/dist/subscriptions/subscriptionsApi.js +7 -14
- package/dist/system/systemApi.d.ts +3 -0
- package/dist/system/systemApi.js +3 -0
- package/dist/templates/templatesApi.d.ts +3 -0
- package/dist/templates/templatesApi.js +3 -0
- package/dist/templates-preview/templatesPreviewApi.d.ts +2 -0
- package/dist/templates-preview/templatesPreviewApi.js +2 -0
- package/dist/user-activity/userActivityApi.d.ts +1 -0
- package/dist/user-activity/userActivityApi.js +1 -0
- package/dist/users/usersApi.d.ts +14 -0
- package/dist/users/usersApi.js +14 -0
- package/dist/web-socket/wsApi.d.ts +1 -1
- package/dist/web-socket/wsApi.js +1 -1
- package/package.json +1 -1
|
@@ -56,6 +56,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
56
56
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
57
57
|
* @returns {Promise<IPostFormResponse | IError>} Returns an object containing the created form data entry and message.
|
|
58
58
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
59
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/postFormsData postFormsData} documentation.
|
|
59
60
|
*/
|
|
60
61
|
postFormsData(body: IBodyPostFormData, langCode?: string): Promise<IPostFormResponse | IError>;
|
|
61
62
|
/**
|
|
@@ -79,6 +80,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
79
80
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
80
81
|
* @returns {Promise<IFormsByMarkerDataEntity | IError>} Returns an object containing the form data or an error object if there was an issue.
|
|
81
82
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
83
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByMarker getFormsDataByMarker} documentation.
|
|
82
84
|
*/
|
|
83
85
|
getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: object, isExtended?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsByMarkerDataEntity | IError>;
|
|
84
86
|
/**
|
|
@@ -86,6 +88,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
86
88
|
* @handleName updateFormsDataByid
|
|
87
89
|
* @param {number} id - ID of the form data. Example: 1.
|
|
88
90
|
* @returns {Promise<IUpdateFormsData | IError>} Returns an object containing the updated form data or an error object if there was an issue.
|
|
91
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/updateFormsDataByid updateFormsDataByid} documentation.
|
|
89
92
|
*/
|
|
90
93
|
updateFormsDataByid(id: number, body?: object): Promise<IUpdateFormsData | IError>;
|
|
91
94
|
/**
|
|
@@ -94,6 +97,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
94
97
|
* @param {number} id - ID of the form data. Example: 1.
|
|
95
98
|
* @param {object} body - Request body.
|
|
96
99
|
* @returns {Promise<boolean | IError>} Returns an object containing the updated form data or an error object if there was an issue.
|
|
100
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/updateFormsDataStatusByid updateFormsDataStatusByid} documentation.
|
|
97
101
|
*/
|
|
98
102
|
updateFormsDataStatusByid(id: number, body?: object): Promise<boolean | IError>;
|
|
99
103
|
/**
|
|
@@ -101,6 +105,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
101
105
|
* @handleName deleteFormsDataByid
|
|
102
106
|
* @param {number} id - ID of the form data. Example: 1.
|
|
103
107
|
* @returns {Promise<boolean | IError>} Returns an object containing the deleted form data or an error object if there was an issue.
|
|
108
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/deleteFormsDataByid deleteFormsDataByid} documentation.
|
|
104
109
|
*/
|
|
105
110
|
deleteFormsDataByid(id: number): Promise<boolean | IError>;
|
|
106
111
|
}
|
|
@@ -62,6 +62,7 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
62
62
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
63
63
|
* @returns {Promise<IPostFormResponse | IError>} Returns an object containing the created form data entry and message.
|
|
64
64
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
65
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/postFormsData postFormsData} documentation.
|
|
65
66
|
*/
|
|
66
67
|
async postFormsData(body, langCode = this.state.lang) {
|
|
67
68
|
const formData = {};
|
|
@@ -145,6 +146,7 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
145
146
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
146
147
|
* @returns {Promise<IFormsByMarkerDataEntity | IError>} Returns an object containing the form data or an error object if there was an issue.
|
|
147
148
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
149
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByMarker getFormsDataByMarker} documentation.
|
|
148
150
|
*/
|
|
149
151
|
async getFormsDataByMarker(marker, formModuleConfigId, body = {}, isExtended = 0, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
150
152
|
const result = await this._fetchPost(`/marker/${marker}?formModuleConfigId=${formModuleConfigId}&isExtended=${isExtended}&langCode=${langCode}&offset=${offset}&limit=${limit}`, body);
|
|
@@ -157,6 +159,7 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
157
159
|
* @handleName updateFormsDataByid
|
|
158
160
|
* @param {number} id - ID of the form data. Example: 1.
|
|
159
161
|
* @returns {Promise<IUpdateFormsData | IError>} Returns an object containing the updated form data or an error object if there was an issue.
|
|
162
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/updateFormsDataByid updateFormsDataByid} documentation.
|
|
160
163
|
*/
|
|
161
164
|
async updateFormsDataByid(id, body = {}) {
|
|
162
165
|
const result = await this._fetchPut(`/${id}`, body);
|
|
@@ -170,6 +173,7 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
170
173
|
* @param {number} id - ID of the form data. Example: 1.
|
|
171
174
|
* @param {object} body - Request body.
|
|
172
175
|
* @returns {Promise<boolean | IError>} Returns an object containing the updated form data or an error object if there was an issue.
|
|
176
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/updateFormsDataStatusByid updateFormsDataStatusByid} documentation.
|
|
173
177
|
*/
|
|
174
178
|
async updateFormsDataStatusByid(id, body = {}) {
|
|
175
179
|
const result = await this._fetchPut(`/${id}/update-status`, body);
|
|
@@ -180,6 +184,7 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
180
184
|
* @handleName deleteFormsDataByid
|
|
181
185
|
* @param {number} id - ID of the form data. Example: 1.
|
|
182
186
|
* @returns {Promise<boolean | IError>} Returns an object containing the deleted form data or an error object if there was an issue.
|
|
187
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/deleteFormsDataByid deleteFormsDataByid} documentation.
|
|
183
188
|
*/
|
|
184
189
|
async deleteFormsDataByid(id) {
|
|
185
190
|
const result = await this._fetchDelete(`/${id}`);
|
|
@@ -23,6 +23,7 @@ export default class GeneralTypesApi extends AsyncModules implements IGeneralTyp
|
|
|
23
23
|
* @returns {Promise<IGeneralTypesEntity[] | IError>} Returns an array of general types or an error object if there was an issue.
|
|
24
24
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
25
25
|
* @description This method retrieves all general types available in the system.
|
|
26
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/general-types/getAllTypes getAllTypes} documentation.
|
|
26
27
|
*/
|
|
27
28
|
getAllTypes(): Promise<IGeneralTypesEntity[] | IError>;
|
|
28
29
|
}
|
|
@@ -27,6 +27,7 @@ class GeneralTypesApi extends asyncModules_1.default {
|
|
|
27
27
|
* @returns {Promise<IGeneralTypesEntity[] | IError>} Returns an array of general types or an error object if there was an issue.
|
|
28
28
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
29
29
|
* @description This method retrieves all general types available in the system.
|
|
30
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/general-types/getAllTypes getAllTypes} documentation.
|
|
30
31
|
*/
|
|
31
32
|
async getAllTypes() {
|
|
32
33
|
const result = await this._fetchGet('');
|
|
@@ -35,6 +35,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
|
|
|
35
35
|
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
36
36
|
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
37
37
|
* @returns {Promise<ICollectionEntity[] | IError>} Returns an array of ICollection objects or an error object if there was an issue.
|
|
38
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollections getICollections} documentation.
|
|
38
39
|
*/
|
|
39
40
|
getICollections(langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionEntity[] | IError>;
|
|
40
41
|
/**
|
|
@@ -44,6 +45,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
|
|
|
44
45
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
45
46
|
* @returns {Promise<ICollectionEntity | IError>} Returns an ICollection object or an error object if there was an issue.
|
|
46
47
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
48
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionById getICollectionById} documentation.
|
|
47
49
|
*/
|
|
48
50
|
getICollectionById(id: number, langCode?: string): Promise<ICollectionEntity | IError>;
|
|
49
51
|
/**
|
|
@@ -61,11 +63,12 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
|
|
|
61
63
|
}
|
|
62
64
|
* @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
|
|
63
65
|
* @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
|
|
64
|
-
* @param {
|
|
66
|
+
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
65
67
|
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
66
68
|
* @returns {Promise<ICollectionRowsResponce | IError>} Returns object ItemsWithTotal, where items is an array of requested objects.
|
|
67
69
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
68
70
|
* @description Get all records belonging to the collection by collection id.
|
|
71
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsById getICollectionRowsById} documentation.
|
|
69
72
|
*/
|
|
70
73
|
getICollectionRowsById(id: number, langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionRowsResponce | IError>;
|
|
71
74
|
/**
|
|
@@ -79,6 +82,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
|
|
|
79
82
|
}
|
|
80
83
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
81
84
|
* @description Check for the existence of a text identifier (marker).
|
|
85
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/validateICollectionMarker validateICollectionMarker} documentation.
|
|
82
86
|
*/
|
|
83
87
|
validateICollectionMarker(marker: string): Promise<ICollectionIsValid | IError>;
|
|
84
88
|
/**
|
|
@@ -88,6 +92,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
|
|
|
88
92
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
89
93
|
* @returns {Promise<ICollectionRowsResponce | IError>} Returns CollectionRowEntity object.
|
|
90
94
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
95
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsByMarker getICollectionRowsByMarker} documentation.
|
|
91
96
|
*/
|
|
92
97
|
getICollectionRowsByMarker(marker: string, langCode?: string): Promise<ICollectionRowsResponce | IError>;
|
|
93
98
|
/**
|
|
@@ -98,6 +103,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
|
|
|
98
103
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
99
104
|
* @returns {Promise<ICollectionRow | IError>} Returns CollectionRowEntity object.
|
|
100
105
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
106
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowByMarkerAndId getICollectionRowByMarkerAndId} documentation.
|
|
101
107
|
*/
|
|
102
108
|
getICollectionRowByMarkerAndId(marker: string, id: number, langCode?: string): Promise<ICollectionRow | IError>;
|
|
103
109
|
/**
|
|
@@ -120,6 +126,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
|
|
|
120
126
|
* @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
|
|
121
127
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
122
128
|
* @description Create a record in the collection.
|
|
129
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/createICollectionRow createICollectionRow} documentation.
|
|
123
130
|
*/
|
|
124
131
|
createICollectionRow(marker: string, body: ICollectionFormObject, langCode?: string): Promise<ICollectionRow | IError>;
|
|
125
132
|
/**
|
|
@@ -145,6 +152,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
|
|
|
145
152
|
* @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
|
|
146
153
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
147
154
|
* @description Edit a record in the collection.
|
|
155
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/updateICollectionRow updateICollectionRow} documentation.
|
|
148
156
|
*/
|
|
149
157
|
updateICollectionRow(marker: string, id: number, body: {
|
|
150
158
|
formIdentifier: string;
|
|
@@ -158,6 +166,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
|
|
|
158
166
|
* @returns {Promise<boolean | IError>} Returns true (in case of successful deletion) or false (in case of unsuccessful deletion) (permission "collections.row.delete" required for access)
|
|
159
167
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
160
168
|
* @description Deletion of collection record object
|
|
169
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/deleteICollectionRowByMarkerAndId deleteICollectionRowByMarkerAndId} documentation.
|
|
161
170
|
*/
|
|
162
171
|
deleteICollectionRowByMarkerAndId(marker: string, id: number): Promise<boolean | IError>;
|
|
163
172
|
}
|
|
@@ -44,6 +44,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
44
44
|
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
45
45
|
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
46
46
|
* @returns {Promise<ICollectionEntity[] | IError>} Returns an array of ICollection objects or an error object if there was an issue.
|
|
47
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollections getICollections} documentation.
|
|
47
48
|
*/
|
|
48
49
|
async getICollections(langCode = this.state.lang, userQuery) {
|
|
49
50
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -60,6 +61,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
60
61
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
61
62
|
* @returns {Promise<ICollectionEntity | IError>} Returns an ICollection object or an error object if there was an issue.
|
|
62
63
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
64
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionById getICollectionById} documentation.
|
|
63
65
|
*/
|
|
64
66
|
async getICollectionById(id, langCode = this.state.lang) {
|
|
65
67
|
const result = await this._fetchGet(`/${id}?` + this._queryParamsToString({ langCode }));
|
|
@@ -82,11 +84,12 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
82
84
|
}
|
|
83
85
|
* @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
|
|
84
86
|
* @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
|
|
85
|
-
* @param {
|
|
87
|
+
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
86
88
|
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
87
89
|
* @returns {Promise<ICollectionRowsResponce | IError>} Returns object ItemsWithTotal, where items is an array of requested objects.
|
|
88
90
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
89
91
|
* @description Get all records belonging to the collection by collection id.
|
|
92
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsById getICollectionRowsById} documentation.
|
|
90
93
|
*/
|
|
91
94
|
async getICollectionRowsById(id, langCode = this.state.lang, userQuery) {
|
|
92
95
|
const result = await this._fetchGet(`/${id}/rows?` +
|
|
@@ -110,6 +113,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
110
113
|
}
|
|
111
114
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
112
115
|
* @description Check for the existence of a text identifier (marker).
|
|
116
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/validateICollectionMarker validateICollectionMarker} documentation.
|
|
113
117
|
*/
|
|
114
118
|
async validateICollectionMarker(marker) {
|
|
115
119
|
const result = await this._fetchGet(`/marker-validation/${marker}`);
|
|
@@ -124,6 +128,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
124
128
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
125
129
|
* @returns {Promise<ICollectionRowsResponce | IError>} Returns CollectionRowEntity object.
|
|
126
130
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
131
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsByMarker getICollectionRowsByMarker} documentation.
|
|
127
132
|
*/
|
|
128
133
|
async getICollectionRowsByMarker(marker, langCode = this.state.lang) {
|
|
129
134
|
const result = await this._fetchGet(`/marker/${marker}/rows?langCode=${langCode}`);
|
|
@@ -139,6 +144,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
139
144
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
140
145
|
* @returns {Promise<ICollectionRow | IError>} Returns CollectionRowEntity object.
|
|
141
146
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
147
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowByMarkerAndId getICollectionRowByMarkerAndId} documentation.
|
|
142
148
|
*/
|
|
143
149
|
async getICollectionRowByMarkerAndId(marker, id, langCode = this.state.lang) {
|
|
144
150
|
const result = await this._fetchGet(`/marker/${marker}/rows/${id}?langCode=${langCode}`);
|
|
@@ -166,6 +172,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
166
172
|
* @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
|
|
167
173
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
168
174
|
* @description Create a record in the collection.
|
|
175
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/createICollectionRow createICollectionRow} documentation.
|
|
169
176
|
*/
|
|
170
177
|
async createICollectionRow(marker, body, langCode = this.state.lang) {
|
|
171
178
|
const response = await this._fetchPost(`/marker/${marker}/rows?langCode=${langCode}`, body);
|
|
@@ -196,6 +203,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
196
203
|
* @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
|
|
197
204
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
198
205
|
* @description Edit a record in the collection.
|
|
206
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/updateICollectionRow updateICollectionRow} documentation.
|
|
199
207
|
*/
|
|
200
208
|
async updateICollectionRow(marker, id, body, langCode = this.state.lang) {
|
|
201
209
|
const response = await this._fetchPut(`/marker/${marker}/rows/${id}?` + `langCode=${langCode}`, body);
|
|
@@ -211,6 +219,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
211
219
|
* @returns {Promise<boolean | IError>} Returns true (in case of successful deletion) or false (in case of unsuccessful deletion) (permission "collections.row.delete" required for access)
|
|
212
220
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
213
221
|
* @description Deletion of collection record object
|
|
222
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/deleteICollectionRowByMarkerAndId deleteICollectionRowByMarkerAndId} documentation.
|
|
214
223
|
*/
|
|
215
224
|
async deleteICollectionRowByMarkerAndId(marker, id) {
|
|
216
225
|
const result = await this._fetchDelete(`/marker/${marker}/rows/${id}`);
|
|
@@ -50,7 +50,7 @@ interface ICollectionsApi {
|
|
|
50
50
|
}
|
|
51
51
|
* @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 30.
|
|
52
52
|
* @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
|
|
53
|
-
* @param {
|
|
53
|
+
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
54
54
|
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
55
55
|
* @returns {ICollectionRowsResponce} Returns object ItemsWithTotal, where items is an array of requested objects.
|
|
56
56
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
@@ -22,6 +22,7 @@ export default class LocalesApi extends AsyncModules implements ILocales {
|
|
|
22
22
|
* @returns {Promise<ILocalEntity[] | IError>} Returns an array of LocaleEntity objects.
|
|
23
23
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
24
24
|
* @description Find all active language localization objects.
|
|
25
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/locales/getLocales getLocales} documentation.
|
|
25
26
|
*/
|
|
26
27
|
getLocales(): Promise<Array<ILocalEntity> | IError>;
|
|
27
28
|
}
|
|
@@ -26,6 +26,7 @@ class LocalesApi extends asyncModules_1.default {
|
|
|
26
26
|
* @returns {Promise<ILocalEntity[] | IError>} Returns an array of LocaleEntity objects.
|
|
27
27
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
28
28
|
* @description Find all active language localization objects.
|
|
29
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/locales/getLocales getLocales} documentation.
|
|
29
30
|
*/
|
|
30
31
|
async getLocales() {
|
|
31
32
|
const result = await this._fetchGet('/active/all');
|
package/dist/menus/menusApi.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export default class MenusApi extends AsyncModules implements IMenus {
|
|
|
24
24
|
* @returns {Promise<IMenusEntity | IError>} Returns a single menu object as a ContentMenu object with included pages.
|
|
25
25
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
26
26
|
* @description Get pages includes in menu by marker.
|
|
27
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/menus/getMenusByMarker getMenusByMarker} documentation.
|
|
27
28
|
*/
|
|
28
29
|
getMenusByMarker(marker: string, langCode?: string): Promise<IMenusEntity | IError>;
|
|
29
30
|
}
|
package/dist/menus/menusApi.js
CHANGED
|
@@ -28,6 +28,7 @@ class MenusApi extends asyncModules_1.default {
|
|
|
28
28
|
* @returns {Promise<IMenusEntity | IError>} Returns a single menu object as a ContentMenu object with included pages.
|
|
29
29
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
30
30
|
* @description Get pages includes in menu by marker.
|
|
31
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/menus/getMenusByMarker getMenusByMarker} documentation.
|
|
31
32
|
*/
|
|
32
33
|
async getMenusByMarker(marker, langCode = this.state.lang) {
|
|
33
34
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
@@ -28,6 +28,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
28
28
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
29
29
|
* @description This method requires user authorization.
|
|
30
30
|
* @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}.
|
|
31
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllOrdersStorage getAllOrdersStorage} documentation.
|
|
31
32
|
*/
|
|
32
33
|
getAllOrdersStorage(langCode?: string, offset?: number, limit?: number): Promise<IOrdersEntity[] | IError>;
|
|
33
34
|
/**
|
|
@@ -41,6 +42,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
41
42
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
42
43
|
* @description This method requires user authorization.
|
|
43
44
|
* @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}.
|
|
45
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllOrdersByMarker getAllOrdersByMarker} documentation.
|
|
44
46
|
*/
|
|
45
47
|
getAllOrdersByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrdersByMarkerEntity | IError>;
|
|
46
48
|
/**
|
|
@@ -52,6 +54,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
52
54
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
53
55
|
* @description This method requires user authorization.
|
|
54
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
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrdersStorageByMarker getOrdersStorageByMarker} documentation.
|
|
55
58
|
*/
|
|
56
59
|
getOrdersStorageByMarker(marker: string, langCode?: string): Promise<IOrdersEntity | IError>;
|
|
57
60
|
/**
|
|
@@ -64,6 +67,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
64
67
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
65
68
|
* @description This method requires user authorization.
|
|
66
69
|
* @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}.
|
|
70
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderByMarkerAndId getOrderByMarkerAndId} documentation.
|
|
67
71
|
*/
|
|
68
72
|
getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
|
|
69
73
|
/**
|
|
@@ -73,8 +77,9 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
73
77
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
74
78
|
* @returns {Promise<IOrderPreviewResponse | IError>} Returns an object with the order preview.
|
|
75
79
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
76
|
-
* @description This method requires user authorization
|
|
80
|
+
* @description This method requires user authorization.
|
|
77
81
|
* @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}.
|
|
82
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/previewOrder previewOrder} documentation.
|
|
78
83
|
*/
|
|
79
84
|
previewOrder(body: ICreateOrderPreview, langCode?: string): Promise<IOrderPreviewResponse | IError>;
|
|
80
85
|
/**
|
|
@@ -103,6 +108,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
103
108
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
104
109
|
* @description This method requires user authorization.
|
|
105
110
|
* @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}.
|
|
111
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/createOrder createOrder} documentation.
|
|
106
112
|
*/
|
|
107
113
|
createOrder(marker: string, body: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
|
|
108
114
|
/**
|
|
@@ -133,6 +139,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
133
139
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
134
140
|
* @description This method requires user authorization.
|
|
135
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
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/updateOrderByMarkerAndId updateOrderByMarkerAndId} documentation.
|
|
136
143
|
*/
|
|
137
144
|
updateOrderByMarkerAndId(marker: string, id: number, body: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
|
|
138
145
|
/**
|
|
@@ -145,6 +152,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
145
152
|
* @returns {Promise<IOrderStatus[] | IError>} Returns an object with the orders statuses.
|
|
146
153
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
147
154
|
* @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}.
|
|
155
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllStatusesByStorageMarker getAllStatusesByStorageMarker} documentation.
|
|
148
156
|
*/
|
|
149
157
|
getAllStatusesByStorageMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrderStatus[] | IError>;
|
|
150
158
|
/**
|
|
@@ -153,6 +161,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
153
161
|
* @param {number} id - Order id. Example: 1.
|
|
154
162
|
* @returns {Promise<IRefundRequest[] | IError>} Returns array of refund requests.
|
|
155
163
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
164
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getRefunds getRefunds} documentation.
|
|
156
165
|
*/
|
|
157
166
|
getRefunds(id: number): Promise<IRefundRequest[] | IError>;
|
|
158
167
|
/**
|
|
@@ -162,6 +171,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
162
171
|
* @param {ICreateRefundRequest} body - Refund request body.
|
|
163
172
|
* @returns {Promise<boolean | IError>} Returns true if the refund request was created successfully.
|
|
164
173
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
174
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/createRefundRequest createRefundRequest} documentation.
|
|
165
175
|
*/
|
|
166
176
|
createRefundRequest(id: number, body: ICreateRefundRequest): Promise<boolean | IError>;
|
|
167
177
|
/**
|
|
@@ -170,6 +180,20 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
170
180
|
* @param {number} id - Order id. Example: 1.
|
|
171
181
|
* @returns {Promise<boolean | IError>} Returns true if the refund request was cancelled successfully.
|
|
172
182
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
183
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/cancelRefundRequest cancelRefundRequest} documentation.
|
|
173
184
|
*/
|
|
174
185
|
cancelRefundRequest(id: number): Promise<boolean | IError>;
|
|
186
|
+
/**
|
|
187
|
+
* Runs a fetch against the `/orders` base URL instead of the default
|
|
188
|
+
* `/orders-storage`, then restores the original URL.
|
|
189
|
+
*
|
|
190
|
+
* Refund endpoints live under `/api/content/orders`, while this class is based
|
|
191
|
+
* on `/api/content/orders-storage`. The helper swaps `_url` for the duration of
|
|
192
|
+
* the call and restores it in `finally`, so the base URL is restored even if
|
|
193
|
+
* the request throws.
|
|
194
|
+
* @param {() => Promise<T>} fetcher - Thunk performing the fetch call.
|
|
195
|
+
* @returns {Promise<T>} The fetcher result.
|
|
196
|
+
* @template T
|
|
197
|
+
*/
|
|
198
|
+
private _withOrdersUrl;
|
|
175
199
|
}
|
package/dist/orders/ordersApi.js
CHANGED
|
@@ -32,6 +32,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
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
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllOrdersStorage getAllOrdersStorage} documentation.
|
|
35
36
|
*/
|
|
36
37
|
async getAllOrdersStorage(langCode = this.state.lang, offset = 0, limit = 30) {
|
|
37
38
|
const result = await this._fetchGet(`?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
@@ -48,6 +49,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
48
49
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
49
50
|
* @description This method requires user authorization.
|
|
50
51
|
* @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}.
|
|
52
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllOrdersByMarker getAllOrdersByMarker} documentation.
|
|
51
53
|
*/
|
|
52
54
|
async getAllOrdersByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
53
55
|
const result = await this._fetchGet(`/marker/${marker}/orders?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
@@ -64,6 +66,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
64
66
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
65
67
|
* @description This method requires user authorization.
|
|
66
68
|
* @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}.
|
|
69
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrdersStorageByMarker getOrdersStorageByMarker} documentation.
|
|
67
70
|
*/
|
|
68
71
|
async getOrdersStorageByMarker(marker, langCode = this.state.lang) {
|
|
69
72
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
@@ -79,6 +82,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
79
82
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
80
83
|
* @description This method requires user authorization.
|
|
81
84
|
* @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}.
|
|
85
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderByMarkerAndId getOrderByMarkerAndId} documentation.
|
|
82
86
|
*/
|
|
83
87
|
async getOrderByMarkerAndId(marker, id, langCode = this.state.lang) {
|
|
84
88
|
const result = await this._fetchGet(`/marker/${marker}/orders/${id}?langCode=${langCode}`);
|
|
@@ -93,8 +97,9 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
93
97
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
94
98
|
* @returns {Promise<IOrderPreviewResponse | IError>} Returns an object with the order preview.
|
|
95
99
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
96
|
-
* @description This method requires user authorization
|
|
100
|
+
* @description This method requires user authorization.
|
|
97
101
|
* @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}.
|
|
102
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/previewOrder previewOrder} documentation.
|
|
98
103
|
*/
|
|
99
104
|
async previewOrder(body, langCode = this.state.lang) {
|
|
100
105
|
const result = await this._fetchPost(`/orders/preview?langCode=${langCode}`, body);
|
|
@@ -126,6 +131,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
126
131
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
127
132
|
* @description This method requires user authorization.
|
|
128
133
|
* @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}.
|
|
134
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/createOrder createOrder} documentation.
|
|
129
135
|
*/
|
|
130
136
|
async createOrder(marker, body, langCode = this.state.lang) {
|
|
131
137
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -167,6 +173,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
167
173
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
168
174
|
* @description This method requires user authorization.
|
|
169
175
|
* @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}.
|
|
176
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/updateOrderByMarkerAndId updateOrderByMarkerAndId} documentation.
|
|
170
177
|
*/
|
|
171
178
|
async updateOrderByMarkerAndId(marker, id, body, langCode = this.state.lang) {
|
|
172
179
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -190,6 +197,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
190
197
|
* @returns {Promise<IOrderStatus[] | IError>} Returns an object with the orders statuses.
|
|
191
198
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
192
199
|
* @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}.
|
|
200
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllStatusesByStorageMarker getAllStatusesByStorageMarker} documentation.
|
|
193
201
|
*/
|
|
194
202
|
async getAllStatusesByStorageMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
195
203
|
const query = {
|
|
@@ -206,12 +214,10 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
206
214
|
* @param {number} id - Order id. Example: 1.
|
|
207
215
|
* @returns {Promise<IRefundRequest[] | IError>} Returns array of refund requests.
|
|
208
216
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
217
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getRefunds getRefunds} documentation.
|
|
209
218
|
*/
|
|
210
219
|
async getRefunds(id) {
|
|
211
|
-
const
|
|
212
|
-
this._url = this._ordersUrl;
|
|
213
|
-
const data = await this._fetchGet(`/${id}/refund`);
|
|
214
|
-
this._url = savedUrl;
|
|
220
|
+
const data = await this._withOrdersUrl(() => this._fetchGet(`/${id}/refund`));
|
|
215
221
|
return this._normalizeData(data);
|
|
216
222
|
}
|
|
217
223
|
/**
|
|
@@ -221,12 +227,10 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
221
227
|
* @param {ICreateRefundRequest} body - Refund request body.
|
|
222
228
|
* @returns {Promise<boolean | IError>} Returns true if the refund request was created successfully.
|
|
223
229
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
230
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/createRefundRequest createRefundRequest} documentation.
|
|
224
231
|
*/
|
|
225
232
|
async createRefundRequest(id, body) {
|
|
226
|
-
const
|
|
227
|
-
this._url = this._ordersUrl;
|
|
228
|
-
const data = await this._fetchPost(`/${id}/refund`, body);
|
|
229
|
-
this._url = savedUrl;
|
|
233
|
+
const data = await this._withOrdersUrl(() => this._fetchPost(`/${id}/refund`, body));
|
|
230
234
|
return this._normalizeData(data);
|
|
231
235
|
}
|
|
232
236
|
/**
|
|
@@ -235,13 +239,33 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
235
239
|
* @param {number} id - Order id. Example: 1.
|
|
236
240
|
* @returns {Promise<boolean | IError>} Returns true if the refund request was cancelled successfully.
|
|
237
241
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
242
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/cancelRefundRequest cancelRefundRequest} documentation.
|
|
238
243
|
*/
|
|
239
244
|
async cancelRefundRequest(id) {
|
|
245
|
+
const data = await this._withOrdersUrl(() => this._fetchDelete(`/${id}/refund`));
|
|
246
|
+
return this._normalizeData(data);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Runs a fetch against the `/orders` base URL instead of the default
|
|
250
|
+
* `/orders-storage`, then restores the original URL.
|
|
251
|
+
*
|
|
252
|
+
* Refund endpoints live under `/api/content/orders`, while this class is based
|
|
253
|
+
* on `/api/content/orders-storage`. The helper swaps `_url` for the duration of
|
|
254
|
+
* the call and restores it in `finally`, so the base URL is restored even if
|
|
255
|
+
* the request throws.
|
|
256
|
+
* @param {() => Promise<T>} fetcher - Thunk performing the fetch call.
|
|
257
|
+
* @returns {Promise<T>} The fetcher result.
|
|
258
|
+
* @template T
|
|
259
|
+
*/
|
|
260
|
+
async _withOrdersUrl(fetcher) {
|
|
240
261
|
const savedUrl = this._url;
|
|
241
262
|
this._url = this._ordersUrl;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
263
|
+
try {
|
|
264
|
+
return await fetcher();
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
this._url = savedUrl;
|
|
268
|
+
}
|
|
245
269
|
}
|
|
246
270
|
}
|
|
247
271
|
exports.default = OrdersApi;
|
|
@@ -266,11 +266,13 @@ interface IOrdersFormData {
|
|
|
266
266
|
* @interface IOrderProductData
|
|
267
267
|
* @property {number} productId - Product identifier. Example: 1.
|
|
268
268
|
* @property {number} quantity - Quantity of the product. Example: 2.
|
|
269
|
+
* @property {string} [signedPrice] - The signed price of the product is obtained along with the product data when `signPrice` is set. Example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...".
|
|
269
270
|
* @description Represents a product data in an order.
|
|
270
271
|
*/
|
|
271
272
|
interface IOrderProductData {
|
|
272
273
|
productId: number;
|
|
273
274
|
quantity: number;
|
|
275
|
+
signedPrice?: string;
|
|
274
276
|
}
|
|
275
277
|
/**
|
|
276
278
|
* Interface representing product data in an order.
|
|
@@ -311,7 +313,7 @@ interface IOrderProductsData {
|
|
|
311
313
|
}
|
|
312
314
|
]
|
|
313
315
|
* @property {string} currency - Currency used to pay for the order. Example: "USD".
|
|
314
|
-
* @property {
|
|
316
|
+
* @property {string} totalSum - Total order amount. Example: "150".
|
|
315
317
|
* @property {string} [createdDate] - Order creation date. Example: "2023-10-01T12:00:00Z".
|
|
316
318
|
* @property {string} [statusIdentifier] - Text identifier of order status object (if not set, default status will be assigned). Example: "status-1".
|
|
317
319
|
* @property {string} [couponCode] -
|
|
@@ -328,7 +330,7 @@ interface IBaseOrdersEntity {
|
|
|
328
330
|
formData: IOrdersFormData[];
|
|
329
331
|
products: IOrderProductsData[];
|
|
330
332
|
currency: string;
|
|
331
|
-
totalSum:
|
|
333
|
+
totalSum: string;
|
|
332
334
|
createdDate?: string;
|
|
333
335
|
statusIdentifier?: string;
|
|
334
336
|
couponCode?: string;
|