cronofy-elements 1.48.1 → 1.49.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 (349) hide show
  1. package/dist/.gitkeep +0 -0
  2. package/dist/CronofyElements.js +2 -0
  3. package/{build/CronofyElements.v1.48.1.js.LICENSE.txt → dist/CronofyElements.js.LICENSE.txt} +0 -0
  4. package/package.json +10 -7
  5. package/.babelrc +0 -20
  6. package/.eslintrc.yaml +0 -43
  7. package/.prettierignore +0 -4
  8. package/.prettierrc +0 -7
  9. package/Makefile +0 -92
  10. package/brainstorm.md +0 -76
  11. package/build/CronofyElements.v1.48.1.js +0 -2
  12. package/build/npm/CronofyElements.js +0 -2
  13. package/compat.config.js +0 -25
  14. package/demo/agenda.ejs +0 -71
  15. package/demo/availability-viewer.ejs +0 -322
  16. package/demo/calendar-sync.ejs +0 -149
  17. package/demo/crossbrowser.ejs +0 -228
  18. package/demo/date-time-picker.ejs +0 -213
  19. package/demo/demo-styles.css +0 -134
  20. package/demo/index.ejs +0 -249
  21. package/demo/integration.ejs +0 -482
  22. package/demo/load-elements.ejs +0 -12
  23. package/demo/nav.ejs +0 -14
  24. package/demo/rules.ejs +0 -121
  25. package/demo/server.js +0 -425
  26. package/demo/slot-picker.ejs +0 -197
  27. package/git.README.md +0 -71
  28. package/notes.style.md +0 -197
  29. package/postcss.config.js +0 -3
  30. package/script/i18n-export +0 -11
  31. package/script/i18n-helpers/split_write.rb +0 -25
  32. package/script/i18n-import +0 -22
  33. package/script/i18n-reference-update +0 -241
  34. package/src/js/components/Agenda/Agenda.js +0 -243
  35. package/src/js/components/Agenda/AllDayEventsList.js +0 -37
  36. package/src/js/components/Agenda/Calendar.js +0 -100
  37. package/src/js/components/Agenda/CalendarHeader.js +0 -187
  38. package/src/js/components/Agenda/Event.js +0 -34
  39. package/src/js/components/Agenda/EventAllDay.js +0 -76
  40. package/src/js/components/Agenda/EventAttendees.js +0 -30
  41. package/src/js/components/Agenda/EventDetail.js +0 -111
  42. package/src/js/components/Agenda/EventMessages.js +0 -24
  43. package/src/js/components/Agenda/EventMeta.js +0 -48
  44. package/src/js/components/Agenda/EventTime.js +0 -34
  45. package/src/js/components/Agenda/EventWrapper.js +0 -271
  46. package/src/js/components/Agenda/Location.js +0 -29
  47. package/src/js/components/Agenda/Message.js +0 -22
  48. package/src/js/components/Agenda/TimedEventsList.js +0 -29
  49. package/src/js/components/AvailabilityRules/AddButton.js +0 -60
  50. package/src/js/components/AvailabilityRules/AvailabilityRules.js +0 -45
  51. package/src/js/components/AvailabilityRules/Calendar.js +0 -31
  52. package/src/js/components/AvailabilityRules/CalendarListItem.js +0 -53
  53. package/src/js/components/AvailabilityRules/CalendarProfiles.js +0 -67
  54. package/src/js/components/AvailabilityRules/CalendarSelector.js +0 -104
  55. package/src/js/components/AvailabilityRules/Calendars.js +0 -145
  56. package/src/js/components/AvailabilityRules/Checkmark.js +0 -51
  57. package/src/js/components/AvailabilityRules/DayLabels.js +0 -91
  58. package/src/js/components/AvailabilityRules/Footer.js +0 -109
  59. package/src/js/components/AvailabilityRules/Legend.js +0 -57
  60. package/src/js/components/AvailabilityRules/Loading.js +0 -53
  61. package/src/js/components/AvailabilityRules/RemoveButton.js +0 -57
  62. package/src/js/components/AvailabilityRules/Slot.js +0 -195
  63. package/src/js/components/AvailabilityRules/SlotDisplay.js +0 -27
  64. package/src/js/components/AvailabilityRules/Slots.js +0 -81
  65. package/src/js/components/AvailabilityRules/SlotsDisplay.js +0 -68
  66. package/src/js/components/AvailabilityRules/TimeExpander.js +0 -119
  67. package/src/js/components/AvailabilityRules/TimeLabels.js +0 -89
  68. package/src/js/components/AvailabilityRules/TimeZoneDisplay.js +0 -41
  69. package/src/js/components/AvailabilityRules/ToggleIcon.js +0 -41
  70. package/src/js/components/AvailabilityRules/Tooltip.js +0 -63
  71. package/src/js/components/AvailabilityRules/UnknownCalendar.js +0 -33
  72. package/src/js/components/AvailabilityRules/Week.js +0 -115
  73. package/src/js/components/AvailabilityRules/WeekGrid.js +0 -80
  74. package/src/js/components/AvailabilityRules/Wrapper.js +0 -414
  75. package/src/js/components/AvailabilityRules/contexts/drag-context.js +0 -15
  76. package/src/js/components/AvailabilityRules/scss/_base.buttons.scss +0 -58
  77. package/src/js/components/AvailabilityRules/scss/_base.theme.scss +0 -4
  78. package/src/js/components/AvailabilityRules/scss/_components.timezoneselector.scss +0 -74
  79. package/src/js/components/AvailabilityRules/scss/_generic.reset.scss +0 -13
  80. package/src/js/components/AvailabilityRules/scss/_settings.colours.scss +0 -12
  81. package/src/js/components/AvailabilityRules/scss/availabilityrules.scss +0 -5
  82. package/src/js/components/AvailabilityRules/utils/tz-utils.js +0 -44
  83. package/src/js/components/AvailabilityViewer/AvailabilityViewer.js +0 -524
  84. package/src/js/components/AvailabilityViewer/ColumnHeader.js +0 -35
  85. package/src/js/components/AvailabilityViewer/DayColumn.js +0 -36
  86. package/src/js/components/AvailabilityViewer/DayColumnDisplay.js +0 -33
  87. package/src/js/components/AvailabilityViewer/DayColumnWrapper.js +0 -29
  88. package/src/js/components/AvailabilityViewer/DayLabels.js +0 -41
  89. package/src/js/components/AvailabilityViewer/EmptyColumn.js +0 -29
  90. package/src/js/components/AvailabilityViewer/Footer.js +0 -36
  91. package/src/js/components/AvailabilityViewer/GridFreeSelect.js +0 -33
  92. package/src/js/components/AvailabilityViewer/HoverSlot.js +0 -35
  93. package/src/js/components/AvailabilityViewer/HoverTooltip.js +0 -34
  94. package/src/js/components/AvailabilityViewer/LabelColumn.js +0 -53
  95. package/src/js/components/AvailabilityViewer/LabelItem.js +0 -73
  96. package/src/js/components/AvailabilityViewer/Legend.js +0 -79
  97. package/src/js/components/AvailabilityViewer/Loading.js +0 -57
  98. package/src/js/components/AvailabilityViewer/MonthLabels.js +0 -43
  99. package/src/js/components/AvailabilityViewer/Navigation.js +0 -138
  100. package/src/js/components/AvailabilityViewer/Overlay.js +0 -60
  101. package/src/js/components/AvailabilityViewer/Preloading.js +0 -66
  102. package/src/js/components/AvailabilityViewer/SelectedSlot.js +0 -106
  103. package/src/js/components/AvailabilityViewer/SelectedSlots.js +0 -72
  104. package/src/js/components/AvailabilityViewer/SelectionMask.js +0 -44
  105. package/src/js/components/AvailabilityViewer/Slot.js +0 -237
  106. package/src/js/components/AvailabilityViewer/SlotFreeSelect.js +0 -115
  107. package/src/js/components/AvailabilityViewer/Slots.js +0 -57
  108. package/src/js/components/AvailabilityViewer/TimeExpander.js +0 -93
  109. package/src/js/components/AvailabilityViewer/TimeLines.js +0 -74
  110. package/src/js/components/AvailabilityViewer/TimeSelector.js +0 -243
  111. package/src/js/components/AvailabilityViewer/TimeSelectorTrigger.js +0 -42
  112. package/src/js/components/AvailabilityViewer/TimeZoneDisplay.js +0 -28
  113. package/src/js/components/AvailabilityViewer/ToggleIcon.js +0 -41
  114. package/src/js/components/AvailabilityViewer/Tooltip.js +0 -65
  115. package/src/js/components/AvailabilityViewer/Week.js +0 -255
  116. package/src/js/components/AvailabilityViewer/WeekWrapper.js +0 -132
  117. package/src/js/components/AvailabilityViewer/contexts/page-context.js +0 -17
  118. package/src/js/components/AvailabilityViewer/contexts/page-reducer.js +0 -28
  119. package/src/js/components/AvailabilityViewer/contexts/selection-context.js +0 -25
  120. package/src/js/components/AvailabilityViewer/contexts/selection-reducer.js +0 -18
  121. package/src/js/components/CalendarSync/Active.js +0 -57
  122. package/src/js/components/CalendarSync/AddToggle.js +0 -72
  123. package/src/js/components/CalendarSync/CalendarSync.js +0 -215
  124. package/src/js/components/CalendarSync/EditToggle.js +0 -71
  125. package/src/js/components/CalendarSync/Footer.js +0 -31
  126. package/src/js/components/CalendarSync/Inactive.js +0 -66
  127. package/src/js/components/CalendarSync/Loading.js +0 -52
  128. package/src/js/components/CalendarSync/Pending.js +0 -74
  129. package/src/js/components/CalendarSync/ProfileStatus.js +0 -33
  130. package/src/js/components/CalendarSync/Profiles.js +0 -109
  131. package/src/js/components/CalendarSync/ProviderLogo.js +0 -28
  132. package/src/js/components/CalendarSync/Providers.js +0 -80
  133. package/src/js/components/CalendarSync/RemoveLink.js +0 -96
  134. package/src/js/components/CalendarSync/SelectProvider.js +0 -25
  135. package/src/js/components/CalendarSync/contexts/status-reducer.js +0 -74
  136. package/src/js/components/DateTimePicker/Calendar.js +0 -127
  137. package/src/js/components/DateTimePicker/CalendarHeader.js +0 -80
  138. package/src/js/components/DateTimePicker/Confirm.js +0 -106
  139. package/src/js/components/DateTimePicker/DateTimePicker.js +0 -131
  140. package/src/js/components/DateTimePicker/DayButton.js +0 -38
  141. package/src/js/components/DateTimePicker/DayHeadings.js +0 -33
  142. package/src/js/components/DateTimePicker/Details.js +0 -33
  143. package/src/js/components/DateTimePicker/Error.js +0 -39
  144. package/src/js/components/DateTimePicker/Loading.js +0 -20
  145. package/src/js/components/DateTimePicker/LoadingCalendar.js +0 -21
  146. package/src/js/components/DateTimePicker/NoSlotsFound.js +0 -16
  147. package/src/js/components/DateTimePicker/SequencedSlotButton.js +0 -97
  148. package/src/js/components/DateTimePicker/SlotButton.js +0 -55
  149. package/src/js/components/DateTimePicker/SlotsList.js +0 -45
  150. package/src/js/components/DateTimePicker/Wrapper.js +0 -281
  151. package/src/js/components/DateTimePicker/contexts/status-context.js +0 -19
  152. package/src/js/components/DateTimePicker/contexts/status-reducer.js +0 -276
  153. package/src/js/components/DateTimePicker/contexts/theme-context.js +0 -33
  154. package/src/js/components/DateTimePicker/helpers/theming.js +0 -49
  155. package/src/js/components/DateTimePicker/scss/_base.buttons.scss +0 -58
  156. package/src/js/components/DateTimePicker/scss/_base.layout.scss +0 -28
  157. package/src/js/components/DateTimePicker/scss/_base.theme.scss +0 -17
  158. package/src/js/components/DateTimePicker/scss/_components.calendargrid.scss +0 -78
  159. package/src/js/components/DateTimePicker/scss/_components.calendarheader.scss +0 -71
  160. package/src/js/components/DateTimePicker/scss/_components.confirm.scss +0 -40
  161. package/src/js/components/DateTimePicker/scss/_components.details.scss +0 -20
  162. package/src/js/components/DateTimePicker/scss/_components.error.scss +0 -34
  163. package/src/js/components/DateTimePicker/scss/_components.loading.scss +0 -36
  164. package/src/js/components/DateTimePicker/scss/_components.slotslist.scss +0 -43
  165. package/src/js/components/DateTimePicker/scss/_components.timezoneselector.scss +0 -73
  166. package/src/js/components/DateTimePicker/scss/_generic.reset.scss +0 -18
  167. package/src/js/components/DateTimePicker/scss/_settings.colours.scss +0 -17
  168. package/src/js/components/DateTimePicker/scss/datetimepicker.scss +0 -5
  169. package/src/js/components/DateTimePicker/utils/calendar-keyboard.js +0 -109
  170. package/src/js/components/DateTimePicker/utils/calendar.js +0 -125
  171. package/src/js/components/DateTimePicker/utils/slots.js +0 -288
  172. package/src/js/components/SlotPicker/Confirm.js +0 -160
  173. package/src/js/components/SlotPicker/Days.js +0 -58
  174. package/src/js/components/SlotPicker/Slot.js +0 -72
  175. package/src/js/components/SlotPicker/SlotPicker.js +0 -292
  176. package/src/js/components/SlotPicker/Slots.js +0 -66
  177. package/src/js/components/SlotPicker/TimeSlots.js +0 -91
  178. package/src/js/components/generic/Button.js +0 -26
  179. package/src/js/components/generic/Container.js +0 -33
  180. package/src/js/components/generic/Error.js +0 -77
  181. package/src/js/components/generic/Loading.js +0 -51
  182. package/src/js/components/generic/LoadingSpinner.js +0 -30
  183. package/src/js/components/generic/ShadowScrollbars.js +0 -70
  184. package/src/js/components/generic/TimeZoneSelector.js +0 -158
  185. package/src/js/components/generic/TransitionSlide.js +0 -72
  186. package/src/js/contexts/i18n-context.js +0 -25
  187. package/src/js/contexts/log-context.js +0 -18
  188. package/src/js/contexts/tz-context.js +0 -18
  189. package/src/js/env.example.js +0 -8
  190. package/src/js/helpers/colors.js +0 -33
  191. package/src/js/helpers/comparators.AvailabilityViewer.js +0 -27
  192. package/src/js/helpers/connections.js +0 -370
  193. package/src/js/helpers/events.js +0 -166
  194. package/src/js/helpers/functional.js +0 -4
  195. package/src/js/helpers/generator.js +0 -107
  196. package/src/js/helpers/i18n.js +0 -153
  197. package/src/js/helpers/init.Agenda.js +0 -55
  198. package/src/js/helpers/init.AvailabilityRules.js +0 -195
  199. package/src/js/helpers/init.AvailabilityViewer.js +0 -215
  200. package/src/js/helpers/init.CalendarSync.js +0 -83
  201. package/src/js/helpers/init.DateTimePicker.js +0 -219
  202. package/src/js/helpers/init.SlotPicker.js +0 -89
  203. package/src/js/helpers/init.js +0 -308
  204. package/src/js/helpers/logging.js +0 -78
  205. package/src/js/helpers/mocks.js +0 -871
  206. package/src/js/helpers/slots.js +0 -340
  207. package/src/js/helpers/slots.rules.js +0 -220
  208. package/src/js/helpers/theming.js +0 -93
  209. package/src/js/helpers/translations.js +0 -42
  210. package/src/js/helpers/tz-list.js +0 -136
  211. package/src/js/helpers/utils.AvailabilityRules.js +0 -110
  212. package/src/js/helpers/utils.AvailabilityViewer.js +0 -789
  213. package/src/js/helpers/utils.CalendarSync.js +0 -199
  214. package/src/js/helpers/utils.js +0 -76
  215. package/src/js/hooks/useWindowSize.js +0 -20
  216. package/src/js/main.js +0 -133
  217. package/src/js/next.js +0 -37
  218. package/src/js/styles/_settings.utils.scss +0 -82
  219. package/src/js/styles/colors.js +0 -13
  220. package/src/js/styles/global.js +0 -49
  221. package/src/js/styles/utils.js +0 -81
  222. package/src/js/translations/de/agenda.json +0 -12
  223. package/src/js/translations/de/availability_rules.json +0 -18
  224. package/src/js/translations/de/availability_viewer.json +0 -14
  225. package/src/js/translations/de/calendar_sync.json +0 -14
  226. package/src/js/translations/de/core.json +0 -15
  227. package/src/js/translations/de/date_time_picker.json +0 -14
  228. package/src/js/translations/de/slot_picker.json +0 -9
  229. package/src/js/translations/de/time_zones.json +0 -135
  230. package/src/js/translations/en/agenda.json +0 -12
  231. package/src/js/translations/en/availability_rules.json +0 -18
  232. package/src/js/translations/en/availability_viewer.json +0 -14
  233. package/src/js/translations/en/calendar_sync.json +0 -14
  234. package/src/js/translations/en/core.json +0 -23
  235. package/src/js/translations/en/date_time_picker.json +0 -15
  236. package/src/js/translations/en/slot_picker.json +0 -9
  237. package/src/js/translations/en/time_zones.json +0 -17
  238. package/src/js/translations/es/agenda.json +0 -12
  239. package/src/js/translations/es/availability_rules.json +0 -18
  240. package/src/js/translations/es/availability_viewer.json +0 -14
  241. package/src/js/translations/es/calendar_sync.json +0 -14
  242. package/src/js/translations/es/core.json +0 -15
  243. package/src/js/translations/es/date_time_picker.json +0 -14
  244. package/src/js/translations/es/slot_picker.json +0 -9
  245. package/src/js/translations/es/time_zones.json +0 -203
  246. package/src/js/translations/fr/agenda.json +0 -12
  247. package/src/js/translations/fr/availability_rules.json +0 -18
  248. package/src/js/translations/fr/availability_viewer.json +0 -14
  249. package/src/js/translations/fr/calendar_sync.json +0 -14
  250. package/src/js/translations/fr/core.json +0 -15
  251. package/src/js/translations/fr/date_time_picker.json +0 -14
  252. package/src/js/translations/fr/slot_picker.json +0 -9
  253. package/src/js/translations/fr/time_zones.json +0 -161
  254. package/src/js/translations/fr-CA/agenda.json +0 -12
  255. package/src/js/translations/fr-CA/availability_rules.json +0 -18
  256. package/src/js/translations/fr-CA/availability_viewer.json +0 -14
  257. package/src/js/translations/fr-CA/calendar_sync.json +0 -14
  258. package/src/js/translations/fr-CA/core.json +0 -23
  259. package/src/js/translations/fr-CA/date_time_picker.json +0 -14
  260. package/src/js/translations/fr-CA/slot_picker.json +0 -9
  261. package/src/js/translations/fr-CA/time_zones.json +0 -163
  262. package/src/js/translations/it/agenda.json +0 -12
  263. package/src/js/translations/it/availability_rules.json +0 -18
  264. package/src/js/translations/it/availability_viewer.json +0 -14
  265. package/src/js/translations/it/calendar_sync.json +0 -14
  266. package/src/js/translations/it/core.json +0 -15
  267. package/src/js/translations/it/date_time_picker.json +0 -14
  268. package/src/js/translations/it/slot_picker.json +0 -9
  269. package/src/js/translations/it/time_zones.json +0 -126
  270. package/src/js/translations/ja/agenda.json +0 -12
  271. package/src/js/translations/ja/availability_rules.json +0 -18
  272. package/src/js/translations/ja/availability_viewer.json +0 -14
  273. package/src/js/translations/ja/calendar_sync.json +0 -14
  274. package/src/js/translations/ja/core.json +0 -15
  275. package/src/js/translations/ja/date_formats.json +0 -5
  276. package/src/js/translations/ja/date_time_picker.json +0 -14
  277. package/src/js/translations/ja/slot_picker.json +0 -9
  278. package/src/js/translations/ja/time_zones.json +0 -435
  279. package/src/js/translations/nl/agenda.json +0 -12
  280. package/src/js/translations/nl/availability_rules.json +0 -18
  281. package/src/js/translations/nl/availability_viewer.json +0 -14
  282. package/src/js/translations/nl/calendar_sync.json +0 -14
  283. package/src/js/translations/nl/core.json +0 -15
  284. package/src/js/translations/nl/date_time_picker.json +0 -14
  285. package/src/js/translations/nl/slot_picker.json +0 -9
  286. package/src/js/translations/nl/time_zones.json +0 -118
  287. package/src/js/translations/ru/agenda.json +0 -12
  288. package/src/js/translations/ru/availability_rules.json +0 -18
  289. package/src/js/translations/ru/availability_viewer.json +0 -14
  290. package/src/js/translations/ru/calendar_sync.json +0 -14
  291. package/src/js/translations/ru/core.json +0 -15
  292. package/src/js/translations/ru/date_time_picker.json +0 -14
  293. package/src/js/translations/ru/slot_picker.json +0 -9
  294. package/src/js/translations/ru/time_zones.json +0 -435
  295. package/src/js/translations/sv/agenda.json +0 -12
  296. package/src/js/translations/sv/availability_rules.json +0 -18
  297. package/src/js/translations/sv/availability_viewer.json +0 -14
  298. package/src/js/translations/sv/calendar_sync.json +0 -14
  299. package/src/js/translations/sv/core.json +0 -15
  300. package/src/js/translations/sv/date_time_picker.json +0 -14
  301. package/src/js/translations/sv/slot_picker.json +0 -9
  302. package/src/js/translations/sv/time_zones.json +0 -136
  303. package/tests/AvailabilityRules/AvailabilityRules.test.js +0 -39
  304. package/tests/AvailabilityRules/__snapshots__/AvailabilityRules.test.js.snap +0 -1045
  305. package/tests/AvailabilityViewer/Navigation.test.js +0 -130
  306. package/tests/AvailabilityViewer/contexts/page-reducer.test.js +0 -87
  307. package/tests/AvailabilityViewer/reducer.test.js +0 -73
  308. package/tests/CalendarSync/Active.test.js +0 -25
  309. package/tests/CalendarSync/AddToggle.test.js +0 -57
  310. package/tests/CalendarSync/EditToggle.test.js +0 -57
  311. package/tests/CalendarSync/Inactive.test.js +0 -26
  312. package/tests/CalendarSync/Pending.test.js +0 -25
  313. package/tests/CalendarSync/ProviderLogo.test.js +0 -95
  314. package/tests/CalendarSync/__snapshots__/Active.test.js.snap +0 -61
  315. package/tests/CalendarSync/__snapshots__/Inactive.test.js.snap +0 -78
  316. package/tests/CalendarSync/__snapshots__/Pending.test.js.snap +0 -90
  317. package/tests/CalendarSync/__snapshots__/ProviderLogo.test.js.snap +0 -267
  318. package/tests/CalendarSync/init.CalendarSync.test.js +0 -302
  319. package/tests/CalendarSync/mocks/theme.js +0 -14
  320. package/tests/CalendarSync/status-reducer.test.js +0 -435
  321. package/tests/DateTimePicker/SequencedSlotButton.test.js +0 -157
  322. package/tests/DateTimePicker/SlotButton.test.js +0 -118
  323. package/tests/DateTimePicker/contexts/status-reducer.test.js +0 -1036
  324. package/tests/DateTimePicker/dummy-data.js +0 -883
  325. package/tests/DateTimePicker/utils.test.js +0 -515
  326. package/tests/colors.test.js +0 -70
  327. package/tests/components/TimezoneSelector.test.js +0 -124
  328. package/tests/components/main.test.js +0 -203
  329. package/tests/components/rtl-utils.js +0 -32
  330. package/tests/connections.test.js +0 -684
  331. package/tests/events.test.js +0 -472
  332. package/tests/generator.test.js +0 -74
  333. package/tests/i18n.test.js +0 -255
  334. package/tests/init.Agenda.test.js +0 -122
  335. package/tests/init.AvailabilityRules.test.js +0 -279
  336. package/tests/init.AvailabilityViewer.test.js +0 -740
  337. package/tests/init.SlotPicker.test.js +0 -166
  338. package/tests/init.test.js +0 -231
  339. package/tests/logging.test.js +0 -235
  340. package/tests/mocks/i18n.js +0 -3
  341. package/tests/mocks/theme.js +0 -3
  342. package/tests/setupJest.js +0 -8
  343. package/tests/slots.rules.test.js +0 -195
  344. package/tests/slots.test.js +0 -278
  345. package/tests/utils.AvailabilityRules.test.js +0 -221
  346. package/tests/utils.AvailabilityViewer.test.js +0 -1800
  347. package/tests/utils.CalendarSync.test.js +0 -277
  348. package/tests/utils.test.js +0 -119
  349. package/webpack.config.js +0 -114
