oneentry 1.0.116 → 1.0.118

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 CHANGED
@@ -200,6 +200,9 @@ Now you can use the following links to jump to specific entries:
200
200
 
201
201
  ## <h2 id="admins"> Admins </h2>
202
202
 
203
+ The "Administrators" module is designed for creating and managing administrators.
204
+ An administrator is a user who can add, update, and edit information on the website or in the mobile application.
205
+
203
206
  ```js
204
207
  const { Admins } = defineOneEntry('your-url');
205
208
  ```
@@ -354,6 +357,54 @@ const result = await Admins.getAdminsInfo(body, 'en_US', 0, 30);
354
357
 
355
358
  ## <h2 id="attributesets"> AttributesSets </h2>
356
359
 
360
+ Attributes are an entity that allows you to configure the structure of your application. With them, you can achieve maximum flexibility and eliminate hardcoding.
361
+
362
+ Attribute sets are similar to a collection of properties, the values of which you can manage through the admin panel. They differ by the type of binding to various entities. You can read more about the types in the section "Types".
363
+
364
+ An attribute set forms the data structure that can then be used within your project. For example, for a product, you can define that its structure should contain a name, image, price, and text description. At the same time, the structure of a blog post may contain text with a title and a set of images.
365
+
366
+ Some attributes may be similar in structure and used in different entities, so you can reuse attribute sets for different entities.
367
+
368
+ Structure
369
+ Each attribute set contains a customizable collection of attributes that store the content of your project. You can manage these attributes from the management system. This is convenient, as you no longer need to edit the application code to change your project. Just move all content components that can be changed into attributes.
370
+
371
+ Markers
372
+ Markers cannot contain spaces and cannot start with a digit. If you attempt to enter invalid values in the marker field, the system will ignore the input.
373
+
374
+ Name
375
+ To make it easier for you to navigate, each attribute has a required name parameter, which is a non-unique string. Name the attributes in a way that makes it easy for you to work with them.
376
+
377
+ Marker
378
+ As an identifier, each attribute has a required parameter - "marker", which is a unique string. The marker is also used as a key to access the attributes in your project code. Keep this in mind when setting the attribute marker to avoid syntax conflicts.
379
+
380
+ Data Type
381
+ Choose the data type for each attribute field that it will store.
382
+
383
+ Data types can be of the following types:
384
+
385
+ String: Simple text, for example, "Hello, world!".
386
+ Text: Longer text, often formatted, for example, an article or a letter.
387
+ Text with Header: Text with a header that can be used to denote a topic or category.
388
+ Integer: An integer, for example, 5, 100, -2.
389
+ Float: A data type for floating-point numbers that can have a decimal part, for example, 3.14, 1.5, -0.25.
390
+ Real: The same as Float, but with higher precision.
391
+ Date and Time: A combination of date and time, for example, 2023-10-27 10:00:00.
392
+ Date: A date, for example, 2023-10-27.
393
+ Time: A time, for example, 10:00:00.
394
+ File: Any file on your computer, for example, a document, image, music.
395
+ Image: An image, for example, a photograph, drawing.
396
+ Group of Images: A collection of images, for example, a photo album.
397
+ Radio Button: A selection button from which only one option can be chosen.
398
+ List: A list of items, for example, a shopping list.
399
+ Entity: An entity representing an object from the real world, for example, a person, place, organization.
400
+ The content filling interface will correspond to the selected data type for each attribute field.
401
+
402
+ Opportunities
403
+ You can add validators for attributes. This mechanism is discussed in more detail in the section "Validators".
404
+
405
+ Attributes
406
+ If one attribute set is used by several entities at once, you need to be careful when changing the attributes of that set. For example, if you delete one of the attributes, that attribute will be removed everywhere it is used along with the content. If you add a new attribute to the set, that attribute will also be added everywhere the attribute set is used.
407
+
357
408
  ```js
358
409
  const { AttributesSets } = defineOneEntry('your-url');
359
410
  ```
@@ -793,6 +844,8 @@ Example return:
793
844
 
794
845
  ## <h2 id="authprovider"> User Auth Provider </h2>
795
846
 
