oneentry 1.0.166 → 1.0.168

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.
Files changed (79) hide show
  1. package/README.md +5 -1
  2. package/changelog.md +46 -0
  3. package/dist/auth-provider/authProviderApi.js +3 -2
  4. package/dist/base/asyncModules.d.ts +18 -0
  5. package/dist/base/asyncModules.js +34 -1
  6. package/dist/base/syncModules.d.ts +10 -3
  7. package/dist/base/syncModules.js +25 -14
  8. package/dist/base/utils.d.ts +5 -2
  9. package/dist/base/validation.d.ts +7 -5
  10. package/dist/base/validation.js +7 -4
  11. package/dist/discounts/discountsApi.d.ts +3 -3
  12. package/dist/discounts/discountsApi.js +1 -1
  13. package/dist/discounts/discountsInterfaces.d.ts +15 -3
  14. package/dist/file-uploading/fileUploadingApi.d.ts +27 -1
  15. package/dist/file-uploading/fileUploadingApi.js +42 -0
  16. package/dist/file-uploading/fileUploadingInterfaces.d.ts +102 -1
  17. package/dist/file-uploading/fileUploadingSchemas.d.ts +73 -0
  18. package/dist/file-uploading/fileUploadingSchemas.js +47 -1
  19. package/dist/forms-data/formsDataInterfaces.d.ts +130 -3
  20. package/dist/index.d.ts +4 -0
  21. package/dist/index.js +3 -0
  22. package/dist/orders/ordersApi.d.ts +14 -0
  23. package/dist/orders/ordersApi.js +19 -0
  24. package/dist/orders/ordersInterfaces.d.ts +11 -0
  25. package/dist/payments/paymentsApi.d.ts +14 -1
  26. package/dist/payments/paymentsApi.js +18 -0
  27. package/dist/payments/paymentsInterfaces.d.ts +43 -1
  28. package/dist/payments/paymentsSchemas.d.ts +32 -0
  29. package/dist/payments/paymentsSchemas.js +20 -1
  30. package/dist/search/searchApi.d.ts +3 -2
  31. package/dist/search/searchApi.js +6 -2
  32. package/dist/search/searchInterfaces.d.ts +3 -2
  33. package/dist/types.d.ts +1 -0
  34. package/dist/user-groups/userGroupsApi.d.ts +81 -0
  35. package/dist/user-groups/userGroupsApi.js +145 -0
  36. package/dist/user-groups/userGroupsInterfaces.d.ts +100 -0
  37. package/dist/user-groups/userGroupsInterfaces.js +2 -0
  38. package/dist/user-groups/userGroupsSchemas.d.ts +55 -0
  39. package/dist/user-groups/userGroupsSchemas.js +35 -0
  40. package/dist/users/usersApi.js +3 -3
  41. package/esm/auth-provider/authProviderApi.js +3 -2
  42. package/esm/base/asyncModules.d.ts +18 -0
  43. package/esm/base/asyncModules.js +34 -1
  44. package/esm/base/syncModules.d.ts +10 -3
  45. package/esm/base/syncModules.js +25 -14
  46. package/esm/base/utils.d.ts +5 -2
  47. package/esm/base/validation.d.ts +7 -5
  48. package/esm/base/validation.js +7 -4
  49. package/esm/discounts/discountsApi.d.ts +3 -3
  50. package/esm/discounts/discountsApi.js +1 -1
  51. package/esm/discounts/discountsInterfaces.d.ts +15 -3
  52. package/esm/file-uploading/fileUploadingApi.d.ts +27 -1
  53. package/esm/file-uploading/fileUploadingApi.js +42 -0
  54. package/esm/file-uploading/fileUploadingInterfaces.d.ts +102 -1
  55. package/esm/file-uploading/fileUploadingSchemas.d.ts +73 -0
  56. package/esm/file-uploading/fileUploadingSchemas.js +46 -0
  57. package/esm/forms-data/formsDataInterfaces.d.ts +130 -3
  58. package/esm/index.d.ts +4 -0
  59. package/esm/index.js +3 -0
  60. package/esm/orders/ordersApi.d.ts +14 -0
  61. package/esm/orders/ordersApi.js +19 -0
  62. package/esm/orders/ordersInterfaces.d.ts +11 -0
  63. package/esm/payments/paymentsApi.d.ts +14 -1
  64. package/esm/payments/paymentsApi.js +18 -0
  65. package/esm/payments/paymentsInterfaces.d.ts +43 -1
  66. package/esm/payments/paymentsSchemas.d.ts +32 -0
  67. package/esm/payments/paymentsSchemas.js +19 -0
  68. package/esm/search/searchApi.d.ts +3 -2
  69. package/esm/search/searchApi.js +6 -2
  70. package/esm/search/searchInterfaces.d.ts +3 -2
  71. package/esm/types.d.ts +1 -0
  72. package/esm/user-groups/userGroupsApi.d.ts +81 -0
  73. package/esm/user-groups/userGroupsApi.js +106 -0
  74. package/esm/user-groups/userGroupsInterfaces.d.ts +100 -0
  75. package/esm/user-groups/userGroupsInterfaces.js +1 -0
  76. package/esm/user-groups/userGroupsSchemas.d.ts +55 -0
  77. package/esm/user-groups/userGroupsSchemas.js +32 -0
  78. package/esm/users/usersApi.js +3 -3
  79. package/package.json +2 -2
