oneentry 1.0.175 → 1.0.176
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +24 -0
- package/dist/attribute-sets/attributeSetsApi.js +3 -3
- package/dist/auth-provider/authProviderApi.js +12 -12
- package/dist/base/asyncModules.d.ts +11 -0
- package/dist/base/asyncModules.js +14 -0
- package/dist/blocks/blocksApi.js +24 -15
- package/dist/discounts/discountsApi.js +2 -1
- package/dist/events/eventsApi.js +4 -4
- package/dist/filters/filtersApi.js +1 -1
- package/dist/forms/formsApi.js +1 -1
- package/dist/forms-data/formsDataApi.d.ts +10 -8
- package/dist/forms-data/formsDataApi.js +14 -10
- package/dist/forms-data/formsDataInterfaces.d.ts +75 -54
- package/dist/integration-collections/integrationCollectionsApi.js +7 -6
- package/dist/menus/menusApi.js +1 -1
- package/dist/orders/ordersApi.js +7 -6
- package/dist/pages/pagesApi.js +2 -2
- package/dist/product-statuses/productStatusesApi.js +2 -2
- package/dist/templates/templatesApi.js +1 -1
- package/dist/templates-preview/templatesPreviewApi.js +1 -1
- package/dist/user-groups/userGroupsApi.js +2 -2
- package/esm/attribute-sets/attributeSetsApi.js +3 -3
- package/esm/auth-provider/authProviderApi.js +12 -12
- package/esm/base/asyncModules.d.ts +11 -0
- package/esm/base/asyncModules.js +14 -0
- package/esm/blocks/blocksApi.js +24 -15
- package/esm/discounts/discountsApi.js +2 -1
- package/esm/events/eventsApi.js +4 -4
- package/esm/filters/filtersApi.js +1 -1
- package/esm/forms/formsApi.js +1 -1
- package/esm/forms-data/formsDataApi.d.ts +10 -8
- package/esm/forms-data/formsDataApi.js +14 -10
- package/esm/forms-data/formsDataInterfaces.d.ts +75 -54
- package/esm/integration-collections/integrationCollectionsApi.js +7 -6
- package/esm/menus/menusApi.js +1 -1
- package/esm/orders/ordersApi.js +7 -6
- package/esm/pages/pagesApi.js +2 -2
- package/esm/product-statuses/productStatusesApi.js +2 -2
- package/esm/templates/templatesApi.js +1 -1
- package/esm/templates-preview/templatesPreviewApi.js +1 -1
- package/esm/user-groups/userGroupsApi.js +2 -2
- package/package.json +2 -2
|
@@ -85,9 +85,9 @@ interface IFormsData {
|
|
|
85
85
|
/**
|
|
86
86
|
* Body for semantic (vector) form data search.
|
|
87
87
|
* @interface IFormsDataVectorSearch
|
|
88
|
-
* @property {string} queryText - Natural-language search query
|
|
89
|
-
* @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2)
|
|
90
|
-
* @property {number} [maxHits] - Number of top candidates fetched before pagination. Default: 100. Maximum: 500. Example: 10.
|
|
88
|
+
* @property {string} queryText - Natural-language search query, 1 to 512 characters: an empty one answers `400 queryText should not be empty`, a longer one `400 queryText must be shorter than or equal to 512 characters`. Example: "order confirmation".
|
|
89
|
+
* @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2); a negative value answers `400`. Example: 0.3.
|
|
90
|
+
* @property {number} [maxHits] - Number of top candidates fetched before pagination, from 1. Default: 100. Maximum: 500. Example: 10.
|
|
91
91
|
* @property {boolean} [debug] - When `true`, each returned item gets a `distance` field. Example: false.
|
|
92
92
|
* @description Body for the form-data vector/search endpoint.
|
|
93
93
|
*/
|
|
@@ -113,14 +113,14 @@ type FormDataStatus = 'sent' | 'moderation' | 'approved' | 'banned' | 'deleted';
|
|
|
113
113
|
* @property {number} [parentId] - Identifier of the parent record — the way to fetch replies to one comment. Example: 10.
|
|
114
114
|
* @property {string} [userIdentifier] - Text identifier of the sender; an empty string means "no filter". Example: "admin".
|
|
115
115
|
* @property {FormDataStatus[]} [status] - Moderation statuses to keep. Must be an array — a bare string is rejected with `400`. An empty array means "no filter". Example: ["approved"].
|
|
116
|
-
* @property {string} [dateFrom] - Lower bound of the submission date, `YYYY-MM-DD`; an empty string means "no bound" — `getFormsDataByMarker` strips it from the body, since the endpoint rejects an empty date with a `400`. A non-empty value the API cannot parse still fails the request. Example: "2025-01-01".
|
|
117
|
-
* @property {string} [dateTo] - Upper bound of the submission date, `YYYY-MM-DD`; an empty string means "no bound", handled like `dateFrom`. Example: "2025-12-31".
|
|
116
|
+
* @property {string} [dateFrom] - Lower bound of the submission date, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`; an empty string means "no bound" — `getFormsDataByMarker` strips it from the body, since the endpoint rejects an empty date with a `400`. A non-empty value the API cannot parse still fails the request. Example: "2025-01-01".
|
|
117
|
+
* @property {string} [dateTo] - Upper bound of the submission date, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`; an empty string means "no bound", handled like `dateFrom`. Example: "2025-12-31".
|
|
118
118
|
* @description Filter for reading form submissions. Every field is optional and an omitted one is simply not applied.
|
|
119
119
|
*
|
|
120
|
-
* Typed rather than left as `object` on purpose: the API **
|
|
121
|
-
* does not know, so `statuses: ['approved']` (note the "s")
|
|
122
|
-
*
|
|
123
|
-
*
|
|
120
|
+
* Typed rather than left as `object` on purpose: the API **refuses** a field it
|
|
121
|
+
* does not know, so `statuses: ['approved']` (note the "s") answers
|
|
122
|
+
* `400 property statuses should not exist` — the compiler catches the typo
|
|
123
|
+
* before the request does.
|
|
124
124
|
*/
|
|
125
125
|
interface IFormsDataFilter {
|
|
126
126
|
/**
|
|
@@ -419,7 +419,7 @@ interface IUpdateFormsData {
|
|
|
419
419
|
/**
|
|
420
420
|
* Contains an array of data form objects with the following values
|
|
421
421
|
*/
|
|
422
|
-
type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, unknown>;
|
|
422
|
+
type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | IBodyTypeEntity | IBodyTypeTimeInterval | Record<string, unknown>;
|
|
423
423
|
/**
|
|
424
424
|
* Value shapes accepted by a SUBMISSION (`POST /form-data`).
|
|
425
425
|
*
|
|
@@ -588,13 +588,13 @@ interface IBodyPostFormData {
|
|
|
588
588
|
* Represents a form data entity with a simple value.
|
|
589
589
|
* @interface IBodyTypeStringNumberFloat
|
|
590
590
|
* @property {string} marker - marker name. Example: "some_marker".
|
|
591
|
-
* @property {string} type - Type value. "string" | "number" | "float". Example: "string".
|
|
592
|
-
* @property {string | number | null} value - Value of the form data entity.
|
|
591
|
+
* @property {string} type - Type value. "string" | "integer" | "number" | "float". Example: "string".
|
|
592
|
+
* @property {string | number | null} value - Value of the form data entity. A submission may send a number or a string; responses return numeric fields **as strings** — `3` comes back as `"3"`, `2.565` as `"2.565"` — or `null` when the field is empty. Convert with `Number(value)` before arithmetic. Example: "string".
|
|
593
593
|
* @description Represents a form data entity with a marker, type, and value.
|
|
594
594
|
*/
|
|
595
595
|
interface IBodyTypeStringNumberFloat {
|
|
596
596
|
marker: string;
|
|
597
|
-
type: 'string' | 'number' | 'float';
|
|
597
|
+
type: 'string' | 'integer' | 'number' | 'float';
|
|
598
598
|
value: string | number | null;
|
|
599
599
|
}
|
|
600
600
|
/**
|
|
@@ -633,43 +633,46 @@ interface ITimeDateValue {
|
|
|
633
633
|
* @interface IBodyTypeText
|
|
634
634
|
* @property {string} marker - marker name. Example: "some_marker".
|
|
635
635
|
* @property {string} type - Type value. Example: "text".
|
|
636
|
-
* @property {
|
|
636
|
+
* @property {ITextValue | ITextValue[]} value - Text value. A read returns a one-element **array**, without `plainValue` and with `params.editorMode`; older records may hold a single object.
|
|
637
637
|
* @example
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
638
|
+
[
|
|
639
|
+
{
|
|
640
|
+
"htmlValue": "<p>Hello world</p>",
|
|
641
|
+
"params": {
|
|
642
|
+
"isImageCompressed": true,
|
|
643
|
+
"editorMode": "html"
|
|
644
|
+
}
|
|
644
645
|
}
|
|
645
|
-
|
|
646
|
-
* @description Represents a text value with HTML and plain text representations, along with parameters for editor and image compression settings.
|
|
646
|
+
]
|
|
647
|
+
* @description Represents a text value with HTML and plain text representations, along with parameters for editor and image compression settings. To submit a text field use {@link IBodyPostTypeText}.
|
|
647
648
|
*/
|
|
648
649
|
interface IBodyTypeText {
|
|
649
650
|
marker: string;
|
|
650
651
|
type: 'text';
|
|
651
|
-
value: ITextValue;
|
|
652
|
+
value: ITextValue | ITextValue[];
|
|
652
653
|
}
|
|
653
654
|
/**
|
|
654
655
|
* @interface ITextEditorParams
|
|
655
|
-
* @property {boolean} isEditorDisabled - Whether the rich-text editor is disabled. Example: false.
|
|
656
|
+
* @property {boolean} [isEditorDisabled] - Whether the rich-text editor is disabled. Older records only; current reads carry `editorMode` instead. Example: false.
|
|
656
657
|
* @property {boolean} isImageCompressed - Whether embedded images are compressed. Example: true.
|
|
658
|
+
* @property {string} [editorMode] - Editor the value was written in. Example: "html".
|
|
657
659
|
* @description Editor parameters attached to text-type form values.
|
|
658
660
|
*/
|
|
659
661
|
interface ITextEditorParams {
|
|
660
|
-
isEditorDisabled
|
|
662
|
+
isEditorDisabled?: boolean;
|
|
661
663
|
isImageCompressed: boolean;
|
|
664
|
+
editorMode?: string;
|
|
662
665
|
}
|
|
663
666
|
/**
|
|
664
667
|
* @interface ITextValue
|
|
665
668
|
* @property {string} htmlValue - HTML representation of the text. Example: "<p>Hello world</p>".
|
|
666
|
-
* @property {string} plainValue - Plain-text representation.
|
|
669
|
+
* @property {string} [plainValue] - Plain-text representation. Absent from current reads. Example: "Hello world".
|
|
667
670
|
* @property {ITextEditorParams} params - Editor configuration applied to this value.
|
|
668
671
|
* @description Value payload for `text` form fields.
|
|
669
672
|
*/
|
|
670
673
|
interface ITextValue {
|
|
671
674
|
htmlValue: string;
|
|
672
|
-
plainValue
|
|
675
|
+
plainValue?: string;
|
|
673
676
|
params: ITextEditorParams;
|
|
674
677
|
}
|
|
675
678
|
/**
|
|
@@ -677,36 +680,37 @@ interface ITextValue {
|
|
|
677
680
|
* @interface IBodyTypeTextWithHeader
|
|
678
681
|
* @property {string} marker - marker name. Example: "about".
|
|
679
682
|
* @property {string} type - Type value. Example: "textWithHeader".
|
|
680
|
-
* @property {
|
|
683
|
+
* @property {ITextWithHeaderValue | ITextWithHeaderValue[]} value - Text with a header. A read returns a one-element **array**, without `plainValue` and with `params.editorMode`; older records may hold a single object.
|
|
681
684
|
* @example
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
685
|
+
[
|
|
686
|
+
{
|
|
687
|
+
"header": "Headline",
|
|
688
|
+
"htmlValue": "<p>Hello World</p>",
|
|
689
|
+
"params": {
|
|
690
|
+
"isImageCompressed": true,
|
|
691
|
+
"editorMode": "html"
|
|
692
|
+
}
|
|
689
693
|
}
|
|
690
|
-
|
|
694
|
+
]
|
|
691
695
|
* @description Represents a text value with a header, HTML and plain text representations, along with parameters for editor and image compression settings.
|
|
692
696
|
*/
|
|
693
697
|
interface IBodyTypeTextWithHeader {
|
|
694
698
|
marker: string;
|
|
695
699
|
type: 'textWithHeader';
|
|
696
|
-
value: ITextWithHeaderValue;
|
|
700
|
+
value: ITextWithHeaderValue | ITextWithHeaderValue[];
|
|
697
701
|
}
|
|
698
702
|
/**
|
|
699
703
|
* @interface ITextWithHeaderValue
|
|
700
704
|
* @property {string} header - Headline text. Example: "Headline".
|
|
701
705
|
* @property {string} htmlValue - HTML body. Example: "<p>Hello world</p>".
|
|
702
|
-
* @property {string} plainValue - Plain-text body.
|
|
706
|
+
* @property {string} [plainValue] - Plain-text body. Absent from current reads. Example: "Hello world".
|
|
703
707
|
* @property {ITextEditorParams} params - Editor configuration applied to this value.
|
|
704
708
|
* @description Value payload for `textWithHeader` form fields.
|
|
705
709
|
*/
|
|
706
710
|
interface ITextWithHeaderValue {
|
|
707
711
|
header: string;
|
|
708
712
|
htmlValue: string;
|
|
709
|
-
plainValue
|
|
713
|
+
plainValue?: string;
|
|
710
714
|
params: ITextEditorParams;
|
|
711
715
|
}
|
|
712
716
|
/**
|
|
@@ -765,7 +769,7 @@ interface IImageValue {
|
|
|
765
769
|
* @interface IBodyTypeFile
|
|
766
770
|
* @property {string} marker - marker name. Example: "picture".
|
|
767
771
|
* @property {'file'} type - Type value. Example: "file".
|
|
768
|
-
* @property {object} value - The attached file. Three shapes are accepted and may be mixed in one array: a `File`/`Blob` (also a `FileList`), which the SDK uploads first; the descriptor `FileUploading.upload` returns for a file **already in storage**, which is passed through as it is; or a hand-built {@link IFileValue}. In a SUBMISSION the value must be an **array** — a lone descriptor or {@link IFileValue} answers `400 formData's marker '<marker>' value must be an array`, while a lone `File`/`Blob` is fine because the SDK wraps the upload result. A READ returns a single attached file
|
|
772
|
+
* @property {object} value - The attached file. Three shapes are accepted and may be mixed in one array: a `File`/`Blob` (also a `FileList`), which the SDK uploads first; the descriptor `FileUploading.upload` returns for a file **already in storage**, which is passed through as it is; or a hand-built {@link IFileValue}. In a SUBMISSION the value must be an **array** — a lone descriptor or {@link IFileValue} answers `400 formData's marker '<marker>' value must be an array`, while a lone `File`/`Blob` is fine because the SDK wraps the upload result. A READ returns the files as an array too — a single attached file is a one-element array.
|
|
769
773
|
* @example
|
|
770
774
|
[
|
|
771
775
|
{
|
|
@@ -800,24 +804,41 @@ interface IFileValue {
|
|
|
800
804
|
* @interface IBodyTypeRadioButtonList
|
|
801
805
|
* @property {string} marker - marker name. Example: "selector".
|
|
802
806
|
* @property {string} type - Type value. Example: 'list'.
|
|
803
|
-
* @property {
|
|
807
|
+
* @property {IListOptionValue[] | string[] | string} value - Chosen option(s). A read of a submission returns the option **values as stored**: `list` — an array of strings (`["1"]`), `radioButton` — one string (`"1"`). The `[{ title, value, extended }]` form is the shape of a page attribute.
|
|
804
808
|
* @example
|
|
805
|
-
[
|
|
806
|
-
|
|
807
|
-
"title": "red",
|
|
808
|
-
"value": "1",
|
|
809
|
-
"extended": {
|
|
810
|
-
"value": "red",
|
|
811
|
-
"type": "string"
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
]
|
|
815
|
-
* @description Represents a list or radio button selection with multiple options, each containing a title, value, and extended information.
|
|
809
|
+
["1"]
|
|
810
|
+
* @description Represents a list or radio button selection. Look the titles up in the form's attribute (`Forms.getFormByMarker`) by the stored value.
|
|
816
811
|
*/
|
|
817
812
|
interface IBodyTypeRadioButtonList {
|
|
818
813
|
marker: string;
|
|
819
814
|
type: 'list' | 'radioButton';
|
|
820
|
-
value: IListOptionValue[];
|
|
815
|
+
value: IListOptionValue[] | string[] | string;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Represents an `entity` form data field — links to other entities.
|
|
819
|
+
* @interface IBodyTypeEntity
|
|
820
|
+
* @property {string} marker - marker name. Example: "related".
|
|
821
|
+
* @property {'entity'} type - Type value. Example: "entity".
|
|
822
|
+
* @property {number[]} value - Identifiers of the linked entities. Example: [2954, 2957].
|
|
823
|
+
* @description A form field that stores links to other entities (for example products) by id.
|
|
824
|
+
*/
|
|
825
|
+
interface IBodyTypeEntity {
|
|
826
|
+
marker: string;
|
|
827
|
+
type: 'entity';
|
|
828
|
+
value: number[];
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Represents a `timeInterval` form data field.
|
|
832
|
+
* @interface IBodyTypeTimeInterval
|
|
833
|
+
* @property {string} marker - marker name. Example: "booking".
|
|
834
|
+
* @property {'timeInterval'} type - Type value. Example: "timeInterval".
|
|
835
|
+
* @property {string[][]} value - Intervals as `[start, end]` pairs of ISO dates. Example: [["2025-02-11T16:00:00.000Z", "2025-02-13T16:00:00.000Z"]].
|
|
836
|
+
* @description A form field that stores one or more time intervals.
|
|
837
|
+
*/
|
|
838
|
+
interface IBodyTypeTimeInterval {
|
|
839
|
+
marker: string;
|
|
840
|
+
type: 'timeInterval';
|
|
841
|
+
value: string[][];
|
|
821
842
|
}
|
|
822
843
|
/**
|
|
823
844
|
* @interface IListOptionExtended
|
|
@@ -841,4 +862,4 @@ interface IListOptionValue {
|
|
|
841
862
|
value: string;
|
|
842
863
|
extended: IListOptionExtended;
|
|
843
864
|
}
|
|
844
|
-
export type { FormDataPostType, FormDataStatus, FormDataType, IBodyPostFormData, IBodyPostTypeList, IBodyPostTypeSpam, IBodyPostTypeText, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, ICaptchaEvent, ICaptchaValue, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextSubmissionValue, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
|
|
865
|
+
export type { FormDataPostType, FormDataStatus, FormDataType, IBodyPostFormData, IBodyPostTypeList, IBodyPostTypeSpam, IBodyPostTypeText, IBodyTypeEntity, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IBodyTypeTimeInterval, ICaptchaEvent, ICaptchaValue, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextSubmissionValue, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
|
|
@@ -146,7 +146,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
146
146
|
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/validateICollectionMarker validateICollectionMarker} documentation.
|
|
147
147
|
*/
|
|
148
148
|
async validateICollectionMarker(marker) {
|
|
149
|
-
const result = await this._fetchGet(`/marker-validation/${marker}`);
|
|
149
|
+
const result = await this._fetchGet(`/marker-validation/${this._pathSegment(marker)}`);
|
|
150
150
|
// Validate response if validation is enabled
|
|
151
151
|
const validated = await this._validateResponse(result, schema('CollectionIsValidSchema'));
|
|
152
152
|
return this._normalizeData(validated);
|
|
@@ -161,7 +161,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
161
161
|
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsByMarker getICollectionRowsByMarker} documentation.
|
|
162
162
|
*/
|
|
163
163
|
async getICollectionRowsByMarker(marker, langCode = this.state.lang) {
|
|
164
|
-
const result = await this._fetchGet(`/marker/${marker}/rows?langCode=${langCode}`);
|
|
164
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/rows?langCode=${langCode}`);
|
|
165
165
|
// Validate response if validation is enabled
|
|
166
166
|
const validated = await this._validateResponse(result, schema('CollectionRowsResponseSchema'));
|
|
167
167
|
return this._normalizeData(validated, langCode);
|
|
@@ -177,7 +177,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
177
177
|
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowByMarkerAndId getICollectionRowByMarkerAndId} documentation.
|
|
178
178
|
*/
|
|
179
179
|
async getICollectionRowByMarkerAndId(marker, id, langCode = this.state.lang) {
|
|
180
|
-
const result = await this._fetchGet(`/marker/${marker}/rows/${id}?langCode=${langCode}`);
|
|
180
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/rows/${id}?langCode=${langCode}`);
|
|
181
181
|
// Validate response if validation is enabled
|
|
182
182
|
const validated = await this._validateResponse(result, schema('CollectionRowSchema'));
|
|
183
183
|
return this._normalizeData(validated, langCode);
|
|
@@ -205,7 +205,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
205
205
|
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/createICollectionRow createICollectionRow} documentation.
|
|
206
206
|
*/
|
|
207
207
|
async createICollectionRow(marker, body, langCode = this.state.lang) {
|
|
208
|
-
const response = await this._fetchPost(`/marker/${marker}/rows?langCode=${langCode}`, body);
|
|
208
|
+
const response = await this._fetchPost(`/marker/${this._pathSegment(marker)}/rows?langCode=${langCode}`, body);
|
|
209
209
|
// Validate response if validation is enabled
|
|
210
210
|
const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
|
|
211
211
|
return this._normalizeData(validated, langCode);
|
|
@@ -236,7 +236,8 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
236
236
|
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/updateICollectionRow updateICollectionRow} documentation.
|
|
237
237
|
*/
|
|
238
238
|
async updateICollectionRow(marker, id, body, langCode = this.state.lang) {
|
|
239
|
-
const response = await this._fetchPut(`/marker/${marker}/rows/${id}?` +
|
|
239
|
+
const response = await this._fetchPut(`/marker/${this._pathSegment(marker)}/rows/${id}?` +
|
|
240
|
+
`langCode=${langCode}`, body);
|
|
240
241
|
// Validate response if validation is enabled
|
|
241
242
|
const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
|
|
242
243
|
return this._normalizeData(validated, langCode);
|
|
@@ -252,7 +253,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
|
252
253
|
* @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/deleteICollectionRowByMarkerAndId deleteICollectionRowByMarkerAndId} documentation.
|
|
253
254
|
*/
|
|
254
255
|
async deleteICollectionRowByMarkerAndId(marker, id) {
|
|
255
|
-
const result = await this._fetchDelete(`/marker/${marker}/rows/${id}`);
|
|
256
|
+
const result = await this._fetchDelete(`/marker/${this._pathSegment(marker)}/rows/${id}`);
|
|
256
257
|
return result;
|
|
257
258
|
}
|
|
258
259
|
}
|
package/dist/menus/menusApi.js
CHANGED
|
@@ -65,7 +65,7 @@ class MenusApi extends asyncModules_1.default {
|
|
|
65
65
|
* @see {@link https://js-sdk.oneentry.cloud/docs/menus/getMenusByMarker getMenusByMarker} documentation.
|
|
66
66
|
*/
|
|
67
67
|
async getMenusByMarker(marker, langCode = this.state.lang) {
|
|
68
|
-
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
68
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
|
|
69
69
|
// Validate response if validation is enabled
|
|
70
70
|
const validated = await this._validateResponse(result, schema('MenuEntitySchema'));
|
|
71
71
|
return this._normalizeData(validated, langCode);
|
package/dist/orders/ordersApi.js
CHANGED
|
@@ -86,7 +86,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
86
86
|
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllOrdersByMarker getAllOrdersByMarker} documentation.
|
|
87
87
|
*/
|
|
88
88
|
async getAllOrdersByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
89
|
-
const result = await this._fetchGet(`/marker/${marker}/orders?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
89
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/orders?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
90
90
|
// Validate response if validation is enabled
|
|
91
91
|
const validated = await this._validateResponse(result, schema('OrdersResponseSchema'));
|
|
92
92
|
return this._normalizeData(validated);
|
|
@@ -103,7 +103,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
103
103
|
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrdersStorageByMarker getOrdersStorageByMarker} documentation.
|
|
104
104
|
*/
|
|
105
105
|
async getOrdersStorageByMarker(marker, langCode = this.state.lang) {
|
|
106
|
-
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
106
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
|
|
107
107
|
return this._normalizeData(result);
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
@@ -119,7 +119,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
119
119
|
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderByMarkerAndId getOrderByMarkerAndId} documentation.
|
|
120
120
|
*/
|
|
121
121
|
async getOrderByMarkerAndId(marker, id, langCode = this.state.lang) {
|
|
122
|
-
const result = await this._fetchGet(`/marker/${marker}/orders/${id}?langCode=${langCode}`);
|
|
122
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/orders/${id}?langCode=${langCode}`);
|
|
123
123
|
// Validate response if validation is enabled
|
|
124
124
|
const validated = await this._validateResponse(result, schema('OrderEntitySchema'));
|
|
125
125
|
return this._normalizeData(validated);
|
|
@@ -187,7 +187,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
187
187
|
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/createOrder createOrder} documentation.
|
|
188
188
|
*/
|
|
189
189
|
async createOrder(marker, body, langCode = this.state.lang) {
|
|
190
|
-
const result = await this._fetchPost(`/marker/${marker}/orders`, this._wrapOrderFormData(body, langCode));
|
|
190
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/orders`, this._wrapOrderFormData(body, langCode));
|
|
191
191
|
// Validate response if validation is enabled
|
|
192
192
|
const validated = await this._validateResponse(result, schema('CreateOrderResponseSchema'));
|
|
193
193
|
return this._normalizeData(validated);
|
|
@@ -223,7 +223,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
223
223
|
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/updateOrderByMarkerAndId updateOrderByMarkerAndId} documentation.
|
|
224
224
|
*/
|
|
225
225
|
async updateOrderByMarkerAndId(marker, id, body, langCode = this.state.lang) {
|
|
226
|
-
const result = await this._fetchPut(`/marker/${marker}/orders/${id}?langCode=${langCode}`, this._wrapOrderFormData(body, langCode));
|
|
226
|
+
const result = await this._fetchPut(`/marker/${this._pathSegment(marker)}/orders/${id}?langCode=${langCode}`, this._wrapOrderFormData(body, langCode));
|
|
227
227
|
// Validate response if validation is enabled
|
|
228
228
|
const validated = await this._validateResponse(result, schema('UpdateOrderResponseSchema'));
|
|
229
229
|
return this._normalizeData(validated);
|
|
@@ -246,7 +246,8 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
246
246
|
offset,
|
|
247
247
|
limit,
|
|
248
248
|
};
|
|
249
|
-
const data = await this._fetchGet(`/marker/${marker}/order-statuses?` +
|
|
249
|
+
const data = await this._fetchGet(`/marker/${this._pathSegment(marker)}/order-statuses?` +
|
|
250
|
+
this._queryParamsToString(query));
|
|
250
251
|
return this._normalizeData(data);
|
|
251
252
|
}
|
|
252
253
|
/**
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -415,13 +415,13 @@ class StaffModule extends asyncModules_1.default {
|
|
|
415
415
|
// ({ total, items }) to match BlocksApi's similarProducts contract.
|
|
416
416
|
async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
417
417
|
// Fetch similar products from the server
|
|
418
|
-
const result = await this._fetchGet(`/${marker}/similar-products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
418
|
+
const result = await this._fetchGet(`/${this._pathSegment(marker)}/similar-products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
419
419
|
return this._normalizeData(result);
|
|
420
420
|
}
|
|
421
421
|
// Method to fetch products by block marker
|
|
422
422
|
async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
423
423
|
// Fetch products from the server
|
|
424
|
-
const result = await this._fetchGet(`/${marker}/products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
424
|
+
const result = await this._fetchGet(`/${this._pathSegment(marker)}/products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
425
425
|
// On API error responses there is no `items` array — return the (normalized)
|
|
426
426
|
// error as-is instead of producing `undefined` from `result.items`.
|
|
427
427
|
if (!Array.isArray(result === null || result === void 0 ? void 0 : result.items)) {
|
|
@@ -80,7 +80,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
80
80
|
* @see {@link https://js-sdk.oneentry.cloud/docs/product-statuses/getProductsByStatusMarker getProductsByStatusMarker} documentation.
|
|
81
81
|
*/
|
|
82
82
|
async getProductsByStatusMarker(marker, langCode = this.state.lang) {
|
|
83
|
-
const result = await this._fetchGet(`/marker/${marker}`);
|
|
83
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}`);
|
|
84
84
|
// Validate response if validation is enabled
|
|
85
85
|
const validated = await this._validateResponse(result, schema('ProductStatusEntitySchema'));
|
|
86
86
|
return this._normalizeData(validated, langCode);
|
|
@@ -95,7 +95,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
95
95
|
* @see {@link https://js-sdk.oneentry.cloud/docs/product-statuses/validateMarker validateMarker} documentation.
|
|
96
96
|
*/
|
|
97
97
|
async validateMarker(marker) {
|
|
98
|
-
const result = await this._fetchGet(`/marker-validation/${marker}`);
|
|
98
|
+
const result = await this._fetchGet(`/marker-validation/${this._pathSegment(marker)}`);
|
|
99
99
|
// Validate response if validation is enabled
|
|
100
100
|
const validated = await this._validateResponse(result, schema('ValidateMarkerResponseSchema'));
|
|
101
101
|
// Extract the 'valid' boolean value from the response object
|
|
@@ -108,7 +108,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
108
108
|
* @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByMarker getTemplateByMarker} documentation.
|
|
109
109
|
*/
|
|
110
110
|
async getTemplateByMarker(marker, langCode = this.state.lang) {
|
|
111
|
-
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
111
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
|
|
112
112
|
// Validate response if validation is enabled
|
|
113
113
|
const validated = await this._validateResponse(result, schema('TemplateEntitySchema'));
|
|
114
114
|
return this._normalizeData(validated);
|
|
@@ -80,7 +80,7 @@ class TemplatePreviewsApi extends asyncModules_1.default {
|
|
|
80
80
|
* @see {@link https://js-sdk.oneentry.cloud/docs/templates-preview/getTemplatePreviewByMarker getTemplatePreviewByMarker} documentation.
|
|
81
81
|
*/
|
|
82
82
|
async getTemplatePreviewByMarker(marker, langCode = this.state.lang) {
|
|
83
|
-
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
83
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
|
|
84
84
|
// Validate response if validation is enabled
|
|
85
85
|
const validated = await this._validateResponse(result, schema('TemplatePreviewEntitySchema'));
|
|
86
86
|
return this._normalizeData(validated, langCode);
|
|
@@ -119,7 +119,7 @@ class UserGroupsApi extends asyncModules_1.default {
|
|
|
119
119
|
* @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroupByMarker getUserGroupByMarker} documentation.
|
|
120
120
|
*/
|
|
121
121
|
async getUserGroupByMarker(marker, langCode = this.state.lang) {
|
|
122
|
-
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
122
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
|
|
123
123
|
// Validate response if validation is enabled
|
|
124
124
|
const validated = await this._validateResponse(result, schema('UserGroupEntitySchema'));
|
|
125
125
|
return this._normalizeData(validated, langCode);
|
|
@@ -136,7 +136,7 @@ class UserGroupsApi extends asyncModules_1.default {
|
|
|
136
136
|
* @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getChildUserGroupsByMarker getChildUserGroupsByMarker} documentation.
|
|
137
137
|
*/
|
|
138
138
|
async getChildUserGroupsByMarker(marker, langCode = this.state.lang) {
|
|
139
|
-
const result = await this._fetchGet(`/marker/${marker}/children?langCode=${langCode}`);
|
|
139
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/children?langCode=${langCode}`);
|
|
140
140
|
// Validate response if validation is enabled
|
|
141
141
|
const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
|
|
142
142
|
return this._normalizeData(validated, langCode);
|
|
@@ -58,7 +58,7 @@ export default class AttributesSetsApi extends AsyncModules {
|
|
|
58
58
|
* @see {@link https://js-sdk.oneentry.cloud/docs/attribute-sets/getAttributesByMarker getAttributesByMarker} documentation.
|
|
59
59
|
*/
|
|
60
60
|
async getAttributesByMarker(marker, langCode = this.state.lang) {
|
|
61
|
-
const result = await this._fetchGet(`/${marker}/attributes?langCode=${langCode}`);
|
|
61
|
+
const result = await this._fetchGet(`/${this._pathSegment(marker)}/attributes?langCode=${langCode}`);
|
|
62
62
|
// Validate response if validation is enabled
|
|
63
63
|
const validated = await this._validateResponse(result, schema('AttributesArrayResponseSchema'));
|
|
64
64
|
return this._normalizeData(validated, langCode);
|
|
@@ -74,7 +74,7 @@ export default class AttributesSetsApi extends AsyncModules {
|
|
|
74
74
|
* @see {@link https://js-sdk.oneentry.cloud/docs/attribute-sets/getSingleAttributeByMarkerSet getSingleAttributeByMarkerSet} documentation.
|
|
75
75
|
*/
|
|
76
76
|
async getSingleAttributeByMarkerSet(setMarker, attributeMarker, langCode = this.state.lang) {
|
|
77
|
-
const result = await this._fetchGet(`/${setMarker}/attributes/${attributeMarker}?langCode=${langCode}`);
|
|
77
|
+
const result = await this._fetchGet(`/${this._pathSegment(setMarker)}/attributes/${this._pathSegment(attributeMarker)}?langCode=${langCode}`);
|
|
78
78
|
// Validate response if validation is enabled
|
|
79
79
|
const validated = await this._validateResponse(result, schema('AttributeEntitySchema'));
|
|
80
80
|
return this._normalizeData(validated, langCode);
|
|
@@ -89,7 +89,7 @@ export default class AttributesSetsApi extends AsyncModules {
|
|
|
89
89
|
* @see {@link https://js-sdk.oneentry.cloud/docs/attribute-sets/getAttributeSetByMarker getAttributeSetByMarker} documentation.
|
|
90
90
|
*/
|
|
91
91
|
async getAttributeSetByMarker(marker, langCode = this.state.lang) {
|
|
92
|
-
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
92
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
|
|
93
93
|
// Validate response if validation is enabled
|
|
94
94
|
const validated = await this._validateResponse(result, schema('AttributeSetEntitySchema'));
|
|
95
95
|
return this._normalizeData(validated, langCode);
|
|
@@ -88,7 +88,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
88
88
|
async signUp(marker, body, langCode = this.state.lang) {
|
|
89
89
|
// `langCode` goes onto our own copy — the caller's body stays as it was
|
|
90
90
|
// given, so a retry or a second parallel call sends the same thing (CMS-909).
|
|
91
|
-
const result = await this._fetchPost(`/marker/${marker}/users/sign-up`, this._normalizePostBody({ ...body, langCode }, langCode));
|
|
91
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/sign-up`, this._normalizePostBody({ ...body, langCode }, langCode));
|
|
92
92
|
// Validate response if validation is enabled
|
|
93
93
|
const validated = await this._validateResponse(result, schema('SignUpResponseSchema'));
|
|
94
94
|
return this._normalizeData(validated);
|
|
@@ -109,7 +109,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
109
109
|
userIdentifier,
|
|
110
110
|
eventIdentifier,
|
|
111
111
|
};
|
|
112
|
-
const result = await this._fetchPost(`/marker/${marker}/users/generate-code`, data);
|
|
112
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/generate-code`, data);
|
|
113
113
|
return result;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
@@ -130,7 +130,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
130
130
|
eventIdentifier,
|
|
131
131
|
code,
|
|
132
132
|
};
|
|
133
|
-
const result = await this._fetchPost(`/marker/${marker}/users/check-code`, data);
|
|
133
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/check-code`, data);
|
|
134
134
|
return result;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
@@ -149,7 +149,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
149
149
|
userIdentifier: userIdentifier,
|
|
150
150
|
code: code,
|
|
151
151
|
};
|
|
152
|
-
const result = await this._fetchPost(`/marker/${marker}/users/activate`, data);
|
|
152
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/activate`, data);
|
|
153
153
|
return result;
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
@@ -186,7 +186,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
186
186
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/auth auth} documentation.
|
|
187
187
|
*/
|
|
188
188
|
async auth(marker, body) {
|
|
189
|
-
const result = await this._fetchPost(`/marker/${marker}/users/auth`, body);
|
|
189
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/auth`, body);
|
|
190
190
|
// Validate response if validation is enabled
|
|
191
191
|
const validated = await this._validateResponse(result, schema('AuthResponseSchema'));
|
|
192
192
|
if (!('statusCode' in validated)) {
|
|
@@ -210,7 +210,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
210
210
|
*/
|
|
211
211
|
async refresh(marker, token) {
|
|
212
212
|
const data = { refreshToken: token };
|
|
213
|
-
const result = await this._fetchPost(`/marker/${marker}/users/refresh`, data);
|
|
213
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/refresh`, data);
|
|
214
214
|
if (!('statusCode' in result)) {
|
|
215
215
|
this.state.accessToken = result.accessToken;
|
|
216
216
|
this.state.refreshToken = result.refreshToken;
|
|
@@ -235,7 +235,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
235
235
|
const data = {
|
|
236
236
|
refreshToken: token,
|
|
237
237
|
};
|
|
238
|
-
const result = await this._fetchPost(`/marker/${marker}/users/logout`, data);
|
|
238
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/logout`, data);
|
|
239
239
|
if (result) {
|
|
240
240
|
this.state.accessToken = undefined;
|
|
241
241
|
this.state.refreshToken = undefined;
|
|
@@ -256,7 +256,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
256
256
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/logoutAll logoutAll} documentation.
|
|
257
257
|
*/
|
|
258
258
|
async logoutAll(marker) {
|
|
259
|
-
const result = await this._fetchPost(`/marker/${marker}/users/logout-all`);
|
|
259
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/logout-all`);
|
|
260
260
|
if (result) {
|
|
261
261
|
this.state.accessToken = undefined;
|
|
262
262
|
this.state.refreshToken = undefined;
|
|
@@ -290,7 +290,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
290
290
|
password1: newPassword,
|
|
291
291
|
password2: repeatPassword !== null && repeatPassword !== void 0 ? repeatPassword : newPassword,
|
|
292
292
|
};
|
|
293
|
-
const result = await this._fetchPost(`/marker/${marker}/users/change-password`, data);
|
|
293
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/change-password`, data);
|
|
294
294
|
return result;
|
|
295
295
|
}
|
|
296
296
|
/**
|
|
@@ -321,7 +321,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
321
321
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/getAuthProviderByMarker getAuthProviderByMarker} documentation.
|
|
322
322
|
*/
|
|
323
323
|
async getAuthProviderByMarker(marker, langCode = this.state.lang) {
|
|
324
|
-
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
324
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
|
|
325
325
|
return this._normalizeData(result);
|
|
326
326
|
}
|
|
327
327
|
/**
|
|
@@ -334,7 +334,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
334
334
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/getActiveSessionsByMarker getActiveSessionsByMarker} documentation.
|
|
335
335
|
*/
|
|
336
336
|
async getActiveSessionsByMarker(marker) {
|
|
337
|
-
const result = await this._fetchGet(`/marker/${marker}/users/sessions`);
|
|
337
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/users/sessions`);
|
|
338
338
|
return this._normalizeData(result);
|
|
339
339
|
}
|
|
340
340
|
/**
|
|
@@ -357,7 +357,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
357
357
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/oauth oauth} documentation.
|
|
358
358
|
*/
|
|
359
359
|
async oauth(marker, body, langCode = this.state.lang) {
|
|
360
|
-
const result = await this._fetchPost(`/marker/${marker}/oauth`, this._normalizePostBody(body, langCode));
|
|
360
|
+
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/oauth`, this._normalizePostBody(body, langCode));
|
|
361
361
|
return result;
|
|
362
362
|
}
|
|
363
363
|
}
|
|
@@ -36,6 +36,17 @@ export default abstract class AsyncModules extends SyncModules {
|
|
|
36
36
|
* validation disabled (the default) never pulls Zod into its bundle.
|
|
37
37
|
*/
|
|
38
38
|
protected _validateResponse<T>(data: unknown, loadSchema?: () => Promise<z.ZodSchema<T>>): Promise<T | IError>;
|
|
39
|
+
/**
|
|
40
|
+
* Prepares a caller value (a marker) to be one segment of a request path.
|
|
41
|
+
* @param {string} value - The value to put into the path.
|
|
42
|
+
* @returns {string} The value encoded as a single path segment.
|
|
43
|
+
* @description `encodeURIComponent` keeps `?`, `#` and `/` from cutting the query or
|
|
44
|
+
* adding segments, but leaves `.` alone, and `URL` resolves a `.` or `..` segment
|
|
45
|
+
* (`%2E` included) — `form-data/marker/..` turned a read into `POST /form-data/`,
|
|
46
|
+
* the create endpoint. A dot-only value is sent with its `%` escaped instead, so the
|
|
47
|
+
* API gets a marker it rejects as invalid rather than another route.
|
|
48
|
+
*/
|
|
49
|
+
protected _pathSegment(value: string): string;
|
|
39
50
|
/**
|
|
40
51
|
* Performs an HTTP GET request.
|
|
41
52
|
* @param {string} path - The path to append to the base URL.
|
package/esm/base/asyncModules.js
CHANGED
|
@@ -79,6 +79,20 @@ export default class AsyncModules extends SyncModules {
|
|
|
79
79
|
return validateResponseSafe(schema, data, this.state.validationLogErrors);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Prepares a caller value (a marker) to be one segment of a request path.
|
|
84
|
+
* @param {string} value - The value to put into the path.
|
|
85
|
+
* @returns {string} The value encoded as a single path segment.
|
|
86
|
+
* @description `encodeURIComponent` keeps `?`, `#` and `/` from cutting the query or
|
|
87
|
+
* adding segments, but leaves `.` alone, and `URL` resolves a `.` or `..` segment
|
|
88
|
+
* (`%2E` included) — `form-data/marker/..` turned a read into `POST /form-data/`,
|
|
89
|
+
* the create endpoint. A dot-only value is sent with its `%` escaped instead, so the
|
|
90
|
+
* API gets a marker it rejects as invalid rather than another route.
|
|
91
|
+
*/
|
|
92
|
+
_pathSegment(value) {
|
|
93
|
+
const encoded = encodeURIComponent(value);
|
|
94
|
+
return /^\.{1,2}$/.test(value) ? encoded.replace(/\./g, '%252E') : encoded;
|
|
95
|
+
}
|
|
82
96
|
/**
|
|
83
97
|
* Performs an HTTP GET request.
|
|
84
98
|
* @param {string} path - The path to append to the base URL.
|