@oneblink/apps-react 8.7.0-beta.9 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OneBlinkFormBase.js +8 -12
- package/dist/OneBlinkFormBase.js.map +1 -1
- package/dist/components/ArcGISWebMap.js +23 -10
- package/dist/components/ArcGISWebMap.js.map +1 -1
- package/dist/hooks/attachments/useAttachments.js +2 -2
- package/dist/hooks/attachments/useAttachments.js.map +1 -1
- package/dist/services/attachments.d.ts +1 -1
- package/dist/services/attachments.js +2 -1
- package/dist/services/attachments.js.map +1 -1
- package/dist/services/form-validation/validators.js +39 -9
- package/dist/services/form-validation/validators.js.map +1 -1
- package/dist/styles/renderer.scss +0 -4
- package/dist/styles.css +0 -4
- package/package.json +2 -2
- package/dist/components/OneBlinkFormFooter.d.ts +0 -6
- package/dist/components/OneBlinkFormFooter.js +0 -10
- package/dist/components/OneBlinkFormFooter.js.map +0 -1
package/dist/OneBlinkFormBase.js
CHANGED
@@ -40,11 +40,9 @@ import MaterialIcon from './components/MaterialIcon';
|
|
40
40
|
import ValidationErrorsCard from './components/ValidationErrorsCard';
|
41
41
|
import { sendGoogleAnalyticsEvent } from './utils/sendGoogleAnalyticsEvent';
|
42
42
|
import { useUserProfileForInjectablesOutsideContext } from './hooks/useUserProfileForInjectables';
|
43
|
-
import OneBlinkFormFooter from './components/OneBlinkFormFooter';
|
44
43
|
import { ValidationIconConfigurationContext } from './hooks/useValidationIconConfiguration';
|
45
|
-
import { FormSubmissionModelContextProvider } from './hooks/useFormSubmissionModelContext';
|
46
44
|
function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captchaSiteKey, definition, disabled, isPreview, submission, isReadOnly, onCancel, onSubmit, onSaveDraft, setFormSubmission, buttons, validationIcon, primaryColour, attachmentRetentionInDays, isPendingQueueEnabled, handleNavigateAway, isInfoPage: isInfoPageProp, lastElementUpdated, executedLookups, task, taskGroup, taskGroupInstance, onUploadAttachment, captchaType, shouldUseNavigableValidationErrorsNotification = true, navigableValidationErrorsNotificationSettings, replaceInjectablesOverrides, sectionState, }) {
|
47
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
48
46
|
const isOffline = useIsOffline();
|
49
47
|
const { isUsingFormsKey } = useAuth();
|
50
48
|
const userProfileForInjectables = useUserProfileForInjectablesOutsideContext(replaceInjectablesOverrides === null || replaceInjectablesOverrides === void 0 ? void 0 : replaceInjectablesOverrides.getUserProfile);
|
@@ -787,19 +785,17 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
787
785
|
!submissionConditionallyEnabled },
|
788
786
|
React.createElement(CustomisableButtonInner, { label: isInfoPage
|
789
787
|
? 'Done'
|
790
|
-
: ((_e = buttons === null || buttons === void 0 ? void 0 : buttons.submit) === null || _e === void 0 ? void 0 : _e.label) || 'Submit', icon: (_f = buttons === null || buttons === void 0 ? void 0 : buttons.submit) === null || _f === void 0 ? void 0 : _f.icon }))))))),
|
791
|
-
!!((_g = definition.footer) === null || _g === void 0 ? void 0 : _g.html) && (React.createElement(FormSubmissionModelContextProvider, { elements: definition.elements, model: submission, formElementsConditionallyShown: formElementsConditionallyShown },
|
792
|
-
React.createElement(OneBlinkFormFooter, { footer: (_h = definition.footer) === null || _h === void 0 ? void 0 : _h.html })))),
|
788
|
+
: ((_e = buttons === null || buttons === void 0 ? void 0 : buttons.submit) === null || _e === void 0 ? void 0 : _e.label) || 'Submit', icon: (_f = buttons === null || buttons === void 0 ? void 0 : buttons.submit) === null || _f === void 0 ? void 0 : _f.icon })))))))),
|
793
789
|
!isReadOnly && !isPreview && (React.createElement(React.Fragment, null,
|
794
790
|
React.createElement(Prompt, { when: isDirty && !isNavigationAllowed, message: handleBlockedNavigation }),
|
795
791
|
React.createElement(Modal, { isOpen: hasConfirmedNavigation === false, title: "Unsaved Changes", cardClassName: "cypress-cancel-confirm", titleClassName: "cypress-cancel-confirm-title", bodyClassName: "cypress-cancel-confirm-body", actions: React.createElement(React.Fragment, null,
|
796
792
|
onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button is-success cypress-cancel-confirm-save-draft", onClick: () => handleSaveDraft(false) },
|
797
|
-
React.createElement(CustomisableButtonInner, { label: ((
|
793
|
+
React.createElement(CustomisableButtonInner, { label: ((_g = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _g === void 0 ? void 0 : _g.label) || 'Save Draft', icon: (_h = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _h === void 0 ? void 0 : _h.icon }))),
|
798
794
|
React.createElement("span", { style: { flex: 1 } }),
|
799
795
|
React.createElement("button", { type: "button", className: "button ob-button is-light cypress-cancel-confirm-back", onClick: handleKeepGoing },
|
800
|
-
React.createElement(CustomisableButtonInner, { label: ((
|
796
|
+
React.createElement(CustomisableButtonInner, { label: ((_j = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptNo) === null || _j === void 0 ? void 0 : _j.label) || 'Back', icon: (_k = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptNo) === null || _k === void 0 ? void 0 : _k.icon })),
|
801
797
|
React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-cancel-confirm-discard", onClick: handleDiscardUnsavedChanges, autoFocus: true },
|
802
|
-
React.createElement(CustomisableButtonInner, { label: ((
|
798
|
+
React.createElement(CustomisableButtonInner, { label: ((_l = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptYes) === null || _l === void 0 ? void 0 : _l.label) || 'Discard', icon: (_m = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptYes) === null || _m === void 0 ? void 0 : _m.icon }))) },
|
803
799
|
React.createElement("p", null, "You have unsaved changes, are you sure you want discard them?")),
|
804
800
|
React.createElement(Modal, { isOpen: promptUploadingAttachments === true, title: "Attachment upload in progress", cardClassName: "cypress-attachments-wait-continue", titleClassName: "cypress-attachments-confirm-wait-title", bodyClassName: "cypress-attachments-confirm-wait-body", actions: React.createElement(React.Fragment, null,
|
805
801
|
React.createElement("span", { style: { flex: 1 } }),
|
@@ -808,7 +804,7 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
808
804
|
React.createElement("p", null, "Your attachments are still uploading, do you want to wait for the uploads to complete or continue using the app? If you click continue the attachments will upload in the background. Do not close the app until the upload has been completed.")),
|
809
805
|
React.createElement(Modal, { isOpen: promptOfflineSubmissionAttempt, title: "It looks like you're Offline", className: "ob-modal__offline-submission-attempt", cardClassName: "cypress-submission-offline has-text-centered", titleClassName: "cypress-offline-title", bodyClassName: "cypress-offline-body", actions: React.createElement(React.Fragment, null,
|
810
806
|
onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button ob-button__offline-submission-attempt-save-draft is-success", onClick: () => handleSaveDraft(false) },
|
811
|
-
React.createElement(CustomisableButtonInner, { label: ((
|
807
|
+
React.createElement(CustomisableButtonInner, { label: ((_o = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _o === void 0 ? void 0 : _o.label) || 'Save Draft', icon: (_p = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _p === void 0 ? void 0 : _p.icon }))),
|
812
808
|
React.createElement("span", { style: { flex: 1 } }),
|
813
809
|
React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-cancel is-light", onClick: () => setPromptOfflineSubmissionAttempt(false) }, "Cancel"),
|
814
810
|
React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-try-again is-primary", onClick: (e) => {
|
@@ -821,12 +817,12 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
821
817
|
' ',
|
822
818
|
"Alternatively, click the",
|
823
819
|
' ',
|
824
|
-
React.createElement("b", null, ((
|
820
|
+
React.createElement("b", null, ((_q = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _q === void 0 ? void 0 : _q.label) || 'Save Draft'),
|
825
821
|
' ',
|
826
822
|
"button below to come back to this later."))),
|
827
823
|
React.createElement(MaterialIcon, { className: "has-text-warning icon-x-large ob-modal__offline-submission-attempt-icon" }, "wifi_off")))),
|
828
824
|
shouldUseNavigableValidationErrorsNotification &&
|
829
|
-
isShowingValidationErrorsCard && (React.createElement(ValidationErrorsCard, { visiblePages: visiblePages, formElementsValidation: formElementsValidation, setPageId: setPageId, currentPage: currentPage, navigationTopOffset: (
|
825
|
+
isShowingValidationErrorsCard && (React.createElement(ValidationErrorsCard, { visiblePages: visiblePages, formElementsValidation: formElementsValidation, setPageId: setPageId, currentPage: currentPage, navigationTopOffset: (_r = navigableValidationErrorsNotificationSettings === null || navigableValidationErrorsNotificationSettings === void 0 ? void 0 : navigableValidationErrorsNotificationSettings.navigationTopOffset) !== null && _r !== void 0 ? _r : 'CALCULATE', scrollableContainerId: navigableValidationErrorsNotificationSettings === null || navigableValidationErrorsNotificationSettings === void 0 ? void 0 : navigableValidationErrorsNotificationSettings.scrollableContainerId, validationErrorToastFocusElementRef: validationErrorToastFocusElementRef })))))))))));
|
830
826
|
}
|
831
827
|
export default React.memo(OneBlinkFormBase);
|
832
828
|
//# sourceMappingURL=OneBlinkFormBase.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"OneBlinkFormBase.js","sourceRoot":"","sources":["../src/OneBlinkFormBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,OAAO,MAAM,+BAA+B,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,UAAU,MAAM,aAAa,CAAA;AACzC,OAAO,EACL,mBAAmB,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C1B,sBAAsB,EAAE,sBAAsB,EAC9C,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,mBAAmB,EACjB,MAAA,6CAA6C,aAA7C,6CAA6C,uBAA7C,6CAA6C,CAAE,mBAAmB,mCAClE,WAAW,EAEb,qBAAqB,EACnB,6CAA6C,aAA7C,6CAA6C,uBAA7C,6CAA6C,CAAE,qBAAqB,EAEtE,mCAAmC,EACjC,mCAAmC,GAErC,CACH,CACC,CACgC,CACN,CACF,CACL,CACW,CACzB,CACT,CACjB,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { createTheme as createMuiTheme, ThemeProvider } from '@mui/material'\nimport Tooltip from './components/renderer/Tooltip'\nimport { Prompt, useHistory } from 'react-router-dom'\nimport clsx from 'clsx'\nimport * as bulmaToast from 'bulma-toast'\nimport {\n localisationService,\n submissionService,\n attachmentsService,\n} from '@oneblink/apps'\nimport {\n EnvironmentTypes,\n FormTypes,\n FormsAppsTypes,\n ScheduledTasksTypes,\n SubmissionTypes,\n} from '@oneblink/types'\nimport * as H from 'history'\nimport { LocalizationProvider } from '@mui/x-date-pickers'\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'\n\nimport Modal from './components/renderer/Modal'\nimport cleanFormSubmissionModel from './services/cleanFormSubmissionModel'\nimport PageFormElements from './components/renderer/PageFormElements'\nimport useFormValidation from './hooks/useFormValidation'\nimport useConditionalLogic from './hooks/useConditionalLogic'\nimport usePages from './hooks/usePages'\nimport useLookups from './hooks/useLookups'\nimport { FormDefinitionContext } from './hooks/useFormDefinition'\nimport {\n ReplaceInjectablesOverridesContext,\n ReplaceInjectablesOverrides,\n} from './hooks/useReplaceInjectablesOverrides'\nimport { InjectPagesContext } from './hooks/useInjectPages'\nimport { FormElementOptionsContextProvider } from './hooks/useDynamicOptionsLoaderState'\nimport { FormElementLookupsContextProvider } from './hooks/useFormElementLookups'\nimport { OneBlinkFormContainerContext } from './hooks/useOneBlinkFormContainer'\nimport { GoogleMapsApiKeyContext } from './hooks/useGoogleMapsApiKey'\nimport { AbnLookupAuthenticationGuidContext } from './hooks/useAbnLookupAuthenticationGuid'\nimport { CaptchaContext } from './hooks/useCaptcha'\nimport { FormIsReadOnlyContext } from './hooks/useFormIsReadOnly'\nimport { AttachmentBlobsProvider } from './hooks/attachments/useAttachmentBlobs'\nimport useIsOffline from './hooks/useIsOffline'\nimport CustomisableButtonInner from './components/renderer/CustomisableButtonInner'\nimport {\n CaptchaType,\n ExecutedLookups,\n FormElementsValidation,\n NestedFormElementValueChangeHandler,\n SetFormSubmission,\n SectionState,\n} from './types/form'\nimport checkBsbsAreInvalid from './services/checkBsbsAreInvalid'\nimport checkIfBsbsAreValidating from './services/checkIfBsbsAreValidating'\nimport checkIfAttachmentsExist from './services/checkIfAttachmentsExist'\nimport { injectDynamicElements } from './services/dynamic-elements'\nimport useAuth from './hooks/useAuth'\nimport { formElementsService } from '@oneblink/sdk-core'\nimport { TaskContext } from './hooks/useTaskContext'\nimport { OnUploadAttachmentContext } from './hooks/useOnUploadAttachment'\nimport { injectOptionsAcrossAllElements } from './services/injectableOptions'\nimport MaterialIcon from './components/MaterialIcon'\nimport ReCAPTCHA from 'react-google-recaptcha'\nimport ValidationErrorsCard from './components/ValidationErrorsCard'\nimport { sendGoogleAnalyticsEvent } from './utils/sendGoogleAnalyticsEvent'\nimport { useUserProfileForInjectablesOutsideContext } from './hooks/useUserProfileForInjectables'\nimport OneBlinkFormFooter from './components/OneBlinkFormFooter'\nimport { ValidationIconConfigurationContext } from './hooks/useValidationIconConfiguration'\nimport { FormSubmissionModelContextProvider } from './hooks/useFormSubmissionModelContext'\n\nexport type OneBlinkReadOnlyFormProps = {\n /**\n * A [Google Maps API\n * Key](https://developers.google.com/maps/documentation/javascript/get-api-key).\n * Required if the form contains a `location` form element.\n */\n googleMapsApiKey?: string\n /** Hex colour value for certain inputs (defaults to `#4c8da7`). */\n primaryColour?: string\n /**\n * Pass a task if the user was attempting to complete a scheduled task via a\n * form submission\n */\n task?: ScheduledTasksTypes.Task\n /**\n * Pass a task group if the user was attempting to complete a scheduled task\n * associated with a group via a form submission\n */\n taskGroup?: ScheduledTasksTypes.TaskGroup\n /**\n * Pass a task group instance if the user was attempting to complete a\n * scheduled task associated with a group via a form submission\n */\n taskGroupInstance?: ScheduledTasksTypes.TaskGroupInstance\n /**\n * Override the default behaviour when injecting values, such as in an info\n * element or a default value.\n */\n replaceInjectablesOverrides?: ReplaceInjectablesOverrides\n}\n\nexport type OneBlinkFormBaseProps = OneBlinkReadOnlyFormProps & {\n /** The function to call when the user cancels the form */\n onCancel: () => unknown\n /**\n * The function to call when the user submits the form with valid submission\n * data. See\n * [NewFormSubmission](https://oneblink.github.io/apps/modules/submissionService.html#NewFormSubmission)\n * for the structure of the argument.\n */\n onSubmit: (newFormSubmission: submissionService.NewFormSubmission) => unknown\n /** Whether the form is currently able to be submitted. False by default. */\n disabled?: boolean\n /** Whether the form is in preview mode. False by default. */\n isPreview?: boolean\n /**\n * An [ABN Lookup Authentication\n * Guid](https://abr.business.gov.au/Tools/WebServices). Required if the form\n * contains a `abn` form element.\n */\n abnLookupAuthenticationGuid?: string\n /**\n * A [reCAPTCHA Site Key](https://developers.google.com/recaptcha/intro).\n * Required if the form contains a `captcha` form element.\n */\n captchaSiteKey?: string\n /** Change properties for certain buttons on the form. */\n buttons?: FormsAppsTypes.FormsListStyles['buttons']\n /** Set a custom validation icon and accessible label. */\n validationIcon?: EnvironmentTypes.FormsAppEnvironmentStyles['validationIcon']\n /** Number of days attachments are retained for. */\n attachmentRetentionInDays?: number\n /**\n * If set to `false`, submission will be prevented while offline. If set to\n * `true`, the user will be prompted to allow them to continue with\n * attachments uploading in the background later.\n */\n isPendingQueueEnabled: boolean\n /**\n * The function to call when the user wishes to save their submission data as\n * a draft submission. If not specified, drafts cannot be saved. See\n * [NewDraftSubmission](https://oneblink.github.io/apps/modules/submissionService.html#NewDraftSubmission)\n * for the structure of the argument.\n */\n onSaveDraft?: (\n newDraftSubmission: submissionService.NewDraftSubmission,\n ) => unknown\n /**\n * The function to call when the user needs to navigate away from the form.\n * e.g. `history.push`\n */\n handleNavigateAway?: () => unknown\n /**\n * Determines whether the form is submittable or not. Info page type forms\n * show a \"Done\" button instead of a \"Submit\" button. Defaults to\n * \"CALCULATED\"\n */\n isInfoPage?: 'YES' | 'NO' | 'CALCULATED'\n /**\n * The function to call when a user uploads an attachment through an element\n * that allows attachment upload. See\n * [uploadAttachment](https://oneblink.github.io/apps/modules/attachmentsService.html#uploadAttachment)\n * for the structure of the argument and a sample function to be used.\n */\n onUploadAttachment?: typeof attachmentsService.uploadAttachment\n /**\n * Determines whether to use checkboxes or invisible recaptcha v2 for captcha\n * elements. Defaults to \"CHECKBOX\"\n */\n captchaType?: CaptchaType\n\n /**\n * Whether the form should use a navigable validation errors notification, or\n * a simple validation errors notification\n *\n * @default true\n */\n shouldUseNavigableValidationErrorsNotification?: boolean\n /** Various settings for the navigable validation errors notification */\n navigableValidationErrorsNotificationSettings?: {\n /**\n * A pixel offset for validation error navigation markers. Use this to\n * account for any headers your page might have. If not set, we will attempt\n * to calculate the offset for you. Please note: Calculating this value is\n * not supported when passing in a `scrollableContainerId`.\n */\n navigationTopOffset?: number\n /**\n * The HTML Element ID of the scrollable container your form resides in. If\n * not set, will scroll on the window.\n */\n scrollableContainerId?: string\n }\n}\n\nexport type OneBlinkFormUncontrolledProps = {\n /** The OneBlink Form to render */\n form: FormTypes.Form\n /** The initial submission data */\n initialSubmission?: SubmissionTypes.S3SubmissionData['submission']\n}\n\nexport type OneBlinkFormControlledProps = {\n definition: FormTypes.Form\n submission: SubmissionTypes.S3SubmissionData['submission']\n setFormSubmission: SetFormSubmission\n lastElementUpdated?: FormTypes.FormElement\n executedLookups: ExecutedLookups\n sectionState?: SectionState\n}\n\ntype Props = OneBlinkFormBaseProps &\n OneBlinkFormControlledProps & {\n isReadOnly: boolean\n }\n\nfunction OneBlinkFormBase({\n googleMapsApiKey,\n abnLookupAuthenticationGuid,\n captchaSiteKey,\n definition,\n disabled,\n isPreview,\n submission,\n isReadOnly,\n onCancel,\n onSubmit,\n onSaveDraft,\n setFormSubmission,\n buttons,\n validationIcon,\n primaryColour,\n attachmentRetentionInDays,\n isPendingQueueEnabled,\n handleNavigateAway,\n isInfoPage: isInfoPageProp,\n lastElementUpdated,\n executedLookups,\n task,\n taskGroup,\n taskGroupInstance,\n onUploadAttachment,\n captchaType,\n shouldUseNavigableValidationErrorsNotification = true,\n navigableValidationErrorsNotificationSettings,\n replaceInjectablesOverrides,\n sectionState,\n}: Props) {\n const isOffline = useIsOffline()\n const { isUsingFormsKey } = useAuth()\n const userProfileForInjectables = useUserProfileForInjectablesOutsideContext(\n replaceInjectablesOverrides?.getUserProfile,\n )\n const captchasRef = React.useRef<Array<ReCAPTCHA>>([])\n\n const theme = React.useMemo(\n () =>\n createMuiTheme({\n palette: {\n primary: {\n main: primaryColour || '#4c8da7',\n },\n success: {\n main: '#4caf50',\n },\n },\n }),\n [primaryColour],\n )\n\n const isInfoPage = React.useMemo(() => {\n if (!!isInfoPageProp && isInfoPageProp !== 'CALCULATED') {\n return isInfoPageProp === 'YES'\n }\n return formElementsService.determineIsInfoPage(definition)\n }, [definition, isInfoPageProp])\n\n const taskContextValue = React.useMemo(() => {\n return {\n task,\n taskGroup,\n taskGroupInstance,\n }\n }, [task, taskGroup, taskGroupInstance])\n\n //\n //\n // #region Form Definition\n\n const pages = React.useMemo<FormTypes.PageElement[]>(() => {\n if (definition.isMultiPage) {\n return definition.elements.reduce(\n (\n pageElements: FormTypes.PageElement[],\n formElement: FormTypes.FormElement,\n ) => {\n if (formElement.type === 'page') {\n pageElements.push(formElement)\n }\n return pageElements\n },\n [],\n )\n } else {\n return [\n {\n type: 'page',\n id: definition.id.toString(),\n label: definition.name,\n elements: definition.elements,\n conditionallyShow: false,\n requiresAllConditionallyShowPredicates: false,\n },\n ]\n }\n }, [\n definition.elements,\n definition.id,\n definition.isMultiPage,\n definition.name,\n ])\n\n const pagesWithDynamicElements = React.useMemo<\n FormTypes.PageElement[]\n >(() => {\n return injectDynamicElements(pages) as FormTypes.PageElement[]\n }, [pages])\n\n // #endregion\n //\n //\n\n //\n //\n // #region Unsaved Changed\n\n const history = useHistory()\n\n const [isPreparingToSubmit, setIsPreparingToSubmit] =\n React.useState<boolean>(false)\n const [\n { isDirty, isNavigationAllowed, hasConfirmedNavigation, goToLocation },\n setUnsavedChangesState,\n ] = React.useState<{\n isDirty: boolean\n isNavigationAllowed: boolean\n hasConfirmedNavigation: boolean | null\n goToLocation: H.Location | null\n }>({\n isDirty: false,\n isNavigationAllowed: false,\n hasConfirmedNavigation: null,\n goToLocation: null,\n })\n const [promptOfflineSubmissionAttempt, setPromptOfflineSubmissionAttempt] =\n React.useState<boolean>(false)\n const [promptUploadingAttachments, setPromptUploadingAttachments] =\n React.useState<boolean>(false)\n const handleBlockedNavigation = React.useCallback<\n (location: H.Location, action: H.Action) => string | boolean\n >((location) => {\n setUnsavedChangesState((current) => ({\n ...current,\n goToLocation: location,\n hasConfirmedNavigation: false,\n }))\n return false\n }, [])\n\n const handleKeepGoing = React.useCallback(() => {\n setUnsavedChangesState((current) => ({\n ...current,\n goToLocation: null,\n hasConfirmedNavigation: null,\n }))\n }, [])\n\n const handleDiscardUnsavedChanges = React.useCallback(() => {\n setUnsavedChangesState((current) => ({\n ...current,\n isNavigationAllowed: true,\n hasConfirmedNavigation: true,\n }))\n sendGoogleAnalyticsEvent('oneblink_form_abandon', {\n formId: definition.id,\n formName: definition.name,\n })\n }, [definition.id, definition.name])\n\n React.useEffect(() => {\n if (hasConfirmedNavigation) {\n // Navigate to the previous blocked location with your navigate function\n if (goToLocation) {\n history.push(`${goToLocation.pathname}${goToLocation.search}`)\n if (handleNavigateAway) {\n handleNavigateAway()\n }\n } else {\n onCancel()\n }\n }\n }, [\n goToLocation,\n handleNavigateAway,\n hasConfirmedNavigation,\n history,\n onCancel,\n ])\n\n const handleCancel = React.useCallback(() => {\n if (isDirty) {\n setUnsavedChangesState((current) => ({\n ...current,\n hasConfirmedNavigation: false,\n }))\n } else {\n sendGoogleAnalyticsEvent('oneblink_form_abandon', {\n formId: definition.id,\n formName: definition.name,\n })\n onCancel()\n }\n }, [definition.id, definition.name, isDirty, onCancel])\n\n const allowNavigation = React.useCallback(() => {\n setUnsavedChangesState((current) => ({\n ...current,\n isNavigationAllowed: true,\n }))\n }, [])\n\n // #endregion Unsaved Changed\n //\n //\n\n //\n //\n // #region Conditional Logic\n\n const {\n formElementsConditionallyShown,\n conditionalLogicError,\n submissionConditionallyEnabled,\n } = useConditionalLogic({\n formElements: pagesWithDynamicElements,\n submission,\n enableSubmission: definition.enableSubmission,\n })\n\n // #endregion\n //\n //\n\n //\n //\n // #region Validation\n\n const validationErrorToastFocusElementRef =\n React.useRef<HTMLButtonElement>(null)\n const [isShowingValidationErrorsCard, setIsShowingValidationErrorsCard] =\n React.useState(false)\n const { validate } = useFormValidation(pages)\n\n const recaptchaType = React.useMemo(\n () => captchaType ?? 'CHECKBOX',\n [captchaType],\n )\n\n const formElementsValidation = React.useMemo<\n FormElementsValidation | undefined\n >(\n () =>\n !isReadOnly\n ? validate(\n submission,\n formElementsConditionallyShown,\n executedLookups ?? {},\n recaptchaType,\n isOffline,\n )\n : undefined,\n [\n isReadOnly,\n validate,\n submission,\n formElementsConditionallyShown,\n executedLookups,\n recaptchaType,\n isOffline,\n ],\n )\n\n React.useEffect(() => {\n if (!formElementsValidation) {\n setIsShowingValidationErrorsCard(false)\n }\n }, [formElementsValidation])\n\n // #endregion\n //\n //\n\n //\n //\n // #region Pages\n\n const [hasAttemptedSubmit, setHasAttemptedSubmit] = React.useState(false)\n\n const {\n visiblePages,\n isFirstVisiblePage,\n isLastVisiblePage,\n isDisplayingCurrentPageError,\n isShowingMultiplePages,\n isStepsHeaderActive,\n toggleStepsNavigation,\n currentPageIndex,\n currentPage,\n currentPageNumber,\n checkDisplayPageError,\n setPageId,\n goToPreviousPage,\n goToNextPage,\n scrollToTopOfPageHTMLElementRef,\n } = usePages({\n hasAttemptedSubmit,\n pages,\n formElementsValidation,\n formElementsConditionallyShown,\n })\n\n // #endregion\n //\n //\n\n //\n //\n // #region Submissions\n\n const getCurrentSubmissionData = React.useCallback(\n (stripBinaryData: boolean) => {\n const { model, captchaTokens } = cleanFormSubmissionModel(\n submission,\n definition.elements,\n formElementsConditionallyShown,\n stripBinaryData,\n )\n return {\n submission: model,\n captchaTokens,\n }\n },\n [definition.elements, formElementsConditionallyShown, submission],\n )\n\n const obFormContainerHTMLElementRef = React.useRef<HTMLDivElement>(null)\n React.useEffect(() => {\n const obFormContainerHTMLElement = obFormContainerHTMLElementRef.current\n if (obFormContainerHTMLElement) {\n console.log(\n 'Setting toast notifications to be appended to HTML Element',\n obFormContainerHTMLElement,\n )\n bulmaToast.setDefaults({\n position: 'bottom-right',\n opacity: 0.95,\n appendTo: obFormContainerHTMLElement,\n })\n }\n return () => {\n bulmaToast.resetDefaults()\n }\n }, [])\n\n const checkAttachmentsCanBeSubmitted = React.useCallback(\n (submission: SubmissionTypes.S3SubmissionData['submission']) => {\n // Prevent submission until all attachment uploads are finished\n // Unless the user is offline, in which case, the uploads will\n // be taken care of by a pending queue if enabled, otherwise\n // the user will be prompted to try again or save a draft.\n if (isOffline) {\n return true\n }\n const attachmentsAreUploading =\n attachmentsService.checkIfAttachmentsAreUploading(\n definition,\n submission,\n )\n\n if (attachmentsAreUploading) {\n if (isUsingFormsKey || !isPendingQueueEnabled) {\n bulmaToast.toast({\n message:\n 'Attachments are still uploading, please wait for them to finish before trying again.',\n type: 'is-primary',\n extraClasses: 'ob-toast cypress-still-uploading-toast',\n duration: 4000,\n pauseOnHover: true,\n closeOnClick: true,\n })\n return false\n } else {\n setPromptUploadingAttachments(true)\n return false\n }\n }\n\n return true\n },\n [definition, isOffline, isPendingQueueEnabled, isUsingFormsKey],\n )\n\n const checkBsbsCanBeSubmitted = React.useCallback(\n (submission: SubmissionTypes.S3SubmissionData['submission']) => {\n return !checkBsbsAreInvalid(definition, submission)\n },\n [definition],\n )\n\n const checkBsbAreValidating = React.useCallback(\n (submission: SubmissionTypes.S3SubmissionData['submission']) => {\n if (checkIfBsbsAreValidating(definition, submission)) {\n bulmaToast.toast({\n message:\n 'Bsb(s) are still being validated, please wait for them to finish before trying again.',\n type: 'is-primary',\n extraClasses: 'ob-toast cypress-still-validating-toast',\n duration: 4000,\n pauseOnHover: true,\n closeOnClick: true,\n })\n return false\n }\n\n return true\n },\n [definition],\n )\n\n const addCaptchaRef = React.useCallback((recaptcha: ReCAPTCHA) => {\n captchasRef.current.push(recaptcha)\n // this allows the FormElementCaptcha element to unregister any captchas\n return () => {\n captchasRef.current = captchasRef.current.filter(\n (recaptchaInstance) => recaptchaInstance !== recaptcha,\n )\n }\n }, [])\n\n const captchaContextValue = React.useMemo(\n () => ({\n captchaSiteKey,\n captchaType: recaptchaType,\n addCaptchaRef,\n }),\n [addCaptchaRef, captchaSiteKey, recaptchaType],\n )\n\n const resetRecaptchas = React.useCallback(() => {\n // unset the submission model value for each captcha element\n const updatedModel = { ...submission }\n formElementsService.forEachFormElement(definition.elements, (element) => {\n if (element.type === 'captcha') {\n updatedModel[element.name] = undefined\n }\n })\n // reset each captcha\n if (captchaType === 'CHECKBOX') {\n captchasRef.current.forEach((captcha) => {\n captcha.reset()\n })\n }\n\n setHasAttemptedSubmit(false)\n setFormSubmission((current) => {\n return { ...current, submission: updatedModel }\n })\n }, [definition.elements, setFormSubmission, submission, captchaType])\n\n const prepareSubmission = React.useCallback(\n async (\n continueWhilstAttachmentsAreUploading: boolean,\n ): Promise<ReturnType<typeof getCurrentSubmissionData> | undefined> => {\n const submissionData = getCurrentSubmissionData(false)\n if (!checkBsbAreValidating(submissionData.submission)) {\n return\n }\n if (formElementsValidation) {\n console.log('Validation errors', formElementsValidation)\n if (!shouldUseNavigableValidationErrorsNotification) {\n bulmaToast.toast({\n message: 'Please fix validation errors',\n type: 'is-danger',\n extraClasses: 'ob-toast cypress-invalid-submit-attempt',\n duration: 4000,\n pauseOnHover: true,\n closeOnClick: true,\n })\n }\n setIsShowingValidationErrorsCard(true)\n validationErrorToastFocusElementRef.current?.focus()\n return\n }\n if (!checkBsbsCanBeSubmitted(submissionData.submission)) {\n return\n }\n if (\n !continueWhilstAttachmentsAreUploading &&\n !checkAttachmentsCanBeSubmitted(submissionData.submission)\n ) {\n return\n }\n\n if (captchaType === 'INVISIBLE') {\n if (captchasRef.current.length) {\n const tokenResults = await Promise.allSettled(\n captchasRef.current.map((captcha) => captcha.executeAsync()),\n )\n\n const captchaTokens: string[] = []\n\n for (const result of tokenResults) {\n if (result.status === 'rejected' || !result.value) {\n console.log('Captcha token failure')\n bulmaToast.toast({\n message: 'Failed to get a captcha token',\n type: 'is-danger',\n extraClasses: 'ob-toast cypress-failed-captcha-token-creation',\n duration: 4000,\n pauseOnHover: true,\n closeOnClick: true,\n })\n return\n }\n captchaTokens.push(result.value)\n }\n\n submissionData.captchaTokens = captchaTokens\n }\n }\n\n // check if attachments exist\n const newSubmission = checkIfAttachmentsExist(\n definition,\n submissionData.submission,\n attachmentRetentionInDays,\n )\n if (newSubmission) {\n setFormSubmission((currentFormSubmission) => ({\n ...currentFormSubmission,\n submission: newSubmission,\n }))\n bulmaToast.toast({\n message:\n \"Some files that were included in your submission have been removed based on your administrator's data retention policy, please remove them and upload them again.\",\n type: 'is-danger',\n extraClasses: 'ob-toast cypress-invalid-submit-attempt',\n duration: 4000,\n pauseOnHover: true,\n closeOnClick: true,\n })\n return\n }\n\n if (isOffline && !isPendingQueueEnabled) {\n console.log('User is offline and form does not support a pending queue')\n setPromptOfflineSubmissionAttempt(true)\n return\n }\n return submissionData\n },\n [\n attachmentRetentionInDays,\n captchaType,\n checkAttachmentsCanBeSubmitted,\n checkBsbAreValidating,\n checkBsbsCanBeSubmitted,\n definition,\n formElementsValidation,\n getCurrentSubmissionData,\n isOffline,\n isPendingQueueEnabled,\n setFormSubmission,\n shouldUseNavigableValidationErrorsNotification,\n ],\n )\n\n const handleSubmit = React.useCallback(\n async (\n event:\n | React.FormEvent<HTMLFormElement>\n | React.MouseEvent<HTMLButtonElement, MouseEvent>,\n continueWhilstAttachmentsAreUploading: boolean,\n ) => {\n event.preventDefault()\n if (disabled || isReadOnly) return\n setHasAttemptedSubmit(true)\n\n setIsPreparingToSubmit(true)\n\n const submissionData = await prepareSubmission(\n continueWhilstAttachmentsAreUploading,\n )\n\n if (!submissionData) {\n setIsPreparingToSubmit(false)\n return\n }\n\n allowNavigation()\n\n // transplant injected options on the definition\n const elementsWithInjectedOptions = injectOptionsAcrossAllElements({\n contextElements: definition.elements,\n elements: definition.elements,\n submission: submissionData.submission,\n taskContext: taskContextValue,\n userProfile: userProfileForInjectables,\n })\n setIsPreparingToSubmit(false)\n resetRecaptchas()\n onSubmit({\n definition: {\n ...definition,\n elements: elementsWithInjectedOptions,\n },\n submission: submissionData.submission,\n recaptchas: submissionData.captchaTokens.map((token) => ({\n token,\n siteKey: captchaSiteKey as string,\n })),\n })\n sendGoogleAnalyticsEvent('oneblink_form_submit', {\n formId: definition.id,\n formName: definition.name,\n })\n },\n [\n disabled,\n isReadOnly,\n prepareSubmission,\n allowNavigation,\n definition,\n taskContextValue,\n userProfileForInjectables,\n resetRecaptchas,\n onSubmit,\n captchaSiteKey,\n ],\n )\n\n const handleSaveDraft = React.useCallback(\n (continueWhilstAttachmentsAreUploading: boolean) => {\n if (disabled) return\n if (onSaveDraft) {\n allowNavigation()\n\n // For drafts we don't need to save the captcha tokens,\n // they will need to prove they are not robot again\n const { submission } = getCurrentSubmissionData(false)\n if (!checkBsbAreValidating(submission)) {\n return\n }\n if (\n !continueWhilstAttachmentsAreUploading &&\n !checkAttachmentsCanBeSubmitted(submission)\n ) {\n return\n }\n onSaveDraft({\n definition,\n submission,\n backgroundUpload: continueWhilstAttachmentsAreUploading,\n lastElementUpdated,\n sectionState,\n })\n }\n },\n [\n allowNavigation,\n checkAttachmentsCanBeSubmitted,\n definition,\n disabled,\n getCurrentSubmissionData,\n onSaveDraft,\n checkBsbAreValidating,\n lastElementUpdated,\n sectionState,\n ],\n )\n\n const handleContinueWithAttachments = React.useCallback(\n (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n setPromptUploadingAttachments(false)\n if (hasAttemptedSubmit) {\n handleSubmit(e, true)\n } else {\n handleSaveDraft(true)\n }\n },\n [\n handleSubmit,\n setPromptUploadingAttachments,\n hasAttemptedSubmit,\n handleSaveDraft,\n ],\n )\n const handleWaitForAttachments = React.useCallback(() => {\n setPromptUploadingAttachments(false)\n }, [setPromptUploadingAttachments])\n\n // #endregion\n //\n //\n\n //\n //\n // #region Lookups\n\n const { handlePagesLookupResult } = useLookups(\n definition.id,\n setFormSubmission,\n )\n\n // #endregion\n //\n //\n\n //\n //\n // #region Submission/Definition Changes\n\n const handleChange = React.useCallback<NestedFormElementValueChangeHandler>(\n (element, { value, executedLookups, deleteSection, sectionState }) => {\n if (\n //This will ensure on a read only form that the summary and calculation elements\n //can still be displayed as it needs handleChange so it can render\n //due to the dynamic nature of the summary element.\n (disabled &&\n element.type !== 'summary' &&\n element.type !== 'calculation') ||\n element.type === 'page'\n ) {\n return\n }\n\n setUnsavedChangesState((current) => ({\n ...current,\n isDirty: true,\n }))\n if (element.type === 'section') {\n setFormSubmission((currentFormSubmission) => {\n const currentSectionState = currentFormSubmission.sectionState || []\n const existingSectionIndex = currentSectionState.findIndex(\n (section) => section.id === element.id,\n )\n const sectionIsInState = existingSectionIndex >= 0\n let newSectionState: SectionState\n if (sectionIsInState && deleteSection) {\n newSectionState = currentSectionState.filter(\n (section) => section.id !== element.id,\n )\n } else if (sectionIsInState) {\n // Update state of the section\n newSectionState = currentSectionState.map((section, index) =>\n index === existingSectionIndex\n ? {\n ...section,\n state:\n section.state === 'COLLAPSED' ? 'EXPANDED' : 'COLLAPSED',\n }\n : section,\n )\n } else {\n // Add the section to state\n newSectionState = [\n ...currentSectionState,\n {\n id: element.id,\n state: element.isCollapsed ? 'EXPANDED' : 'COLLAPSED',\n },\n ]\n }\n\n return {\n ...currentFormSubmission,\n sectionState: newSectionState,\n }\n })\n }\n // dont update the last element updated for elements the user cannot set the value of\n else if (element.type === 'summary' || element.type === 'calculation') {\n setFormSubmission((currentFormSubmission) => ({\n ...currentFormSubmission,\n submission: {\n ...currentFormSubmission.submission,\n [element.name]:\n typeof value === 'function'\n ? value(currentFormSubmission.submission[element.name])\n : value,\n },\n }))\n } else {\n setFormSubmission((currentFormSubmission) => {\n return {\n ...currentFormSubmission,\n submission: {\n ...currentFormSubmission.submission,\n [element.name]:\n typeof value === 'function'\n ? value(currentFormSubmission.submission[element.name])\n : value,\n },\n lastElementUpdated: element,\n executedLookups: {\n ...currentFormSubmission.executedLookups,\n [element.name]:\n typeof executedLookups === 'function'\n ? executedLookups(\n currentFormSubmission.executedLookups?.[element.name],\n )\n : executedLookups,\n },\n sectionState: sectionState\n ? typeof sectionState === 'function'\n ? sectionState(currentFormSubmission.sectionState)\n : sectionState\n : currentFormSubmission.sectionState,\n }\n })\n }\n },\n [disabled, setFormSubmission],\n )\n\n // #endregion\n //\n //\n\n const lastElementUpdatedExistsOnForm = React.useMemo(() => {\n return !!formElementsService.findFormElement(\n definition.elements,\n (el) => el.id === lastElementUpdated?.id,\n )\n }, [definition.elements, lastElementUpdated])\n\n const lastElementUpdatedPage = React.useMemo(() => {\n return definition.elements.find((pageElement: FormTypes.FormElement) => {\n if (pageElement.type === 'page') {\n return formElementsService.findFormElement(\n pageElement.elements,\n (el) => el.id === lastElementUpdated?.id,\n )\n }\n })\n }, [lastElementUpdated, definition])\n\n const [hasResumed, setHasResumed] = React.useState(false)\n React.useEffect(() => {\n if (!hasResumed) {\n if (lastElementUpdated && lastElementUpdatedExistsOnForm) {\n if (lastElementUpdatedPage) {\n setPageId(lastElementUpdatedPage.id)\n }\n const element = document.querySelector(\n `[data-element-id=\"${lastElementUpdated.id}\"]`,\n )\n if (element) {\n window.requestAnimationFrame(() => {\n element.scrollIntoView({ behavior: 'smooth' })\n })\n }\n }\n if (sectionState) {\n {\n setFormSubmission((currentFormSubmission) => ({\n ...currentFormSubmission,\n sectionState,\n }))\n }\n }\n setHasResumed(true)\n }\n }, [\n lastElementUpdated,\n hasResumed,\n lastElementUpdatedPage,\n lastElementUpdatedExistsOnForm,\n setPageId,\n sectionState,\n setFormSubmission,\n ])\n\n if (conditionalLogicError) {\n return (\n <>\n <div className=\"has-text-centered\">\n <MaterialIcon className=\"has-text-warning icon-x-large\">\n error\n </MaterialIcon>\n <h3 className=\"title is-3\">Bad Form Configuration</h3>\n <p className=\"cypress-conditional-logic-error-message\">\n {conditionalLogicError.message}\n </p>\n <p className=\"has-text-grey\">\n {localisationService.formatDatetimeLong(new Date())}\n </p>\n </div>\n </>\n )\n }\n\n return (\n <ThemeProvider theme={theme}>\n <LocalizationProvider dateAdapter={AdapterDateFns}>\n <ReplaceInjectablesOverridesContext.Provider\n value={replaceInjectablesOverrides}\n >\n <FormDefinitionContext.Provider value={definition}>\n <FormElementOptionsContextProvider>\n <FormElementLookupsContextProvider>\n <OneBlinkFormContainerContext.Provider\n value={obFormContainerHTMLElementRef.current}\n >\n <div\n className={clsx('ob-form-container', {\n 'is-showing-pages': isShowingMultiplePages,\n })}\n ref={obFormContainerHTMLElementRef}\n >\n <form\n name=\"obForm\"\n className={`ob-form cypress-ob-form ob-form__page-${\n currentPageIndex + 1\n }`}\n noValidate\n onSubmit={(e) => handleSubmit(e, false)}\n >\n <div>\n <div ref={scrollToTopOfPageHTMLElementRef} />\n {isShowingMultiplePages && (\n <div\n className={clsx('ob-steps-navigation', {\n 'is-active': isStepsHeaderActive,\n })}\n >\n <div\n className={clsx('ob-steps-navigation__header', {\n 'is-active': isStepsHeaderActive,\n })}\n onClick={toggleStepsNavigation}\n >\n <span className=\"icon is-invisible\">\n <MaterialIcon>keyboard_arrow_down</MaterialIcon>\n </span>\n <div className=\"steps-header-active-page\">\n {isDisplayingCurrentPageError ? (\n <span className=\"icon\">\n <MaterialIcon className=\"has-text-danger is-size-4\">\n warning\n </MaterialIcon>\n </span>\n ) : (\n <span className=\"steps-header-active-page-icon\">\n {currentPageNumber}\n </span>\n )}\n <span className=\"steps-header-active-page-label cypress-tablet-step-title\">\n {currentPage ? currentPage.label : ''}\n </span>\n </div>\n <span className=\"dropdown icon\">\n <MaterialIcon>keyboard_arrow_down</MaterialIcon>\n </span>\n </div>\n\n <div\n className={clsx('ob-steps-navigation__steps', {\n 'is-active': isStepsHeaderActive,\n })}\n >\n <div className=\"steps is-small is-horizontal-tablet cypress-steps\">\n {visiblePages.map(\n (\n page: FormTypes.PageElement,\n index: number,\n ) => {\n const hasErrors =\n checkDisplayPageError(page)\n return (\n <div\n key={page.id}\n id={`steps-navigation-step-${page.id}`}\n className={clsx(\n 'step-item cypress-step-item',\n {\n 'is-active':\n currentPage.id === page.id,\n 'is-completed':\n currentPageIndex > index,\n 'is-error': hasErrors,\n },\n )}\n onClick={(e) => {\n e.stopPropagation()\n if (page.id !== currentPage.id) {\n setPageId(page.id)\n }\n }}\n >\n <div\n className=\"step-marker step-marker-error ob-step-marker cypress-step-marker\"\n // @ts-expect-error ???\n name={`cypress-page-stepper-${index + 1}`}\n value={index + 1}\n >\n {hasErrors ? (\n <Tooltip title=\"Page has errors\">\n <span className=\"icon tooltip has-tooltip-top cypress-page-error\">\n <MaterialIcon className=\"has-text-danger is-size-3\">\n warning\n </MaterialIcon>\n </span>\n </Tooltip>\n ) : (\n <span>{index + 1}</span>\n )}\n </div>\n <div className=\"step-details ob-step-details\">\n <p\n className=\"step-title ob-step-title cypress-desktop-step-title\"\n id={`steps-navigation-step-label-${page.id}`}\n >\n {page.label}\n </p>\n </div>\n </div>\n )\n },\n )}\n </div>\n </div>\n </div>\n )}\n\n <div\n className={clsx('ob-steps-navigation__background', {\n 'is-active': isStepsHeaderActive,\n })}\n onClick={toggleStepsNavigation}\n />\n\n <div className=\"steps\">\n <div\n className={clsx('steps-content', {\n 'is-single-step': !isShowingMultiplePages,\n })}\n >\n <InjectPagesContext.Provider\n value={handlePagesLookupResult}\n >\n <GoogleMapsApiKeyContext.Provider\n value={googleMapsApiKey}\n >\n <AbnLookupAuthenticationGuidContext.Provider\n value={abnLookupAuthenticationGuid}\n >\n <ValidationIconConfigurationContext.Provider\n value={validationIcon}\n >\n <CaptchaContext.Provider\n value={captchaContextValue}\n >\n <AttachmentBlobsProvider>\n <FormIsReadOnlyContext.Provider\n value={isReadOnly}\n >\n <TaskContext.Provider\n value={taskContextValue}\n >\n <OnUploadAttachmentContext.Provider\n value={onUploadAttachment}\n >\n {visiblePages.map(\n (\n pageElement: FormTypes.PageElement,\n ) => (\n <PageFormElements\n key={pageElement.id}\n isActive={\n pageElement.id ===\n currentPage.id\n }\n formId={definition.id}\n formElementsConditionallyShown={\n formElementsConditionallyShown\n }\n formElementsValidation={\n formElementsValidation\n }\n displayValidationMessages={\n hasAttemptedSubmit ||\n isDisplayingCurrentPageError\n }\n pageElement={pageElement}\n onChange={handleChange}\n model={submission}\n setFormSubmission={\n setFormSubmission\n }\n sectionState={sectionState}\n />\n ),\n )}\n </OnUploadAttachmentContext.Provider>\n </TaskContext.Provider>\n </FormIsReadOnlyContext.Provider>\n </AttachmentBlobsProvider>\n </CaptchaContext.Provider>\n </ValidationIconConfigurationContext.Provider>\n </AbnLookupAuthenticationGuidContext.Provider>\n </GoogleMapsApiKeyContext.Provider>\n </InjectPagesContext.Provider>\n </div>\n\n {isShowingMultiplePages && (\n <div className=\"steps-actions\">\n <div className=\"steps-action\">\n <button\n type=\"button\"\n onClick={goToPreviousPage}\n disabled={isFirstVisiblePage}\n className=\"button is-light cypress-pages-previous\"\n >\n <span className=\"icon\">\n <MaterialIcon>\n keyboard_arrow_left\n </MaterialIcon>\n </span>\n <span>Back</span>\n </button>\n </div>\n <div className=\"step-progress-mobile cypress-steps-mobile\">\n {visiblePages.map(\n (page: FormTypes.PageElement, index) => (\n <div\n key={page.id}\n className={clsx(\n 'step-progress-mobile-dot',\n {\n 'is-active':\n currentPage.id === page.id,\n 'is-completed':\n currentPageIndex > index,\n 'has-background-danger':\n currentPage.id !== page.id &&\n checkDisplayPageError(page),\n },\n )}\n />\n ),\n )}\n </div>\n <div className=\"steps-action\">\n <button\n type=\"button\"\n onClick={goToNextPage}\n disabled={isLastVisiblePage}\n className=\"button is-light cypress-pages-next\"\n >\n <span>Next</span>\n <span className=\"icon\">\n <MaterialIcon>\n keyboard_arrow_right\n </MaterialIcon>\n </span>\n </button>\n </div>\n </div>\n )}\n </div>\n {!isReadOnly && (\n <div className=\"buttons ob-buttons ob-buttons-submit\">\n {onSaveDraft && !isInfoPage && (\n <button\n type=\"button\"\n className=\"button ob-button is-primary ob-button-save-draft cypress-save-draft-form\"\n onClick={() => handleSaveDraft(false)}\n disabled={isPreview || disabled}\n >\n <CustomisableButtonInner\n label={\n buttons?.saveDraft?.label || 'Save Draft'\n }\n icon={buttons?.saveDraft?.icon}\n />\n </button>\n )}\n <span className=\"ob-buttons-submit__spacer\"></span>\n {!isInfoPage && (\n <button\n type=\"button\"\n className=\"button ob-button is-light ob-button-submit-cancel cypress-cancel-form\"\n onClick={handleCancel}\n disabled={isPreview || disabled}\n >\n <CustomisableButtonInner\n label={buttons?.cancel?.label || 'Cancel'}\n icon={buttons?.cancel?.icon}\n />\n </button>\n )}\n {isLastVisiblePage && (\n <Tooltip\n title={\n submissionConditionallyEnabled\n ? ''\n : 'Submission disabled: Your inputs have not met the criteria for submission'\n }\n >\n <button\n type=\"submit\"\n className={clsx(\n 'button ob-button is-success ob-button-submit cypress-submit-form-button cypress-submit-form',\n { 'is-loading': isPreparingToSubmit },\n {\n 'ob-button-submit-is-disabled':\n submissionConditionallyEnabled,\n },\n )}\n disabled={\n isPreview ||\n disabled ||\n isPreparingToSubmit ||\n !submissionConditionallyEnabled\n }\n >\n <CustomisableButtonInner\n label={\n isInfoPage\n ? 'Done'\n : buttons?.submit?.label || 'Submit'\n }\n icon={buttons?.submit?.icon}\n />\n </button>\n </Tooltip>\n )}\n </div>\n )}\n </div>\n\n {!!definition.footer?.html && (\n <FormSubmissionModelContextProvider\n elements={definition.elements}\n model={submission}\n formElementsConditionallyShown={\n formElementsConditionallyShown\n }\n >\n <OneBlinkFormFooter\n footer={definition.footer?.html}\n />\n </FormSubmissionModelContextProvider>\n )}\n </form>\n\n {!isReadOnly && !isPreview && (\n <React.Fragment>\n <Prompt\n when={isDirty && !isNavigationAllowed}\n message={handleBlockedNavigation}\n />\n <Modal\n isOpen={hasConfirmedNavigation === false}\n title=\"Unsaved Changes\"\n cardClassName=\"cypress-cancel-confirm\"\n titleClassName=\"cypress-cancel-confirm-title\"\n bodyClassName=\"cypress-cancel-confirm-body\"\n actions={\n <>\n {onSaveDraft && (\n <button\n type=\"button\"\n className=\"button ob-button is-success cypress-cancel-confirm-save-draft\"\n onClick={() => handleSaveDraft(false)}\n >\n <CustomisableButtonInner\n label={\n buttons?.saveDraft?.label || 'Save Draft'\n }\n icon={buttons?.saveDraft?.icon}\n />\n </button>\n )}\n <span style={{ flex: 1 }}></span>\n <button\n type=\"button\"\n className=\"button ob-button is-light cypress-cancel-confirm-back\"\n onClick={handleKeepGoing}\n >\n <CustomisableButtonInner\n label={\n buttons?.cancelPromptNo?.label || 'Back'\n }\n icon={buttons?.cancelPromptNo?.icon}\n />\n </button>\n <button\n type=\"button\"\n className=\"button ob-button is-primary cypress-cancel-confirm-discard\"\n onClick={handleDiscardUnsavedChanges}\n autoFocus\n >\n <CustomisableButtonInner\n label={\n buttons?.cancelPromptYes?.label || 'Discard'\n }\n icon={buttons?.cancelPromptYes?.icon}\n />\n </button>\n </>\n }\n >\n <p>\n You have unsaved changes, are you sure you want\n discard them?\n </p>\n </Modal>\n <Modal\n isOpen={promptUploadingAttachments === true}\n title=\"Attachment upload in progress\"\n cardClassName=\"cypress-attachments-wait-continue\"\n titleClassName=\"cypress-attachments-confirm-wait-title\"\n bodyClassName=\"cypress-attachments-confirm-wait-body\"\n actions={\n <>\n <span style={{ flex: 1 }}></span>\n <button\n type=\"button\"\n className=\"button ob-button is-light cypress-attachments-confirm-wait\"\n onClick={handleWaitForAttachments}\n >\n Wait\n </button>\n <button\n type=\"button\"\n className=\"button ob-button is-primary cypress-attachments-confirm-continue\"\n onClick={handleContinueWithAttachments}\n autoFocus\n >\n Continue\n </button>\n </>\n }\n >\n <p>\n Your attachments are still uploading, do you want to\n wait for the uploads to complete or continue using\n the app? If you click continue the attachments will\n upload in the background. Do not close the app until\n the upload has been completed.\n </p>\n </Modal>\n\n <Modal\n isOpen={promptOfflineSubmissionAttempt}\n title=\"It looks like you're Offline\"\n className=\"ob-modal__offline-submission-attempt\"\n cardClassName=\"cypress-submission-offline has-text-centered\"\n titleClassName=\"cypress-offline-title\"\n bodyClassName=\"cypress-offline-body\"\n actions={\n <>\n {onSaveDraft && (\n <button\n type=\"button\"\n className=\"button ob-button ob-button__offline-submission-attempt-save-draft is-success\"\n onClick={() => handleSaveDraft(false)}\n >\n <CustomisableButtonInner\n label={\n buttons?.saveDraft?.label || 'Save Draft'\n }\n icon={buttons?.saveDraft?.icon}\n />\n </button>\n )}\n <span style={{ flex: 1 }}></span>\n <button\n className=\"button ob-button ob-button__offline-submission-attempt-cancel is-light\"\n onClick={() =>\n setPromptOfflineSubmissionAttempt(false)\n }\n >\n Cancel\n </button>\n <button\n className=\"button ob-button ob-button__offline-submission-attempt-try-again is-primary\"\n onClick={(e) => {\n setPromptOfflineSubmissionAttempt(false)\n handleSubmit(e, false)\n }}\n autoFocus\n >\n Try Again\n </button>\n </>\n }\n >\n <p className=\"ob-modal__offline-submission-attempt-message\">\n You cannot submit this form while offline, please\n try again when connectivity is restored.\n {onSaveDraft && (\n <span className=\"ob-modal__offline-submission-attempt-save-draft-message\">\n {' '}\n Alternatively, click the{' '}\n <b>\n {buttons?.saveDraft?.label || 'Save Draft'}\n </b>{' '}\n button below to come back to this later.\n </span>\n )}\n </p>\n <MaterialIcon className=\"has-text-warning icon-x-large ob-modal__offline-submission-attempt-icon\">\n wifi_off\n </MaterialIcon>\n </Modal>\n </React.Fragment>\n )}\n {shouldUseNavigableValidationErrorsNotification &&\n isShowingValidationErrorsCard && (\n <ValidationErrorsCard\n visiblePages={visiblePages}\n formElementsValidation={formElementsValidation}\n setPageId={setPageId}\n currentPage={currentPage}\n navigationTopOffset={\n navigableValidationErrorsNotificationSettings?.navigationTopOffset ??\n 'CALCULATE'\n }\n scrollableContainerId={\n navigableValidationErrorsNotificationSettings?.scrollableContainerId\n }\n validationErrorToastFocusElementRef={\n validationErrorToastFocusElementRef\n }\n />\n )}\n </div>\n </OneBlinkFormContainerContext.Provider>\n </FormElementLookupsContextProvider>\n </FormElementOptionsContextProvider>\n </FormDefinitionContext.Provider>\n </ReplaceInjectablesOverridesContext.Provider>\n </LocalizationProvider>\n </ThemeProvider>\n )\n}\n\nexport default React.memo(OneBlinkFormBase)\n"]}
|
1
|
+
{"version":3,"file":"OneBlinkFormBase.js","sourceRoot":"","sources":["../src/OneBlinkFormBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,OAAO,MAAM,+BAA+B,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,UAAU,MAAM,aAAa,CAAA;AACzC,OAAO,EACL,mBAAmB,EAEnB,kBAAkB,GACnB,MAAM,gBAAgB,CAAA;AASvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAEnE,OAAO,KAAK,MAAM,6BAA6B,CAAA;AAC/C,OAAO,wBAAwB,MAAM,qCAAqC,CAAA;AAC1E,OAAO,gBAAgB,MAA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ACE,SAAS,EAAC,6EAA6E,EACvF,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;wDACb,iCAAiC,CAAC,KAAK,CAAC,CAAA;wDACxC,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;oDACxB,CAAC,EACD,SAAS,sBAGF,CACR;4CAGL,2BAAG,SAAS,EAAC,8CAA8C;;gDAGxD,WAAW,IAAI,CACd,8BAAM,SAAS,EAAC,yDAAyD;oDACtE,GAAG;;oDACqB,GAAG;oDAC5B,+BACG,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,KAAK,KAAI,YAAY,CACxC;oDAAC,GAAG;+FAEH,CACR,CACC;4CACJ,oBAAC,YAAY,IAAC,SAAS,EAAC,yEAAyE,eAElF,CACT,CACO,CAClB;oCACA,8CAA8C;wCAC7C,6BAA6B,IAAI,CAC/B,oBAAC,oBAAoB,IACnB,YAAY,EAAE,YAAY,EAC1B,sBAAsB,EAAE,sBAAsB,EAC9C,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,mBAAmB,EACjB,MAAA,6CAA6C,aAA7C,6CAA6C,uBAA7C,6CAA6C,CAAE,mBAAmB,mCAClE,WAAW,EAEb,qBAAqB,EACnB,6CAA6C,aAA7C,6CAA6C,uBAA7C,6CAA6C,CAAE,qBAAqB,EAEtE,mCAAmC,EACjC,mCAAmC,GAErC,CACH,CACC,CACgC,CACN,CACF,CACL,CACW,CACzB,CACT,CACjB,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { createTheme as createMuiTheme, ThemeProvider } from '@mui/material'\nimport Tooltip from './components/renderer/Tooltip'\nimport { Prompt, useHistory } from 'react-router-dom'\nimport clsx from 'clsx'\nimport * as bulmaToast from 'bulma-toast'\nimport {\n localisationService,\n submissionService,\n attachmentsService,\n} from '@oneblink/apps'\nimport {\n EnvironmentTypes,\n FormTypes,\n FormsAppsTypes,\n ScheduledTasksTypes,\n SubmissionTypes,\n} from '@oneblink/types'\nimport * as H from 'history'\nimport { LocalizationProvider } from '@mui/x-date-pickers'\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'\n\nimport Modal from './components/renderer/Modal'\nimport cleanFormSubmissionModel from './services/cleanFormSubmissionModel'\nimport PageFormElements from './components/renderer/PageFormElements'\nimport useFormValidation from './hooks/useFormValidation'\nimport useConditionalLogic from './hooks/useConditionalLogic'\nimport usePages from './hooks/usePages'\nimport useLookups from './hooks/useLookups'\nimport { FormDefinitionContext } from './hooks/useFormDefinition'\nimport {\n ReplaceInjectablesOverridesContext,\n ReplaceInjectablesOverrides,\n} from './hooks/useReplaceInjectablesOverrides'\nimport { InjectPagesContext } from './hooks/useInjectPages'\nimport { FormElementOptionsContextProvider } from './hooks/useDynamicOptionsLoaderState'\nimport { FormElementLookupsContextProvider } from './hooks/useFormElementLookups'\nimport { OneBlinkFormContainerContext } from './hooks/useOneBlinkFormContainer'\nimport { GoogleMapsApiKeyContext } from './hooks/useGoogleMapsApiKey'\nimport { AbnLookupAuthenticationGuidContext } from './hooks/useAbnLookupAuthenticationGuid'\nimport { CaptchaContext } from './hooks/useCaptcha'\nimport { FormIsReadOnlyContext } from './hooks/useFormIsReadOnly'\nimport { AttachmentBlobsProvider } from './hooks/attachments/useAttachmentBlobs'\nimport useIsOffline from './hooks/useIsOffline'\nimport CustomisableButtonInner from './components/renderer/CustomisableButtonInner'\nimport {\n CaptchaType,\n ExecutedLookups,\n FormElementsValidation,\n NestedFormElementValueChangeHandler,\n SetFormSubmission,\n SectionState,\n} from './types/form'\nimport checkBsbsAreInvalid from './services/checkBsbsAreInvalid'\nimport checkIfBsbsAreValidating from './services/checkIfBsbsAreValidating'\nimport checkIfAttachmentsExist from './services/checkIfAttachmentsExist'\nimport { injectDynamicElements } from './services/dynamic-elements'\nimport useAuth from './hooks/useAuth'\nimport { formElementsService } from '@oneblink/sdk-core'\nimport { TaskContext } from './hooks/useTaskContext'\nimport { OnUploadAttachmentContext } from './hooks/useOnUploadAttachment'\nimport { injectOptionsAcrossAllElements } from './services/injectableOptions'\nimport MaterialIcon from './components/MaterialIcon'\nimport ReCAPTCHA from 'react-google-recaptcha'\nimport ValidationErrorsCard from './components/ValidationErrorsCard'\nimport { sendGoogleAnalyticsEvent } from './utils/sendGoogleAnalyticsEvent'\nimport { useUserProfileForInjectablesOutsideContext } from './hooks/useUserProfileForInjectables'\nimport { ValidationIconConfigurationContext } from './hooks/useValidationIconConfiguration'\n\nexport type OneBlinkReadOnlyFormProps = {\n /**\n * A [Google Maps API\n * Key](https://developers.google.com/maps/documentation/javascript/get-api-key).\n * Required if the form contains a `location` form element.\n */\n googleMapsApiKey?: string\n /** Hex colour value for certain inputs (defaults to `#4c8da7`). */\n primaryColour?: string\n /**\n * Pass a task if the user was attempting to complete a scheduled task via a\n * form submission\n */\n task?: ScheduledTasksTypes.Task\n /**\n * Pass a task group if the user was attempting to complete a scheduled task\n * associated with a group via a form submission\n */\n taskGroup?: ScheduledTasksTypes.TaskGroup\n /**\n * Pass a task group instance if the user was attempting to complete a\n * scheduled task associated with a group via a form submission\n */\n taskGroupInstance?: ScheduledTasksTypes.TaskGroupInstance\n /**\n * Override the default behaviour when injecting values, such as in an info\n * element or a default value.\n */\n replaceInjectablesOverrides?: ReplaceInjectablesOverrides\n}\n\nexport type OneBlinkFormBaseProps = OneBlinkReadOnlyFormProps & {\n /** The function to call when the user cancels the form */\n onCancel: () => unknown\n /**\n * The function to call when the user submits the form with valid submission\n * data. See\n * [NewFormSubmission](https://oneblink.github.io/apps/modules/submissionService.html#NewFormSubmission)\n * for the structure of the argument.\n */\n onSubmit: (newFormSubmission: submissionService.NewFormSubmission) => unknown\n /** Whether the form is currently able to be submitted. False by default. */\n disabled?: boolean\n /** Whether the form is in preview mode. False by default. */\n isPreview?: boolean\n /**\n * An [ABN Lookup Authentication\n * Guid](https://abr.business.gov.au/Tools/WebServices). Required if the form\n * contains a `abn` form element.\n */\n abnLookupAuthenticationGuid?: string\n /**\n * A [reCAPTCHA Site Key](https://developers.google.com/recaptcha/intro).\n * Required if the form contains a `captcha` form element.\n */\n captchaSiteKey?: string\n /** Change properties for certain buttons on the form. */\n buttons?: FormsAppsTypes.FormsListStyles['buttons']\n /** Set a custom validation icon and accessible label. */\n validationIcon?: EnvironmentTypes.FormsAppEnvironmentStyles['validationIcon']\n /** Number of days attachments are retained for. */\n attachmentRetentionInDays?: number\n /**\n * If set to `false`, submission will be prevented while offline. If set to\n * `true`, the user will be prompted to allow them to continue with\n * attachments uploading in the background later.\n */\n isPendingQueueEnabled: boolean\n /**\n * The function to call when the user wishes to save their submission data as\n * a draft submission. If not specified, drafts cannot be saved. See\n * [NewDraftSubmission](https://oneblink.github.io/apps/modules/submissionService.html#NewDraftSubmission)\n * for the structure of the argument.\n */\n onSaveDraft?: (\n newDraftSubmission: submissionService.NewDraftSubmission,\n ) => unknown\n /**\n * The function to call when the user needs to navigate away from the form.\n * e.g. `history.push`\n */\n handleNavigateAway?: () => unknown\n /**\n * Determines whether the form is submittable or not. Info page type forms\n * show a \"Done\" button instead of a \"Submit\" button. Defaults to\n * \"CALCULATED\"\n */\n isInfoPage?: 'YES' | 'NO' | 'CALCULATED'\n /**\n * The function to call when a user uploads an attachment through an element\n * that allows attachment upload. See\n * [uploadAttachment](https://oneblink.github.io/apps/modules/attachmentsService.html#uploadAttachment)\n * for the structure of the argument and a sample function to be used.\n */\n onUploadAttachment?: typeof attachmentsService.uploadAttachment\n /**\n * Determines whether to use checkboxes or invisible recaptcha v2 for captcha\n * elements. Defaults to \"CHECKBOX\"\n */\n captchaType?: CaptchaType\n\n /**\n * Whether the form should use a navigable validation errors notification, or\n * a simple validation errors notification\n *\n * @default true\n */\n shouldUseNavigableValidationErrorsNotification?: boolean\n /** Various settings for the navigable validation errors notification */\n navigableValidationErrorsNotificationSettings?: {\n /**\n * A pixel offset for validation error navigation markers. Use this to\n * account for any headers your page might have. If not set, we will attempt\n * to calculate the offset for you. Please note: Calculating this value is\n * not supported when passing in a `scrollableContainerId`.\n */\n navigationTopOffset?: number\n /**\n * The HTML Element ID of the scrollable container your form resides in. If\n * not set, will scroll on the window.\n */\n scrollableContainerId?: string\n }\n}\n\nexport type OneBlinkFormUncontrolledProps = {\n /** The OneBlink Form to render */\n form: FormTypes.Form\n /** The initial submission data */\n initialSubmission?: SubmissionTypes.S3SubmissionData['submission']\n}\n\nexport type OneBlinkFormControlledProps = {\n definition: FormTypes.Form\n submission: SubmissionTypes.S3SubmissionData['submission']\n setFormSubmission: SetFormSubmission\n lastElementUpdated?: FormTypes.FormElement\n executedLookups: ExecutedLookups\n sectionState?: SectionState\n}\n\ntype Props = OneBlinkFormBaseProps &\n OneBlinkFormControlledProps & {\n isReadOnly: boolean\n }\n\nfunction OneBlinkFormBase({\n googleMapsApiKey,\n abnLookupAuthenticationGuid,\n captchaSiteKey,\n definition,\n disabled,\n isPreview,\n submission,\n isReadOnly,\n onCancel,\n onSubmit,\n onSaveDraft,\n setFormSubmission,\n buttons,\n validationIcon,\n primaryColour,\n attachmentRetentionInDays,\n isPendingQueueEnabled,\n handleNavigateAway,\n isInfoPage: isInfoPageProp,\n lastElementUpdated,\n executedLookups,\n task,\n taskGroup,\n taskGroupInstance,\n onUploadAttachment,\n captchaType,\n shouldUseNavigableValidationErrorsNotification = true,\n navigableValidationErrorsNotificationSettings,\n replaceInjectablesOverrides,\n sectionState,\n}: Props) {\n const isOffline = useIsOffline()\n const { isUsingFormsKey } = useAuth()\n const userProfileForInjectables = useUserProfileForInjectablesOutsideContext(\n replaceInjectablesOverrides?.getUserProfile,\n )\n const captchasRef = React.useRef<Array<ReCAPTCHA>>([])\n\n const theme = React.useMemo(\n () =>\n createMuiTheme({\n palette: {\n primary: {\n main: primaryColour || '#4c8da7',\n },\n success: {\n main: '#4caf50',\n },\n },\n }),\n [primaryColour],\n )\n\n const isInfoPage = React.useMemo(() => {\n if (!!isInfoPageProp && isInfoPageProp !== 'CALCULATED') {\n return isInfoPageProp === 'YES'\n }\n return formElementsService.determineIsInfoPage(definition)\n }, [definition, isInfoPageProp])\n\n const taskContextValue = React.useMemo(() => {\n return {\n task,\n taskGroup,\n taskGroupInstance,\n }\n }, [task, taskGroup, taskGroupInstance])\n\n //\n //\n // #region Form Definition\n\n const pages = React.useMemo<FormTypes.PageElement[]>(() => {\n if (definition.isMultiPage) {\n return definition.elements.reduce(\n (\n pageElements: FormTypes.PageElement[],\n formElement: FormTypes.FormElement,\n ) => {\n if (formElement.type === 'page') {\n pageElements.push(formElement)\n }\n return pageElements\n },\n [],\n )\n } else {\n return [\n {\n type: 'page',\n id: definition.id.toString(),\n label: definition.name,\n elements: definition.elements,\n conditionallyShow: false,\n requiresAllConditionallyShowPredicates: false,\n },\n ]\n }\n }, [\n definition.elements,\n definition.id,\n definition.isMultiPage,\n definition.name,\n ])\n\n const pagesWithDynamicElements = React.useMemo<\n FormTypes.PageElement[]\n >(() => {\n return injectDynamicElements(pages) as FormTypes.PageElement[]\n }, [pages])\n\n // #endregion\n //\n //\n\n //\n //\n // #region Unsaved Changed\n\n const history = useHistory()\n\n const [isPreparingToSubmit, setIsPreparingToSubmit] =\n React.useState<boolean>(false)\n const [\n { isDirty, isNavigationAllowed, hasConfirmedNavigation, goToLocation },\n setUnsavedChangesState,\n ] = React.useState<{\n isDirty: boolean\n isNavigationAllowed: boolean\n hasConfirmedNavigation: boolean | null\n goToLocation: H.Location | null\n }>({\n isDirty: false,\n isNavigationAllowed: false,\n hasConfirmedNavigation: null,\n goToLocation: null,\n })\n const [promptOfflineSubmissionAttempt, setPromptOfflineSubmissionAttempt] =\n React.useState<boolean>(false)\n const [promptUploadingAttachments, setPromptUploadingAttachments] =\n React.useState<boolean>(false)\n const handleBlockedNavigation = React.useCallback<\n (location: H.Location, action: H.Action) => string | boolean\n >((location) => {\n setUnsavedChangesState((current) => ({\n ...current,\n goToLocation: location,\n hasConfirmedNavigation: false,\n }))\n return false\n }, [])\n\n const handleKeepGoing = React.useCallback(() => {\n setUnsavedChangesState((current) => ({\n ...current,\n goToLocation: null,\n hasConfirmedNavigation: null,\n }))\n }, [])\n\n const handleDiscardUnsavedChanges = React.useCallback(() => {\n setUnsavedChangesState((current) => ({\n ...current,\n isNavigationAllowed: true,\n hasConfirmedNavigation: true,\n }))\n sendGoogleAnalyticsEvent('oneblink_form_abandon', {\n formId: definition.id,\n formName: definition.name,\n })\n }, [definition.id, definition.name])\n\n React.useEffect(() => {\n if (hasConfirmedNavigation) {\n // Navigate to the previous blocked location with your navigate function\n if (goToLocation) {\n history.push(`${goToLocation.pathname}${goToLocation.search}`)\n if (handleNavigateAway) {\n handleNavigateAway()\n }\n } else {\n onCancel()\n }\n }\n }, [\n goToLocation,\n handleNavigateAway,\n hasConfirmedNavigation,\n history,\n onCancel,\n ])\n\n const handleCancel = React.useCallback(() => {\n if (isDirty) {\n setUnsavedChangesState((current) => ({\n ...current,\n hasConfirmedNavigation: false,\n }))\n } else {\n sendGoogleAnalyticsEvent('oneblink_form_abandon', {\n formId: definition.id,\n formName: definition.name,\n })\n onCancel()\n }\n }, [definition.id, definition.name, isDirty, onCancel])\n\n const allowNavigation = React.useCallback(() => {\n setUnsavedChangesState((current) => ({\n ...current,\n isNavigationAllowed: true,\n }))\n }, [])\n\n // #endregion Unsaved Changed\n //\n //\n\n //\n //\n // #region Conditional Logic\n\n const {\n formElementsConditionallyShown,\n conditionalLogicError,\n submissionConditionallyEnabled,\n } = useConditionalLogic({\n formElements: pagesWithDynamicElements,\n submission,\n enableSubmission: definition.enableSubmission,\n })\n\n // #endregion\n //\n //\n\n //\n //\n // #region Validation\n\n const validationErrorToastFocusElementRef =\n React.useRef<HTMLButtonElement>(null)\n const [isShowingValidationErrorsCard, setIsShowingValidationErrorsCard] =\n React.useState(false)\n const { validate } = useFormValidation(pages)\n\n const recaptchaType = React.useMemo(\n () => captchaType ?? 'CHECKBOX',\n [captchaType],\n )\n\n const formElementsValidation = React.useMemo<\n FormElementsValidation | undefined\n >(\n () =>\n !isReadOnly\n ? validate(\n submission,\n formElementsConditionallyShown,\n executedLookups ?? {},\n recaptchaType,\n isOffline,\n )\n : undefined,\n [\n isReadOnly,\n validate,\n submission,\n formElementsConditionallyShown,\n executedLookups,\n recaptchaType,\n isOffline,\n ],\n )\n\n React.useEffect(() => {\n if (!formElementsValidation) {\n setIsShowingValidationErrorsCard(false)\n }\n }, [formElementsValidation])\n\n // #endregion\n //\n //\n\n //\n //\n // #region Pages\n\n const [hasAttemptedSubmit, setHasAttemptedSubmit] = React.useState(false)\n\n const {\n visiblePages,\n isFirstVisiblePage,\n isLastVisiblePage,\n isDisplayingCurrentPageError,\n isShowingMultiplePages,\n isStepsHeaderActive,\n toggleStepsNavigation,\n currentPageIndex,\n currentPage,\n currentPageNumber,\n checkDisplayPageError,\n setPageId,\n goToPreviousPage,\n goToNextPage,\n scrollToTopOfPageHTMLElementRef,\n } = usePages({\n hasAttemptedSubmit,\n pages,\n formElementsValidation,\n formElementsConditionallyShown,\n })\n\n // #endregion\n //\n //\n\n //\n //\n // #region Submissions\n\n const getCurrentSubmissionData = React.useCallback(\n (stripBinaryData: boolean) => {\n const { model, captchaTokens } = cleanFormSubmissionModel(\n submission,\n definition.elements,\n formElementsConditionallyShown,\n stripBinaryData,\n )\n return {\n submission: model,\n captchaTokens,\n }\n },\n [definition.elements, formElementsConditionallyShown, submission],\n )\n\n const obFormContainerHTMLElementRef = React.useRef<HTMLDivElement>(null)\n React.useEffect(() => {\n const obFormContainerHTMLElement = obFormContainerHTMLElementRef.current\n if (obFormContainerHTMLElement) {\n console.log(\n 'Setting toast notifications to be appended to HTML Element',\n obFormContainerHTMLElement,\n )\n bulmaToast.setDefaults({\n position: 'bottom-right',\n opacity: 0.95,\n appendTo: obFormContainerHTMLElement,\n })\n }\n return () => {\n bulmaToast.resetDefaults()\n }\n }, [])\n\n const checkAttachmentsCanBeSubmitted = React.useCallback(\n (submission: SubmissionTypes.S3SubmissionData['submission']) => {\n // Prevent submission until all attachment uploads are finished\n // Unless the user is offline, in which case, the uploads will\n // be taken care of by a pending queue if enabled, otherwise\n // the user will be prompted to try again or save a draft.\n if (isOffline) {\n return true\n }\n const attachmentsAreUploading =\n attachmentsService.checkIfAttachmentsAreUploading(\n definition,\n submission,\n )\n\n if (attachmentsAreUploading) {\n if (isUsingFormsKey || !isPendingQueueEnabled) {\n bulmaToast.toast({\n message:\n 'Attachments are still uploading, please wait for them to finish before trying again.',\n type: 'is-primary',\n extraClasses: 'ob-toast cypress-still-uploading-toast',\n duration: 4000,\n pauseOnHover: true,\n closeOnClick: true,\n })\n return false\n } else {\n setPromptUploadingAttachments(true)\n return false\n }\n }\n\n return true\n },\n [definition, isOffline, isPendingQueueEnabled, isUsingFormsKey],\n )\n\n const checkBsbsCanBeSubmitted = React.useCallback(\n (submission: SubmissionTypes.S3SubmissionData['submission']) => {\n return !checkBsbsAreInvalid(definition, submission)\n },\n [definition],\n )\n\n const checkBsbAreValidating = React.useCallback(\n (submission: SubmissionTypes.S3SubmissionData['submission']) => {\n if (checkIfBsbsAreValidating(definition, submission)) {\n bulmaToast.toast({\n message:\n 'Bsb(s) are still being validated, please wait for them to finish before trying again.',\n type: 'is-primary',\n extraClasses: 'ob-toast cypress-still-validating-toast',\n duration: 4000,\n pauseOnHover: true,\n closeOnClick: true,\n })\n return false\n }\n\n return true\n },\n [definition],\n )\n\n const addCaptchaRef = React.useCallback((recaptcha: ReCAPTCHA) => {\n captchasRef.current.push(recaptcha)\n // this allows the FormElementCaptcha element to unregister any captchas\n return () => {\n captchasRef.current = captchasRef.current.filter(\n (recaptchaInstance) => recaptchaInstance !== recaptcha,\n )\n }\n }, [])\n\n const captchaContextValue = React.useMemo(\n () => ({\n captchaSiteKey,\n captchaType: recaptchaType,\n addCaptchaRef,\n }),\n [addCaptchaRef, captchaSiteKey, recaptchaType],\n )\n\n const resetRecaptchas = React.useCallback(() => {\n // unset the submission model value for each captcha element\n const updatedModel = { ...submission }\n formElementsService.forEachFormElement(definition.elements, (element) => {\n if (element.type === 'captcha') {\n updatedModel[element.name] = undefined\n }\n })\n // reset each captcha\n if (captchaType === 'CHECKBOX') {\n captchasRef.current.forEach((captcha) => {\n captcha.reset()\n })\n }\n\n setHasAttemptedSubmit(false)\n setFormSubmission((current) => {\n return { ...current, submission: updatedModel }\n })\n }, [definition.elements, setFormSubmission, submission, captchaType])\n\n const prepareSubmission = React.useCallback(\n async (\n continueWhilstAttachmentsAreUploading: boolean,\n ): Promise<ReturnType<typeof getCurrentSubmissionData> | undefined> => {\n const submissionData = getCurrentSubmissionData(false)\n if (!checkBsbAreValidating(submissionData.submission)) {\n return\n }\n if (formElementsValidation) {\n console.log('Validation errors', formElementsValidation)\n if (!shouldUseNavigableValidationErrorsNotification) {\n bulmaToast.toast({\n message: 'Please fix validation errors',\n type: 'is-danger',\n extraClasses: 'ob-toast cypress-invalid-submit-attempt',\n duration: 4000,\n pauseOnHover: true,\n closeOnClick: true,\n })\n }\n setIsShowingValidationErrorsCard(true)\n validationErrorToastFocusElementRef.current?.focus()\n return\n }\n if (!checkBsbsCanBeSubmitted(submissionData.submission)) {\n return\n }\n if (\n !continueWhilstAttachmentsAreUploading &&\n !checkAttachmentsCanBeSubmitted(submissionData.submission)\n ) {\n return\n }\n\n if (captchaType === 'INVISIBLE') {\n if (captchasRef.current.length) {\n const tokenResults = await Promise.allSettled(\n captchasRef.current.map((captcha) => captcha.executeAsync()),\n )\n\n const captchaTokens: string[] = []\n\n for (const result of tokenResults) {\n if (result.status === 'rejected' || !result.value) {\n console.log('Captcha token failure')\n bulmaToast.toast({\n message: 'Failed to get a captcha token',\n type: 'is-danger',\n extraClasses: 'ob-toast cypress-failed-captcha-token-creation',\n duration: 4000,\n pauseOnHover: true,\n closeOnClick: true,\n })\n return\n }\n captchaTokens.push(result.value)\n }\n\n submissionData.captchaTokens = captchaTokens\n }\n }\n\n // check if attachments exist\n const newSubmission = checkIfAttachmentsExist(\n definition,\n submissionData.submission,\n attachmentRetentionInDays,\n )\n if (newSubmission) {\n setFormSubmission((currentFormSubmission) => ({\n ...currentFormSubmission,\n submission: newSubmission,\n }))\n bulmaToast.toast({\n message:\n \"Some files that were included in your submission have been removed based on your administrator's data retention policy, please remove them and upload them again.\",\n type: 'is-danger',\n extraClasses: 'ob-toast cypress-invalid-submit-attempt',\n duration: 4000,\n pauseOnHover: true,\n closeOnClick: true,\n })\n return\n }\n\n if (isOffline && !isPendingQueueEnabled) {\n console.log('User is offline and form does not support a pending queue')\n setPromptOfflineSubmissionAttempt(true)\n return\n }\n return submissionData\n },\n [\n attachmentRetentionInDays,\n captchaType,\n checkAttachmentsCanBeSubmitted,\n checkBsbAreValidating,\n checkBsbsCanBeSubmitted,\n definition,\n formElementsValidation,\n getCurrentSubmissionData,\n isOffline,\n isPendingQueueEnabled,\n setFormSubmission,\n shouldUseNavigableValidationErrorsNotification,\n ],\n )\n\n const handleSubmit = React.useCallback(\n async (\n event:\n | React.FormEvent<HTMLFormElement>\n | React.MouseEvent<HTMLButtonElement, MouseEvent>,\n continueWhilstAttachmentsAreUploading: boolean,\n ) => {\n event.preventDefault()\n if (disabled || isReadOnly) return\n setHasAttemptedSubmit(true)\n\n setIsPreparingToSubmit(true)\n\n const submissionData = await prepareSubmission(\n continueWhilstAttachmentsAreUploading,\n )\n\n if (!submissionData) {\n setIsPreparingToSubmit(false)\n return\n }\n\n allowNavigation()\n\n // transplant injected options on the definition\n const elementsWithInjectedOptions = injectOptionsAcrossAllElements({\n contextElements: definition.elements,\n elements: definition.elements,\n submission: submissionData.submission,\n taskContext: taskContextValue,\n userProfile: userProfileForInjectables,\n })\n setIsPreparingToSubmit(false)\n resetRecaptchas()\n onSubmit({\n definition: {\n ...definition,\n elements: elementsWithInjectedOptions,\n },\n submission: submissionData.submission,\n recaptchas: submissionData.captchaTokens.map((token) => ({\n token,\n siteKey: captchaSiteKey as string,\n })),\n })\n sendGoogleAnalyticsEvent('oneblink_form_submit', {\n formId: definition.id,\n formName: definition.name,\n })\n },\n [\n disabled,\n isReadOnly,\n prepareSubmission,\n allowNavigation,\n definition,\n taskContextValue,\n userProfileForInjectables,\n resetRecaptchas,\n onSubmit,\n captchaSiteKey,\n ],\n )\n\n const handleSaveDraft = React.useCallback(\n (continueWhilstAttachmentsAreUploading: boolean) => {\n if (disabled) return\n if (onSaveDraft) {\n allowNavigation()\n\n // For drafts we don't need to save the captcha tokens,\n // they will need to prove they are not robot again\n const { submission } = getCurrentSubmissionData(false)\n if (!checkBsbAreValidating(submission)) {\n return\n }\n if (\n !continueWhilstAttachmentsAreUploading &&\n !checkAttachmentsCanBeSubmitted(submission)\n ) {\n return\n }\n onSaveDraft({\n definition,\n submission,\n backgroundUpload: continueWhilstAttachmentsAreUploading,\n lastElementUpdated,\n sectionState,\n })\n }\n },\n [\n allowNavigation,\n checkAttachmentsCanBeSubmitted,\n definition,\n disabled,\n getCurrentSubmissionData,\n onSaveDraft,\n checkBsbAreValidating,\n lastElementUpdated,\n sectionState,\n ],\n )\n\n const handleContinueWithAttachments = React.useCallback(\n (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n setPromptUploadingAttachments(false)\n if (hasAttemptedSubmit) {\n handleSubmit(e, true)\n } else {\n handleSaveDraft(true)\n }\n },\n [\n handleSubmit,\n setPromptUploadingAttachments,\n hasAttemptedSubmit,\n handleSaveDraft,\n ],\n )\n const handleWaitForAttachments = React.useCallback(() => {\n setPromptUploadingAttachments(false)\n }, [setPromptUploadingAttachments])\n\n // #endregion\n //\n //\n\n //\n //\n // #region Lookups\n\n const { handlePagesLookupResult } = useLookups(\n definition.id,\n setFormSubmission,\n )\n\n // #endregion\n //\n //\n\n //\n //\n // #region Submission/Definition Changes\n\n const handleChange = React.useCallback<NestedFormElementValueChangeHandler>(\n (element, { value, executedLookups, deleteSection, sectionState }) => {\n if (\n //This will ensure on a read only form that the summary and calculation elements\n //can still be displayed as it needs handleChange so it can render\n //due to the dynamic nature of the summary element.\n (disabled &&\n element.type !== 'summary' &&\n element.type !== 'calculation') ||\n element.type === 'page'\n ) {\n return\n }\n\n setUnsavedChangesState((current) => ({\n ...current,\n isDirty: true,\n }))\n if (element.type === 'section') {\n setFormSubmission((currentFormSubmission) => {\n const currentSectionState = currentFormSubmission.sectionState || []\n const existingSectionIndex = currentSectionState.findIndex(\n (section) => section.id === element.id,\n )\n const sectionIsInState = existingSectionIndex >= 0\n let newSectionState: SectionState\n if (sectionIsInState && deleteSection) {\n newSectionState = currentSectionState.filter(\n (section) => section.id !== element.id,\n )\n } else if (sectionIsInState) {\n // Update state of the section\n newSectionState = currentSectionState.map((section, index) =>\n index === existingSectionIndex\n ? {\n ...section,\n state:\n section.state === 'COLLAPSED' ? 'EXPANDED' : 'COLLAPSED',\n }\n : section,\n )\n } else {\n // Add the section to state\n newSectionState = [\n ...currentSectionState,\n {\n id: element.id,\n state: element.isCollapsed ? 'EXPANDED' : 'COLLAPSED',\n },\n ]\n }\n\n return {\n ...currentFormSubmission,\n sectionState: newSectionState,\n }\n })\n }\n // dont update the last element updated for elements the user cannot set the value of\n else if (element.type === 'summary' || element.type === 'calculation') {\n setFormSubmission((currentFormSubmission) => ({\n ...currentFormSubmission,\n submission: {\n ...currentFormSubmission.submission,\n [element.name]:\n typeof value === 'function'\n ? value(currentFormSubmission.submission[element.name])\n : value,\n },\n }))\n } else {\n setFormSubmission((currentFormSubmission) => {\n return {\n ...currentFormSubmission,\n submission: {\n ...currentFormSubmission.submission,\n [element.name]:\n typeof value === 'function'\n ? value(currentFormSubmission.submission[element.name])\n : value,\n },\n lastElementUpdated: element,\n executedLookups: {\n ...currentFormSubmission.executedLookups,\n [element.name]:\n typeof executedLookups === 'function'\n ? executedLookups(\n currentFormSubmission.executedLookups?.[element.name],\n )\n : executedLookups,\n },\n sectionState: sectionState\n ? typeof sectionState === 'function'\n ? sectionState(currentFormSubmission.sectionState)\n : sectionState\n : currentFormSubmission.sectionState,\n }\n })\n }\n },\n [disabled, setFormSubmission],\n )\n\n // #endregion\n //\n //\n\n const lastElementUpdatedExistsOnForm = React.useMemo(() => {\n return !!formElementsService.findFormElement(\n definition.elements,\n (el) => el.id === lastElementUpdated?.id,\n )\n }, [definition.elements, lastElementUpdated])\n\n const lastElementUpdatedPage = React.useMemo(() => {\n return definition.elements.find((pageElement: FormTypes.FormElement) => {\n if (pageElement.type === 'page') {\n return formElementsService.findFormElement(\n pageElement.elements,\n (el) => el.id === lastElementUpdated?.id,\n )\n }\n })\n }, [lastElementUpdated, definition])\n\n const [hasResumed, setHasResumed] = React.useState(false)\n React.useEffect(() => {\n if (!hasResumed) {\n if (lastElementUpdated && lastElementUpdatedExistsOnForm) {\n if (lastElementUpdatedPage) {\n setPageId(lastElementUpdatedPage.id)\n }\n const element = document.querySelector(\n `[data-element-id=\"${lastElementUpdated.id}\"]`,\n )\n if (element) {\n window.requestAnimationFrame(() => {\n element.scrollIntoView({ behavior: 'smooth' })\n })\n }\n }\n if (sectionState) {\n {\n setFormSubmission((currentFormSubmission) => ({\n ...currentFormSubmission,\n sectionState,\n }))\n }\n }\n setHasResumed(true)\n }\n }, [\n lastElementUpdated,\n hasResumed,\n lastElementUpdatedPage,\n lastElementUpdatedExistsOnForm,\n setPageId,\n sectionState,\n setFormSubmission,\n ])\n\n if (conditionalLogicError) {\n return (\n <>\n <div className=\"has-text-centered\">\n <MaterialIcon className=\"has-text-warning icon-x-large\">\n error\n </MaterialIcon>\n <h3 className=\"title is-3\">Bad Form Configuration</h3>\n <p className=\"cypress-conditional-logic-error-message\">\n {conditionalLogicError.message}\n </p>\n <p className=\"has-text-grey\">\n {localisationService.formatDatetimeLong(new Date())}\n </p>\n </div>\n </>\n )\n }\n\n return (\n <ThemeProvider theme={theme}>\n <LocalizationProvider dateAdapter={AdapterDateFns}>\n <ReplaceInjectablesOverridesContext.Provider\n value={replaceInjectablesOverrides}\n >\n <FormDefinitionContext.Provider value={definition}>\n <FormElementOptionsContextProvider>\n <FormElementLookupsContextProvider>\n <OneBlinkFormContainerContext.Provider\n value={obFormContainerHTMLElementRef.current}\n >\n <div\n className={clsx('ob-form-container', {\n 'is-showing-pages': isShowingMultiplePages,\n })}\n ref={obFormContainerHTMLElementRef}\n >\n <form\n name=\"obForm\"\n className={`ob-form cypress-ob-form ob-form__page-${\n currentPageIndex + 1\n }`}\n noValidate\n onSubmit={(e) => handleSubmit(e, false)}\n >\n <div>\n <div ref={scrollToTopOfPageHTMLElementRef} />\n {isShowingMultiplePages && (\n <div\n className={clsx('ob-steps-navigation', {\n 'is-active': isStepsHeaderActive,\n })}\n >\n <div\n className={clsx('ob-steps-navigation__header', {\n 'is-active': isStepsHeaderActive,\n })}\n onClick={toggleStepsNavigation}\n >\n <span className=\"icon is-invisible\">\n <MaterialIcon>keyboard_arrow_down</MaterialIcon>\n </span>\n <div className=\"steps-header-active-page\">\n {isDisplayingCurrentPageError ? (\n <span className=\"icon\">\n <MaterialIcon className=\"has-text-danger is-size-4\">\n warning\n </MaterialIcon>\n </span>\n ) : (\n <span className=\"steps-header-active-page-icon\">\n {currentPageNumber}\n </span>\n )}\n <span className=\"steps-header-active-page-label cypress-tablet-step-title\">\n {currentPage ? currentPage.label : ''}\n </span>\n </div>\n <span className=\"dropdown icon\">\n <MaterialIcon>keyboard_arrow_down</MaterialIcon>\n </span>\n </div>\n\n <div\n className={clsx('ob-steps-navigation__steps', {\n 'is-active': isStepsHeaderActive,\n })}\n >\n <div className=\"steps is-small is-horizontal-tablet cypress-steps\">\n {visiblePages.map(\n (\n page: FormTypes.PageElement,\n index: number,\n ) => {\n const hasErrors =\n checkDisplayPageError(page)\n return (\n <div\n key={page.id}\n id={`steps-navigation-step-${page.id}`}\n className={clsx(\n 'step-item cypress-step-item',\n {\n 'is-active':\n currentPage.id === page.id,\n 'is-completed':\n currentPageIndex > index,\n 'is-error': hasErrors,\n },\n )}\n onClick={(e) => {\n e.stopPropagation()\n if (page.id !== currentPage.id) {\n setPageId(page.id)\n }\n }}\n >\n <div\n className=\"step-marker step-marker-error ob-step-marker cypress-step-marker\"\n // @ts-expect-error ???\n name={`cypress-page-stepper-${index + 1}`}\n value={index + 1}\n >\n {hasErrors ? (\n <Tooltip title=\"Page has errors\">\n <span className=\"icon tooltip has-tooltip-top cypress-page-error\">\n <MaterialIcon className=\"has-text-danger is-size-3\">\n warning\n </MaterialIcon>\n </span>\n </Tooltip>\n ) : (\n <span>{index + 1}</span>\n )}\n </div>\n <div className=\"step-details ob-step-details\">\n <p\n className=\"step-title ob-step-title cypress-desktop-step-title\"\n id={`steps-navigation-step-label-${page.id}`}\n >\n {page.label}\n </p>\n </div>\n </div>\n )\n },\n )}\n </div>\n </div>\n </div>\n )}\n\n <div\n className={clsx('ob-steps-navigation__background', {\n 'is-active': isStepsHeaderActive,\n })}\n onClick={toggleStepsNavigation}\n />\n\n <div className=\"steps\">\n <div\n className={clsx('steps-content', {\n 'is-single-step': !isShowingMultiplePages,\n })}\n >\n <InjectPagesContext.Provider\n value={handlePagesLookupResult}\n >\n <GoogleMapsApiKeyContext.Provider\n value={googleMapsApiKey}\n >\n <AbnLookupAuthenticationGuidContext.Provider\n value={abnLookupAuthenticationGuid}\n >\n <ValidationIconConfigurationContext.Provider\n value={validationIcon}\n >\n <CaptchaContext.Provider\n value={captchaContextValue}\n >\n <AttachmentBlobsProvider>\n <FormIsReadOnlyContext.Provider\n value={isReadOnly}\n >\n <TaskContext.Provider\n value={taskContextValue}\n >\n <OnUploadAttachmentContext.Provider\n value={onUploadAttachment}\n >\n {visiblePages.map(\n (\n pageElement: FormTypes.PageElement,\n ) => (\n <PageFormElements\n key={pageElement.id}\n isActive={\n pageElement.id ===\n currentPage.id\n }\n formId={definition.id}\n formElementsConditionallyShown={\n formElementsConditionallyShown\n }\n formElementsValidation={\n formElementsValidation\n }\n displayValidationMessages={\n hasAttemptedSubmit ||\n isDisplayingCurrentPageError\n }\n pageElement={pageElement}\n onChange={handleChange}\n model={submission}\n setFormSubmission={\n setFormSubmission\n }\n sectionState={sectionState}\n />\n ),\n )}\n </OnUploadAttachmentContext.Provider>\n </TaskContext.Provider>\n </FormIsReadOnlyContext.Provider>\n </AttachmentBlobsProvider>\n </CaptchaContext.Provider>\n </ValidationIconConfigurationContext.Provider>\n </AbnLookupAuthenticationGuidContext.Provider>\n </GoogleMapsApiKeyContext.Provider>\n </InjectPagesContext.Provider>\n </div>\n\n {isShowingMultiplePages && (\n <div className=\"steps-actions\">\n <div className=\"steps-action\">\n <button\n type=\"button\"\n onClick={goToPreviousPage}\n disabled={isFirstVisiblePage}\n className=\"button is-light cypress-pages-previous\"\n >\n <span className=\"icon\">\n <MaterialIcon>\n keyboard_arrow_left\n </MaterialIcon>\n </span>\n <span>Back</span>\n </button>\n </div>\n <div className=\"step-progress-mobile cypress-steps-mobile\">\n {visiblePages.map(\n (page: FormTypes.PageElement, index) => (\n <div\n key={page.id}\n className={clsx(\n 'step-progress-mobile-dot',\n {\n 'is-active':\n currentPage.id === page.id,\n 'is-completed':\n currentPageIndex > index,\n 'has-background-danger':\n currentPage.id !== page.id &&\n checkDisplayPageError(page),\n },\n )}\n />\n ),\n )}\n </div>\n <div className=\"steps-action\">\n <button\n type=\"button\"\n onClick={goToNextPage}\n disabled={isLastVisiblePage}\n className=\"button is-light cypress-pages-next\"\n >\n <span>Next</span>\n <span className=\"icon\">\n <MaterialIcon>\n keyboard_arrow_right\n </MaterialIcon>\n </span>\n </button>\n </div>\n </div>\n )}\n </div>\n {!isReadOnly && (\n <div className=\"buttons ob-buttons ob-buttons-submit\">\n {onSaveDraft && !isInfoPage && (\n <button\n type=\"button\"\n className=\"button ob-button is-primary ob-button-save-draft cypress-save-draft-form\"\n onClick={() => handleSaveDraft(false)}\n disabled={isPreview || disabled}\n >\n <CustomisableButtonInner\n label={\n buttons?.saveDraft?.label || 'Save Draft'\n }\n icon={buttons?.saveDraft?.icon}\n />\n </button>\n )}\n <span className=\"ob-buttons-submit__spacer\"></span>\n {!isInfoPage && (\n <button\n type=\"button\"\n className=\"button ob-button is-light ob-button-submit-cancel cypress-cancel-form\"\n onClick={handleCancel}\n disabled={isPreview || disabled}\n >\n <CustomisableButtonInner\n label={buttons?.cancel?.label || 'Cancel'}\n icon={buttons?.cancel?.icon}\n />\n </button>\n )}\n {isLastVisiblePage && (\n <Tooltip\n title={\n submissionConditionallyEnabled\n ? ''\n : 'Submission disabled: Your inputs have not met the criteria for submission'\n }\n >\n <button\n type=\"submit\"\n className={clsx(\n 'button ob-button is-success ob-button-submit cypress-submit-form-button cypress-submit-form',\n { 'is-loading': isPreparingToSubmit },\n {\n 'ob-button-submit-is-disabled':\n submissionConditionallyEnabled,\n },\n )}\n disabled={\n isPreview ||\n disabled ||\n isPreparingToSubmit ||\n !submissionConditionallyEnabled\n }\n >\n <CustomisableButtonInner\n label={\n isInfoPage\n ? 'Done'\n : buttons?.submit?.label || 'Submit'\n }\n icon={buttons?.submit?.icon}\n />\n </button>\n </Tooltip>\n )}\n </div>\n )}\n </div>\n </form>\n\n {!isReadOnly && !isPreview && (\n <React.Fragment>\n <Prompt\n when={isDirty && !isNavigationAllowed}\n message={handleBlockedNavigation}\n />\n <Modal\n isOpen={hasConfirmedNavigation === false}\n title=\"Unsaved Changes\"\n cardClassName=\"cypress-cancel-confirm\"\n titleClassName=\"cypress-cancel-confirm-title\"\n bodyClassName=\"cypress-cancel-confirm-body\"\n actions={\n <>\n {onSaveDraft && (\n <button\n type=\"button\"\n className=\"button ob-button is-success cypress-cancel-confirm-save-draft\"\n onClick={() => handleSaveDraft(false)}\n >\n <CustomisableButtonInner\n label={\n buttons?.saveDraft?.label || 'Save Draft'\n }\n icon={buttons?.saveDraft?.icon}\n />\n </button>\n )}\n <span style={{ flex: 1 }}></span>\n <button\n type=\"button\"\n className=\"button ob-button is-light cypress-cancel-confirm-back\"\n onClick={handleKeepGoing}\n >\n <CustomisableButtonInner\n label={\n buttons?.cancelPromptNo?.label || 'Back'\n }\n icon={buttons?.cancelPromptNo?.icon}\n />\n </button>\n <button\n type=\"button\"\n className=\"button ob-button is-primary cypress-cancel-confirm-discard\"\n onClick={handleDiscardUnsavedChanges}\n autoFocus\n >\n <CustomisableButtonInner\n label={\n buttons?.cancelPromptYes?.label || 'Discard'\n }\n icon={buttons?.cancelPromptYes?.icon}\n />\n </button>\n </>\n }\n >\n <p>\n You have unsaved changes, are you sure you want\n discard them?\n </p>\n </Modal>\n <Modal\n isOpen={promptUploadingAttachments === true}\n title=\"Attachment upload in progress\"\n cardClassName=\"cypress-attachments-wait-continue\"\n titleClassName=\"cypress-attachments-confirm-wait-title\"\n bodyClassName=\"cypress-attachments-confirm-wait-body\"\n actions={\n <>\n <span style={{ flex: 1 }}></span>\n <button\n type=\"button\"\n className=\"button ob-button is-light cypress-attachments-confirm-wait\"\n onClick={handleWaitForAttachments}\n >\n Wait\n </button>\n <button\n type=\"button\"\n className=\"button ob-button is-primary cypress-attachments-confirm-continue\"\n onClick={handleContinueWithAttachments}\n autoFocus\n >\n Continue\n </button>\n </>\n }\n >\n <p>\n Your attachments are still uploading, do you want to\n wait for the uploads to complete or continue using\n the app? If you click continue the attachments will\n upload in the background. Do not close the app until\n the upload has been completed.\n </p>\n </Modal>\n\n <Modal\n isOpen={promptOfflineSubmissionAttempt}\n title=\"It looks like you're Offline\"\n className=\"ob-modal__offline-submission-attempt\"\n cardClassName=\"cypress-submission-offline has-text-centered\"\n titleClassName=\"cypress-offline-title\"\n bodyClassName=\"cypress-offline-body\"\n actions={\n <>\n {onSaveDraft && (\n <button\n type=\"button\"\n className=\"button ob-button ob-button__offline-submission-attempt-save-draft is-success\"\n onClick={() => handleSaveDraft(false)}\n >\n <CustomisableButtonInner\n label={\n buttons?.saveDraft?.label || 'Save Draft'\n }\n icon={buttons?.saveDraft?.icon}\n />\n </button>\n )}\n <span style={{ flex: 1 }}></span>\n <button\n className=\"button ob-button ob-button__offline-submission-attempt-cancel is-light\"\n onClick={() =>\n setPromptOfflineSubmissionAttempt(false)\n }\n >\n Cancel\n </button>\n <button\n className=\"button ob-button ob-button__offline-submission-attempt-try-again is-primary\"\n onClick={(e) => {\n setPromptOfflineSubmissionAttempt(false)\n handleSubmit(e, false)\n }}\n autoFocus\n >\n Try Again\n </button>\n </>\n }\n >\n <p className=\"ob-modal__offline-submission-attempt-message\">\n You cannot submit this form while offline, please\n try again when connectivity is restored.\n {onSaveDraft && (\n <span className=\"ob-modal__offline-submission-attempt-save-draft-message\">\n {' '}\n Alternatively, click the{' '}\n <b>\n {buttons?.saveDraft?.label || 'Save Draft'}\n </b>{' '}\n button below to come back to this later.\n </span>\n )}\n </p>\n <MaterialIcon className=\"has-text-warning icon-x-large ob-modal__offline-submission-attempt-icon\">\n wifi_off\n </MaterialIcon>\n </Modal>\n </React.Fragment>\n )}\n {shouldUseNavigableValidationErrorsNotification &&\n isShowingValidationErrorsCard && (\n <ValidationErrorsCard\n visiblePages={visiblePages}\n formElementsValidation={formElementsValidation}\n setPageId={setPageId}\n currentPage={currentPage}\n navigationTopOffset={\n navigableValidationErrorsNotificationSettings?.navigationTopOffset ??\n 'CALCULATE'\n }\n scrollableContainerId={\n navigableValidationErrorsNotificationSettings?.scrollableContainerId\n }\n validationErrorToastFocusElementRef={\n validationErrorToastFocusElementRef\n }\n />\n )}\n </div>\n </OneBlinkFormContainerContext.Provider>\n </FormElementLookupsContextProvider>\n </FormElementOptionsContextProvider>\n </FormDefinitionContext.Provider>\n </ReplaceInjectablesOverridesContext.Provider>\n </LocalizationProvider>\n </ThemeProvider>\n )\n}\n\nexport default React.memo(OneBlinkFormBase)\n"]}
|
@@ -11,7 +11,7 @@ import Sketch from '@arcgis/core/widgets/Sketch';
|
|
11
11
|
import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer';
|
12
12
|
import Graphic from '@arcgis/core/Graphic';
|
13
13
|
import Popup from '@arcgis/core/widgets/Popup';
|
14
|
-
import { Point, SpatialReference, } from '@arcgis/core/geometry';
|
14
|
+
import { Point, SpatialReference, Polyline, } from '@arcgis/core/geometry';
|
15
15
|
import TextSymbol from '@arcgis/core/symbols/TextSymbol';
|
16
16
|
import * as geometryEngine from '@arcgis/core/geometry/geometryEngine';
|
17
17
|
import { Box, Divider, IconButton } from '@mui/material';
|
@@ -109,6 +109,8 @@ function FormElementArcGISWebMap({ element, id, value, onChange, setIsDirty, ...
|
|
109
109
|
};
|
110
110
|
const addMeasurementLabels = React.useCallback((graphics) => {
|
111
111
|
var _a, _b;
|
112
|
+
if (!element.measurementDimensionsEnabled)
|
113
|
+
return;
|
112
114
|
const spatialRef = new SpatialReference({ wkid: 3857 });
|
113
115
|
const measurementLayer = measurementLayerRef.current;
|
114
116
|
const mapView = mapViewRef.current;
|
@@ -129,7 +131,6 @@ function FormElementArcGISWebMap({ element, id, value, onChange, setIsDirty, ...
|
|
129
131
|
}
|
130
132
|
const graphics = [];
|
131
133
|
for (let i = 1; i < points.length; i++) {
|
132
|
-
const distance = geometryEngine.distance(points[i], points[i - 1], distanceUnit);
|
133
134
|
const x1 = points[i].x;
|
134
135
|
const x2 = points[i - 1].x;
|
135
136
|
const y1 = points[i].y;
|
@@ -156,6 +157,16 @@ function FormElementArcGISWebMap({ element, id, value, onChange, setIsDirty, ...
|
|
156
157
|
screenPoint.x += offsetScreenX;
|
157
158
|
screenPoint.y -= offsetScreenY;
|
158
159
|
const offsetMapPoint = mapView.toMap(screenPoint);
|
160
|
+
const polyline = new Polyline({
|
161
|
+
paths: [
|
162
|
+
[
|
163
|
+
[points[i].longitude, points[i].latitude],
|
164
|
+
[points[i - 1].longitude, points[i - 1].latitude],
|
165
|
+
],
|
166
|
+
],
|
167
|
+
spatialReference: { wkid: 4326 },
|
168
|
+
});
|
169
|
+
const distance = geometryEngine.geodesicLength(polyline, distanceUnit);
|
159
170
|
graphics.push(new Graphic({
|
160
171
|
geometry: offsetMapPoint,
|
161
172
|
symbol: new TextSymbol({
|
@@ -170,7 +181,7 @@ function FormElementArcGISWebMap({ element, id, value, onChange, setIsDirty, ...
|
|
170
181
|
measurementLayer.addMany(graphics);
|
171
182
|
(_a = mapViewRef.current) === null || _a === void 0 ? void 0 : _a.map.reorder(measurementLayer, (_b = mapViewRef.current) === null || _b === void 0 ? void 0 : _b.map.layers.length);
|
172
183
|
}
|
173
|
-
}, []);
|
184
|
+
}, [element]);
|
174
185
|
const clearMeasurementLabels = React.useCallback(() => {
|
175
186
|
if (measurementLayerRef.current) {
|
176
187
|
measurementLayerRef.current.removeAll();
|
@@ -437,13 +448,15 @@ function FormElementArcGISWebMap({ element, id, value, onChange, setIsDirty, ...
|
|
437
448
|
drawingLayerRef.current = drawingLayer;
|
438
449
|
map.layers.add(drawingLayer);
|
439
450
|
// Add measurement layer above drawing layer
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
451
|
+
if (element.measurementDimensionsEnabled) {
|
452
|
+
const measurementLayer = new GraphicsLayer({
|
453
|
+
id: uuid(),
|
454
|
+
title: 'Measurements',
|
455
|
+
listMode: 'hide',
|
456
|
+
});
|
457
|
+
measurementLayerRef.current = measurementLayer;
|
458
|
+
map.layers.add(measurementLayer);
|
459
|
+
}
|
447
460
|
const sketch = new Sketch({
|
448
461
|
view,
|
449
462
|
layer: drawingLayer,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ArcGISWebMap.js","sourceRoot":"","sources":["../../src/components/ArcGISWebMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,OAAO,MAAM,4BAA4B,CAAA;AAChD,OAAO,MAAM,MAAM,qBAAqB,CAAA;AACxC,OAAO,IAAI,MAAM,2BAA2B,CAAA;AAC5C,OAAO,MAAM,MAAM,6BAA6B,CAAA;AAChD,OAAO,IAAI,MAAM,2BAA2B,CAAA;AAC5C,OAAO,SAAS,MAAM,gCAAgC,CAAA;AACtD,OAAO,MAAM,MAAM,6BAA6B,CAAA;AAChD,OAAO,cAAc,MAAM,qCAAqC,CAAA;AAChE,OAAO,MAAM,MAAM,6BAA6B,CAAA;AAChD,OAAO,aAAa,MAAM,mC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AAC,EACD,cAAc,EAAE,oBAAoB,EACpC,UAAU,EAAE,aAAa,CAAC,OAAO,GACjC,CACH,CACG,CACL,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { FormTypes } from '@oneblink/types'\nimport MapView from '@arcgis/core/views/MapView'\nimport WebMap from '@arcgis/core/WebMap'\nimport Home from '@arcgis/core/widgets/Home'\nimport Search from '@arcgis/core/widgets/Search'\nimport Zoom from '@arcgis/core/widgets/Zoom'\nimport LayerList from '@arcgis/core/widgets/LayerList'\nimport Expand from '@arcgis/core/widgets/Expand'\nimport BaseMapGallery from '@arcgis/core/widgets/BasemapGallery'\nimport Sketch from '@arcgis/core/widgets/Sketch'\nimport GraphicsLayer from '@arcgis/core/layers/GraphicsLayer'\nimport Graphic from '@arcgis/core/Graphic'\nimport Layer from '@arcgis/core/layers/Layer'\nimport Popup from '@arcgis/core/widgets/Popup'\nimport {\n Point,\n Polygon,\n SpatialReference,\n Polyline,\n} from '@arcgis/core/geometry'\nimport TextSymbol from '@arcgis/core/symbols/TextSymbol'\nimport * as geometryEngine from '@arcgis/core/geometry/geometryEngine'\nimport { Box, Divider, IconButton } from '@mui/material'\nimport throttle from 'lodash.throttle'\nimport { localisationService } from '@oneblink/apps'\nimport { v4 as uuid } from 'uuid'\n\nimport OnLoading from '../components/renderer/OnLoading'\nimport MaterialIcon from './MaterialIcon'\n\nimport useIsPageVisible from '../hooks/useIsPageVisible'\nimport { ArcGISWebMapElementValue } from '@oneblink/types/typescript/arcgis'\nimport { FormElementValueChangeHandler } from '../types/form'\nimport '../styles/arcgis-external.css'\n\ntype Props = {\n element: FormTypes.ArcGISWebMapElement\n id: string\n value: ArcGISWebMapElementValue | undefined\n onChange: FormElementValueChangeHandler<ArcGISWebMapElementValue>\n 'aria-describedby'?: string\n setIsDirty: () => void\n}\n\ntype SketchCreateTool = Parameters<Sketch['create']>[0]\n\nfunction DrawingOptionsList({\n options,\n sketchTool,\n onClose,\n sketchToolType,\n setSelectedGraphicAttributes,\n}: {\n options: { id: string; label: string; value: string; description?: string }[]\n onClose: () => void\n sketchTool: Sketch\n sketchToolType: SketchCreateTool\n setSelectedGraphicAttributes: (opt: {\n label: string\n value: string\n description?: string\n }) => void\n}) {\n return (\n <div className=\"esri-widget\">\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <b style={{ padding: '0.5rem' }}>Select an option</b>\n <IconButton\n onClick={(e) => {\n e.stopPropagation()\n onClose()\n }}\n size=\"small\"\n data-cypress=\"copy-to-clip-board-button\"\n >\n <MaterialIcon fontSize=\"small\">close</MaterialIcon>\n </IconButton>\n </Box>\n <Divider sx={{ backgroundColor: 'unset', margin: '0px 8px' }} />\n <Box sx={{ maxHeight: '200px', overflowY: 'auto' }}>\n {options?.map(({ id, value, label, description }) => (\n <div\n key={id}\n className=\"ob-list__item is-clickable\"\n style={{ alignItems: 'center' }}\n onClick={() => {\n onClose()\n sketchTool?.create(sketchToolType)\n setSelectedGraphicAttributes({ value, label, description })\n }}\n >\n {label}\n </div>\n ))}\n </Box>\n </div>\n )\n}\n\nfunction FormElementArcGISWebMap({\n element,\n id,\n value,\n onChange,\n setIsDirty,\n ...props\n}: Props) {\n const ref = React.useRef<HTMLDivElement | null>(null)\n const layerPanelRef = React.useRef<Expand>()\n const mapGalleryPanelRef = React.useRef<Expand>()\n const sketchToolRef = React.useRef<Sketch>()\n const drawingLayerRef = React.useRef<GraphicsLayer>()\n const selectedGraphicForUpdate = React.useRef<string>()\n const mapViewRef = React.useRef<MapView>()\n const measurementLayerRef = React.useRef<GraphicsLayer>()\n\n const [overlayLayerIds, setOverlayLayerIds] = React.useState<string[]>()\n const [loadError, setLoadError] = React.useState<Error>()\n const [isLoading, setIsLoading] = React.useState<boolean>(false)\n const isPageVisible = useIsPageVisible()\n const [selectedGraphicAttributes, setSelectedGraphicAttributes] =\n React.useState<{\n value: string\n label: string\n description?: string\n }>()\n // only used when an allowed drawing tool also has a list of graphic attribute options to display to the user\n const [activeSketchToolMenu, setActiveSketchToolMenu] =\n React.useState<SketchCreateTool>()\n\n const updateDrawingInputSubmissionValue = React.useCallback(() => {\n const updatedGraphics = drawingLayerRef.current?.graphics\n .toArray()\n .map((graphic) => graphic.toJSON())\n\n onChange(element, {\n value: {\n ...(value || {}),\n drawingLayer: updatedGraphics,\n userInput: updatedGraphics,\n },\n })\n\n setIsDirty()\n }, [element, onChange, setIsDirty, value])\n\n const updateMapViewSubmissionValue = React.useCallback(() => {\n const zoom = mapViewRef.current?.zoom\n const latitude = mapViewRef.current?.center.latitude\n const longitude = mapViewRef.current?.center.longitude\n if (zoom && latitude && longitude) {\n onChange(element, {\n value: {\n ...(value || {}),\n view: {\n zoom,\n latitude,\n longitude,\n },\n },\n })\n }\n }, [element, onChange, value])\n\n const getGeometryPoints = (\n geom: __esri.Geometry,\n spatialRef: SpatialReference,\n ) => {\n if (geom.type === 'polygon') {\n const polygon = geom as Polygon\n return polygon.rings[0].map(\n (ring) =>\n new Point({\n x: ring[0],\n y: ring[1],\n spatialReference: spatialRef,\n }),\n )\n } else if (geom.type === 'polyline') {\n const polyline = geom as Polyline\n return polyline.paths[0].map(\n (path) =>\n new Point({\n x: path[0],\n y: path[1],\n spatialReference: spatialRef,\n }),\n )\n }\n }\n\n const addMeasurementLabels = React.useCallback(\n (graphics: __esri.Graphic[]) => {\n const spatialRef = new SpatialReference({ wkid: 3857 })\n const measurementLayer = measurementLayerRef.current\n const mapView = mapViewRef.current\n if (!measurementLayer || !mapView) return\n measurementLayer.removeAll()\n\n for (const graphic of graphics) {\n const geom = graphic.geometry\n if (!geom || (geom.type !== 'polygon' && geom.type !== 'polyline'))\n continue\n\n const points = getGeometryPoints(geom, spatialRef)\n if (!points) continue\n\n const { distanceUnit, distanceUnitShortName } =\n localisationService.getDistanceUnits()\n if (distanceUnit !== 'meters' && distanceUnit !== 'feet') {\n console.warn(\n 'Unsupported distance unit provided in tenant configuration: ',\n distanceUnit,\n )\n return\n }\n const graphics: Graphic[] = []\n\n for (let i = 1; i < points.length; i++) {\n const distance = geometryEngine.distance(\n points[i],\n points[i - 1],\n distanceUnit,\n )\n\n const x1 = points[i].x\n const x2 = points[i - 1].x\n const y1 = points[i].y\n const y2 = points[i - 1].y\n\n const midpoint = new Point({\n x: (x1 + x2) / 2,\n y: (y1 + y2) / 2,\n spatialReference: spatialRef,\n })\n\n // Angle of the measurement label - this will be rotated to be parallel with the polygon or polyline edge\n const dx = x2 - x1\n const dy = y2 - y1\n const radians = Math.atan2(dy, dx)\n let angle = radians * (-180 / Math.PI)\n if (angle > 90 || angle < -90) {\n angle += 180\n }\n\n // offset of the measurement label against the edge of the polygon/polyline it's measuring\n const pixelOffset = 10\n const normalAngle = radians + Math.PI / 2\n const offsetScreenX = pixelOffset * Math.cos(normalAngle)\n const offsetScreenY = pixelOffset * Math.sin(normalAngle)\n\n const screenPoint = mapView.toScreen(midpoint)\n screenPoint.x += offsetScreenX\n screenPoint.y -= offsetScreenY\n const offsetMapPoint = mapView.toMap(screenPoint)\n\n graphics.push(\n new Graphic({\n geometry: offsetMapPoint,\n symbol: new TextSymbol({\n text: distance.toFixed(0) + distanceUnitShortName,\n color: 'black',\n haloColor: 'white',\n haloSize: 1,\n angle,\n }),\n }),\n )\n }\n\n measurementLayer.addMany(graphics)\n mapViewRef.current?.map.reorder(\n measurementLayer,\n mapViewRef.current?.map.layers.length,\n )\n }\n },\n [],\n )\n\n const clearMeasurementLabels = React.useCallback(() => {\n if (measurementLayerRef.current) {\n measurementLayerRef.current.removeAll()\n }\n }, [])\n\n React.useEffect(() => {\n if (element.readOnly) return\n // event listeners for drawing tool creates/updates/deletes\n // these need to be removed and recreated when the submission value changes\n // to ensure they always have access to the latest submission value\n const createListener = sketchToolRef.current?.on(\n 'create',\n throttle((sketchEvent: __esri.SketchCreateEvent) => {\n if (sketchEvent.state === 'active') {\n addMeasurementLabels([sketchEvent.graphic])\n }\n if (sketchEvent.state === 'complete') {\n if (selectedGraphicAttributes) {\n sketchEvent.graphic.attributes = {\n name: selectedGraphicAttributes.value,\n label: selectedGraphicAttributes.label,\n description: selectedGraphicAttributes.description,\n }\n setSelectedGraphicAttributes(undefined)\n }\n updateDrawingInputSubmissionValue()\n clearMeasurementLabels()\n }\n if (sketchEvent.state === 'cancel') {\n setSelectedGraphicAttributes(undefined)\n clearMeasurementLabels()\n }\n }, 100),\n )\n\n const updateListener = sketchToolRef.current?.on(\n 'update',\n throttle((sketchEvent: __esri.SketchUpdateEvent) => {\n if (sketchEvent.state === 'active') {\n addMeasurementLabels(sketchEvent.graphics)\n }\n if (sketchEvent.state === 'complete') {\n // only update the submission value if the graphic's geometry was actually changed\n if (\n JSON.stringify(sketchEvent.graphics[0].geometry.toJSON()) !==\n selectedGraphicForUpdate.current\n ) {\n updateDrawingInputSubmissionValue()\n }\n selectedGraphicForUpdate.current = undefined\n clearMeasurementLabels()\n }\n if (sketchEvent.state === 'start') {\n selectedGraphicForUpdate.current = JSON.stringify(\n sketchEvent.graphics[0].geometry.clone().toJSON(),\n )\n addMeasurementLabels(sketchEvent.graphics)\n }\n }, 100),\n )\n\n const deleteListener = sketchToolRef.current?.on('delete', () => {\n mapViewRef.current?.closePopup()\n updateDrawingInputSubmissionValue()\n clearMeasurementLabels()\n })\n\n const mapViewChangeListener = mapViewRef.current?.watch(\n 'stationary',\n () => {\n const mapView = mapViewRef.current\n if (mapView && mapView.stationary) {\n const hasViewChanged =\n mapView.zoom !== value?.view?.zoom ||\n mapView.center.longitude !== value?.view?.longitude ||\n mapView.center.latitude !== value?.view?.latitude\n if (hasViewChanged) {\n updateMapViewSubmissionValue()\n }\n }\n },\n )\n\n const sketchToolListener = sketchToolRef.current?.viewModel.watch(\n 'activeTool',\n () => {\n if (selectedGraphicAttributes) {\n return\n }\n const activeTool = sketchToolRef.current?.activeTool\n const hasGraphicAttributeOptions = !!element.allowedDrawingTools?.find(\n (tool) => tool.type === activeTool,\n )?.graphicAttributeOptions?.length\n\n if (activeTool) {\n if (\n hasGraphicAttributeOptions &&\n (activeTool === 'point' ||\n activeTool === 'polygon' ||\n activeTool === 'circle' ||\n activeTool === 'rectangle' ||\n activeTool === 'polyline')\n ) {\n // the sketch.create() fn only allows active tools of the above 5 types\n // hence we must check above to keep the types happy further down the line\n sketchToolRef.current?.cancel()\n setActiveSketchToolMenu(activeTool)\n } else {\n setActiveSketchToolMenu(undefined)\n }\n }\n },\n )\n\n mapViewRef.current?.on('click', (event) => {\n mapViewRef.current?.hitTest(event).then((response) => {\n // the \"hit test\" will typically yield the graphic we want to display the popup for,\n // and an ArcGIS built-in graphic which highlights the selected graphic.\n // By filtering for the graphic with the \"label\" attribute, we're able to reliably\n // get the graphic we want to display the popup for.\n const result = response.results\n .filter((r) => r.type === 'graphic')\n .find((r) => !!r.graphic.attributes?.label)\n\n if (result) {\n mapViewRef.current?.openPopup({\n title: result.graphic.attributes.label,\n content: result.graphic.attributes.description,\n })\n }\n })\n })\n\n return () => {\n createListener?.remove()\n updateListener?.remove()\n deleteListener?.remove()\n mapViewChangeListener?.remove()\n sketchToolListener?.remove()\n }\n }, [\n isLoading,\n value,\n updateDrawingInputSubmissionValue,\n updateMapViewSubmissionValue,\n element,\n selectedGraphicAttributes,\n addMeasurementLabels,\n clearMeasurementLabels,\n ])\n\n const onSubmissionValueChange = React.useCallback(() => {\n const view = mapViewRef.current\n const map = mapViewRef.current?.map\n if (!view || !map) return\n\n const newLayerIds = value?.layers?.map((l) => l.id)\n // remove map layers no longer in submission value\n if (overlayLayerIds) {\n const layersToRemove = overlayLayerIds.reduce((toRemove: Layer[], id) => {\n if (!newLayerIds?.includes(id)) {\n const layer = map.layers.find((layer) => layer.id === id)\n if (layer) toRemove.push(layer)\n }\n return toRemove\n }, [])\n map.layers.removeMany(layersToRemove)\n }\n\n if (value?.layers) {\n // determine if a layer is new or existing and handle accordingly\n for (const layer of value.layers) {\n const existingLayer = map.layers.find(\n (mapLayer) => mapLayer.id === layer.id,\n )\n if (!existingLayer) {\n const newLayer = new GraphicsLayer({\n title: layer.title as string,\n id: layer.id,\n })\n newLayer.addMany(layer.graphics.map((g) => Graphic.fromJSON(g)))\n newLayer.visible =\n typeof layer.visible === 'boolean' ? layer.visible : true\n map.layers.add(newLayer)\n } else if (existingLayer && existingLayer.type === 'graphics') {\n const existingGraphicLayer = existingLayer as GraphicsLayer\n existingGraphicLayer.title = layer.title\n existingGraphicLayer.graphics.removeAll()\n existingGraphicLayer.addMany(\n layer.graphics.map((g) => Graphic.fromJSON(g)),\n )\n existingGraphicLayer.visible =\n typeof layer.visible === 'boolean' ? layer.visible : true\n }\n }\n }\n\n // finally, set the new layer ids in state\n setOverlayLayerIds(newLayerIds)\n\n // update the web map's drawing layers\n const drawingLayer = drawingLayerRef.current\n if (value?.drawingLayer && drawingLayer) {\n drawingLayer.removeAll()\n drawingLayer.addMany(value.drawingLayer.map((g) => Graphic.fromJSON(g)))\n }\n if (value?.view) {\n view.zoom = value.view.zoom\n view.center = new Point({\n latitude: value.view.latitude,\n longitude: value.view.longitude,\n })\n }\n }, [overlayLayerIds, value])\n\n React.useEffect(() => {\n if (!isLoading && mapViewRef.current) {\n onSubmissionValueChange()\n }\n // only run the above when the submission value changes or the map finishes loading\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value, isLoading])\n\n const drawingOptionsContainerId = `OneBlinkDrawingOptionsSelector-${element.id}`\n\n React.useEffect(() => {\n const loadMap = async () => {\n try {\n const map = new WebMap({\n portalItem: {\n id: element.webMapId,\n },\n basemap: element.basemapId || 'streets',\n })\n await map.load()\n\n const view = new MapView({\n map: map,\n container: ref.current || undefined,\n popup: new Popup({\n dockEnabled: true,\n dockOptions: {\n buttonEnabled: false,\n breakpoint: false,\n position: 'bottom-left',\n },\n }),\n })\n\n // remove default widgets\n const components = view.ui.getComponents()\n for (const component of components) {\n view.ui.remove(component)\n }\n\n if (element.addressSearchWidgetEnabled) {\n view.ui.add(\n new Search({\n view,\n }),\n 'top-left',\n )\n }\n\n if (element.homeWidgetEnabled) {\n view.ui.add(\n new Home({\n view,\n }),\n 'top-left',\n )\n }\n\n view.ui.add(\n new Zoom({\n view,\n }),\n 'bottom-right',\n )\n\n const layerList = new LayerList({\n view,\n })\n\n layerPanelRef.current = new Expand({\n expandIcon: 'layers',\n view,\n content: layerList,\n expanded: element.showLayerPanel,\n mode: 'floating',\n visible: false,\n })\n\n view.ui.add(layerPanelRef.current, 'top-right')\n\n const baseMapGallery = new BaseMapGallery({ view })\n\n mapGalleryPanelRef.current = new Expand({\n expandIcon: 'basemap',\n view,\n content: baseMapGallery,\n mode: 'floating',\n visible: false,\n })\n\n view.ui.add(mapGalleryPanelRef.current, 'top-left')\n\n if (!element.readOnly && element.allowedDrawingTools?.length) {\n const drawingLayer = new GraphicsLayer({\n id: uuid(),\n title: 'Drawing',\n })\n drawingLayerRef.current = drawingLayer\n map.layers.add(drawingLayer)\n\n // Add measurement layer above drawing layer\n const measurementLayer = new GraphicsLayer({\n id: uuid(),\n title: 'Measurements',\n listMode: 'hide',\n })\n measurementLayerRef.current = measurementLayer\n map.layers.add(measurementLayer)\n\n const sketch = new Sketch({\n view,\n layer: drawingLayer,\n creationMode: 'single',\n layout: 'vertical',\n availableCreateTools: [\n 'point',\n 'polyline',\n 'polygon',\n 'rectangle',\n 'circle',\n ].filter((createTool) =>\n element.allowedDrawingTools?.find(\n (tool) => tool.type === createTool,\n ),\n ),\n // hiding the below by default\n visibleElements: {\n duplicateButton: false,\n settingsMenu: false,\n undoRedoMenu: false,\n selectionTools: {\n 'lasso-selection': false,\n 'rectangle-selection': false,\n },\n },\n })\n sketchToolRef.current = sketch\n view.ui.add(sketch, 'bottom-right')\n view.ui.add(drawingOptionsContainerId, 'bottom-right')\n }\n\n // once the view has loaded\n view.when(() => {\n mapViewRef.current = view\n setIsLoading(false)\n })\n } catch (e) {\n console.warn('Error while trying to load arcgis web map ', e)\n setLoadError(e as Error)\n setIsLoading(false)\n }\n }\n\n if (!mapViewRef.current && !isLoading) {\n setIsLoading(true)\n loadMap()\n }\n }, [drawingOptionsContainerId, element, isLoading, value])\n\n React.useEffect(() => {\n if (!isLoading) {\n if (isPageVisible) {\n if (layerPanelRef.current) {\n layerPanelRef.current.visible = true\n }\n if (mapGalleryPanelRef.current) {\n mapGalleryPanelRef.current.visible = true\n }\n } else {\n if (layerPanelRef.current) {\n layerPanelRef.current.visible = false\n }\n if (mapGalleryPanelRef.current) {\n mapGalleryPanelRef.current.visible = false\n }\n }\n }\n }, [isPageVisible, isLoading])\n\n if (loadError) {\n return (\n <figure className=\"ob-figure\">\n <div className=\"figure-content has-text-centered\">\n <MaterialIcon className=\"icon-large has-margin-bottom-6 has-text-warning\">\n error\n </MaterialIcon>\n <h4 className=\"title is-4\">We were unable to display your web map</h4>\n <p>{loadError.message}</p>\n </div>\n </figure>\n )\n }\n\n return (\n <>\n {isLoading && <OnLoading />}\n <div\n className=\"arcgis-web-map\"\n ref={ref}\n id={id}\n aria-describedby={props['aria-describedby']}\n />\n <div id={drawingOptionsContainerId}>\n {!!activeSketchToolMenu && sketchToolRef.current && (\n <DrawingOptionsList\n options={\n element.allowedDrawingTools?.find(\n (tool) => tool.type === activeSketchToolMenu,\n )?.graphicAttributeOptions || []\n }\n onClose={() => setActiveSketchToolMenu(undefined)}\n setSelectedGraphicAttributes={(opt) => {\n setSelectedGraphicAttributes(opt)\n }}\n sketchToolType={activeSketchToolMenu}\n sketchTool={sketchToolRef.current}\n />\n )}\n </div>\n </>\n )\n}\n\nexport default React.memo(FormElementArcGISWebMap)\n"]}
|
1
|
+
{"version":3,"file":"ArcGISWebMap.js","sourceRoot":"","sources":["../../src/components/ArcGISWebMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,OAAO,MAAM,4BAA4B,CAAA;AAChD,OAAO,MAAM,MAAM,qBAAqB,CAAA;AACxC,OAAO,IAAI,MAAM,2BAA2B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BAAI,SAAS,EAAC,YAAY,6CAA4C;gBACtE,+BAAI,SAAS,CAAC,OAAO,CAAK,CACtB,CACC,CACV,CAAA;IACH,CAAC;IAED,OAAO,CACL;QACG,SAAS,IAAI,oBAAC,SAAS,OAAG;QAC3B,6BACE,SAAS,EAAC,gBAAgB,EAC1B,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,EAAE,sBACY,KAAK,CAAC,kBAAkB,CAAC,GAC3C;QACF,6BAAK,EAAE,EAAE,yBAAyB,IAC/B,CAAC,CAAC,oBAAoB,IAAI,aAAa,CAAC,OAAO,IAAI,CAClD,oBAAC,kBAAkB,IACjB,OAAO,EACL,CAAA,MAAA,MAAA,OAAO,CAAC,mBAAmB,0CAAE,IAAI,CAC/B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,oBAAoB,CAC7C,0CAAE,uBAAuB,KAAI,EAAE,EAElC,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,SAAS,CAAC,EACjD,4BAA4B,EAAE,CAAC,GAAG,EAAE,EAAE;gBACpC,4BAA4B,CAAC,GAAG,CAAC,CAAA;YACnC,CAAC,EACD,cAAc,EAAE,oBAAoB,EACpC,UAAU,EAAE,aAAa,CAAC,OAAO,GACjC,CACH,CACG,CACL,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { FormTypes } from '@oneblink/types'\nimport MapView from '@arcgis/core/views/MapView'\nimport WebMap from '@arcgis/core/WebMap'\nimport Home from '@arcgis/core/widgets/Home'\nimport Search from '@arcgis/core/widgets/Search'\nimport Zoom from '@arcgis/core/widgets/Zoom'\nimport LayerList from '@arcgis/core/widgets/LayerList'\nimport Expand from '@arcgis/core/widgets/Expand'\nimport BaseMapGallery from '@arcgis/core/widgets/BasemapGallery'\nimport Sketch from '@arcgis/core/widgets/Sketch'\nimport GraphicsLayer from '@arcgis/core/layers/GraphicsLayer'\nimport Graphic from '@arcgis/core/Graphic'\nimport Layer from '@arcgis/core/layers/Layer'\nimport Popup from '@arcgis/core/widgets/Popup'\nimport {\n Point,\n Polygon,\n SpatialReference,\n Polyline,\n} from '@arcgis/core/geometry'\nimport TextSymbol from '@arcgis/core/symbols/TextSymbol'\nimport * as geometryEngine from '@arcgis/core/geometry/geometryEngine'\nimport { Box, Divider, IconButton } from '@mui/material'\nimport throttle from 'lodash.throttle'\nimport { localisationService } from '@oneblink/apps'\nimport { v4 as uuid } from 'uuid'\n\nimport OnLoading from '../components/renderer/OnLoading'\nimport MaterialIcon from './MaterialIcon'\n\nimport useIsPageVisible from '../hooks/useIsPageVisible'\nimport { ArcGISWebMapElementValue } from '@oneblink/types/typescript/arcgis'\nimport { FormElementValueChangeHandler } from '../types/form'\nimport '../styles/arcgis-external.css'\n\ntype Props = {\n element: FormTypes.ArcGISWebMapElement\n id: string\n value: ArcGISWebMapElementValue | undefined\n onChange: FormElementValueChangeHandler<ArcGISWebMapElementValue>\n 'aria-describedby'?: string\n setIsDirty: () => void\n}\n\ntype SketchCreateTool = Parameters<Sketch['create']>[0]\n\nfunction DrawingOptionsList({\n options,\n sketchTool,\n onClose,\n sketchToolType,\n setSelectedGraphicAttributes,\n}: {\n options: { id: string; label: string; value: string; description?: string }[]\n onClose: () => void\n sketchTool: Sketch\n sketchToolType: SketchCreateTool\n setSelectedGraphicAttributes: (opt: {\n label: string\n value: string\n description?: string\n }) => void\n}) {\n return (\n <div className=\"esri-widget\">\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <b style={{ padding: '0.5rem' }}>Select an option</b>\n <IconButton\n onClick={(e) => {\n e.stopPropagation()\n onClose()\n }}\n size=\"small\"\n data-cypress=\"copy-to-clip-board-button\"\n >\n <MaterialIcon fontSize=\"small\">close</MaterialIcon>\n </IconButton>\n </Box>\n <Divider sx={{ backgroundColor: 'unset', margin: '0px 8px' }} />\n <Box sx={{ maxHeight: '200px', overflowY: 'auto' }}>\n {options?.map(({ id, value, label, description }) => (\n <div\n key={id}\n className=\"ob-list__item is-clickable\"\n style={{ alignItems: 'center' }}\n onClick={() => {\n onClose()\n sketchTool?.create(sketchToolType)\n setSelectedGraphicAttributes({ value, label, description })\n }}\n >\n {label}\n </div>\n ))}\n </Box>\n </div>\n )\n}\n\nfunction FormElementArcGISWebMap({\n element,\n id,\n value,\n onChange,\n setIsDirty,\n ...props\n}: Props) {\n const ref = React.useRef<HTMLDivElement | null>(null)\n const layerPanelRef = React.useRef<Expand>()\n const mapGalleryPanelRef = React.useRef<Expand>()\n const sketchToolRef = React.useRef<Sketch>()\n const drawingLayerRef = React.useRef<GraphicsLayer>()\n const selectedGraphicForUpdate = React.useRef<string>()\n const mapViewRef = React.useRef<MapView>()\n const measurementLayerRef = React.useRef<GraphicsLayer>()\n\n const [overlayLayerIds, setOverlayLayerIds] = React.useState<string[]>()\n const [loadError, setLoadError] = React.useState<Error>()\n const [isLoading, setIsLoading] = React.useState<boolean>(false)\n const isPageVisible = useIsPageVisible()\n const [selectedGraphicAttributes, setSelectedGraphicAttributes] =\n React.useState<{\n value: string\n label: string\n description?: string\n }>()\n // only used when an allowed drawing tool also has a list of graphic attribute options to display to the user\n const [activeSketchToolMenu, setActiveSketchToolMenu] =\n React.useState<SketchCreateTool>()\n\n const updateDrawingInputSubmissionValue = React.useCallback(() => {\n const updatedGraphics = drawingLayerRef.current?.graphics\n .toArray()\n .map((graphic) => graphic.toJSON())\n\n onChange(element, {\n value: {\n ...(value || {}),\n drawingLayer: updatedGraphics,\n userInput: updatedGraphics,\n },\n })\n\n setIsDirty()\n }, [element, onChange, setIsDirty, value])\n\n const updateMapViewSubmissionValue = React.useCallback(() => {\n const zoom = mapViewRef.current?.zoom\n const latitude = mapViewRef.current?.center.latitude\n const longitude = mapViewRef.current?.center.longitude\n if (zoom && latitude && longitude) {\n onChange(element, {\n value: {\n ...(value || {}),\n view: {\n zoom,\n latitude,\n longitude,\n },\n },\n })\n }\n }, [element, onChange, value])\n\n const getGeometryPoints = (\n geom: __esri.Geometry,\n spatialRef: SpatialReference,\n ) => {\n if (geom.type === 'polygon') {\n const polygon = geom as Polygon\n return polygon.rings[0].map(\n (ring) =>\n new Point({\n x: ring[0],\n y: ring[1],\n spatialReference: spatialRef,\n }),\n )\n } else if (geom.type === 'polyline') {\n const polyline = geom as Polyline\n return polyline.paths[0].map(\n (path) =>\n new Point({\n x: path[0],\n y: path[1],\n spatialReference: spatialRef,\n }),\n )\n }\n }\n\n const addMeasurementLabels = React.useCallback(\n (graphics: __esri.Graphic[]) => {\n if (!element.measurementDimensionsEnabled) return\n const spatialRef = new SpatialReference({ wkid: 3857 })\n const measurementLayer = measurementLayerRef.current\n const mapView = mapViewRef.current\n if (!measurementLayer || !mapView) return\n measurementLayer.removeAll()\n\n for (const graphic of graphics) {\n const geom = graphic.geometry\n if (!geom || (geom.type !== 'polygon' && geom.type !== 'polyline'))\n continue\n\n const points = getGeometryPoints(geom, spatialRef)\n if (!points) continue\n\n const { distanceUnit, distanceUnitShortName } =\n localisationService.getDistanceUnits()\n if (distanceUnit !== 'meters' && distanceUnit !== 'feet') {\n console.warn(\n 'Unsupported distance unit provided in tenant configuration: ',\n distanceUnit,\n )\n return\n }\n const graphics: Graphic[] = []\n\n for (let i = 1; i < points.length; i++) {\n const x1 = points[i].x\n const x2 = points[i - 1].x\n const y1 = points[i].y\n const y2 = points[i - 1].y\n\n const midpoint = new Point({\n x: (x1 + x2) / 2,\n y: (y1 + y2) / 2,\n spatialReference: spatialRef,\n })\n\n // Angle of the measurement label - this will be rotated to be parallel with the polygon or polyline edge\n const dx = x2 - x1\n const dy = y2 - y1\n const radians = Math.atan2(dy, dx)\n let angle = radians * (-180 / Math.PI)\n if (angle > 90 || angle < -90) {\n angle += 180\n }\n\n // offset of the measurement label against the edge of the polygon/polyline it's measuring\n const pixelOffset = 10\n const normalAngle = radians + Math.PI / 2\n const offsetScreenX = pixelOffset * Math.cos(normalAngle)\n const offsetScreenY = pixelOffset * Math.sin(normalAngle)\n\n const screenPoint = mapView.toScreen(midpoint)\n screenPoint.x += offsetScreenX\n screenPoint.y -= offsetScreenY\n const offsetMapPoint = mapView.toMap(screenPoint)\n\n const polyline = new Polyline({\n paths: [\n [\n [points[i].longitude, points[i].latitude],\n [points[i - 1].longitude, points[i - 1].latitude],\n ],\n ],\n spatialReference: { wkid: 4326 },\n })\n const distance = geometryEngine.geodesicLength(polyline, distanceUnit)\n graphics.push(\n new Graphic({\n geometry: offsetMapPoint,\n symbol: new TextSymbol({\n text: distance.toFixed(0) + distanceUnitShortName,\n color: 'black',\n haloColor: 'white',\n haloSize: 1,\n angle,\n }),\n }),\n )\n }\n\n measurementLayer.addMany(graphics)\n mapViewRef.current?.map.reorder(\n measurementLayer,\n mapViewRef.current?.map.layers.length,\n )\n }\n },\n [element],\n )\n\n const clearMeasurementLabels = React.useCallback(() => {\n if (measurementLayerRef.current) {\n measurementLayerRef.current.removeAll()\n }\n }, [])\n\n React.useEffect(() => {\n if (element.readOnly) return\n // event listeners for drawing tool creates/updates/deletes\n // these need to be removed and recreated when the submission value changes\n // to ensure they always have access to the latest submission value\n const createListener = sketchToolRef.current?.on(\n 'create',\n throttle((sketchEvent: __esri.SketchCreateEvent) => {\n if (sketchEvent.state === 'active') {\n addMeasurementLabels([sketchEvent.graphic])\n }\n if (sketchEvent.state === 'complete') {\n if (selectedGraphicAttributes) {\n sketchEvent.graphic.attributes = {\n name: selectedGraphicAttributes.value,\n label: selectedGraphicAttributes.label,\n description: selectedGraphicAttributes.description,\n }\n setSelectedGraphicAttributes(undefined)\n }\n updateDrawingInputSubmissionValue()\n clearMeasurementLabels()\n }\n if (sketchEvent.state === 'cancel') {\n setSelectedGraphicAttributes(undefined)\n clearMeasurementLabels()\n }\n }, 100),\n )\n\n const updateListener = sketchToolRef.current?.on(\n 'update',\n throttle((sketchEvent: __esri.SketchUpdateEvent) => {\n if (sketchEvent.state === 'active') {\n addMeasurementLabels(sketchEvent.graphics)\n }\n if (sketchEvent.state === 'complete') {\n // only update the submission value if the graphic's geometry was actually changed\n if (\n JSON.stringify(sketchEvent.graphics[0].geometry.toJSON()) !==\n selectedGraphicForUpdate.current\n ) {\n updateDrawingInputSubmissionValue()\n }\n selectedGraphicForUpdate.current = undefined\n clearMeasurementLabels()\n }\n if (sketchEvent.state === 'start') {\n selectedGraphicForUpdate.current = JSON.stringify(\n sketchEvent.graphics[0].geometry.clone().toJSON(),\n )\n addMeasurementLabels(sketchEvent.graphics)\n }\n }, 100),\n )\n\n const deleteListener = sketchToolRef.current?.on('delete', () => {\n mapViewRef.current?.closePopup()\n updateDrawingInputSubmissionValue()\n clearMeasurementLabels()\n })\n\n const mapViewChangeListener = mapViewRef.current?.watch(\n 'stationary',\n () => {\n const mapView = mapViewRef.current\n if (mapView && mapView.stationary) {\n const hasViewChanged =\n mapView.zoom !== value?.view?.zoom ||\n mapView.center.longitude !== value?.view?.longitude ||\n mapView.center.latitude !== value?.view?.latitude\n if (hasViewChanged) {\n updateMapViewSubmissionValue()\n }\n }\n },\n )\n\n const sketchToolListener = sketchToolRef.current?.viewModel.watch(\n 'activeTool',\n () => {\n if (selectedGraphicAttributes) {\n return\n }\n const activeTool = sketchToolRef.current?.activeTool\n const hasGraphicAttributeOptions = !!element.allowedDrawingTools?.find(\n (tool) => tool.type === activeTool,\n )?.graphicAttributeOptions?.length\n\n if (activeTool) {\n if (\n hasGraphicAttributeOptions &&\n (activeTool === 'point' ||\n activeTool === 'polygon' ||\n activeTool === 'circle' ||\n activeTool === 'rectangle' ||\n activeTool === 'polyline')\n ) {\n // the sketch.create() fn only allows active tools of the above 5 types\n // hence we must check above to keep the types happy further down the line\n sketchToolRef.current?.cancel()\n setActiveSketchToolMenu(activeTool)\n } else {\n setActiveSketchToolMenu(undefined)\n }\n }\n },\n )\n\n mapViewRef.current?.on('click', (event) => {\n mapViewRef.current?.hitTest(event).then((response) => {\n // the \"hit test\" will typically yield the graphic we want to display the popup for,\n // and an ArcGIS built-in graphic which highlights the selected graphic.\n // By filtering for the graphic with the \"label\" attribute, we're able to reliably\n // get the graphic we want to display the popup for.\n const result = response.results\n .filter((r) => r.type === 'graphic')\n .find((r) => !!r.graphic.attributes?.label)\n\n if (result) {\n mapViewRef.current?.openPopup({\n title: result.graphic.attributes.label,\n content: result.graphic.attributes.description,\n })\n }\n })\n })\n\n return () => {\n createListener?.remove()\n updateListener?.remove()\n deleteListener?.remove()\n mapViewChangeListener?.remove()\n sketchToolListener?.remove()\n }\n }, [\n isLoading,\n value,\n updateDrawingInputSubmissionValue,\n updateMapViewSubmissionValue,\n element,\n selectedGraphicAttributes,\n addMeasurementLabels,\n clearMeasurementLabels,\n ])\n\n const onSubmissionValueChange = React.useCallback(() => {\n const view = mapViewRef.current\n const map = mapViewRef.current?.map\n if (!view || !map) return\n\n const newLayerIds = value?.layers?.map((l) => l.id)\n // remove map layers no longer in submission value\n if (overlayLayerIds) {\n const layersToRemove = overlayLayerIds.reduce((toRemove: Layer[], id) => {\n if (!newLayerIds?.includes(id)) {\n const layer = map.layers.find((layer) => layer.id === id)\n if (layer) toRemove.push(layer)\n }\n return toRemove\n }, [])\n map.layers.removeMany(layersToRemove)\n }\n\n if (value?.layers) {\n // determine if a layer is new or existing and handle accordingly\n for (const layer of value.layers) {\n const existingLayer = map.layers.find(\n (mapLayer) => mapLayer.id === layer.id,\n )\n if (!existingLayer) {\n const newLayer = new GraphicsLayer({\n title: layer.title as string,\n id: layer.id,\n })\n newLayer.addMany(layer.graphics.map((g) => Graphic.fromJSON(g)))\n newLayer.visible =\n typeof layer.visible === 'boolean' ? layer.visible : true\n map.layers.add(newLayer)\n } else if (existingLayer && existingLayer.type === 'graphics') {\n const existingGraphicLayer = existingLayer as GraphicsLayer\n existingGraphicLayer.title = layer.title\n existingGraphicLayer.graphics.removeAll()\n existingGraphicLayer.addMany(\n layer.graphics.map((g) => Graphic.fromJSON(g)),\n )\n existingGraphicLayer.visible =\n typeof layer.visible === 'boolean' ? layer.visible : true\n }\n }\n }\n\n // finally, set the new layer ids in state\n setOverlayLayerIds(newLayerIds)\n\n // update the web map's drawing layers\n const drawingLayer = drawingLayerRef.current\n if (value?.drawingLayer && drawingLayer) {\n drawingLayer.removeAll()\n drawingLayer.addMany(value.drawingLayer.map((g) => Graphic.fromJSON(g)))\n }\n if (value?.view) {\n view.zoom = value.view.zoom\n view.center = new Point({\n latitude: value.view.latitude,\n longitude: value.view.longitude,\n })\n }\n }, [overlayLayerIds, value])\n\n React.useEffect(() => {\n if (!isLoading && mapViewRef.current) {\n onSubmissionValueChange()\n }\n // only run the above when the submission value changes or the map finishes loading\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value, isLoading])\n\n const drawingOptionsContainerId = `OneBlinkDrawingOptionsSelector-${element.id}`\n\n React.useEffect(() => {\n const loadMap = async () => {\n try {\n const map = new WebMap({\n portalItem: {\n id: element.webMapId,\n },\n basemap: element.basemapId || 'streets',\n })\n await map.load()\n\n const view = new MapView({\n map: map,\n container: ref.current || undefined,\n popup: new Popup({\n dockEnabled: true,\n dockOptions: {\n buttonEnabled: false,\n breakpoint: false,\n position: 'bottom-left',\n },\n }),\n })\n\n // remove default widgets\n const components = view.ui.getComponents()\n for (const component of components) {\n view.ui.remove(component)\n }\n\n if (element.addressSearchWidgetEnabled) {\n view.ui.add(\n new Search({\n view,\n }),\n 'top-left',\n )\n }\n\n if (element.homeWidgetEnabled) {\n view.ui.add(\n new Home({\n view,\n }),\n 'top-left',\n )\n }\n\n view.ui.add(\n new Zoom({\n view,\n }),\n 'bottom-right',\n )\n\n const layerList = new LayerList({\n view,\n })\n\n layerPanelRef.current = new Expand({\n expandIcon: 'layers',\n view,\n content: layerList,\n expanded: element.showLayerPanel,\n mode: 'floating',\n visible: false,\n })\n\n view.ui.add(layerPanelRef.current, 'top-right')\n\n const baseMapGallery = new BaseMapGallery({ view })\n\n mapGalleryPanelRef.current = new Expand({\n expandIcon: 'basemap',\n view,\n content: baseMapGallery,\n mode: 'floating',\n visible: false,\n })\n\n view.ui.add(mapGalleryPanelRef.current, 'top-left')\n\n if (!element.readOnly && element.allowedDrawingTools?.length) {\n const drawingLayer = new GraphicsLayer({\n id: uuid(),\n title: 'Drawing',\n })\n drawingLayerRef.current = drawingLayer\n map.layers.add(drawingLayer)\n\n // Add measurement layer above drawing layer\n if (element.measurementDimensionsEnabled) {\n const measurementLayer = new GraphicsLayer({\n id: uuid(),\n title: 'Measurements',\n listMode: 'hide',\n })\n measurementLayerRef.current = measurementLayer\n map.layers.add(measurementLayer)\n }\n\n const sketch = new Sketch({\n view,\n layer: drawingLayer,\n creationMode: 'single',\n layout: 'vertical',\n availableCreateTools: [\n 'point',\n 'polyline',\n 'polygon',\n 'rectangle',\n 'circle',\n ].filter((createTool) =>\n element.allowedDrawingTools?.find(\n (tool) => tool.type === createTool,\n ),\n ),\n // hiding the below by default\n visibleElements: {\n duplicateButton: false,\n settingsMenu: false,\n undoRedoMenu: false,\n selectionTools: {\n 'lasso-selection': false,\n 'rectangle-selection': false,\n },\n },\n })\n sketchToolRef.current = sketch\n view.ui.add(sketch, 'bottom-right')\n view.ui.add(drawingOptionsContainerId, 'bottom-right')\n }\n\n // once the view has loaded\n view.when(() => {\n mapViewRef.current = view\n setIsLoading(false)\n })\n } catch (e) {\n console.warn('Error while trying to load arcgis web map ', e)\n setLoadError(e as Error)\n setIsLoading(false)\n }\n }\n\n if (!mapViewRef.current && !isLoading) {\n setIsLoading(true)\n loadMap()\n }\n }, [drawingOptionsContainerId, element, isLoading, value])\n\n React.useEffect(() => {\n if (!isLoading) {\n if (isPageVisible) {\n if (layerPanelRef.current) {\n layerPanelRef.current.visible = true\n }\n if (mapGalleryPanelRef.current) {\n mapGalleryPanelRef.current.visible = true\n }\n } else {\n if (layerPanelRef.current) {\n layerPanelRef.current.visible = false\n }\n if (mapGalleryPanelRef.current) {\n mapGalleryPanelRef.current.visible = false\n }\n }\n }\n }, [isPageVisible, isLoading])\n\n if (loadError) {\n return (\n <figure className=\"ob-figure\">\n <div className=\"figure-content has-text-centered\">\n <MaterialIcon className=\"icon-large has-margin-bottom-6 has-text-warning\">\n error\n </MaterialIcon>\n <h4 className=\"title is-4\">We were unable to display your web map</h4>\n <p>{loadError.message}</p>\n </div>\n </figure>\n )\n }\n\n return (\n <>\n {isLoading && <OnLoading />}\n <div\n className=\"arcgis-web-map\"\n ref={ref}\n id={id}\n aria-describedby={props['aria-describedby']}\n />\n <div id={drawingOptionsContainerId}>\n {!!activeSketchToolMenu && sketchToolRef.current && (\n <DrawingOptionsList\n options={\n element.allowedDrawingTools?.find(\n (tool) => tool.type === activeSketchToolMenu,\n )?.graphicAttributeOptions || []\n }\n onClose={() => setActiveSketchToolMenu(undefined)}\n setSelectedGraphicAttributes={(opt) => {\n setSelectedGraphicAttributes(opt)\n }}\n sketchToolType={activeSketchToolMenu}\n sketchTool={sketchToolRef.current}\n />\n )}\n </div>\n </>\n )\n}\n\nexport default React.memo(FormElementArcGISWebMap)\n"]}
|
@@ -9,11 +9,11 @@ const useAttachments = (element, onChange, setIsDirty) => {
|
|
9
9
|
return;
|
10
10
|
const newAttachments = await Promise.all(files.map(async (file) => {
|
11
11
|
if (!file.size) {
|
12
|
-
return generateErrorAttachment(file, file.name, element, 'You cannot upload an empty file.');
|
12
|
+
return generateErrorAttachment(file, file.name, element, 'You cannot upload an empty file.', 'EMPTY_FILE');
|
13
13
|
}
|
14
14
|
const fileSizeInMB = file.size / 1024 / 1024;
|
15
15
|
if (element.maxFileSize && fileSizeInMB > element.maxFileSize) {
|
16
|
-
return generateErrorAttachment(file, file.name, element, `File size ${fileSizeInMB.toFixed(2)}MB exceeds the allowed maximum of ${element.maxFileSize}MB
|
16
|
+
return generateErrorAttachment(file, file.name, element, `File size ${fileSizeInMB.toFixed(2)}MB exceeds the allowed maximum of ${element.maxFileSize}MB.`, 'EXCEEDS_MAX_SIZE');
|
17
17
|
}
|
18
18
|
const result = await correctFileOrientation(file);
|
19
19
|
if (result instanceof Blob) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useAttachments.js","sourceRoot":"","sources":["../../../src/hooks/attachments/useAttachments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAG1C,MAAM,cAAc,GAAG,CACrB,OAA+B,EAC/B,QAAwE,EACxE,UAAsC,EACtC,EAAE;IACF,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CACtC,KAAK,EAAE,KAAa,EAAiB,EAAE;QACrC,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,OAAM;QACzB,MAAM,cAAc,GAEhB,MAAM,OAAO,CAAC,GAAG,CACnB,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACvB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACf,OAAO,uBAAuB,CAC5B,IAAI,EACJ,IAAI,CAAC,IAAI,EACT,OAAO,EACP,kCAAkC,
|
1
|
+
{"version":3,"file":"useAttachments.js","sourceRoot":"","sources":["../../../src/hooks/attachments/useAttachments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAG1C,MAAM,cAAc,GAAG,CACrB,OAA+B,EAC/B,QAAwE,EACxE,UAAsC,EACtC,EAAE;IACF,MAAM,SAAS,GAAG,YAAY,EAAE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AAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBACpC,kEAAkE;oBAClE,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC;wBAC/B,OAAO,UAAU,CAAA;oBACnB,CAAC;oBACD,OAAO,GAAG,CAAA;gBACZ,CAAC,CAAC,CAAA;YACJ,CAAC;SACF,CAAC,CAAA;QACF,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,UAAU,EAAE,CAAA;QACd,CAAC;IACH,CAAC,EACD,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAC3C,CAAA;IAED,OAAO;QACL,cAAc;QACd,gBAAgB;QAChB,gBAAgB;KACjB,CAAA;AACH,CAAC,CAAA;AAED,eAAe,cAAc,CAAA","sourcesContent":["import { FormTypes } from '@oneblink/types'\nimport * as React from 'react'\nimport {\n prepareNewAttachment,\n generateErrorAttachment,\n correctFileOrientation,\n} from '../../services/attachments'\nimport { attachmentsService } from '@oneblink/apps'\nimport { canvasToBlob } from '../../services/blob-utils'\nimport useIsMounted from '../useIsMounted'\nimport { FormElementValueChangeHandler, IsDirtyProps } from '../../types/form'\n\nconst useAttachments = (\n element: FormTypes.FilesElement,\n onChange: FormElementValueChangeHandler<attachmentsService.Attachment[]>,\n setIsDirty: IsDirtyProps['setIsDirty'],\n) => {\n const isMounted = useIsMounted()\n\n const addAttachments = React.useCallback(\n async (files: File[]): Promise<void> => {\n if (!files.length) return\n const newAttachments: Array<\n attachmentsService.AttachmentNew | attachmentsService.AttachmentError\n > = await Promise.all(\n files.map(async (file) => {\n if (!file.size) {\n return generateErrorAttachment(\n file,\n file.name,\n element,\n 'You cannot upload an empty file.',\n 'EMPTY_FILE',\n )\n }\n const fileSizeInMB = file.size / 1024 / 1024\n if (element.maxFileSize && fileSizeInMB > element.maxFileSize) {\n return generateErrorAttachment(\n file,\n file.name,\n element,\n `File size ${fileSizeInMB.toFixed(2)}MB exceeds the allowed maximum of ${element.maxFileSize}MB.`,\n 'EXCEEDS_MAX_SIZE',\n )\n }\n const result = await correctFileOrientation(file)\n if (result instanceof Blob) {\n return prepareNewAttachment(result, file.name, element)\n }\n\n const blob = await canvasToBlob(result)\n return prepareNewAttachment(blob, file.name, element)\n }),\n )\n\n onChange(element, {\n value: (currentAttachments) => {\n if (!currentAttachments) return newAttachments\n return [...currentAttachments, ...newAttachments]\n },\n })\n if (isMounted.current) {\n setIsDirty()\n }\n },\n [element, isMounted, onChange, setIsDirty],\n )\n\n const removeAttachment = React.useCallback(\n (id: string) => {\n onChange(element, {\n value: (currentAttachments) => {\n const newAttachments = currentAttachments?.filter((att) => {\n // Return items that are not the removed id\n if (!att.type) {\n return att.id !== id\n }\n return att._id !== id\n })\n if (newAttachments?.length) {\n return newAttachments\n }\n },\n })\n if (isMounted.current) {\n setIsDirty()\n }\n },\n [element, isMounted, onChange, setIsDirty],\n )\n\n const changeAttachment = React.useCallback(\n (id: string, attachment: attachmentsService.Attachment) => {\n onChange(element, {\n value: (currentAttachments) => {\n if (!currentAttachments) return\n return currentAttachments.map((att) => {\n // Can only change attachments that are not uploaded (have a type)\n if (att.type && att._id === id) {\n return attachment\n }\n return att\n })\n },\n })\n if (isMounted.current) {\n setIsDirty()\n }\n },\n [element, isMounted, onChange, setIsDirty],\n )\n\n return {\n addAttachments,\n removeAttachment,\n changeAttachment,\n }\n}\n\nexport default useAttachments\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { FormTypes } from '@oneblink/types';
|
2
2
|
import { attachmentsService } from '@oneblink/apps';
|
3
|
-
export declare function generateErrorAttachment(blob: Blob, fileName: string, element: FormTypes.FormElementBinaryStorage, errorMessage: string): attachmentsService.AttachmentError;
|
3
|
+
export declare function generateErrorAttachment(blob: Blob, fileName: string, element: FormTypes.FormElementBinaryStorage, errorMessage: string, errorType?: attachmentsService.AttachmentError['errorType']): attachmentsService.AttachmentError;
|
4
4
|
export declare function prepareNewAttachment(blob: Blob, fileName: string, element: FormTypes.FormElementBinaryStorage): attachmentsService.AttachmentNew;
|
5
5
|
export declare function checkIfContentTypeIsImage(contentType: string): boolean;
|
6
6
|
export declare function parseFilesAsAttachmentsLegacy(files: File[], onAnnotateCanvas?: (file: File, canvas: HTMLCanvasElement) => void): Promise<Array<{
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Sentry } from '@oneblink/apps';
|
2
2
|
import { v4 as uuid } from 'uuid';
|
3
3
|
import { blobToCanvas, getBlobOrientation } from './blob-utils';
|
4
|
-
export function generateErrorAttachment(blob, fileName, element, errorMessage) {
|
4
|
+
export function generateErrorAttachment(blob, fileName, element, errorMessage, errorType) {
|
5
5
|
return {
|
6
6
|
_id: uuid(),
|
7
7
|
data: blob,
|
@@ -9,6 +9,7 @@ export function generateErrorAttachment(blob, fileName, element, errorMessage) {
|
|
9
9
|
isPrivate: element.storageType !== 'public',
|
10
10
|
type: 'ERROR',
|
11
11
|
errorMessage,
|
12
|
+
errorType,
|
12
13
|
};
|
13
14
|
}
|
14
15
|
export function prepareNewAttachment(blob, fileName, element) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../src/services/attachments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAsB,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAE/D,MAAM,UAAU,uBAAuB,CACrC,IAAU,EACV,QAAgB,EAChB,OAA2C,EAC3C,YAAoB;
|
1
|
+
{"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../src/services/attachments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAsB,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AACj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IAAI,EAAE,WAAW,CAAC,CAAA;QACpD,IAAI,gBAAgB,EAAE,CAAC;YACrB,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QAChC,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,6CAA6C,EAAE,GAAG,CAAC,CAAA;QAChE,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAA;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC","sourcesContent":["import { FormTypes } from '@oneblink/types'\nimport { Sentry, attachmentsService } from '@oneblink/apps'\nimport { v4 as uuid } from 'uuid'\nimport { blobToCanvas, getBlobOrientation } from './blob-utils'\n\nexport function generateErrorAttachment(\n blob: Blob,\n fileName: string,\n element: FormTypes.FormElementBinaryStorage,\n errorMessage: string,\n errorType?: attachmentsService.AttachmentError['errorType'],\n): attachmentsService.AttachmentError {\n return {\n _id: uuid(),\n data: blob,\n fileName,\n isPrivate: element.storageType !== 'public',\n type: 'ERROR',\n errorMessage,\n errorType,\n }\n}\n\nexport function prepareNewAttachment(\n blob: Blob,\n fileName: string,\n element: FormTypes.FormElementBinaryStorage,\n): attachmentsService.AttachmentNew {\n return {\n _id: uuid(),\n data: blob,\n fileName,\n isPrivate: element.storageType !== 'public',\n type: 'NEW',\n }\n}\n\nexport function checkIfContentTypeIsImage(contentType: string) {\n return contentType.indexOf('image/') === 0\n}\n\nexport async function parseFilesAsAttachmentsLegacy(\n files: File[],\n onAnnotateCanvas?: (file: File, canvas: HTMLCanvasElement) => void,\n): Promise<Array<{ data: string; fileName: string; contentType: string }>> {\n const attachments: Array<{\n data: string\n fileName: string\n contentType: string\n }> = []\n\n for (const file of files) {\n const result = await correctFileOrientation(file, onAnnotateCanvas)\n\n if (result instanceof Blob) {\n console.log('Attempting to parse File as attachment', file)\n\n const base64data = await new Promise<string>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = function () {\n resolve(reader.result as string)\n }\n reader.onerror = function () {\n reject(new Error('Could not read file from data url'))\n }\n reader.readAsDataURL(file)\n })\n\n attachments.push({\n fileName: file.name,\n contentType: file.type,\n data: base64data,\n })\n } else {\n attachments.push({\n fileName: file.name,\n contentType: file.type,\n data: result.toDataURL(),\n })\n }\n }\n\n return attachments\n}\n\nexport async function correctFileOrientation(\n file: File,\n onAnnotateCanvas?: (file: File, canvas: HTMLCanvasElement) => void,\n): Promise<Blob | HTMLCanvasElement> {\n try {\n if (!checkIfContentTypeIsImage(file.type)) {\n return file\n }\n\n console.log('Attempting to parse File as image attachment', file)\n\n const orientation = await getBlobOrientation(file)\n if (\n (typeof orientation !== 'number' || orientation === 1) &&\n !onAnnotateCanvas\n ) {\n console.log('Skipping orientation correction for image')\n return file\n }\n\n console.log(\n 'Loading image onto canvas to correct orientation using image meta data',\n { orientation },\n )\n const canvas = await blobToCanvas(file, orientation)\n if (onAnnotateCanvas) {\n onAnnotateCanvas(file, canvas)\n }\n return canvas\n } catch (err) {\n console.warn('Failed to rotate the orientation of a file:', err)\n Sentry.captureException(err)\n return file\n }\n}\n"]}
|
@@ -49,16 +49,46 @@ export function getInvalidAttachment(value) {
|
|
49
49
|
}
|
50
50
|
}
|
51
51
|
export function validateAttachments(value) {
|
52
|
-
const
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
const exceedsMaximumSize = value === null || value === void 0 ? void 0 : value.some((att) => {
|
53
|
+
const invalidAttachment = getInvalidAttachment(att);
|
54
|
+
if ((invalidAttachment === null || invalidAttachment === void 0 ? void 0 : invalidAttachment.fileName) &&
|
55
|
+
(invalidAttachment === null || invalidAttachment === void 0 ? void 0 : invalidAttachment.errorType) === 'EXCEEDS_MAX_SIZE') {
|
56
|
+
return true;
|
57
57
|
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
});
|
59
|
+
const emptyFiles = value === null || value === void 0 ? void 0 : value.some((att) => {
|
60
|
+
const invalidAttachment = getInvalidAttachment(att);
|
61
|
+
if ((invalidAttachment === null || invalidAttachment === void 0 ? void 0 : invalidAttachment.fileName) &&
|
62
|
+
(invalidAttachment === null || invalidAttachment === void 0 ? void 0 : invalidAttachment.errorType) === 'EMPTY_FILE') {
|
63
|
+
return true;
|
64
|
+
}
|
65
|
+
});
|
66
|
+
if (!exceedsMaximumSize && !emptyFiles) {
|
67
|
+
const invalidAttachmentNames = value === null || value === void 0 ? void 0 : value.reduce((invalidAttachmentNames, att) => {
|
68
|
+
var _a;
|
69
|
+
const attachmentName = (_a = getInvalidAttachment(att)) === null || _a === void 0 ? void 0 : _a.fileName;
|
70
|
+
if (attachmentName) {
|
71
|
+
invalidAttachmentNames.push(attachmentName);
|
72
|
+
}
|
73
|
+
return invalidAttachmentNames;
|
74
|
+
}, []);
|
75
|
+
if (invalidAttachmentNames === null || invalidAttachmentNames === void 0 ? void 0 : invalidAttachmentNames.length) {
|
76
|
+
return [`${invalidAttachmentNames.join(', ')} could not be uploaded.`];
|
77
|
+
}
|
78
|
+
return [];
|
79
|
+
}
|
80
|
+
let errorMessage;
|
81
|
+
if (exceedsMaximumSize) {
|
82
|
+
errorMessage = 'One or more of the files exceed the maximum size allowed.';
|
83
|
+
}
|
84
|
+
if (emptyFiles) {
|
85
|
+
const emptyMessage = 'One or more of the files are empty.';
|
86
|
+
errorMessage = errorMessage
|
87
|
+
? `${errorMessage} ${emptyMessage}`
|
88
|
+
: emptyMessage;
|
89
|
+
}
|
90
|
+
if (errorMessage) {
|
91
|
+
return [errorMessage];
|
62
92
|
}
|
63
93
|
return [];
|
64
94
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/services/form-validation/validators.ts"],"names":[],"mappings":"AACA,OAAO,yBAEN,MAAM,8BAA8B,CAAA;AAKrC,OAAO,wBAAwB,MAAM,6BAA6B,CAAA;AAClE,OAAO,oCAAoC,MAAM,yCAAyC,CAAA;AAI1F,MAA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AAI,CAAC,CAC7E,CAAA;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,OAAyD,EACzD,sBAA0D;IAE1D,oDAAoD;IACpD,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAA;IACd,CAAC;IAED,+EAA+E;IAC/E,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;QAC3C,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC;YACzB,KAAK,MAAM,CAAC;YACZ,KAAK,SAAS,CAAC,CAAC,CAAC;gBACf,OAAO,oBAAoB,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAA;YAClE,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,OAAO,sBAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;YACjD,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,KAAc;IAEd,IACE,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,IAAI,KAAK;QACf,KAAK,CAAC,IAAI,KAAK,OAAO,EACtB,CAAC;QACD,OAAO,KAA2C,CAAA;IACpD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,KAAkD;IAElD,MAAM,sBAAsB,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,CAC1C,CAAC,sBAAgC,EAAE,GAAG,EAAE,EAAE;;
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/services/form-validation/validators.ts"],"names":[],"mappings":"AACA,OAAO,yBAEN,MAAM,8BAA8B,CAAA;AAKrC,OAAO,wBAAwB,MAAM,6BAA6B,CAAA;AAClE,OAAO,oCAAoC,MAAM,yCAAyC,CAAA;AAI1F,MAAM,UAAU,8BAA8B,CAC5C,OAAsC,EACtC,QAAiC,EACjC,UAAsE,EACtE,8BAA0E;IAE1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B,CAAC;IAED,OAAO,EAAE,CAAA;AACX,CAAC;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,kBAAyD,EACzD,EAAE;IACF,OAAO,kBAAkB,IAAI,kBAAkB,CAAC,KAAK;QACnD,CAAC,CAAC,GAAG,kBAAkB,CAAC,KAAK,cAAc;QAC3C,CAAC,CAAC,oBAAoB,CAAA;AAC1B,CAAC,CAAA","sourcesContent":["import { EnvironmentTypes, FormTypes, SubmissionTypes } from '@oneblink/types'\nimport getDateRangeConfiguration, {\n DateRangeConfigurationOptions,\n} from '../getDateRangeConfiguration'\nimport {\n FormElementsConditionallyShown,\n FormElementsValidation,\n} from '../../types/form'\nimport cleanFormSubmissionModel from '../cleanFormSubmissionModel'\nimport getRepeatableSetEntriesConfiguration from '../getRepeatableSetEntriesConfiguration'\nimport { attachmentsService } from '@oneblink/apps'\nimport { FormElementBinaryStorageValue } from '../../types/attachments'\n\nexport function getCleanDateRangeConfiguration(\n options: DateRangeConfigurationOptions,\n elements: FormTypes.FormElement[],\n submission: SubmissionTypes.S3SubmissionData['submission'] | undefined,\n formElementsConditionallyShown: FormElementsConditionallyShown | undefined,\n): ReturnType<typeof getDateRangeConfiguration> {\n if (options.referenceFormElementId && submission) {\n const { model } = cleanFormSubmissionModel(\n submission,\n elements,\n formElementsConditionallyShown,\n true,\n )\n return getDateRangeConfiguration(options, elements, model)\n }\n return [options.date, options.daysOffset]\n}\n\nexport function getCleanRepeatableSetConfiguration(\n setEntries: FormTypes.RepeatableSetElement['minSetEntries'],\n elements: FormTypes.FormElement[],\n submission: SubmissionTypes.S3SubmissionData['submission'] | undefined,\n formElementsConditionallyShown: FormElementsConditionallyShown | undefined,\n) {\n if (submission) {\n const { model } = cleanFormSubmissionModel(\n submission,\n elements,\n formElementsConditionallyShown,\n true,\n )\n return getRepeatableSetEntriesConfiguration(setEntries, elements, model)\n }\n}\n\nexport function checkFileNameIsValid(\n formElement: FormTypes.FilesElement,\n fileName: string,\n) {\n const extension = fileName.split('.').pop()\n return (\n !formElement.restrictedFileTypes ||\n formElement.restrictedFileTypes.some(\n (fileType) => fileType.toLowerCase() === extension?.toLowerCase(),\n )\n )\n}\n\nexport function checkFileNameExtensionIsValid(\n formElement: FormTypes.FilesElement,\n fileName: string,\n) {\n return (\n formElement.allowExtensionlessAttachments || fileName.split('.').length >= 2\n )\n}\n\nexport function checkSectionValidity(\n element: FormTypes.PageElement | FormTypes.SectionElement,\n formElementsValidation: FormElementsValidation | undefined,\n): boolean {\n // If everything is valid, no need to check elements\n if (!formElementsValidation) {\n return false\n }\n\n // If there is no elements on the page that are invalid, we will treat as valid\n return element.elements.some((formElement) => {\n switch (formElement.type) {\n case 'page':\n case 'section': {\n return checkSectionValidity(formElement, formElementsValidation)\n }\n default: {\n return formElementsValidation[formElement.name]\n }\n }\n })\n}\n\nexport function getInvalidAttachment(\n value: unknown,\n): attachmentsService.AttachmentError | undefined {\n if (\n value &&\n typeof value === 'object' &&\n 'type' in value &&\n value.type === 'ERROR'\n ) {\n return value as attachmentsService.AttachmentError\n }\n}\n\nexport function validateAttachments(\n value: FormElementBinaryStorageValue[] | undefined,\n): string[] {\n const exceedsMaximumSize = value?.some((att) => {\n const invalidAttachment = getInvalidAttachment(att)\n if (\n invalidAttachment?.fileName &&\n invalidAttachment?.errorType === 'EXCEEDS_MAX_SIZE'\n ) {\n return true\n }\n })\n const emptyFiles = value?.some((att) => {\n const invalidAttachment = getInvalidAttachment(att)\n if (\n invalidAttachment?.fileName &&\n invalidAttachment?.errorType === 'EMPTY_FILE'\n ) {\n return true\n }\n })\n if (!exceedsMaximumSize && !emptyFiles) {\n const invalidAttachmentNames = value?.reduce(\n (invalidAttachmentNames: string[], att) => {\n const attachmentName = getInvalidAttachment(att)?.fileName\n if (attachmentName) {\n invalidAttachmentNames.push(attachmentName)\n }\n return invalidAttachmentNames\n },\n [],\n )\n if (invalidAttachmentNames?.length) {\n return [`${invalidAttachmentNames.join(', ')} could not be uploaded.`]\n }\n return []\n }\n let errorMessage\n if (exceedsMaximumSize) {\n errorMessage = 'One or more of the files exceed the maximum size allowed.'\n }\n if (emptyFiles) {\n const emptyMessage = 'One or more of the files are empty.'\n errorMessage = errorMessage\n ? `${errorMessage} ${emptyMessage}`\n : emptyMessage\n }\n if (errorMessage) {\n return [errorMessage]\n }\n\n return []\n}\n\nexport const generateLookupValidationMessage = (\n lookupButtonConfig?: EnvironmentTypes.ButtonConfiguration,\n) => {\n return lookupButtonConfig && lookupButtonConfig.label\n ? `${lookupButtonConfig.label} is required`\n : 'Lookup is required'\n}\n"]}
|
package/dist/styles.css
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@oneblink/apps-react",
|
3
3
|
"description": "Helper functions for OneBlink apps in ReactJS.",
|
4
|
-
"version": "8.7.0
|
4
|
+
"version": "8.7.0",
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/oneblink/apps-react/issues"
|
@@ -47,7 +47,7 @@
|
|
47
47
|
"@mui/lab": "^5.0.0-alpha.152",
|
48
48
|
"@mui/material": "^5.15.6",
|
49
49
|
"@mui/x-date-pickers": "^6.20.2",
|
50
|
-
"@oneblink/apps": "^23.1.0-beta.
|
50
|
+
"@oneblink/apps": "^23.1.0-beta.9",
|
51
51
|
"@oneblink/release-cli": "^3.4.0-beta.1",
|
52
52
|
"@oneblink/types": "github:oneblink/types",
|
53
53
|
"@types/blueimp-load-image": "^5.16.6",
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import React, { memo } from 'react';
|
2
|
-
import QuillHTML from './QuillHTML';
|
3
|
-
import useReplaceableText from '../hooks/useReplaceableText';
|
4
|
-
function OneBlinkFormFooter({ footer }) {
|
5
|
-
const html = useReplaceableText(footer);
|
6
|
-
return (React.createElement("footer", { className: "ob-footer-container" },
|
7
|
-
React.createElement(QuillHTML, { html: html })));
|
8
|
-
}
|
9
|
-
export default memo(OneBlinkFormFooter);
|
10
|
-
//# sourceMappingURL=OneBlinkFormFooter.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"OneBlinkFormFooter.js","sourceRoot":"","sources":["../../src/components/OneBlinkFormFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,kBAAkB,MAAM,6BAA6B,CAAA;AAE5D,SAAS,kBAAkB,CAAC,EAAE,MAAM,EAAsB;IACxD,MAAM,IAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAEvC,OAAO,CACL,gCAAQ,SAAS,EAAC,qBAAqB;QACrC,oBAAC,SAAS,IAAC,IAAI,EAAE,IAAI,GAAI,CAClB,CACV,CAAA;AACH,CAAC;AAED,eAAe,IAAI,CAAC,kBAAkB,CAAC,CAAA","sourcesContent":["import React, { memo } from 'react'\nimport QuillHTML from './QuillHTML'\nimport useReplaceableText from '../hooks/useReplaceableText'\n\nfunction OneBlinkFormFooter({ footer }: { footer: string }) {\n const html = useReplaceableText(footer)\n\n return (\n <footer className=\"ob-footer-container\">\n <QuillHTML html={html} />\n </footer>\n )\n}\n\nexport default memo(OneBlinkFormFooter)\n"]}
|