@esri/hub-common 14.110.1 → 14.111.1

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 (175) 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/getEditorSchemas.js +13 -0
  8. package/dist/esm/core/schemas/internal/getEditorSchemas.js.map +1 -1
  9. package/dist/esm/core/schemas/internal/metrics/MetricSchema.js +4 -0
  10. package/dist/esm/core/schemas/internal/metrics/MetricSchema.js.map +1 -1
  11. package/dist/esm/core/schemas/types.js +2 -0
  12. package/dist/esm/core/schemas/types.js.map +1 -1
  13. package/dist/esm/core/types/HubEntityType.js +1 -0
  14. package/dist/esm/core/types/HubEntityType.js.map +1 -1
  15. package/dist/esm/core/updateHubEntity.js +8 -0
  16. package/dist/esm/core/updateHubEntity.js.map +1 -1
  17. package/dist/esm/discussions/_internal/DiscussionBusinessRules.js +7 -0
  18. package/dist/esm/discussions/_internal/DiscussionBusinessRules.js.map +1 -1
  19. package/dist/esm/discussions/api/settings/getDefaultEntitySettings.js +1 -0
  20. package/dist/esm/discussions/api/settings/getDefaultEntitySettings.js.map +1 -1
  21. package/dist/esm/events/HubEvent.js +149 -0
  22. package/dist/esm/events/HubEvent.js.map +1 -0
  23. package/dist/esm/events/_internal/EventBusinessRules.js +115 -0
  24. package/dist/esm/events/_internal/EventBusinessRules.js.map +1 -0
  25. package/dist/esm/events/_internal/EventSchemaCreate.js +50 -0
  26. package/dist/esm/events/_internal/EventSchemaCreate.js.map +1 -0
  27. package/dist/esm/events/_internal/EventSchemaEdit.js +77 -0
  28. package/dist/esm/events/_internal/EventSchemaEdit.js.map +1 -0
  29. package/dist/esm/events/_internal/EventUiSchemaCreate.js +165 -0
  30. package/dist/esm/events/_internal/EventUiSchemaCreate.js.map +1 -0
  31. package/dist/esm/events/_internal/EventUiSchemaEdit.js +371 -0
  32. package/dist/esm/events/_internal/EventUiSchemaEdit.js.map +1 -0
  33. package/dist/esm/events/_internal/PropertyMapper.js +134 -0
  34. package/dist/esm/events/_internal/PropertyMapper.js.map +1 -0
  35. package/dist/esm/events/_internal/getDefaultEventDatesAndTimes.js +28 -0
  36. package/dist/esm/events/_internal/getDefaultEventDatesAndTimes.js.map +1 -0
  37. package/dist/esm/events/_internal/getISOStringFromClientDateTime.js +28 -0
  38. package/dist/esm/events/_internal/getISOStringFromClientDateTime.js.map +1 -0
  39. package/dist/esm/events/_internal/getPropertyMap.js +47 -0
  40. package/dist/esm/events/_internal/getPropertyMap.js.map +1 -0
  41. package/dist/esm/events/_internal/validations.js +53 -0
  42. package/dist/esm/events/_internal/validations.js.map +1 -0
  43. package/dist/esm/events/defaults.js +32 -0
  44. package/dist/esm/events/defaults.js.map +1 -0
  45. package/dist/esm/events/edit.js +81 -0
  46. package/dist/esm/events/edit.js.map +1 -0
  47. package/dist/esm/events/fetch.js +29 -0
  48. package/dist/esm/events/fetch.js.map +1 -0
  49. package/dist/esm/events/index.js +4 -1
  50. package/dist/esm/events/index.js.map +1 -1
  51. package/dist/esm/events/types.js +12 -0
  52. package/dist/esm/events/types.js.map +1 -0
  53. package/dist/esm/index.js +1 -0
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/permissions/HubPermissionPolicies.js +2 -0
  56. package/dist/esm/permissions/HubPermissionPolicies.js.map +1 -1
  57. package/dist/esm/permissions/types/Permission.js +2 -0
  58. package/dist/esm/permissions/types/Permission.js.map +1 -1
  59. package/dist/esm/surveys/HubSurvey.js +24 -0
  60. package/dist/esm/surveys/HubSurvey.js.map +1 -1
  61. package/dist/esm/surveys/_internal/SurveyBusinessRules.js +14 -1
  62. package/dist/esm/surveys/_internal/SurveyBusinessRules.js.map +1 -1
  63. package/dist/esm/utils/date/getDatePickerDate.js +27 -0
  64. package/dist/esm/utils/date/getDatePickerDate.js.map +1 -0
  65. package/dist/esm/utils/date/getTimePickerTime.js +33 -0
  66. package/dist/esm/utils/date/getTimePickerTime.js.map +1 -0
  67. package/dist/esm/utils/date/guessTimeZone.js +8 -0
  68. package/dist/esm/utils/date/guessTimeZone.js.map +1 -0
  69. package/dist/esm/utils/date/index.js +4 -0
  70. package/dist/esm/utils/date/index.js.map +1 -0
  71. package/dist/esm/utils/index.js +1 -0
  72. package/dist/esm/utils/index.js.map +1 -1
  73. package/dist/node/core/EntityEditor.js +4 -0
  74. package/dist/node/core/EntityEditor.js.map +1 -1
  75. package/dist/node/core/fetchHubEntity.js +4 -0
  76. package/dist/node/core/fetchHubEntity.js.map +1 -1
  77. package/dist/node/core/getTypeFromEntity.js +3 -0
  78. package/dist/node/core/getTypeFromEntity.js.map +1 -1
  79. package/dist/node/core/schemas/internal/getEditorSchemas.js +13 -0
  80. package/dist/node/core/schemas/internal/getEditorSchemas.js.map +1 -1
  81. package/dist/node/core/schemas/internal/metrics/MetricSchema.js +4 -0
  82. package/dist/node/core/schemas/internal/metrics/MetricSchema.js.map +1 -1
  83. package/dist/node/core/schemas/types.js +2 -0
  84. package/dist/node/core/schemas/types.js.map +1 -1
  85. package/dist/node/core/types/HubEntityType.js +1 -0
  86. package/dist/node/core/types/HubEntityType.js.map +1 -1
  87. package/dist/node/core/updateHubEntity.js +8 -0
  88. package/dist/node/core/updateHubEntity.js.map +1 -1
  89. package/dist/node/discussions/_internal/DiscussionBusinessRules.js +7 -0
  90. package/dist/node/discussions/_internal/DiscussionBusinessRules.js.map +1 -1
  91. package/dist/node/discussions/api/settings/getDefaultEntitySettings.js +1 -0
  92. package/dist/node/discussions/api/settings/getDefaultEntitySettings.js.map +1 -1
  93. package/dist/node/events/HubEvent.js +153 -0
  94. package/dist/node/events/HubEvent.js.map +1 -0
  95. package/dist/node/events/_internal/EventBusinessRules.js +118 -0
  96. package/dist/node/events/_internal/EventBusinessRules.js.map +1 -0
  97. package/dist/node/events/_internal/EventSchemaCreate.js +53 -0
  98. package/dist/node/events/_internal/EventSchemaCreate.js.map +1 -0
  99. package/dist/node/events/_internal/EventSchemaEdit.js +80 -0
  100. package/dist/node/events/_internal/EventSchemaEdit.js.map +1 -0
  101. package/dist/node/events/_internal/EventUiSchemaCreate.js +168 -0
  102. package/dist/node/events/_internal/EventUiSchemaCreate.js.map +1 -0
  103. package/dist/node/events/_internal/EventUiSchemaEdit.js +374 -0
  104. package/dist/node/events/_internal/EventUiSchemaEdit.js.map +1 -0
  105. package/dist/node/events/_internal/PropertyMapper.js +138 -0
  106. package/dist/node/events/_internal/PropertyMapper.js.map +1 -0
  107. package/dist/node/events/_internal/getDefaultEventDatesAndTimes.js +31 -0
  108. package/dist/node/events/_internal/getDefaultEventDatesAndTimes.js.map +1 -0
  109. package/dist/node/events/_internal/getISOStringFromClientDateTime.js +32 -0
  110. package/dist/node/events/_internal/getISOStringFromClientDateTime.js.map +1 -0
  111. package/dist/node/events/_internal/getPropertyMap.js +51 -0
  112. package/dist/node/events/_internal/getPropertyMap.js.map +1 -0
  113. package/dist/node/events/_internal/validations.js +56 -0
  114. package/dist/node/events/_internal/validations.js.map +1 -0
  115. package/dist/node/events/defaults.js +37 -0
  116. package/dist/node/events/defaults.js.map +1 -0
  117. package/dist/node/events/edit.js +86 -0
  118. package/dist/node/events/edit.js.map +1 -0
  119. package/dist/node/events/fetch.js +34 -0
  120. package/dist/node/events/fetch.js.map +1 -0
  121. package/dist/node/events/index.js +4 -1
  122. package/dist/node/events/index.js.map +1 -1
  123. package/dist/node/events/types.js +15 -0
  124. package/dist/node/events/types.js.map +1 -0
  125. package/dist/node/index.js +1 -0
  126. package/dist/node/index.js.map +1 -1
  127. package/dist/node/permissions/HubPermissionPolicies.js +2 -0
  128. package/dist/node/permissions/HubPermissionPolicies.js.map +1 -1
  129. package/dist/node/permissions/types/Permission.js +2 -0
  130. package/dist/node/permissions/types/Permission.js.map +1 -1
  131. package/dist/node/surveys/HubSurvey.js +24 -0
  132. package/dist/node/surveys/HubSurvey.js.map +1 -1
  133. package/dist/node/surveys/_internal/SurveyBusinessRules.js +14 -1
  134. package/dist/node/surveys/_internal/SurveyBusinessRules.js.map +1 -1
  135. package/dist/node/utils/date/getDatePickerDate.js +31 -0
  136. package/dist/node/utils/date/getDatePickerDate.js.map +1 -0
  137. package/dist/node/utils/date/getTimePickerTime.js +37 -0
  138. package/dist/node/utils/date/getTimePickerTime.js.map +1 -0
  139. package/dist/node/utils/date/guessTimeZone.js +12 -0
  140. package/dist/node/utils/date/guessTimeZone.js.map +1 -0
  141. package/dist/node/utils/date/index.js +7 -0
  142. package/dist/node/utils/date/index.js.map +1 -0
  143. package/dist/node/utils/index.js +1 -0
  144. package/dist/node/utils/index.js.map +1 -1
  145. package/dist/types/core/schemas/types.d.ts +2 -2
  146. package/dist/types/core/types/HubEntity.d.ts +2 -1
  147. package/dist/types/core/types/HubEntityType.d.ts +1 -1
  148. package/dist/types/core/types/IHubEvent.d.ts +113 -5
  149. package/dist/types/discussions/_internal/DiscussionBusinessRules.d.ts +1 -1
  150. package/dist/types/events/HubEvent.d.ts +77 -0
  151. package/dist/types/events/_internal/EventBusinessRules.d.ts +12 -0
  152. package/dist/types/events/_internal/EventSchemaCreate.d.ts +8 -0
  153. package/dist/types/events/_internal/EventSchemaEdit.d.ts +6 -0
  154. package/dist/types/events/_internal/EventUiSchemaCreate.d.ts +10 -0
  155. package/dist/types/events/_internal/EventUiSchemaEdit.d.ts +10 -0
  156. package/dist/types/events/_internal/PropertyMapper.d.ts +35 -0
  157. package/dist/types/events/_internal/getDefaultEventDatesAndTimes.d.ts +14 -0
  158. package/dist/types/events/_internal/getISOStringFromClientDateTime.d.ts +18 -0
  159. package/dist/types/events/_internal/getPropertyMap.d.ts +8 -0
  160. package/dist/types/events/_internal/validations.d.ts +58 -0
  161. package/dist/types/events/defaults.d.ts +10 -0
  162. package/dist/types/events/edit.d.ts +21 -0
  163. package/dist/types/events/fetch.d.ts +19 -0
  164. package/dist/types/events/index.d.ts +4 -1
  165. package/dist/types/events/types.d.ts +9 -0
  166. package/dist/types/index.d.ts +1 -0
  167. package/dist/types/permissions/types/Permission.d.ts +2 -1
  168. package/dist/types/surveys/HubSurvey.d.ts +7 -0
  169. package/dist/types/surveys/_internal/SurveyBusinessRules.d.ts +1 -1
  170. package/dist/types/utils/date/getDatePickerDate.d.ts +17 -0
  171. package/dist/types/utils/date/getTimePickerTime.d.ts +17 -0
  172. package/dist/types/utils/date/guessTimeZone.d.ts +5 -0
  173. package/dist/types/utils/date/index.d.ts +3 -0
  174. package/dist/types/utils/index.d.ts +1 -0
  175. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- export declare const HUB_ENTITY_TYPES: readonly ["site", "project", "initiative", "initiativeTemplate", "page", "discussion", "content", "org", "group", "template", "survey"];