@@ -22,3 +22,76 @@ export declare const UploadResponseSchema: z.ZodArray<z.ZodObject<{
22
22
  size: z.ZodNumber;
23
23
  contentType: z.ZodString;
24
24
  }, z.core.$strip>>;
25
+ /**
26
+ * One record a found file is attached to
27
+ */
28
+ export declare const FileSearchOwnerSchema: z.ZodObject<{
29
+ tableName: z.ZodString;
30
+ dataId: z.ZodNumber;
31
+ title: z.ZodString;
32
+ langCode: z.ZodString;
33
+ }, z.core.$strip>;
34
+ /**
35
+ * Matching fragment of a found file
36
+ */
37
+ export declare const FileSearchSnippetSchema: z.ZodObject<{
38
+ text: z.ZodString;
39
+ pageFrom: z.ZodNullable<z.ZodNumber>;
40
+ }, z.core.$strip>;
41
+ /**
42
+ * One found file
43
+ */
44
+ export declare const FileSearchItemSchema: z.ZodObject<{
45
+ id: z.ZodNumber;
46
+ storageKey: z.ZodString;
47
+ extension: z.ZodString;
48
+ title: z.ZodNullable<z.ZodString>;
49
+ langCode: z.ZodNullable<z.ZodString>;
50
+ pageCount: z.ZodNullable<z.ZodNumber>;
51
+ rank: z.ZodNumber;
52
+ snippet: z.ZodNullable<z.ZodObject<{
53
+ text: z.ZodString;
54
+ pageFrom: z.ZodNullable<z.ZodNumber>;
55
+ }, z.core.$strip>>;
56
+ owners: z.ZodArray<z.ZodObject<{
57
+ tableName: z.ZodString;
58
+ dataId: z.ZodNumber;
59
+ title: z.ZodString;
60
+ langCode: z.ZodString;
61
+ }, z.core.$strip>>;
62
+ ownersTotal: z.ZodNumber;
63
+ }, z.core.$strip>;
64
+ /**
65
+ * File content search response
66
+ */
67
+ export declare const FileSearchResponseSchema: z.ZodObject<{
68
+ total: z.ZodNumber;
69
+ offset: z.ZodNumber;
70
+ limit: z.ZodNumber;
71
+ queryLanguage: z.ZodObject<{
72
+ resolved: z.ZodArray<z.ZodString>;
73
+ source: z.ZodString;
74
+ candidates: z.ZodArray<z.ZodString>;
75
+ }, z.core.$strip>;
76
+ warnings: z.ZodArray<z.ZodString>;
77
+ items: z.ZodArray<z.ZodObject<{
78
+ id: z.ZodNumber;
79
+ storageKey: z.ZodString;
80
+ extension: z.ZodString;
81
+ title: z.ZodNullable<z.ZodString>;
82
+ langCode: z.ZodNullable<z.ZodString>;
83
+ pageCount: z.ZodNullable<z.ZodNumber>;
84
+ rank: z.ZodNumber;
85
+ snippet: z.ZodNullable<z.ZodObject<{
86
+ text: z.ZodString;
87
+ pageFrom: z.ZodNullable<z.ZodNumber>;
88
+ }, z.core.$strip>>;
89
+ owners: z.ZodArray<z.ZodObject<{
90
+ tableName: z.ZodString;
91
+ dataId: z.ZodNumber;
92
+ title: z.ZodString;
93
+ langCode: z.ZodString;
94
+ }, z.core.$strip>>;
95
+ ownersTotal: z.ZodNumber;
96
+ }, z.core.$strip>>;
97
+ }, z.core.$strip>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UploadResponseSchema = exports.UploadingReturnSchema = void 0;
3
+ exports.FileSearchResponseSchema = exports.FileSearchItemSchema = exports.FileSearchSnippetSchema = exports.FileSearchOwnerSchema = exports.UploadResponseSchema = exports.UploadingReturnSchema = void 0;
4
4
  /**
5
5
  * Validation schemas for FileUploading module
6
6
  * @description Zod schemas for validating file uploading-related API responses
@@ -20,3 +20,49 @@ exports.UploadingReturnSchema = zod_1.z.object({
20
20
  * Upload response schema (array of upload results)
21
21
  */
22
22
  exports.UploadResponseSchema = zod_1.z.array(exports.UploadingReturnSchema);
