@esri/hub-common 14.110.0 → 14.111.0

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 (188) hide show
  1. package/dist/esm/core/EntityEditor.js +4 -0
  2. package/dist/esm/core/EntityEditor.js.map +1 -1
  3. package/dist/esm/core/fetchHubEntity.js +4 -0
  4. package/dist/esm/core/fetchHubEntity.js.map +1 -1
  5. package/dist/esm/core/getTypeFromEntity.js +3 -0
  6. package/dist/esm/core/getTypeFromEntity.js.map +1 -1
  7. package/dist/esm/core/schemas/internal/follow/FollowCardUiSchema.js +98 -63
  8. package/dist/esm/core/schemas/internal/follow/FollowCardUiSchema.js.map +1 -1
  9. package/dist/esm/core/schemas/internal/follow/FollowSchema.js +2 -7
  10. package/dist/esm/core/schemas/internal/follow/FollowSchema.js.map +1 -1
  11. package/dist/esm/core/schemas/internal/getEditorSchemas.js +13 -0
  12. package/dist/esm/core/schemas/internal/getEditorSchemas.js.map +1 -1
  13. package/dist/esm/core/schemas/types.js +2 -0
  14. package/dist/esm/core/schemas/types.js.map +1 -1
  15. package/dist/esm/core/types/HubEntityType.js +1 -0
  16. package/dist/esm/core/types/HubEntityType.js.map +1 -1
  17. package/dist/esm/core/updateHubEntity.js +8 -0
  18. package/dist/esm/core/updateHubEntity.js.map +1 -1
  19. package/dist/esm/discussions/_internal/DiscussionBusinessRules.js +7 -0
  20. package/dist/esm/discussions/_internal/DiscussionBusinessRules.js.map +1 -1
  21. package/dist/esm/discussions/api/settings/getDefaultEntitySettings.js +1 -0
  22. package/dist/esm/discussions/api/settings/getDefaultEntitySettings.js.map +1 -1
  23. package/dist/esm/events/HubEvent.js +149 -0
  24. package/dist/esm/events/HubEvent.js.map +1 -0
  25. package/dist/esm/events/_internal/EventBusinessRules.js +115 -0
  26. package/dist/esm/events/_internal/EventBusinessRules.js.map +1 -0
  27. package/dist/esm/events/_internal/EventSchemaCreate.js +50 -0
  28. package/dist/esm/events/_internal/EventSchemaCreate.js.map +1 -0
  29. package/dist/esm/events/_internal/EventSchemaEdit.js +77 -0
  30. package/dist/esm/events/_internal/EventSchemaEdit.js.map +1 -0
  31. package/dist/esm/events/_internal/EventUiSchemaCreate.js +165 -0
  32. package/dist/esm/events/_internal/EventUiSchemaCreate.js.map +1 -0
  33. package/dist/esm/events/_internal/EventUiSchemaEdit.js +371 -0
  34. package/dist/esm/events/_internal/EventUiSchemaEdit.js.map +1 -0
  35. package/dist/esm/events/_internal/PropertyMapper.js +134 -0
  36. package/dist/esm/events/_internal/PropertyMapper.js.map +1 -0
  37. package/dist/esm/events/_internal/getDefaultEventDatesAndTimes.js +28 -0
  38. package/dist/esm/events/_internal/getDefaultEventDatesAndTimes.js.map +1 -0
  39. package/dist/esm/events/_internal/getISOStringFromClientDateTime.js +28 -0
  40. package/dist/esm/events/_internal/getISOStringFromClientDateTime.js.map +1 -0
  41. package/dist/esm/events/_internal/getPropertyMap.js +47 -0
  42. package/dist/esm/events/_internal/getPropertyMap.js.map +1 -0
  43. package/dist/esm/events/_internal/validations.js +53 -0
  44. package/dist/esm/events/_internal/validations.js.map +1 -0
  45. package/dist/esm/events/defaults.js +32 -0
  46. package/dist/esm/events/defaults.js.map +1 -0
  47. package/dist/esm/events/edit.js +81 -0
  48. package/dist/esm/events/edit.js.map +1 -0
  49. package/dist/esm/events/fetch.js +29 -0
  50. package/dist/esm/events/fetch.js.map +1 -0
  51. package/dist/esm/events/index.js +4 -1
  52. package/dist/esm/events/index.js.map +1 -1
  53. package/dist/esm/events/types.js +12 -0
  54. package/dist/esm/events/types.js.map +1 -0
  55. package/dist/esm/index.js +1 -0
  56. package/dist/esm/index.js.map +1 -1
  57. package/dist/esm/initiatives/_internal/computeProps.js +3 -3
  58. package/dist/esm/initiatives/_internal/computeProps.js.map +1 -1
  59. package/dist/esm/initiatives/_internal/getPropertyMap.js +5 -0
  60. package/dist/esm/initiatives/_internal/getPropertyMap.js.map +1 -1
  61. package/dist/esm/permissions/HubPermissionPolicies.js +2 -0
  62. package/dist/esm/permissions/HubPermissionPolicies.js.map +1 -1
  63. package/dist/esm/permissions/types/Permission.js +2 -0
  64. package/dist/esm/permissions/types/Permission.js.map +1 -1
  65. package/dist/esm/surveys/HubSurvey.js +24 -0
  66. package/dist/esm/surveys/HubSurvey.js.map +1 -1
  67. package/dist/esm/surveys/_internal/SurveyBusinessRules.js +14 -1
  68. package/dist/esm/surveys/_internal/SurveyBusinessRules.js.map +1 -1
  69. package/dist/esm/utils/date/getDatePickerDate.js +27 -0
  70. package/dist/esm/utils/date/getDatePickerDate.js.map +1 -0
  71. package/dist/esm/utils/date/getTimePickerTime.js +33 -0
  72. package/dist/esm/utils/date/getTimePickerTime.js.map +1 -0
  73. package/dist/esm/utils/date/guessTimeZone.js +8 -0
  74. package/dist/esm/utils/date/guessTimeZone.js.map +1 -0
  75. package/dist/esm/utils/date/index.js +4 -0
  76. package/dist/esm/utils/date/index.js.map +1 -0
  77. package/dist/esm/utils/index.js +1 -0
  78. package/dist/esm/utils/index.js.map +1 -1
  79. package/dist/node/core/EntityEditor.js +4 -0
  80. package/dist/node/core/EntityEditor.js.map +1 -1
  81. package/dist/node/core/fetchHubEntity.js +4 -0
  82. package/dist/node/core/fetchHubEntity.js.map +1 -1
  83. package/dist/node/core/getTypeFromEntity.js +3 -0
  84. package/dist/node/core/getTypeFromEntity.js.map +1 -1
  85. package/dist/node/core/schemas/internal/follow/FollowCardUiSchema.js +98 -63
  86. package/dist/node/core/schemas/internal/follow/FollowCardUiSchema.js.map +1 -1
  87. package/dist/node/core/schemas/internal/follow/FollowSchema.js +2 -7
  88. package/dist/node/core/schemas/internal/follow/FollowSchema.js.map +1 -1
  89. package/dist/node/core/schemas/internal/getEditorSchemas.js +13 -0
  90. package/dist/node/core/schemas/internal/getEditorSchemas.js.map +1 -1
  91. package/dist/node/core/schemas/types.js +2 -0
  92. package/dist/node/core/schemas/types.js.map +1 -1
  93. package/dist/node/core/types/HubEntityType.js +1 -0
  94. package/dist/node/core/types/HubEntityType.js.map +1 -1
  95. package/dist/node/core/updateHubEntity.js +8 -0
  96. package/dist/node/core/updateHubEntity.js.map +1 -1
  97. package/dist/node/discussions/_internal/DiscussionBusinessRules.js +7 -0
  98. package/dist/node/discussions/_internal/DiscussionBusinessRules.js.map +1 -1
  99. package/dist/node/discussions/api/settings/getDefaultEntitySettings.js +1 -0
  100. package/dist/node/discussions/api/settings/getDefaultEntitySettings.js.map +1 -1
  101. package/dist/node/events/HubEvent.js +153 -0
  102. package/dist/node/events/HubEvent.js.map +1 -0
  103. package/dist/node/events/_internal/EventBusinessRules.js +118 -0
  104. package/dist/node/events/_internal/EventBusinessRules.js.map +1 -0
  105. package/dist/node/events/_internal/EventSchemaCreate.js +53 -0
  106. package/dist/node/events/_internal/EventSchemaCreate.js.map +1 -0
  107. package/dist/node/events/_internal/EventSchemaEdit.js +80 -0
  108. package/dist/node/events/_internal/EventSchemaEdit.js.map +1 -0
  109. package/dist/node/events/_internal/EventUiSchemaCreate.js +168 -0
  110. package/dist/node/events/_internal/EventUiSchemaCreate.js.map +1 -0
  111. package/dist/node/events/_internal/EventUiSchemaEdit.js +374 -0
  112. package/dist/node/events/_internal/EventUiSchemaEdit.js.map +1 -0
  113. package/dist/node/events/_internal/PropertyMapper.js +138 -0
  114. package/dist/node/events/_internal/PropertyMapper.js.map +1 -0
  115. package/dist/node/events/_internal/getDefaultEventDatesAndTimes.js +31 -0
  116. package/dist/node/events/_internal/getDefaultEventDatesAndTimes.js.map +1 -0
  117. package/dist/node/events/_internal/getISOStringFromClientDateTime.js +32 -0
  118. package/dist/node/events/_internal/getISOStringFromClientDateTime.js.map +1 -0
  119. package/dist/node/events/_internal/getPropertyMap.js +51 -0
  120. package/dist/node/events/_internal/getPropertyMap.js.map +1 -0
  121. package/dist/node/events/_internal/validations.js +56 -0
  122. package/dist/node/events/_internal/validations.js.map +1 -0
  123. package/dist/node/events/defaults.js +37 -0
  124. package/dist/node/events/defaults.js.map +1 -0
  125. package/dist/node/events/edit.js +86 -0
  126. package/dist/node/events/edit.js.map +1 -0
  127. package/dist/node/events/fetch.js +34 -0
  128. package/dist/node/events/fetch.js.map +1 -0
  129. package/dist/node/events/index.js +4 -1
  130. package/dist/node/events/index.js.map +1 -1
  131. package/dist/node/events/types.js +15 -0
  132. package/dist/node/events/types.js.map +1 -0
  133. package/dist/node/index.js +1 -0
  134. package/dist/node/index.js.map +1 -1
  135. package/dist/node/initiatives/_internal/computeProps.js +3 -3
  136. package/dist/node/initiatives/_internal/computeProps.js.map +1 -1
  137. package/dist/node/initiatives/_internal/getPropertyMap.js +5 -0
  138. package/dist/node/initiatives/_internal/getPropertyMap.js.map +1 -1
  139. package/dist/node/permissions/HubPermissionPolicies.js +2 -0
  140. package/dist/node/permissions/HubPermissionPolicies.js.map +1 -1
  141. package/dist/node/permissions/types/Permission.js +2 -0
  142. package/dist/node/permissions/types/Permission.js.map +1 -1
  143. package/dist/node/surveys/HubSurvey.js +24 -0
  144. package/dist/node/surveys/HubSurvey.js.map +1 -1
  145. package/dist/node/surveys/_internal/SurveyBusinessRules.js +14 -1
  146. package/dist/node/surveys/_internal/SurveyBusinessRules.js.map +1 -1
  147. package/dist/node/utils/date/getDatePickerDate.js +31 -0
  148. package/dist/node/utils/date/getDatePickerDate.js.map +1 -0
  149. package/dist/node/utils/date/getTimePickerTime.js +37 -0
  150. package/dist/node/utils/date/getTimePickerTime.js.map +1 -0
  151. package/dist/node/utils/date/guessTimeZone.js +12 -0
  152. package/dist/node/utils/date/guessTimeZone.js.map +1 -0
  153. package/dist/node/utils/date/index.js +7 -0
  154. package/dist/node/utils/date/index.js.map +1 -0
  155. package/dist/node/utils/index.js +1 -0
  156. package/dist/node/utils/index.js.map +1 -1
  157. package/dist/types/core/schemas/internal/follow/FollowCardUiSchema.d.ts +0 -5
  158. package/dist/types/core/schemas/types.d.ts +2 -2
  159. package/dist/types/core/types/HubEntity.d.ts +2 -1
  160. package/dist/types/core/types/HubEntityType.d.ts +1 -1
  161. package/dist/types/core/types/IHubEvent.d.ts +113 -5
  162. package/dist/types/discussions/_internal/DiscussionBusinessRules.d.ts +1 -1
  163. package/dist/types/events/HubEvent.d.ts +77 -0
  164. package/dist/types/events/_internal/EventBusinessRules.d.ts +12 -0
  165. package/dist/types/events/_internal/EventSchemaCreate.d.ts +8 -0
  166. package/dist/types/events/_internal/EventSchemaEdit.d.ts +6 -0
  167. package/dist/types/events/_internal/EventUiSchemaCreate.d.ts +10 -0
  168. package/dist/types/events/_internal/EventUiSchemaEdit.d.ts +10 -0
  169. package/dist/types/events/_internal/PropertyMapper.d.ts +35 -0
  170. package/dist/types/events/_internal/getDefaultEventDatesAndTimes.d.ts +14 -0
  171. package/dist/types/events/_internal/getISOStringFromClientDateTime.d.ts +18 -0
  172. package/dist/types/events/_internal/getPropertyMap.d.ts +8 -0
  173. package/dist/types/events/_internal/validations.d.ts +58 -0
  174. package/dist/types/events/defaults.d.ts +10 -0
  175. package/dist/types/events/edit.d.ts +21 -0
  176. package/dist/types/events/fetch.d.ts +19 -0
  177. package/dist/types/events/index.d.ts +4 -1
  178. package/dist/types/events/types.d.ts +9 -0
  179. package/dist/types/index.d.ts +1 -0
  180. package/dist/types/permissions/types/Permission.d.ts +2 -1
  181. package/dist/types/surveys/HubSurvey.d.ts +7 -0
  182. package/dist/types/surveys/_internal/SurveyBusinessRules.d.ts +1 -1
  183. package/dist/types/utils/date/getDatePickerDate.d.ts +17 -0
  184. package/dist/types/utils/date/getTimePickerTime.d.ts +17 -0
  185. package/dist/types/utils/date/guessTimeZone.d.ts +5 -0
  186. package/dist/types/utils/date/index.d.ts +3 -0
  187. package/dist/types/utils/index.d.ts +1 -0
  188. package/package.json +1 -1
