@oneblink/apps-react 9.0.0-beta.2 → 9.0.0-beta.4

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 (368) hide show
  1. package/dist/OneBlinkForm.d.ts +6 -10
  2. package/dist/OneBlinkForm.js +0 -4
  3. package/dist/OneBlinkForm.js.map +1 -1
  4. package/dist/OneBlinkFormBase.d.ts +1 -1
  5. package/dist/OneBlinkFormBase.js +2 -1
  6. package/dist/OneBlinkFormBase.js.map +1 -1
  7. package/dist/OneBlinkReadOnlyForm.d.ts +1 -1
  8. package/dist/OneBlinkReadOnlyForm.js +1 -1
  9. package/dist/OneBlinkReadOnlyForm.js.map +1 -1
  10. package/dist/PaymentReceipt.d.ts +1 -1
  11. package/dist/PaymentReceipt.js +1 -1
  12. package/dist/PaymentReceipt.js.map +1 -1
  13. package/dist/apps/Sentry.d.ts +7 -0
  14. package/dist/apps/Sentry.js +16 -0
  15. package/dist/apps/Sentry.js.map +1 -0
  16. package/dist/apps/approvals-service.d.ts +390 -0
  17. package/dist/apps/approvals-service.js +987 -0
  18. package/dist/apps/approvals-service.js.map +1 -0
  19. package/dist/apps/attachments-service.d.ts +49 -0
  20. package/dist/apps/attachments-service.js +134 -0
  21. package/dist/apps/attachments-service.js.map +1 -0
  22. package/dist/apps/auth-service.d.ts +114 -0
  23. package/dist/apps/auth-service.js +194 -0
  24. package/dist/apps/auth-service.js.map +1 -0
  25. package/dist/apps/auto-save-service.d.ts +82 -0
  26. package/dist/apps/auto-save-service.js +105 -0
  27. package/dist/apps/auto-save-service.js.map +1 -0
  28. package/dist/apps/draft-service.d.ts +148 -0
  29. package/dist/apps/draft-service.js +583 -0
  30. package/dist/apps/draft-service.js.map +1 -0
  31. package/dist/apps/form-service.d.ts +204 -0
  32. package/dist/apps/form-service.js +718 -0
  33. package/dist/apps/form-service.js.map +1 -0
  34. package/dist/apps/form-store-service.d.ts +141 -0
  35. package/dist/apps/form-store-service.js +114 -0
  36. package/dist/apps/form-store-service.js.map +1 -0
  37. package/dist/apps/forms-app-environment-service.d.ts +19 -0
  38. package/dist/apps/forms-app-environment-service.js +55 -0
  39. package/dist/apps/forms-app-environment-service.js.map +1 -0
  40. package/dist/apps/forms-app-service.d.ts +18 -0
  41. package/dist/apps/forms-app-service.js +53 -0
  42. package/dist/apps/forms-app-service.js.map +1 -0
  43. package/dist/apps/index.d.ts +252 -0
  44. package/dist/apps/index.js +254 -0
  45. package/dist/apps/index.js.map +1 -0
  46. package/dist/apps/job-service.d.ts +20 -0
  47. package/dist/apps/job-service.js +95 -0
  48. package/dist/apps/job-service.js.map +1 -0
  49. package/dist/apps/localisation-service.d.ts +207 -0
  50. package/dist/apps/localisation-service.js +321 -0
  51. package/dist/apps/localisation-service.js.map +1 -0
  52. package/dist/apps/notification-service.d.ts +83 -0
  53. package/dist/apps/notification-service.js +315 -0
  54. package/dist/apps/notification-service.js.map +1 -0
  55. package/dist/apps/offline-service.d.ts +18 -0
  56. package/dist/apps/offline-service.js +25 -0
  57. package/dist/apps/offline-service.js.map +1 -0
  58. package/dist/apps/payment-service.d.ts +110 -0
  59. package/dist/apps/payment-service.js +182 -0
  60. package/dist/apps/payment-service.js.map +1 -0
  61. package/dist/apps/prefill-service.d.ts +14 -0
  62. package/dist/apps/prefill-service.js +19 -0
  63. package/dist/apps/prefill-service.js.map +1 -0
  64. package/dist/apps/scheduled-tasks-service.d.ts +127 -0
  65. package/dist/apps/scheduled-tasks-service.js +240 -0
  66. package/dist/apps/scheduled-tasks-service.js.map +1 -0
  67. package/dist/apps/scheduling-service.d.ts +101 -0
  68. package/dist/apps/scheduling-service.js +171 -0
  69. package/dist/apps/scheduling-service.js.map +1 -0
  70. package/dist/apps/services/AWSCognitoClient.d.ts +55 -0
  71. package/dist/apps/services/AWSCognitoClient.js +436 -0
  72. package/dist/apps/services/AWSCognitoClient.js.map +1 -0
  73. package/dist/apps/services/api/drafts.d.ts +7 -0
  74. package/dist/apps/services/api/drafts.js +236 -0
  75. package/dist/apps/services/api/drafts.js.map +1 -0
  76. package/dist/apps/services/api/notifications.d.ts +3 -0
  77. package/dist/apps/services/api/notifications.js +60 -0
  78. package/dist/apps/services/api/notifications.js.map +1 -0
  79. package/dist/apps/services/api/payment.d.ts +23 -0
  80. package/dist/apps/services/api/payment.js +235 -0
  81. package/dist/apps/services/api/payment.js.map +1 -0
  82. package/dist/apps/services/api/post-submission-attachment-urls.d.ts +7 -0
  83. package/dist/apps/services/api/post-submission-attachment-urls.js +19 -0
  84. package/dist/apps/services/api/post-submission-attachment-urls.js.map +1 -0
  85. package/dist/apps/services/api/prefill.d.ts +1 -0
  86. package/dist/apps/services/api/prefill.js +70 -0
  87. package/dist/apps/services/api/prefill.js.map +1 -0
  88. package/dist/apps/services/api/receipt-id.d.ts +2 -0
  89. package/dist/apps/services/api/receipt-id.js +54 -0
  90. package/dist/apps/services/api/receipt-id.js.map +1 -0
  91. package/dist/apps/services/api/scheduling.d.ts +38 -0
  92. package/dist/apps/services/api/scheduling.js +142 -0
  93. package/dist/apps/services/api/scheduling.js.map +1 -0
  94. package/dist/apps/services/api/submissions.d.ts +18 -0
  95. package/dist/apps/services/api/submissions.js +166 -0
  96. package/dist/apps/services/api/submissions.js.map +1 -0
  97. package/dist/apps/services/cognito.d.ts +302 -0
  98. package/dist/apps/services/cognito.js +441 -0
  99. package/dist/apps/services/cognito.js.map +1 -0
  100. package/dist/apps/services/draft-data-store.d.ts +16 -0
  101. package/dist/apps/services/draft-data-store.js +115 -0
  102. package/dist/apps/services/draft-data-store.js.map +1 -0
  103. package/dist/apps/services/errors/oneBlinkAppsError.d.ts +35 -0
  104. package/dist/apps/services/errors/oneBlinkAppsError.js +32 -0
  105. package/dist/apps/services/errors/oneBlinkAppsError.js.map +1 -0
  106. package/dist/apps/services/external-id-generation.d.ts +4 -0
  107. package/dist/apps/services/external-id-generation.js +59 -0
  108. package/dist/apps/services/external-id-generation.js.map +1 -0
  109. package/dist/apps/services/fetch.d.ts +12 -0
  110. package/dist/apps/services/fetch.js +95 -0
  111. package/dist/apps/services/fetch.js.map +1 -0
  112. package/dist/apps/services/forms-key.d.ts +51 -0
  113. package/dist/apps/services/forms-key.js +83 -0
  114. package/dist/apps/services/forms-key.js.map +1 -0
  115. package/dist/apps/services/generate-generic-error.d.ts +3 -0
  116. package/dist/apps/services/generate-generic-error.js +52 -0
  117. package/dist/apps/services/generate-generic-error.js.map +1 -0
  118. package/dist/apps/services/generateOneBlinkDownloader.d.ts +2 -0
  119. package/dist/apps/services/generateOneBlinkDownloader.js +11 -0
  120. package/dist/apps/services/generateOneBlinkDownloader.js.map +1 -0
  121. package/dist/apps/services/generateOneBlinkUploader.d.ts +2 -0
  122. package/dist/apps/services/generateOneBlinkUploader.js +11 -0
  123. package/dist/apps/services/generateOneBlinkUploader.js.map +1 -0
  124. package/dist/apps/services/getDeviceInformation.d.ts +17 -0
  125. package/dist/apps/services/getDeviceInformation.js +38 -0
  126. package/dist/apps/services/getDeviceInformation.js.map +1 -0
  127. package/dist/apps/services/integration-elements.d.ts +383 -0
  128. package/dist/apps/services/integration-elements.js +761 -0
  129. package/dist/apps/services/integration-elements.js.map +1 -0
  130. package/dist/apps/services/job-prefill.d.ts +40 -0
  131. package/dist/apps/services/job-prefill.js +78 -0
  132. package/dist/apps/services/job-prefill.js.map +1 -0
  133. package/dist/apps/services/payment-providers/BPOINTPaymentProvider.d.ts +29 -0
  134. package/dist/apps/services/payment-providers/BPOINTPaymentProvider.js +59 -0
  135. package/dist/apps/services/payment-providers/BPOINTPaymentProvider.js.map +1 -0
  136. package/dist/apps/services/payment-providers/CPPayPaymentProvider.d.ts +27 -0
  137. package/dist/apps/services/payment-providers/CPPayPaymentProvider.js +63 -0
  138. package/dist/apps/services/payment-providers/CPPayPaymentProvider.js.map +1 -0
  139. package/dist/apps/services/payment-providers/NSWGovPayPaymentProvider.d.ts +30 -0
  140. package/dist/apps/services/payment-providers/NSWGovPayPaymentProvider.js +116 -0
  141. package/dist/apps/services/payment-providers/NSWGovPayPaymentProvider.js.map +1 -0
  142. package/dist/apps/services/payment-providers/WestpacQuickStreamPaymentProvider.d.ts +49 -0
  143. package/dist/apps/services/payment-providers/WestpacQuickStreamPaymentProvider.js +116 -0
  144. package/dist/apps/services/payment-providers/WestpacQuickStreamPaymentProvider.js.map +1 -0
  145. package/dist/apps/services/payment-providers/receipt-items.d.ts +8 -0
  146. package/dist/apps/services/payment-providers/receipt-items.js +58 -0
  147. package/dist/apps/services/payment-providers/receipt-items.js.map +1 -0
  148. package/dist/apps/services/pending-queue.d.ts +150 -0
  149. package/dist/apps/services/pending-queue.js +316 -0
  150. package/dist/apps/services/pending-queue.js.map +1 -0
  151. package/dist/apps/services/prepareSubmissionData.d.ts +2 -0
  152. package/dist/apps/services/prepareSubmissionData.js +113 -0
  153. package/dist/apps/services/prepareSubmissionData.js.map +1 -0
  154. package/dist/apps/services/query-string.d.ts +1 -0
  155. package/dist/apps/services/query-string.js +16 -0
  156. package/dist/apps/services/query-string.js.map +1 -0
  157. package/dist/apps/services/replaceInjectablesWithSubmissionValues.d.ts +3 -0
  158. package/dist/apps/services/replaceInjectablesWithSubmissionValues.js +18 -0
  159. package/dist/apps/services/replaceInjectablesWithSubmissionValues.js.map +1 -0
  160. package/dist/apps/services/schedulingHandlers.d.ts +36 -0
  161. package/dist/apps/services/schedulingHandlers.js +76 -0
  162. package/dist/apps/services/schedulingHandlers.js.map +1 -0
  163. package/dist/apps/services/server-validation.d.ts +2 -0
  164. package/dist/apps/services/server-validation.js +36 -0
  165. package/dist/apps/services/server-validation.js.map +1 -0
  166. package/dist/apps/services/serverRequest.d.ts +5 -0
  167. package/dist/apps/services/serverRequest.js +24 -0
  168. package/dist/apps/services/serverRequest.js.map +1 -0
  169. package/dist/apps/services/submit.d.ts +19 -0
  170. package/dist/apps/services/submit.js +219 -0
  171. package/dist/apps/services/submit.js.map +1 -0
  172. package/dist/apps/services/uploadAttachment.d.ts +52 -0
  173. package/dist/apps/services/uploadAttachment.js +73 -0
  174. package/dist/apps/services/uploadAttachment.js.map +1 -0
  175. package/dist/apps/services/user-token.d.ts +27 -0
  176. package/dist/apps/services/user-token.js +33 -0
  177. package/dist/apps/services/user-token.js.map +1 -0
  178. package/dist/apps/services/utils.d.ts +12 -0
  179. package/dist/apps/services/utils.js +100 -0
  180. package/dist/apps/services/utils.js.map +1 -0
  181. package/dist/apps/submission-service.d.ts +226 -0
  182. package/dist/apps/submission-service.js +425 -0
  183. package/dist/apps/submission-service.js.map +1 -0
  184. package/dist/apps/tenants.d.ts +29 -0
  185. package/dist/apps/tenants.js +127 -0
  186. package/dist/apps/tenants.js.map +1 -0
  187. package/dist/apps/types/form.d.ts +4 -0
  188. package/dist/apps/types/form.js +2 -0
  189. package/dist/apps/types/form.js.map +1 -0
  190. package/dist/apps/types/payments.d.ts +45 -0
  191. package/dist/apps/types/payments.js +2 -0
  192. package/dist/apps/types/payments.js.map +1 -0
  193. package/dist/apps/types/scheduling.d.ts +5 -0
  194. package/dist/apps/types/scheduling.js +2 -0
  195. package/dist/apps/types/scheduling.js.map +1 -0
  196. package/dist/apps/types/submissions.d.ts +175 -0
  197. package/dist/apps/types/submissions.js +2 -0
  198. package/dist/apps/types/submissions.js.map +1 -0
  199. package/dist/components/ArcGISWebMap.js +1 -1
  200. package/dist/components/ArcGISWebMap.js.map +1 -1
  201. package/dist/components/CustomAccordion.d.ts +3 -3
  202. package/dist/components/Lists.d.ts +4 -1
  203. package/dist/components/calendar-bookings/CalendarBookingsCancelForm.js +1 -1
  204. package/dist/components/calendar-bookings/CalendarBookingsCancelForm.js.map +1 -1
  205. package/dist/components/calendar-bookings/CalendarBookingsForm.d.ts +1 -1
  206. package/dist/components/calendar-bookings/CalendarBookingsForm.js +1 -1
  207. package/dist/components/calendar-bookings/CalendarBookingsForm.js.map +1 -1
  208. package/dist/components/calendar-bookings/CalendarBookingsReschedulingForm.js +1 -1
  209. package/dist/components/calendar-bookings/CalendarBookingsReschedulingForm.js.map +1 -1
  210. package/dist/components/calendar-bookings/ErrorModal.d.ts +1 -1
  211. package/dist/components/calendar-bookings/ErrorModal.js +1 -1
  212. package/dist/components/calendar-bookings/ErrorModal.js.map +1 -1
  213. package/dist/components/downloadable-files/index.d.ts +1 -1
  214. package/dist/components/downloadable-files/index.js +1 -1
  215. package/dist/components/downloadable-files/index.js.map +1 -1
  216. package/dist/components/downloadable-files/resource-components.d.ts +1 -1
  217. package/dist/components/downloadable-files/resource-components.js +1 -1
  218. package/dist/components/downloadable-files/resource-components.js.map +1 -1
  219. package/dist/components/formStore/FormStoreTableProvider.js +1 -1
  220. package/dist/components/formStore/FormStoreTableProvider.js.map +1 -1
  221. package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js.map +1 -1
  222. package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js +1 -1
  223. package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js.map +1 -1
  224. package/dist/components/formStore/OneBlinkFormStoreProvider.js +1 -1
  225. package/dist/components/formStore/OneBlinkFormStoreProvider.js.map +1 -1
  226. package/dist/components/formStore/OneBlinkFormStoreTable.js.map +1 -1
  227. package/dist/components/formStore/display/ElementDisplay.js +2 -2
  228. package/dist/components/formStore/display/ElementDisplay.js.map +1 -1
  229. package/dist/components/formStore/table/ColumnFilters.js +1 -1
  230. package/dist/components/formStore/table/ColumnFilters.js.map +1 -1
  231. package/dist/components/formStore/table/FormElementTableCell.js +1 -1
  232. package/dist/components/formStore/table/FormElementTableCell.js.map +1 -1
  233. package/dist/components/formStore/table/Pickers.js +1 -1
  234. package/dist/components/formStore/table/Pickers.js.map +1 -1
  235. package/dist/components/formStore/table/generateColumns.d.ts +1 -1
  236. package/dist/components/formStore/table/generateColumns.js.map +1 -1
  237. package/dist/components/formStore/table/useFormStoreTable.d.ts +1 -1
  238. package/dist/components/formStore/table/useFormStoreTable.js +1 -1
  239. package/dist/components/formStore/table/useFormStoreTable.js.map +1 -1
  240. package/dist/components/formStore/useFormStoreTableContext.d.ts +2 -2
  241. package/dist/components/mfa/MfaDialog.d.ts +1 -1
  242. package/dist/components/mfa/MfaDialog.js +1 -1
  243. package/dist/components/mfa/MfaDialog.js.map +1 -1
  244. package/dist/components/mfa/MultiFactorAuthentication.d.ts +1 -1
  245. package/dist/components/payments/PaymentForm.js +1 -1
  246. package/dist/components/payments/PaymentForm.js.map +1 -1
  247. package/dist/components/payments/WestpacQuickStreamPaymentForm.d.ts +1 -1
  248. package/dist/components/payments/WestpacQuickStreamPaymentForm.js +1 -1
  249. package/dist/components/payments/WestpacQuickStreamPaymentForm.js.map +1 -1
  250. package/dist/components/renderer/AutocompleteDropdown.js +1 -1
  251. package/dist/components/renderer/AutocompleteDropdown.js.map +1 -1
  252. package/dist/components/renderer/LookupNotification.js +2 -2
  253. package/dist/components/renderer/LookupNotification.js.map +1 -1
  254. package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.js +1 -1
  255. package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.js.map +1 -1
  256. package/dist/components/renderer/OneBlinkFormElements.js.map +1 -1
  257. package/dist/components/renderer/ReverseGeocode.js +1 -1
  258. package/dist/components/renderer/ReverseGeocode.js.map +1 -1
  259. package/dist/form-elements/FormElementAPINSWLiquorLicence.js +1 -1
  260. package/dist/form-elements/FormElementAPINSWLiquorLicence.js.map +1 -1
  261. package/dist/form-elements/FormElementArcGISWebMap.js.map +1 -1
  262. package/dist/form-elements/FormElementAutocomplete.js +1 -1
  263. package/dist/form-elements/FormElementAutocomplete.js.map +1 -1
  264. package/dist/form-elements/FormElementBSB.js +1 -1
  265. package/dist/form-elements/FormElementBSB.js.map +1 -1
  266. package/dist/form-elements/FormElementCalculation.js +2 -2
  267. package/dist/form-elements/FormElementCalculation.js.map +1 -1
  268. package/dist/form-elements/FormElementCivicaNameRecord.js +1 -1
  269. package/dist/form-elements/FormElementCivicaNameRecord.js.map +1 -1
  270. package/dist/form-elements/FormElementCivicaStreetName.js +1 -1
  271. package/dist/form-elements/FormElementCivicaStreetName.js.map +1 -1
  272. package/dist/form-elements/FormElementCompliance.d.ts +1 -1
  273. package/dist/form-elements/FormElementCompliance.js.map +1 -1
  274. package/dist/form-elements/FormElementDate.js +1 -1
  275. package/dist/form-elements/FormElementDate.js.map +1 -1
  276. package/dist/form-elements/FormElementDateTime.js +1 -1
  277. package/dist/form-elements/FormElementDateTime.js.map +1 -1
  278. package/dist/form-elements/FormElementFile.d.ts +1 -1
  279. package/dist/form-elements/FormElementFile.js.map +1 -1
  280. package/dist/form-elements/FormElementFiles.d.ts +1 -1
  281. package/dist/form-elements/FormElementFiles.js.map +1 -1
  282. package/dist/form-elements/FormElementGeoscapeAddress.js +1 -1
  283. package/dist/form-elements/FormElementGeoscapeAddress.js.map +1 -1
  284. package/dist/form-elements/FormElementGoogleAddress.js +1 -1
  285. package/dist/form-elements/FormElementGoogleAddress.js.map +1 -1
  286. package/dist/form-elements/FormElementLocation.js +1 -1
  287. package/dist/form-elements/FormElementLocation.js.map +1 -1
  288. package/dist/form-elements/FormElementNumber.js +1 -1
  289. package/dist/form-elements/FormElementNumber.js.map +1 -1
  290. package/dist/form-elements/FormElementPointAddress.js +1 -1
  291. package/dist/form-elements/FormElementPointAddress.js.map +1 -1
  292. package/dist/form-elements/FormElementPointAddressV3.js +1 -1
  293. package/dist/form-elements/FormElementPointAddressV3.js.map +1 -1
  294. package/dist/form-elements/FormElementPointCadastralParcel.js +1 -1
  295. package/dist/form-elements/FormElementPointCadastralParcel.js.map +1 -1
  296. package/dist/form-elements/FormElementSummary.js +1 -1
  297. package/dist/form-elements/FormElementSummary.js.map +1 -1
  298. package/dist/form-elements/FormElementTime.js +1 -1
  299. package/dist/form-elements/FormElementTime.js.map +1 -1
  300. package/dist/hooks/attachments/useAttachment.d.ts +1 -1
  301. package/dist/hooks/attachments/useAttachment.js +1 -1
  302. package/dist/hooks/attachments/useAttachment.js.map +1 -1
  303. package/dist/hooks/attachments/useAttachments.d.ts +1 -1
  304. package/dist/hooks/attachments/useAttachments.js.map +1 -1
  305. package/dist/hooks/useAuth.js +1 -1
  306. package/dist/hooks/useAuth.js.map +1 -1
  307. package/dist/hooks/useConditionalLogic.js +1 -1
  308. package/dist/hooks/useConditionalLogic.js.map +1 -1
  309. package/dist/hooks/useDrafts.d.ts +1 -1
  310. package/dist/hooks/useDrafts.js +1 -1
  311. package/dist/hooks/useDrafts.js.map +1 -1
  312. package/dist/hooks/useDynamicOptionsLoaderState.d.ts +1 -1
  313. package/dist/hooks/useDynamicOptionsLoaderState.js +1 -1
  314. package/dist/hooks/useDynamicOptionsLoaderState.js.map +1 -1
  315. package/dist/hooks/useFormElementLookups.d.ts +1 -1
  316. package/dist/hooks/useFormElementLookups.js +1 -1
  317. package/dist/hooks/useFormElementLookups.js.map +1 -1
  318. package/dist/hooks/useFormSubmissionAutoSaveState.d.ts +1 -1
  319. package/dist/hooks/useFormSubmissionAutoSaveState.js +1 -1
  320. package/dist/hooks/useFormSubmissionAutoSaveState.js.map +1 -1
  321. package/dist/hooks/useIsOffline.js +1 -1
  322. package/dist/hooks/useIsOffline.js.map +1 -1
  323. package/dist/hooks/useLogin.js +1 -1
  324. package/dist/hooks/useLogin.js.map +1 -1
  325. package/dist/hooks/useMfa.d.ts +1 -1
  326. package/dist/hooks/useMfa.js +1 -1
  327. package/dist/hooks/useMfa.js.map +1 -1
  328. package/dist/hooks/useOnUploadAttachment.d.ts +1 -1
  329. package/dist/hooks/useOnUploadAttachment.js +1 -1
  330. package/dist/hooks/useOnUploadAttachment.js.map +1 -1
  331. package/dist/hooks/usePendingSubmissions.d.ts +1 -1
  332. package/dist/hooks/usePendingSubmissions.js +1 -1
  333. package/dist/hooks/usePendingSubmissions.js.map +1 -1
  334. package/dist/hooks/useReplaceableText.js +1 -1
  335. package/dist/hooks/useReplaceableText.js.map +1 -1
  336. package/dist/hooks/useSignUp.js +1 -1
  337. package/dist/hooks/useSignUp.js.map +1 -1
  338. package/dist/index.d.ts +1 -0
  339. package/dist/index.js +2 -0
  340. package/dist/index.js.map +1 -1
  341. package/dist/services/attachments.d.ts +1 -1
  342. package/dist/services/attachments.js +1 -1
  343. package/dist/services/attachments.js.map +1 -1
  344. package/dist/services/blob-utils.js +1 -1
  345. package/dist/services/blob-utils.js.map +1 -1
  346. package/dist/services/checkIfAttachmentsExist.d.ts +1 -1
  347. package/dist/services/checkIfAttachmentsExist.js.map +1 -1
  348. package/dist/services/defaultCoordinates.js +1 -1
  349. package/dist/services/defaultCoordinates.js.map +1 -1
  350. package/dist/services/download-file.d.ts +1 -1
  351. package/dist/services/download-file.js +2 -2
  352. package/dist/services/download-file.js.map +1 -1
  353. package/dist/services/drawTimestampOnCanvas.js +1 -1
  354. package/dist/services/drawTimestampOnCanvas.js.map +1 -1
  355. package/dist/services/form-validation/validateSubmission.js +1 -1
  356. package/dist/services/form-validation/validateSubmission.js.map +1 -1
  357. package/dist/services/form-validation/validators.d.ts +1 -1
  358. package/dist/services/form-validation/validators.js.map +1 -1
  359. package/dist/services/generate-default-data.js +1 -1
  360. package/dist/services/generate-default-data.js.map +1 -1
  361. package/dist/services/injectableOptions.js +1 -1
  362. package/dist/services/injectableOptions.js.map +1 -1
  363. package/dist/styles.css +208 -204
  364. package/dist/types/attachments.d.ts +1 -1
  365. package/dist/types/attachments.js.map +1 -1
  366. package/dist/utils/sendGoogleAnalyticsEvent.js +1 -1
  367. package/dist/utils/sendGoogleAnalyticsEvent.js.map +1 -1
  368. package/package.json +42 -34