23
+ /**
24
+ * One record a found file is attached to
25
+ */
26
+ exports.FileSearchOwnerSchema = zod_1.z.object({
27
+ tableName: zod_1.z.string(),
28
+ dataId: zod_1.z.number(),
29
+ title: zod_1.z.string(),
30
+ langCode: zod_1.z.string(),
31
+ });
32
+ /**
33
+ * Matching fragment of a found file
34
+ */
35
+ exports.FileSearchSnippetSchema = zod_1.z.object({
36
+ text: zod_1.z.string(),
37
+ pageFrom: zod_1.z.number().nullable(),
38
+ });
39
+ /**
40
+ * One found file
41
+ */
42
+ exports.FileSearchItemSchema = zod_1.z.object({
43
+ id: zod_1.z.number(),
44
+ storageKey: zod_1.z.string(),
45
+ extension: zod_1.z.string(),
46
+ title: zod_1.z.string().nullable(),
47
+ langCode: zod_1.z.string().nullable(),
48
+ pageCount: zod_1.z.number().nullable(),
49
+ rank: zod_1.z.number(),
50
+ snippet: exports.FileSearchSnippetSchema.nullable(),
51
+ owners: zod_1.z.array(exports.FileSearchOwnerSchema),
52
+ ownersTotal: zod_1.z.number(),
53
+ });
54
+ /**
55
+ * File content search response
56
+ */
57
+ exports.FileSearchResponseSchema = zod_1.z.object({
58
+ total: zod_1.z.number(),
59
+ offset: zod_1.z.number(),
60
+ limit: zod_1.z.number(),
61
+ queryLanguage: zod_1.z.object({
62
+ resolved: zod_1.z.array(zod_1.z.string()),
63
+ source: zod_1.z.string(),
64
+ candidates: zod_1.z.array(zod_1.z.string()),
65
+ }),
66
+ warnings: zod_1.z.array(zod_1.z.string()),
67
+ items: zod_1.z.array(exports.FileSearchItemSchema),
68
+ });
@@ -420,6 +420,133 @@ interface IUpdateFormsData {
420
420
  * Contains an array of data form objects with the following values
421
421
  */
422
422
  type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, unknown>;
423
+ /**
424
+ * Value shapes accepted by a SUBMISSION (`POST /form-data`).
425
+ *
426
+ * For three field kinds they are not the shapes a page attribute uses, and a
427
+ * body written from the read types is refused. Measured on
428
+ * rwah2o.oneentry.cloud, 2026-09-12 and again 2026-09-28 (CMS-888).
429
+ *
430
+ * `list` takes a list of strings; the `[{ title, value }]` form of a page
431
+ * attribute answers `400 formData's marker '<marker>' value[0] must be a string`.
432
+ *
433
+ * `text` takes a one-element array holding exactly ONE of `plainValue`,
434
+ * `htmlValue` or `mdValue`, and no `params`. The object form answers
435
+ * `400 … value must be an array`, `params` answers `… is not allowed`, and two
436
+ * representations answer `Only one of htmlValue, plainValue or mdValue can be provided`.
437
+ *
438
+ * `spam` takes the captcha event, not the bare token.
439
+ */
440
+ type FormDataPostType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyPostTypeText | IBodyPostTypeList | IBodyPostTypeSpam | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | Record<string, unknown>;
441
+ /**
442
+ * Represents a `list` field of a form SUBMISSION.
443
+ * @interface IBodyPostTypeList
444
+ * @property {string} marker - marker name. Example: "recipient".
445
+ * @property {string} type - Type value. Example: "list".
446
+ * @property {string[]} value - Chosen options as plain strings. Example: ["Tom Hoffart"].
447
+ * @example
448
+ {
449
+ "marker": "recipient",
450
+ "type": "list",
451
+ "value": ["Tom Hoffart"]
452
+ }
453
+ * @description A submission sends the chosen options as strings. The `[{ title, value }]`
454
+ * shape a page attribute stores is refused here with `value[0] must be a string`.
455
+ */
456
+ interface IBodyPostTypeList {
457
+ marker: string;
458
+ type: 'list';
459
+ value: string[];
460
+ }
461
+ /**
462
+ * Represents a `text` field of a form SUBMISSION.
463
+ * @interface IBodyPostTypeText
464
+ * @property {string} marker - marker name. Example: "your_message".
465
+ * @property {string} type - Type value. Example: "text".
466
+ * @property {ITextSubmissionValue[]} value - One-element array holding exactly one representation.
467
+ * @example
468
+ {
469
+ "marker": "your_message",
470
+ "type": "text",
471
+ "value": [{ "plainValue": "Hello" }]
472
+ }
473
+ * @description The array holds one object carrying exactly one of `plainValue`,
474
+ * `htmlValue` or `mdValue`. Editor `params` are refused, and so is sending two
475
+ * representations at once.
476
+ */
477
+ interface IBodyPostTypeText {
478
+ marker: string;
479
+ type: 'text';
480
+ value: ITextSubmissionValue[];
481
+ }
482
+ /**
483
+ * @interface ITextSubmissionValuePlain
484
+ * @property {string} plainValue - Plain-text representation. Example: "Hello".
485
+ * @description Plain-text branch of a submitted text value.
486
+ */
487
+ interface ITextSubmissionValuePlain {
488
+ plainValue: string;
489
+ }
490
+ /**
491
+ * @interface ITextSubmissionValueHtml
492
+ * @property {string} htmlValue - HTML representation. Example: "<p>Hello</p>".
493
+ * @description HTML branch of a submitted text value.
494
+ */
495
+ interface ITextSubmissionValueHtml {
496
+ htmlValue: string;
497
+ }
498
+ /**
499
+ * @interface ITextSubmissionValueMd
500
+ * @property {string} mdValue - Markdown representation. Must not be empty. Example: "**Hello**".
501
+ * @description Markdown branch of a submitted text value.
502
+ */
503
+ interface ITextSubmissionValueMd {
504
+ mdValue: string;
505
+ }
506
+ /**
507
+ * Exactly one representation of a submitted text value.
508
+ */
509
+ type ITextSubmissionValue = ITextSubmissionValuePlain | ITextSubmissionValueHtml | ITextSubmissionValueMd;
510
+ /**
511
+ * Represents a `spam` (captcha) field of a form SUBMISSION.
512
+ * @interface IBodyPostTypeSpam
513
+ * @property {string} marker - marker name. Example: "spam".
514
+ * @property {string} type - Type value. Example: "spam".
515
+ * @property {ICaptchaValue} value - The captcha event, not the bare token.
516
+ * @example
517
+ {
518
+ "marker": "spam",
519
+ "type": "spam",
520
+ "value": { "event": { "token": "<reCAPTCHA v3 token>", "siteKey": "6Ldjk7Yt…" } }
521
+ }
522
+ * @description The field carries a reCAPTCHA v3 token obtained in the browser.
523
+ * A bare string is refused with the same sentence as a wrong token —
524
+ * `Captcha Validation Failed, captcha type is: google` — so a malformed value
525
+ * is indistinguishable from a bot.
526
+ */
527
+ interface IBodyPostTypeSpam {
528
+ marker: string;
529
+ type: 'spam';
530
+ value: ICaptchaValue;
531
+ }
532
+ /**
533
+ * @interface ICaptchaEvent
534
+ * @property {string} token - The token issued by the captcha provider in the browser.
535
+ * @property {string} siteKey - The site key the token was issued for. Example: "6Ldjk7Yt…".
536
+ * @description The captcha payload of a `spam` field.
537
+ */
538
+ interface ICaptchaEvent {
539
+ token: string;
540
+ siteKey: string;
541
+ }
542
+ /**
543
+ * @interface ICaptchaValue
544
+ * @property {ICaptchaEvent} event - The captcha payload.
545
+ * @description Wrapper the platform expects around the captcha payload.
546
+ */
547
+ interface ICaptchaValue {
548
+ event: ICaptchaEvent;
549
+ }
423
550
  /**
424
551
  * Represents the structure of the body for posting form data.
425
552
  * @interface IBodyPostFormData
@@ -428,7 +555,7 @@ type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeTe
428
555
  * @property {string} moduleEntityIdentifier - Text identifier (marker) of the module entity. Example: "blog".
429
556
  * @property {string | null} replayTo - Email to reply to. Example: "some@email.com".
430
557
  * @property {string} status - Status of the form. Example: "sent".
431
- * @property {FormDataType[]} formData - Array of form data objects.
558
+ * @property {FormDataPostType[]} formData - Array of form data objects. A submission's value shapes differ from the read shapes — see FormDataPostType.
432
559
  * @example
433
560
  [
434
561
  {
@@ -455,7 +582,7 @@ interface IBodyPostFormData {
455
582
  moduleEntityIdentifier: string;
456
583
  replayTo: string | null;
457
584
  status: string;
458
- formData: FormDataType[];
585
+ formData: FormDataPostType[];
459
586
  fileQuery?: IUploadingQuery;
460
587
  }
461
588
  /**
@@ -711,4 +838,4 @@ interface IListOptionValue {
711
838
  value: string;
712
839
  extended: IListOptionExtended;
713
840
  }
714
- export type { FormDataStatus, FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
841
+ 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, };
package/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ import SystemApi from './system/systemApi';
28
28
  import TemplatesApi from './templates/templatesApi';
29
29
  import TemplatePreviewsApi from './templates-preview/templatesPreviewApi';
30
30
  import UserActivityApi from './user-activity/userActivityApi';
31
+ import UserGroupsApi from './user-groups/userGroupsApi';
31
32
  import UsersApi from './users/usersApi';
32
33
  import WsApi from './web-socket/wsApi';
33
34
  export { getAdditionalFields, getAttributeFile, getAttributeFiles, isFileAttribute, isListAttribute, isNumberAttribute, isStringAttribute, } from './base/attributes';
@@ -62,6 +63,7 @@ export type * from './types';
62
63
  * @property {TemplatesApi} Templates - Templates API module.
63
64
  * @property {TemplatePreviewsApi} TemplatePreviews - Template previews API module.
64
65
  * @property {UserActivityApi} UserActivity - User activity API module.
66
+ * @property {UserGroupsApi} UserGroups - User groups API module.
65
67
  * @property {UsersApi} Users - Users API module.
66
68
  * @property {WsApi} WS - WebSocket API module.
67
69
  */
@@ -118,6 +120,8 @@ interface IDefineApi {
118
120
  TemplatePreviews: TemplatePreviewsApi;
119
121
  /** User/guest activity tracking: trackUserActivity */
120
122
  UserActivity: UserActivityApi;
123
+ /** User groups tree: getUserGroups, getRootUserGroups, getUserGroupByMarker, getChildUserGroupsByMarker */
124
+ UserGroups: UserGroupsApi;
121
125
  /** Current authenticated user: getUser, updateUser */
122
126
  Users: UsersApi;
123
127
  /** WebSocket real-time updates */
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ const systemApi_1 = __importDefault(require("./system/systemApi"));
35
35
  const templatesApi_1 = __importDefault(require("./templates/templatesApi"));
36
36
  const templatesPreviewApi_1 = __importDefault(require("./templates-preview/templatesPreviewApi"));
37
37
  const userActivityApi_1 = __importDefault(require("./user-activity/userActivityApi"));
38
+ const userGroupsApi_1 = __importDefault(require("./user-groups/userGroupsApi"));
38
39
  const usersApi_1 = __importDefault(require("./users/usersApi"));
39
40
  const wsApi_1 = __importDefault(require("./web-socket/wsApi"));
40
41
  var attributes_1 = require("./base/attributes");
@@ -107,6 +108,7 @@ function defineOneEntry(url, config) {
107
108
  const Templates = new templatesApi_1.default(stateModule);
108
109
  const TemplatePreviews = new templatesPreviewApi_1.default(stateModule);
109
110
  const UserActivity = new userActivityApi_1.default(stateModule);
111
+ const UserGroups = new userGroupsApi_1.default(stateModule);
110
112
  const Users = new usersApi_1.default(stateModule);
111
113
  const WS = new wsApi_1.default(stateModule);
112
114
  return {
@@ -136,6 +138,7 @@ function defineOneEntry(url, config) {
136
138
  Templates,
137
139
  TemplatePreviews,
138
140
  UserActivity,
141
+ UserGroups,
139
142
  Users,
140
143
  WS,
141
144
  };
@@ -70,6 +70,20 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
70
70
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderByMarkerAndId getOrderByMarkerAndId} documentation.
71
71
  */
72
72
  getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
73
+ /**
74
+ * Getting a single order created by the user, by its own id.
75
+ * @handleName getOrderById
76
+ * @param {number} id - ID of the order object. Example: 12345.
77
+ * @param {string} [langCode] - Language code. Default: "en_US".
78
+ * @returns {Promise<IOrderByMarkerEntity | IError>} Returns an object with the order.
79
+ * @throws {IError} When isShell=false and an error occurs during the fetch
80
+ * @description This method requires user authorization. Unlike `getOrderByMarkerAndId`,
81
+ * it does not need the storage marker — use it when only the order id is at hand, for
82
+ * example on the return URL of a payment provider or in a link from a notification.
83
+ * @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}.
84
+ * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderById getOrderById} documentation.
85
+ */
86
+ getOrderById(id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
73
87
  /**
74
88
  * Preview order calculation with discounts and coupons (without saving).
75
89
  * @handleName previewOrder
@@ -124,6 +124,25 @@ class OrdersApi extends asyncModules_1.default {
124
124
  const validated = await this._validateResponse(result, schema('OrderEntitySchema'));
125
125
  return this._normalizeData(validated);
126
126
  }
127
+ /**
128
+ * Getting a single order created by the user, by its own id.
129
+ * @handleName getOrderById
130
+ * @param {number} id - ID of the order object. Example: 12345.
131
+ * @param {string} [langCode] - Language code. Default: "en_US".
132
+ * @returns {Promise<IOrderByMarkerEntity | IError>} Returns an object with the order.
133
+ * @throws {IError} When isShell=false and an error occurs during the fetch
134
+ * @description This method requires user authorization. Unlike `getOrderByMarkerAndId`,
135
+ * it does not need the storage marker — use it when only the order id is at hand, for
136
+ * example on the return URL of a payment provider or in a link from a notification.
137
+ * @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}.
138
+ * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderById getOrderById} documentation.
139
+ */
140
+ async getOrderById(id, langCode = this.state.lang) {
141
+ const result = await this._withOrdersUrl(() => this._fetchGet(`/${id}?langCode=${langCode}`));
142
+ // Validate response if validation is enabled
143
+ const validated = await this._validateResponse(result, schema('OrderEntitySchema'));
144
+ return this._normalizeData(validated);
145
+ }
127
146
  /**
128
147
  * Preview order calculation with discounts and coupons (without saving).
129
148
  * @handleName previewOrder
@@ -52,6 +52,17 @@ interface IOrdersApi {
52
52
  * @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}.
53
53
  */
54
54
  getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
55
+ /**
56
+ * Getting a single order created by the user, by its own id.
57
+ * @handleName getOrderById
58
+ * @param {number} id - ID of the order object. Example: 12345.
59
+ * @param {string} [langCode] - Language code. Default: "en_US".
60
+ * @returns {Promise<IOrderByMarkerEntity | IError>} Returns an object with the order.
61
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
62
+ * @description This method gets a single order by its own id, without the storage marker. This method requires user authorization.
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}.
64
+ */
65
+ getOrderById(id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
55
66
  /**
56
67
  * Creation of an order in the order storage.
57
68
  * @handleName createOrder
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
3
  import type { IError } from '../base/utils';
4
- import type { IAccountsEntity, IPaymentsApi, ISessionEntity, ISessionsEntity } from './paymentsInterfaces';
4
+ import type { IAccountsEntity, IPaymentProgress, IPaymentsApi, ISessionEntity, ISessionsEntity } from './paymentsInterfaces';
5
5
  /**
6
6
  * Controllers for working with payments
7
7
  * @handle /api/content/payments
@@ -85,4 +85,17 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
85
85
  * @see {@link https://js-sdk.oneentry.cloud/docs/payments/getAccountById getAccountById} documentation.
86
86
  */
87
87
  getAccountById(id: number): Promise<IAccountsEntity | IError>;
88
+ /**
89
+ * Get the payment progress of an order: its stages and whether they are paid.
90
+ * @handleName getPaymentStagesByOrderId
91
+ * @param {number} id - ID of the order object. Example: 1.
92
+ * @returns {Promise<IPaymentProgress | IError>} Returns the payment progress of the order.
93
+ * @throws {IError} When isShell=false and an error occurs during the fetch
94
+ * @description An order can be paid in stages rather than in one payment — `partial` says
95
+ * which case it is, `completed` says whether nothing is left to pay, and every stage carries
96
+ * its own `status`. This method requires user authorization.
97
+ * @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}.
98
+ * @see {@link https://js-sdk.oneentry.cloud/docs/payments/getPaymentStagesByOrderId getPaymentStagesByOrderId} documentation.
99
+ */
100
+ getPaymentStagesByOrderId(id: number): Promise<IPaymentProgress | IError>;
88
101
  }
@@ -157,5 +157,23 @@ class PaymentsApi extends asyncModules_1.default {
157
157
  const result = await this._fetchGet(`/accounts/${id}`);
158
158
  return this._normalizeData(result);
159
159
  }
160
+ /**
161
+ * Get the payment progress of an order: its stages and whether they are paid.
162
+ * @handleName getPaymentStagesByOrderId
163
+ * @param {number} id - ID of the order object. Example: 1.
164
+ * @returns {Promise<IPaymentProgress | IError>} Returns the payment progress of the order.
165
+ * @throws {IError} When isShell=false and an error occurs during the fetch
166
+ * @description An order can be paid in stages rather than in one payment — `partial` says
167
+ * which case it is, `completed` says whether nothing is left to pay, and every stage carries
168
+ * its own `status`. This method requires user authorization.
169
+ * @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}.
170
+ * @see {@link https://js-sdk.oneentry.cloud/docs/payments/getPaymentStagesByOrderId getPaymentStagesByOrderId} documentation.
171
+ */
172
+ async getPaymentStagesByOrderId(id) {
173
+ const result = await this._fetchGet(`/stages/order/${id}`);
174
+ // Validate response if validation is enabled
175
+ const validated = await this._validateResponse(result, schema('PaymentProgressSchema'));
176
+ return this._normalizeData(validated);
177
+ }
160
178
  }
161
179
  exports.default = PaymentsApi;
@@ -66,6 +66,16 @@ interface IPaymentsApi {
66
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}.
67
67
  */
68
68
  getAccountById(id: number): Promise<IAccountsEntity | IError>;
69
+ /**
70
+ * Get the payment progress of an order: its stages and whether they are paid.
71
+ * @handleName getPaymentStagesByOrderId
72
+ * @param {number} id - ID of the order object. Example: 1.
73
+ * @returns {IPaymentProgress} Returns the payment progress of the order.
74
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
75
+ * @description This method gets the payment stages of an order. This method requires user authorization.
76
+ * @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}.
77
+ */
78
+ getPaymentStagesByOrderId(id: number): Promise<IPaymentProgress | IError>;
69
79
  }
70
80
  /**
71
81
  * @interface ISessionsEntity
@@ -186,4 +196,36 @@ interface IPaymentAccountTestSettings {
186
196
  signingSecretKey?: string;
187
197
  useWebHookValidation?: boolean;
188
198
  }
189
- export type { IAccountsEntity, IIntent, IPaymentAccountSettings, IPaymentAccountTestSettings, IPaymentsApi, ISessionEntity, ISessionsEntity, };
199
+ /**
200
+ * The `IPaymentProgress` interface describes the payment progress of an order.
201
+ * @interface IPaymentProgress
202
+ * @property {boolean} completed - True when every stage of the order has been paid. Example: false.
203
+ * @property {boolean} partial - True when the order is paid in stages rather than in one payment. Example: true.
204
+ * @property {IPaymentStage[]} stages - The stages themselves, in the order the API returns them.
205
+ * @description This interface describes the payment progress of an order — whether it is fully paid, whether it is split into stages, and the stages themselves.
206
+ */
207
+ interface IPaymentProgress {
208
+ completed: boolean;
209
+ partial: boolean;
210
+ stages: IPaymentStage[];
211
+ }
212
+ /**
213
+ * The `IPaymentStage` interface describes one payment stage of an order.
214
+ * @interface IPaymentStage
215
+ * @property {string} marker - Marker of the attribute that set the price of the stage. Example: "part_a".
216
+ * @property {number} sessionId - Identifier of the payment session bound to the stage. Example: 100.
217
+ * @property {number} productId - Identifier of the product the stage belongs to. Example: 200.
218
+ * @property {string} title - Title of the stage. Example: "Part A".
219
+ * @property {number} value - Price of the stage. Example: 150.
220
+ * @property {"planned" | "completed"} status - Stage status: "planned" — not paid yet, "completed" — paid. Example: "planned".
221
+ * @description This interface describes one payment stage of an order.
222
+ */
223
+ interface IPaymentStage {
224
+ marker: string;
225
+ sessionId: number;
226
+ productId: number;
227
+ title: string;
228
+ value: number;
229
+ status: 'planned' | 'completed';
230
+ }
231
+ export type { IAccountsEntity, IIntent, IPaymentAccountSettings, IPaymentAccountTestSettings, IPaymentProgress, IPaymentsApi, IPaymentStage, ISessionEntity, ISessionsEntity, };
@@ -92,3 +92,35 @@ export declare const PaymentAccountsResponseSchema: z.ZodArray<z.ZodObject<{
92
92
  localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
93
93
  updatedDate: z.ZodString;
94
94
  }, z.core.$strip>>;
95
+ /**
96
+ * Payment stage schema
97
+ */
98
+ export declare const PaymentStageSchema: z.ZodObject<{
99
+ marker: z.ZodString;
100
+ sessionId: z.ZodNumber;
101
+ productId: z.ZodNumber;
102
+ title: z.ZodString;
103
+ value: z.ZodNumber;
104
+ status: z.ZodEnum<{
105
+ completed: "completed";
106
+ planned: "planned";
107
+ }>;
108
+ }, z.core.$strip>;
109
+ /**
110
+ * Payment progress schema — stages of one order plus their aggregate state
111
+ */
112
+ export declare const PaymentProgressSchema: z.ZodObject<{
113
+ completed: z.ZodBoolean;
114
+ partial: z.ZodBoolean;
115
+ stages: z.ZodArray<z.ZodObject<{
116
+ marker: z.ZodString;
117
+ sessionId: z.ZodNumber;
118
+ productId: z.ZodNumber;
119
+ title: z.ZodString;
120
+ value: z.ZodNumber;
121
+ status: z.ZodEnum<{
122
+ completed: "completed";
123
+ planned: "planned";
124
+ }>;
125
+ }, z.core.$strip>>;
126
+ }, z.core.$strip>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PaymentAccountsResponseSchema = exports.PaymentAccountSchema = exports.SinglePaymentSessionSchema = exports.PaymentSessionsResponseSchema = exports.PaymentSessionSchema = void 0;
3
+ exports.PaymentProgressSchema = exports.PaymentStageSchema = exports.PaymentAccountsResponseSchema = exports.PaymentAccountSchema = exports.SinglePaymentSessionSchema = exports.PaymentSessionsResponseSchema = exports.PaymentSessionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  /**
6
6
  * Payment session schema
@@ -54,3 +54,22 @@ exports.PaymentAccountSchema = zod_1.z.object({
54
54
  * Payment accounts response schema
55
55
  */
56
56
  exports.PaymentAccountsResponseSchema = zod_1.z.array(exports.PaymentAccountSchema);
57
+ /**
58
+ * Payment stage schema
59
+ */
60
+ exports.PaymentStageSchema = zod_1.z.object({
61
+ marker: zod_1.z.string(),
62
+ sessionId: zod_1.z.number(),
63
+ productId: zod_1.z.number(),
64
+ title: zod_1.z.string(),
65
+ value: zod_1.z.number(),
66
+ status: zod_1.z.enum(['planned', 'completed']),
67
+ });
68
+ /**
69
+ * Payment progress schema — stages of one order plus their aggregate state
70
+ */
71
+ exports.PaymentProgressSchema = zod_1.z.object({
72
+ completed: zod_1.z.boolean(),
73
+ partial: zod_1.z.boolean(),
74
+ stages: zod_1.z.array(exports.PaymentStageSchema),
75
+ });
@@ -26,10 +26,11 @@ export default class SearchApi extends AsyncModules implements ISearchApi {
26
26
  * @param {'all' | 'visible' | 'hidden'} [visibility] - Visibility filter of the searched records. Default: "all".
27
27
  * @param {number} [offset] - Drilldown mode offset. Pass it only together with a single accessible type in `types`.
28
28
  * @param {number} [limit] - Drilldown mode page size. Pass it only together with a single accessible type in `types`, otherwise the API answers 400 "Drilldown mode (limit/offset) requires exactly one accessible type in `types`". Without it every group is returned in full.
29
+ * @param {string} [langCode] - Language code. Default: "en_US". The search index is per language: a word of a second locale is found only when its own langCode is sent (CMS-912).
29
30
  * @returns {Promise<IGlobalSearchResponse | IError>} Returns the query and the found records grouped by entity type.
30
31
  * @throws {IError} When isShell=false and an error occurs during the fetch
31
- * @description Searches names and attribute values of visible records across entity types.
32
+ * @description Searches names and attribute values of visible records across entity types. The index is per language — the request carries `langCode`, so a bilingual project finds a word of either locale.
32
33
  * @see {@link https://js-sdk.oneentry.cloud/docs/search/globalSearch globalSearch} documentation.
33
34
  */
34
- globalSearch(query: string, types?: TGlobalSearchEntityType[], visibility?: 'all' | 'visible' | 'hidden', offset?: number, limit?: number): Promise<IGlobalSearchResponse | IError>;
35
+ globalSearch(query: string, types?: TGlobalSearchEntityType[], visibility?: 'all' | 'visible' | 'hidden', offset?: number, limit?: number, langCode?: string): Promise<IGlobalSearchResponse | IError>;
35
36
  }
@@ -64,19 +64,23 @@ class SearchApi extends asyncModules_1.default {
64
64
  * @param {'all' | 'visible' | 'hidden'} [visibility] - Visibility filter of the searched records. Default: "all".
65
65
  * @param {number} [offset] - Drilldown mode offset. Pass it only together with a single accessible type in `types`.
66
66
  * @param {number} [limit] - Drilldown mode page size. Pass it only together with a single accessible type in `types`, otherwise the API answers 400 "Drilldown mode (limit/offset) requires exactly one accessible type in `types`". Without it every group is returned in full.
67
+ * @param {string} [langCode] - Language code. Default: "en_US". The search index is per language: a word of a second locale is found only when its own langCode is sent (CMS-912).
67
68
  * @returns {Promise<IGlobalSearchResponse | IError>} Returns the query and the found records grouped by entity type.
68
69
  * @throws {IError} When isShell=false and an error occurs during the fetch
69
- * @description Searches names and attribute values of visible records across entity types.
70
+ * @description Searches names and attribute values of visible records across entity types. The index is per language — the request carries `langCode`, so a bilingual project finds a word of either locale.
70
71
  * @see {@link https://js-sdk.oneentry.cloud/docs/search/globalSearch globalSearch} documentation.
71
72
  */
72
- async globalSearch(query, types, visibility, offset, limit) {
73
+ async globalSearch(query, types, visibility, offset, limit, langCode = this.state.lang) {
73
74
  // `types` is sent comma-separated — the array stringifies to exactly that.
75
+ // `langCode` is not optional decoration: the index is per language, and
76
+ // without it a word of a second locale answers an empty group (CMS-912).
74
77
  const params = {
75
78
  q: query,
76
79
  types,
77
80
  visibility,
78
81
  offset,
79
82
  limit,
83
+ langCode,
80
84
  };
81
85
  const data = await this._fetchGet(`?` + this._queryParamsToString(params));
82
86
  const validated = await this._validateResponse(data, schema('GlobalSearchResponseSchema'));
@@ -13,11 +13,12 @@ interface ISearchApi {
13
13
  * @param {'all' | 'visible' | 'hidden'} [visibility] - Visibility filter of the searched records. Default: "all".
14
14
  * @param {number} [offset] - Drilldown mode offset. Pass it only together with a single accessible type in `types`.
15
15
  * @param {number} [limit] - Drilldown mode page size. Pass it only together with a single accessible type in `types`, otherwise the API answers 400 "Drilldown mode (limit/offset) requires exactly one accessible type in `types`". Without it every group is returned in full.
16
+ * @param {string} [langCode] - Language code. Default: "en_US". The search index is per language: a word of a second locale is found only when its own langCode is sent (CMS-912).
16
17
  * @returns {Promise<IGlobalSearchResponse | IError>} Returns the query and the found records grouped by entity type.
17
18
  * @throws {IError} When isShell=false and an error occurs during the fetch
18
- * @description Searches names and attribute values of visible records across entity types.
19
+ * @description Searches names and attribute values of visible records across entity types. The index is per language — the request carries `langCode`, so a bilingual project finds a word of either locale.
19
20
  */
20
- globalSearch(query: string, types?: TGlobalSearchEntityType[], visibility?: 'all' | 'visible' | 'hidden', offset?: number, limit?: number): Promise<IGlobalSearchResponse | IError>;
21
+ globalSearch(query: string, types?: TGlobalSearchEntityType[], visibility?: 'all' | 'visible' | 'hidden', offset?: number, limit?: number, langCode?: string): Promise<IGlobalSearchResponse | IError>;
21
22
  }
22
23
  /**
23
24
  * Entity type a global search group or item belongs to.
package/dist/types.d.ts CHANGED
@@ -31,5 +31,6 @@ export type * from './system/systemInterfaces';
31
31
  export type * from './templates/templatesInterfaces';
32
32
  export type * from './templates-preview/templatesPreviewInterfaces';
33
33
  export type * from './user-activity/userActivityInterfaces';
34
+ export type * from './user-groups/userGroupsInterfaces';
34
35
  export type * from './users/usersInterfaces';
35
36
  export type * from './web-socket/wsInterfaces';