oneentry 1.0.159 → 1.0.161

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 (222) hide show
  1. package/README.md +2 -0
  2. package/changelog.md +56 -1
  3. package/dist/admins/adminsApi.d.ts +15 -1
  4. package/dist/admins/adminsApi.js +29 -0
  5. package/dist/admins/adminsInterfaces.d.ts +37 -1
  6. package/dist/base/lazySchema.d.ts +15 -0
  7. package/dist/base/lazySchema.js +20 -0
  8. package/dist/discounts/discountsApi.d.ts +14 -1
  9. package/dist/discounts/discountsApi.js +21 -0
  10. package/dist/discounts/discountsInterfaces.d.ts +27 -1
  11. package/dist/filters/filtersInterfaces.d.ts +2 -2
  12. package/dist/filters/filtersSchemas.d.ts +1 -1
  13. package/dist/filters/filtersSchemas.js +4 -1
  14. package/dist/forms-data/formsDataApi.d.ts +14 -1
  15. package/dist/forms-data/formsDataApi.js +21 -0
  16. package/dist/forms-data/formsDataInterfaces.d.ts +74 -1
  17. package/dist/index.d.ts +4 -0
  18. package/dist/index.js +3 -0
  19. package/dist/orders/ordersApi.d.ts +15 -1
  20. package/dist/orders/ordersApi.js +22 -0
  21. package/dist/orders/ordersInterfaces.d.ts +27 -1
  22. package/dist/pages/pagesApi.d.ts +14 -1
  23. package/dist/pages/pagesApi.js +21 -0
  24. package/dist/pages/pagesInterfaces.d.ts +38 -1
  25. package/dist/payments/paymentsInterfaces.d.ts +2 -2
  26. package/dist/products/productsInterfaces.d.ts +1 -1
  27. package/dist/search/searchApi.d.ts +35 -0
  28. package/dist/search/searchApi.js +86 -0
  29. package/dist/search/searchInterfaces.d.ts +94 -0
  30. package/dist/search/searchInterfaces.js +2 -0
  31. package/dist/search/searchSchemas.d.ts +73 -0
  32. package/dist/search/searchSchemas.js +44 -0
  33. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -2
  34. package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -2
  35. package/dist/templates-preview/templatesPreviewSchemas.js +0 -1
  36. package/dist/types.d.ts +35 -0
  37. package/dist/types.js +2 -0
  38. package/dist/users/usersApi.d.ts +15 -1
  39. package/dist/users/usersApi.js +22 -0
  40. package/dist/users/usersInterfaces.d.ts +39 -1
  41. package/dist/web-socket/lazySocket.d.ts +18 -0
  42. package/dist/web-socket/lazySocket.js +70 -0
  43. package/esm/admins/adminsApi.d.ts +66 -0
  44. package/esm/admins/adminsApi.js +90 -0
  45. package/esm/admins/adminsInterfaces.d.ts +137 -0
  46. package/esm/admins/adminsInterfaces.js +1 -0
  47. package/esm/admins/adminsSchemas.d.ts +48 -0
  48. package/esm/admins/adminsSchemas.js +31 -0
  49. package/esm/attribute-sets/attributeSetsApi.d.ts +67 -0
  50. package/esm/attribute-sets/attributeSetsApi.js +97 -0
  51. package/esm/attribute-sets/attributeSetsInterfaces.d.ts +285 -0
  52. package/esm/attribute-sets/attributeSetsInterfaces.js +1 -0
  53. package/esm/attribute-sets/attributeSetsSchemas.d.ts +84 -0
  54. package/esm/attribute-sets/attributeSetsSchemas.js +66 -0
  55. package/esm/auth-provider/authProviderApi.d.ts +262 -0
  56. package/esm/auth-provider/authProviderApi.js +362 -0
  57. package/esm/auth-provider/authProviderSchemas.d.ts +124 -0
  58. package/esm/auth-provider/authProviderSchemas.js +92 -0
  59. package/esm/auth-provider/authProvidersInterfaces.d.ts +430 -0
  60. package/esm/auth-provider/authProvidersInterfaces.js +1 -0
  61. package/esm/base/asyncModules.d.ts +123 -0
  62. package/esm/base/asyncModules.js +382 -0
  63. package/esm/base/lazySchema.d.ts +15 -0
  64. package/esm/base/lazySchema.js +17 -0
  65. package/esm/base/stateModule.d.ts +35 -0
  66. package/esm/base/stateModule.js +51 -0
  67. package/esm/base/syncModules.d.ts +245 -0
  68. package/esm/base/syncModules.js +555 -0
  69. package/esm/base/timeIntervals.d.ts +95 -0
  70. package/esm/base/timeIntervals.js +317 -0
  71. package/esm/base/utils.d.ts +354 -0
  72. package/esm/base/utils.js +1 -0
  73. package/esm/base/validation.d.ts +98 -0
  74. package/esm/base/validation.js +118 -0
  75. package/esm/blocks/blocksApi.d.ts +252 -0
  76. package/esm/blocks/blocksApi.js +394 -0
  77. package/esm/blocks/blocksInterfaces.d.ts +361 -0
  78. package/esm/blocks/blocksInterfaces.js +1 -0
  79. package/esm/blocks/blocksSchemas.d.ts +213 -0
  80. package/esm/blocks/blocksSchemas.js +40 -0
  81. package/esm/discounts/discountsApi.d.ts +94 -0
  82. package/esm/discounts/discountsApi.js +136 -0
  83. package/esm/discounts/discountsInterfaces.d.ts +293 -0
  84. package/esm/discounts/discountsInterfaces.js +1 -0
  85. package/esm/events/eventsApi.d.ts +108 -0
  86. package/esm/events/eventsApi.js +141 -0
  87. package/esm/events/eventsInterfaces.d.ts +176 -0
  88. package/esm/events/eventsInterfaces.js +1 -0
  89. package/esm/file-uploading/fileUploadingApi.d.ts +91 -0
  90. package/esm/file-uploading/fileUploadingApi.js +127 -0
  91. package/esm/file-uploading/fileUploadingInterfaces.d.ts +116 -0
  92. package/esm/file-uploading/fileUploadingInterfaces.js +1 -0
  93. package/esm/file-uploading/fileUploadingSchemas.d.ts +24 -0
  94. package/esm/file-uploading/fileUploadingSchemas.js +19 -0
  95. package/esm/filters/filtersApi.d.ts +32 -0
  96. package/esm/filters/filtersApi.js +36 -0
  97. package/esm/filters/filtersInterfaces.d.ts +56 -0
  98. package/esm/filters/filtersInterfaces.js +1 -0
  99. package/esm/filters/filtersSchemas.d.ts +32 -0
  100. package/esm/filters/filtersSchemas.js +29 -0
  101. package/esm/forms/formsApi.d.ts +44 -0
  102. package/esm/forms/formsApi.js +54 -0
  103. package/esm/forms/formsInterfaces.d.ts +237 -0
  104. package/esm/forms/formsInterfaces.js +1 -0
  105. package/esm/forms/formsSchemas.d.ts +56 -0
  106. package/esm/forms/formsSchemas.js +32 -0
  107. package/esm/forms-data/formsDataApi.d.ts +124 -0
  108. package/esm/forms-data/formsDataApi.js +210 -0
  109. package/esm/forms-data/formsDataInterfaces.d.ts +670 -0
  110. package/esm/forms-data/formsDataInterfaces.js +1 -0
  111. package/esm/forms-data/formsDataSchemas.d.ts +107 -0
  112. package/esm/forms-data/formsDataSchemas.js +83 -0
  113. package/esm/general-types/generalTypesApi.d.ts +29 -0
  114. package/esm/general-types/generalTypesApi.js +34 -0
  115. package/esm/general-types/generalTypesInterfaces.d.ts +29 -0
  116. package/esm/general-types/generalTypesInterfaces.js +1 -0
  117. package/esm/general-types/generalTypesSchemas.d.ts +68 -0
  118. package/esm/general-types/generalTypesSchemas.js +42 -0
  119. package/esm/index.d.ts +143 -0
  120. package/esm/index.js +124 -0
  121. package/esm/integration-collections/integrationCollectionsApi.d.ts +172 -0
  122. package/esm/integration-collections/integrationCollectionsApi.js +224 -0
  123. package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +317 -0
  124. package/esm/integration-collections/integrationCollectionsInterfaces.js +1 -0
  125. package/esm/integration-collections/integrationCollectionsSchemas.d.ts +84 -0
  126. package/esm/integration-collections/integrationCollectionsSchemas.js +60 -0
  127. package/esm/locales/localesApi.d.ts +28 -0
  128. package/esm/locales/localesApi.js +33 -0
  129. package/esm/locales/localesInterfaces.d.ts +40 -0
  130. package/esm/locales/localesInterfaces.js +1 -0
  131. package/esm/locales/localesSchemas.d.ts +32 -0
  132. package/esm/locales/localesSchemas.js +23 -0
  133. package/esm/menus/menusApi.d.ts +30 -0
  134. package/esm/menus/menusApi.js +35 -0
  135. package/esm/menus/menusInterfaces.d.ts +87 -0
  136. package/esm/menus/menusInterfaces.js +2 -0
  137. package/esm/menus/menusSchemas.d.ts +16 -0
  138. package/esm/menus/menusSchemas.js +25 -0
  139. package/esm/orders/ordersApi.d.ts +213 -0
  140. package/esm/orders/ordersApi.js +288 -0
  141. package/esm/orders/ordersInterfaces.d.ts +763 -0
  142. package/esm/orders/ordersInterfaces.js +1 -0
  143. package/esm/orders/ordersSchemas.d.ts +312 -0
  144. package/esm/orders/ordersSchemas.js +171 -0
  145. package/esm/package.json +4 -0
  146. package/esm/pages/pagesApi.d.ts +173 -0
  147. package/esm/pages/pagesApi.js +414 -0
  148. package/esm/pages/pagesInterfaces.d.ts +344 -0
  149. package/esm/pages/pagesInterfaces.js +1 -0
  150. package/esm/pages/pagesSchemas.d.ts +121 -0
  151. package/esm/pages/pagesSchemas.js +60 -0
  152. package/esm/payments/paymentsApi.d.ts +88 -0
  153. package/esm/payments/paymentsApi.js +122 -0
  154. package/esm/payments/paymentsInterfaces.d.ts +189 -0
  155. package/esm/payments/paymentsInterfaces.js +1 -0
  156. package/esm/payments/paymentsSchemas.d.ts +94 -0
  157. package/esm/payments/paymentsSchemas.js +53 -0
  158. package/esm/product-statuses/productStatusesApi.d.ts +50 -0
  159. package/esm/product-statuses/productStatusesApi.js +68 -0
  160. package/esm/product-statuses/productStatusesInterfaces.d.ts +62 -0
  161. package/esm/product-statuses/productStatusesInterfaces.js +1 -0
  162. package/esm/product-statuses/productStatusesSchemas.d.ts +34 -0
  163. package/esm/product-statuses/productStatusesSchemas.js +27 -0
  164. package/esm/products/productsApi.d.ts +366 -0
  165. package/esm/products/productsApi.js +468 -0
  166. package/esm/products/productsInterfaces.d.ts +723 -0
  167. package/esm/products/productsInterfaces.js +1 -0
  168. package/esm/products/productsSchemas.d.ts +234 -0
  169. package/esm/products/productsSchemas.js +121 -0
  170. package/esm/search/searchApi.d.ts +35 -0
  171. package/esm/search/searchApi.js +47 -0
  172. package/esm/search/searchInterfaces.d.ts +94 -0
  173. package/esm/search/searchInterfaces.js +1 -0
  174. package/esm/search/searchSchemas.d.ts +73 -0
  175. package/esm/search/searchSchemas.js +41 -0
  176. package/esm/sitemap/sitemapApi.d.ts +37 -0
  177. package/esm/sitemap/sitemapApi.js +41 -0
  178. package/esm/sitemap/sitemapInterfaces.d.ts +51 -0
  179. package/esm/sitemap/sitemapInterfaces.js +1 -0
  180. package/esm/subscriptions/subscriptionsApi.d.ts +74 -0
  181. package/esm/subscriptions/subscriptionsApi.js +90 -0
  182. package/esm/subscriptions/subscriptionsInterfaces.d.ts +111 -0
  183. package/esm/subscriptions/subscriptionsInterfaces.js +1 -0
  184. package/esm/subscriptions/subscriptionsSchemas.d.ts +46 -0
  185. package/esm/subscriptions/subscriptionsSchemas.js +38 -0
  186. package/esm/system/systemApi.d.ts +46 -0
  187. package/esm/system/systemApi.js +53 -0
  188. package/esm/system/systemInterfaces.d.ts +29 -0
  189. package/esm/system/systemInterfaces.js +1 -0
  190. package/esm/templates/templatesApi.d.ts +53 -0
  191. package/esm/templates/templatesApi.js +78 -0
  192. package/esm/templates/templatesInterfaces.d.ts +68 -0
  193. package/esm/templates/templatesInterfaces.js +1 -0
  194. package/esm/templates/templatesSchemas.d.ts +48 -0
  195. package/esm/templates/templatesSchemas.js +28 -0
  196. package/esm/templates-preview/templatesPreviewApi.d.ts +40 -0
  197. package/esm/templates-preview/templatesPreviewApi.js +50 -0
  198. package/esm/templates-preview/templatesPreviewInterfaces.d.ts +129 -0
  199. package/esm/templates-preview/templatesPreviewInterfaces.js +1 -0
  200. package/esm/templates-preview/templatesPreviewSchemas.d.ts +79 -0
  201. package/esm/templates-preview/templatesPreviewSchemas.js +43 -0
  202. package/esm/types.d.ts +35 -0
  203. package/esm/types.js +1 -0
  204. package/esm/user-activity/userActivityApi.d.ts +31 -0
  205. package/esm/user-activity/userActivityApi.js +37 -0
  206. package/esm/user-activity/userActivityInterfaces.d.ts +42 -0
  207. package/esm/user-activity/userActivityInterfaces.js +1 -0
  208. package/esm/users/usersApi.d.ts +249 -0
  209. package/esm/users/usersApi.js +312 -0
  210. package/esm/users/usersInterfaces.d.ts +419 -0
  211. package/esm/users/usersInterfaces.js +1 -0
  212. package/esm/users/usersSchemas.d.ts +72 -0
  213. package/esm/users/usersSchemas.js +55 -0
  214. package/esm/web-socket/lazySocket.d.ts +18 -0
  215. package/esm/web-socket/lazySocket.js +67 -0
  216. package/esm/web-socket/wsApi.d.ts +27 -0
  217. package/esm/web-socket/wsApi.js +43 -0
  218. package/esm/web-socket/wsInterfaces.d.ts +16 -0
  219. package/esm/web-socket/wsInterfaces.js +1 -0
  220. package/package.json +47 -2
  221. package/types.d.ts +1 -0
  222. package/types.js +1 -0