847
+ The User Auth Provider in OneEntry Headless CMS facilitates user authentication and registration through various methods, such as email. By using the AuthProvider object, developers can handle user registration, including sending activation codes when necessary. The system supports diverse data types for form attributes, allowing comprehensive user data management. Key functionalities include user authentication, token management (access and refresh tokens), password changes, and logout. Additionally, it provides methods to manage authentication providers and retrieve specific details by marker or language code, ensuring secure and efficient user management across applications.
848
+
796
849
  ```js
797
850
  const { AuthProvider } = defineOneEntry('your-url');
798
851
  ```
@@ -1900,6 +1953,10 @@ Example return:
1900
1953
 
1901
1954
  ## <h2 id="blocks"> Blocks </h2>
1902
1955
 
1956
+ The "Blocks" module is designed to create structures that contain sets of attributes. The Headless CMS OneEntry provides users with very flexible tools, and you can use the "Blocks" module as you see fit for your specific case. The main concept of the "Blocks" module is to create reusable entities (blocks) that contain sets of attributes and additional content.
1957
+
1958
+ For example, you can create a block - "footer" and use it on all pages of your project.
1959
+
1903
1960
  ```js
1904
1961
  const { Blocks } = defineOneEntry('your-url');
1905
1962
  ```
@@ -2206,10 +2263,17 @@ Example return:
2206
2263
 
2207
2264
  ## <h2 id="events"> Events </h2>
2208
2265
 
2266
+ The "Events" module allows you to create and edit events, through which you can interact with the users of your system. In this module, you select an event that the system will respond to and send notifications to the users of your system. For example, you have statuses for catalog items "In stock" and "Out of stock," and you want to send users a notification about the status change from "Out of stock" to "In stock"
2267
+
2209
2268
  ```js
2210
2269
  const { Events } = defineOneEntry('your-url');
2211
2270
  ```
2212
2271
 
2272
+ In the Headless CMS OneEntry, there are three ways to interact with the users of your system through the "Events" module: <br/>
2273
+ Push Notification <br/>
2274
+ Email <br/>
2275
+ Socket IO <br/>
2276
+
2213
2277
  ### Events.getAllSubscriptions(offset, limit)
2214
2278
 
2215
2279
  Returns all subscriptions to products 🔐 This method requires authorization.
@@ -2327,6 +2391,8 @@ This method unsubscribes to the product event. Returns nothing if the unsubscrip
2327
2391
 
2328
2392
  ## <h2 id="fileuploading"> FileUploading </h2>
2329
2393
 
2394
+ FileUploading in OneEntry Headless CMS provides methods for managing files in cloud storage. The upload method allows uploading files with optional parameters such as type, entity, ID, and image optimization options. It returns information about the uploaded file, including its name and download link. The delete method removes a file from storage by its name and specified parameters. The getFile method searches for and returns a file object based on provided parameters such as ID, type, entity, and filename.
2395
+
2330
2396
  ```js
2331
2397
  const { FileUploading } = defineOneEntry('your-url');
2332
2398
  ```
@@ -2513,6 +2579,8 @@ Example return:
2513
2579
 
2514
2580
  ## <h2 id="forms"> Forms </h2>
2515
2581
 
2582
+ The "Forms" module is a user-friendly tool for creating and managing various forms, such as contact forms, surveys, and registration sheets. With an intuitive interface, users can add form elements, customize layouts, and apply themes. The module supports organizing and categorizing forms, setting access permissions, and tracking responses in real-time. Automation features include notifications upon form submissions and integration with applications.
2583
+
2516
2584
  ```js
2517
2585
  const { Forms } = defineOneEntry('your-url');
2518
2586
  ```
@@ -2769,6 +2837,8 @@ Example return:
2769
2837
 
2770
2838
  ## <h2 id="formsdata"> FormData </h2>
2771
2839
 
2840
+ The FormData module in OneEntry Headless CMS allows for managing and interacting with form data. By using the defineOneEntry function, you can create a FormData object to handle various operations. The module supports different data types such as strings, numbers, dates, text, images, files, lists, and nested entities. It provides methods like getFormsData, postFormsData, and getFormsDataByMarker for retrieving, creating, and searching form data. Each method interacts with the API to perform these tasks, returning structured JSON objects with detailed information about the form data, including identifiers, timestamps, and language-specific data.
2841
+
2772
2842
  ```js
2773
2843
  const { FormData } = defineOneEntry('your-url');
2774
2844
  ```
@@ -3193,6 +3263,8 @@ Example return:
3193
3263
 
3194
3264
  ## <h2 id="generaltypes"> GeneralTypes </h2>