@@ -0,0 +1,371 @@
1
+ import { UiSchemaRuleEffects } from "../../core/schemas/types";
2
+ import { getDatePickerDate } from "../../utils/date/getDatePickerDate";
3
+ import { getCategoryItems } from "../../core/schemas/internal/getCategoryItems";
4
+ import { getTagItems } from "../../core/schemas/internal/getTagItems";
5
+ import { HubEventAttendanceType, HubEventOnlineCapacityType } from "../types";
6
+ /**
7
+ * @private
8
+ * constructs the complete edit uiSchema for Hub Events.
9
+ * This defines how the schema properties should be
10
+ * rendered in the event creation experience
11
+ */
12
+ export const buildUiSchema = async (i18nScope, options, context) => {
13
+ const minStartEndDate = getDatePickerDate(new Date(), options.timeZone);
14
+ return {
15
+ type: "Layout",
16
+ elements: [
17
+ {
18
+ type: "Section",
19
+ labelKey: `${i18nScope}.sections.eventInfo.label`,
20
+ elements: [
21
+ {
22
+ labelKey: `${i18nScope}.fields.name.label`,
23
+ scope: "/properties/name",
24
+ type: "Control",
25
+ options: {
26
+ messages: [
27
+ {
28
+ type: "ERROR",
29
+ keyword: "required",
30
+ icon: true,
31
+ labelKey: `${i18nScope}.fields.name.requiredError`,
32
+ },
33
+ {
34
+ type: "ERROR",
35
+ keyword: "maxLength",
36
+ icon: true,
37
+ labelKey: `shared.fields.title.maxLengthError`,
38
+ },
39
+ ],
40
+ },
41
+ },
42
+ {
43
+ labelKey: `${i18nScope}.fields.description.label`,
44
+ scope: "/properties/description",
45
+ type: "Control",
46
+ options: {
47
+ control: "hub-field-input-rich-text",
48
+ type: "textarea",
49
+ helperText: {
50
+ labelKey: `${i18nScope}.fields.description.helperText`,
51
+ },
52
+ messages: [
53
+ {
54
+ type: "ERROR",
55
+ keyword: "required",
56
+ icon: true,
57
+ labelKey: `${i18nScope}.fields.description.requiredError`,
58
+ },
59
+ ],
60
+ },
61
+ },
62
+ ],
63
+ },
64
+ {
65
+ type: "Section",
66
+ labelKey: `${i18nScope}.sections.dateTime.label`,
67
+ elements: [
68
+ {
69
+ labelKey: `${i18nScope}.fields.startDate.label`,
70
+ scope: "/properties/startDate",
71
+ type: "Control",
72
+ options: {
73
+ control: "hub-field-input-date",
74
+ min: minStartEndDate,
75
+ messages: [
76
+ {
77
+ type: "ERROR",
78
+ keyword: "required",
79
+ icon: true,
80
+ labelKey: `${i18nScope}.fields.startDate.requiredError`,
81
+ },
82
+ {
83
+ type: "ERROR",
84
+ keyword: "formatMinimum",
85
+ icon: true,
86
+ labelKey: `${i18nScope}.fields.startDate.minDateError`,
87
+ },
88
+ ],
89
+ },
90
+ },
91
+ {
92
+ labelKey: `${i18nScope}.fields.endDate.label`,
93
+ scope: "/properties/endDate",
94
+ type: "Control",
95
+ options: {
96
+ control: "hub-field-input-date",
97
+ min: minStartEndDate,
98
+ messages: [
99
+ {
100
+ type: "ERROR",
101
+ keyword: "required",
102
+ icon: true,
103
+ labelKey: `${i18nScope}.fields.endDate.requiredError`,
104
+ },
105
+ {
106
+ type: "ERROR",
107
+ keyword: "formatMinimum",
108
+ icon: true,
109
+ labelKey: `${i18nScope}.fields.endDate.minDateError`,
110
+ },
111
+ ],
112
+ },
113
+ },
114
+ {
115
+ labelKey: `${i18nScope}.fields.allDay.label`,
116
+ type: "Control",
117
+ scope: "/properties/isAllDay",
118
+ options: {
119
+ control: "hub-field-input-switch",
120
+ },
121
+ },
122
+ {
123
+ labelKey: `${i18nScope}.fields.startTime.label`,
124
+ scope: "/properties/startTime",
125
+ type: "Control",
126
+ rule: {
127
+ condition: {
128
+ scope: "/properties/isAllDay",
129
+ schema: { const: false },
130
+ },
131
+ effect: UiSchemaRuleEffects.SHOW,
132
+ },
133
+ options: {
134
+ control: "hub-field-input-time",
135
+ messages: [
136
+ {
137
+ type: "ERROR",
138
+ keyword: "required",
139
+ icon: true,
140
+ labelKey: `${i18nScope}.fields.startTime.requiredError`,
141
+ },
142
+ ],
143
+ },
144
+ },
145
+ {
146
+ labelKey: `${i18nScope}.fields.endTime.label`,
147
+ scope: "/properties/endTime",
148
+ type: "Control",
149
+ rule: {
150
+ condition: {
151
+ scope: "/properties/isAllDay",
152
+ schema: { const: false },
153
+ },
154
+ effect: UiSchemaRuleEffects.SHOW,
155
+ },
156
+ options: {
157
+ control: "hub-field-input-time",
158
+ messages: [
159
+ {
160
+ type: "ERROR",
161
+ keyword: "required",
162
+ icon: true,
163
+ labelKey: `${i18nScope}.fields.endTime.requiredError`,
164
+ },
165
+ {
166
+ type: "ERROR",
167
+ keyword: "formatExclusiveMinimum",
168
+ icon: true,
169
+ labelKey: `${i18nScope}.fields.endTime.minTimeError`,
170
+ },
171
+ ],
172
+ },
173
+ },
174
+ ],
175
+ },
176
+ {
177
+ type: "Section",
178
+ labelKey: `${i18nScope}.sections.location.label`,
179
+ elements: [
180
+ {
181
+ labelKey: `${i18nScope}.fields.attendanceType.label`,
182
+ scope: "/properties/attendanceType",
183
+ type: "Control",
184
+ options: {
185
+ control: "hub-field-input-radio-group",
186
+ enum: { i18nScope: `${i18nScope}.fields.attendanceType` },
187
+ },
188
+ },
189
+ {
190
+ labelKey: `${i18nScope}.fields.onlineUrl.label`,
191
+ scope: "/properties/onlineUrl",
192
+ type: "Control",
193
+ rule: {
194
+ condition: {
195
+ scope: "/properties/attendanceType",
196
+ schema: {
197
+ enum: [
198
+ HubEventAttendanceType.Online,
199
+ HubEventAttendanceType.Both,
200
+ ],
201
+ },
202
+ },
203
+ effect: UiSchemaRuleEffects.SHOW,
204
+ },
205
+ options: {
206
+ control: "hub-field-input-input",
207
+ messages: [
208
+ {
209
+ type: "ERROR",
210
+ keyword: "required",
211
+ icon: true,
212
+ labelKey: `${i18nScope}.fields.onlineUrl.requiredError`,
213
+ },
214
+ {
215
+ type: "ERROR",
216
+ keyword: "format",
217
+ icon: true,
218
+ labelKey: `${i18nScope}.fields.onlineUrl.linkHrefFormatError`,
219
+ },
220
+ ],
221
+ },
222
+ },
223
+ {
224
+ labelKey: `${i18nScope}.fields.onlineDetails.label`,
225
+ scope: "/properties/onlineDetails",
226
+ type: "Control",
227
+ rule: {
228
+ condition: {
229
+ scope: "/properties/attendanceType",
230
+ schema: {
231
+ enum: [
232
+ HubEventAttendanceType.Online,
233
+ HubEventAttendanceType.Both,
234
+ ],
235
+ },
236
+ },
237
+ effect: UiSchemaRuleEffects.SHOW,
238
+ },
239
+ options: {
240
+ control: "hub-field-input-rich-text",
241
+ type: "textarea",
242
+ helperText: {
243
+ labelKey: `${i18nScope}.fields.onlineDetails.helperText`,
244
+ },
245
+ },
246
+ },
247
+ {
248
+ labelKey: `${i18nScope}.fields.onlineCapacityType.label`,
249
+ scope: "/properties/onlineCapacityType",
250
+ type: "Control",
251
+ rule: {
252
+ condition: {
253
+ scope: "/properties/attendanceType",
254
+ schema: {
255
+ enum: [
256
+ HubEventAttendanceType.Online,
257
+ HubEventAttendanceType.Both,
258
+ ],
259
+ },
260
+ },
261
+ effect: UiSchemaRuleEffects.SHOW,
262
+ },
263
+ options: {
264
+ control: "hub-field-input-radio-group",
265
+ enum: { i18nScope: `${i18nScope}.fields.onlineCapacityType` },
266
+ },
267
+ },
268
+ {
269
+ labelKey: `${i18nScope}.fields.onlineCapacity.label`,
270
+ scope: "/properties/onlineCapacity",
271
+ type: "Control",
272
+ rule: {
273
+ condition: {
274
+ schema: {
275
+ properties: {
276
+ attendanceType: {
277
+ enum: [
278
+ HubEventAttendanceType.Online,
279
+ HubEventAttendanceType.Both,
280
+ ],
281
+ },
282
+ onlineCapacityType: {
283
+ const: HubEventOnlineCapacityType.Fixed,
284
+ },
285
+ },
286
+ },
287
+ },
288
+ effect: UiSchemaRuleEffects.SHOW,
289
+ },
290
+ options: {
291
+ control: "hub-field-input-input",
292
+ type: "number",
293
+ messages: [
294
+ {
295
+ type: "ERROR",
296
+ keyword: "required",
297
+ icon: true,
298
+ labelKey: `${i18nScope}.fields.onlineCapacity.requiredError`,
299
+ },
300
+ {
301
+ type: "ERROR",
302
+ keyword: "minimum",
303
+ icon: true,
304
+ labelKey: `${i18nScope}.fields.onlineCapacity.minimumError`,
305
+ },
306
+ ],
307
+ },
308
+ },
309
+ ],
310
+ },
311
+ {
312
+ type: "Section",
313
+ labelKey: `${i18nScope}.sections.discoverability.label`,
314
+ elements: [
315
+ {
316
+ labelKey: `${i18nScope}.fields.tags.label`,
317
+ scope: "/properties/tags",
318
+ type: "Control",
319
+ options: {
320
+ control: "hub-field-input-combobox",
321
+ items: await getTagItems(options.tags, context.portal.id, context.hubRequestOptions),
322
+ allowCustomValues: true,
323
+ selectionMode: "multiple",
324
+ placeholderIcon: "label",
325
+ helperText: {
326
+ labelKey: `${i18nScope}.fields.tags.helperText`,
327
+ },
328
+ },
329
+ },
330
+ {
331
+ labelKey: `${i18nScope}.fields.categories.label`,
332
+ scope: "/properties/categories",
333
+ type: "Control",
334
+ options: {
335
+ control: "hub-field-input-combobox",
336
+ items: await getCategoryItems(context.portal.id, context.hubRequestOptions),
337
+ allowCustomValues: false,
338
+ selectionMode: "multiple",
339
+ placeholderIcon: "select-category",
340
+ helperText: {
341
+ labelKey: `${i18nScope}.fields.categories.helperText`,
342
+ },
343
+ },
344
+ },
345
+ {
346
+ labelKey: `${i18nScope}.fields.summary.label`,
347
+ scope: "/properties/summary",
348
+ type: "Control",
349
+ options: {
350
+ control: "hub-field-input-input",
351
+ type: "textarea",
352
+ rows: 4,
353
+ helperText: {
354
+ labelKey: `${i18nScope}.fields.summary.helperText`,
355
+ },
356
+ messages: [
357
+ {
358
+ type: "ERROR",
359
+ keyword: "maxLength",
360
+ icon: true,
361
+ labelKey: `shared.fields.summary.maxLengthError`,
362
+ },
363
+ ],
364
+ },
365
+ },
366
+ ],
367
+ },
368
+ ],
369
+ };
370
+ };
371
+ //# sourceMappingURL=EventUiSchemaEdit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventUiSchemaEdit.js","sourceRoot":"","sources":["../../../../src/events/_internal/EventUiSchemaEdit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAE9E;;;;;GA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iCACjD;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,134 @@
1
+ import { PropertyMapper, mapEntityToStore, mapStoreToEntity, } from "../../core/_internal/PropertyMapper";
2
+ import { cloneObject } from "../../util";
3
+ import { getDatePickerDate } from "../../utils/date/getDatePickerDate";
4
+ import { getTimePickerTime } from "../../utils/date/getTimePickerTime";
5
+ import { getISOStringFromClientDateTime } from "./getISOStringFromClientDateTime";
6
+ import { EventAttendanceType, EventStatus, } from "../api/orval/api/orval-events";
7
+ import { HubEventAttendanceType, HubEventOnlineCapacityType } from "../types";
8
+ /**
9
+ * @private
10
+ * Manage forward and backward property mappings to
11
+ * streamline conversion between a Hub Event, and
12
+ * the backing Store objects.
13
+ */
14
+ export class EventPropertyMapper extends PropertyMapper {
15
+ /**
16
+ * Map properties from a Store object, on to an Entity object.
17
+ *
18
+ * Used when constructing an Entity from a fetched Store object,
19
+ * in which case the Entity should be an empty object (`{}`).
20
+ *
21
+ * Can also be used to apply changes to an Entity from a Store,
22
+ * in which case an existing Entity can be passed in.
23
+ * @param store
24
+ * @param entity
25
+ * @returns
26
+ */
27
+ storeToEntity(store, entity) {
28
+ // TODO: support locations
29
+ // TODO: thumbnail & thumbnail url
30
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
31
+ const obj = mapStoreToEntity(store, entity, this.mappings);
32
+ obj.type = "Event";
33
+ obj.access = store.access.toLowerCase();
34
+ obj.isCanceled = store.status === EventStatus.CANCELED;
35
+ obj.isPlanned = store.status === EventStatus.PLANNED;
36
+ obj.isRemoved = store.status === EventStatus.REMOVED;
37
+ if (store.attendanceType.includes(EventAttendanceType.IN_PERSON) &&
38
+ store.attendanceType.includes(EventAttendanceType.VIRTUAL)) {
39
+ obj.attendanceType = HubEventAttendanceType.Both;
40
+ }
41
+ else if (store.attendanceType.includes(EventAttendanceType.IN_PERSON)) {
42
+ obj.attendanceType = HubEventAttendanceType.InPerson;
43
+ }
44
+ else {
45
+ obj.attendanceType = HubEventAttendanceType.Online;
46
+ }
47
+ obj.inPersonCapacity = (_c = (_b = (_a = store.addresses) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.capacity) !== null && _c !== void 0 ? _c : null;
48
+ obj.onlineCapacity = (_f = (_e = (_d = store.onlineMeetings) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.capacity) !== null && _f !== void 0 ? _f : null;
49
+ obj.onlineCapacityType = ((_h = (_g = store.onlineMeetings) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.capacity) ? HubEventOnlineCapacityType.Fixed
50
+ : HubEventOnlineCapacityType.Unlimited;
51
+ obj.onlineDetails = (_l = (_k = (_j = store.onlineMeetings) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.details) !== null && _l !== void 0 ? _l : null;
52
+ obj.onlineUrl = (_p = (_o = (_m = store.onlineMeetings) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.url) !== null && _p !== void 0 ? _p : null;
53
+ obj.canChangeAccess = [
54
+ store.permission.canSetAccessToPublic,
55
+ store.permission.canSetAccessToOrg,
56
+ store.permission.canSetAccessToPrivate,
57
+ ].some(Boolean);
58
+ obj.canChangeStatus = [
59
+ store.permission.canSetStatusToCancelled,
60
+ store.permission.canSetStatusToRemoved,
61
+ ].some(Boolean);
62
+ // Handle Dates
63
+ obj.createdDate = new Date(store.createdAt);
64
+ obj.startDateTime = new Date(store.startDateTime);
65
+ obj.endDateTime = new Date(store.endDateTime);
66
+ obj.startDate = getDatePickerDate(store.startDateTime, store.timeZone);
67
+ obj.endDate = getDatePickerDate(store.endDateTime, store.timeZone);
68
+ obj.startTime = getTimePickerTime(store.startDateTime, store.timeZone);
69
+ obj.endTime = getTimePickerTime(store.endDateTime, store.timeZone);
70
+ obj.createdDateSource = "createdAt";
71
+ obj.updatedDate = new Date(store.updatedAt);
72
+ obj.updatedDateSource = "updatedAt";
73
+ return obj;
74
+ }
75
+ /**
76
+ * Map properties from an entity object onto a model.
77
+ *
78
+ * Typically the model will already exist, and this
79
+ * method is used to transfer changes to the model
80
+ * prior to storage.
81
+ * @param entity
82
+ * @param store
83
+ * @returns
84
+ */
85
+ entityToStore(entity, store) {
86
+ // TODO: support locations
87
+ // TODO: thumbnail & thumbnail url
88
+ const clonedEntity = cloneObject(entity);
89
+ const obj = mapEntityToStore(clonedEntity, store, this.mappings);
90
+ obj.access = clonedEntity.access.toUpperCase();
91
+ if (clonedEntity.isRemoved) {
92
+ obj.status = EventStatus.REMOVED;
93
+ }
94
+ else if (clonedEntity.isCanceled) {
95
+ obj.status = EventStatus.CANCELED;
96
+ }
97
+ else {
98
+ obj.status = EventStatus.PLANNED;
99
+ }
100
+ if (clonedEntity.attendanceType === HubEventAttendanceType.Both) {
101
+ obj.attendanceType = [
102
+ EventAttendanceType.IN_PERSON,
103
+ EventAttendanceType.VIRTUAL,
104
+ ];
105
+ }
106
+ else if (clonedEntity.attendanceType === HubEventAttendanceType.InPerson) {
107
+ obj.attendanceType = [EventAttendanceType.IN_PERSON];
108
+ }
109
+ else {
110
+ obj.attendanceType = [EventAttendanceType.VIRTUAL];
111
+ }
112
+ if ([HubEventAttendanceType.Online, HubEventAttendanceType.Both].includes(clonedEntity.attendanceType)) {
113
+ obj.onlineMeetings = [
114
+ {
115
+ details: clonedEntity.onlineDetails,
116
+ capacity: clonedEntity.onlineCapacityType === HubEventOnlineCapacityType.Fixed
117
+ ? clonedEntity.onlineCapacity
118
+ : null,
119
+ url: clonedEntity.onlineUrl,
120
+ },
121
+ ];
122
+ }
123
+ // override startTime & endTime for all-day events
124
+ if (clonedEntity.isAllDay) {
125
+ clonedEntity.startTime = "00:00:00";
126
+ clonedEntity.endTime = "23:59:59";
127
+ }
128
+ // build start & end date/time iso strings, adjusted for desired time zone
129
+ obj.startDateTime = getISOStringFromClientDateTime(clonedEntity.startDate, clonedEntity.startTime);
130
+ obj.endDateTime = getISOStringFromClientDateTime(clonedEntity.endDate, clonedEntity.endTime);
131
+ return obj;
132
+ }
133
+ }
134
+ //# sourceMappingURL=PropertyMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyMapper.js","sourceRoot":"","sources":["../../../../src/events/_internal/PropertyMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAEL,mBAAmB,EACnB,WAAW,GAGZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,cAGxC;IACC;;;;;;;;;;;OAWG;IACH,aAAa,CACX,KAAsB,EACtB,MAA0B;QAE1B,0BAA0B;QAC1B,kCAAkC;;QAElC,MAAM,GAAG,GAAG,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE3D,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC;QACnB,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,EAAyB,CAAC;QAC/D,GAAG,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC,QAAQ,CAAC;QACvD,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC,OAAO,CAAC;QACrD,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,K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,GAAG,CAAC,aAAa,GAAG,8BAA8B,CAChD,YAAY,CAAC,SAAS,EACtB,YAAY,CAAC,SAAS,CACvB,CAAC;QACF,GAAG,CAAC,WAAW,GAAG,8BAA8B,CAC9C,YAAY,CAAC,OAAO,EACpB,YAAY,CAAC,OAAO,CACrB,CAAC;QAEF,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
@@ -0,0 +1,28 @@
1
+ import { getDatePickerDate } from "../../utils/date/getDatePickerDate";
2
+ import { getTimePickerTime } from "../../utils/date/getTimePickerTime";
3
+ import { guessTimeZone } from "../../utils/date/guessTimeZone";
4
+ /**
5
+ * @private
6
+ * Builds an object containing the user's guessed timezone and default
7
+ * event start/end dates and times
8
+ */
9
+ export const getDefaultEventDatesAndTimes = () => {
10
+ const hour = 1000 * 60 * 60;
11
+ const nowPlus1Hour = new Date(Date.now() + hour);
12
+ const nextFullHour = new Date(nowPlus1Hour.getFullYear(), nowPlus1Hour.getMonth(), nowPlus1Hour.getDate(), nowPlus1Hour.getHours());
13
+ const sDate = nextFullHour.toISOString();
14
+ const eDate = new Date(nextFullHour.valueOf() + hour).toISOString();
15
+ const timeZone = guessTimeZone();
16
+ const startDate = getDatePickerDate(sDate, timeZone);
17
+ const endDate = getDatePickerDate(eDate, timeZone);
18
+ return {
19
+ startDate,
20
+ startDateTime: new Date(sDate),
21
+ startTime: getTimePickerTime(sDate, timeZone),
22
+ endDate,
23
+ endDateTime: new Date(eDate),
24
+ endTime: getTimePickerTime(eDate, timeZone),
25
+ timeZone,
26
+ };
27
+ };
28
+ //# sourceMappingURL=getDefaultEventDatesAndTimes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDefaultEventDatesAndTimes.js","sourceRoot":"","sources":["../../../../src/events/_internal/getDefaultEventDatesAndTimes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;IAC5B,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,IAAI,IAAI,CAC3B,YAAY,CAAC,WAAW,EAAE,EAC1B,YAAY,CAAC,QAAQ,EAAE,EACvB,YAAY,CAAC,OAAO,EAAE,EACtB,YAAY,CAAC,QAAQ,EAAE,CACxB,CAAC;IACF,MAAM,KAAK,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACpE,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACnD,OAAO;QACL,SAAS;QACT,aAAa,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC;QAC9B,SAAS,EAAE,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC;QAC7C,OAAO;QACP,WAAW,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC;QAC5B,OAAO,EAAE,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC;QAC3C,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @private
3
+ * A utility method to aid in generating an ISO-8601 UTC date/time string from separate date & time
4
+ * inputs for the client's current locale.
5
+ *
6
+ * // a user in the America/New_York timeZone
7
+ * getTimeZoneISOStringFromLocalDateTime('2024-03-29', '13:00:00')
8
+ * // => `2024-03-29T17:00:00.000Z`
9
+ *
10
+ * // a user in America/Los_Angeles timeZone
11
+ * getTimeZoneISOStringFromLocalDateTime('2024-03-29', '13:00:00')
12
+ * // => `2024-03-29T20:00:00.000Z`
13
+ *
14
+ * @param date A date string in the format of `2024-03-29`
15
+ * @param time A time string in 24-hour format of `13:00:00`
16
+ * @returns an ISO-8601 UTC date/time string, e.g. `2024-03-29T16:00:00.000Z`
17
+ */
18
+ export function getISOStringFromClientDateTime(date, time) {
19
+ const [yr, mon, day] = date
20
+ .split("-")
21
+ .map((segment) => parseInt(segment, 10));
22
+ const [hr, min, sec] = time
23
+ .split(":")
24
+ .map((segment) => parseInt(segment, 10));
25
+ const timeZoneDateTime = new Date(yr, mon - 1, day, hr, min, sec, 0);
26
+ return timeZoneDateTime.toISOString();
27
+ }
28
+ //# sourceMappingURL=getISOStringFromClientDateTime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getISOStringFromClientDateTime.js","sourceRoot":"","sources":["../../../../src/events/_internal/getISOStringFromClientDateTime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,8BAA8B,CAC5C,IAAY,EACZ,IAAY;IAEZ,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI;SACxB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI;SACxB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3C,MAAM,gBAAgB,GAAG,IAAI,IAAI,CAAC,EAAE,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IACrE,OAAO,gBAAgB,CAAC,WAAW,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @private
3
+ * Returns an Array of IPropertyMap objects
4
+ * that define the projection of properties from an IEvent to an IHubEvent
5
+ * @returns an IPropertyMap array
6
+ */
7
+ export function getPropertyMap() {
8
+ const commonPropNames = [
9
+ "orgId",
10
+ "description",
11
+ "id",
12
+ "tags",
13
+ "categories",
14
+ "timeZone",
15
+ "summary",
16
+ "notifyAttendees",
17
+ "allowRegistration",
18
+ ];
19
+ return commonPropNames.reduce((acc, propName) => [...acc, { entityKey: propName, storeKey: propName }], [
20
+ { entityKey: "isAllDay", storeKey: "allDay" },
21
+ { entityKey: "name", storeKey: "title" },
22
+ { entityKey: "owner", storeKey: "createdById" },
23
+ { entityKey: "canEdit", storeKey: "permission.canEdit" },
24
+ { entityKey: "canDelete", storeKey: "permission.canDelete" },
25
+ {
26
+ entityKey: "canChangeAccessOrg",
27
+ storeKey: "permission.canSetAccessToOrg",
28
+ },
29
+ {
30
+ entityKey: "canChangeAccessPrivate",
31
+ storeKey: "permission.canSetAccessToPrivate",
32
+ },
33
+ {
34
+ entityKey: "canChangeAccessPublic",
35
+ storeKey: "permission.canSetAccessToPublic",
36
+ },
37
+ {
38
+ entityKey: "canChangeStatusCancelled",
39
+ storeKey: "permission.canSetStatusToCancelled",
40
+ },
41
+ {
42
+ entityKey: "canChangeStatusRemoved",
43
+ storeKey: "permission.canSetStatusToRemoved",
44
+ },
45
+ ]);
46
+ }
47
+ //# sourceMappingURL=getPropertyMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPropertyMap.js","sourceRoot":"","sources":["../../../../src/events/_internal/getPropertyMap.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,eAAe,GAAG;QACtB,OAAO;QACP,aAAa;QACb,IAAI;QACJ,MAAM;QACN,YAAY;QACZ,UAAU;QACV,SAAS;QACT,iBAAiB;QACjB,mBAAmB;KACpB,CAAC;IACF,OAAO,eAAe,CAAC,MAAM,CAC3B,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EACxE;QACE,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE;QAC7C,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE;QACxC,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE;QAC/C,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,oBAAoB,EAAE;QACxD,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,sBAAsB,EAAE;QAC5D;YACE,SAAS,EAAE,oBAAoB;YAC/B,QAAQ,EAAE,8BAA8B;SACzC;QACD;YACE,SAAS,EAAE,wBAAwB;YACnC,QAAQ,EAAE,kCAAkC;SAC7C;QACD;YACE,SAAS,EAAE,uBAAuB;YAClC,QAAQ,EAAE,iCAAiC;SAC5C;QACD;YACE,SAAS,EAAE,0BAA0B;YACrC,QAAQ,EAAE,oCAAoC;SAC/C;QACD;YACE,SAAS,EAAE,wBAAwB;YACnC,QAAQ,EAAE,kCAAkC;SAC7C;KACF,CACF,CAAC;AACJ,CAAC"}