@@ -1,153 +0,0 @@
1
- import { turnSlugIntoString, humanizeTzName, nestedValue } from "./utils";
2
- import { translations } from "./translations";
3
- import moment from "moment";
4
-
5
- export const getNavigatorLanguage = (nav = navigator) =>
6
- nav.languages && nav.languages.length
7
- ? nav.languages[0]
8
- : nav.userLanguage || nav.language || nav.browserLanguage || "en";
9
-
10
- const rootLocaleFromLocale = locale =>
11
- locale.indexOf("-") > 0 ? locale.substr(0, locale.indexOf("-")) : locale;
12
-
13
- export const modifierDateFormats = {
14
- ja: {
15
- dates: {
16
- western: { slotFormat: "Y年 MMM Do (dd)" },
17
- },
18
- },
19
- };
20
-
21
- export const i18n = (
22
- context = "core",
23
- phrase,
24
- locale = getNavigatorLanguage(),
25
- allPhrases = translations
26
- ) => {
27
- // Handle "keys" mode
28
- if (locale === "keys") {
29
- return `${context}.${phrase}`;
30
- }
31
-
32
- // get the root locale if using a dialect
33
- const rootLocale = rootLocaleFromLocale(locale);
34
-
35
- // 1. Pre-check fallbacks
36
- // ...we don't have the provided context or locale.
37
-
38
- if (typeof allPhrases[locale] === "undefined") {
39
- //First check if phrase exists in rootLocale
40
- if (typeof allPhrases[rootLocale] !== "undefined") {
41
- //Fallback to rootLocale if it does
42
- locale = rootLocale;
43
- } else {
44
- // Fallback to base locale if not
45
- locale = "en";
46
- }
47
- }
48
-
49
- if (typeof allPhrases[locale][context] === "undefined" && context === "date_formats") {
50
- // Fallback to the format in the 'en' date formats
51
- return allPhrases["en"][context][phrase];
52
- }
53
-
54
- if (typeof allPhrases[locale][context] === "undefined") {
55
- //First check if context exists in the rootLocale
56
- if (typeof allPhrases[rootLocale][context] !== "undefined") {
57
- //Fallback to rootLocale if it does
58
- locale = rootLocale;
59
- } else {
60
- // Fallback to base context if it doesn't
61
- context = "core";
62
- }
63
- }
64
-
65
- if (typeof allPhrases[locale][context][phrase] !== "undefined") {
66
- // Happy path:
67
- return allPhrases[locale][context][phrase];
68
- } else if (typeof allPhrases[locale]["core"][phrase] !== "undefined") {
69
- // Check the phrase with our base context:
70
- return allPhrases[locale]["core"][phrase];
71
- } else if (typeof allPhrases["en"]["core"][phrase] !== "undefined") {
72
- // Check the phrase with our base context and default locale:
73
- return allPhrases["en"]["core"][phrase];
74
- } else {
75
- // Nothing has worked, so let's return a string to
76
- // highlight the error but not break the app.
77
- console.warn(
78
- `Missing translation. slug: ${phrase}, context: ${context}, locale: ${locale}`
79
- );
80
- return turnSlugIntoString(phrase);
81
- }
82
- };
83
-
84
- export const tzi18n = (tzid, locale = getNavigatorLanguage(), exceptions = translations) => {
85
- // console.log("timezones", timezones);
86
- // Parse the locale (if it's one we want to normalize)
87
- locale = locale === "en-US" ? "en" : locale;
88
-
89
- // 1. Pre-check fallbacks
90
- // ...we don't have the provided locale.
91
-
92
- if (typeof exceptions[locale] === "undefined") {
93
- // Fallback to base locale
94
- locale = "en";
95
- }
96
-
97
- if (typeof exceptions[locale].time_zones === "undefined") {
98
- // Fallback to base locale
99
- locale = "en";
100
- }
101
-
102
- if (typeof exceptions[locale].time_zones[tzid] !== "undefined") {
103
- // There is an exception:
104
- return exceptions[locale].time_zones[tzid];
105
- }
106
-
107
- // If we get here, the tzid string doesn't match any exceptions,
108
- // so we'll infer the visually-acceptable version.
109
- return humanizeTzName(tzid);
110
- };
111
-
112
- export const i18nConstructor = ({
113
- context = "core",
114
- locale = getNavigatorLanguage(),
115
- localeModifiers = {},
116
- allPhrases = translations,
117
- tzid,
118
- }) => {
119
- const slotFormatString = () => {
120
- let slotFormat = "dddd Do MMMM";
121
-
122
- const configVariant = nestedValue([locale, "dates"], localeModifiers);
123
- if (configVariant) {
124
- const overrideFormat = nestedValue(
125
- [locale, "dates", configVariant, "slotFormat"],
126
- modifierDateFormats
127
- );
128
- if (overrideFormat) slotFormat = overrideFormat;
129
- }
130
-
131
- return slotFormat;
132
- };
133
-
134
- const formatDateString = (dateString, formatString) =>
135
- moment(dateString).tz(tzid).locale(locale).format(formatString);
136
-
137
- const dateToSlotStringWithoutTzShift = dateString =>
138
- // TZ is not applied here as it is already shifted into local time
139
- moment(dateString).locale(locale).format(slotFormatString());
140
-
141
- const timeToSlotString = dateString => formatDateString(dateString, "LT").replace(" ", "");
142
-
143
- return {
144
- t: slug => i18n(context, slug, locale, allPhrases),
145
- f: (momentObject, formatString) => momentObject.locale(locale).format(formatString),
146
- ftz: (momentObject, formatString) =>
147
- momentObject.tz(tzid).locale(locale).format(formatString),
148
- customFormatedTimeZone: (momentObject, ctz, formatString) =>
149
- momentObject.tz(ctz).locale(locale).format(formatString),
150
- dateToSlotStringWithoutTzShift,
151
- timeToSlotString,
152
- };
153
- };
@@ -1,55 +0,0 @@
1
- import { parseToken, parseTarget, parseConnectionDomains, parseTranslations } from "./init";
2
- import { logConstructor } from "./logging";
3
-
4
- export const parseAgendaOptions = (options = {}) => {
5
- let config = typeof options.config === "undefined" ? {} : options.config;
6
- const logs = typeof config.logs === "undefined" ? "warn" : config.logs;
7
- const log = logConstructor(logs, "Agenda View", options.callback);
8
-
9
- const demoMode = typeof options.demo === "undefined" ? false : options.demo;
10
- if (demoMode) {
11
- log.warn("You are running in demo mode. No API requests will be made");
12
- }
13
-
14
- const token = parseToken(options, "agenda-view", log);
15
- if (!token && !demoMode) {
16
- log.error(
17
- "You need to include an `element_token`. If you're just testing (and don't want to use real API data) you can set the `demo` option to `true` to bypass the API connection and view dummy content."
18
- );
19
- return false;
20
- }
21
-
22
- const target = parseTarget(options, "agenda", log);
23
-
24
- const domains = parseConnectionDomains(
25
- options.data_center,
26
- options.api_domain,
27
- options.app_domain
28
- );
29
-
30
- const translations = parseTranslations(options.translations, "availability_rules");
31
-
32
- const mode = typeof config.mode === "undefined" ? "default" : config.mode;
33
-
34
- const validModes = ["default", "only_managed", "free_busy", "free_busy_managed"];
35
- const validMode = validModes.includes(mode);
36
- if (!validMode) {
37
- log.error(`Please provide a valid \`config.mode\`. \`${mode}\` is not a supported value.`, {
38
- docsSlug: "agenda-viewer/#config.mode",
39
- });
40
- return false;
41
- }
42
-
43
- delete options.target_id;
44
- delete options.element_token;
45
- delete options.translations;
46
-
47
- return {
48
- ...options,
49
- config: { ...config, mode, logs },
50
- target,
51
- token,
52
- domains,
53
- translations,
54
- };
55
- };
@@ -1,195 +0,0 @@
1
- import {
2
- parseConnectionDomains,
3
- parseTarget,
4
- parseTimezone,
5
- parseToken,
6
- parseTranslations,
7
- } from "./init";
8
- import { logConstructor } from "./logging";
9
- import { default_availability_rules } from "./mocks";
10
- import moment from "moment-timezone";
11
-
12
- export const parseAvailabilityRulesOptions = (options = {}) => {
13
- let config = typeof options.config === "undefined" ? {} : options.config;
14
- const logs = typeof config.logs === "undefined" ? "warn" : config.logs;
15
- const log = logConstructor(
16
- logs,
17
- "Availability Rules",
18
- options.callback ? options.callback : false
19
- );
20
- const startDay =
21
- typeof config.week_start_day === "undefined" ? "sunday" : config.week_start_day;
22
-
23
- const validDays = [
24
- "sunday",
25
- "monday",
26
- "tuesday",
27
- "wednesday",
28
- "thursday",
29
- "friday",
30
- "saturday",
31
- ];
32
- const validStartDay = validDays.includes(startDay);
33
-
34
- if (!validStartDay) {
35
- log.error(
36
- `Please provide a valid \`config.week_start_day\`. \`${startDay}\` is not a supported value.`,
37
- {
38
- docsSlug: "availability-viewer/#config.week_start_day",
39
- }
40
- );
41
- return false;
42
- }
43
-
44
- const defaultWeeklyPeriods =
45
- typeof config.default_weekly_periods === "undefined"
46
- ? default_availability_rules
47
- : config.default_weekly_periods;
48
-
49
- const validateDefaultWeeklyPeriods = (default_weekly_periods, log) => {
50
- if (!Array.isArray(default_weekly_periods)) {
51
- return false;
52
- }
53
-
54
- if (default_weekly_periods.length < 1) {
55
- return false;
56
- }
57
-
58
- let errors = {};
59
- default_weekly_periods.forEach((dwp, index) => {
60
- if (
61
- dwp === null ||
62
- typeof dwp !== "object" ||
63
- !("day" in dwp) ||
64
- !("start_time" in dwp) ||
65
- !("end_time" in dwp)
66
- ) {
67
- errors[`default_weekly_period[${index}]`] = [
68
- "default weekly period must be an object with day, start_time and end_time properties",
69
- ];
70
- return false;
71
- }
72
-
73
- let out = [];
74
-
75
- if (!validDays.includes(dwp.day)) {
76
- out.push(
77
- "Please provide a valid day. '" + `${dwp.day}` + "' is not a supported value."
78
- );
79
- }
80
-
81
- if (!moment(dwp.start_time, "HH:mm", true).isValid()) {
82
- out.push("start_time must be a valid time string");
83
- }
84
-
85
- if (!moment(dwp.end_time, "HH:mm", true).isValid()) {
86
- out.push("end_time must be a valid time string");
87
- }
88
-
89
- if (dwp.start_time >= dwp.end_time) {
90
- out.push("end must be after start");
91
- }
92
-
93
- if (out.length > 0) errors[`default_weekly_period[${index}]`] = out;
94
- });
95
-
96
- if (Object.keys(errors).length > 0) {
97
- log.error("Some of the provided `default_weekly_periods` option have errors.", {
98
- docsSlug: "availability-viewer/#default_weekly_periods",
99
- errorObject: errors,
100
- });
101
- return false;
102
- }
103
- return true;
104
- };
105
-
106
- const validDefaultWeeklyPeriods = validateDefaultWeeklyPeriods(defaultWeeklyPeriods, log);
107
-
108
- if (!validDefaultWeeklyPeriods) {
109
- log.error("The provided default weekly periods are invalid");
110
- return false;
111
- }
112
-
113
- options.error = false;
114
- const demoMode = typeof options.demo === "undefined" ? false : options.demo;
115
- if (demoMode) {
116
- log.warn("You are running in demo mode. No API requests will be made");
117
- }
118
-
119
- const autoCreateRulesMode =
120
- typeof config.auto_create_rules === "undefined" ? false : config.auto_create_rules;
121
-
122
- const token = parseToken(options, "availability-rules", log);
123
- if (!token && !demoMode) {
124
- log.error(
125
- "You need to include an `element_token`. If you're just testing (and don't want to use real API data) you can set the `demo` option to `true` to bypass the API connection and view dummy content."
126
- );
127
- return false;
128
- }
129
-
130
- const target = parseTarget(options, "availability-rules", log);
131
-
132
- if (typeof options.availability_rule_id === "undefined") {
133
- // options.error = true;
134
- log.warn(
135
- 'You have not defined an availability_rule_id, so "default" will be used instead. Full details can be found on the Cronofy Elements documention page: https://docs.cronofy.com/developers/ui-elements/'
136
- );
137
- }
138
-
139
- const translations = parseTranslations(options.translations, "availability_rules");
140
-
141
- const tzid = parseTimezone(options.tzid, "availability-rules", log);
142
-
143
- const keyboardSupportedValues = ["basic"];
144
-
145
- const validateKeyBoardSupport = keyboard_support => {
146
- const validKeyboardSupport = keyboardSupportedValues.includes(keyboard_support);
147
- if (!validKeyboardSupport) {
148
- log.error(
149
- `Please provide a valid \`config.keyboard_support\`. \`${keyboard_support}\` is not a supported value.`,
150
- {
151
- docsSlug: "availability-rules/#config.keyboard_support",
152
- }
153
- );
154
- return false;
155
- } else {
156
- return keyboard_support;
157
- }
158
- };
159
-
160
- const keyboardSupport =
161
- typeof config.keyboard_support === "undefined"
162
- ? false
163
- : validateKeyBoardSupport(config.keyboard_support);
164
-
165
- const domains = parseConnectionDomains(
166
- options.data_center,
167
- options.api_domain,
168
- options.app_domain
169
- );
170
-
171
- delete options.target_id;
172
- delete options.element_token;
173
- delete options.translations;
174
- delete config.week_start_day;
175
- delete config.default_weekly_periods;
176
- delete config.auto_create_rules;
177
- delete config.keyboard_support;
178
-
179
- return {
180
- ...options,
181
- ...tzid,
182
- target,
183
- token,
184
- domains,
185
- config: {
186
- ...config,
187
- logs,
188
- startDay,
189
- defaultWeeklyPeriods,
190
- autoCreateRulesMode,
191
- keyboardSupport,
192
- },
193
- translations,
194
- };
195
- };
@@ -1,215 +0,0 @@
1
- import moment from "moment-timezone";
2
- import {
3
- adjustInterval,
4
- parseConnectionDomains,
5
- parseGridTime,
6
- parseInterval,
7
- parseQuery,
8
- parseTarget,
9
- parseTimezone,
10
- parseToken,
11
- parseTranslations,
12
- } from "./init";
13
- import { logConstructor } from "./logging";
14
-
15
- export const parseAvailabilityViewerOptions = (options = {}) => {
16
- let config = typeof options.config === "undefined" ? {} : options.config;
17
- const logs = typeof config.logs === "undefined" ? "warn" : config.logs;
18
- const log = logConstructor(
19
- logs,
20
- "Availability Viewer",
21
- options.callback ? options.callback : false
22
- );
23
-
24
- options.error = false;
25
- const demoMode = typeof options.demo === "undefined" ? false : options.demo;
26
-
27
- if (demoMode) {
28
- log.warn("You are running in demo mode. No API requests will be made");
29
- }
30
-
31
- const token = parseToken(options, "availability-viewer", log);
32
- if (!token && !demoMode) {
33
- log.error(
34
- "You need to include an `element_token`. If you're just testing (and don't want to use real API data) you can set the `demo` option to `true` to bypass the API connection and view dummy content."
35
- );
36
- return false;
37
- }
38
-
39
- const target = parseTarget(options, "availability-viewer", log);
40
-
41
- const startTime = parseGridTime(config.start_time, "09:00");
42
- if (startTime.message) {
43
- log.warn(`config.start_time: ${startTime.message}`, {
44
- docsSlug: "availability-viewer/#config.start_time",
45
- });
46
- }
47
-
48
- const endTime = parseGridTime(config.end_time, "17:00", true);
49
- if (endTime.message) {
50
- log.warn(`config.end_time: ${endTime.message}`, {
51
- docsSlug: "availability-viewer/#config.end_time",
52
- });
53
- }
54
- if (endTime.time === "00:00") {
55
- endTime.time = "24:00";
56
- }
57
-
58
- if (startTime.time > endTime.time) {
59
- log.error(
60
- `\`config.start_time\` (${startTime.time}) must be earlier than \`config.end_time\` (${endTime.time}).`
61
- );
62
- return false;
63
- }
64
-
65
- const rawInterval = parseInterval(config.interval);
66
-
67
- const interval = adjustInterval(rawInterval, startTime.offset, log);
68
-
69
- if (typeof options.extras !== "undefined") {
70
- log.warn(
71
- "The `extras` option has been deprecated in v1.0.0. Please use `config` option instead.",
72
- { docsSlug: "availability-viewer/#config" }
73
- );
74
- config = options.extras;
75
- }
76
- if (typeof options.config !== "undefined") {
77
- config = { ...config, ...options.config };
78
- }
79
-
80
- const tzid = parseTimezone(options.tzid, "availability-viewer", log);
81
- options = { ...options, ...tzid };
82
-
83
- const mode =
84
- typeof config.mode === "undefined" || config.mode === "default" ? "confirm" : config.mode;
85
-
86
- const validModes = ["confirm", "multi_select", "no_confirm", "free_select"];
87
- const validMode = validModes.includes(mode);
88
- if (!validMode) {
89
- log.error(`Please provide a valid \`config.mode\`. \`${mode}\` is not a supported value.`, {
90
- docsSlug: "availability-viewer/#config.mode",
91
- });
92
- return false;
93
- }
94
-
95
- const slot_selection =
96
- typeof config.slot_selection === "undefined" || config.slot_selection === "default"
97
- ? "available"
98
- : config.slot_selection;
99
-
100
- const boundsControl =
101
- typeof config.bounds_control === "undefined" || config.bounds_control === "default"
102
- ? false
103
- : true;
104
-
105
- const query = parseQuery({
106
- options,
107
- elementSlug: "availability-viewer",
108
- log,
109
- allowEmpty: true,
110
- });
111
- if (!query) return false;
112
-
113
- if (config.mode === "free_select") {
114
- query.required_duration.minutes = interval;
115
- const now = moment.utc().startOf("hour").add(1, "hour");
116
- // Adding 34 days to ensure that the resulting query stays within the requiered bounds defined in
117
- // https://docs.cronofy.com/developers/api/scheduling/availability/#param-participants.members.available_periods.end
118
- query.query_periods = [
119
- {
120
- start: now.format("YYYY-MM-DDTHH:mm[:00Z]"),
121
- end: now
122
- .clone()
123
- .local()
124
- .add(34, "days")
125
- .endOf("day")
126
- .utc()
127
- .format("YYYY-MM-DDTHH:mm[:00Z]"),
128
- },
129
- ];
130
- config.week_start_day = now.tz(options.tzid).local().format("dddd").toLowerCase();
131
- }
132
-
133
- const allowExpansion =
134
- typeof config.allow_expansion === "undefined" || config.allow_expansion === "default"
135
- ? false
136
- : config.allow_expansion;
137
-
138
- const startDay =
139
- typeof config.week_start_day === "undefined" || config.week_start_day === "default"
140
- ? "sunday"
141
- : config.week_start_day;
142
-
143
- const validStartDays = [
144
- "sunday",
145
- "monday",
146
- "tuesday",
147
- "wednesday",
148
- "thursday",
149
- "friday",
150
- "saturday",
151
- ];
152
- const validStartDay = validStartDays.includes(startDay);
153
-
154
- if (!validStartDay) {
155
- log.error(
156
- `Please provide a valid \`config.week_start_day\`. \`${startDay}\` is not a supported value.`,
157
- {
158
- docsSlug: "availability-viewer/#config.week_start_day",
159
- }
160
- );
161
- return false;
162
- }
163
-
164
- config = {
165
- ...config,
166
- allowExpansion,
167
- start_time: startTime.time,
168
- end_time: endTime.time,
169
- interval,
170
- startDay,
171
- mode,
172
- boundsControl,
173
- slot_selection,
174
- logs,
175
- };
176
-
177
- const domains = parseConnectionDomains(
178
- options.data_center,
179
- options.api_domain,
180
- options.app_domain
181
- );
182
-
183
- const translations = parseTranslations(options.translations, "availability_rules");
184
-
185
- config.start_time = config.start_time || "09:00";
186
- config.end_time = config.end_time || "17:30";
187
-
188
- const validStart = moment(config.start_time, "HH:mm").isValid();
189
- const validEnd = moment(config.end_time, "HH:mm").isValid();
190
-
191
- if (!validStart || !validEnd) {
192
- log.error("Please provide a valid `config.start_time` and `config.end_time`.", {
193
- docsSlug: "availability-viewer/#config.start_time",
194
- });
195
- return false;
196
- }
197
-
198
- delete options.availability_query;
199
- delete options.element_token;
200
- delete options.target_id;
201
- delete config.bounds_control;
202
- delete config.week_start_day;
203
- delete config.allow_expansion;
204
- delete config.translations;
205
-
206
- return {
207
- ...options,
208
- target,
209
- token,
210
- domains,
211
- config,
212
- query,
213
- translations,
214
- };
215
- };
@@ -1,83 +0,0 @@
1
- import { parseToken, parseTarget, parseConnectionDomains, parseTranslations } from "./init";
2
- import { logConstructor } from "./logging";
3
-
4
- export const parseCalendarSyncOptions = (options = {}) => {
5
- let config = typeof options.config === "undefined" ? {} : options.config;
6
- const logs = typeof config.logs === "undefined" ? "warn" : config.logs;
7
- const log = logConstructor(logs, "Calendar Sync", options.callback ? options.callback : false);
8
-
9
- options.error = false;
10
- const demoMode = typeof options.demo === "undefined" ? false : options.demo;
11
- if (demoMode) {
12
- log.warn("You are running in demo mode. No API requests will be made");
13
- }
14
-
15
- const token = parseToken(options, "calendar-sync", log);
16
-
17
- const target = parseTarget(options, "calendar-sync", log);
18
-
19
- if (!options.authorization_url) {
20
- if (typeof options.authorization === "undefined" && !demoMode) {
21
- log.error("You need to specify authorization options.");
22
- return false;
23
- } else if (typeof options.authorization === "undefined" && demoMode) {
24
- options.authorization = {
25
- redirect_uri: "REDIRECT_URI",
26
- client_id: "CLIENT_ID",
27
- scope: "SCOPE",
28
- };
29
- } else {
30
- if (typeof options.authorization.redirect_uri === "undefined" && !demoMode) {
31
- log.error("You need to specify authorization option: `redirect_uri`.");
32
- return false;
33
- }
34
- if (typeof options.authorization.client_id === "undefined" && !demoMode) {
35
- log.error("You need to specify authorization option: `client_id`.");
36
- return false;
37
- }
38
- if (typeof options.authorization.scope === "undefined" && !demoMode) {
39
- log.error("You need to specify authorization option: `scope`.");
40
- return false;
41
- }
42
- }
43
- }
44
-
45
- const revokeMode =
46
- typeof config.revoke_mode === "undefined" ? "trigger_and_callback" : config.revoke_mode;
47
- const validRevokeModes = ["trigger_and_callback", "callback_only"];
48
- const validRevokeMode = validRevokeModes.includes(revokeMode);
49
-
50
- if (!validRevokeMode) {
51
- log.error(
52
- `Please provide a valid 'config.revoke_mode'. '${revokeMode}' is not a supported value.`,
53
- {
54
- docsSlug: "calendar-sync#config.revoke_mode",
55
- }
56
- );
57
- return false;
58
- }
59
-
60
- options.single_profile =
61
- typeof options.single_profile !== "undefined" ? options.single_profile : false;
62
-
63
- const translations = parseTranslations(options.translations, "availability_rules");
64
-
65
- delete options.target_id;
66
- delete options.element_token;
67
- delete options.translations;
68
-
69
- const domains = parseConnectionDomains(
70
- options.data_center,
71
- options.api_domain,
72
- options.app_domain
73
- );
74
-
75
- return {
76
- ...options,
77
- config: { ...config, logs, revoke_mode: revokeMode },
78
- target,
79
- token,
80
- domains,
81
- translations,
82
- };
83
- };