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
|
@@ -48,21 +48,23 @@ export default class PaymentsApi extends AsyncModules {
|
|
|
48
48
|
* @see {@link https://js-sdk.oneentry.cloud/docs/payments/getSessionById getSessionById} documentation.
|
|
49
49
|
*/
|
|
50
50
|
async getSessionById(id) {
|
|
51
|
-
const result = await this._fetchGet(`/sessions/${id}`);
|
|
52
|
-
|
|
51
|
+
const result = await this._fetchGet(`/sessions/${this._pathSegment(String(id))}`);
|
|
52
|
+
// Validate response if validation is enabled
|
|
53
|
+
const validated = await this._validateResponse(result, schema('PaymentSessionSchema'));
|
|
54
|
+
return validated;
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Get one payment session object by order identifier
|
|
56
58
|
* @handleName getSessionByOrderId
|
|
57
59
|
* @param {number} id - Order ID. Example: 12345.
|
|
58
|
-
* @returns {Promise<
|
|
60
|
+
* @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.
|
|
59
61
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
60
|
-
* @description This method gets
|
|
62
|
+
* @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.
|
|
61
63
|
* @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}.
|
|
62
64
|
* @see {@link https://js-sdk.oneentry.cloud/docs/payments/getSessionByOrderId getSessionByOrderId} documentation.
|
|
63
65
|
*/
|
|
64
66
|
async getSessionByOrderId(id) {
|
|
65
|
-
const result = await this._fetchGet(`/sessions/order/${id}`);
|
|
67
|
+
const result = await this._fetchGet(`/sessions/order/${this._pathSegment(String(id))}`);
|
|
66
68
|
// Validate response if validation is enabled
|
|
67
69
|
const validated = await this._validateResponse(result, schema('SinglePaymentSessionSchema'));
|
|
68
70
|
return validated;
|
|
@@ -92,32 +94,34 @@ export default class PaymentsApi extends AsyncModules {
|
|
|
92
94
|
/**
|
|
93
95
|
* Get all payment accounts as an array.
|
|
94
96
|
* @handleName getAccounts
|
|
95
|
-
* @
|
|
97
|
+
* @param {string} [langCode] - Language code. Default: the client's language.
|
|
98
|
+
* @returns {Promise<IAccountsEntity[] | IError>} Returns all created payment accounts as an array of PaymentAccountEntity objects.
|
|
96
99
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
97
|
-
* @description This method gets all payment accounts as an array.
|
|
98
|
-
* @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}.
|
|
100
|
+
* @description This method gets all payment accounts as an array. It does not require user authorization: a guest gets the accounts too.
|
|
99
101
|
* @see {@link https://js-sdk.oneentry.cloud/docs/payments/getAccounts getAccounts} documentation.
|
|
100
102
|
*/
|
|
101
|
-
async getAccounts() {
|
|
102
|
-
const result = await this._fetchGet('/accounts');
|
|
103
|
+
async getAccounts(langCode = this.state.lang) {
|
|
104
|
+
const result = await this._fetchGet('/accounts?' + this._queryParamsToString({ langCode }));
|
|
103
105
|
// Validate response if validation is enabled
|
|
104
106
|
const validated = await this._validateResponse(result, schema('PaymentAccountsResponseSchema'));
|
|
105
|
-
return this._normalizeData(validated);
|
|
107
|
+
return this._normalizeData(validated, langCode);
|
|
106
108
|
}
|
|
107
109
|
/**
|
|
108
110
|
* Get a single payment account object by its identifier.
|
|
109
111
|
* @handleName getAccountById
|
|
110
112
|
* @param {number} id - Payment account ID. Example: 12345.
|
|
113
|
+
* @param {string} [langCode] - Language code. Default: the client's language.
|
|
111
114
|
* @returns {Promise<IAccountsEntity | IError>} Returns a single payment account object.
|
|
112
115
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
113
|
-
* @description Get a single payment account object by its identifier.
|
|
114
|
-
* @description This method requires user authorization.
|
|
115
|
-
* @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}.
|
|
116
|
+
* @description Get a single payment account object by its identifier. It does not require user authorization: a guest gets the account too.
|
|
116
117
|
* @see {@link https://js-sdk.oneentry.cloud/docs/payments/getAccountById getAccountById} documentation.
|
|
117
118
|
*/
|
|
118
|
-
async getAccountById(id) {
|
|
119
|
-
const result = await this._fetchGet(`/accounts/${id}
|
|
120
|
-
|
|
119
|
+
async getAccountById(id, langCode = this.state.lang) {
|
|
120
|
+
const result = await this._fetchGet(`/accounts/${this._pathSegment(String(id))}?` +
|
|
121
|
+
this._queryParamsToString({ langCode }));
|
|
122
|
+
// Validate response if validation is enabled
|
|
123
|
+
const validated = await this._validateResponse(result, schema('PaymentAccountSchema'));
|
|
124
|
+
return this._normalizeData(validated, langCode);
|
|
121
125
|
}
|
|
122
126
|
/**
|
|
123
127
|
* Get the payment progress of an order: its stages and whether they are paid.
|
|
@@ -132,7 +136,7 @@ export default class PaymentsApi extends AsyncModules {
|
|
|
132
136
|
* @see {@link https://js-sdk.oneentry.cloud/docs/payments/getPaymentStagesByOrderId getPaymentStagesByOrderId} documentation.
|
|
133
137
|
*/
|
|
134
138
|
async getPaymentStagesByOrderId(id) {
|
|
135
|
-
const result = await this._fetchGet(`/stages/order/${id}`);
|
|
139
|
+
const result = await this._fetchGet(`/stages/order/${this._pathSegment(String(id))}`);
|
|
136
140
|
// Validate response if validation is enabled
|
|
137
141
|
const validated = await this._validateResponse(result, schema('PaymentProgressSchema'));
|
|
138
142
|
return this._normalizeData(validated);
|
|
@@ -29,12 +29,12 @@ interface IPaymentsApi {
|
|
|
29
29
|
* Get one payment session object by order identifier 🔐
|
|
30
30
|
* @handleName getSessionByOrderId
|
|
31
31
|
* @param {number} id - Order ID. Example: 12345.
|
|
32
|
-
* @returns {ISessionEntity}
|
|
32
|
+
* @returns {ISessionEntity[]} The payment sessions of the order — an **array**, `[]` (with `200`) for an order without sessions or one that does not exist.
|
|
33
33
|
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
34
|
-
* @description This method gets
|
|
34
|
+
* @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.
|
|
35
35
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
36
36
|
*/
|
|
37
|
-
getSessionByOrderId(id: number): Promise<ISessionEntity
|
|
37
|
+
getSessionByOrderId(id: number): Promise<ISessionEntity[] | IError>;
|
|
38
38
|
/**
|
|
39
39
|
* Creation of payment session.
|
|
40
40
|
* @handleName createSession
|
|
@@ -50,22 +50,22 @@ interface IPaymentsApi {
|
|
|
50
50
|
/**
|
|
51
51
|
* Get all payment accounts as an array.
|
|
52
52
|
* @handleName getAccounts
|
|
53
|
-
* @
|
|
53
|
+
* @param {string} [langCode] - Language code. Default: the client's language.
|
|
54
|
+
* @returns {IAccountsEntity[]} Returns all created payment accounts as an array of PaymentAccountEntity objects.
|
|
54
55
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
55
|
-
* @description This method gets all payment accounts as an array.
|
|
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}.
|
|
56
|
+
* @description This method gets all payment accounts as an array. It does not require user authorization: a guest gets the accounts too.
|
|
57
57
|
*/
|
|
58
|
-
getAccounts(): Promise<IAccountsEntity[] | IError>;
|
|
58
|
+
getAccounts(langCode?: string): Promise<IAccountsEntity[] | IError>;
|
|
59
59
|
/**
|
|
60
60
|
* Get a single payment account object by its identifier.
|
|
61
61
|
* @handleName getAccountById
|
|
62
62
|
* @param {number} id - Payment account ID. Example: 12345.
|
|
63
|
+
* @param {string} [langCode] - Language code. Default: the client's language.
|
|
63
64
|
* @returns {IAccountsEntity} Returns a single payment account object.
|
|
64
65
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
65
|
-
* @description This method gets a single payment account object by its identifier.
|
|
66
|
-
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
66
|
+
* @description This method gets a single payment account object by its identifier. It does not require user authorization: a guest gets the account too.
|
|
67
67
|
*/
|
|
68
|
-
getAccountById(id: number): Promise<IAccountsEntity | IError>;
|
|
68
|
+
getAccountById(id: number, langCode?: string): Promise<IAccountsEntity | IError>;
|
|
69
69
|
/**
|
|
70
70
|
* Get the payment progress of an order: its stages and whether they are paid.
|
|
71
71
|
* @handleName getPaymentStagesByOrderId
|
|
@@ -108,7 +108,7 @@ interface ISessionsEntity {
|
|
|
108
108
|
* @property {'session' | 'intent'} type - Session type: "session" or "intent". Example: "session".
|
|
109
109
|
* @property {string} status - Payment status. Example: "completed".
|
|
110
110
|
* @property {number} paymentAccountId - ID of the payment account. Example: 1.
|
|
111
|
-
* @property {number} orderId - ID of the order. Example: 1.
|
|
111
|
+
* @property {number | null} orderId - ID of the order; `null` for the session of a subscription, which has no order. Example: 1.
|
|
112
112
|
* @property {string | null} paymentUrl - Payment page URL. Example: " https://www.sandbox.paypal.com/checkoutnow?token=9BE88048TU058770M".
|
|
113
113
|
* @property {number | null} [amount] - Payment session amount. Example: 100.
|
|
114
114
|
* @property {string} [clientSecret] - Client secret returned by the payment provider (for example, Stripe) when the session is created. Example: "pi_3MtwBwLkdIwHu7ix28a3tqPa_secret_YrKJUKribcBjcG8HVhfZluoGH".
|
|
@@ -121,7 +121,7 @@ interface ISessionEntity {
|
|
|
121
121
|
type: 'session' | 'intent';
|
|
122
122
|
status: string;
|
|
123
123
|
paymentAccountId: number;
|
|
124
|
-
orderId: number;
|
|
124
|
+
orderId: number | null;
|
|
125
125
|
paymentUrl: string | null;
|
|
126
126
|
amount?: number | null;
|
|
127
127
|
clientSecret?: string;
|
|
@@ -180,7 +180,6 @@ interface IPaymentAccountSettings {
|
|
|
180
180
|
* @property {string} [stripeRedirectUrl] - Stripe onboarding redirect URL.
|
|
181
181
|
* @property {boolean} [stripeOnboardingComplete] - Whether Stripe onboarding finished. Example: true.
|
|
182
182
|
* @property {string} [stripePublishableKey] - Stripe publishable key.
|
|
183
|
-
* @property {string} [signingSecretKey] - Stripe webhook signing secret. Example: "whsec_...".
|
|
184
183
|
* @property {boolean} [useWebHookValidation] - Whether incoming webhooks must be signature-validated. Example: true.
|
|
185
184
|
* @description Test-mode configuration of a payment account; field set depends on the provider (Stripe-specific fields are optional).
|
|
186
185
|
*/
|
|
@@ -193,7 +192,6 @@ interface IPaymentAccountTestSettings {
|
|
|
193
192
|
stripeRedirectUrl?: string;
|
|
194
193
|
stripeOnboardingComplete?: boolean;
|
|
195
194
|
stripePublishableKey?: string;
|
|
196
|
-
signingSecretKey?: string;
|
|
197
195
|
useWebHookValidation?: boolean;
|
|
198
196
|
}
|
|
199
197
|
/**
|
|
@@ -5,7 +5,7 @@ import { z } from 'zod';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const PaymentSessionSchema: z.ZodObject<{
|
|
7
7
|
id: z.ZodNumber;
|
|
8
|
-
orderId: z.ZodNumber
|
|
8
|
+
orderId: z.ZodNullable<z.ZodNumber>;
|
|
9
9
|
amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
10
10
|
status: z.ZodString;
|
|
11
11
|
createdDate: z.ZodString;
|
|
@@ -22,7 +22,7 @@ export declare const PaymentSessionSchema: z.ZodObject<{
|
|
|
22
22
|
export declare const PaymentSessionsResponseSchema: z.ZodObject<{
|
|
23
23
|
items: z.ZodArray<z.ZodObject<{
|
|
24
24
|
id: z.ZodNumber;
|
|
25
|
-
orderId: z.ZodNumber
|
|
25
|
+
orderId: z.ZodNullable<z.ZodNumber>;
|
|
26
26
|
amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
27
27
|
status: z.ZodString;
|
|
28
28
|
createdDate: z.ZodString;
|
|
@@ -35,12 +35,12 @@ export declare const PaymentSessionsResponseSchema: z.ZodObject<{
|
|
|
35
35
|
total: z.ZodNumber;
|
|
36
36
|
}, z.core.$strip>;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @description
|
|
38
|
+
* Sessions of one order
|
|
39
|
+
* @description The answer of `/sessions/order/{id}` is always an array (`[]` when there are none)
|
|
40
40
|
*/
|
|
41
|
-
export declare const SinglePaymentSessionSchema: z.
|
|
41
|
+
export declare const SinglePaymentSessionSchema: z.ZodArray<z.ZodObject<{
|
|
42
42
|
id: z.ZodNumber;
|
|
43
|
-
orderId: z.ZodNumber
|
|
43
|
+
orderId: z.ZodNullable<z.ZodNumber>;
|
|
44
44
|
amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
45
45
|
status: z.ZodString;
|
|
46
46
|
createdDate: z.ZodString;
|
|
@@ -49,18 +49,7 @@ export declare const SinglePaymentSessionSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
49
49
|
paymentAccountId: z.ZodNumber;
|
|
50
50
|
paymentUrl: z.ZodNullable<z.ZodString>;
|
|
51
51
|
clientSecret: z.ZodOptional<z.ZodString>;
|
|
52
|
-
}, z.core.$strip
|
|
53
|
-
id: z.ZodNumber;
|
|
54
|
-
orderId: z.ZodNumber;
|
|
55
|
-
amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
56
|
-
status: z.ZodString;
|
|
57
|
-
createdDate: z.ZodString;
|
|
58
|
-
updatedDate: z.ZodString;
|
|
59
|
-
type: z.ZodString;
|
|
60
|
-
paymentAccountId: z.ZodNumber;
|
|
61
|
-
paymentUrl: z.ZodNullable<z.ZodString>;
|
|
62
|
-
clientSecret: z.ZodOptional<z.ZodString>;
|
|
63
|
-
}, z.core.$strip>>]>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
64
53
|
/**
|
|
65
54
|
* Payment account schema
|
|
66
55
|
* @description Schema for a payment account
|
|
@@ -71,7 +60,13 @@ export declare const PaymentAccountSchema: z.ZodObject<{
|
|
|
71
60
|
isVisible: z.ZodBoolean;
|
|
72
61
|
isUsed: z.ZodBoolean;
|
|
73
62
|
testMode: z.ZodBoolean;
|
|
74
|
-
type: z.
|
|
63
|
+
type: z.ZodEnum<{
|
|
64
|
+
custom: "custom";
|
|
65
|
+
stripe: "stripe";
|
|
66
|
+
yookassa: "yookassa";
|
|
67
|
+
midtrans: "midtrans";
|
|
68
|
+
xendit: "xendit";
|
|
69
|
+
}>;
|
|
75
70
|
settings: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
76
71
|
testSettings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
77
72
|
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
@@ -86,7 +81,13 @@ export declare const PaymentAccountsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
86
81
|
isVisible: z.ZodBoolean;
|
|
87
82
|
isUsed: z.ZodBoolean;
|
|
88
83
|
testMode: z.ZodBoolean;
|
|
89
|
-
type: z.
|
|
84
|
+
type: z.ZodEnum<{
|
|
85
|
+
custom: "custom";
|
|
86
|
+
stripe: "stripe";
|
|
87
|
+
yookassa: "yookassa";
|
|
88
|
+
midtrans: "midtrans";
|
|
89
|
+
xendit: "xendit";
|
|
90
|
+
}>;
|
|
90
91
|
settings: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
91
92
|
testSettings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
92
93
|
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
@@ -5,7 +5,7 @@ import { z } from 'zod';
|
|
|
5
5
|
*/
|
|
6
6
|
export const PaymentSessionSchema = z.object({
|
|
7
7
|
id: z.number(),
|
|
8
|
-
orderId: z.number(),
|
|
8
|
+
orderId: z.number().nullable(),
|
|
9
9
|
amount: z.number().nullable().optional(),
|
|
10
10
|
status: z.string(),
|
|
11
11
|
createdDate: z.string(),
|
|
@@ -24,13 +24,10 @@ export const PaymentSessionsResponseSchema = z.object({
|
|
|
24
24
|
total: z.number(),
|
|
25
25
|
});
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @description
|
|
27
|
+
* Sessions of one order
|
|
28
|
+
* @description The answer of `/sessions/order/{id}` is always an array (`[]` when there are none)
|
|
29
29
|
*/
|
|
30
|
-
export const SinglePaymentSessionSchema = z.
|
|
31
|
-
PaymentSessionSchema,
|
|
32
|
-
z.array(PaymentSessionSchema),
|
|
33
|
-
]);
|
|
30
|
+
export const SinglePaymentSessionSchema = z.array(PaymentSessionSchema);
|
|
34
31
|
/**
|
|
35
32
|
* Payment account schema
|
|
36
33
|
* @description Schema for a payment account
|
|
@@ -41,7 +38,7 @@ export const PaymentAccountSchema = z.object({
|
|
|
41
38
|
isVisible: z.boolean(),
|
|
42
39
|
isUsed: z.boolean(),
|
|
43
40
|
testMode: z.boolean(),
|
|
44
|
-
type: z.
|
|
41
|
+
type: z.enum(['stripe', 'yookassa', 'midtrans', 'xendit', 'custom']),
|
|
45
42
|
settings: z.record(z.string(), z.any()),
|
|
46
43
|
testSettings: z.record(z.string(), z.any()).optional(),
|
|
47
44
|
localizeInfos: z.record(z.string(), z.any()),
|
|
@@ -33,7 +33,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
|
|
|
33
33
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
34
34
|
* @returns {Promise<IProductStatusEntity | IError>} Returns a product status object.
|
|
35
35
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
36
|
-
* @description Search for a product status object by its textual identifier (marker).
|
|
36
|
+
* @description Search for a product status object by its textual identifier (marker). Despite the name it returns the status itself, not products — to list products with a status, filter `Products.getProducts` by `statusMarker`.
|
|
37
37
|
* @see {@link https://js-sdk.oneentry.cloud/docs/product-statuses/getProductsByStatusMarker getProductsByStatusMarker} documentation.
|
|
38
38
|
*/
|
|
39
39
|
getProductsByStatusMarker(marker: string, langCode?: string): Promise<IProductStatusEntity | IError>;
|
|
@@ -26,7 +26,7 @@ export default class ProductStatusesApi extends AsyncModules {
|
|
|
26
26
|
* @see {@link https://js-sdk.oneentry.cloud/docs/product-statuses/getProductStatuses getProductStatuses} documentation.
|
|
27
27
|
*/
|
|
28
28
|
async getProductStatuses(langCode = this.state.lang) {
|
|
29
|
-
const result = await this._fetchGet(
|
|
29
|
+
const result = await this._fetchGet(`?langCode=${encodeURIComponent(langCode)}`);
|
|
30
30
|
// Validate response if validation is enabled
|
|
31
31
|
const validated = await this._validateResponse(result, schema('ProductStatusesResponseSchema'));
|
|
32
32
|
return this._normalizeData(validated, langCode);
|
|
@@ -38,11 +38,11 @@ export default class ProductStatusesApi extends AsyncModules {
|
|
|
38
38
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
39
39
|
* @returns {Promise<IProductStatusEntity | IError>} Returns a product status object.
|
|
40
40
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
41
|
-
* @description Search for a product status object by its textual identifier (marker).
|
|
41
|
+
* @description Search for a product status object by its textual identifier (marker). Despite the name it returns the status itself, not products — to list products with a status, filter `Products.getProducts` by `statusMarker`.
|
|
42
42
|
* @see {@link https://js-sdk.oneentry.cloud/docs/product-statuses/getProductsByStatusMarker getProductsByStatusMarker} documentation.
|
|
43
43
|
*/
|
|
44
44
|
async getProductsByStatusMarker(marker, langCode = this.state.lang) {
|
|
45
|
-
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}`);
|
|
45
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${encodeURIComponent(langCode)}`);
|
|
46
46
|
// Validate response if validation is enabled
|
|
47
47
|
const validated = await this._validateResponse(result, schema('ProductStatusEntitySchema'));
|
|
48
48
|
return this._normalizeData(validated, langCode);
|
|
@@ -41,10 +41,7 @@ interface IProductStatusesApi {
|
|
|
41
41
|
* @property {ILocalizeInfo} localizeInfos - Localized name of the product status.
|
|
42
42
|
* @example
|
|
43
43
|
{
|
|
44
|
-
"title": "
|
|
45
|
-
"plainContent": "Content for catalog",
|
|
46
|
-
"htmlContent": "<b>Content for catalog</b>",
|
|
47
|
-
"menuTitle": "Catalog"
|
|
44
|
+
"title": "Sold"
|
|
48
45
|
}
|
|
49
46
|
* @property {boolean} isDefault - Whether this is the default status. Example: true.
|
|
50
47
|
* @property {number} version - Version number of the object; changes with each update. Example: 1.
|
|
@@ -52,14 +52,14 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
52
52
|
"offset": 0,
|
|
53
53
|
"sortOrder": "DESC",
|
|
54
54
|
"sortKey": "id",
|
|
55
|
-
"signPrice": "
|
|
55
|
+
"signPrice": "my_order"
|
|
56
56
|
}
|
|
57
|
-
* @param {string} [userQuery.signPrice] - Marker of the order storage to fix prices for. When set, each product comes with a `signedPrice` that holds the price for a limited time.
|
|
57
|
+
* @param {string} [userQuery.signPrice] - Marker of the order storage to fix prices for. When set, each product comes with a `signedPrice` that holds the price for a limited time. Must be an existing orders storage marker of the project, e.g. "my_order"; a marker with no such storage fails the whole request with `404 Specified orders storage for price signature not found`.
|
|
58
58
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/#Fixing-the-price-signPrice Fixing the price} documentation.
|
|
59
59
|
* @param {string} [userQuery.sortOrder] - Sorting order parameter.
|
|
60
60
|
* @returns {Promise<IProductsResponse | IError>} Products response, or IError when isShell=true
|
|
61
61
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
62
|
-
* @description Fetch products with optional filters and pagination.
|
|
62
|
+
* @description Fetch products with optional filters and pagination. `limit` is an integer from `1` (`0` or `1.5` answer `400`). A `signPrice` naming no orders storage fails the whole request with `404 Specified orders storage for price signature not found`. Products without a translation in `langCode` are left out.
|
|
63
63
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProducts getProducts} documentation.
|
|
64
64
|
*/
|
|
65
65
|
getProducts(body?: IFilterParams[], langCode?: string, userQuery?: IProductsQueryBase): Promise<IProductsResponse | IError>;
|
|
@@ -75,7 +75,7 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
75
75
|
"offset": 0,
|
|
76
76
|
"sortOrder": "DESC",
|
|
77
77
|
"sortKey": "id",
|
|
78
|
-
"signPrice": "
|
|
78
|
+
"signPrice": "my_order"
|
|
79
79
|
}
|
|
80
80
|
* @returns {Promise<IProductsResponse | IError>} Products without a category: `{ items, total }`, the same container as getProducts.
|
|
81
81
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
@@ -120,7 +120,7 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
120
120
|
"offset": 0,
|
|
121
121
|
"sortOrder": "DESC",
|
|
122
122
|
"sortKey": "id",
|
|
123
|
-
"signPrice": "
|
|
123
|
+
"signPrice": "my_order"
|
|
124
124
|
}
|
|
125
125
|
* @returns {Promise<IProductsResponse | IError>} Array with ProductEntity objects
|
|
126
126
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
@@ -139,7 +139,7 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
139
139
|
"limit": 30,
|
|
140
140
|
"offset": 0,
|
|
141
141
|
"sortOrder": "DESC",
|
|
142
|
-
"signPrice": "
|
|
142
|
+
"signPrice": "my_order",
|
|
143
143
|
"statusMarker": "in_stock"
|
|
144
144
|
}
|
|
145
145
|
* @returns {Promise<IProductsInfo | IError>} Array with ProductInformation objects.
|
|
@@ -185,7 +185,7 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
185
185
|
"offset": 0,
|
|
186
186
|
"sortOrder": "DESC",
|
|
187
187
|
"sortKey": "id",
|
|
188
|
-
"signPrice": "
|
|
188
|
+
"signPrice": "my_order"
|
|
189
189
|
}
|
|
190
190
|
* @returns {Promise<IProductsResponse | IError>} Array with ProductEntity objects.
|
|
191
191
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
@@ -205,7 +205,7 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
205
205
|
"offset": 0,
|
|
206
206
|
"sortOrder": "DESC",
|
|
207
207
|
"sortKey": "id",
|
|
208
|
-
"signPrice": "
|
|
208
|
+
"signPrice": "my_order",
|
|
209
209
|
"statusMarker": "in_stock",
|
|
210
210
|
"templateMarker": "template_12345"
|
|
211
211
|
}
|
|
@@ -223,18 +223,18 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
223
223
|
/**
|
|
224
224
|
* Find products by its ids.
|
|
225
225
|
* @handleName getProductsByIds
|
|
226
|
-
* @param {string} ids - Comma-separated IDs
|
|
226
|
+
* @param {string} ids - Comma-separated product IDs. Unknown ids are dropped and repeated ones collapsed; a non-numeric one answers `400 Incorrect request`. Example: "12345,67890".
|
|
227
227
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
228
228
|
* @param {IProductsByIdsQuery} [userQuery] - Optional query parameters.
|
|
229
229
|
* @example
|
|
230
230
|
{
|
|
231
231
|
"limit": 30,
|
|
232
232
|
"offset": 0,
|
|
233
|
-
"signPrice": "
|
|
233
|
+
"signPrice": "my_order"
|
|
234
234
|
}
|
|
235
235
|
* @param {number} [userQuery.limit] - Maximum number of records to return. Default: 30.
|
|
236
236
|
* @param {number} [userQuery.offset] - Number of records to skip. Default: 0.
|
|
237
|
-
* @param {string} [userQuery.signPrice] - Marker of the order storage to fix prices for. When set, each product comes with a `signedPrice` that holds the price for a limited time.
|
|
237
|
+
* @param {string} [userQuery.signPrice] - Marker of the order storage to fix prices for. When set, each product comes with a `signedPrice` that holds the price for a limited time. Must be an existing orders storage marker of the project, e.g. "my_order"; a marker with no such storage fails the whole request with `404 Specified orders storage for price signature not found`.
|
|
238
238
|
* @returns {Promise<IProductsEntity[] | IError>} Array with ProductEntity objects
|
|
239
239
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
240
240
|
* @description Find products by its ids.
|
|
@@ -246,104 +246,77 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
246
246
|
* @handleName getProductById
|
|
247
247
|
* @param {number} id - Product ID. Example: 12345.
|
|
248
248
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
249
|
-
* @param {boolean} [isNormalized] -
|
|
249
|
+
* @param {boolean} [isNormalized] - Deprecated: the API no longer reads it, the answer is the same with `true`, `false` or without it. Kept for compatibility.
|
|
250
|
+
* @param {string} [signPrice] - Marker of an orders storage to fix the price for. When set, the product comes with a `signedPrice` holding the price for a limited time; an unknown marker fails the request with `404 Specified orders storage for price signature not found`.
|
|
250
251
|
* @returns {Promise<IProductsEntity | IError>} ProductEntity object.
|
|
251
252
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
252
|
-
* @description Retrieve one product object.
|
|
253
|
+
* @description Retrieve one product object. A product with no translation in `langCode` answers `404 Product not found` — there is no fallback to another language.
|
|
253
254
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductById getProductById} documentation.
|
|
254
255
|
*/
|
|
255
|
-
getProductById(id: number, langCode?: string, isNormalized?: boolean): Promise<IProductsEntity | IError>;
|
|
256
|
+
getProductById(id: number, langCode?: string, isNormalized?: boolean, signPrice?: string): Promise<IProductsEntity | IError>;
|
|
256
257
|
/**
|
|
257
258
|
* Getting a product block object by product id.
|
|
258
259
|
* @handleName getProductBlockById
|
|
259
260
|
* @param {number} id - Product ID. Example: 12345.
|
|
260
|
-
* @
|
|
261
|
+
* @param {string} [langCode] - Language code. Default: the client's language.
|
|
262
|
+
* @returns {Promise<IProductBlock[] | IError>} - Array of the product's block objects.
|
|
261
263
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
262
264
|
* @description Getting a product block object by product id.
|
|
263
265
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductBlockById getProductBlockById} documentation.
|
|
264
266
|
*/
|
|
265
|
-
getProductBlockById(id: number): Promise<IProductBlock[] | IError>;
|
|
267
|
+
getProductBlockById(id: number, langCode?: string): Promise<IProductBlock[] | IError>;
|
|
266
268
|
/**
|
|
267
269
|
* Quick search for product page objects with limited output.
|
|
268
270
|
* @handleName searchProduct
|
|
269
271
|
* @param {string} name - Text to search for in product titles (`localizeInfos.title`) in the requested language. Example: "laminat".
|
|
270
272
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
273
|
+
* @param {string} [url] - URL of a catalog page to search within that category. Default: the whole catalog.
|
|
274
|
+
* @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.
|
|
271
275
|
* @returns {Promise<IProductsEntity[] | IProductSearchResult[] | IError>} Array with ProductEntity objects, or an array with short ProductSearchResult cards when the traficLimit config option is enabled
|
|
272
276
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
273
277
|
* @description Quick search for product page objects with limited output. The quick search endpoint returns short cards ({ id, title, pageId }); with traficLimit enabled they are returned as is, otherwise full product entities are fetched for the found ids.
|
|
274
278
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/searchProduct searchProduct} documentation.
|
|
275
279
|
*/
|
|
276
|
-
searchProduct(name: string, langCode?: string): Promise<IProductsEntity[] | IProductSearchResult[] | IError>;
|
|
280
|
+
searchProduct(name: string, langCode?: string, url?: string, correct?: boolean): Promise<IProductsEntity[] | IProductSearchResult[] | IError>;
|
|
277
281
|
/**
|
|
278
282
|
* Getting the number of products for the entire catalog.
|
|
279
283
|
* @handleName getProductsCount
|
|
280
|
-
* @param {any[]} body - Filter objects with search conditions. Default: `[]`.
|
|
284
|
+
* @param {any[]} [body] - Filter objects with search conditions. Default: `[]`.
|
|
285
|
+
* @param {string} [langCode] - Language code. Default: "en_US". Must be one of the project's active languages — an inactive one answers `400 langCode must be one of the active languages`. The count reflects the products visible in that language.
|
|
281
286
|
* @example
|
|
282
287
|
[
|
|
283
288
|
{
|
|
284
289
|
"attributeMarker": "price",
|
|
285
|
-
"conditionMarker": "
|
|
286
|
-
"
|
|
287
|
-
"conditionValue": {},
|
|
288
|
-
"pageUrls": [
|
|
289
|
-
"23-laminat-floorwood-maxima"
|
|
290
|
-
],
|
|
291
|
-
"title": "Iphone 17 Pro"
|
|
290
|
+
"conditionMarker": "eq",
|
|
291
|
+
"conditionValue": 51
|
|
292
292
|
}
|
|
293
293
|
]
|
|
294
294
|
* @returns {Promise<IProductsCount | IError>} Object with product items count.
|
|
295
295
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
296
|
-
* @description This method calculates and returns the total number of products present across the entire catalog, optionally applying specified filters.
|
|
296
|
+
* @description This method calculates and returns the total number of products present across the entire catalog, optionally applying specified filters. The request carries `langCode`; it must be an active language of the project, otherwise the API answers `400`.
|
|
297
297
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsCount getProductsCount} documentation.
|
|
298
298
|
*/
|
|
299
|
-
getProductsCount(body?: any[]): Promise<IProductsCount | IError>;
|
|
299
|
+
getProductsCount(body?: any[], langCode?: string): Promise<IProductsCount | IError>;
|
|
300
300
|
/**
|
|
301
301
|
* Getting the number of products on a catalog page by page ID.
|
|
302
302
|
* @handleName getProductsCountByPageId
|
|
303
303
|
* @param {number | string} id - Page ID. Example: 12345.
|
|
304
304
|
* @param {any[]} [body] - Filter objects with search conditions. Default: `[]`.
|
|
305
|
+
* @param {string} [langCode] - Language code. Default: "en_US". Must be one of the project's active languages — an inactive one answers `400 langCode must be one of the active languages`. The count reflects the products visible in that language.
|
|
305
306
|
* @example
|
|
306
307
|
[
|
|
307
308
|
{
|
|
308
309
|
"attributeMarker": "price",
|
|
309
|
-
"conditionMarker": "
|
|
310
|
-
"
|
|
311
|
-
"conditionValue": {},
|
|
312
|
-
"pageUrls": [
|
|
313
|
-
"23-laminat-floorwood-maxima"
|
|
314
|
-
],
|
|
315
|
-
"title": "Iphone 17 Pro"
|
|
310
|
+
"conditionMarker": "eq",
|
|
311
|
+
"conditionValue": 51
|
|
316
312
|
}
|
|
317
313
|
]
|
|
318
314
|
* @returns {Promise<IProductsCount | IError>} Object with product items count.
|
|
319
315
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
320
|
-
* @description This method calculates and returns the number of products available on a given catalog page, identified by its page ID, with optional filtering.
|
|
316
|
+
* @description This method calculates and returns the number of products available on a given catalog page, identified by its page ID, with optional filtering. The request carries `langCode`; it must be an active language of the project (an inactive one answers `400`), and the count reflects the products visible in that language.
|
|
321
317
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsCountByPageId getProductsCountByPageId} documentation.
|
|
322
318
|
*/
|
|
323
|
-
getProductsCountByPageId(id: number | string, body?: any[]): Promise<IProductsCount | IError>;
|
|
324
|
-
/**
|
|
325
|
-
* Getting the number of products for the catalog page by page url.
|
|
326
|
-
* @handleName getProductsCountByPageUrl
|
|
327
|
-
* @param {string} url - Page URL.
|
|
328
|
-
* @param {any[]} body - Filter objects with search conditions. Default: `[]`.
|
|
329
|
-
* @example
|
|
330
|
-
[
|
|
331
|
-
{
|
|
332
|
-
"attributeMarker": "price",
|
|
333
|
-
"conditionMarker": "in",
|
|
334
|
-
"statusMarker": "status_1",
|
|
335
|
-
"conditionValue": {},
|
|
336
|
-
"pageUrls": [
|
|
337
|
-
"23-laminat-floorwood-maxima"
|
|
338
|
-
],
|
|
339
|
-
"title": "Iphone 17 Pro"
|
|
340
|
-
}
|
|
341
|
-
]
|
|
342
|
-
* @returns {Promise<IProductsCount | IError>} Object with product items count.
|
|
343
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
344
|
-
* @description This method calculates and returns the number of products available on a given catalog page, identified by its URL, with optional filtering.
|
|
345
|
-
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsCountByPageUrl getProductsCountByPageUrl} documentation.
|
|
346
|
-
*/
|
|
319
|
+
getProductsCountByPageId(id: number | string, body?: any[], langCode?: string): Promise<IProductsCount | IError>;
|
|
347
320
|
/**
|
|
348
321
|
* Semantic (vector) search for products.
|
|
349
322
|
* @handleName getProductsByVectorSearch
|
|
@@ -358,10 +331,23 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
358
331
|
*/
|
|
359
332
|
getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IProductsResponse> | IError>;
|
|
360
333
|
/**
|
|
361
|
-
*
|
|
362
|
-
* @
|
|
363
|
-
* @param {
|
|
364
|
-
* @
|
|
334
|
+
* Getting the number of products for the catalog page by page url.
|
|
335
|
+
* @handleName getProductsCountByPageUrl
|
|
336
|
+
* @param {string} url - Page URL. Example: "catalog".
|
|
337
|
+
* @param {any[]} [body] - Filter objects with search conditions. Default: `[]`.
|
|
338
|
+
* @param {string} [langCode] - Language code. Default: "en_US". Must be one of the project's active languages — an inactive one answers `400 langCode must be one of the active languages`. The count reflects the products visible in that language.
|
|
339
|
+
* @example
|
|
340
|
+
[
|
|
341
|
+
{
|
|
342
|
+
"attributeMarker": "price",
|
|
343
|
+
"conditionMarker": "eq",
|
|
344
|
+
"conditionValue": 51
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
* @returns {Promise<IProductsCount | IError>} Object with product items count.
|
|
348
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
349
|
+
* @description This method calculates and returns the number of products available on a given catalog page, identified by its URL, with optional filtering. The request carries `langCode`; it must be an active language of the project (an inactive one answers `400`), and the count reflects the products visible in that language.
|
|
350
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsCountByPageUrl getProductsCountByPageUrl} documentation.
|
|
365
351
|
*/
|
|
366
|
-
getProductsCountByPageUrl(url: string, body?: any[]): Promise<IProductsCount | IError>;
|
|
352
|
+
getProductsCountByPageUrl(url: string, body?: any[], langCode?: string): Promise<IProductsCount | IError>;
|
|
367
353
|
}
|