@@ -0,0 +1,317 @@
1
+ const _MS_PER_MINUTE = 60000;
2
+ const _MS_PER_DAY = 86400000;
3
+ const _MS_PER_WEEK = 7 * _MS_PER_DAY;
4
+ /**
5
+ * Converts a date-ish value to the UTC midnight of its day, as epoch milliseconds.
6
+ *
7
+ * Everything downstream works on whole UTC days, so this is the single place
8
+ * where an incoming `Date` / ISO string / timestamp is reduced to a day key.
9
+ *
10
+ * `null` is rejected explicitly: `new Date(null)` is the epoch, not an invalid
11
+ * date, so a NaN check alone would silently accept it as 1970-01-01.
12
+ * @param {Date | string | number} value - The value to interpret as a date.
13
+ * @returns {number | null} Epoch ms of the UTC day start, or null when the value is not a valid date.
14
+ */
15
+ function _toUtcDayStart(value) {
16
+ if (value === null || value === undefined)
17
+ return null;
18
+ const date = value instanceof Date ? value : new Date(value);
19
+ if (Number.isNaN(date.getTime()))
20
+ return null;
21
+ return Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
22
+ }
23
+ /**
24
+ * Converts a time-of-day point to minutes since midnight.
25
+ *
26
+ * Guards the numeric contract: a missing component, or one arriving as a string
27
+ * (`{ hours: '9' }`), would otherwise poison the arithmetic downstream — either
28
+ * throwing `RangeError` on `toISOString` or, for strings, concatenating instead
29
+ * of adding.
30
+ * @param {ITimeIntervalPoint | undefined} point - The point to convert.
31
+ * @returns {number | null} Minutes since midnight, or null when the point is malformed.
32
+ */
33
+ function _toMinutes(point) {
34
+ if (!point)
35
+ return null;
36
+ if (!Number.isFinite(point.hours) || !Number.isFinite(point.minutes)) {
37
+ return null;
38
+ }
39
+ return point.hours * 60 + point.minutes;
40
+ }
41
+ /**
42
+ * Resolves the days a schedule is active on, clipped to the requested window.
43
+ *
44
+ * `anchor` is both the recurrence phase (which weekday / which day-of-month)
45
+ * and the first day the schedule is valid — nothing before it is ever emitted.
46
+ * The recurrence rule is open-ended, so `rangeEnd` (the window, intersected
47
+ * with the schedule's own validity end) is what stops the enumeration.
48
+ * @param {number} anchor - UTC day start the schedule is anchored to.
49
+ * @param {number} rangeStart - UTC day start of the first day to consider (inclusive).
50
+ * @param {number} rangeEnd - UTC day start of the last day to consider (inclusive).
51
+ * @param {boolean} inEveryWeek - Whether the schedule repeats weekly.
52
+ * @param {boolean} inEveryMonth - Whether the schedule repeats monthly.
53
+ * @returns {number[]} Ascending UTC day starts the schedule is active on.
54
+ */
55
+ function _resolveActiveDays(anchor, rangeStart, rangeEnd, inEveryWeek, inEveryMonth) {
56
+ const days = [];
57
+ // Weekly wins over monthly: repeating "every week" already visits every
58
+ // occurrence of the anchor's weekday in every month, which is exactly what
59
+ // the two flags combined have always meant.
60
+ if (inEveryWeek) {
61
+ const offset = Math.ceil((rangeStart - anchor) / _MS_PER_WEEK);
62
+ for (let day = anchor + Math.max(0, offset) * _MS_PER_WEEK; day <= rangeEnd; day += _MS_PER_WEEK) {
63
+ days.push(day);
64
+ }
65
+ return days;
66
+ }
67
+ // Monthly: the same day-of-month, every month. Months too short for that day
68
+ // (e.g. the 31st in February) are skipped rather than rolled over.
69
+ if (inEveryMonth) {
70
+ const dayOfMonth = new Date(anchor).getUTCDate();
71
+ const start = new Date(rangeStart);
72
+ let year = start.getUTCFullYear();
73
+ let month = start.getUTCMonth();
74
+ // Walk the calendar month by month. The cursor is the first of the month,
75
+ // not the emitted day: a month too short for `dayOfMonth` emits nothing and
76
+ // would otherwise leave the cursor standing still.
77
+ while (Date.UTC(year, month, 1) <= rangeEnd) {
78
+ const daysInMonth = new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
79
+ if (dayOfMonth <= daysInMonth) {
80
+ const day = Date.UTC(year, month, dayOfMonth);
81
+ if (day >= rangeStart && day <= rangeEnd)
82
+ days.push(day);
83
+ }
84
+ month += 1;
85
+ if (month > 11) {
86
+ month = 0;
87
+ year += 1;
88
+ }
89
+ }
90
+ return days;
91
+ }
92
+ // No recurrence: a plain date range — every day of it.
93
+ for (let day = rangeStart; day <= rangeEnd; day += _MS_PER_DAY) {
94
+ days.push(day);
95
+ }
96
+ return days;
97
+ }
98
+ /**
99
+ * Builds slots for one day from explicit `[start, end]` time pairs.
100
+ *
101
+ * Used by entity schedules, where each pair is emitted verbatim as one slot.
102
+ * @param {number} day - UTC day start, in epoch ms.
103
+ * @param {ITimeIntervalPoint[][]} times - Daily time ranges as `[start, end]` pairs.
104
+ * @param {TimeIntervalPair[]} out - Accumulator the produced slots are pushed to.
105
+ */
106
+ function _addSlotsFromTimes(day, times, out) {
107
+ times.forEach((range) => {
108
+ const [start, end] = range !== null && range !== void 0 ? range : [];
109
+ const startMinutes = _toMinutes(start);
110
+ const endMinutes = _toMinutes(end);
111
+ if (startMinutes === null || endMinutes === null)
112
+ return;
113
+ const from = day + startMinutes * _MS_PER_MINUTE;
114
+ const to = day + endMinutes * _MS_PER_MINUTE;
115
+ out.push([new Date(from).toISOString(), new Date(to).toISOString()]);
116
+ });
117
+ }
118
+ /**
119
+ * Builds slots for one day by slicing each range into fixed-length periods.
120
+ *
121
+ * Used by form schedules: `start=09:00, end=12:00, period=30` yields
122
+ * `[09:00–09:30], [09:30–10:00], …, [11:30–12:00]`. A trailing partial slot
123
+ * that would overrun `end` is not emitted.
124
+ * @param {number} day - UTC day start, in epoch ms.
125
+ * @param {ITimeIntervalRange[]} ranges - Daily ranges carrying a slot `period` in minutes.
126
+ * @param {TimeIntervalPair[]} out - Accumulator the produced slots are pushed to.
127
+ */
128
+ function _addSlotsFromRanges(day, ranges, out) {
129
+ ranges.forEach((range) => {
130
+ const startMinutes = _toMinutes(range === null || range === void 0 ? void 0 : range.start);
131
+ const endMinutes = _toMinutes(range === null || range === void 0 ? void 0 : range.end);
132
+ if (startMinutes === null || endMinutes === null)
133
+ return;
134
+ // A non-positive period would never advance the cursor; a null or
135
+ // non-numeric one would concatenate into it.
136
+ const period = range === null || range === void 0 ? void 0 : range.period;
137
+ if (typeof period !== 'number' || !Number.isFinite(period) || period <= 0)
138
+ return;
139
+ for (let minutes = startMinutes; minutes + period <= endMinutes; minutes += period) {
140
+ const from = day + minutes * _MS_PER_MINUTE;
141
+ const to = day + (minutes + period) * _MS_PER_MINUTE;
142
+ out.push([new Date(from).toISOString(), new Date(to).toISOString()]);
143
+ }
144
+ });
145
+ }
146
+ /**
147
+ * Deduplicates slots by value and sorts them by start, then end.
148
+ *
149
+ * A plain `Set` would not do: slots are arrays, so it would compare by
150
+ * reference and keep every duplicate.
151
+ * @param {TimeIntervalPair[]} slots - The slots to normalize.
152
+ * @returns {TimeIntervalPair[]} Sorted, deduplicated slots.
153
+ */
154
+ function _dedupeAndSort(slots) {
155
+ const unique = new Map();
156
+ slots.forEach((slot) => {
157
+ const key = `${slot[0]}|${slot[1]}`;
158
+ if (!unique.has(key))
159
+ unique.set(key, slot);
160
+ });
161
+ return [...unique.values()].sort((a, b) => a[0].localeCompare(b[0]) || a[1].localeCompare(b[1]));
162
+ }
163
+ /**
164
+ * Narrows a schedule to the entity shape (pages, products, blocks, attribute sets).
165
+ *
166
+ * Entity schedules carry `times`; form schedules never do.
167
+ * @param {ITimeIntervalEntitySchedule | ITimeIntervalSchedule} schedule - The schedule to test.
168
+ * @returns {boolean} True when the schedule is an entity schedule.
169
+ */
170
+ function _isEntitySchedule(schedule) {
171
+ return Array.isArray(schedule.times);
172
+ }
173
+ /**
174
+ * Expands a `timeInterval` schedule into concrete UTC slots for a given window.
175
+ *
176
+ * A schedule as returned by the API is a compact **recurrence rule** — an
177
+ * anchor date plus daily time ranges plus repeat flags — not a list of slots.
178
+ * Materializing it wholesale is what makes `timeInterval` attributes expensive
179
+ * (a year of half-hour slots runs to megabytes), so expansion is on demand and
180
+ * the window is required: only the caller knows how far it needs to resolve.
181
+ *
182
+ * Both schedule shapes the API returns are accepted:
183
+ * - **entity** — `attributeValues[marker].value[].values[]` on pages, products,
184
+ * blocks and attribute sets: a `dates` range with `times` pairs;
185
+ * - **form** — `attributes[marker].localizeInfos.intervals[]`: a `range` with
186
+ * `intervals` that carry a slot `period` in minutes.
187
+ *
188
+ * Semantics:
189
+ * - `dates[0]` / `range[0]` is both the recurrence phase and the first valid
190
+ * day — nothing earlier is emitted, however wide the window;
191
+ * - `dates[1]` / `range[1]` ends validity; when it does not extend past the
192
+ * start, the schedule is anchored to that day — with a recurrence flag set,
193
+ * recurrence is then open-ended and the window alone bounds the result;
194
+ * - `inEveryWeek` repeats every 7 days from the anchor; `inEveryMonth` repeats
195
+ * on the same day-of-month, skipping months that are too short; with both set
196
+ * the weekly rule applies, which is what it has always meant in practice;
197
+ * - with neither flag the schedule is a plain date range — every day of it;
198
+ * - the result is deduplicated and sorted by start, then end.
199
+ * @param {ITimeIntervalEntitySchedule | ITimeIntervalSchedule} schedule - A single schedule entry from a `timeInterval` attribute.
200
+ * @param {ITimeIntervalWindow} window - Inclusive `{ from, to }` range to resolve, compared at UTC day granularity.
201
+ * @returns {TimeIntervalPair[]} Sorted, deduplicated `[start, end]` ISO pairs; empty when the schedule is malformed or does not overlap the window.
202
+ * To expand a whole attribute at once, prefer {@link expandAttributeTimeIntervals}
203
+ * — it walks the groups and merges the results for you. Reach for this function
204
+ * directly when you already hold a single schedule, e.g. a form's
205
+ * `localizeInfos.intervals[]`.
206
+ * @example
207
+ * ```ts
208
+ * import { expandTimeIntervals } from 'oneentry';
209
+ *
210
+ * // Form attributes are an array keyed by `marker`, and carry their schedules
211
+ * // already typed on `localizeInfos.intervals`.
212
+ * const field = form.attributes.find((a) => a.marker === 'booking');
213
+ *
214
+ * const slots = (field?.localizeInfos.intervals ?? []).flatMap((schedule) =>
215
+ * expandTimeIntervals(schedule, { from: '2025-05-01', to: '2025-05-31' }),
216
+ * );
217
+ * // [['2025-05-07T09:00:00.000Z', '2025-05-07T10:00:00.000Z'], …]
218
+ * ```
219
+ */
220
+ export function expandTimeIntervals(schedule, window) {
221
+ var _a, _b;
222
+ if (!schedule || !window)
223
+ return [];
224
+ const isEntity = _isEntitySchedule(schedule);
225
+ const bounds = isEntity ? schedule.dates : schedule.range;
226
+ if (!Array.isArray(bounds))
227
+ return [];
228
+ const anchor = _toUtcDayStart(bounds[0]);
229
+ if (anchor === null)
230
+ return [];
231
+ const windowFrom = _toUtcDayStart(window.from);
232
+ const windowTo = _toUtcDayStart(window.to);
233
+ if (windowFrom === null || windowTo === null || windowTo < windowFrom) {
234
+ return [];
235
+ }
236
+ const inEveryWeek = (_a = schedule.inEveryWeek) !== null && _a !== void 0 ? _a : false;
237
+ const inEveryMonth = (_b = schedule.inEveryMonth) !== null && _b !== void 0 ? _b : false;
238
+ // An anchor-only range (start === end) means the schedule is pinned to that
239
+ // day; with a recurrence rule it then runs open-ended and the window is the
240
+ // only horizon. Otherwise the second bound ends validity.
241
+ const declaredEnd = _toUtcDayStart(bounds[1]);
242
+ const isOpenEnded = (declaredEnd === null || declaredEnd <= anchor) &&
243
+ (inEveryWeek || inEveryMonth);
244
+ const validTo = isOpenEnded
245
+ ? Number.POSITIVE_INFINITY
246
+ : Math.max(anchor, declaredEnd !== null && declaredEnd !== void 0 ? declaredEnd : anchor);
247
+ const rangeStart = Math.max(anchor, windowFrom);
248
+ const rangeEnd = Math.min(validTo, windowTo);
249
+ if (rangeEnd < rangeStart)
250
+ return [];
251
+ const days = _resolveActiveDays(anchor, rangeStart, rangeEnd, inEveryWeek, inEveryMonth);
252
+ const slots = [];
253
+ days.forEach((day) => {
254
+ if (isEntity) {
255
+ _addSlotsFromTimes(day, schedule.times, slots);
256
+ }
257
+ else if (Array.isArray(schedule.intervals)) {
258
+ _addSlotsFromRanges(day, schedule.intervals, slots);
259
+ }
260
+ });
261
+ return _dedupeAndSort(slots);
262
+ }
263
+ /**
264
+ * Narrows an attribute value to a `timeInterval` attribute.
265
+ *
266
+ * `IAttributeValue.value` is `unknown` — its shape depends on `type` — so this
267
+ * guard is what lets you reach the schedules without a cast.
268
+ * @param {IAttributeValue | undefined} attr - The attribute value to test.
269
+ * @returns {boolean} True when the attribute is a `timeInterval` carrying an array of groups.
270
+ * @example
271
+ * ```ts
272
+ * const attr = page.attributeValues.interval;
273
+ * if (isTimeIntervalAttribute(attr)) {
274
+ * attr.value[0].values[0].dates; // fully typed, no cast
275
+ * }
276
+ * ```
277
+ */
278
+ export function isTimeIntervalAttribute(attr) {
279
+ return !!attr && attr.type === 'timeInterval' && Array.isArray(attr.value);
280
+ }
281
+ /**
282
+ * Expands a whole `timeInterval` attribute into concrete UTC slots for a window.
283
+ *
284
+ * The one-call path for the common case: it walks the attribute's groups and
285
+ * their schedules, expands each with {@link expandTimeIntervals}, and merges the
286
+ * results. Merging matters — deduplication and ordering only hold within a
287
+ * single schedule, so combining groups by hand can yield duplicate or unsorted
288
+ * slots.
289
+ *
290
+ * Anything that is not a `timeInterval` attribute yields an empty array, so this
291
+ * is safe to call on an arbitrary attribute without checking `type` first.
292
+ *
293
+ * For **form** attributes the schedules are already typed at
294
+ * `localizeInfos.intervals`, so no equivalent helper is needed — map over them
295
+ * and call {@link expandTimeIntervals} directly.
296
+ * @param {IAttributeValue | undefined} attr - A `timeInterval` attribute value, e.g. `page.attributeValues.interval`.
297
+ * @param {ITimeIntervalWindow} window - Inclusive `{ from, to }` range to resolve, compared at UTC day granularity.
298
+ * @returns {TimeIntervalPair[]} Sorted, deduplicated `[start, end]` ISO pairs across every group; empty when the attribute is not a `timeInterval`.
299
+ * @example
300
+ * ```ts
301
+ * import { expandAttributeTimeIntervals } from 'oneentry';
302
+ *
303
+ * const slots = expandAttributeTimeIntervals(page.attributeValues.interval, {
304
+ * from: '2025-04-01',
305
+ * to: '2025-04-30',
306
+ * });
307
+ * // [['2025-04-14T09:00:00.000Z', '2025-04-14T10:00:00.000Z'], …]
308
+ * ```
309
+ */
310
+ export function expandAttributeTimeIntervals(attr, window) {
311
+ if (!isTimeIntervalAttribute(attr))
312
+ return [];
313
+ const slots = attr.value.flatMap((group) => Array.isArray(group === null || group === void 0 ? void 0 : group.values)
314
+ ? group.values.flatMap((schedule) => expandTimeIntervals(schedule, window))
315
+ : []);
316
+ return _dedupeAndSort(slots);
317
+ }
@@ -0,0 +1,354 @@
1
+ /**
2
+ * @interface IConfig
3
+ * @property {string} [token] - If your project is protected by a token, specify this token in this parameter.
4
+ * @property {string} [guestId] - Guest identifier sent as the `x-guest-id` header on unauthenticated requests. Lets cart/wishlist/activity endpoints work for a guest. In the browser a stable id is auto-generated (localStorage) when omitted; on the server pass a per-visitor id. Can also be set later via `setGuestId`.
5
+ * @property {string} [deviceMetadata] - Device-metadata string sent as the `x-device-metadata` header on POST requests and token refresh, overriding the environment-derived fingerprint. The API binds refresh tokens to this header, so server-side flows that issue tokens on behalf of a browser (e.g. an OAuth code exchange) must pass the browser's string here — otherwise the token is bound to the server's fingerprint and cannot be refreshed from the browser. Obtain the string in the browser via `getDeviceMetadata()`. Can also be set later via `setDeviceMetadata`.
6
+ * @property {string} [langCode] - specify the default language to avoid specifying it in every request.
7
+ * @property {boolean} [traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
8
+ * @property {boolean} [rawData] - Set to true to receive raw API responses without any transformation.
9
+ * @property {object} [validation] - Validation settings for API responses.
10
+ * @property {boolean} [auth] - An object with authorization settings.
11
+ * @property {boolean} [auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
12
+ * @property {boolean} [auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
13
+ * @property {boolean} [auth.providerMarker] - The marker of the provider, for example, email, google, facebook, etc. Default 'email';
14
+ * @property {boolean} [auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated.
15
+ * @property {object} [errors] - Error handling settings.
16
+ * @example
17
+ * ```ts
18
+ * const saveToken = (token) => {
19
+ * localStorage.setItem('refresh', token)
20
+ * }
21
+ *
22
+ * const config = {
23
+ * token: 'project.token.here',
24
+ * langCode: 'en_US',
25
+ * multipleRequests: true,
26
+ * auth: {
27
+ * customAuth: false,
28
+ * refreshToken: 'user.refresh.token',
29
+ * providerMarker: 'email',
30
+ * saveFunction: saveToken
31
+ * },
32
+ * errors: {
33
+ * isShell: true,
34
+ * customErrors: {
35
+ * '400': badRequestFunction,
36
+ * '404': notFoundFunction,
37
+ * '429': rateLimitFunction,
38
+ * '500': serverErrorFunction,
39
+ * '503': serviceUnavailableFunction
40
+ * }
41
+ * }
42
+ * }
43
+ * ```
44
+ */
45
+ interface IConfig {
46
+ token?: string;
47
+ guestId?: string;
48
+ deviceMetadata?: string;
49
+ langCode?: string;
50
+ traficLimit?: boolean;
51
+ rawData?: boolean;
52
+ validation?: {
53
+ enabled?: boolean;
54
+ strictMode?: boolean;
55
+ logErrors?: boolean;
56
+ };
57
+ auth?: {
58
+ customAuth?: boolean;
59
+ refreshToken?: string;
60
+ providerMarker?: string;
61
+ saveFunction?: (refreshToken: string) => void;
62
+ };
63
+ errors?: {
64
+ isShell?: boolean;
65
+ customErrors?: {
66
+ 400?: (data?: IError) => unknown;
67
+ 401?: (data?: IError) => unknown;
68
+ 403?: (data?: IError) => unknown;
69
+ 404?: (data?: IError) => unknown;
70
+ 429?: (data?: IError) => unknown;
71
+ 500?: (data?: IError) => unknown;
72
+ 502?: (data?: IError) => unknown;
73
+ 503?: (data?: IError) => unknown;
74
+ 504?: (data?: IError) => unknown;
75
+ };
76
+ };
77
+ }
78
+ /**
79
+ * @interface IAttributes
80
+ * @property {Array<object>} listTitles - Predefined option list for `list`/`enum`-style attributes. Each entry holds a localized label, raw value, sort position, and an `extended` payload with the typed value used by the runtime.
81
+ * @example
82
+ [
83
+ {
84
+ "title": "Red",
85
+ "value": "red",
86
+ "position": 1,
87
+ "extended": { "value": "#ff0000", "type": "string" }
88
+ }
89
+ ]
90
+ * @property {IAttributeLocalizeInfo} localizeInfos - Localized labels for the attribute (title and other text fields shown in UI). For `timeInterval` attributes, also carries the `intervals` schedule payload.
91
+ * @property {string} marker - Machine-readable identifier of the attribute, unique within its set. Example: "color".
92
+ * @property {number} position - Sort position of the attribute inside its set. Example: 1.
93
+ * @property {boolean} isVisible - Whether the attribute is exposed in the public API/UI. Example: true.
94
+ * @property {string} type - Attribute data type (e.g. "string", "integer", "list", "file", "image").
95
+ * @property {Record<string, unknown>} [settings] - Type-specific configuration (e.g. min/max for numbers, accepted MIME types for files). Optional.
96
+ * @property {Record<string, unknown>} validators - Validation rules applied to the attribute value (e.g. `requiredValidator`, `regexValidator`). Example: { "requiredValidator": { "strict": true } }.
97
+ * @property {Record<string, IAttributes>} [additionalFields] - Nested sub-attributes attached to this attribute, keyed by marker. Optional.
98
+ * @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
99
+ * @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
100
+ * @property {boolean} [isLogin] - Form attribute flag — whether the field carries the login value used for authentication. Optional.
101
+ * @property {boolean} [isSignUp] - Form attribute flag — whether the field is required during sign-up. Optional.
102
+ * @property {boolean} [isNotificationEmail] - Form attribute flag — whether the field stores the email used for notifications. Optional.
103
+ * @property {boolean} [isNotificationPhonePush] - Form attribute flag — whether the field stores the phone number used for push notifications. Optional.
104
+ * @property {boolean} [isNotificationPhoneSMS] - Form attribute flag — whether the field stores the phone number used for SMS notifications. Optional.
105
+ * @description Definition of a single attribute inside an attribute set — describes how a field is labeled, validated and rendered.
106
+ */
107
+ interface IAttributes {
108
+ listTitles: Array<{
109
+ title: string;
110
+ value: number | string | null;
111
+ position: number;
112
+ extended: {
113
+ value: string | number | null;
114
+ type: string | number | null;
115
+ };
116
+ }>;
117
+ localizeInfos: IAttributeLocalizeInfo;
118
+ marker: string;
119
+ position: number;
120
+ isVisible: boolean;
121
+ type: string;
122
+ settings?: Record<string, unknown>;
123
+ validators: Record<string, unknown>;
124
+ additionalFields?: Record<string, IAttributes>;
125
+ isIcon?: boolean;
126
+ isProductPreview?: boolean;
127
+ isLogin?: boolean;
128
+ isSignUp?: boolean;
129
+ isNotificationEmail?: boolean;
130
+ isNotificationPhonePush?: boolean;
131
+ isNotificationPhoneSMS?: boolean;
132
+ }
133
+ /**
134
+ * @interface ILocalizeInfo
135
+ * @property {string} title - Localized title of the entity. Example: "Catalog".
136
+ * @property {string | null} [plainValue] - Localized plain-text content (without HTML markup). Example: "Plain description".
137
+ * @property {string | null} [htmlValue] - Localized HTML-rendered content. Example: "<p>Description</p>".
138
+ * @property {string | null} [htmlContent] - Localized HTML body content for richer pages. Example: "<div>...</div>".
139
+ * @property {string | null} [plainContent] - Localized plain-text version of `htmlContent`; returned by pages and menus. Example: "Description".
140
+ * @property {string | null} [menuTitle] - Localized title used in menus and navigation. Example: "Home".
141
+ * @description Normalized localization payload for a single locale, returned by the SDK after unwrapping the API's per-language map.
142
+ */
143
+ interface ILocalizeInfo {
144
+ title: string;
145
+ plainValue?: string | null;
146
+ htmlValue?: string | null;
147
+ htmlContent?: string | null;
148
+ plainContent?: string | null;
149
+ menuTitle?: string | null;
150
+ }
151
+ /**
152
+ * @interface IAttributeLocalizeInfo
153
+ * @property {string} [title] - Localized title of the attribute. Optional — the payload is an empty object when the attribute has no localization for the requested language (e.g. form attributes in list responses). Example: "Color".
154
+ * @property {ITimeIntervalSchedule[]} [intervals] - For attributes of type `timeInterval`, the schedule data attached to the localization payload. Each entry is a compact recurrence rule — pass it to `expandTimeIntervals` to resolve concrete slots.
155
+ * @description Extension of {@link ILocalizeInfo} used by attribute entities — adds attribute-type-specific fields the API exposes via `localizeInfos`. Unlike the base type, `title` is optional here.
156
+ */
157
+ interface IAttributeLocalizeInfo extends Omit<ILocalizeInfo, 'title'> {
158
+ title?: string;
159
+ intervals?: ITimeIntervalSchedule[];
160
+ [key: string]: unknown;
161
+ }
162
+ /**
163
+ * @interface ITimeIntervalSchedule
164
+ * @property {string} id - Schedule entry identifier (UUID). Example: "c6466cd8-c55d-4583-97c5-42b684210f12".
165
+ * @property {number} [fullMonth] - Month index this schedule covers (0-11). Optional — present when the schedule is pinned to a month/year rather than an explicit date `range`. Example: 2.
166
+ * @property {boolean} inEveryMonth - Whether the schedule repeats every month. Example: true.
167
+ * @property {number} [selectedYear] - Year the schedule applies to. Optional — present when the schedule is pinned to a month/year rather than an explicit date `range`. Example: 2025.
168
+ * @property {ITimeIntervalRange[]} intervals - Daily time ranges configured for the schedule.
169
+ * @property {unknown[]} external - External overrides; empty array when none.
170
+ * @property {string[]} range - Validity range as a pair of ISO dates `[from, to]`; empty array when none. When both entries are equal the schedule is anchored to that single day and its recurrence is open-ended. Example: ["2025-05-07T21:00:00.000Z", "2025-05-07T21:00:00.000Z"].
171
+ * @property {boolean} [inEveryWeek] - Whether the schedule repeats every week. Optional.
172
+ * @description One entry of a `timeInterval` **form** attribute's schedule, carried on `localizeInfos.intervals`. Holds a compact recurrence rule — pass it to `expandTimeIntervals` to resolve concrete slots for a given window.
173
+ */
174
+ interface ITimeIntervalSchedule {
175
+ id: string;
176
+ fullMonth?: number;
177
+ inEveryMonth: boolean;
178
+ selectedYear?: number;
179
+ intervals: ITimeIntervalRange[];
180
+ external: unknown[];
181
+ range: string[];
182
+ inEveryWeek?: boolean;
183
+ }
184
+ /**
185
+ * @interface ITimeIntervalEntitySchedule
186
+ * @property {string} id - Schedule entry identifier (UUID). Example: "bbc82c9f-1bc4-4c86-b83c-c062016eb7cb".
187
+ * @property {string} intervalId - Identifier of the parent interval group (UUID). Example: "c6466cd8-c55d-4583-97c5-42b684210f12".
188
+ * @property {string[]} dates - Validity range as a pair of ISO dates `[from, to]`. When both entries are equal the schedule is anchored to that single day and its recurrence is open-ended. Example: ["2025-04-14T00:00:00.000Z", "2025-04-14T00:00:00.000Z"].
189
+ * @property {ITimeIntervalPoint[][]} times - Daily time ranges, each a `[start, end]` pair. Example: [[{ "hours": 9, "minutes": 0 }, { "hours": 10, "minutes": 0 }]].
190
+ * @property {boolean} inEveryWeek - Whether the schedule repeats every week. Example: true.
191
+ * @property {boolean} inEveryMonth - Whether the schedule repeats every month. Example: true.
192
+ * @property {unknown[]} [exceptions] - Excluded dates; empty array when none. Optional.
193
+ * @property {ITimeIntervalRange[]} [intervals] - Slot-based ranges; empty array on entity schedules, which use `times` instead. Optional.
194
+ * @description One entry of a `timeInterval` attribute's schedule on pages, products, blocks and attribute sets — found at `attributeValues[marker].value[].values[]`. Holds a compact recurrence rule — pass it to `expandTimeIntervals` to resolve concrete slots for a given window.
195
+ */
196
+ interface ITimeIntervalEntitySchedule {
197
+ id: string;
198
+ intervalId: string;
199
+ dates: string[];
200
+ times: ITimeIntervalPoint[][];
201
+ inEveryWeek: boolean;
202
+ inEveryMonth: boolean;
203
+ exceptions?: unknown[];
204
+ intervals?: ITimeIntervalRange[];
205
+ }
206
+ /**
207
+ * @interface ITimeIntervalGroup
208
+ * @property {string} intervalId - Identifier of the interval group (UUID). Example: "c6466cd8-c55d-4583-97c5-42b684210f12".
209
+ * @property {ITimeIntervalEntitySchedule[]} values - The schedules configured under this group.
210
+ * @description One entry of a `timeInterval` attribute's `value` array — a group of schedules sharing an `intervalId`.
211
+ */
212
+ interface ITimeIntervalGroup {
213
+ intervalId: string;
214
+ values: ITimeIntervalEntitySchedule[];
215
+ }
216
+ /**
217
+ * @interface ITimeIntervalAttributeValue
218
+ * @property {'timeInterval'} type - Discriminant identifying the attribute as a `timeInterval`.
219
+ * @property {ITimeIntervalGroup[]} value - Groups of schedules attached to the attribute.
220
+ * @description {@link IAttributeValue} narrowed to `timeInterval` attributes, whose generic `value: unknown` resolves to an array of {@link ITimeIntervalGroup}. Narrow to it with `isTimeIntervalAttribute`, or skip straight to the slots with `expandAttributeTimeIntervals`.
221
+ */
222
+ interface ITimeIntervalAttributeValue extends IAttributeValue {
223
+ type: 'timeInterval';
224
+ value: ITimeIntervalGroup[];
225
+ }
226
+ /**
227
+ * @interface ITimeIntervalWindow
228
+ * @property {Date | string | number} from - Inclusive start of the window.
229
+ * @property {Date | string | number} to - Inclusive end of the window.
230
+ * @description The bounded range to expand a schedule into. Both bounds are inclusive and compared at UTC day granularity, so the time-of-day component of `from`/`to` is ignored. The window is required: a schedule is an open-ended recurrence rule, and only the caller knows how far it needs to be resolved.
231
+ */
232
+ interface ITimeIntervalWindow {
233
+ from: Date | string | number;
234
+ to: Date | string | number;
235
+ }
236
+ /**
237
+ * TimeIntervalPair — one resolved slot as a `[start, end]` pair of ISO 8601 UTC timestamps.
238
+ */
239
+ type TimeIntervalPair = [string, string];
240
+ /**
241
+ * @interface ITimeIntervalPoint
242
+ * @property {number} hours - Hour component (0-23).
243
+ * @property {number} minutes - Minute component (0-59).
244
+ * @description A point in time within a day, used as start/end of {@link ITimeIntervalRange}.
245
+ */
246
+ interface ITimeIntervalPoint {
247
+ hours: number;
248
+ minutes: number;
249
+ }
250
+ /**
251
+ * @interface ITimeIntervalRange
252
+ * @property {string} id - Range identifier (UUID).
253
+ * @property {ITimeIntervalPoint} start - Start time of the range.
254
+ * @property {ITimeIntervalPoint} end - End time of the range.
255
+ * @property {number | null} period - Slot duration in minutes; `null` when the range is not sliced into slots. Example: 60.
256
+ * @description A single daily time range inside a {@link ITimeIntervalSchedule}.
257
+ */
258
+ interface ITimeIntervalRange {
259
+ id: string;
260
+ start: ITimeIntervalPoint;
261
+ end: ITimeIntervalPoint;
262
+ period: number | null;
263
+ }
264
+ /**
265
+ * @interface IAttributeValue
266
+ * @property {string} type - Attribute data type (e.g. "string", "integer", "list", "file", "image").
267
+ * @property {unknown} value - Attribute value — actual TS type depends on `type`, and the SDK normalizes it to the same shape in every module: `string` for "string"/"text"; `number | null` for "integer"/"float"/"real"; the file object itself for a single-file "image"/"file" and an array of them for several; an array for "list" and "groupOfImages". An attribute with no value is always `null`. Example: "Admins text".
268
+ * @property {number} [position] - Sort position of the value inside its set; the containing collection is returned sorted by it. Example: 0.
269
+ * @property {Record<string, IAttributeValue> | unknown[]} [additionalFields] - Nested attribute values keyed by marker; the API may also return an empty array when none are configured. Optional.
270
+ * @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
271
+ * @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
272
+ * @description A single attribute value attached to an entity (admin, user, page, product, …).
273
+ */
274
+ interface IAttributeValue {
275
+ type: string;
276
+ value: unknown;
277
+ position?: number;
278
+ additionalFields?: Record<string, IAttributeValue> | unknown[];
279
+ isIcon?: boolean;
280
+ isProductPreview?: boolean;
281
+ }
282
+ /**
283
+ * @interface IAttributeValues
284
+ * @description Map of attribute values keyed by attribute marker.
285
+ */
286
+ interface IAttributeValues {
287
+ [key: string]: IAttributeValue;
288
+ }
289
+ /**
290
+ * @interface IRating
291
+ * @property {number} [value] - Average rating value. Example: 4.5.
292
+ * @property {number} [like] - Number of likes. Example: 10.
293
+ * @property {number} [dislike] - Number of dislikes. Example: 2.
294
+ * @property {string} [method] - Rating calculation method. Example: "average".
295
+ * @description Rating data attached to an entity. All fields are optional — the API returns an empty object when no rating has been collected yet.
296
+ */
297
+ interface IRating {
298
+ value?: number;
299
+ like?: number;
300
+ dislike?: number;
301
+ method?: string;
302
+ }
303
+ /**
304
+ * @interface IError
305
+ * @property {string} message - Error message.
306
+ * @property {unknown} pageData - Page data.
307
+ * @property {number} statusCode - Status code.
308
+ * @property {string} timestamp - Timestamp.
309
+ * @property {string} [localizeMessage] - Human-readable localized error message; populated by the SDK when response validation fails. Optional.
310
+ * @property {unknown[]} [validationErrors] - Detailed validation issues from Zod when response validation fails. Optional.
311
+ * @description Interface for error responses returned by the SDK either from the API or from local response validation.
312
+ */
313
+ interface IError {
314
+ message: string;
315
+ pageData: unknown;
316
+ statusCode: number;
317
+ timestamp: string;
318
+ localizeMessage?: string;
319
+ validationErrors?: unknown[];
320
+ }
321
+ /**
322
+ * @interface IHttpHeaders
323
+ * @property {string} [Authorization] - Authorization header.
324
+ * @description Interface for HTTP headers. Supports the standard `Content-Type`, `Authorization`, and OneEntry-specific `x-app-token` / `x-device-metadata` / `x-guest-id` (guest cart/wishlist/activity) headers, plus arbitrary string entries via the index signature.
325
+ */
326
+ interface IHttpHeaders {
327
+ 'Content-Type'?: string;
328
+ 'x-app-token'?: string;
329
+ 'x-device-metadata'?: string;
330
+ 'x-guest-id'?: string;
331
+ Authorization?: string;
332
+ [key: string]: string | undefined;
333
+ }
334
+ /**
335
+ * @interface IHttpOptions
336
+ * @property {string} method - HTTP method
337
+ * @property {IHttpHeaders} headers - HTTP headers
338
+ * @property {string | FormData | Blob} [body] - Request body
339
+ * @description Interface for HTTP request options
340
+ */
341
+ interface IHttpOptions {
342
+ method: string;
343
+ headers: IHttpHeaders;
344
+ body?: string | FormData | Blob;
345
+ }
346
+ /**
347
+ * LangType
348
+ */
349
+ type LangType = string | Array<string>;
350
+ /**
351
+ * LocalizeType
352
+ */
353
+ type LocalizeType = ILocalizeInfo;
354
+ export type { IAttributeLocalizeInfo, IAttributes, IAttributeValue, IAttributeValues, IConfig, IError, IHttpHeaders, IHttpOptions, ILocalizeInfo, IRating, ITimeIntervalAttributeValue, ITimeIntervalEntitySchedule, ITimeIntervalGroup, ITimeIntervalPoint, ITimeIntervalRange, ITimeIntervalSchedule, ITimeIntervalWindow, LangType, LocalizeType, TimeIntervalPair, };
@@ -0,0 +1 @@
1
+ export {};