3195
3265
 
3266
+ The `GeneralTypes` module in OneEntry Headless CMS is designed to manage and retrieve general types used within the system. By using the `defineOneEntry` function, you can create a `GeneralTypes` object to interact with these types. The primary method available is `getAllTypes`, which retrieves all objects of type `GeneralTypeEntity` from the API. This method returns a Promise that resolves to an array of `GeneralTypeEntity` objects, each containing an `id` and a `type`. The types cover various purposes, such as page layouts, forms, product blocks, and more, providing flexibility for different content management needs.
3267
+
3196
3268
  ```js
3197
3269
  const { GeneralTypes } = defineOneEntry('your-url');
3198
3270
  ```
@@ -3237,6 +3309,8 @@ Example return:
3237
3309
 
3238
3310
  ## <h2 id="integrationcollections">IntegrationCollections</h2>
3239
3311
 
3312
+ Integration Collections is a module for storing various data that can be used for integrating different services and systems. To integrate third-party services, it is necessary to create and configure collections.
3313
+
3240
3314
  ```js
3241
3315
  const { IntegrationCollections } = defineOneEntry('your-url');
3242
3316
  ```
@@ -3845,6 +3919,8 @@ Returns true (in case of successful deletion) or false (in case of unsuccessful
3845
3919
 
3846
3920
  ## <h2 id="locales"> Locales </h2>
3847
3921
 
3922
+ Thanks to the support of multiple languages in Oneentry Headless CMS, you can flexibly customize the interface of your dashboard and conveniently manage languages in your project. In this section, you can learn about the principles of working with languages.
3923
+
3848
3924
  ```js
3849
3925
  const { Locales } = defineOneEntry('your-url');
3850
3926
  ```
@@ -3917,6 +3993,24 @@ Example return:
3917
3993
 
3918
3994
  ## <h2 id="menus"> Menus </h2>
3919
3995
 
3996
+ The menu is a key element of the structure and navigation of your site. With the menu, you provide visitors with a convenient way to navigate through different sections of your application and find the information they need.
3997
+
3998
+ In OneEntry Headless CMS, you can create the menu structure directly from your personal account. This allows you to change the set of pages included in the menu, their order, and titles without modifying the source code of your application.
3999
+
4000
+ Additionally, if necessary, you can create nested levels in the menu, allowing for a tree-like structure with sections and subsections.
4001
+
4002
+ All of this enables you to work conveniently and flexibly with the navigation of your application directly from your personal account.
4003
+
4004
+ At the core of the menu are pages. The menu structure is created from pages.
4005
+
4006
+ You can define:
4007
+
4008
+ Which pages will be included in the menu
4009
+ In what order they will be presented to the user
4010
+ What title will be given to the menu item leading to a specific page
4011
+ The nesting of menu items (Tree structure)
4012
+ Some of these concepts were discussed in the pages section, and some page settings affect the menu structure you can create from these pages.
4013
+
3920
4014
  ```js
3921
4015
  const { Menus } = defineOneEntry('your-url')
3922
4016
  ```
@@ -3994,6 +4088,8 @@ Example return:
3994
4088
 
3995
4089
  ## <h2 id="orders"> Orders </h2>
3996
4090
 
4091
+ The ability to make and pay for goods or services is an integral part of the E-commerce application. In this section, you can familiarize yourself with the principles of working with orders.
4092
+
3997
4093
  ```js
3998
4094
  const { Orders } = defineOneEntry('your-url');
3999
4095
  ```
@@ -4673,6 +4769,8 @@ Example return:
4673
4769
 
4674
4770
  ## <h2 id="pages"> Pages </h2>
4675
4771
 
4772
+ The Pages module in the Headless CMS OneEntry interface allows you to manage pages if it is a web application, or screens if it is a mobile application.
4773
+
4676
4774
  ```js
4677
4775
  const { Pages } = defineOneEntry('your-url');
4678
4776
  ```
@@ -5596,6 +5694,8 @@ Example return:
5596
5694
 
5597
5695
  ## <h2 id="payments"> Payments </h2>
5598
5696
 
5697
+ An important part of the E-commerce application is working with payments. In this section, you can learn about the principles of working with payments.
5698
+
5599
5699
  ```js
5600
5700
  const { Payments } = defineOneEntry('your-url');
5601
5701
  ```
@@ -6244,6 +6344,8 @@ This method use webhook for Stripe. Returns true (in case of successful executio
6244
6344
 
6245
6345
  ## <h2 id="products"> Products </h2>
6246
6346
 
6347
+ Products is a separate module in the Headless CMS OneEntry interface that allows you to create a product catalog or a set of multimedia elements, such as a gallery.
6348
+
6247
6349
  ```js
6248
6350
  const { Products } = defineOneEntry('your-url');
6249
6351
  ```
@@ -8092,6 +8194,8 @@ Example return:
8092
8194
 
8093
8195
  ## <h2 id="productstatuses"> ProductStatuses </h2>
8094
8196
 
8197
+ To create additional filtering conditions for catalog items in Headless CMS OneEntry, the functionality of Product Statuses has been added. In this tab, you can create a status that will serve as an additional filter alongside the existing conditions from attributes.
8198
+
8095
8199
  ```js
8096
8200
  const { ProductStatuses } = defineOneEntry('your-url');
8097
8201
  ```
@@ -8297,6 +8401,8 @@ true
8297
8401
 
8298
8402
  ## <h2 id="system"> System </h2>
8299
8403
 
8404
+ The System module in OneEntry Headless CMS provides methods for testing error page redirections, allowing developers to ensure that their error handling mechanisms are functioning correctly. By using the defineOneEntry function, you can create a System object to access these functionalities. The module offers two primary methods: test404 and test500. Both methods simulate scenarios where the user is redirected to an error page, specifically 404 (Not Found) and 500 (Internal Server Error) pages, respectively. These tools are essential for verifying that the system's error pages are correctly implemented and displayed to users when needed.
8405
+
8300
8406
  ```js
8301
8407
  const { System } = defineOneEntry('your-url');
8302
8408
  ```
@@ -8321,6 +8427,8 @@ const value = await System.test500()
8321
8427
 
8322
8428
  ## <h2 id="templates"> Templates </h2>
8323
8429
 
8430
+ Templates help configure the display of the content part of your application. Some templates affect the images stored in the CMS system, while others influence the appearance of other entities, such as blocks, pages, products, etc. In this section, you can familiarize yourself with the principles of working with templates.
8431
+
8324
8432
  ```js
8325
8433
  const { Templates } = defineOneEntry('your-url');
8326
8434
  ```
@@ -8679,6 +8787,8 @@ Example return:
8679
8787
 
8680
8788
  ## <h2 id="templatepreviews"> TemplatePreviews </h2>
8681
8789
 
8790
+ Preview templates allow you to configure the image parameters used in attributes. By applying a template to an attribute of type "Image" or "Image Group," you will get images standardized according to the specifications in the preview template. This is convenient if the design of your project is sensitive to image sizes. By configuring the preview template, you can change the image parameters that the end user will see.
8791
+
8682
8792
  ```js
8683
8793
  const { TemplatePreviews } = defineOneEntry('your-url');
8684
8794
  ```
@@ -8998,6 +9108,8 @@ Example return:
8998
9108
 
8999
9109
  ## <h2 id="users"> Users </h2>
9000
9110
 
9111
+ In Headless CMS OneEntry, there are the necessary tools for working with registered users. In this section, you can familiarize yourself with the principles of working with users.
9112
+
9001
9113
  You can store the data necessary for your application to work in a state object. When changing the user, add the necessary data to the state. When the user's data is subsequently received, it will contain a state object.
9002
9114
 
9003
9115
  An example in which we add information to the user about how many orders he has made. Add a field "orderCount" with the value to the state object.
@@ -16,7 +16,7 @@ import type { IError, ILocalizeInfo } from '../base/utils';
16
16
  interface IAuthProvider {
17
17
  signUp(marker: string, data: ISignUpData, langCode?: string): Promise<ISignUpEntity | IError>;
18
18
  generateCode(marker: string, userIdentifier: string, eventIdentifier: string): Promise<void | IError>;
19
- checkCode(marker: string, userIdentifier: string, code: string, eventIdentifier: string): Promise<boolean | IError>;
19
+ checkCode(marker: string, userIdentifier: string, eventIdentifier: string, code: string): Promise<boolean | IError>;
20
20
  activateUser(marker: string, userIdentifier: string, code: string): Promise<boolean | IError>;
21
21
  auth(marker: string, data: IAuthPostBody): Promise<IAuthEntity | IError>;
22
22
  refresh(marker: string, token: string): Promise<IAuthEntity | IError>;
@@ -43,7 +43,7 @@ export default abstract class SyncModules {
43
43
  */
44
44
  protected _clearArray(data: Record<string, any>): any;
45
45
  /**
46
- * sortAttributes
46
+ * Sort attributes by its positions
47
47
  *
48
48
  * @param data
49
49
  * @returns
@@ -58,7 +58,7 @@ export default abstract class SyncModules {
58
58
  * @param days
59
59
  * @returns
60
60
  */
61
- protected _addDays(date: string | number | Date, days: number): Date;
61
+ protected _addDays(date: Date, days: number): Date;
62
62
  /**
63
63
  * Function to generate intervals for a specific date
64
64
  *
@@ -66,18 +66,18 @@ export default abstract class SyncModules {
66
66
  * @param schedule
67
67
  * @param utcIntervals
68
68
  */
69
- protected _generateIntervalsForDate(date: string | number | Date, schedule: {
70
- inEveryWeek: any;
69
+ protected _generateIntervalsForDate(date: Date, schedule: {
70
+ inEveryWeek: boolean;
71
71
  times: any[];
72
- inEveryMonth: any;
73
- }, utcIntervals: any[][]): void;
72
+ inEveryMonth: boolean;
73
+ }, utcIntervals: Set<Array<string>>): void;
74
74
  /**
75
75
  * Add TimeIntervals to schedules
76
76
  *
77
77
  * @param schedules
78
78
  * @returns schedules with timeIntervals
79
79
  */
80
- protected _addTimeIntervalsToSchedules(schedules: any[]): any[];
80
+ _addTimeIntervalsToSchedules(schedules: any[]): any[];
81
81
  /**
82
82
  * normalizeAttr
83
83
  *
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class SyncModules {
4
4
  constructor(state) {
5
5
  /**
6
- * sortAttributes
6
+ * Sort attributes by its positions
7
7
  *
8
8
  * @param data
9
9
  * @returns
@@ -143,40 +143,85 @@ class SyncModules {
143
143
  * @param utcIntervals
144
144
  */
145
145
  _generateIntervalsForDate(date, schedule, utcIntervals) {
146
- // Generate intervals based on weekly repetition
147
- if (schedule.inEveryWeek) {
148
- for (let week = 0; week < 4; week++) {
146
+ // inEveryWeek
147
+ if (schedule.inEveryWeek && !schedule.inEveryMonth) {
148
+ let currentDate = new Date(date);
149
+ // Вычисляем последний день текущего месяца
150
+ const endOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
151
+ while (currentDate <= endOfMonth) {
149
152
  schedule.times.forEach((timeRange) => {
150
153
  const [startTime, endTime] = timeRange;
151
- const intervalStart = this._addDays(date, week * 7);
154
+ const intervalStart = new Date(currentDate);
152
155
  intervalStart.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
153
- const intervalEnd = this._addDays(date, week * 7);
156
+ const intervalEnd = new Date(currentDate);
154
157
  intervalEnd.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
155
- utcIntervals.push([
158
+ // Добавляем строку JSON в Set для уникальности
159
+ utcIntervals.add([
156
160
  intervalStart.toISOString(),
157
161
  intervalEnd.toISOString(),
158
162
  ]);
159
163
  });
164
+ currentDate = this._addDays(currentDate, 7); // Переходим к следующей неделе
160
165
  }
161
166
  }
162
- // Generate intervals based on monthly repetition
163
- if (schedule.inEveryMonth) {
164
- for (let month = 0; month < 12; month++) {
167
+ // inEveryMonth
168
+ if (schedule.inEveryMonth && !schedule.inEveryWeek) {
169
+ const startDate = new Date(date); // Начальная дата
170
+ const targetDayOfMonth = startDate.getUTCDate(); // Определяем день месяца начальной даты
171
+ const numberOfMonths = 12; // Количество месяцев, на которые нужно повторить
172
+ for (let i = 0; i < numberOfMonths; i++) {
173
+ const currentDate = new Date(startDate);
174
+ currentDate.setUTCMonth(currentDate.getUTCMonth() + i);
175
+ // Попробуем установить текущую дату на целевой день месяца
176
+ currentDate.setUTCDate(targetDayOfMonth);
177
+ // Проверяем, не вышли ли мы за пределы месяца
178
+ if (currentDate.getUTCMonth() !== (startDate.getUTCMonth() + i) % 12) {
179
+ continue; // Если вышли, пропускаем этот месяц
180
+ }
165
181
  schedule.times.forEach((timeRange) => {
166
182
  const [startTime, endTime] = timeRange;
167
- const intervalStart = new Date(date);
168
- intervalStart.setUTCMonth(intervalStart.getUTCMonth() + month);
183
+ const intervalStart = new Date(currentDate);
169
184
  intervalStart.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
170
- const intervalEnd = new Date(date);
171
- intervalEnd.setUTCMonth(intervalEnd.getUTCMonth() + month);
185
+ const intervalEnd = new Date(currentDate);
172
186
  intervalEnd.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
173
- utcIntervals.push([
187
+ utcIntervals.add([
174
188
  intervalStart.toISOString(),
175
189
  intervalEnd.toISOString(),
176
190
  ]);
177
191
  });
178
192
  }
179
193
  }
194
+ // inEveryMonth && inEveryWeek
195
+ if (schedule.inEveryMonth && schedule.inEveryWeek) {
196
+ const startDate = new Date(date); // Начальная дата
197
+ const targetDayOfWeek = startDate.getUTCDay(); // Определяем день недели начальной даты
198
+ const numberOfMonths = 12; // Количество месяцев, на которые нужно повторить
199
+ for (let i = 0; i < numberOfMonths; i++) {
200
+ const currentDate = new Date(startDate);
201
+ currentDate.setUTCMonth(currentDate.getUTCMonth() + i);
202
+ currentDate.setUTCDate(1); // Устанавливаем на первый день месяца
203
+ // Находим первый целевой день недели в текущем месяце
204
+ const daysUntilTargetDay = (targetDayOfWeek - currentDate.getUTCDay() + 7) % 7;
205
+ currentDate.setUTCDate(currentDate.getUTCDate() + daysUntilTargetDay);
206
+ // Проходим по всем целевым дням недели в текущем месяце
207
+ while (currentDate.getUTCMonth() ===
208
+ (startDate.getUTCMonth() + i) % 12) {
209
+ schedule.times.forEach((timeRange) => {
210
+ const [startTime, endTime] = timeRange;
211
+ const intervalStart = new Date(currentDate);
212
+ intervalStart.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
213
+ const intervalEnd = new Date(currentDate);
214
+ intervalEnd.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
215
+ utcIntervals.add([
216
+ intervalStart.toISOString(),
217
+ intervalEnd.toISOString(),
218
+ ]);
219
+ });
220
+ // Переходим к следующей неделе (следующему такому же дню недели)
221
+ currentDate.setUTCDate(currentDate.getUTCDate() + 7);
222
+ }
223
+ }
224
+ }
180
225
  }
181
226
  /**
182
227
  * Add TimeIntervals to schedules
@@ -187,23 +232,19 @@ class SyncModules {
187
232
  _addTimeIntervalsToSchedules(schedules) {
188
233
  schedules.forEach((scheduleGroup) => {
189
234
  scheduleGroup.values.forEach((schedule) => {
190
- const utcIntervals = [];
235
+ const utcIntervals = new Set();
191
236
  const startDate = new Date(schedule.dates[0]);
192
237
  const endDate = new Date(schedule.dates[1]);
193
- // Check if the dates are the same
194
238
  const isSameDay = startDate.toISOString() === endDate.toISOString();
195
- // If the dates are the same, process only the first date
196
239
  if (isSameDay) {
197
240
  this._generateIntervalsForDate(startDate, schedule, utcIntervals);
198
241
  }
199
242
  else {
200
- // Otherwise, process each day in the range
201
243
  for (let currentDate = new Date(startDate); currentDate <= endDate; currentDate = this._addDays(currentDate, 1)) {
202
244
  this._generateIntervalsForDate(currentDate, schedule, utcIntervals);
203
245
  }
204
246
  }
205
- // Add calculated intervals to the new field timeIntervals
206
- schedule.timeIntervals = utcIntervals;
247
+ schedule.timeIntervals = Array.from(utcIntervals).sort();
207
248
  });
208
249
  });
209
250
  return schedules;
@@ -225,7 +266,8 @@ class SyncModules {
225
266
  // add timeIntervals
226
267
  if (data.attributeValues[attr].type === 'timeInterval') {
227
268
  const schedules = data.attributeValues[attr].value;
228
- if (typeof schedules === 'object' && schedules.length > 0) {
269
+ // console.log(JSON.stringify(schedules));
270
+ if (Array.isArray(schedules) && schedules.length > 0) {
229
271
  const result = this._addTimeIntervalsToSchedules(schedules);
230
272
  data.attributeValues[attr].value = result;
231
273
  }
@@ -69,6 +69,8 @@ interface IAttributes {
69
69
  type: string;
70
70
  settings?: Record<string, any>;
71
71
  validators: Record<string, any>;
72
+ additionalFields?: any;
73
+ [key: string]: any;
72
74
  }
73
75
  interface ILocalizeInfos {
74
76
  [key: string]: ILocalizeInfo;
@@ -16,12 +16,13 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
16
16
  * @param {File} [data] File objects. Get data as File from your unput as e.target.files[0]
17
17
  *
18
18
  * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
19
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example : "page"
20
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example : "editor"
21
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example : 3787
22
- * @param {number} [fileQuery.width] - Optional width parameter. Example : 0
23
- * @param {number} [fileQuery.height] - Optional height parameter. Example : 0
24
- * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example : true
19
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
20
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
21
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
22
+ * @param {number} [fileQuery.width] - Optional width parameter. Example: 0
23
+ * @param {number} [fileQuery.height] - Optional height parameter. Example: 0
24
+ * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true
25
+ * @param {boolean} [fileQuery.template] - preview template identifier. Example: 1
25
26
  *
26
27
  * @returns Uploads a file to an Amazon S3-compatible cloud file storage
27
28
  */
@@ -32,9 +33,10 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
32
33
  * @param {string} [filename] File name. Example "file.png"
33
34
  *
34
35
  * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
35
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example : "page"
36
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example : "editor"
37
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example : 3787
36
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
37
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
38
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
39
+ * @param {number} [fileQuery.template] - preview template identifier. Example: 1
38
40
  *
39
41
  * @returns Deletes a file from the cloud file storage
40
42
  */
@@ -47,8 +49,9 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
47
49
  * @param {string} [type] - Type, determines the folder name in the storage
48
50
  * @param {string} [entity] - entity name, from which the file is uploaded, determines the folder name in the storage
49
51
  * @param {string} [filename] - Filename. Example "file.png"
52
+ * @param {string} [template] - preview template identifier. Example 1
50
53
  *
51
54
  * @returns Return file as File object
52
55
  */
53
- getFile(id: number, type: string, entity: string, filename?: string): Promise<Blob | IError>;
56
+ getFile(id: number, type: string, entity: string, filename?: string, template?: string): Promise<Blob | IError>;
54
57
  }
@@ -28,12 +28,13 @@ class FileUploadingApi extends asyncModules_1.default {
28
28
  * @param {File} [data] File objects. Get data as File from your unput as e.target.files[0]
29
29
  *
30
30
  * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
31
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example : "page"
32
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example : "editor"
33
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example : 3787
34
- * @param {number} [fileQuery.width] - Optional width parameter. Example : 0
35
- * @param {number} [fileQuery.height] - Optional height parameter. Example : 0
36
- * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example : true
31
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
32
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
33
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
34
+ * @param {number} [fileQuery.width] - Optional width parameter. Example: 0
35
+ * @param {number} [fileQuery.height] - Optional height parameter. Example: 0
36
+ * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true
37
+ * @param {boolean} [fileQuery.template] - preview template identifier. Example: 1
37
38
  *
38
39
  * @returns Uploads a file to an Amazon S3-compatible cloud file storage
39
40
  */
@@ -50,9 +51,10 @@ class FileUploadingApi extends asyncModules_1.default {
50
51
  * @param {string} [filename] File name. Example "file.png"
51
52
  *
52
53
  * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
53
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example : "page"
54
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example : "editor"
55
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example : 3787
54
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
55
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
56
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
57
+ * @param {number} [fileQuery.template] - preview template identifier. Example: 1
56
58
  *
57
59
  * @returns Deletes a file from the cloud file storage
58
60
  */
@@ -69,11 +71,12 @@ class FileUploadingApi extends asyncModules_1.default {
69
71
  * @param {string} [type] - Type, determines the folder name in the storage
70
72
  * @param {string} [entity] - entity name, from which the file is uploaded, determines the folder name in the storage
71
73
  * @param {string} [filename] - Filename. Example "file.png"
74
+ * @param {string} [template] - preview template identifier. Example 1
72
75
  *
73
76
  * @returns Return file as File object
74
77
  */
75
- async getFile(id, type, entity, filename) {
76
- const response = await fetch(this._getFullPath(`?id=${id}&type=${type}&entity=${entity}${filename ? `&filename=${filename}` : ''}`), {
78
+ async getFile(id, type, entity, filename, template) {
79
+ const response = await fetch(this._getFullPath(`?id=${id}&type=${type}&entity=${entity}${filename ? `&filename=${filename}` : ''}${template ? `&template=${template}` : ''}`), {
77
80
  method: 'GET',
78
81
  headers: {
79
82
  'Content-Type': 'application/json',
@@ -40,6 +40,8 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
40
40
  *
41
41
  * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
42
42
  * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
43
+ * @param {number} [userQuery.entityType] - Entity type. Example: 1
44
+ * @param {number} [userQuery.entityId] - Entity identifier. Example: orders
43
45
  *
44
46
  * @returns Returns object ItemsWithTotal, where items is an array of requested objects
45
47
  */
@@ -56,6 +56,8 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
56
56
  *
57
57
  * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
58
58
  * @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
59
+ * @param {number} [userQuery.entityType] - Entity type. Example: 1
60
+ * @param {number} [userQuery.entityId] - Entity identifier. Example: orders
59
61
  *
60
62
  * @returns Returns object ItemsWithTotal, where items is an array of requested objects
61
63
  */
@@ -21,8 +21,8 @@ interface IMenus {
21
21
  */
22
22
  interface IMenusPages {
23
23
  children?: Array<IMenusPages> | IMenusPages;
24
- id: number;
25
- pageUrl: string;
24
+ id: number | null;
25
+ pageUrl: string | null;
26
26
  localizeInfos: ILocalizeInfo;
27
27
  attributeValues: any;
28
28
  position: number;
@@ -90,8 +90,8 @@ interface IBaseOrdersEntity {
90
90
  paymentAccountIdentifier: string;
91
91
  formData: Array<IOrdersFormData>;
92
92
  products: Array<IOrderProductData>;
93
- createdDate: string;
94
- totalSum: string;
93
+ createdDate?: string;
94
+ totalSum: number;
95
95
  currency: string;
96
96
  id: number;
97
97
  statusIdentifier?: string;
@@ -115,5 +115,6 @@ interface IAccountsEntity {
115
115
  localizeInfos: Record<string, any>;
116
116
  type: 'stripe' | 'custom';
117
117
  isVisible: boolean;
118
+ isUsed: boolean;
118
119
  }
119
120
  export type { IAccountsEntity, IConnectedEntity, ICreateSessionEntity, IIntent, IPaymentsApi, ISessionEntity, ISessionItem, ISessionsEntity, };
@@ -100,9 +100,9 @@ interface IProductsEntity {
100
100
  localizeInfos: Record<string, any>;
101
101
  isVisible: boolean;
102
102
  statusIdentifier: string | null;
103
- attributeSetIdentifier: string;
103
+ attributeSetIdentifier: string | null;
104
104
  isSync: number | boolean;
105
- price: number;
105
+ price: number | null;
106
106
  templateIdentifier: string | null;
107
107
  shortDescTemplateIdentifier: string | null;
108
108
  statusLocalizeInfos: Record<string, any>;
@@ -171,8 +171,8 @@ interface IProductBlock {
171
171
  productConfig: {
172
172
  quantity: string | number;
173
173
  countElementsPerRow: string | number;
174
- sortType?: string;
175
- sortOrder?: string;
174
+ sortType?: string | number;
175
+ sortOrder?: string | number;
176
176
  };
177
177
  similarProductRules: Array<{
178
178
  property: string;
@@ -29,7 +29,7 @@ interface ITemplatesPreviewEntity {
29
29
  version: number;
30
30
  identifier: string;
31
31
  attributeValues: AttributeType;
32
- attributeSetIdentifier: string | null;
32
+ attributeSetIdentifier?: string | null;
33
33
  proportion: {
34
34
  horizontal: IProportion | null;
35
35
  vertical: IProportion | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.116",
3
+ "version": "1.0.118",
4
4
  "description": "OneEntry NPM package",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",