1
+ export declare const HUB_ENTITY_TYPES: readonly ["site", "project", "initiative", "initiativeTemplate", "page", "discussion", "content", "org", "group", "template", "survey", "event"];
2
2
  export declare type HubEntityType = (typeof HUB_ENTITY_TYPES)[number];
@@ -1,10 +1,118 @@
1
- import { IHubEntityBase } from "./IHubEntityBase";
1
+ import { HubEventAttendanceType, HubEventOnlineCapacityType } from "../../events/types";
2
+ import { IWithPermissions, IWithSlug } from "../traits";
3
+ import { IHubItemEntity, IHubItemEntityEditor } from "./IHubItemEntity";
2
4
  /**
3
5
  * DRAFT: Under development and more properties will likely be added
4
6
  * @internal
5
7
  */
6
- export interface IHubEvent extends IHubEntityBase {
7
- location: string;
8
- startDate: Date;
9
- readonly owner: string;
8
+ export interface IHubEvent extends IHubItemEntity, IWithPermissions, IWithSlug {
9
+ /**
10
+ * True when users can be registered to attend the event
11
+ */
12
+ allowRegistration: boolean;
13
+ /**
14
+ * The attendnace type of the event. Either `online`, `inPerson` or `both`
15
+ */
16
+ attendanceType: HubEventAttendanceType;
17
+ /**
18
+ * True when the user can change the access of the event to `public`, `org` or `private`
19
+ */
20
+ canChangeAccess: boolean;
21
+ /**
22
+ * True when the user can change the access of the event to `org`
23
+ */
24
+ canChangeAccessOrg: boolean;
25
+ /**
26
+ * True when the user can change the access of the event to `private`
27
+ */
28
+ canChangeAccessPrivate: boolean;
29
+ /**
30
+ * True when the user can change the access of the event to `public`
31
+ */
32
+ canChangeAccessPublic: boolean;
33
+ /**
34
+ * True when the user can change the status of the event to `cancelled` or `removed`
35
+ */
36
+ canChangeStatus: boolean;
37
+ /**
38
+ * True when the user can change the status of the event to `cancelled`
39
+ */
40
+ canChangeStatusCancelled: boolean;
41
+ /**
42
+ * True when the user can change the status of the event to `removed`
43
+ */
44
+ canChangeStatusRemoved: boolean;
45
+ /**
46
+ * The end date of the event
47
+ */
48
+ endDate: string;
49
+ /**
50
+ * The end date & time of the event
51
+ */
52
+ endDateTime: Date;
53
+ /**
54
+ * The end time of the event
55
+ */
56
+ endTime: string;
57
+ /**
58
+ * The maximum capacity for in-person attendance
59
+ */
60
+ inPersonCapacity?: number | null;
61
+ /**
62
+ * True when the event is an all day event
63
+ */
64
+ isAllDay: boolean;
65
+ /**
66
+ * True when the event has been canceled
67
+ */
68
+ isCanceled: boolean;
69
+ /**
70
+ * True when the event is planned
71
+ */
72
+ isPlanned: boolean;
73
+ /**
74
+ * True when the event has been removed
75
+ */
76
+ isRemoved: boolean;
77
+ /**
78
+ * If attendees should be notified of event updates
79
+ */
80
+ notifyAttendees: boolean;
81
+ /**
82
+ * The maximum attendance capacity for an online event
83
+ */
84
+ onlineCapacity?: number | null;
85
+ /**
86
+ * The capacity type for an online event, either `unlimited` or `fixed`
87
+ */
88
+ onlineCapacityType?: HubEventOnlineCapacityType;
89
+ /**
90
+ * The details for an online event
91
+ */
92
+ onlineDetails?: string | null;
93
+ /**
94
+ * The URL for an online event
95
+ */
96
+ onlineUrl?: string | null;
97
+ /**
98
+ * A collection of objects containing the ids & types for entities that the event references
99
+ */
100
+ references: Array<Record<string, string>>;
101
+ /**
102
+ * The start date of the event
103
+ */
104
+ startDate: string;
105
+ /**
106
+ * The start date & time of the event
107
+ */
108
+ startDateTime: Date;
109
+ /**
110
+ * The start time of the event
111
+ */
112
+ startTime: string;
113
+ /**
114
+ * The time zone of the event
115
+ */
116
+ timeZone: string;
10
117
  }
118
+ export declare type IHubEventEditor = IHubItemEntityEditor<IHubEvent> & {};
@@ -4,7 +4,7 @@ import { IPermissionPolicy } from "../../permissions";
4
4
  * These define the requirements any user must meet to perform related actions
5
5
  * @private
6
6
  */
7
- export declare const DiscussionPermissions: readonly ["hub:discussion", "hub:discussion:create", "hub:discussion:delete", "hub:discussion:edit", "hub:discussion:view", "hub:discussion:canChangeAccess", "hub:discussion:workspace:overview", "hub:discussion:workspace:dashboard", "hub:discussion:workspace:details", "hub:discussion:workspace:settings", "hub:discussion:workspace:collaborators", "hub:discussion:workspace:discussion", "hub:discussion:workspace:metrics", "hub:discussion:manage", "temp:hub:discussion:create"];
7
+ export declare const DiscussionPermissions: readonly ["hub:discussion", "hub:discussion:create", "hub:discussion:delete", "hub:discussion:edit", "hub:discussion:view", "hub:discussion:owner", "hub:discussion:canChangeAccess", "hub:discussion:workspace:overview", "hub:discussion:workspace:dashboard", "hub:discussion:workspace:details", "hub:discussion:workspace:settings", "hub:discussion:workspace:collaborators", "hub:discussion:workspace:discussion", "hub:discussion:workspace:metrics", "hub:discussion:manage", "temp:hub:discussion:create"];
8
8
  /**
9
9
  * Discussion permission policies
10
10
  * @private
@@ -0,0 +1,77 @@
1
+ import { IGroup } from "@esri/arcgis-rest-types";
2
+ import { HubItemEntity } from "../core/HubItemEntity";
3
+ import { IHubEventEditor, IHubEvent } from "../core/types/IHubEvent";
4
+ import { IWithEditorBehavior, IWithSharingBehavior } from "../core/behaviors";
5
+ import { SettableAccessLevel } from "../core/types/types";
6
+ import { IArcGISContext } from "../ArcGISContext";
7
+ import { IEntityEditorContext } from "../core/types";
8
+ import { IEditorConfig } from "../core/schemas/types";
9
+ import { EventEditorType } from "./_internal/EventSchemaCreate";
10
+ /**
11
+ * Defines the properties of a Hub Event object
12
+ * @internal
13
+ */
14
+ export declare class HubEvent extends HubItemEntity<IHubEvent> implements IWithSharingBehavior, IWithEditorBehavior {
15
+ /**
16
+ * Create an instance from a HubEvent object
17
+ * @param json - JSON object to create a HubEvent from
18
+ * @param context - ArcGIS context
19
+ * @returns HubEvent
20
+ */
21
+ static fromJson(json: Partial<IHubEvent>, context: IArcGISContext): HubEvent;
22
+ /**
23
+ * Fetch an Event from the API and return a HubEvent instance.
24
+ * @param identifier slug or item id
25
+ * @param context ArcGIS context
26
+ * @returns Promise<HubEvent>
27
+ */
28
+ static fetch(identifier: string, context: IArcGISContext): Promise<HubEvent>;
29
+ private static applyDefaults;
30
+ /**
31
+ * Apply a new state to the instance
32
+ * @param changes A partial IHubEvent
33
+ */
34
+ update(changes: Partial<IHubEvent>): void;
35
+ /**
36
+ * Creates or saves the Event.
37
+ */
38
+ save(): Promise<void>;
39
+ /**
40
+ * Deletes the Event
41
+ */
42
+ delete(): Promise<void>;
43
+ /**
44
+ * Share the Entity with the specified group id
45
+ * @param groupId The ID of the group to share the Event to
46
+ */
47
+ shareWithGroup(groupId: string): Promise<void>;
48
+ /**
49
+ * Unshare the Event with the specified group id
50
+ * @param groupId The ID of the group to unshar ethe Event with
51
+ */
52
+ unshareWithGroup(groupId: string): Promise<void>;
53
+ /**
54
+ * Sets the access level of the event
55
+ * @param access The access level to set the Event to
56
+ */
57
+ setAccess(access: SettableAccessLevel): Promise<void>;
58
+ /**
59
+ * Return a list of groups the Entity is shared to.
60
+ */
61
+ sharedWith(): Promise<IGroup[]>;
62
+ getEditorConfig(i18nScope: string, type: EventEditorType): Promise<IEditorConfig>;
63
+ /**
64
+ * Return the HubEvent object as an editor object
65
+ * @param editorContext
66
+ * @param include
67
+ * @returns Promise<IHubEventEditor>
68
+ */
69
+ toEditor(editorContext?: IEntityEditorContext, include?: string[]): Promise<IHubEventEditor>;
70
+ /**
71
+ * Load the HubEvent object from the editor object
72
+ * @param editor
73
+ * @param editorContext
74
+ * @returns Promise<IHubEvent>
75
+ */
76
+ fromEditor(editor: IHubEventEditor): Promise<IHubEvent>;
77
+ }
@@ -0,0 +1,12 @@
1
+ import { IPermissionPolicy } from "../../permissions";
2
+ /**
3
+ * @private
4
+ * Event Permission Policies
5
+ * These define the requirements any user must meet to perform related actions
6
+ */
7
+ export declare const EventPermissions: readonly ["hub:event", "hub:event:create", "hub:event:edit", "hub:event:delete", "hub:event:view", "hub:event:owner", "hub:event:canChangeAccess", "hub:event:workspace", "hub:event:workspace:dashboard", "hub:event:workspace:details", "hub:event:workspace:settings", "hub:event:workspace:collaborators", "hub:event:workspace:manage", "hub:event:workspace:attendees", "hub:event:manage"];
8
+ /**
9
+ * @private
10
+ * Event permission policies
11
+ */
12
+ export declare const EventPermissionPolicies: IPermissionPolicy[];
@@ -0,0 +1,8 @@
1
+ import { IConfigurationSchema } from "../../core/schemas/types";
2
+ export declare type EventEditorType = (typeof EventEditorTypes)[number];
3
+ export declare const EventEditorTypes: readonly ["hub:event:create", "hub:event:edit"];
4
+ /**
5
+ * @private
6
+ * Builds a schema for creating a new Event that enforces a startDate relative to the user's locale
7
+ */
8
+ export declare const buildSchema: () => IConfigurationSchema;
@@ -0,0 +1,6 @@
1
+ import { IConfigurationSchema } from "../../core/schemas/types";
2
+ /**
3
+ * @private
4
+ * Builds a schema for creating a new Event that enforces a startDate relative to the user's locale
5
+ */
6
+ export declare const buildSchema: () => IConfigurationSchema;
@@ -0,0 +1,10 @@
1
+ import { IUiSchema } from "../../core/schemas/types";
2
+ import { IArcGISContext } from "../../ArcGISContext";
3
+ import { EntityEditorOptions } from "../../core/schemas/internal/EditorOptions";
4
+ /**
5
+ * @private
6
+ * constructs the complete create uiSchema for Hub Events.
7
+ * This defines how the schema properties should be
8
+ * rendered in the event creation experience
9
+ */
10
+ export declare const buildUiSchema: (i18nScope: string, options: EntityEditorOptions, context: IArcGISContext) => Promise<IUiSchema>;
@@ -0,0 +1,10 @@
1
+ import { IUiSchema } from "../../core/schemas/types";
2
+ import { IArcGISContext } from "../../ArcGISContext";
3
+ import { EntityEditorOptions } from "../../core/schemas/internal/EditorOptions";
4
+ /**
5
+ * @private
6
+ * constructs the complete edit uiSchema for Hub Events.
7
+ * This defines how the schema properties should be
8
+ * rendered in the event creation experience
9
+ */
10
+ export declare const buildUiSchema: (i18nScope: string, options: EntityEditorOptions, context: IArcGISContext) => Promise<IUiSchema>;
@@ -0,0 +1,35 @@
1
+ import { PropertyMapper } from "../../core/_internal/PropertyMapper";
2
+ import { IHubEvent } from "../../core/types/IHubEvent";
3
+ import { IEvent } from "../api/orval/api/orval-events";
4
+ /**
5
+ * @private
6
+ * Manage forward and backward property mappings to
7
+ * streamline conversion between a Hub Event, and
8
+ * the backing Store objects.
9
+ */
10
+ export declare class EventPropertyMapper extends PropertyMapper<Partial<IHubEvent>, Partial<IEvent>> {
11
+ /**
12
+ * Map properties from a Store object, on to an Entity object.
13
+ *
14
+ * Used when constructing an Entity from a fetched Store object,
15
+ * in which case the Entity should be an empty object (`{}`).
16
+ *
17
+ * Can also be used to apply changes to an Entity from a Store,
18
+ * in which case an existing Entity can be passed in.
19
+ * @param store
20
+ * @param entity
21
+ * @returns
22
+ */
23
+ storeToEntity(store: Partial<IEvent>, entity: Partial<IHubEvent>): Partial<IHubEvent>;
24
+ /**
25
+ * Map properties from an entity object onto a model.
26
+ *
27
+ * Typically the model will already exist, and this
28
+ * method is used to transfer changes to the model
29
+ * prior to storage.
30
+ * @param entity
31
+ * @param store
32
+ * @returns
33
+ */
34
+ entityToStore(entity: Partial<IHubEvent>, store: Partial<IEvent>): Partial<IEvent>;
35
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @private
3
+ * Builds an object containing the user's guessed timezone and default
4
+ * event start/end dates and times
5
+ */
6
+ export declare const getDefaultEventDatesAndTimes: () => {
7
+ startDate: string;
8
+ startDateTime: Date;
9
+ startTime: string;
10
+ endDate: string;
11
+ endDateTime: Date;
12
+ endTime: string;
13
+ timeZone: string;
14
+ };
@@ -0,0 +1,18 @@
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 declare function getISOStringFromClientDateTime(date: string, time: string): string;
@@ -0,0 +1,8 @@
1
+ import { IPropertyMap } from "../../core/_internal/PropertyMapper";
2
+ /**
3
+ * @private
4
+ * Returns an Array of IPropertyMap objects
5
+ * that define the projection of properties from an IEvent to an IHubEvent
6
+ * @returns an IPropertyMap array
7
+ */
8
+ export declare function getPropertyMap(): IPropertyMap[];
@@ -0,0 +1,58 @@
1
+ import { HubEventAttendanceType, HubEventOnlineCapacityType } from "../types";
2
+ export declare const TIME_VALIDATIONS_WHEN_NOT_ALL_DAY: {
3
+ if: {
4
+ properties: {
5
+ isAllDay: {
6
+ const: boolean;
7
+ };
8
+ };
9
+ };
10
+ then: {
11
+ required: string[];
12
+ properties: {
13
+ endTime: {
14
+ format: string;
15
+ formatExclusiveMinimum: {
16
+ $data: string;
17
+ };
18
+ };
19
+ };
20
+ };
21
+ };
22
+ export declare const URL_VALIDATIONS_WHEN_ONLINE_OR_HYBRID: {
23
+ if: {
24
+ properties: {
25
+ attendanceType: {
26
+ enum: HubEventAttendanceType[];
27
+ };
28
+ };
29
+ };
30
+ then: {
31
+ required: string[];
32
+ properties: {
33
+ onlineUrl: {
34
+ format: string;
35
+ };
36
+ };
37
+ };
38
+ };
39
+ export declare const FIXED_ONLINE_ATTENDANCE_VALIDATIONS: {
40
+ if: {
41
+ properties: {
42
+ onlineCapacityType: {
43
+ const: HubEventOnlineCapacityType;
44
+ };
45
+ attendanceType: {
46
+ enum: HubEventAttendanceType[];
47
+ };
48
+ };
49
+ };
50
+ then: {
51
+ required: string[];
52
+ properties: {
53
+ onlineCapacity: {
54
+ minimum: number;
55
+ };
56
+ };
57
+ };
58
+ };
@@ -0,0 +1,10 @@
1
+ import { IHubEvent } from "../core/types/IHubEvent";
2
+ import { IEvent } from "./api/orval/api/orval-events";
3
+ /**
4
+ * Builds a partial IHubEvent (entity) with default values
5
+ */
6
+ export declare function buildDefaultEventEntity(): Partial<IHubEvent>;
7
+ /**
8
+ * Builds a partial IEvent (record) with default values
9
+ */
10
+ export declare function buildDefaultEventRecord(): Partial<IEvent>;
@@ -0,0 +1,21 @@
1
+ import { IHubEvent } from "../core/types/IHubEvent";
2
+ import { IHubRequestOptions } from "../types";
3
+ /**
4
+ * @private
5
+ * Create a new Hub Event item
6
+ *
7
+ * Minimal properties are name and orgUrlKey
8
+ *
9
+ * @param partialEvent a partial event
10
+ * @param requestOptions user request options
11
+ * @returns promise that resolves a IHubEvent
12
+ */
13
+ export declare function createHubEvent(partialEvent: Partial<IHubEvent>, requestOptions: IHubRequestOptions): Promise<IHubEvent>;
14
+ /**
15
+ * @private
16
+ * Update a Hub Event
17
+ * @param event the event to update
18
+ * @param requestOptions user request options
19
+ * @returns promise that resolves a IHubEvent
20
+ */
21
+ export declare function updateHubEvent(event: IHubEvent, requestOptions: IHubRequestOptions): Promise<IHubEvent>;
@@ -0,0 +1,19 @@
1
+ import { IHubEvent } from "../core/types/IHubEvent";
2
+ import { IHubRequestOptions } from "../types";
3
+ import { IEvent } from "./api/orval/api/orval-events";
4
+ /**
5
+ * @private
6
+ * Get an Event by id or slug
7
+ * @param identifier event id or slug
8
+ * @param requestOptions request options
9
+ * @returns a promise that resolves an IHubEvent
10
+ */
11
+ export declare function fetchEvent(eventId: string, requestOptions: IHubRequestOptions): Promise<IHubEvent>;
12
+ /**
13
+ * @private
14
+ * Convert a client event record into a Hub Event
15
+ * @param clientEvent the client event record
16
+ * @param requestOptions request options
17
+ * @returns a promise that resolves a IHubEvent
18
+ */
19
+ export declare function convertClientEventToHubEvent(clientEvent: IEvent, requestOptions: IHubRequestOptions): Promise<IHubEvent>;
@@ -1 +1,4 @@
1
- export * from "./api";
1
+ export * from "./edit";
2
+ export * from "./fetch";
3
+ export * from "./HubEvent";
4
+ export * from "./types";
@@ -0,0 +1,9 @@
1
+ export declare enum HubEventAttendanceType {
2
+ InPerson = "inPerson",
3
+ Online = "online",
4
+ Both = "both"
5
+ }
6
+ export declare enum HubEventOnlineCapacityType {
7
+ Unlimited = "unlimited",
8
+ Fixed = "fixed"
9
+ }
@@ -15,6 +15,7 @@ export * from "./initiatives";
15
15
  export * from "./initiative-templates";
16
16
  export * from "./discussions";
17
17
  export * from "./surveys";
18
+ export * from "./events";
18
19
  export * from "./items";
19
20
  export * from "./models";
20
21
  export * from "./objects";
@@ -9,6 +9,7 @@ import { PlatformPermissions } from "../PlatformPermissionPolicies";
9
9
  import { InitiativeTemplatePermissions } from "../../initiative-templates/_internal/InitiativeTemplateBusinessRules";
10
10
  import { TemplatePermissions } from "../../templates/_internal/TemplateBusinessRules";
11
11
  import { SurveyPermissions } from "../../surveys/_internal/SurveyBusinessRules";
12
+ import { EventPermissions } from "../../events/_internal/EventBusinessRules";
12
13
  /**
13
14
  * Defines the values for Permissions
14
15
  * It's critical that the arrays defined in the modules use `as const`
@@ -19,7 +20,7 @@ declare const SystemPermissions: string[];
19
20
  /**
20
21
  * Defines the possible values for Permissions
21
22
  */
22
- export declare type Permission = (typeof SitePermissions)[number] | (typeof ProjectPermissions)[number] | (typeof InitiativePermissions)[number] | (typeof ContentPermissions)[number] | (typeof GroupPermissions)[number] | (typeof PagePermissions)[number] | (typeof PlatformPermissions)[number] | (typeof TempPermissions)[number] | (typeof DiscussionPermissions)[number] | (typeof InitiativeTemplatePermissions)[number] | (typeof TemplatePermissions)[number] | (typeof SystemPermissions)[number] | (typeof SurveyPermissions)[number];
23
+ export declare type Permission = (typeof SitePermissions)[number] | (typeof ProjectPermissions)[number] | (typeof InitiativePermissions)[number] | (typeof ContentPermissions)[number] | (typeof GroupPermissions)[number] | (typeof PagePermissions)[number] | (typeof PlatformPermissions)[number] | (typeof TempPermissions)[number] | (typeof DiscussionPermissions)[number] | (typeof InitiativeTemplatePermissions)[number] | (typeof TemplatePermissions)[number] | (typeof SystemPermissions)[number] | (typeof SurveyPermissions)[number] | (typeof EventPermissions)[number];
23
24
  /**
24
25
  * Validate a Permission
25
26
  * @param permission
@@ -16,6 +16,13 @@ export declare class HubSurvey extends HubItemEntity<IHubSurvey> implements IWit
16
16
  * @returns
17
17
  */
18
18
  static fromJson(json: Partial<IHubSurvey>, context: IArcGISContext): HubSurvey;
19
+ /**
20
+ * Fetch a Survey from the backing store and return a HubSurvey instance.
21
+ * @param identifier - Identifier of the survey to load
22
+ * @param context
23
+ * @returns
24
+ */
25
+ static fetch(identifier: string, context: IArcGISContext): Promise<HubSurvey>;
19
26
  private static applyDefaults;
20
27
  /**
21
28
  * Apply a new state to the instance
@@ -4,7 +4,7 @@ import { IPermissionPolicy } from "../../permissions/types/IPermissionPolicy";
4
4
  * These define the requirements any user must meet to perform related actions
5
5
  * @private
6
6
  */
7
- export declare const SurveyPermissions: readonly ["hub:survey", "hub:survey:create", "hub:survey:delete", "hub:survey:edit", "hub:survey:view", "hub:survey:canChangeAccess", "hub:survey:workspace", "hub:survey:workspace:dashboard", "hub:survey:workspace:details", "hub:survey:workspace:settings", "hub:survey:workspace:collaborators", "hub:survey:manage"];
7
+ export declare const SurveyPermissions: readonly ["hub:survey", "hub:survey:create", "hub:survey:delete", "hub:survey:edit", "hub:survey:view", "hub:survey:owner", "hub:survey:canChangeAccess", "hub:survey:workspace", "hub:survey:workspace:dashboard", "hub:survey:workspace:details", "hub:survey:workspace:settings", "hub:survey:workspace:collaborators", "hub:survey:manage"];
8
8
  /**
9
9
  * Survey permission policies
10
10
  * @private
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A utility method to get a date-picker date string in the format `2024-04-03` from a Date object, timestamp in ms,
3
+ * or a valid date/time string. By default, the date string will reflect the client's local date for the provided date.
4
+ * An optional IANA timeZone string can be provided to adjust the resulting date string to reflect the local date
5
+ * in the provided timeZone at that point in time.
6
+ *
7
+ * getDatePickerDate('2024-03-29T16:00:00.000Z', 'America/New_York')
8
+ * // => `2024-03-29` (eastern)
9
+ *
10
+ * getDatePickerDate('2024-03-29T16:00:00.000Z', 'America/Los_Angeles')
11
+ * // => `2024-03-29` (pacific)
12
+ *
13
+ * @param date A Date object, timestamp in ms, or valid date/time string (e.g. `2024-03-29T16:00:00.000Z`)
14
+ * @param timeZone An optional IANA time zone string, e.g. `America/Los_Angeles`
15
+ * @returns a date-picker date string, e.g. `2024-03-29`
16
+ */
17
+ export declare function getDatePickerDate(date: string | number | Date, timeZone?: string): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A utility method to get a time-picker time string in 24-hour format from a Date object, timestamp in ms, or a
3
+ * valid date/time string. By default, the time string will reflect the client's local time for the provided date.
4
+ * An optional IANA timeZone string can be provided to adjust the resulting time string to reflect the local time
5
+ * in the provided timeZone at that point in time.
6
+ *
7
+ * getTimePickerTime('2024-03-29T17:00:00.000Z', 'America/New_York')
8
+ * // => `13:00:00` (eastern)
9
+ *
10
+ * getTimePickerTime('2024-03-29T17:00:00.000Z', 'America/Los_Angeles')
11
+ * // => `10:00:00` (pacific)
12
+ *
13
+ * @param date A Date object, timestamp in ms, or valid date/time string (e.g. `2024-03-29T16:00:00.000Z`)
14
+ * @param timeZone An optional IANA time zone string, e.g. `America/Los_Angeles`
15
+ * @returns a time-picker time string in 24-hour format, e.g. `13:00:00`
16
+ */
17
+ export declare function getTimePickerTime(date: string | number | Date, timeZone?: string): string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Attempts to guess the client's IANA time zone string
3
+ * @returns an IANA time zone
4
+ */
5
+ export declare function guessTimeZone(): string;
@@ -0,0 +1,3 @@
1
+ export * from "./getDatePickerDate";
2
+ export * from "./getTimePickerTime";
3
+ export * from "./guessTimeZone";
@@ -25,3 +25,4 @@ export * from "./getEnvironmentFromPortalUrl";
25
25
  export * from "./poll";
26
26
  export * from "./hubUserAppResources";
27
27
  export * from "./getObjectSize";
28
+ export * from "./date";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "14.110.1",
3
+ "version": "14.111.1",
4
4
  "description": "Common TypeScript types and utility functions for @esri/hub.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/esm/index.js",