@@ -0,0 +1,207 @@
1
+ import { submissionService } from '@oneblink/sdk-core';
2
+ /**
3
+ * Get the locale (e.g. `en-AU`) for the current tenant.
4
+ *
5
+ * #### Example
6
+ *
7
+ * ```js
8
+ * const locale = localisationService.getLocale()
9
+ * ```
10
+ *
11
+ * @returns
12
+ */
13
+ export declare function getLocale(): "en-AU" | "en-US";
14
+ /**
15
+ * Get the distance units (e.g. `feet` & 'ft) for the current tenant.
16
+ *
17
+ * #### Example
18
+ *
19
+ * ```js
20
+ * const { distanceUnit, distanceUnitShortName } =
21
+ * localisationService.getDistanceUnits()
22
+ * ```
23
+ *
24
+ * @returns
25
+ */
26
+ export declare function getDistanceUnits(): {
27
+ distanceUnit: string;
28
+ distanceUnitShortName: string;
29
+ };
30
+ export declare function getDateFnsFormats(): {
31
+ time: string;
32
+ shortDate: string;
33
+ shortYearlessDate: string;
34
+ longDate: string;
35
+ longYearlessDate: string;
36
+ shortDateTime: string;
37
+ longDateTime: string;
38
+ };
39
+ /**
40
+ * Format a `Date` as a `string` that just contains the date portion e.g.
41
+ * _31/01/2020_
42
+ *
43
+ * #### Example
44
+ *
45
+ * ```js
46
+ * const date = new Date()
47
+ * const text = localisationService.formatDate(date)
48
+ * // Display text
49
+ * ```
50
+ *
51
+ * @param value
52
+ * @returns
53
+ */
54
+ export declare function formatDate(value: Date): string;
55
+ /**
56
+ * Format a `Date` as a `string` that just contains the date portion in a long
57
+ * format e.g. _Thursday, 2 January 2020_
58
+ *
59
+ * #### Example
60
+ *
61
+ * ```js
62
+ * const date = new Date()
63
+ * const text = localisationService.formatDateLong(date)
64
+ * // Display text
65
+ * ```
66
+ *
67
+ * @param value
68
+ * @returns
69
+ */
70
+ export declare function formatDateLong(value: Date): string;
71
+ /**
72
+ * Format a `Date` as a `string` that just contains the time portion e.g. _5:31
73
+ * pm_
74
+ *
75
+ * #### Example
76
+ *
77
+ * ```js
78
+ * const date = new Date()
79
+ * const text = localisationService.formatTime(date)
80
+ * // Display text
81
+ * ```
82
+ *
83
+ * @param value
84
+ * @returns
85
+ */
86
+ export declare function formatTime(value: Date): string;
87
+ /**
88
+ * Format a `Date` as a `string` that contains the date and time portions e.g.
89
+ * _31/01/2020 5:31 pm_
90
+ *
91
+ * #### Example
92
+ *
93
+ * ```js
94
+ * const date = new Date()
95
+ * const text = localisationService.formatDatetime(date)
96
+ * // Display text
97
+ * ```
98
+ *
99
+ * @param value
100
+ * @returns
101
+ */
102
+ export declare function formatDatetime(value: Date): string;
103
+ /**
104
+ * Format a `Date` as a `string` that contains the date and time portions in a
105
+ * long format e.g. _Thursday, 2 January 2020 5:31 pm_
106
+ *
107
+ * #### Example
108
+ *
109
+ * ```js
110
+ * const date = new Date()
111
+ * const text = localisationService.formatDatetime(date)
112
+ * // Display text
113
+ * ```
114
+ *
115
+ * @param value
116
+ * @returns
117
+ */
118
+ export declare function formatDatetimeLong(value: Date): string;
119
+ /**
120
+ * Format a `number` as a `string` represented as a readable number e.g.
121
+ * _123,321.123_
122
+ *
123
+ * #### Example
124
+ *
125
+ * ```js
126
+ * const amount = 1234.4321
127
+ * const text = localisationService.formatCurrency(amount)
128
+ * // Display text
129
+ * ```
130
+ *
131
+ * @param value
132
+ * @returns
133
+ */
134
+ export declare function formatNumber(value: number): string;
135
+ /**
136
+ * Format a `number` as a `string` represented as a currency e.g. _$123.31_
137
+ *
138
+ * #### Example
139
+ *
140
+ * ```js
141
+ * const amount = 123.321
142
+ * const text = localisationService.formatCurrency(amount)
143
+ * // Display text
144
+ * ```
145
+ *
146
+ * @param value
147
+ * @returns
148
+ */
149
+ export declare function formatCurrency(value: number): string;
150
+ /**
151
+ * Generate a `Date` based a `string` while adding/subtracting a number of days.
152
+ * Use this function to generate a date with the correct time if only the date
153
+ * part is required to be formatted for display purposes. Also supports passing
154
+ * `'NOW'` as the value to get the current date with an offset.
155
+ *
156
+ * #### Example
157
+ *
158
+ * ```js
159
+ * const dateOnly = localisationService.generateDate({
160
+ * value: '2023-05-04',
161
+ * dateOnly: true,
162
+ * daysOffset: undefined,
163
+ * })
164
+ *
165
+ * const date = localisationService.generateDate({
166
+ * value: '2023-05-04T02:49:23.616Z',
167
+ * dateOnly: false,
168
+ * daysOffset: undefined,
169
+ * })
170
+ *
171
+ * const now = localisationService.generateDate({
172
+ * value: 'NOW',
173
+ * dateOnly: false,
174
+ * daysOffset: undefined,
175
+ * })
176
+ * ```
177
+ *
178
+ * @param options
179
+ * @returns
180
+ */
181
+ export declare function generateDate({ daysOffset, value, }: {
182
+ daysOffset: number | undefined;
183
+ value: string;
184
+ }): Date | undefined;
185
+ export declare const replaceSubmissionFormatters: submissionService.ReplaceInjectablesFormatters;
186
+ /**
187
+ * Replace the `{ELEMENT:<elementName>}` values in text after a successful form
188
+ * submission as well as other replaceable parameters e.g. `submissionId`. The
189
+ * replacements are suppose to be user friendly and for display purposes, e.g.
190
+ * dates should be displayed in the user's desired format and timezone.
191
+ *
192
+ * @param text
193
+ * @param options
194
+ * @returns
195
+ */
196
+ export declare function replaceInjectablesWithSubmissionValues(text: string, options: Omit<Parameters<typeof submissionService.replaceInjectablesWithSubmissionValues>[1], keyof submissionService.ReplaceInjectablesFormatters>): ReturnType<typeof submissionService.replaceInjectablesWithSubmissionValues>;
197
+ /**
198
+ * Replace the `{ELEMENT:<elementName>}` values in text while a form is being
199
+ * filled out. The replacements are suppose to be user friendly and for display
200
+ * purposes, e.g. dates should be displayed in the user's desired format and
201
+ * timezone.
202
+ *
203
+ * @param text
204
+ * @param options
205
+ * @returns
206
+ */
207
+ export declare function replaceInjectablesWithElementValues(text: string, options: Omit<Parameters<typeof submissionService.replaceInjectablesWithElementValues>[1], keyof submissionService.ReplaceInjectablesFormatters>): ReturnType<typeof submissionService.replaceInjectablesWithElementValues>;
@@ -0,0 +1,321 @@
1
+ import { submissionService } from '@oneblink/sdk-core';
2
+ import tenants from './tenants';
3
+ import parser from 'ua-parser-js';
4
+ import { add, parse } from 'date-fns';
5
+ let iosVersion;
6
+ const parsedUserAgent = parser(window.navigator.userAgent);
7
+ if (parsedUserAgent.os.name === 'iOS' &&
8
+ typeof parsedUserAgent.os.version === 'string') {
9
+ iosVersion = parseFloat(parsedUserAgent.os.version);
10
+ if (Number.isNaN(iosVersion)) {
11
+ iosVersion = undefined;
12
+ }
13
+ }
14
+ /**
15
+ * Get the locale (e.g. `en-AU`) for the current tenant.
16
+ *
17
+ * #### Example
18
+ *
19
+ * ```js
20
+ * const locale = localisationService.getLocale()
21
+ * ```
22
+ *
23
+ * @returns
24
+ */
25
+ export function getLocale() {
26
+ return tenants.locale;
27
+ }
28
+ /**
29
+ * Get the distance units (e.g. `feet` & 'ft) for the current tenant.
30
+ *
31
+ * #### Example
32
+ *
33
+ * ```js
34
+ * const { distanceUnit, distanceUnitShortName } =
35
+ * localisationService.getDistanceUnits()
36
+ * ```
37
+ *
38
+ * @returns
39
+ */
40
+ export function getDistanceUnits() {
41
+ return {
42
+ distanceUnit: tenants.current.distanceUnit,
43
+ distanceUnitShortName: tenants.current.distanceUnitShortName,
44
+ };
45
+ }
46
+ function generateFormats({ time, shortDate, shortYearlessDate, longDate, longYearlessDate, }) {
47
+ return {
48
+ time,
49
+ shortDate,
50
+ shortYearlessDate,
51
+ longDate,
52
+ longYearlessDate,
53
+ shortDateTime: `${shortDate} ${time}`,
54
+ longDateTime: `${longDate} ${time}`,
55
+ };
56
+ }
57
+ export function getDateFnsFormats() {
58
+ const time = 'h:mm a';
59
+ switch (tenants.locale) {
60
+ case 'en-US': {
61
+ return generateFormats({
62
+ time,
63
+ shortDate: 'MM/dd/yyyy',
64
+ shortYearlessDate: 'MM/dd',
65
+ longDate: 'MMM do, yyyy',
66
+ longYearlessDate: 'MMM do',
67
+ });
68
+ }
69
+ case 'en-AU':
70
+ default: {
71
+ return generateFormats({
72
+ time,
73
+ shortDate: 'dd/MM/yyyy',
74
+ shortYearlessDate: 'dd/MM',
75
+ longDate: 'do MMM, yyyy',
76
+ longYearlessDate: 'do MMM',
77
+ });
78
+ }
79
+ }
80
+ }
81
+ /**
82
+ * Format a `Date` as a `string` that just contains the date portion e.g.
83
+ * _31/01/2020_
84
+ *
85
+ * #### Example
86
+ *
87
+ * ```js
88
+ * const date = new Date()
89
+ * const text = localisationService.formatDate(date)
90
+ * // Display text
91
+ * ```
92
+ *
93
+ * @param value
94
+ * @returns
95
+ */
96
+ export function formatDate(value) {
97
+ return tenants.current.intlFormats.date.format(value);
98
+ }
99
+ /**
100
+ * Format a `Date` as a `string` that just contains the date portion in a long
101
+ * format e.g. _Thursday, 2 January 2020_
102
+ *
103
+ * #### Example
104
+ *
105
+ * ```js
106
+ * const date = new Date()
107
+ * const text = localisationService.formatDateLong(date)
108
+ * // Display text
109
+ * ```
110
+ *
111
+ * @param value
112
+ * @returns
113
+ */
114
+ export function formatDateLong(value) {
115
+ return tenants.current.intlFormats.dateLong.format(value);
116
+ }
117
+ /**
118
+ * Format a `Date` as a `string` that just contains the time portion e.g. _5:31
119
+ * pm_
120
+ *
121
+ * #### Example
122
+ *
123
+ * ```js
124
+ * const date = new Date()
125
+ * const text = localisationService.formatTime(date)
126
+ * // Display text
127
+ * ```
128
+ *
129
+ * @param value
130
+ * @returns
131
+ */
132
+ export function formatTime(value) {
133
+ /*
134
+ * Time formatting for older iOS devices. Prevents date from repeating.
135
+ * Example: Last sync time: 24/11/2022 24/11/2022
136
+ */
137
+ if (typeof iosVersion === 'number' && iosVersion < 13.0) {
138
+ const time = tenants.current.intlFormats.olderIOSTime.formatToParts(value);
139
+ const newTime = time.map((t) => t.value).join('');
140
+ return `${newTime}`;
141
+ }
142
+ return tenants.current.intlFormats.time.format(value);
143
+ }
144
+ /**
145
+ * Format a `Date` as a `string` that contains the date and time portions e.g.
146
+ * _31/01/2020 5:31 pm_
147
+ *
148
+ * #### Example
149
+ *
150
+ * ```js
151
+ * const date = new Date()
152
+ * const text = localisationService.formatDatetime(date)
153
+ * // Display text
154
+ * ```
155
+ *
156
+ * @param value
157
+ * @returns
158
+ */
159
+ export function formatDatetime(value) {
160
+ return `${formatDate(value)} ${formatTime(value)}`;
161
+ }
162
+ /**
163
+ * Format a `Date` as a `string` that contains the date and time portions in a
164
+ * long format e.g. _Thursday, 2 January 2020 5:31 pm_
165
+ *
166
+ * #### Example
167
+ *
168
+ * ```js
169
+ * const date = new Date()
170
+ * const text = localisationService.formatDatetime(date)
171
+ * // Display text
172
+ * ```
173
+ *
174
+ * @param value
175
+ * @returns
176
+ */
177
+ export function formatDatetimeLong(value) {
178
+ return `${formatDateLong(value)} ${formatTime(value)}`;
179
+ }
180
+ /**
181
+ * Format a `number` as a `string` represented as a readable number e.g.
182
+ * _123,321.123_
183
+ *
184
+ * #### Example
185
+ *
186
+ * ```js
187
+ * const amount = 1234.4321
188
+ * const text = localisationService.formatCurrency(amount)
189
+ * // Display text
190
+ * ```
191
+ *
192
+ * @param value
193
+ * @returns
194
+ */
195
+ export function formatNumber(value) {
196
+ return tenants.current.intlFormats.number.format(value);
197
+ }
198
+ /**
199
+ * Format a `number` as a `string` represented as a currency e.g. _$123.31_
200
+ *
201
+ * #### Example
202
+ *
203
+ * ```js
204
+ * const amount = 123.321
205
+ * const text = localisationService.formatCurrency(amount)
206
+ * // Display text
207
+ * ```
208
+ *
209
+ * @param value
210
+ * @returns
211
+ */
212
+ export function formatCurrency(value) {
213
+ return tenants.current.intlFormats.currency.format(value);
214
+ }
215
+ /**
216
+ * Generate a `Date` based a `string` while adding/subtracting a number of days.
217
+ * Use this function to generate a date with the correct time if only the date
218
+ * part is required to be formatted for display purposes. Also supports passing
219
+ * `'NOW'` as the value to get the current date with an offset.
220
+ *
221
+ * #### Example
222
+ *
223
+ * ```js
224
+ * const dateOnly = localisationService.generateDate({
225
+ * value: '2023-05-04',
226
+ * dateOnly: true,
227
+ * daysOffset: undefined,
228
+ * })
229
+ *
230
+ * const date = localisationService.generateDate({
231
+ * value: '2023-05-04T02:49:23.616Z',
232
+ * dateOnly: false,
233
+ * daysOffset: undefined,
234
+ * })
235
+ *
236
+ * const now = localisationService.generateDate({
237
+ * value: 'NOW',
238
+ * dateOnly: false,
239
+ * daysOffset: undefined,
240
+ * })
241
+ * ```
242
+ *
243
+ * @param options
244
+ * @returns
245
+ */
246
+ export function generateDate({ daysOffset, value, }) {
247
+ if (value === 'NOW') {
248
+ const date = new Date();
249
+ if (daysOffset !== undefined) {
250
+ date.setDate(date.getDate() + daysOffset);
251
+ }
252
+ return date;
253
+ }
254
+ else {
255
+ let date = parse(value, 'yyyy-MM-dd', new Date());
256
+ if (Number.isNaN(date.getTime())) {
257
+ date = parse(value, "yyyy-MM-dd'T'HH:mm:ss.SSSX", new Date());
258
+ if (!Number.isNaN(date.getTime())) {
259
+ return generateDateOffset({ date, daysOffset });
260
+ }
261
+ }
262
+ else {
263
+ return generateDateOffset({ date, daysOffset });
264
+ }
265
+ }
266
+ }
267
+ function generateDateOffset({ date, daysOffset, }) {
268
+ if (daysOffset !== undefined) {
269
+ return add(date, { days: daysOffset });
270
+ }
271
+ return date;
272
+ }
273
+ export const replaceSubmissionFormatters = {
274
+ formatDate: (v) => {
275
+ const date = generateDate({
276
+ value: v,
277
+ daysOffset: undefined,
278
+ });
279
+ if (date) {
280
+ return formatDate(date);
281
+ }
282
+ return '';
283
+ },
284
+ formatDateTime: (value) => formatDatetime(new Date(value)),
285
+ formatTime: (value) => formatTime(new Date(value)),
286
+ formatCurrency: (value) => formatCurrency(value),
287
+ formatNumber: (value) => value.toString(),
288
+ };
289
+ /**
290
+ * Replace the `{ELEMENT:<elementName>}` values in text after a successful form
291
+ * submission as well as other replaceable parameters e.g. `submissionId`. The
292
+ * replacements are suppose to be user friendly and for display purposes, e.g.
293
+ * dates should be displayed in the user's desired format and timezone.
294
+ *
295
+ * @param text
296
+ * @param options
297
+ * @returns
298
+ */
299
+ export function replaceInjectablesWithSubmissionValues(text, options) {
300
+ return submissionService.replaceInjectablesWithSubmissionValues(text, {
301
+ ...options,
302
+ ...replaceSubmissionFormatters,
303
+ });
304
+ }
305
+ /**
306
+ * Replace the `{ELEMENT:<elementName>}` values in text while a form is being
307
+ * filled out. The replacements are suppose to be user friendly and for display
308
+ * purposes, e.g. dates should be displayed in the user's desired format and
309
+ * timezone.
310
+ *
311
+ * @param text
312
+ * @param options
313
+ * @returns
314
+ */
315
+ export function replaceInjectablesWithElementValues(text, options) {
316
+ return submissionService.replaceInjectablesWithElementValues(text, {
317
+ ...options,
318
+ ...replaceSubmissionFormatters,
319
+ });
320
+ }
321
+ //# sourceMappingURL=localisation-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localisation-service.js","sourceRoot":"","sources":["../../src/apps/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AAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC;IAChD,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE;CAC1C,CAAA;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,sCAAsC,CACpD,IAAY,EACZ,OAKC;IAED,OAAO,iBAAiB,CAAC,sCAAsC,CAAC,IAAI,EAAE;QACpE,GAAG,OAAO;QACV,GAAG,2BAA2B;KAC/B,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,mCAAmC,CACjD,IAAY,EACZ,OAGC;IAED,OAAO,iBAAiB,CAAC,mCAAmC,CAAC,IAAI,EAAE;QACjE,GAAG,OAAO;QACV,GAAG,2BAA2B;KAC/B,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { submissionService } from '@oneblink/sdk-core'\nimport tenants from './tenants'\nimport parser from 'ua-parser-js'\nimport { add, parse } from 'date-fns'\n\nlet iosVersion: number | undefined\nconst parsedUserAgent: parser.IResult = parser(window.navigator.userAgent)\nif (\n parsedUserAgent.os.name === 'iOS' &&\n typeof parsedUserAgent.os.version === 'string'\n) {\n iosVersion = parseFloat(parsedUserAgent.os.version)\n if (Number.isNaN(iosVersion)) {\n iosVersion = undefined\n }\n}\n\n/**\n * Get the locale (e.g. `en-AU`) for the current tenant.\n *\n * #### Example\n *\n * ```js\n * const locale = localisationService.getLocale()\n * ```\n *\n * @returns\n */\nexport function getLocale() {\n return tenants.locale\n}\n\n/**\n * Get the distance units (e.g. `feet` & 'ft) for the current tenant.\n *\n * #### Example\n *\n * ```js\n * const { distanceUnit, distanceUnitShortName } =\n * localisationService.getDistanceUnits()\n * ```\n *\n * @returns\n */\nexport function getDistanceUnits() {\n return {\n distanceUnit: tenants.current.distanceUnit,\n distanceUnitShortName: tenants.current.distanceUnitShortName,\n }\n}\n\nfunction generateFormats({\n time,\n shortDate,\n shortYearlessDate,\n longDate,\n longYearlessDate,\n}: {\n time: string\n shortDate: string\n shortYearlessDate: string\n longDate: string\n longYearlessDate: string\n}) {\n return {\n time,\n shortDate,\n shortYearlessDate,\n longDate,\n longYearlessDate,\n shortDateTime: `${shortDate} ${time}`,\n longDateTime: `${longDate} ${time}`,\n }\n}\n\nexport function getDateFnsFormats() {\n const time = 'h:mm a'\n switch (tenants.locale) {\n case 'en-US': {\n return generateFormats({\n time,\n shortDate: 'MM/dd/yyyy',\n shortYearlessDate: 'MM/dd',\n longDate: 'MMM do, yyyy',\n longYearlessDate: 'MMM do',\n })\n }\n case 'en-AU':\n default: {\n return generateFormats({\n time,\n shortDate: 'dd/MM/yyyy',\n shortYearlessDate: 'dd/MM',\n longDate: 'do MMM, yyyy',\n longYearlessDate: 'do MMM',\n })\n }\n }\n}\n\n/**\n * Format a `Date` as a `string` that just contains the date portion e.g.\n * _31/01/2020_\n *\n * #### Example\n *\n * ```js\n * const date = new Date()\n * const text = localisationService.formatDate(date)\n * // Display text\n * ```\n *\n * @param value\n * @returns\n */\nexport function formatDate(value: Date): string {\n return tenants.current.intlFormats.date.format(value)\n}\n\n/**\n * Format a `Date` as a `string` that just contains the date portion in a long\n * format e.g. _Thursday, 2 January 2020_\n *\n * #### Example\n *\n * ```js\n * const date = new Date()\n * const text = localisationService.formatDateLong(date)\n * // Display text\n * ```\n *\n * @param value\n * @returns\n */\nexport function formatDateLong(value: Date): string {\n return tenants.current.intlFormats.dateLong.format(value)\n}\n\n/**\n * Format a `Date` as a `string` that just contains the time portion e.g. _5:31\n * pm_\n *\n * #### Example\n *\n * ```js\n * const date = new Date()\n * const text = localisationService.formatTime(date)\n * // Display text\n * ```\n *\n * @param value\n * @returns\n */\nexport function formatTime(value: Date): string {\n /*\n * Time formatting for older iOS devices. Prevents date from repeating.\n * Example: Last sync time: 24/11/2022 24/11/2022\n */\n if (typeof iosVersion === 'number' && iosVersion < 13.0) {\n const time = tenants.current.intlFormats.olderIOSTime.formatToParts(value)\n const newTime = time.map((t) => t.value).join('')\n return `${newTime}`\n }\n return tenants.current.intlFormats.time.format(value)\n}\n\n/**\n * Format a `Date` as a `string` that contains the date and time portions e.g.\n * _31/01/2020 5:31 pm_\n *\n * #### Example\n *\n * ```js\n * const date = new Date()\n * const text = localisationService.formatDatetime(date)\n * // Display text\n * ```\n *\n * @param value\n * @returns\n */\nexport function formatDatetime(value: Date) {\n return `${formatDate(value)} ${formatTime(value)}`\n}\n\n/**\n * Format a `Date` as a `string` that contains the date and time portions in a\n * long format e.g. _Thursday, 2 January 2020 5:31 pm_\n *\n * #### Example\n *\n * ```js\n * const date = new Date()\n * const text = localisationService.formatDatetime(date)\n * // Display text\n * ```\n *\n * @param value\n * @returns\n */\nexport function formatDatetimeLong(value: Date) {\n return `${formatDateLong(value)} ${formatTime(value)}`\n}\n\n/**\n * Format a `number` as a `string` represented as a readable number e.g.\n * _123,321.123_\n *\n * #### Example\n *\n * ```js\n * const amount = 1234.4321\n * const text = localisationService.formatCurrency(amount)\n * // Display text\n * ```\n *\n * @param value\n * @returns\n */\nexport function formatNumber(value: number): string {\n return tenants.current.intlFormats.number.format(value)\n}\n\n/**\n * Format a `number` as a `string` represented as a currency e.g. _$123.31_\n *\n * #### Example\n *\n * ```js\n * const amount = 123.321\n * const text = localisationService.formatCurrency(amount)\n * // Display text\n * ```\n *\n * @param value\n * @returns\n */\nexport function formatCurrency(value: number): string {\n return tenants.current.intlFormats.currency.format(value)\n}\n\n/**\n * Generate a `Date` based a `string` while adding/subtracting a number of days.\n * Use this function to generate a date with the correct time if only the date\n * part is required to be formatted for display purposes. Also supports passing\n * `'NOW'` as the value to get the current date with an offset.\n *\n * #### Example\n *\n * ```js\n * const dateOnly = localisationService.generateDate({\n * value: '2023-05-04',\n * dateOnly: true,\n * daysOffset: undefined,\n * })\n *\n * const date = localisationService.generateDate({\n * value: '2023-05-04T02:49:23.616Z',\n * dateOnly: false,\n * daysOffset: undefined,\n * })\n *\n * const now = localisationService.generateDate({\n * value: 'NOW',\n * dateOnly: false,\n * daysOffset: undefined,\n * })\n * ```\n *\n * @param options\n * @returns\n */\nexport function generateDate({\n daysOffset,\n value,\n}: {\n daysOffset: number | undefined\n value: string\n}): Date | undefined {\n if (value === 'NOW') {\n const date = new Date()\n if (daysOffset !== undefined) {\n date.setDate(date.getDate() + daysOffset)\n }\n return date\n } else {\n let date = parse(value, 'yyyy-MM-dd', new Date())\n if (Number.isNaN(date.getTime())) {\n date = parse(value, \"yyyy-MM-dd'T'HH:mm:ss.SSSX\", new Date())\n if (!Number.isNaN(date.getTime())) {\n return generateDateOffset({ date, daysOffset })\n }\n } else {\n return generateDateOffset({ date, daysOffset })\n }\n }\n}\n\nfunction generateDateOffset({\n date,\n daysOffset,\n}: {\n daysOffset: number | undefined\n date: Date\n}) {\n if (daysOffset !== undefined) {\n return add(date, { days: daysOffset })\n }\n return date\n}\n\nexport const replaceSubmissionFormatters: submissionService.ReplaceInjectablesFormatters =\n {\n formatDate: (v) => {\n const date = generateDate({\n value: v,\n daysOffset: undefined,\n })\n if (date) {\n return formatDate(date)\n }\n return ''\n },\n formatDateTime: (value) => formatDatetime(new Date(value)),\n formatTime: (value) => formatTime(new Date(value)),\n formatCurrency: (value) => formatCurrency(value),\n formatNumber: (value) => value.toString(),\n }\n\n/**\n * Replace the `{ELEMENT:<elementName>}` values in text after a successful form\n * submission as well as other replaceable parameters e.g. `submissionId`. The\n * replacements are suppose to be user friendly and for display purposes, e.g.\n * dates should be displayed in the user's desired format and timezone.\n *\n * @param text\n * @param options\n * @returns\n */\nexport function replaceInjectablesWithSubmissionValues(\n text: string,\n options: Omit<\n Parameters<\n typeof submissionService.replaceInjectablesWithSubmissionValues\n >[1],\n keyof submissionService.ReplaceInjectablesFormatters\n >,\n): ReturnType<typeof submissionService.replaceInjectablesWithSubmissionValues> {\n return submissionService.replaceInjectablesWithSubmissionValues(text, {\n ...options,\n ...replaceSubmissionFormatters,\n })\n}\n\n/**\n * Replace the `{ELEMENT:<elementName>}` values in text while a form is being\n * filled out. The replacements are suppose to be user friendly and for display\n * purposes, e.g. dates should be displayed in the user's desired format and\n * timezone.\n *\n * @param text\n * @param options\n * @returns\n */\nexport function replaceInjectablesWithElementValues(\n text: string,\n options: Omit<\n Parameters<typeof submissionService.replaceInjectablesWithElementValues>[1],\n keyof submissionService.ReplaceInjectablesFormatters\n >,\n): ReturnType<typeof submissionService.replaceInjectablesWithElementValues> {\n return submissionService.replaceInjectablesWithElementValues(text, {\n ...options,\n ...replaceSubmissionFormatters,\n })\n}\n"]}
@@ -0,0 +1,83 @@
1
+ import { FormsAppsTypes } from '@oneblink/types';
2
+ /**
3
+ * Check if the user is currently subscribed to notifications
4
+ *
5
+ * #### Example
6
+ *
7
+ * ```js
8
+ * const isSubscribed = await notificationService.isSubscribed()
9
+ * // Allow user to subscribe or unsubscribe
10
+ * ```
11
+ *
12
+ * @returns
13
+ */
14
+ declare function isSubscribed(): Promise<boolean>;
15
+ /**
16
+ * Subscribe the current user to notifications
17
+ *
18
+ * #### Example
19
+ *
20
+ * ```js
21
+ * const formsAppId = 1
22
+ * const isSubscribed = await notificationService.subscribe(formsAppId)
23
+ * // isSubscribed will be false if user denied permission to push notifications
24
+ * ```
25
+ *
26
+ * @param formsAppId
27
+ * @returns
28
+ */
29
+ declare function subscribe(formsAppId: number): Promise<boolean>;
30
+ /**
31
+ * Subscribe the current user to notifications
32
+ *
33
+ * #### Example
34
+ *
35
+ * ```js
36
+ * const formsAppId = 1
37
+ * await notificationService.unsubscribe(formsAppId)
38
+ * // isSubscribed will be false if user denied permission to push notifications
39
+ * ```
40
+ *
41
+ * @param formsAppId
42
+ * @returns
43
+ */
44
+ declare function unsubscribe(formsAppId: number): Promise<void>;
45
+ /**
46
+ * Get the current users email subscriptions for a single forms app.
47
+ *
48
+ * #### Example
49
+ *
50
+ * ```js
51
+ * const formsAppId = 1
52
+ * const emailSubscriptions =
53
+ * await approvalsService.getEmailSubscriptions(formsAppId)
54
+ * ```
55
+ *
56
+ * @param formsAppId
57
+ * @param abortSignal
58
+ * @returns
59
+ */
60
+ export declare function getEmailSubscriptions(formsAppId: number, abortSignal?: AbortSignal): Promise<FormsAppsTypes.FormsAppUserSubscription['emailSubscriptions']>;
61
+ /**
62
+ * Update the current users email subscriptions for a single forms app.
63
+ *
64
+ * #### Example
65
+ *
66
+ * ```js
67
+ * const emailSubscriptions = {
68
+ * newApproval: true,
69
+ * clarificationReceived: true,
70
+ * }
71
+ * const savedFormsAppUserSubscription =
72
+ * await approvalsService.updateFormsAppUserSubscription(
73
+ * emailSubscriptions,
74
+ * )
75
+ * ```
76
+ *
77
+ * @param formsAppId
78
+ * @param emailSubscriptions
79
+ * @param abortSignal
80
+ * @returns
81
+ */
82
+ export declare function updateEmailSubscriptions(formsAppId: number, emailSubscriptions: FormsAppsTypes.FormsAppUserSubscription['emailSubscriptions'], abortSignal?: AbortSignal): Promise<void>;
83
+ export { isSubscribed, subscribe, unsubscribe };