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,435 +0,0 @@
1
- import { statusReducer } from "../../src/js/components/CalendarSync/contexts/status-reducer";
2
-
3
- describe("CalendarSync statusReducer", () => {
4
- describe("TOGGLE_ADD_PROFILE", () => {
5
- it("sets `adding` to `true` on the state", () => {
6
- const initialState = {
7
- adding: false,
8
- };
9
-
10
- const action = {
11
- type: "TOGGLE_ADD_PROFILE",
12
- };
13
-
14
- const actual = statusReducer(initialState, action);
15
-
16
- expect(actual).toEqual({
17
- adding: true,
18
- });
19
- });
20
-
21
- it("sets `adding` to `false` on the state", () => {
22
- const initialState = {
23
- adding: true,
24
- };
25
-
26
- const action = {
27
- type: "TOGGLE_ADD_PROFILE",
28
- };
29
-
30
- const actual = statusReducer(initialState, action);
31
-
32
- expect(actual).toEqual({
33
- adding: false,
34
- });
35
- });
36
- });
37
-
38
- describe("REVOKE_PROFILE", () => {
39
- it("invokes a callback with correct params", () => {
40
- const initialState = {
41
- callback: jest.fn(),
42
- };
43
-
44
- const action = {
45
- type: "REVOKE_PROFILE",
46
- profile: {
47
- id: "some_id",
48
- },
49
- };
50
-
51
- const actual = statusReducer(initialState, action);
52
-
53
- expect(actual).toEqual(initialState);
54
- expect(initialState.callback).toHaveBeenCalledTimes(1);
55
- expect(initialState.callback).toHaveBeenCalledWith({
56
- notification: {
57
- type: "profile_revoke_pressed",
58
- profile: action.profile,
59
- },
60
- });
61
- });
62
- });
63
-
64
- describe("REVOKE_PROFILE_SUCCESS", () => {
65
- it("sets `pendingNotification` on the state", () => {
66
- const initialState = {
67
- adding: false,
68
- editing: true,
69
- };
70
-
71
- const action = {
72
- type: "REVOKE_PROFILE_SUCCESS",
73
- profile: {
74
- id: "some_id",
75
- },
76
- };
77
-
78
- const actual = statusReducer(initialState, action);
79
-
80
- expect(actual).toEqual({
81
- ...initialState,
82
- pendingNotification: {
83
- type: "profile_revoked",
84
- profile: action.profile,
85
- },
86
- });
87
- });
88
- });
89
-
90
- describe("TOGGLE_EDIT_PROFILES", () => {
91
- it("sets `editing` to `true` on the state", () => {
92
- const initialState = {
93
- editing: false,
94
- };
95
-
96
- const action = {
97
- type: "TOGGLE_EDIT_PROFILES",
98
- };
99
-
100
- const actual = statusReducer(initialState, action);
101
-
102
- expect(actual).toEqual({
103
- editing: true,
104
- });
105
- });
106
-
107
- it("sets `editing` to `false` on the state", () => {
108
- const initialState = {
109
- editing: true,
110
- };
111
-
112
- const action = {
113
- type: "TOGGLE_EDIT_PROFILES",
114
- };
115
-
116
- const actual = statusReducer(initialState, action);
117
-
118
- expect(actual).toEqual({
119
- editing: false,
120
- });
121
- });
122
- });
123
-
124
- describe("GET_USER_INFO_SUCCESS", () => {
125
- it("sets `loading` to `false` on the state", () => {
126
- const initialState = {
127
- loading: true,
128
- type: null,
129
- pendingNotification: null,
130
- someOtherState: "yes",
131
- };
132
-
133
- const action = {
134
- type: "GET_USER_INFO_SUCCESS",
135
- userInfo: {
136
- id: "some_id",
137
- "cronofy.type": "account",
138
- },
139
- };
140
-
141
- const expected = {
142
- loading: false,
143
- type: action.userInfo["cronofy.type"],
144
- pendingNotification: null,
145
- someOtherState: "yes",
146
- };
147
-
148
- const actualWithLoadingTrue = statusReducer(initialState, action);
149
- const actualWithLoadingFalse = statusReducer(
150
- { ...initialState, loading: false },
151
- action
152
- );
153
-
154
- expect(actualWithLoadingTrue).toEqual(expected);
155
- expect(actualWithLoadingFalse).toEqual(expected);
156
- });
157
-
158
- it("sets `type` to the `cronofy.type` on the state", () => {
159
- const initialState = {
160
- loading: true,
161
- type: null,
162
- pendingNotification: null,
163
- someOtherState: "yes",
164
- };
165
-
166
- const action = {
167
- type: "GET_USER_INFO_SUCCESS",
168
- userInfo: {
169
- id: "some_id",
170
- "cronofy.type": "account",
171
- },
172
- };
173
-
174
- const expected = {
175
- loading: false,
176
- type: action.userInfo["cronofy.type"],
177
- pendingNotification: null,
178
- someOtherState: "yes",
179
- };
180
-
181
- const actualWithNullType = statusReducer(initialState, action);
182
- const actualWithPopulatedType = statusReducer(
183
- { ...initialState, type: "some_value" },
184
- action
185
- );
186
-
187
- expect(actualWithNullType).toEqual(expected);
188
- expect(actualWithPopulatedType).toEqual(expected);
189
- });
190
-
191
- it("sets `pendingNotification` to `null` on the state", () => {
192
- const callback = () => {};
193
-
194
- const initialState = {
195
- loading: true,
196
- type: null,
197
- pendingNotification: null,
198
- someOtherState: "yes",
199
- callback,
200
- };
201
-
202
- const action = {
203
- type: "GET_USER_INFO_SUCCESS",
204
- userInfo: {
205
- id: "some_id",
206
- "cronofy.type": "account",
207
- },
208
- };
209
-
210
- const expected = {
211
- loading: false,
212
- type: action.userInfo["cronofy.type"],
213
- pendingNotification: null,
214
- someOtherState: "yes",
215
- callback,
216
- };
217
-
218
- const actualWithNullNotification = statusReducer(initialState, action);
219
- const actualWithPopulatedNotification = statusReducer(
220
- { ...initialState, pendingNotification: "some_value" },
221
- action
222
- );
223
-
224
- expect(actualWithNullNotification).toEqual(expected);
225
- expect(actualWithPopulatedNotification).toEqual(expected);
226
- });
227
-
228
- describe("when `pendingNotification` exists", () => {
229
- it("invokes callback with correct params", () => {
230
- const initialState = {
231
- pendingNotification: {
232
- type: "profile_revoked",
233
- profile: {
234
- id: "some_id",
235
- },
236
- },
237
- callback: jest.fn(),
238
- };
239
-
240
- const action = {
241
- type: "GET_USER_INFO_SUCCESS",
242
- userInfo: {
243
- id: "some_userinfo_id",
244
- "cronofy.type": "account",
245
- },
246
- };
247
-
248
- statusReducer(initialState, action);
249
-
250
- expect(initialState.callback).toHaveBeenCalledTimes(1);
251
- expect(initialState.callback).toHaveBeenCalledWith({
252
- notification: initialState.pendingNotification,
253
- userinfo: action.userInfo,
254
- });
255
- });
256
- });
257
-
258
- describe("when `pendingNotification` doesn't exist", () => {
259
- it("doesn't invoke callback", () => {
260
- const initialState = {
261
- pendingNotification: null,
262
- callback: jest.fn(),
263
- };
264
-
265
- const action = {
266
- type: "GET_USER_INFO_SUCCESS",
267
- userInfo: {
268
- id: "some_userinfo_id",
269
- "cronofy.type": "account",
270
- },
271
- };
272
-
273
- statusReducer(initialState, action);
274
-
275
- expect(initialState.callback).toHaveBeenCalledTimes(0);
276
- });
277
- });
278
- });
279
-
280
- describe("GET_USER_INFO_ERROR", () => {
281
- it("sets `loading` to `false` on the state", () => {
282
- const initialState = {
283
- loading: true,
284
- error: null,
285
- };
286
-
287
- const action = {
288
- type: "GET_USER_INFO_ERROR",
289
- error: null,
290
- };
291
-
292
- const expected = {
293
- loading: false,
294
- error: null,
295
- };
296
-
297
- const actualWithLoadingTrue = statusReducer(initialState, action);
298
- const actualWithLoadingFalse = statusReducer(
299
- { ...initialState, loading: false },
300
- action
301
- );
302
-
303
- expect(actualWithLoadingTrue).toEqual(expected);
304
- expect(actualWithLoadingFalse).toEqual(expected);
305
- });
306
-
307
- it("sets `error` to correct value on the state", () => {
308
- const initialState = {
309
- loading: false,
310
- error: null,
311
- };
312
-
313
- const action = {
314
- type: "GET_USER_INFO_ERROR",
315
- error: "some error",
316
- };
317
-
318
- const expected = {
319
- loading: false,
320
- error: action.error,
321
- };
322
-
323
- const actualWithNullError = statusReducer(initialState, action);
324
- const actualWithExistingError = statusReducer(
325
- { ...initialState, error: "previous error" },
326
- action
327
- );
328
-
329
- expect(actualWithNullError).toEqual(expected);
330
- expect(actualWithExistingError).toEqual(expected);
331
- });
332
- });
333
-
334
- describe("NO_TOKEN_SUCCESS", () => {
335
- it("sets `loading` to `false` on the state", () => {
336
- const initialState = {
337
- type: null,
338
- loading: true,
339
- pendingNotification: null,
340
- };
341
-
342
- const action = {
343
- type: "NO_TOKEN_SUCCESS",
344
- };
345
-
346
- const expected = {
347
- type: null,
348
- loading: false,
349
- pendingNotification: null,
350
- };
351
-
352
- const actualWithLoadingTrue = statusReducer(initialState, action);
353
- const actualWithLoadingFalse = statusReducer(
354
- { ...initialState, loading: false },
355
- action
356
- );
357
-
358
- expect(actualWithLoadingTrue).toEqual(expected);
359
- expect(actualWithLoadingFalse).toEqual(expected);
360
- });
361
-
362
- it("sets `pendingNotification` to `null` on the state", () => {
363
- const callback = () => {};
364
-
365
- const initialState = {
366
- type: null,
367
- loading: true,
368
- pendingNotification: null,
369
- callback,
370
- };
371
-
372
- const action = {
373
- type: "NO_TOKEN_SUCCESS",
374
- };
375
-
376
- const expected = {
377
- type: null,
378
- loading: false,
379
- pendingNotification: null,
380
- callback,
381
- };
382
-
383
- const actualWithNullNotification = statusReducer(initialState, action);
384
- const actualWithPopulatedNotification = statusReducer(
385
- { ...initialState, pendingNotification: "some_value" },
386
- action
387
- );
388
-
389
- expect(actualWithNullNotification).toEqual(expected);
390
- expect(actualWithPopulatedNotification).toEqual(expected);
391
- });
392
-
393
- describe("when `pendingNotification` exists", () => {
394
- it("invokes callback", () => {
395
- const initialState = {
396
- pendingNotification: {
397
- type: "profile_revoked",
398
- profile: {
399
- id: "some_id",
400
- },
401
- },
402
- callback: jest.fn(),
403
- };
404
-
405
- const action = {
406
- type: "NO_TOKEN_SUCCESS",
407
- };
408
-
409
- statusReducer(initialState, action);
410
-
411
- expect(initialState.callback).toHaveBeenCalledTimes(1);
412
- expect(initialState.callback).toHaveBeenCalledWith({
413
- notification: initialState.pendingNotification,
414
- });
415
- });
416
- });
417
-
418
- describe("when `pendingNotification` doesn't exist", () => {
419
- it("doesn't invoke callback", () => {
420
- const initialState = {
421
- pendingNotification: null,
422
- callback: jest.fn(),
423
- };
424
-
425
- const action = {
426
- type: "NO_TOKEN_SUCCESS",
427
- };
428
-
429
- statusReducer(initialState, action);
430
-
431
- expect(initialState.callback).toHaveBeenCalledTimes(0);
432
- });
433
- });
434
- });
435
- });
@@ -1,157 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent, within } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
-
5
- import SequencedSlotButton from "../../src/js/components/DateTimePicker/SequencedSlotButton";
6
-
7
- import { I18nProvider } from "../../src/js/contexts/i18n-context";
8
- import { ThemeProvider } from "../../src/js/components/DateTimePicker/contexts/theme-context";
9
- import { StatusProvider } from "../../src/js/components/DateTimePicker/contexts/status-context";
10
- import { TzProvider } from "../../src/js/contexts/tz-context";
11
-
12
- const wrapper = ({ children, status }) => (
13
- <ThemeProvider options={{ name: "DTP" }}>
14
- <I18nProvider
15
- options={{
16
- locale: "en",
17
- slug: "date_time_picker",
18
- tzid: "Europe/London",
19
- }}
20
- >
21
- <TzProvider
22
- options={{
23
- selectedTzid: {
24
- tzid: "Europe/London",
25
- offset: "+01:00",
26
- offsetMins: 60,
27
- name: "London",
28
- abbr: "BST",
29
- },
30
- list: [],
31
- }}
32
- >
33
- <StatusProvider
34
- options={{
35
- selected: false,
36
- ...status,
37
- }}
38
- >
39
- {children}
40
- </StatusProvider>
41
- </TzProvider>
42
- </I18nProvider>
43
- </ThemeProvider>
44
- );
45
-
46
- describe("SequencedSlotButton", () => {
47
- const slot = [
48
- { sequence_id: "test-1", start: "2022-10-05T09:30:00Z", end: "2022-10-05T10:00:00Z" },
49
- { sequence_id: "test-2", start: "2022-10-05T10:30:00Z", end: "2022-10-05T11:00:00Z" },
50
- ];
51
-
52
- it("displays slot button with correct start and end time", () => {
53
- const { container } = render(<SequencedSlotButton slot={slot} />, { wrapper });
54
-
55
- const button = container.querySelector(".DTP__time-slot");
56
-
57
- expect(button).toBeInTheDocument();
58
- expect(button.innerHTML).toEqual(expect.stringContaining("10:30 AM - 12:00 PM (BST)"));
59
- });
60
-
61
- it("displays slot button with time in BST", () => {
62
- const { container } = render(<SequencedSlotButton slot={slot} />, { wrapper });
63
-
64
- const button = container.querySelector(".DTP__time-slot");
65
-
66
- expect(button).toBeInTheDocument();
67
- expect(button.innerHTML).toEqual(expect.stringContaining("10:30 AM - 12:00 PM (BST)"));
68
- });
69
-
70
- it("displays a detailed view when slot button mode is set to detailed", () => {
71
- const status = {
72
- slotButtonMode: "detailed",
73
- };
74
- const { container } = render(<SequencedSlotButton slot={slot} />, {
75
- wrapper: e => wrapper({ ...e, status }),
76
- });
77
-
78
- const button = container.querySelector(".DTP__time-slot");
79
- const detailedList = container.querySelector(".DTP__detailed-slot-list");
80
-
81
- expect(button).toBeInTheDocument();
82
- expect(detailedList).toBeInTheDocument();
83
-
84
- const { getAllByRole } = within(detailedList);
85
- const items = getAllByRole("listitem");
86
- expect(items.length).toBe(2);
87
-
88
- const listText = items.map(item => item.textContent);
89
- expect(listText).toMatchInlineSnapshot(`
90
- Array [
91
- "10:30 AM - 11:00 AM (BST)",
92
- "11:30 AM - 12:00 PM (BST)",
93
- ]
94
- `);
95
- });
96
-
97
- it("displays slot button with time in GMT", () => {
98
- const slot = [
99
- { sequence_id: "test-1", start: "2022-11-05T09:30:00Z", end: "2022-11-05T10:00:00Z" },
100
- { sequence_id: "test-2", start: "2022-11-05T10:30:00Z", end: "2022-11-05T11:00:00Z" },
101
- ];
102
- const { container } = render(<SequencedSlotButton slot={slot} />, { wrapper });
103
-
104
- const button = container.querySelector(".DTP__time-slot");
105
-
106
- expect(button).toBeInTheDocument();
107
- expect(button.innerHTML).toEqual(expect.stringContaining("9:30 AM - 11:00 AM (GMT)"));
108
- });
109
-
110
- it("focuses if slot start time matches status.focusedSlot", () => {
111
- const status = {
112
- focusedSlot: "2022-10-05T09:30:00Z",
113
- selected: false,
114
- };
115
-
116
- const { container } = render(<SequencedSlotButton slot={slot} />, {
117
- wrapper: e => wrapper({ ...e, status }),
118
- });
119
-
120
- const button = container.querySelector("button");
121
-
122
- expect(button).toHaveFocus();
123
- });
124
-
125
- it("sets the slot to selected when button is clicked", () => {
126
- const { container } = render(<SequencedSlotButton slot={slot} />, { wrapper });
127
-
128
- const button = container.querySelector("button");
129
-
130
- expect(button).not.toHaveClass("DTP_time-slot--selected");
131
-
132
- fireEvent.click(button);
133
-
134
- expect(button).toHaveFocus();
135
- expect(button.classList).toContain("DTP__time-slot--selected");
136
- });
137
-
138
- it("shows selected className if preselected slot exists", () => {
139
- const status = {
140
- focusedSlot: "2022-10-05T09:30:00Z",
141
- selected: {
142
- start: "2022-10-05T09:30:00Z",
143
- end: "2022-10-05T11:00:00Z",
144
- sequence: slot,
145
- },
146
- };
147
-
148
- const { container } = render(<SequencedSlotButton slot={slot} />, {
149
- wrapper: e => wrapper({ ...e, status }),
150
- });
151
-
152
- const button = container.querySelector("button");
153
-
154
- expect(button).toHaveFocus();
155
- expect(button).toHaveClass("DTP__time-slot--selected");
156
- });
157
- });
@@ -1,118 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
-
5
- import SlotButton from "../../src/js/components/DateTimePicker/SlotButton";
6
-
7
- import { I18nProvider } from "../../src/js/contexts/i18n-context";
8
- import { ThemeProvider } from "../../src/js/components/DateTimePicker/contexts/theme-context";
9
- import { StatusProvider } from "../../src/js/components/DateTimePicker/contexts/status-context";
10
- import { TzProvider } from "../../src/js/contexts/tz-context";
11
-
12
- const wrapper = ({ children, status }) => (
13
- <ThemeProvider options={{ name: "DTP" }}>
14
- <I18nProvider
15
- options={{
16
- locale: "en",
17
- slug: "date_time_picker",
18
- tzid: "Europe/London",
19
- }}
20
- >
21
- <TzProvider
22
- options={{
23
- selectedTzid: {
24
- tzid: "Europe/London",
25
- offset: "+01:00",
26
- offsetMins: 60,
27
- name: "London",
28
- abbr: "BST",
29
- },
30
- list: [],
31
- }}
32
- >
33
- <StatusProvider
34
- options={{
35
- selected: false,
36
- ...status,
37
- }}
38
- >
39
- {children}
40
- </StatusProvider>
41
- </TzProvider>
42
- </I18nProvider>
43
- </ThemeProvider>
44
- );
45
-
46
- describe("SlotButton", () => {
47
- const slot = {
48
- start: "2020-10-05T09:30:00Z",
49
- end: "2020-10-05T10:00:00Z",
50
- };
51
-
52
- it("displays slot button with time in BST", () => {
53
- const { container } = render(<SlotButton slot={slot} />, { wrapper });
54
-
55
- const button = container.querySelector(".DTP__time-slot");
56
-
57
- expect(button).toBeInTheDocument();
58
- expect(button.innerHTML).toEqual(expect.stringContaining("10:30 AM - 11:00 AM (BST)"));
59
- });
60
-
61
- it("displays slot button with time in GMT", () => {
62
- const slot = {
63
- start: "2020-11-05T09:30:00Z",
64
- end: "2020-11-05T10:00:00Z",
65
- };
66
-
67
- const { container } = render(<SlotButton slot={slot} />, { wrapper });
68
-
69
- const button = container.querySelector(".DTP__time-slot");
70
-
71
- expect(button).toBeInTheDocument();
72
- expect(button.innerHTML).toEqual(expect.stringContaining("9:30 AM - 10:00 AM (GMT)"));
73
- });
74
-
75
- it("focuses if slot start time matches status.focusedSlot", () => {
76
- const status = {
77
- focusedSlot: slot.start,
78
- selected: false,
79
- };
80
-
81
- const { container } = render(<SlotButton slot={slot} />, {
82
- wrapper: e => wrapper({ ...e, status }),
83
- });
84
-
85
- const button = container.querySelector("button");
86
-
87
- expect(button).toHaveFocus();
88
- });
89
-
90
- it("sets the slot to selected when button is clicked", () => {
91
- const { container } = render(<SlotButton slot={slot} />, { wrapper });
92
-
93
- const button = container.querySelector("button");
94
-
95
- expect(button).not.toHaveClass("DTP_time-slot--selected");
96
-
97
- fireEvent.click(button);
98
-
99
- expect(button).toHaveFocus();
100
- expect(button.classList).toContain("DTP__time-slot--selected");
101
- });
102
-
103
- it("shows selected className if preselected slot exists", () => {
104
- const status = {
105
- focusedSlot: slot.start,
106
- selected: slot,
107
- };
108
-
109
- const { container } = render(<SlotButton slot={slot} />, {
110
- wrapper: e => wrapper({ ...e, status }),
111
- });
112
-
113
- const button = container.querySelector("button");
114
-
115
- expect(button).toHaveFocus();
116
- expect(button.classList).toContain("DTP__time-slot--selected");
117
- });
118
- });