@oneblink/apps-react 8.4.0-beta.8 → 8.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OneBlinkFormBase.d.ts +7 -1
- package/dist/OneBlinkFormBase.js +140 -136
- package/dist/OneBlinkFormBase.js.map +1 -1
- package/dist/hooks/useFormElementOptions.js +10 -4
- package/dist/hooks/useFormElementOptions.js.map +1 -1
- package/dist/hooks/useReplaceInjectablesOverrides.d.ts +11 -0
- package/dist/hooks/useReplaceInjectablesOverrides.js +7 -0
- package/dist/hooks/useReplaceInjectablesOverrides.js.map +1 -0
- package/dist/hooks/useReplaceableText.js +7 -4
- package/dist/hooks/useReplaceableText.js.map +1 -1
- package/dist/hooks/useUserProfileForInjectables.d.ts +4 -0
- package/dist/hooks/useUserProfileForInjectables.js +18 -0
- package/dist/hooks/useUserProfileForInjectables.js.map +1 -0
- package/package.json +1 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { submissionService, attachmentsService } from '@oneblink/apps';
|
3
3
|
import { FormTypes, FormsAppsTypes, ScheduledTasksTypes, SubmissionTypes } from '@oneblink/types';
|
4
|
+
import { ReplaceInjectablesOverrides } from './hooks/useReplaceInjectablesOverrides';
|
4
5
|
import { CaptchaType, ExecutedLookups, SetFormSubmission } from './types/form';
|
5
6
|
export type OneBlinkReadOnlyFormProps = {
|
6
7
|
/**
|
@@ -26,6 +27,11 @@ export type OneBlinkReadOnlyFormProps = {
|
|
26
27
|
* scheduled task associated with a group via a form submission
|
27
28
|
*/
|
28
29
|
taskGroupInstance?: ScheduledTasksTypes.TaskGroupInstance;
|
30
|
+
/**
|
31
|
+
* Override the default behaviour when injecting values, such as in an info
|
32
|
+
* element or a default value.
|
33
|
+
*/
|
34
|
+
replaceInjectablesOverrides?: ReplaceInjectablesOverrides;
|
29
35
|
};
|
30
36
|
export type OneBlinkFormBaseProps = OneBlinkReadOnlyFormProps & {
|
31
37
|
/** The function to call when the user cancels the form */
|
@@ -131,6 +137,6 @@ export type OneBlinkFormControlledProps = {
|
|
131
137
|
type Props = OneBlinkFormBaseProps & OneBlinkFormControlledProps & {
|
132
138
|
isReadOnly: boolean;
|
133
139
|
};
|
134
|
-
declare function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captchaSiteKey, definition, disabled, isPreview, submission, isReadOnly, onCancel, onSubmit, onSaveDraft, setFormSubmission, buttons, primaryColour, attachmentRetentionInDays, isPendingQueueEnabled, handleNavigateAway, isInfoPage: isInfoPageProp, lastElementUpdated, executedLookups, task, taskGroup, taskGroupInstance, onUploadAttachment, captchaType, shouldUseNavigableValidationErrorsNotification, navigableValidationErrorsNotificationSettings, }: Props): React.JSX.Element;
|
140
|
+
declare function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captchaSiteKey, definition, disabled, isPreview, submission, isReadOnly, onCancel, onSubmit, onSaveDraft, setFormSubmission, buttons, primaryColour, attachmentRetentionInDays, isPendingQueueEnabled, handleNavigateAway, isInfoPage: isInfoPageProp, lastElementUpdated, executedLookups, task, taskGroup, taskGroupInstance, onUploadAttachment, captchaType, shouldUseNavigableValidationErrorsNotification, navigableValidationErrorsNotificationSettings, replaceInjectablesOverrides, }: Props): React.JSX.Element;
|
135
141
|
declare const _default: React.MemoExoticComponent<typeof OneBlinkFormBase>;
|
136
142
|
export default _default;
|
package/dist/OneBlinkFormBase.js
CHANGED
@@ -15,6 +15,7 @@ import useConditionalLogic from './hooks/useConditionalLogic';
|
|
15
15
|
import usePages from './hooks/usePages';
|
16
16
|
import useLookups from './hooks/useLookups';
|
17
17
|
import { FormDefinitionContext } from './hooks/useFormDefinition';
|
18
|
+
import { ReplaceInjectablesOverridesContext, } from './hooks/useReplaceInjectablesOverrides';
|
18
19
|
import { InjectPagesContext } from './hooks/useInjectPages';
|
19
20
|
import { FormElementOptionsContextProvider } from './hooks/useDynamicOptionsLoaderState';
|
20
21
|
import { FormElementLookupsContextProvider } from './hooks/useFormElementLookups';
|
@@ -37,10 +38,12 @@ import { injectOptionsAcrossAllElements } from './services/injectableOptions';
|
|
37
38
|
import MaterialIcon from './components/MaterialIcon';
|
38
39
|
import ValidationErrorsCard from './components/ValidationErrorsCard';
|
39
40
|
import { sendGoogleAnalyticsEvent } from './utils/sendGoogleAnalyticsEvent';
|
40
|
-
|
41
|
+
import { useUserProfileForInjectablesOutsideContext } from './hooks/useUserProfileForInjectables';
|
42
|
+
function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captchaSiteKey, definition, disabled, isPreview, submission, isReadOnly, onCancel, onSubmit, onSaveDraft, setFormSubmission, buttons, primaryColour, attachmentRetentionInDays, isPendingQueueEnabled, handleNavigateAway, isInfoPage: isInfoPageProp, lastElementUpdated, executedLookups, task, taskGroup, taskGroupInstance, onUploadAttachment, captchaType, shouldUseNavigableValidationErrorsNotification = true, navigableValidationErrorsNotificationSettings, replaceInjectablesOverrides, }) {
|
41
43
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
42
44
|
const isOffline = useIsOffline();
|
43
|
-
const { isUsingFormsKey
|
45
|
+
const { isUsingFormsKey } = useAuth();
|
46
|
+
const userProfileForInjectables = useUserProfileForInjectablesOutsideContext(replaceInjectablesOverrides === null || replaceInjectablesOverrides === void 0 ? void 0 : replaceInjectablesOverrides.getUserProfile);
|
44
47
|
const captchasRef = React.useRef([]);
|
45
48
|
const theme = React.useMemo(() => createMuiTheme({
|
46
49
|
palette: {
|
@@ -434,7 +437,7 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
434
437
|
elements: definition.elements,
|
435
438
|
submission: submissionData.submission,
|
436
439
|
taskContext: taskContextValue,
|
437
|
-
userProfile:
|
440
|
+
userProfile: userProfileForInjectables,
|
438
441
|
});
|
439
442
|
setIsPreparingToSubmit(false);
|
440
443
|
resetRecaptchas();
|
@@ -460,7 +463,7 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
460
463
|
allowNavigation,
|
461
464
|
definition,
|
462
465
|
taskContextValue,
|
463
|
-
|
466
|
+
userProfileForInjectables,
|
464
467
|
resetRecaptchas,
|
465
468
|
onSubmit,
|
466
469
|
captchaSiteKey,
|
@@ -623,142 +626,143 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
623
626
|
}
|
624
627
|
return (React.createElement(ThemeProvider, { theme: theme },
|
625
628
|
React.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns },
|
626
|
-
React.createElement(
|
627
|
-
React.createElement(
|
628
|
-
React.createElement(
|
629
|
-
React.createElement(
|
630
|
-
React.createElement(
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
React.createElement("
|
635
|
-
React.createElement("div",
|
636
|
-
|
637
|
-
|
638
|
-
}) },
|
639
|
-
React.createElement("div", { className: clsx('ob-steps-navigation__header', {
|
640
|
-
'is-active': isStepsHeaderActive,
|
641
|
-
}), onClick: toggleStepsNavigation },
|
642
|
-
React.createElement("span", { className: "icon is-invisible" },
|
643
|
-
React.createElement(MaterialIcon, null, "keyboard_arrow_down")),
|
644
|
-
React.createElement("div", { className: "steps-header-active-page" },
|
645
|
-
isDisplayingCurrentPageError ? (React.createElement("span", { className: "icon" },
|
646
|
-
React.createElement(MaterialIcon, { className: "has-text-danger is-size-4" }, "warning"))) : (React.createElement("span", { className: "steps-header-active-page-icon" }, currentPageNumber)),
|
647
|
-
React.createElement("span", { className: "steps-header-active-page-label cypress-tablet-step-title" }, currentPage ? currentPage.label : '')),
|
648
|
-
React.createElement("span", { className: "dropdown icon" },
|
649
|
-
React.createElement(MaterialIcon, null, "keyboard_arrow_down"))),
|
650
|
-
React.createElement("div", { className: clsx('ob-steps-navigation__steps', {
|
629
|
+
React.createElement(ReplaceInjectablesOverridesContext.Provider, { value: replaceInjectablesOverrides },
|
630
|
+
React.createElement(FormDefinitionContext.Provider, { value: definition },
|
631
|
+
React.createElement(FormElementOptionsContextProvider, null,
|
632
|
+
React.createElement(FormElementLookupsContextProvider, null,
|
633
|
+
React.createElement(OneBlinkFormContainerContext.Provider, { value: obFormContainerHTMLElementRef.current },
|
634
|
+
React.createElement("div", { className: clsx('ob-form-container', {
|
635
|
+
'is-showing-pages': isShowingMultiplePages,
|
636
|
+
}), ref: obFormContainerHTMLElementRef },
|
637
|
+
React.createElement("form", { name: "obForm", className: `ob-form cypress-ob-form ob-form__page-${currentPageIndex + 1}`, noValidate: true, onSubmit: (e) => handleSubmit(e, false) },
|
638
|
+
React.createElement("div", null,
|
639
|
+
React.createElement("div", { ref: scrollToTopOfPageHTMLElementRef }),
|
640
|
+
isShowingMultiplePages && (React.createElement("div", { className: clsx('ob-steps-navigation', {
|
651
641
|
'is-active': isStepsHeaderActive,
|
652
642
|
}) },
|
653
|
-
React.createElement("div", { className:
|
654
|
-
|
655
|
-
|
643
|
+
React.createElement("div", { className: clsx('ob-steps-navigation__header', {
|
644
|
+
'is-active': isStepsHeaderActive,
|
645
|
+
}), onClick: toggleStepsNavigation },
|
646
|
+
React.createElement("span", { className: "icon is-invisible" },
|
647
|
+
React.createElement(MaterialIcon, null, "keyboard_arrow_down")),
|
648
|
+
React.createElement("div", { className: "steps-header-active-page" },
|
649
|
+
isDisplayingCurrentPageError ? (React.createElement("span", { className: "icon" },
|
650
|
+
React.createElement(MaterialIcon, { className: "has-text-danger is-size-4" }, "warning"))) : (React.createElement("span", { className: "steps-header-active-page-icon" }, currentPageNumber)),
|
651
|
+
React.createElement("span", { className: "steps-header-active-page-label cypress-tablet-step-title" }, currentPage ? currentPage.label : '')),
|
652
|
+
React.createElement("span", { className: "dropdown icon" },
|
653
|
+
React.createElement(MaterialIcon, null, "keyboard_arrow_down"))),
|
654
|
+
React.createElement("div", { className: clsx('ob-steps-navigation__steps', {
|
655
|
+
'is-active': isStepsHeaderActive,
|
656
|
+
}) },
|
657
|
+
React.createElement("div", { className: "steps is-small is-horizontal-tablet cypress-steps" }, visiblePages.map((page, index) => {
|
658
|
+
const hasErrors = checkDisplayPageError(page);
|
659
|
+
return (React.createElement("div", { key: page.id, id: `steps-navigation-step-${page.id}`, className: clsx('step-item cypress-step-item', {
|
660
|
+
'is-active': currentPage.id === page.id,
|
661
|
+
'is-completed': currentPageIndex > index,
|
662
|
+
'is-error': hasErrors,
|
663
|
+
}), onClick: (e) => {
|
664
|
+
e.stopPropagation();
|
665
|
+
if (page.id !== currentPage.id) {
|
666
|
+
setPageId(page.id);
|
667
|
+
}
|
668
|
+
} },
|
669
|
+
React.createElement("div", { className: "step-marker step-marker-error ob-step-marker cypress-step-marker",
|
670
|
+
// @ts-expect-error ???
|
671
|
+
name: `cypress-page-stepper-${index + 1}`, value: index + 1 }, hasErrors ? (React.createElement(Tooltip, { title: "Page has errors" },
|
672
|
+
React.createElement("span", { className: "icon tooltip has-tooltip-top cypress-page-error" },
|
673
|
+
React.createElement(MaterialIcon, { className: "has-text-danger is-size-3" }, "warning")))) : (React.createElement("span", null, index + 1))),
|
674
|
+
React.createElement("div", { className: "step-details ob-step-details" },
|
675
|
+
React.createElement("p", { className: "step-title ob-step-title cypress-desktop-step-title", id: `steps-navigation-step-label-${page.id}` }, page.label))));
|
676
|
+
}))))),
|
677
|
+
React.createElement("div", { className: clsx('ob-steps-navigation__background', {
|
678
|
+
'is-active': isStepsHeaderActive,
|
679
|
+
}), onClick: toggleStepsNavigation }),
|
680
|
+
React.createElement("div", { className: "steps" },
|
681
|
+
React.createElement("div", { className: clsx('steps-content', {
|
682
|
+
'is-single-step': !isShowingMultiplePages,
|
683
|
+
}) },
|
684
|
+
React.createElement(InjectPagesContext.Provider, { value: handlePagesLookupResult },
|
685
|
+
React.createElement(GoogleMapsApiKeyContext.Provider, { value: googleMapsApiKey },
|
686
|
+
React.createElement(AbnLookupAuthenticationGuidContext.Provider, { value: abnLookupAuthenticationGuid },
|
687
|
+
React.createElement(CaptchaContext.Provider, { value: captchaContextValue },
|
688
|
+
React.createElement(AttachmentBlobsProvider, null,
|
689
|
+
React.createElement(FormIsReadOnlyContext.Provider, { value: isReadOnly },
|
690
|
+
React.createElement(TaskContext.Provider, { value: taskContextValue },
|
691
|
+
React.createElement(OnUploadAttachmentContext.Provider, { value: onUploadAttachment }, visiblePages.map((pageElement) => (React.createElement(PageFormElements, { key: pageElement.id, isActive: pageElement.id ===
|
692
|
+
currentPage.id, formId: definition.id, formElementsConditionallyShown: formElementsConditionallyShown, formElementsValidation: formElementsValidation, displayValidationMessages: hasAttemptedSubmit ||
|
693
|
+
isDisplayingCurrentPageError, pageElement: pageElement, onChange: handleChange, model: submission, setFormSubmission: setFormSubmission })))))))))))),
|
694
|
+
isShowingMultiplePages && (React.createElement("div", { className: "steps-actions" },
|
695
|
+
React.createElement("div", { className: "steps-action" },
|
696
|
+
React.createElement("button", { type: "button", onClick: goToPreviousPage, disabled: isFirstVisiblePage, className: "button is-light cypress-pages-previous" },
|
697
|
+
React.createElement("span", { className: "icon" },
|
698
|
+
React.createElement(MaterialIcon, null, "keyboard_arrow_left")),
|
699
|
+
React.createElement("span", null, "Back"))),
|
700
|
+
React.createElement("div", { className: "step-progress-mobile cypress-steps-mobile" }, visiblePages.map((page, index) => (React.createElement("div", { key: page.id, className: clsx('step-progress-mobile-dot', {
|
656
701
|
'is-active': currentPage.id === page.id,
|
657
702
|
'is-completed': currentPageIndex > index,
|
658
|
-
'
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
React.createElement("
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
!submissionConditionallyEnabled },
|
722
|
-
React.createElement(CustomisableButtonInner, { label: isInfoPage
|
723
|
-
? 'Done'
|
724
|
-
: ((_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 })))))))),
|
725
|
-
!isReadOnly && !isPreview && (React.createElement(React.Fragment, null,
|
726
|
-
React.createElement(Prompt, { when: isDirty && !isNavigationAllowed, message: handleBlockedNavigation }),
|
727
|
-
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,
|
728
|
-
onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button is-success cypress-cancel-confirm-save-draft", onClick: () => handleSaveDraft(false) },
|
729
|
-
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 }))),
|
730
|
-
React.createElement("span", { style: { flex: 1 } }),
|
731
|
-
React.createElement("button", { type: "button", className: "button ob-button is-light cypress-cancel-confirm-back", onClick: handleKeepGoing },
|
732
|
-
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 })),
|
733
|
-
React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-cancel-confirm-discard", onClick: handleDiscardUnsavedChanges, autoFocus: true },
|
734
|
-
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 }))) },
|
735
|
-
React.createElement("p", null, "You have unsaved changes, are you sure you want discard them?")),
|
736
|
-
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,
|
737
|
-
React.createElement("span", { style: { flex: 1 } }),
|
738
|
-
React.createElement("button", { type: "button", className: "button ob-button is-light cypress-attachments-confirm-wait", onClick: handleWaitForAttachments }, "Wait"),
|
739
|
-
React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-attachments-confirm-continue", onClick: handleContinueWithAttachments, autoFocus: true }, "Continue")) },
|
740
|
-
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.")),
|
741
|
-
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,
|
742
|
-
onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button ob-button__offline-submission-attempt-save-draft is-success", onClick: () => handleSaveDraft(false) },
|
743
|
-
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 }))),
|
744
|
-
React.createElement("span", { style: { flex: 1 } }),
|
745
|
-
React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-cancel is-light", onClick: () => setPromptOfflineSubmissionAttempt(false) }, "Cancel"),
|
746
|
-
React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-try-again is-primary", onClick: (e) => {
|
747
|
-
setPromptOfflineSubmissionAttempt(false);
|
748
|
-
handleSubmit(e, false);
|
749
|
-
}, autoFocus: true }, "Try Again")) },
|
750
|
-
React.createElement("p", { className: "ob-modal__offline-submission-attempt-message" },
|
751
|
-
"You cannot submit this form while offline, please try again when connectivity is restored.",
|
752
|
-
onSaveDraft && (React.createElement("span", { className: "ob-modal__offline-submission-attempt-save-draft-message" },
|
753
|
-
' ',
|
754
|
-
"Alternatively, click the",
|
755
|
-
' ',
|
756
|
-
React.createElement("b", null, ((_q = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _q === void 0 ? void 0 : _q.label) || 'Save Draft'),
|
757
|
-
' ',
|
758
|
-
"button below to come back to this later."))),
|
759
|
-
React.createElement(MaterialIcon, { className: "has-text-warning icon-x-large ob-modal__offline-submission-attempt-icon" }, "wifi_off")))),
|
760
|
-
shouldUseNavigableValidationErrorsNotification &&
|
761
|
-
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 }))))))))));
|
703
|
+
'has-background-danger': currentPage.id !== page.id &&
|
704
|
+
checkDisplayPageError(page),
|
705
|
+
}) })))),
|
706
|
+
React.createElement("div", { className: "steps-action" },
|
707
|
+
React.createElement("button", { type: "button", onClick: goToNextPage, disabled: isLastVisiblePage, className: "button is-light cypress-pages-next" },
|
708
|
+
React.createElement("span", null, "Next"),
|
709
|
+
React.createElement("span", { className: "icon" },
|
710
|
+
React.createElement(MaterialIcon, null, "keyboard_arrow_right"))))))),
|
711
|
+
!isReadOnly && (React.createElement("div", { className: "buttons ob-buttons ob-buttons-submit" },
|
712
|
+
onSaveDraft && !isInfoPage && (React.createElement("button", { type: "button", className: "button ob-button is-primary ob-button-save-draft cypress-save-draft-form", onClick: () => handleSaveDraft(false), disabled: isPreview || disabled },
|
713
|
+
React.createElement(CustomisableButtonInner, { label: ((_a = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _a === void 0 ? void 0 : _a.label) || 'Save Draft', icon: (_b = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _b === void 0 ? void 0 : _b.icon }))),
|
714
|
+
React.createElement("span", { className: "ob-buttons-submit__spacer" }),
|
715
|
+
!isInfoPage && (React.createElement("button", { type: "button", className: "button ob-button is-light ob-button-submit-cancel cypress-cancel-form", onClick: handleCancel, disabled: isPreview || disabled },
|
716
|
+
React.createElement(CustomisableButtonInner, { label: ((_c = buttons === null || buttons === void 0 ? void 0 : buttons.cancel) === null || _c === void 0 ? void 0 : _c.label) || 'Cancel', icon: (_d = buttons === null || buttons === void 0 ? void 0 : buttons.cancel) === null || _d === void 0 ? void 0 : _d.icon }))),
|
717
|
+
isLastVisiblePage && (React.createElement(Tooltip, { title: submissionConditionallyEnabled
|
718
|
+
? ''
|
719
|
+
: 'Submission disabled: Your inputs have not met the criteria for submission' },
|
720
|
+
React.createElement("button", { type: "submit", className: clsx('button ob-button is-success ob-button-submit cypress-submit-form-button cypress-submit-form', { 'is-loading': isPreparingToSubmit }, {
|
721
|
+
'ob-button-submit-is-disabled': submissionConditionallyEnabled,
|
722
|
+
}), disabled: isPreview ||
|
723
|
+
disabled ||
|
724
|
+
isPreparingToSubmit ||
|
725
|
+
!submissionConditionallyEnabled },
|
726
|
+
React.createElement(CustomisableButtonInner, { label: isInfoPage
|
727
|
+
? 'Done'
|
728
|
+
: ((_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 })))))))),
|
729
|
+
!isReadOnly && !isPreview && (React.createElement(React.Fragment, null,
|
730
|
+
React.createElement(Prompt, { when: isDirty && !isNavigationAllowed, message: handleBlockedNavigation }),
|
731
|
+
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,
|
732
|
+
onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button is-success cypress-cancel-confirm-save-draft", onClick: () => handleSaveDraft(false) },
|
733
|
+
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 }))),
|
734
|
+
React.createElement("span", { style: { flex: 1 } }),
|
735
|
+
React.createElement("button", { type: "button", className: "button ob-button is-light cypress-cancel-confirm-back", onClick: handleKeepGoing },
|
736
|
+
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 })),
|
737
|
+
React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-cancel-confirm-discard", onClick: handleDiscardUnsavedChanges, autoFocus: true },
|
738
|
+
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 }))) },
|
739
|
+
React.createElement("p", null, "You have unsaved changes, are you sure you want discard them?")),
|
740
|
+
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,
|
741
|
+
React.createElement("span", { style: { flex: 1 } }),
|
742
|
+
React.createElement("button", { type: "button", className: "button ob-button is-light cypress-attachments-confirm-wait", onClick: handleWaitForAttachments }, "Wait"),
|
743
|
+
React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-attachments-confirm-continue", onClick: handleContinueWithAttachments, autoFocus: true }, "Continue")) },
|
744
|
+
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.")),
|
745
|
+
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,
|
746
|
+
onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button ob-button__offline-submission-attempt-save-draft is-success", onClick: () => handleSaveDraft(false) },
|
747
|
+
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 }))),
|
748
|
+
React.createElement("span", { style: { flex: 1 } }),
|
749
|
+
React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-cancel is-light", onClick: () => setPromptOfflineSubmissionAttempt(false) }, "Cancel"),
|
750
|
+
React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-try-again is-primary", onClick: (e) => {
|
751
|
+
setPromptOfflineSubmissionAttempt(false);
|
752
|
+
handleSubmit(e, false);
|
753
|
+
}, autoFocus: true }, "Try Again")) },
|
754
|
+
React.createElement("p", { className: "ob-modal__offline-submission-attempt-message" },
|
755
|
+
"You cannot submit this form while offline, please try again when connectivity is restored.",
|
756
|
+
onSaveDraft && (React.createElement("span", { className: "ob-modal__offline-submission-attempt-save-draft-message" },
|
757
|
+
' ',
|
758
|
+
"Alternatively, click the",
|
759
|
+
' ',
|
760
|
+
React.createElement("b", null, ((_q = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _q === void 0 ? void 0 : _q.label) || 'Save Draft'),
|
761
|
+
' ',
|
762
|
+
"button below to come back to this later."))),
|
763
|
+
React.createElement(MaterialIcon, { className: "has-text-warning icon-x-large ob-modal__offline-submission-attempt-icon" }, "wifi_off")))),
|
764
|
+
shouldUseNavigableValidationErrorsNotification &&
|
765
|
+
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 })))))))))));
|
762
766
|
}
|
763
767
|
export default React.memo(OneBlinkFormBase);
|
764
768
|
//# 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,EAEnB,kBAAkB,GACnB,MAAM,gBAAgB,CAAA;AAQvB,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,MAAM,wCAAwC,CAAA;AACrE,OAAO,iBAAiB,MAAM,2BAA2B,CAAA;AACzD,OAAO,mBAAmB,MAAM,6BAA6B,CAAA;AAC7D,OAAO,QAAQ,MAAM,kBAAkB,CAAA;AACvC,OAAO,UAAU,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAA;AACxF,OAAO,EAAE,iCAAiC,EAA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DAAyD;gDACtE,GAAG;;gDACqB,GAAG;gDAC5B,+BACG,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,KAAK,KAAI,YAAY,CACxC;gDAAC,GAAG;2FAEH,CACR,CACC;wCACJ,oBAAC,YAAY,IAAC,SAAS,EAAC,yEAAyE,eAElF,CACT,CACO,CAClB;gCACA,8CAA8C;oCAC7C,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,CACZ,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 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 { 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} from './types/form'\nimport checkBsbsAreInvalid from './services/checkBsbsAreInvalid'\nimport checkIfBsbsAreValidating from './services/checkIfBsbsAreValidating'\nimport checkIfAttachmentsExist from './services/checkIfAttachmentsExist'\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'\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\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 /** 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}\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 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}: Props) {\n const isOffline = useIsOffline()\n const { isUsingFormsKey, userProfile } = useAuth()\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 // #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(definition, submission)\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: userProfile ?? undefined,\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 userProfile,\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 })\n }\n },\n [\n allowNavigation,\n checkAttachmentsCanBeSubmitted,\n definition,\n disabled,\n getCurrentSubmissionData,\n onSaveDraft,\n checkBsbAreValidating,\n lastElementUpdated,\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 }) => {\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 element.type === 'section'\n ) {\n return\n }\n\n setUnsavedChangesState((current) => ({\n ...current,\n isDirty: true,\n }))\n // dont update the last element updated for elements the user cannot set the value of\n 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 }\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 setHasResumed(true)\n }\n }, [\n lastElementUpdated,\n hasResumed,\n lastElementUpdatedPage,\n lastElementUpdatedExistsOnForm,\n setPageId,\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 <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 = 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 <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 />\n ),\n )}\n </OnUploadAttachmentContext.Provider>\n </TaskContext.Provider>\n </FormIsReadOnlyContext.Provider>\n </AttachmentBlobsProvider>\n </CaptchaContext.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': 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={buttons?.cancelPromptNo?.label || 'Back'}\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 the\n app? If you click continue the attachments will upload\n in the background. Do not close the app until the\n 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 try\n 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 </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;AAQvB,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,MAAM,wCAAwC,CAAA;AACrE,OAAO,iBAAiB,MAAM,2BAA2B,CAAA;AACzD,OAAO,mBAAmB,MAAM,6BAA6B,CAAA;AAC7D,OAAO,QAAQ,MAAM,kBAAkB,CAAA;AACvC,OAAO,UAAU,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EACL,kCAA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S,EAAC,wEAAwE,EAClF,OAAO,EAAE,GAAG,EAAE,CACZ,iCAAiC,CAAC,KAAK,CAAC,aAInC;gDACT,gCACE,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 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} from './types/form'\nimport checkBsbsAreInvalid from './services/checkBsbsAreInvalid'\nimport checkIfBsbsAreValidating from './services/checkIfBsbsAreValidating'\nimport checkIfAttachmentsExist from './services/checkIfAttachmentsExist'\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'\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 /** 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}\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 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}: 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 // #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(definition, submission)\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 })\n }\n },\n [\n allowNavigation,\n checkAttachmentsCanBeSubmitted,\n definition,\n disabled,\n getCurrentSubmissionData,\n onSaveDraft,\n checkBsbAreValidating,\n lastElementUpdated,\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 }) => {\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 element.type === 'section'\n ) {\n return\n }\n\n setUnsavedChangesState((current) => ({\n ...current,\n isDirty: true,\n }))\n // dont update the last element updated for elements the user cannot set the value of\n 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 }\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 setHasResumed(true)\n }\n }, [\n lastElementUpdated,\n hasResumed,\n lastElementUpdatedPage,\n lastElementUpdatedExistsOnForm,\n setPageId,\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 <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 />\n ),\n )}\n </OnUploadAttachmentContext.Provider>\n </TaskContext.Provider>\n </FormIsReadOnlyContext.Provider>\n </AttachmentBlobsProvider>\n </CaptchaContext.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"]}
|
@@ -3,10 +3,10 @@ import { useLoadDynamicOptionsEffect } from './useDynamicOptionsLoaderState';
|
|
3
3
|
import useFormSubmissionModel from './useFormSubmissionModelContext';
|
4
4
|
import processInjectableOption from '../services/injectableOptions';
|
5
5
|
import useTaskContext from './useTaskContext';
|
6
|
-
import
|
6
|
+
import useUserProfileForInjectables from './useUserProfileForInjectables';
|
7
7
|
export default function useFormElementOptions({ element, value, onChange, conditionallyShownOptionsElement, onFilter, onUpdateFormElements, }) {
|
8
8
|
const taskContext = useTaskContext();
|
9
|
-
const
|
9
|
+
const userProfileForInjectables = useUserProfileForInjectables();
|
10
10
|
const { formSubmissionModel, elements } = useFormSubmissionModel();
|
11
11
|
const conditionallyShownOptions = conditionallyShownOptionsElement === null || conditionallyShownOptionsElement === void 0 ? void 0 : conditionallyShownOptionsElement.options;
|
12
12
|
//options that are shown due to conditional logic
|
@@ -30,12 +30,18 @@ export default function useFormElementOptions({ element, value, onChange, condit
|
|
30
30
|
submission: formSubmissionModel,
|
31
31
|
formElements: elements,
|
32
32
|
taskContext,
|
33
|
-
userProfile:
|
33
|
+
userProfile: userProfileForInjectables,
|
34
34
|
});
|
35
35
|
memo.push(...newOptions);
|
36
36
|
return memo;
|
37
37
|
}, []);
|
38
|
-
}, [
|
38
|
+
}, [
|
39
|
+
elements,
|
40
|
+
formSubmissionModel,
|
41
|
+
shownOptions,
|
42
|
+
taskContext,
|
43
|
+
userProfileForInjectables,
|
44
|
+
]);
|
39
45
|
//options that are shown based on conditional logic and user input
|
40
46
|
const filteredOptions = React.useMemo(() => {
|
41
47
|
const reducedOptions = withInjectedOptions.filter((option) => !onFilter || (onFilter(option) && !option.displayAlways));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useFormElementOptions.js","sourceRoot":"","sources":["../../src/hooks/useFormElementOptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,sBAAsB,MAAM,iCAAiC,CAAA;AACpE,OAAO,uBAAuB,MAAM,+BAA+B,CAAA;AACnE,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAC7C,OAAO,
|
1
|
+
{"version":3,"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AAG,EAAE;QACnB,IACE,CAAC,OAAO,CAAC,OAAO;aAChB,gCAAgC,aAAhC,gCAAgC,uBAAhC,gCAAgC,CAAE,mBAAmB,CAAA,EACrD,CAAC;YACD,OAAM;QACR,CAAC;QAED,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,EAC7D,CAAC;YACD,QAAQ,CAAC,OAAO,EAAE;gBAChB,KAAK,EAAE,SAAS;aACjB,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,EAAE,CAC9C,mBAAmB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,KAAK,MAAM,CAAC,KAAK,CAAC,CACrE,CAAA;YACD,IAAI,QAAQ,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;gBACrC,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAA;gBAC5D,QAAQ,CAAC,OAAO,EAAE;oBAChB,KAAK,EAAE,aAA8B;iBACtC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC,EAAE;QACD,OAAO;QACP,YAAY;QACZ,QAAQ;QACR,KAAK;QACL,gCAAgC,aAAhC,gCAAgC,uBAAhC,gCAAgC,CAAE,mBAAmB;QACrD,mBAAmB;KACpB,CAAC,CAAA;IAEF,2BAA2B,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAA;IAE1D,OAAO,eAAe,CAAA;AACxB,CAAC","sourcesContent":["import { FormTypes } from '@oneblink/types'\nimport * as React from 'react'\nimport {\n FormElementValueChangeHandler,\n FormElementConditionallyShownElement,\n UpdateFormElementsHandler,\n} from '../types/form'\nimport { useLoadDynamicOptionsEffect } from './useDynamicOptionsLoaderState'\nimport useFormSubmissionModel from './useFormSubmissionModelContext'\nimport processInjectableOption from '../services/injectableOptions'\nimport useTaskContext from './useTaskContext'\nimport useUserProfileForInjectables from './useUserProfileForInjectables'\n\nexport default function useFormElementOptions<T>({\n element,\n value,\n onChange,\n conditionallyShownOptionsElement,\n onFilter,\n onUpdateFormElements,\n}: {\n element: FormTypes.FormElementWithOptions\n value: unknown | undefined\n onChange: FormElementValueChangeHandler<T>\n conditionallyShownOptionsElement:\n | FormElementConditionallyShownElement\n | undefined\n onFilter?: (choiceElementOption: FormTypes.ChoiceElementOption) => boolean\n onUpdateFormElements: UpdateFormElementsHandler\n}) {\n const taskContext = useTaskContext()\n const userProfileForInjectables = useUserProfileForInjectables()\n\n const { formSubmissionModel, elements } = useFormSubmissionModel()\n const conditionallyShownOptions = conditionallyShownOptionsElement?.options\n //options that are shown due to conditional logic\n const shownOptions = React.useMemo<FormTypes.ChoiceElementOption[]>(() => {\n if (!element.options) {\n return []\n }\n if (!conditionallyShownOptions && !onFilter) {\n return element.options\n }\n return element.options.filter((option) => {\n return (\n !conditionallyShownOptions ||\n conditionallyShownOptions.some(({ id }) => id === option.id)\n )\n })\n }, [conditionallyShownOptions, element.options, onFilter])\n\n //\n const withInjectedOptions = React.useMemo(() => {\n return shownOptions.reduce<FormTypes.ChoiceElementOption[]>(\n (memo, option) => {\n const newOptions = processInjectableOption({\n option,\n submission: formSubmissionModel,\n formElements: elements,\n taskContext,\n userProfile: userProfileForInjectables,\n })\n memo.push(...newOptions)\n\n return memo\n },\n [],\n )\n }, [\n elements,\n formSubmissionModel,\n shownOptions,\n taskContext,\n userProfileForInjectables,\n ])\n\n //options that are shown based on conditional logic and user input\n const filteredOptions = React.useMemo<FormTypes.ChoiceElementOption[]>(() => {\n const reducedOptions = withInjectedOptions.filter(\n (option) => !onFilter || (onFilter(option) && !option.displayAlways),\n )\n if (element.type === 'autocomplete') {\n const alwaysShownOptions = withInjectedOptions.filter(\n (option) => option.displayAlways,\n )\n reducedOptions.push(...alwaysShownOptions)\n }\n return reducedOptions\n }, [withInjectedOptions, element.type, onFilter])\n\n React.useEffect(() => {\n if (\n !element.options ||\n conditionallyShownOptionsElement?.dependencyIsLoading\n ) {\n return\n }\n\n if (\n typeof value === 'string' &&\n !withInjectedOptions.some((option) => value === option.value)\n ) {\n onChange(element, {\n value: undefined,\n })\n return\n }\n\n if (Array.isArray(value)) {\n const newValue = value.filter((selectedValue) =>\n withInjectedOptions.some((option) => selectedValue === option.value),\n )\n if (newValue.length !== value.length) {\n const newValueArray = newValue.length ? newValue : undefined\n onChange(element, {\n value: newValueArray as T | undefined,\n })\n }\n }\n }, [\n element,\n shownOptions,\n onChange,\n value,\n conditionallyShownOptionsElement?.dependencyIsLoading,\n withInjectedOptions,\n ])\n\n useLoadDynamicOptionsEffect(element, onUpdateFormElements)\n\n return filteredOptions\n}\n"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { MiscTypes } from '@oneblink/types';
|
2
|
+
export type ReplaceInjectablesOverrides = {
|
3
|
+
/**
|
4
|
+
* A function that returns the user profile. If not provided, the user profile
|
5
|
+
* will be that of the currently logged in user. The user profile is used for
|
6
|
+
* any injectable `{USER:}` values.
|
7
|
+
*/
|
8
|
+
getUserProfile?: () => MiscTypes.UserProfile | undefined;
|
9
|
+
};
|
10
|
+
export declare const ReplaceInjectablesOverridesContext: import("react").Context<ReplaceInjectablesOverrides | undefined>;
|
11
|
+
export default function useReplaceInjectablesOverrides(): ReplaceInjectablesOverrides | undefined;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { useContext } from 'react';
|
2
|
+
import { createContext } from 'react';
|
3
|
+
export const ReplaceInjectablesOverridesContext = createContext(undefined);
|
4
|
+
export default function useReplaceInjectablesOverrides() {
|
5
|
+
return useContext(ReplaceInjectablesOverridesContext);
|
6
|
+
}
|
7
|
+
//# sourceMappingURL=useReplaceInjectablesOverrides.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useReplaceInjectablesOverrides.js","sourceRoot":"","sources":["../../src/hooks/useReplaceInjectablesOverrides.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAWrC,MAAM,CAAC,MAAM,kCAAkC,GAAG,aAAa,CAE7D,SAAS,CAAC,CAAA;AAEZ,MAAM,CAAC,OAAO,UAAU,8BAA8B;IACpD,OAAO,UAAU,CAAC,kCAAkC,CAAC,CAAA;AACvD,CAAC","sourcesContent":["import { MiscTypes } from '@oneblink/types'\nimport { useContext } from 'react'\nimport { createContext } from 'react'\n\nexport type ReplaceInjectablesOverrides = {\n /**\n * A function that returns the user profile. If not provided, the user profile\n * will be that of the currently logged in user. The user profile is used for\n * any injectable `{USER:}` values.\n */\n getUserProfile?: () => MiscTypes.UserProfile | undefined\n}\n\nexport const ReplaceInjectablesOverridesContext = createContext<\n ReplaceInjectablesOverrides | undefined\n>(undefined)\n\nexport default function useReplaceInjectablesOverrides() {\n return useContext(ReplaceInjectablesOverridesContext)\n}\n"]}
|
@@ -1,17 +1,19 @@
|
|
1
|
-
import { localisationService
|
2
|
-
import
|
1
|
+
import { localisationService } from '@oneblink/apps';
|
2
|
+
import { useMemo } from 'react';
|
3
3
|
import useFormSubmissionModel from './useFormSubmissionModelContext';
|
4
4
|
import { useRepeatableSetIndexText } from '../form-elements/FormElementRepeatableSet';
|
5
5
|
import useTaskContext from './useTaskContext';
|
6
|
+
import useUserProfileForInjectables from './useUserProfileForInjectables';
|
6
7
|
export default function useReplaceableText(text) {
|
7
8
|
const textWithIndex = useRepeatableSetIndexText(text);
|
8
9
|
const { formSubmissionModel, elements } = useFormSubmissionModel();
|
9
10
|
const { task, taskGroup, taskGroupInstance } = useTaskContext();
|
10
|
-
|
11
|
+
const userProfile = useUserProfileForInjectables();
|
12
|
+
return useMemo(() => {
|
11
13
|
return localisationService.replaceInjectablesWithElementValues(textWithIndex, {
|
12
14
|
submission: formSubmissionModel,
|
13
15
|
formElements: elements,
|
14
|
-
userProfile
|
16
|
+
userProfile,
|
15
17
|
task,
|
16
18
|
taskGroup,
|
17
19
|
taskGroupInstance,
|
@@ -23,6 +25,7 @@ export default function useReplaceableText(text) {
|
|
23
25
|
taskGroup,
|
24
26
|
taskGroupInstance,
|
25
27
|
textWithIndex,
|
28
|
+
userProfile,
|
26
29
|
]);
|
27
30
|
}
|
28
31
|
//# sourceMappingURL=useReplaceableText.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useReplaceableText.js","sourceRoot":"","sources":["../../src/hooks/useReplaceableText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,
|
1
|
+
{"version":3,"file":"useReplaceableText.js","sourceRoot":"","sources":["../../src/hooks/useReplaceableText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,sBAAsB,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAA;AACrF,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAC7C,OAAO,4BAA4B,MAAM,gCAAgC,CAAA;AAEzE,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,IAAY;IACrD,MAAM,aAAa,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAA;IACrD,MAAM,EAAE,mBAAmB,EAAE,QAAQ,EAAE,GAAG,sBAAsB,EAAE,CAAA;IAClE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,cAAc,EAAE,CAAA;IAE/D,MAAM,WAAW,GAAG,4BAA4B,EAAE,CAAA;IAElD,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,OAAO,mBAAmB,CAAC,mCAAmC,CAC5D,aAAa,EACb;YACE,UAAU,EAAE,mBAAmB;YAC/B,YAAY,EAAE,QAAQ;YACtB,WAAW;YACX,IAAI;YACJ,SAAS;YACT,iBAAiB;SAClB,CACF,CAAC,IAAI,CAAA;IACR,CAAC,EAAE;QACD,QAAQ;QACR,mBAAmB;QACnB,IAAI;QACJ,SAAS;QACT,iBAAiB;QACjB,aAAa;QACb,WAAW;KACZ,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { localisationService } from '@oneblink/apps'\nimport { useMemo } from 'react'\nimport useFormSubmissionModel from './useFormSubmissionModelContext'\nimport { useRepeatableSetIndexText } from '../form-elements/FormElementRepeatableSet'\nimport useTaskContext from './useTaskContext'\nimport useUserProfileForInjectables from './useUserProfileForInjectables'\n\nexport default function useReplaceableText(text: string) {\n const textWithIndex = useRepeatableSetIndexText(text)\n const { formSubmissionModel, elements } = useFormSubmissionModel()\n const { task, taskGroup, taskGroupInstance } = useTaskContext()\n\n const userProfile = useUserProfileForInjectables()\n\n return useMemo(() => {\n return localisationService.replaceInjectablesWithElementValues(\n textWithIndex,\n {\n submission: formSubmissionModel,\n formElements: elements,\n userProfile,\n task,\n taskGroup,\n taskGroupInstance,\n },\n ).text\n }, [\n elements,\n formSubmissionModel,\n task,\n taskGroup,\n taskGroupInstance,\n textWithIndex,\n userProfile,\n ])\n}\n"]}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { ReplaceInjectablesOverrides } from './useReplaceInjectablesOverrides';
|
2
|
+
declare const useUserProfileForInjectables: () => import("@oneblink/types/typescript/misc").UserProfile | undefined;
|
3
|
+
export default useUserProfileForInjectables;
|
4
|
+
export declare const useUserProfileForInjectablesOutsideContext: (overrideUserProfile: ReplaceInjectablesOverrides["getUserProfile"]) => import("@oneblink/types/typescript/misc").UserProfile | undefined;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import useReplaceInjectablesOverrides from './useReplaceInjectablesOverrides';
|
2
|
+
import useAuth from './useAuth';
|
3
|
+
import { useMemo } from 'react';
|
4
|
+
const useUserProfileForInjectables = () => {
|
5
|
+
const replaceInjectablesOverrides = useReplaceInjectablesOverrides();
|
6
|
+
return useUserProfileForInjectablesOutsideContext(replaceInjectablesOverrides === null || replaceInjectablesOverrides === void 0 ? void 0 : replaceInjectablesOverrides.getUserProfile);
|
7
|
+
};
|
8
|
+
export default useUserProfileForInjectables;
|
9
|
+
export const useUserProfileForInjectablesOutsideContext = (overrideUserProfile) => {
|
10
|
+
const { userProfile } = useAuth();
|
11
|
+
return useMemo(() => {
|
12
|
+
if (overrideUserProfile) {
|
13
|
+
return overrideUserProfile();
|
14
|
+
}
|
15
|
+
return userProfile !== null && userProfile !== void 0 ? userProfile : undefined;
|
16
|
+
}, [overrideUserProfile, userProfile]);
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=useUserProfileForInjectables.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useUserProfileForInjectables.js","sourceRoot":"","sources":["../../src/hooks/useUserProfileForInjectables.ts"],"names":[],"mappings":"AAAA,OAAO,8BAEN,MAAM,kCAAkC,CAAA;AACzC,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,MAAM,4BAA4B,GAAG,GAAG,EAAE;IACxC,MAAM,2BAA2B,GAAG,8BAA8B,EAAE,CAAA;IACpE,OAAO,0CAA0C,CAC/C,2BAA2B,aAA3B,2BAA2B,uBAA3B,2BAA2B,CAAE,cAAc,CAC5C,CAAA;AACH,CAAC,CAAA;AAED,eAAe,4BAA4B,CAAA;AAE3C,MAAM,CAAC,MAAM,0CAA0C,GAAG,CACxD,mBAAkE,EAClE,EAAE;IACF,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE,CAAA;IACjC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,mBAAmB,EAAE,CAAC;YACxB,OAAO,mBAAmB,EAAE,CAAA;QAC9B,CAAC;QACD,OAAO,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,SAAS,CAAA;IACjC,CAAC,EAAE,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC,CAAA;AACxC,CAAC,CAAA","sourcesContent":["import useReplaceInjectablesOverrides, {\n ReplaceInjectablesOverrides,\n} from './useReplaceInjectablesOverrides'\nimport useAuth from './useAuth'\nimport { useMemo } from 'react'\n\nconst useUserProfileForInjectables = () => {\n const replaceInjectablesOverrides = useReplaceInjectablesOverrides()\n return useUserProfileForInjectablesOutsideContext(\n replaceInjectablesOverrides?.getUserProfile,\n )\n}\n\nexport default useUserProfileForInjectables\n\nexport const useUserProfileForInjectablesOutsideContext = (\n overrideUserProfile: ReplaceInjectablesOverrides['getUserProfile'],\n) => {\n const { userProfile } = useAuth()\n return useMemo(() => {\n if (overrideUserProfile) {\n return overrideUserProfile()\n }\n return userProfile ?? undefined\n }, [overrideUserProfile, userProfile])\n}\n"]}
|
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.
|
4
|
+
"version": "8.5.0-beta.1",
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/oneblink/apps-react/issues"
|