oneentry 1.0.176 → 1.0.178
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/README.md +12 -5
- package/changelog.md +116 -0
- package/dist/admins/adminsApi.js +2 -9
- package/dist/admins/adminsInterfaces.d.ts +5 -5
- package/dist/admins/adminsSchemas.d.ts +4 -4
- package/dist/admins/adminsSchemas.js +2 -2
- package/dist/attribute-sets/attributeSetsApi.d.ts +1 -1
- package/dist/attribute-sets/attributeSetsApi.js +4 -4
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +65 -14
- package/dist/attribute-sets/attributeSetsSchemas.d.ts +8 -6
- package/dist/attribute-sets/attributeSetsSchemas.js +6 -9
- package/dist/auth-provider/authProviderApi.d.ts +4 -4
- package/dist/auth-provider/authProviderApi.js +90 -23
- package/dist/auth-provider/authProviderSchemas.d.ts +1 -0
- package/dist/auth-provider/authProviderSchemas.js +1 -0
- package/dist/auth-provider/authProvidersInterfaces.d.ts +8 -6
- package/dist/base/asyncModules.d.ts +62 -1
- package/dist/base/asyncModules.js +219 -37
- package/dist/base/stateModule.d.ts +2 -0
- package/dist/base/stateModule.js +22 -12
- package/dist/base/syncModules.d.ts +18 -10
- package/dist/base/syncModules.js +100 -29
- package/dist/base/utils.d.ts +26 -21
- package/dist/base/validation.d.ts +3 -3
- package/dist/base/validation.js +6 -7
- package/dist/blocks/blocksApi.d.ts +20 -17
- package/dist/blocks/blocksApi.js +82 -64
- package/dist/blocks/blocksInterfaces.d.ts +8 -8
- package/dist/discounts/discountsApi.d.ts +9 -7
- package/dist/discounts/discountsApi.js +16 -13
- package/dist/discounts/discountsInterfaces.d.ts +14 -10
- package/dist/events/eventsApi.d.ts +3 -3
- package/dist/events/eventsApi.js +3 -3
- package/dist/events/eventsInterfaces.d.ts +10 -14
- package/dist/file-uploading/fileUploadingApi.d.ts +4 -4
- package/dist/file-uploading/fileUploadingApi.js +13 -5
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +5 -6
- package/dist/filters/filtersApi.js +2 -2
- package/dist/forms/formsApi.js +2 -2
- package/dist/forms/formsInterfaces.d.ts +1 -3
- package/dist/forms/formsSchemas.d.ts +3 -6
- package/dist/forms/formsSchemas.js +2 -4
- package/dist/forms-data/formsDataApi.d.ts +27 -1
- package/dist/forms-data/formsDataApi.js +119 -68
- package/dist/forms-data/formsDataInterfaces.d.ts +17 -13
- package/dist/general-types/generalTypesInterfaces.d.ts +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.js +50 -7
- package/dist/integration-collections/integrationCollectionsApi.d.ts +15 -4
- package/dist/integration-collections/integrationCollectionsApi.js +41 -14
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +8 -9
- package/dist/integration-collections/integrationCollectionsSchemas.d.ts +0 -2
- package/dist/integration-collections/integrationCollectionsSchemas.js +0 -1
- package/dist/menus/menusApi.js +1 -1
- package/dist/orders/ordersApi.d.ts +1 -13
- package/dist/orders/ordersApi.js +21 -42
- package/dist/orders/ordersInterfaces.d.ts +21 -14
- package/dist/pages/pagesApi.d.ts +8 -6
- package/dist/pages/pagesApi.js +48 -33
- package/dist/pages/pagesInterfaces.d.ts +20 -16
- package/dist/pages/pagesSchemas.d.ts +0 -3
- package/dist/pages/pagesSchemas.js +0 -1
- package/dist/payments/paymentsApi.d.ts +10 -11
- package/dist/payments/paymentsApi.js +22 -18
- package/dist/payments/paymentsInterfaces.d.ts +12 -14
- package/dist/payments/paymentsSchemas.d.ts +21 -20
- package/dist/payments/paymentsSchemas.js +5 -8
- package/dist/product-statuses/productStatusesApi.d.ts +1 -1
- package/dist/product-statuses/productStatusesApi.js +3 -3
- package/dist/product-statuses/productStatusesInterfaces.d.ts +1 -4
- package/dist/products/productsApi.d.ts +50 -64
- package/dist/products/productsApi.js +79 -80
- package/dist/products/productsInterfaces.d.ts +59 -90
- package/dist/search/searchApi.d.ts +3 -2
- package/dist/search/searchApi.js +7 -4
- package/dist/search/searchInterfaces.d.ts +2 -1
- package/dist/sitemap/sitemapInterfaces.d.ts +10 -6
- package/dist/subscriptions/subscriptionsApi.d.ts +1 -1
- package/dist/subscriptions/subscriptionsApi.js +1 -1
- package/dist/subscriptions/subscriptionsInterfaces.d.ts +1 -1
- package/dist/system/systemApi.d.ts +2 -0
- package/dist/system/systemApi.js +2 -0
- package/dist/system/systemInterfaces.d.ts +2 -0
- package/dist/templates/templatesApi.d.ts +2 -2
- package/dist/templates/templatesApi.js +12 -11
- package/dist/templates/templatesInterfaces.d.ts +2 -2
- package/dist/templates-preview/templatesPreviewApi.js +2 -2
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +23 -13
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +7 -0
- package/dist/templates-preview/templatesPreviewSchemas.js +2 -0
- package/dist/user-groups/userGroupsApi.js +5 -5
- package/dist/user-groups/userGroupsSchemas.d.ts +4 -4
- package/dist/users/usersApi.d.ts +1 -1
- package/dist/users/usersApi.js +28 -15
- package/dist/users/usersInterfaces.d.ts +2 -9
- package/dist/web-socket/lazySocket.d.ts +6 -5
- package/dist/web-socket/lazySocket.js +212 -15
- package/dist/web-socket/wsApi.d.ts +7 -4
- package/dist/web-socket/wsApi.js +49 -12
- package/dist/web-socket/wsInterfaces.d.ts +41 -4
- package/esm/admins/adminsApi.js +2 -9
- package/esm/admins/adminsInterfaces.d.ts +5 -5
- package/esm/admins/adminsSchemas.d.ts +4 -4
- package/esm/admins/adminsSchemas.js +2 -2
- package/esm/attribute-sets/attributeSetsApi.d.ts +1 -1
- package/esm/attribute-sets/attributeSetsApi.js +4 -4
- package/esm/attribute-sets/attributeSetsInterfaces.d.ts +65 -14
- package/esm/attribute-sets/attributeSetsSchemas.d.ts +8 -6
- package/esm/attribute-sets/attributeSetsSchemas.js +6 -9
- package/esm/auth-provider/authProviderApi.d.ts +4 -4
- package/esm/auth-provider/authProviderApi.js +90 -23
- package/esm/auth-provider/authProviderSchemas.d.ts +1 -0
- package/esm/auth-provider/authProviderSchemas.js +1 -0
- package/esm/auth-provider/authProvidersInterfaces.d.ts +8 -6
- package/esm/base/asyncModules.d.ts +62 -1
- package/esm/base/asyncModules.js +219 -37
- package/esm/base/stateModule.d.ts +2 -0
- package/esm/base/stateModule.js +22 -12
- package/esm/base/syncModules.d.ts +18 -10
- package/esm/base/syncModules.js +99 -29
- package/esm/base/utils.d.ts +26 -21
- package/esm/base/validation.d.ts +3 -3
- package/esm/base/validation.js +6 -7
- package/esm/blocks/blocksApi.d.ts +20 -17
- package/esm/blocks/blocksApi.js +82 -64
- package/esm/blocks/blocksInterfaces.d.ts +8 -8
- package/esm/discounts/discountsApi.d.ts +9 -7
- package/esm/discounts/discountsApi.js +16 -13
- package/esm/discounts/discountsInterfaces.d.ts +14 -10
- package/esm/events/eventsApi.d.ts +3 -3
- package/esm/events/eventsApi.js +3 -3
- package/esm/events/eventsInterfaces.d.ts +10 -14
- package/esm/file-uploading/fileUploadingApi.d.ts +4 -4
- package/esm/file-uploading/fileUploadingApi.js +13 -5
- package/esm/file-uploading/fileUploadingInterfaces.d.ts +5 -6
- package/esm/filters/filtersApi.js +2 -2
- package/esm/forms/formsApi.js +2 -2
- package/esm/forms/formsInterfaces.d.ts +1 -3
- package/esm/forms/formsSchemas.d.ts +3 -6
- package/esm/forms/formsSchemas.js +2 -4
- package/esm/forms-data/formsDataApi.d.ts +27 -1
- package/esm/forms-data/formsDataApi.js +119 -68
- package/esm/forms-data/formsDataInterfaces.d.ts +17 -13
- package/esm/general-types/generalTypesInterfaces.d.ts +1 -1
- package/esm/index.d.ts +7 -6
- package/esm/index.js +50 -7
- package/esm/integration-collections/integrationCollectionsApi.d.ts +15 -4
- package/esm/integration-collections/integrationCollectionsApi.js +41 -14
- package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +8 -9
- package/esm/integration-collections/integrationCollectionsSchemas.d.ts +0 -2
- package/esm/integration-collections/integrationCollectionsSchemas.js +0 -1
- package/esm/menus/menusApi.js +1 -1
- package/esm/orders/ordersApi.d.ts +1 -13
- package/esm/orders/ordersApi.js +21 -42
- package/esm/orders/ordersInterfaces.d.ts +21 -14
- package/esm/pages/pagesApi.d.ts +8 -6
- package/esm/pages/pagesApi.js +48 -33
- package/esm/pages/pagesInterfaces.d.ts +20 -16
- package/esm/pages/pagesSchemas.d.ts +0 -3
- package/esm/pages/pagesSchemas.js +0 -1
- package/esm/payments/paymentsApi.d.ts +10 -11
- package/esm/payments/paymentsApi.js +22 -18
- package/esm/payments/paymentsInterfaces.d.ts +12 -14
- package/esm/payments/paymentsSchemas.d.ts +21 -20
- package/esm/payments/paymentsSchemas.js +5 -8
- package/esm/product-statuses/productStatusesApi.d.ts +1 -1
- package/esm/product-statuses/productStatusesApi.js +3 -3
- package/esm/product-statuses/productStatusesInterfaces.d.ts +1 -4
- package/esm/products/productsApi.d.ts +50 -64
- package/esm/products/productsApi.js +79 -80
- package/esm/products/productsInterfaces.d.ts +59 -90
- package/esm/search/searchApi.d.ts +3 -2
- package/esm/search/searchApi.js +7 -4
- package/esm/search/searchInterfaces.d.ts +2 -1
- package/esm/sitemap/sitemapInterfaces.d.ts +10 -6
- package/esm/subscriptions/subscriptionsApi.d.ts +1 -1
- package/esm/subscriptions/subscriptionsApi.js +1 -1
- package/esm/subscriptions/subscriptionsInterfaces.d.ts +1 -1
- package/esm/system/systemApi.d.ts +2 -0
- package/esm/system/systemApi.js +2 -0
- package/esm/system/systemInterfaces.d.ts +2 -0
- package/esm/templates/templatesApi.d.ts +2 -2
- package/esm/templates/templatesApi.js +11 -10
- package/esm/templates/templatesInterfaces.d.ts +2 -2
- package/esm/templates-preview/templatesPreviewApi.js +2 -2
- package/esm/templates-preview/templatesPreviewInterfaces.d.ts +23 -13
- package/esm/templates-preview/templatesPreviewSchemas.d.ts +7 -0
- package/esm/templates-preview/templatesPreviewSchemas.js +2 -0
- package/esm/user-groups/userGroupsApi.js +5 -5
- package/esm/user-groups/userGroupsSchemas.d.ts +4 -4
- package/esm/users/usersApi.d.ts +1 -1
- package/esm/users/usersApi.js +28 -15
- package/esm/users/usersInterfaces.d.ts +2 -9
- package/esm/web-socket/lazySocket.d.ts +6 -5
- package/esm/web-socket/lazySocket.js +212 -15
- package/esm/web-socket/wsApi.d.ts +7 -4
- package/esm/web-socket/wsApi.js +49 -12
- package/esm/web-socket/wsInterfaces.d.ts +41 -4
- package/package.json +2 -2
|
@@ -141,6 +141,7 @@ interface IOrdersApi {
|
|
|
141
141
|
* @param {number} [limit] - Maximum number of records to return. Default: 30.
|
|
142
142
|
* @returns {Promise<IOrderStatus[] | IError>} Returns an object with the orders statuses.
|
|
143
143
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
144
|
+
* @description Get all order statuses of the storage. This method requires user authorization: a guest gets `401 Unauthorized`.
|
|
144
145
|
* @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}.
|
|
145
146
|
*/
|
|
146
147
|
getAllStatusesByStorageMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrderStatus[] | IError>;
|
|
@@ -216,7 +217,8 @@ interface IOrdersVectorSearch {
|
|
|
216
217
|
}
|
|
217
218
|
],
|
|
218
219
|
"attributeSetIdentifier": "order_form",
|
|
219
|
-
"totalSum": "300
|
|
220
|
+
"totalSum": "300",
|
|
221
|
+
"totalSumRaw": "300",
|
|
220
222
|
"currency": "",
|
|
221
223
|
"paymentAccountIdentifier": "cash",
|
|
222
224
|
"paymentAccountLocalizeInfos": {
|
|
@@ -227,9 +229,10 @@ interface IOrdersVectorSearch {
|
|
|
227
229
|
"id": 2957,
|
|
228
230
|
"title": "Cosmo",
|
|
229
231
|
"sku": null,
|
|
230
|
-
"previewImage":
|
|
232
|
+
"previewImage": [],
|
|
231
233
|
"price": 150,
|
|
232
|
-
"quantity": 2
|
|
234
|
+
"quantity": 2,
|
|
235
|
+
"isGift": false
|
|
233
236
|
}
|
|
234
237
|
],
|
|
235
238
|
"isCompleted": false
|
|
@@ -262,9 +265,9 @@ interface IPicture {
|
|
|
262
265
|
* @interface IOrderProducts
|
|
263
266
|
* @property {number} id - Product ID. Example: 2957.
|
|
264
267
|
* @property {number} quantity - Product quantity. Example: 1.
|
|
265
|
-
* @property {string} title - Product title. Example: "Cosmo".
|
|
268
|
+
* @property {string | null} title - Product title; `null` on a language the product has no translation in. Example: "Cosmo".
|
|
266
269
|
* @property {string | null} sku - Product SKU. Example: "SKU".
|
|
267
|
-
* @property {IPicture | null} previewImage - Preview image of the product.
|
|
270
|
+
* @property {IPicture | IPicture[] | null} previewImage - Preview image of the product. A product without one comes as an empty array `[]`, not `null` — check `Array.isArray(previewImage) ? previewImage[0] : previewImage`.
|
|
268
271
|
* @example
|
|
269
272
|
{
|
|
270
273
|
"filename": "image.jpg",
|
|
@@ -279,9 +282,9 @@ interface IPicture {
|
|
|
279
282
|
interface IOrderProducts {
|
|
280
283
|
id: number;
|
|
281
284
|
quantity: number;
|
|
282
|
-
title: string;
|
|
285
|
+
title: string | null;
|
|
283
286
|
sku: string | null;
|
|
284
|
-
previewImage: IPicture | null;
|
|
287
|
+
previewImage: IPicture | IPicture[] | null;
|
|
285
288
|
price: number;
|
|
286
289
|
isGift: boolean;
|
|
287
290
|
}
|
|
@@ -542,7 +545,7 @@ interface IOrderData {
|
|
|
542
545
|
* @property {number} productId - Identifier of the product covered by the stage. Example: 1.
|
|
543
546
|
* @property {string} title - Stage title. Example: "Deposit".
|
|
544
547
|
* @property {number} value - Stage amount. Example: 100.
|
|
545
|
-
* @property {string} status - Stage status. Example: "
|
|
548
|
+
* @property {string} status - Stage status. Example: "planned".
|
|
546
549
|
* @description A single stage of a split (staged) order payment.
|
|
547
550
|
*/
|
|
548
551
|
interface IOrderSplitStage {
|
|
@@ -583,8 +586,8 @@ interface IOrderSplit {
|
|
|
583
586
|
}
|
|
584
587
|
]
|
|
585
588
|
* @property {string | null} [attributeSetIdentifier] - Marker of the attribute set. Example: "attribute-set-1".
|
|
586
|
-
* @property {string} totalSum - Total order amount. Example: "
|
|
587
|
-
* @property {string} [totalSumRaw] - Raw total order amount with full precision. Example: "
|
|
589
|
+
* @property {string} totalSum - Total order amount. Example: "300".
|
|
590
|
+
* @property {string} [totalSumRaw] - Raw total order amount with full precision. Example: "300".
|
|
588
591
|
* @property {string} currency - Currency used to pay for the order. Example: "USD".
|
|
589
592
|
* @property {string | null} [paymentAccountIdentifier] - Marker of the payment account. Example: "payment-1".
|
|
590
593
|
* @property {ILocalizeInfo} [paymentAccountLocalizeInfos] - Localized name of the payment account.
|
|
@@ -596,9 +599,13 @@ interface IOrderSplit {
|
|
|
596
599
|
* @example
|
|
597
600
|
[
|
|
598
601
|
{
|
|
599
|
-
"id":
|
|
600
|
-
"
|
|
601
|
-
"
|
|
602
|
+
"id": 2957,
|
|
603
|
+
"title": "Cosmo",
|
|
604
|
+
"sku": null,
|
|
605
|
+
"previewImage": [],
|
|
606
|
+
"price": 150,
|
|
607
|
+
"quantity": 2,
|
|
608
|
+
"isGift": false
|
|
602
609
|
}
|
|
603
610
|
]
|
|
604
611
|
* @property {string | null} paymentUrl - Payment page URL. Example: "https://example.com/pay/123".
|
|
@@ -773,4 +780,4 @@ interface ICreateRefundRequest {
|
|
|
773
780
|
products: Record<string, IRefundProduct>;
|
|
774
781
|
note?: string;
|
|
775
782
|
}
|
|
776
|
-
export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderDiscountBonus, IOrderDiscountConfig, IOrderDiscountSettings, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderSplit, IOrderSplitStage, IOrderStatus, IOrdersVectorSearch, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundProduct, IRefundRequest, };
|
|
783
|
+
export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderDiscountBonus, IOrderDiscountConfig, IOrderDiscountSettings, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrderProductsData, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderSplit, IOrderSplitStage, IOrderStatus, IOrdersVectorSearch, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundProduct, IRefundRequest, };
|
package/esm/pages/pagesApi.d.ts
CHANGED
|
@@ -61,9 +61,9 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
|
|
|
61
61
|
/**
|
|
62
62
|
* Get child pages object with information as an array.
|
|
63
63
|
* @handleName getChildPagesByParentUrl
|
|
64
|
-
* @param {string} url - URL of the parent page whose child pages to fetch
|
|
64
|
+
* @param {string} url - URL of the parent page whose child pages to fetch — the page's own `pageUrl`, not a nested path: `blog/blog1` answers `404`. Example: "blog".
|
|
65
65
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
66
|
-
* @returns {Promise<IPagesEntity | IError>} Returns
|
|
66
|
+
* @returns {Promise<IPagesEntity[] | IError>} Returns an array of PageEntity objects for the selected parent, or an empty array [] when it has no child pages. A parent page that does not exist answers `404 Parent page not found` (IError).
|
|
67
67
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
68
68
|
* @description Get child pages object with information as an array.
|
|
69
69
|
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/getChildPagesByParentUrl getChildPagesByParentUrl} documentation.
|
|
@@ -86,12 +86,13 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
|
|
|
86
86
|
* @param {string} name - Text to search for in page titles (`localizeInfos.title`) in the requested language. Example: "About Us".
|
|
87
87
|
* @param {string} [url] - Page URL. Example: "catalog".
|
|
88
88
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
89
|
+
* @param {boolean} [correct] - Correct typos by the project's search dictionary first. The API defaults to `true`; pass `false` to search the query as is.
|
|
89
90
|
* @returns {Promise<IPagesEntity[] | IPageSearchResult[] | IError>} Returns found pages as an array of PageEntity objects, an array of short PageSearchResult cards when the traficLimit config option is enabled, or an empty array [] (if there is no data)
|
|
90
91
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
91
92
|
* @description Quick search for page objects with limited output. The quick search endpoint returns short cards ({ id, title }); with traficLimit enabled they are returned as is, otherwise full page entities are fetched for the found ids. The search runs in `langCode`, and a found page that cannot be loaded in that language is left out of the result.
|
|
92
93
|
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/searchPage searchPage} documentation.
|
|
93
94
|
*/
|
|
94
|
-
searchPage(name: string, url?: string, langCode?: string): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
|
|
95
|
+
searchPage(name: string, url?: string, langCode?: string, correct?: boolean): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
|
|
95
96
|
/**
|
|
96
97
|
* Semantic (vector) search for pages.
|
|
97
98
|
* @handleName getPagesByVectorSearch
|
|
@@ -109,6 +110,7 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
|
|
|
109
110
|
* Add template data to pages
|
|
110
111
|
* @handleName addTemplateToPages
|
|
111
112
|
* @param {IPagesEntity[]} data - An array of page objects (IPagesEntity[]) to which template data will be added.
|
|
113
|
+
* @param {string} [langCode] - Language the templates are fetched and unwrapped in. Default: the client's language.
|
|
112
114
|
* @example
|
|
113
115
|
[
|
|
114
116
|
{
|
|
@@ -149,15 +151,15 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
|
|
|
149
151
|
* @description Add template data to pages. Optimized to avoid N+1 query problem by fetching only unique templates in parallel.
|
|
150
152
|
* For example, if 100 pages use 3 different templates, this method makes 3 requests instead of 100.
|
|
151
153
|
*/
|
|
152
|
-
protected addTemplateToPages(data: IPagesEntity[]): Promise<any | IError>;
|
|
154
|
+
protected addTemplateToPages(data: IPagesEntity[], langCode?: string): Promise<any | IError>;
|
|
153
155
|
/**
|
|
154
156
|
* Add template data to page by page templateIdentifier
|
|
155
157
|
* @handleName addTemplateToPage
|
|
156
158
|
* @param {IPagesEntity} data - Page object (IPagesEntity) to which template data will be added.
|
|
159
|
+
* @param {string} [langCode] - Language the templates are fetched and unwrapped in. Default: the client's language.
|
|
157
160
|
* @returns {Promise<any | IError>} An array of page objects with template data added
|
|
158
161
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
159
162
|
* @description Add template data to page by page templateIdentifier
|
|
160
|
-
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/addTemplateToPage addTemplateToPage} documentation.
|
|
161
163
|
*/
|
|
162
|
-
protected addTemplateToPage(data: IPagesEntity): Promise<any | IError>;
|
|
164
|
+
protected addTemplateToPage(data: IPagesEntity, langCode?: string): Promise<any | IError>;
|
|
163
165
|
}
|
package/esm/pages/pagesApi.js
CHANGED
|
@@ -30,11 +30,11 @@ export default class PagesApi extends AsyncModules {
|
|
|
30
30
|
*/
|
|
31
31
|
async getRootPages(langCode = this.state.lang) {
|
|
32
32
|
// Fetch data from the server using a GET request to retrieve root pages for the specified language code
|
|
33
|
-
const data = await this._fetchGet(`/root?langCode=${langCode}`);
|
|
33
|
+
const data = await this._fetchGet(`/root?langCode=${encodeURIComponent(langCode)}`);
|
|
34
34
|
// Validate response if validation is enabled
|
|
35
35
|
const validated = await this._validateResponse(data, schema('PagesResponseSchema'));
|
|
36
36
|
// Add template information to each page in the fetched root pages data
|
|
37
|
-
const withTemplate = await this.addTemplateToPages(validated);
|
|
37
|
+
const withTemplate = await this.addTemplateToPages(validated, langCode);
|
|
38
38
|
// Normalize the data and return it; ensures consistent structure or handles errors
|
|
39
39
|
return this._normalizeData(withTemplate, langCode);
|
|
40
40
|
}
|
|
@@ -49,11 +49,11 @@ export default class PagesApi extends AsyncModules {
|
|
|
49
49
|
*/
|
|
50
50
|
async getPages(langCode = this.state.lang) {
|
|
51
51
|
// Fetch data from the server using a GET request to retrieve all pages for the specified language code
|
|
52
|
-
const data = await this._fetchGet(`?langCode=${langCode}`);
|
|
52
|
+
const data = await this._fetchGet(`?langCode=${encodeURIComponent(langCode)}`);
|
|
53
53
|
// Validate response if validation is enabled
|
|
54
54
|
const validated = await this._validateResponse(data, schema('PagesResponseSchema'));
|
|
55
55
|
// Add template information to each page in the fetched data
|
|
56
|
-
const withTemplate = await this.addTemplateToPages(validated);
|
|
56
|
+
const withTemplate = await this.addTemplateToPages(validated, langCode);
|
|
57
57
|
// Normalize the data and return it; ensures consistent structure or handles errors
|
|
58
58
|
return this._normalizeData(withTemplate, langCode);
|
|
59
59
|
}
|
|
@@ -69,11 +69,11 @@ export default class PagesApi extends AsyncModules {
|
|
|
69
69
|
*/
|
|
70
70
|
async getPageById(id, langCode = this.state.lang) {
|
|
71
71
|
// Fetch data from the server using a GET request to retrieve page details by ID and language code
|
|
72
|
-
const data = await this._fetchGet(`/${id}?langCode=${langCode}`);
|
|
72
|
+
const data = await this._fetchGet(`/${this._pathSegment(String(id))}?langCode=${encodeURIComponent(langCode)}`);
|
|
73
73
|
// Validate response if validation is enabled
|
|
74
74
|
const validated = await this._validateResponse(data, schema('PageEntitySchema'));
|
|
75
75
|
// Add template information to the fetched page data
|
|
76
|
-
const withTemplate = await this.addTemplateToPage(validated);
|
|
76
|
+
const withTemplate = await this.addTemplateToPage(validated, langCode);
|
|
77
77
|
// Normalize the data and return it; ensures consistent structure or handles errors
|
|
78
78
|
return this._normalizeData(withTemplate, langCode);
|
|
79
79
|
}
|
|
@@ -89,31 +89,31 @@ export default class PagesApi extends AsyncModules {
|
|
|
89
89
|
*/
|
|
90
90
|
async getPageByUrl(url, langCode = this.state.lang) {
|
|
91
91
|
// Fetch data from the server using a GET request with the specified URL and language code
|
|
92
|
-
const data = await this._fetchGet(`/url/${url}?langCode=${langCode}`);
|
|
92
|
+
const data = await this._fetchGet(`/url/${this._pathSegments(url)}?langCode=${encodeURIComponent(langCode)}`);
|
|
93
93
|
// Validate response if validation is enabled
|
|
94
94
|
const validated = await this._validateResponse(data, schema('PageEntitySchema'));
|
|
95
95
|
// Add template information to the fetched page data
|
|
96
|
-
const withTemplate = await this.addTemplateToPage(validated);
|
|
96
|
+
const withTemplate = await this.addTemplateToPage(validated, langCode);
|
|
97
97
|
// Normalize the result data and return it; ensures consistent structure or handles errors
|
|
98
98
|
return this._normalizeData(withTemplate, langCode);
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Get child pages object with information as an array.
|
|
102
102
|
* @handleName getChildPagesByParentUrl
|
|
103
|
-
* @param {string} url - URL of the parent page whose child pages to fetch
|
|
103
|
+
* @param {string} url - URL of the parent page whose child pages to fetch — the page's own `pageUrl`, not a nested path: `blog/blog1` answers `404`. Example: "blog".
|
|
104
104
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
105
|
-
* @returns {Promise<IPagesEntity | IError>} Returns
|
|
105
|
+
* @returns {Promise<IPagesEntity[] | IError>} Returns an array of PageEntity objects for the selected parent, or an empty array [] when it has no child pages. A parent page that does not exist answers `404 Parent page not found` (IError).
|
|
106
106
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
107
107
|
* @description Get child pages object with information as an array.
|
|
108
108
|
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/getChildPagesByParentUrl getChildPagesByParentUrl} documentation.
|
|
109
109
|
*/
|
|
110
110
|
async getChildPagesByParentUrl(url, langCode = this.state.lang) {
|
|
111
111
|
// Fetch data from the server using a GET request to retrieve child pages for the specified parent URL and language code
|
|
112
|
-
const data = await this._fetchGet(`/${url}/children?langCode=${langCode}`);
|
|
112
|
+
const data = await this._fetchGet(`/${this._pathSegments(url)}/children?langCode=${encodeURIComponent(langCode)}`);
|
|
113
113
|
// Validate response if validation is enabled
|
|
114
114
|
const validated = await this._validateResponse(data, schema('PagesResponseSchema'));
|
|
115
115
|
// Add template information to each of the fetched child pages
|
|
116
|
-
const withTemplate = await this.addTemplateToPages(validated);
|
|
116
|
+
const withTemplate = await this.addTemplateToPages(validated, langCode);
|
|
117
117
|
// Normalize the result data and return it; ensures consistent structure or handles errors
|
|
118
118
|
return this._normalizeData(withTemplate, langCode);
|
|
119
119
|
}
|
|
@@ -128,9 +128,9 @@ export default class PagesApi extends AsyncModules {
|
|
|
128
128
|
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/getBlocksByPageUrl getBlocksByPageUrl} documentation.
|
|
129
129
|
*/
|
|
130
130
|
async getBlocksByPageUrl(url, langCode = this.state.lang) {
|
|
131
|
-
const response = await this._fetchGet(`/${url}/blocks?langCode=${langCode}`);
|
|
132
|
-
// Normalize the
|
|
133
|
-
const normalizeResponse = this._normalizeData(response);
|
|
131
|
+
const response = await this._fetchGet(`/${this._pathSegments(url)}/blocks?langCode=${encodeURIComponent(langCode)}`);
|
|
132
|
+
// Normalize by the language of the call, not by the client's one
|
|
133
|
+
const normalizeResponse = this._normalizeData(response, langCode);
|
|
134
134
|
if (!Array.isArray(normalizeResponse)) {
|
|
135
135
|
return normalizeResponse;
|
|
136
136
|
}
|
|
@@ -150,22 +150,27 @@ export default class PagesApi extends AsyncModules {
|
|
|
150
150
|
}
|
|
151
151
|
// Remove internal-only properties from the result.
|
|
152
152
|
delete item.customSettings;
|
|
153
|
-
delete item.attributesSetIdentifier;
|
|
154
153
|
// In traffic-saving mode skip the extra product requests.
|
|
155
154
|
if (this.state.traficLimit)
|
|
156
155
|
return;
|
|
157
156
|
// Attach related products by block type. StaffModule already normalizes its results.
|
|
157
|
+
// A failed sub-request leaves an empty value of the declared type: with isShell the
|
|
158
|
+
// error comes back as a value, and it used to land in `products`/`similarProducts`
|
|
158
159
|
if (item.type === 'similar_products_block') {
|
|
159
160
|
try {
|
|
160
|
-
|
|
161
|
+
const similar = await AsyncModules._subRequestOf(staffModule).getSimilarProducts(item.identifier, langCode);
|
|
162
|
+
item.similarProducts = this._isErrorResponse(similar)
|
|
163
|
+
? { items: [], total: 0 }
|
|
164
|
+
: similar;
|
|
161
165
|
}
|
|
162
166
|
catch {
|
|
163
|
-
item.similarProducts = [];
|
|
167
|
+
item.similarProducts = { items: [], total: 0 };
|
|
164
168
|
}
|
|
165
169
|
}
|
|
166
170
|
else if (item.type === 'product_block') {
|
|
167
171
|
try {
|
|
168
|
-
|
|
172
|
+
const products = await AsyncModules._subRequestOf(staffModule).getProductsByBlockMarker(item.identifier, langCode);
|
|
173
|
+
item.products = this._isErrorResponse(products) ? [] : products;
|
|
169
174
|
}
|
|
170
175
|
catch {
|
|
171
176
|
item.products = [];
|
|
@@ -180,15 +185,17 @@ export default class PagesApi extends AsyncModules {
|
|
|
180
185
|
* @param {string} name - Text to search for in page titles (`localizeInfos.title`) in the requested language. Example: "About Us".
|
|
181
186
|
* @param {string} [url] - Page URL. Example: "catalog".
|
|
182
187
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
188
|
+
* @param {boolean} [correct] - Correct typos by the project's search dictionary first. The API defaults to `true`; pass `false` to search the query as is.
|
|
183
189
|
* @returns {Promise<IPagesEntity[] | IPageSearchResult[] | IError>} Returns found pages as an array of PageEntity objects, an array of short PageSearchResult cards when the traficLimit config option is enabled, or an empty array [] (if there is no data)
|
|
184
190
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
185
191
|
* @description Quick search for page objects with limited output. The quick search endpoint returns short cards ({ id, title }); with traficLimit enabled they are returned as is, otherwise full page entities are fetched for the found ids. The search runs in `langCode`, and a found page that cannot be loaded in that language is left out of the result.
|
|
186
192
|
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/searchPage searchPage} documentation.
|
|
187
193
|
*/
|
|
188
|
-
async searchPage(name, url, langCode = this.state.lang) {
|
|
194
|
+
async searchPage(name, url, langCode = this.state.lang, correct) {
|
|
189
195
|
// Fetch data from the server using a GET request to perform a quick search by page name and language code
|
|
190
196
|
const urlPart = url ? `url=${encodeURIComponent(url)}&` : '';
|
|
191
|
-
const
|
|
197
|
+
const correctPart = correct !== undefined ? `&correct=${correct}` : '';
|
|
198
|
+
const searchPages = await this._fetchGet(`/quick/search?${urlPart}langCode=${encodeURIComponent(langCode)}&name=${encodeURIComponent(name)}${correctPart}`);
|
|
192
199
|
// Validate response if validation is enabled
|
|
193
200
|
const data = (await this._validateResponse(searchPages, schema('PageSearchResponseSchema')));
|
|
194
201
|
// Check if there is no traffic limit set in the state
|
|
@@ -200,7 +207,7 @@ export default class PagesApi extends AsyncModules {
|
|
|
200
207
|
// and broke `page.localizeInfos.title` on the caller's side (CMS-1068)
|
|
201
208
|
const pageList = fetched.filter((page) => !this._isErrorResponse(page));
|
|
202
209
|
// Add templates to the fetched pages
|
|
203
|
-
const withTemplate = await this.addTemplateToPages(pageList);
|
|
210
|
+
const withTemplate = await this.addTemplateToPages(pageList, langCode);
|
|
204
211
|
// Normalize the data and return it; ensures consistent structure or handles errors
|
|
205
212
|
return this._normalizeData(withTemplate, langCode);
|
|
206
213
|
}
|
|
@@ -233,6 +240,7 @@ export default class PagesApi extends AsyncModules {
|
|
|
233
240
|
* Add template data to pages
|
|
234
241
|
* @handleName addTemplateToPages
|
|
235
242
|
* @param {IPagesEntity[]} data - An array of page objects (IPagesEntity[]) to which template data will be added.
|
|
243
|
+
* @param {string} [langCode] - Language the templates are fetched and unwrapped in. Default: the client's language.
|
|
236
244
|
* @example
|
|
237
245
|
[
|
|
238
246
|
{
|
|
@@ -273,7 +281,7 @@ export default class PagesApi extends AsyncModules {
|
|
|
273
281
|
* @description Add template data to pages. Optimized to avoid N+1 query problem by fetching only unique templates in parallel.
|
|
274
282
|
* For example, if 100 pages use 3 different templates, this method makes 3 requests instead of 100.
|
|
275
283
|
*/
|
|
276
|
-
async addTemplateToPages(data) {
|
|
284
|
+
async addTemplateToPages(data, langCode = this.state.lang) {
|
|
277
285
|
// On API error responses (e.g. 403 without list permission, 422) the value
|
|
278
286
|
// is an IError, not an array — return it as-is instead of calling array
|
|
279
287
|
// methods (.filter/.map) on it and throwing a TypeError.
|
|
@@ -294,7 +302,9 @@ export default class PagesApi extends AsyncModules {
|
|
|
294
302
|
}
|
|
295
303
|
// Step 3: Fetch unique templates in parallel (not N queries, but unique count queries)
|
|
296
304
|
const Templates = new templatesApi(this.state);
|
|
297
|
-
const templatePromises = uniqueIdentifiers.map((identifier) =>
|
|
305
|
+
const templatePromises = uniqueIdentifiers.map((identifier) => AsyncModules._subRequestOf(Templates)
|
|
306
|
+
.getTemplateByMarker(identifier, langCode)
|
|
307
|
+
.catch((error) => {
|
|
298
308
|
// eslint-disable-next-line no-undef, no-console
|
|
299
309
|
console.error(`Template fetch error for ${identifier}: `, error);
|
|
300
310
|
return null; // Return null for failed templates
|
|
@@ -303,7 +313,8 @@ export default class PagesApi extends AsyncModules {
|
|
|
303
313
|
// Step 4: Create a Map for O(1) template lookup
|
|
304
314
|
const templateMap = new Map();
|
|
305
315
|
templates.forEach((template, index) => {
|
|
306
|
-
|
|
316
|
+
// An error comes back as a value with isShell: it is not a template
|
|
317
|
+
if (template !== null && !this._isErrorResponse(template)) {
|
|
307
318
|
templateMap.set(uniqueIdentifiers[index], template);
|
|
308
319
|
}
|
|
309
320
|
});
|
|
@@ -328,12 +339,12 @@ export default class PagesApi extends AsyncModules {
|
|
|
328
339
|
* Add template data to page by page templateIdentifier
|
|
329
340
|
* @handleName addTemplateToPage
|
|
330
341
|
* @param {IPagesEntity} data - Page object (IPagesEntity) to which template data will be added.
|
|
342
|
+
* @param {string} [langCode] - Language the templates are fetched and unwrapped in. Default: the client's language.
|
|
331
343
|
* @returns {Promise<any | IError>} An array of page objects with template data added
|
|
332
344
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
333
345
|
* @description Add template data to page by page templateIdentifier
|
|
334
|
-
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/addTemplateToPage addTemplateToPage} documentation.
|
|
335
346
|
*/
|
|
336
|
-
async addTemplateToPage(data) {
|
|
347
|
+
async addTemplateToPage(data, langCode = this.state.lang) {
|
|
337
348
|
// Check if 'templateIdentifier' exists in 'data' and is not null or an empty string
|
|
338
349
|
if ('templateIdentifier' in data &&
|
|
339
350
|
data.templateIdentifier !== null &&
|
|
@@ -344,7 +355,11 @@ export default class PagesApi extends AsyncModules {
|
|
|
344
355
|
// Create a new instance of templatesApi with the current state
|
|
345
356
|
const Templates = new templatesApi(this.state);
|
|
346
357
|
// Fetch the template using the 'templateIdentifier'
|
|
347
|
-
const result = await Templates.getTemplateByMarker(templateIdentifier);
|
|
358
|
+
const result = await AsyncModules._subRequestOf(Templates).getTemplateByMarker(templateIdentifier, langCode);
|
|
359
|
+
// An error comes back as a value with isShell: leave the page without a template
|
|
360
|
+
if (this._isErrorResponse(result)) {
|
|
361
|
+
return data;
|
|
362
|
+
}
|
|
348
363
|
// Return the original data object with the fetched template added
|
|
349
364
|
return {
|
|
350
365
|
...data,
|
|
@@ -376,18 +391,18 @@ class StaffModule extends AsyncModules {
|
|
|
376
391
|
// ({ total, items }) to match BlocksApi's similarProducts contract.
|
|
377
392
|
async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
378
393
|
// Fetch similar products from the server
|
|
379
|
-
const result = await this._fetchGet(`/${this._pathSegment(marker)}/similar-products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
380
|
-
return this._normalizeData(result);
|
|
394
|
+
const result = await this._fetchGet(`/${this._pathSegment(marker)}/similar-products?langCode=${encodeURIComponent(langCode)}&offset=${encodeURIComponent(String(offset))}&limit=${encodeURIComponent(String(limit))}`);
|
|
395
|
+
return this._normalizeData(result, langCode);
|
|
381
396
|
}
|
|
382
397
|
// Method to fetch products by block marker
|
|
383
398
|
async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
384
399
|
// Fetch products from the server
|
|
385
|
-
const result = await this._fetchGet(`/${this._pathSegment(marker)}/products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
400
|
+
const result = await this._fetchGet(`/${this._pathSegment(marker)}/products?langCode=${encodeURIComponent(langCode)}&offset=${encodeURIComponent(String(offset))}&limit=${encodeURIComponent(String(limit))}`);
|
|
386
401
|
// On API error responses there is no `items` array — return the (normalized)
|
|
387
402
|
// error as-is instead of producing `undefined` from `result.items`.
|
|
388
403
|
if (!Array.isArray(result === null || result === void 0 ? void 0 : result.items)) {
|
|
389
|
-
return this._normalizeData(result);
|
|
404
|
+
return this._normalizeData(result, langCode);
|
|
390
405
|
}
|
|
391
|
-
return this._normalizeData(result.items);
|
|
406
|
+
return this._normalizeData(result.items, langCode);
|
|
392
407
|
}
|
|
393
408
|
}
|
|
@@ -49,9 +49,9 @@ interface IPagesApi {
|
|
|
49
49
|
/**
|
|
50
50
|
* Get child pages object with information as an array.
|
|
51
51
|
* @handleName getChildPagesByParentUrl
|
|
52
|
-
* @param {string} url - URL of the parent page whose child pages to fetch
|
|
52
|
+
* @param {string} url - URL of the parent page whose child pages to fetch — the page's own `pageUrl`, not a nested path: `blog/blog1` answers `404`. Example: "blog".
|
|
53
53
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
54
|
-
* @returns {IPagesEntity} Returns
|
|
54
|
+
* @returns {IPagesEntity[]} Returns an array of PageEntity objects for the selected parent, or an empty array [] when it has no child pages. A parent page that does not exist answers `404 Parent page not found` (IError).
|
|
55
55
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
56
56
|
* @description This method gets child pages object with information as an array.
|
|
57
57
|
*/
|
|
@@ -72,11 +72,12 @@ interface IPagesApi {
|
|
|
72
72
|
* @param {string} name - Text to search for in page titles (`localizeInfos.title`) in the requested language. Example: "About Us".
|
|
73
73
|
* @param {string} [url] - Optional page URL to filter search results. Example: "catalog".
|
|
74
74
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
75
|
+
* @param {boolean} [correct] - Correct typos by the project's search dictionary first. The API defaults to `true`; pass `false` to search the query as is.
|
|
75
76
|
* @returns {IPagesEntity[] | IPageSearchResult[]} Returns found pages as an array of PageEntity objects, an array of short PageSearchResult cards when the traficLimit config option is enabled, or an empty array [] (if there is no data)
|
|
76
77
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
77
78
|
* @description This method performs a quick search for page objects with limited output. With traficLimit enabled the raw quick search response is returned as short cards; otherwise full page entities are fetched for the found ids.
|
|
78
79
|
*/
|
|
79
|
-
searchPage(name: string, url?: string, langCode?: LangType): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
|
|
80
|
+
searchPage(name: string, url?: string, langCode?: LangType, correct?: boolean): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
|
|
80
81
|
/**
|
|
81
82
|
* Semantic (vector) search for pages.
|
|
82
83
|
* @handleName getPagesByVectorSearch
|
|
@@ -121,7 +122,7 @@ interface IPagesResponse {
|
|
|
121
122
|
* @property {number} version - Version number of the object; changes with each update. Example: 10.
|
|
122
123
|
* @property {string} identifier - Text identifier (marker) of the object. Example: "catalog".
|
|
123
124
|
* @property {number} attributeSetId - ID of the attribute set in use. Example: 0.
|
|
124
|
-
* @property {string} processingType - How form submissions are processed
|
|
125
|
+
* @property {string} processingType - How form submissions are processed: the processing type chosen in the form settings. Example: "script".
|
|
125
126
|
* @property {ILocalizeInfo} localizeInfos - Localized name and content of the page.
|
|
126
127
|
* @example
|
|
127
128
|
{
|
|
@@ -142,22 +143,27 @@ interface IPagesResponse {
|
|
|
142
143
|
"listTitles": [
|
|
143
144
|
{
|
|
144
145
|
"title": "red",
|
|
145
|
-
"value": 1,
|
|
146
|
-
"
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
"value": "1",
|
|
147
|
+
"extended": {
|
|
148
|
+
"type": null,
|
|
149
|
+
"value": null
|
|
150
|
+
},
|
|
151
|
+
"position": 1
|
|
149
152
|
},
|
|
150
153
|
{
|
|
151
154
|
"title": "yellow",
|
|
152
|
-
"value": 2,
|
|
153
|
-
"
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
"value": "2",
|
|
156
|
+
"extended": {
|
|
157
|
+
"type": null,
|
|
158
|
+
"value": null
|
|
159
|
+
},
|
|
160
|
+
"position": 2
|
|
156
161
|
}
|
|
157
162
|
],
|
|
158
163
|
"validators": {},
|
|
159
164
|
"localizeInfos": {
|
|
160
|
-
|
|
165
|
+
"title": "l1"
|
|
166
|
+
}
|
|
161
167
|
}
|
|
162
168
|
]
|
|
163
169
|
* @description This interface defines the structure of a position form entity, including its identifiers, attributes, and processing data.
|
|
@@ -188,7 +194,7 @@ interface IPositionForm {
|
|
|
188
194
|
* @property {number} version - Version number of the object; changes with each update. Example: 0.
|
|
189
195
|
* @property {number} position - Position of the object, used for sorting. Example: 1.
|
|
190
196
|
* @property {string} identifier - Text identifier (marker) of the object. Example: "product_block".
|
|
191
|
-
* @property {BlockType} type - Block type. Example: "
|
|
197
|
+
* @property {BlockType} type - Block type. Example: "product_block".
|
|
192
198
|
* @property {string | null} templateIdentifier - Marker of the linked template, or `null` when none is linked. Example: null.
|
|
193
199
|
* @property {boolean} isVisible - Whether the page is visible. Example: true.
|
|
194
200
|
* @property {boolean} isSync - Whether the page is indexed. Example: false.
|
|
@@ -285,7 +291,6 @@ type PageType = 'catalog_page' | 'common_page' | 'error_page' | 'external_page';
|
|
|
285
291
|
}
|
|
286
292
|
* @property {Array<IFormConfig>} [moduleFormConfigs] - Form configurations of the module linked to the page.
|
|
287
293
|
* @property {IRating} [rating] - Rating data: average value, likes and dislikes, and the calculation method.
|
|
288
|
-
* @property {string} [total] - Total number of products linked to the page. Example: "10".
|
|
289
294
|
* @property {string | null} [categoryPath] - Category path; `null` for nested pages that have no category path of their own. Example: "catalog".
|
|
290
295
|
* @property {number} [distance] - Cosine distance to the query. Returned only by the semantic (vector) search endpoint when `debug: true` is passed in the search body. Example: 0.12.
|
|
291
296
|
* @description This interface defines the structure of a page entity, including its identifiers, attributes, and hierarchical relationships.
|
|
@@ -310,7 +315,6 @@ interface IPagesEntity {
|
|
|
310
315
|
config?: Record<string, number>;
|
|
311
316
|
products?: number;
|
|
312
317
|
childrenCount?: number;
|
|
313
|
-
total?: string;
|
|
314
318
|
categoryPath?: string | null;
|
|
315
319
|
distance?: number;
|
|
316
320
|
}
|
|
@@ -32,7 +32,6 @@ export declare const PageEntitySchema: z.ZodObject<{
|
|
|
32
32
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
33
33
|
products: z.ZodOptional<z.ZodNumber>;
|
|
34
34
|
childrenCount: z.ZodOptional<z.ZodNumber>;
|
|
35
|
-
total: z.ZodOptional<z.ZodString>;
|
|
36
35
|
categoryPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
36
|
distance: z.ZodOptional<z.ZodNumber>;
|
|
38
37
|
}, z.core.$strip>;
|
|
@@ -64,7 +63,6 @@ export declare const PagesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
64
63
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
65
64
|
products: z.ZodOptional<z.ZodNumber>;
|
|
66
65
|
childrenCount: z.ZodOptional<z.ZodNumber>;
|
|
67
|
-
total: z.ZodOptional<z.ZodString>;
|
|
68
66
|
categoryPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
67
|
distance: z.ZodOptional<z.ZodNumber>;
|
|
70
68
|
}, z.core.$strip>>;
|
|
@@ -111,7 +109,6 @@ export declare const SinglePageSchema: z.ZodObject<{
|
|
|
111
109
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
112
110
|
products: z.ZodOptional<z.ZodNumber>;
|
|
113
111
|
childrenCount: z.ZodOptional<z.ZodNumber>;
|
|
114
|
-
total: z.ZodOptional<z.ZodString>;
|
|
115
112
|
categoryPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
116
113
|
distance: z.ZodOptional<z.ZodNumber>;
|
|
117
114
|
}, z.core.$strip>;
|
|
@@ -29,7 +29,6 @@ export const PageEntitySchema = z.object({
|
|
|
29
29
|
config: z.record(z.string(), z.number()).optional(),
|
|
30
30
|
products: z.number().optional(),
|
|
31
31
|
childrenCount: z.number().optional(),
|
|
32
|
-
total: z.string().optional(),
|
|
33
32
|
categoryPath: z.string().nullable().optional(),
|
|
34
33
|
distance: z.number().optional(),
|
|
35
34
|
});
|
|
@@ -43,13 +43,13 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
|
|
|
43
43
|
* Get one payment session object by order identifier
|
|
44
44
|
* @handleName getSessionByOrderId
|
|
45
45
|
* @param {number} id - Order ID. Example: 12345.
|
|
46
|
-
* @returns {Promise<
|
|
46
|
+
* @returns {Promise<ISessionEntity[] | IError>} Returns the payment sessions of the order — an **array**, `[]` (with `200`) for an order without sessions, an order that does not exist or an order of another user.
|
|
47
47
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
48
|
-
* @description This method gets
|
|
48
|
+
* @description This method gets the payment sessions of an order by its identifier. The answer is an array even for one session. This method requires user authorization.
|
|
49
49
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
50
50
|
* @see {@link https://js-sdk.oneentry.cloud/docs/payments/getSessionByOrderId getSessionByOrderId} documentation.
|
|
51
51
|
*/
|
|
52
|
-
getSessionByOrderId(id: number): Promise<ISessionEntity
|
|
52
|
+
getSessionByOrderId(id: number): Promise<ISessionEntity[] | IError>;
|
|
53
53
|
/**
|
|
54
54
|
* Creation of payment session.
|
|
55
55
|
* @handleName createSession
|
|
@@ -66,25 +66,24 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
|
|
|
66
66
|
/**
|
|
67
67
|
* Get all payment accounts as an array.
|
|
68
68
|
* @handleName getAccounts
|
|
69
|
-
* @
|
|
69
|
+
* @param {string} [langCode] - Language code. Default: the client's language.
|
|
70
|
+
* @returns {Promise<IAccountsEntity[] | IError>} Returns all created payment accounts as an array of PaymentAccountEntity objects.
|
|
70
71
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
71
|
-
* @description This method gets all payment accounts as an array.
|
|
72
|
-
* @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}.
|
|
72
|
+
* @description This method gets all payment accounts as an array. It does not require user authorization: a guest gets the accounts too.
|
|
73
73
|
* @see {@link https://js-sdk.oneentry.cloud/docs/payments/getAccounts getAccounts} documentation.
|
|
74
74
|
*/
|
|
75
|
-
getAccounts(): Promise<IAccountsEntity[] | IError>;
|
|
75
|
+
getAccounts(langCode?: string): Promise<IAccountsEntity[] | IError>;
|
|
76
76
|
/**
|
|
77
77
|
* Get a single payment account object by its identifier.
|
|
78
78
|
* @handleName getAccountById
|
|
79
79
|
* @param {number} id - Payment account ID. Example: 12345.
|
|
80
|
+
* @param {string} [langCode] - Language code. Default: the client's language.
|
|
80
81
|
* @returns {Promise<IAccountsEntity | IError>} Returns a single payment account object.
|
|
81
82
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
82
|
-
* @description Get a single payment account object by its identifier.
|
|
83
|
-
* @description This method requires user authorization.
|
|
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}.
|
|
83
|
+
* @description Get a single payment account object by its identifier. It does not require user authorization: a guest gets the account too.
|
|
85
84
|
* @see {@link https://js-sdk.oneentry.cloud/docs/payments/getAccountById getAccountById} documentation.
|
|
86
85
|
*/
|
|
87
|
-
getAccountById(id: number): Promise<IAccountsEntity | IError>;
|
|
86
|
+
getAccountById(id: number, langCode?: string): Promise<IAccountsEntity | IError>;
|
|
88
87
|
/**
|
|
89
88
|
* Get the payment progress of an order: its stages and whether they are paid.
|
|
90
89
|
* @handleName getPaymentStagesByOrderId
|