@oneblink/apps-react 7.3.0-beta.2 → 8.0.0-beta.2

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.
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
- import { submissionService } from '@oneblink/apps';
2
+ import { submissionService, attachmentsService } from '@oneblink/apps';
3
3
  import { FormTypes, FormsAppsTypes, ScheduledTasksTypes, SubmissionTypes } from '@oneblink/types';
4
- import { attachmentsService } from '@oneblink/apps';
5
4
  import { CaptchaType, ExecutedLookups, SetFormSubmission } from './types/form';
6
5
  export type OneBlinkReadOnlyFormProps = {
7
6
  /**
@@ -4,8 +4,9 @@ import Tooltip from './components/renderer/Tooltip';
4
4
  import { Prompt, useHistory } from 'react-router-dom';
5
5
  import clsx from 'clsx';
6
6
  import * as bulmaToast from 'bulma-toast';
7
- import { localisationService } from '@oneblink/apps';
8
- import { attachmentsService } from '@oneblink/apps';
7
+ import { localisationService, attachmentsService, } from '@oneblink/apps';
8
+ import { LocalizationProvider } from '@mui/x-date-pickers';
9
+ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
9
10
  import Modal from './components/renderer/Modal';
10
11
  import cleanFormSubmissionModel from './services/cleanFormSubmissionModel';
11
12
  import PageFormElements from './components/renderer/PageFormElements';
@@ -598,143 +599,144 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
598
599
  React.createElement("p", { className: "has-text-grey" }, localisationService.formatDatetimeLong(new Date())))));
599
600
  }
600
601
  return (React.createElement(ThemeProvider, { theme: theme },
601
- React.createElement(FormDefinitionContext.Provider, { value: definition },
602
- React.createElement(FormElementOptionsContextProvider, null,
603
- React.createElement(FormElementLookupsContextProvider, null,
604
- React.createElement(OneBlinkFormContainerContext.Provider, { value: obFormContainerHTMLElementRef.current },
605
- React.createElement("div", { className: clsx('ob-form-container', {
606
- 'is-showing-pages': isShowingMultiplePages,
607
- }), ref: obFormContainerHTMLElementRef },
608
- React.createElement("form", { name: "obForm", className: `ob-form cypress-ob-form ob-form__page-${currentPageIndex + 1}`, noValidate: true, onSubmit: (e) => handleSubmit(e, false) },
609
- React.createElement("div", null,
610
- React.createElement("div", { ref: scrollToTopOfPageHTMLElementRef }),
611
- isShowingMultiplePages && (React.createElement("div", { className: clsx('ob-steps-navigation', {
612
- 'is-active': isStepsHeaderActive,
613
- }) },
614
- React.createElement("div", { className: clsx('ob-steps-navigation__header', {
615
- 'is-active': isStepsHeaderActive,
616
- }), onClick: toggleStepsNavigation },
617
- React.createElement("span", { className: "icon is-invisible" },
618
- React.createElement(MaterialIcon, null, "keyboard_arrow_down")),
619
- React.createElement("div", { className: "steps-header-active-page" },
620
- isDisplayingCurrentPageError ? (React.createElement("span", { className: "icon" },
621
- React.createElement(MaterialIcon, { className: "has-text-danger is-size-4" }, "warning"))) : (React.createElement("span", { className: "steps-header-active-page-icon" }, currentPageNumber)),
622
- React.createElement("span", { className: "steps-header-active-page-label cypress-tablet-step-title" }, currentPage ? currentPage.label : '')),
623
- React.createElement("span", { className: "dropdown icon" },
624
- React.createElement(MaterialIcon, null, "keyboard_arrow_down"))),
625
- React.createElement("div", { className: clsx('ob-steps-navigation__steps', {
602
+ React.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns },
603
+ React.createElement(FormDefinitionContext.Provider, { value: definition },
604
+ React.createElement(FormElementOptionsContextProvider, null,
605
+ React.createElement(FormElementLookupsContextProvider, null,
606
+ React.createElement(OneBlinkFormContainerContext.Provider, { value: obFormContainerHTMLElementRef.current },
607
+ React.createElement("div", { className: clsx('ob-form-container', {
608
+ 'is-showing-pages': isShowingMultiplePages,
609
+ }), ref: obFormContainerHTMLElementRef },
610
+ React.createElement("form", { name: "obForm", className: `ob-form cypress-ob-form ob-form__page-${currentPageIndex + 1}`, noValidate: true, onSubmit: (e) => handleSubmit(e, false) },
611
+ React.createElement("div", null,
612
+ React.createElement("div", { ref: scrollToTopOfPageHTMLElementRef }),
613
+ isShowingMultiplePages && (React.createElement("div", { className: clsx('ob-steps-navigation', {
626
614
  'is-active': isStepsHeaderActive,
627
615
  }) },
628
- React.createElement("div", { className: "steps is-small is-horizontal-tablet cypress-steps" }, visiblePages.map((page, index) => {
629
- const hasErrors = checkDisplayPageError(page);
630
- return (React.createElement("div", { key: page.id, id: `steps-navigation-step-${page.id}`, className: clsx('step-item cypress-step-item', {
616
+ React.createElement("div", { className: clsx('ob-steps-navigation__header', {
617
+ 'is-active': isStepsHeaderActive,
618
+ }), onClick: toggleStepsNavigation },
619
+ React.createElement("span", { className: "icon is-invisible" },
620
+ React.createElement(MaterialIcon, null, "keyboard_arrow_down")),
621
+ React.createElement("div", { className: "steps-header-active-page" },
622
+ isDisplayingCurrentPageError ? (React.createElement("span", { className: "icon" },
623
+ React.createElement(MaterialIcon, { className: "has-text-danger is-size-4" }, "warning"))) : (React.createElement("span", { className: "steps-header-active-page-icon" }, currentPageNumber)),
624
+ React.createElement("span", { className: "steps-header-active-page-label cypress-tablet-step-title" }, currentPage ? currentPage.label : '')),
625
+ React.createElement("span", { className: "dropdown icon" },
626
+ React.createElement(MaterialIcon, null, "keyboard_arrow_down"))),
627
+ React.createElement("div", { className: clsx('ob-steps-navigation__steps', {
628
+ 'is-active': isStepsHeaderActive,
629
+ }) },
630
+ React.createElement("div", { className: "steps is-small is-horizontal-tablet cypress-steps" }, visiblePages.map((page, index) => {
631
+ const hasErrors = checkDisplayPageError(page);
632
+ return (React.createElement("div", { key: page.id, id: `steps-navigation-step-${page.id}`, className: clsx('step-item cypress-step-item', {
633
+ 'is-active': currentPage.id === page.id,
634
+ 'is-completed': currentPageIndex > index,
635
+ 'is-error': hasErrors,
636
+ }), onClick: (e) => {
637
+ e.stopPropagation();
638
+ if (page.id !== currentPage.id) {
639
+ setPageId(page.id);
640
+ }
641
+ } },
642
+ React.createElement("div", { className: "step-marker step-marker-error ob-step-marker cypress-step-marker",
643
+ // @ts-expect-error ???
644
+ name: `cypress-page-stepper-${index + 1}`, value: index + 1 }, hasErrors ? (React.createElement(Tooltip, { title: "Page has errors" },
645
+ React.createElement("span", { className: "icon tooltip has-tooltip-top cypress-page-error" },
646
+ React.createElement(MaterialIcon, { className: "has-text-danger is-size-3" }, "warning")))) : (React.createElement("span", null, index + 1))),
647
+ React.createElement("div", { className: "step-details ob-step-details" },
648
+ React.createElement("p", { className: "step-title ob-step-title cypress-desktop-step-title", id: `steps-navigation-step-label-${page.id}` }, page.label))));
649
+ }))))),
650
+ React.createElement("div", { className: clsx('ob-steps-navigation__background', {
651
+ 'is-active': isStepsHeaderActive,
652
+ }), onClick: toggleStepsNavigation }),
653
+ React.createElement("div", { className: "steps" },
654
+ React.createElement("div", { className: clsx('steps-content', {
655
+ 'is-single-step': !isShowingMultiplePages,
656
+ }) },
657
+ React.createElement(InjectPagesContext.Provider, { value: handlePagesLookupResult },
658
+ React.createElement(GoogleMapsApiKeyContext.Provider, { value: googleMapsApiKey },
659
+ React.createElement(AbnLookupAuthenticationGuidContext.Provider, { value: abnLookupAuthenticationGuid },
660
+ React.createElement(CaptchaContext.Provider, { value: captchaContextValue },
661
+ React.createElement(AttachmentBlobsProvider, null,
662
+ React.createElement(FormIsReadOnlyContext.Provider, { value: isReadOnly },
663
+ React.createElement(TaskContext.Provider, { value: taskContextValue },
664
+ React.createElement(OnUploadAttachmentContext.Provider, { value: onUploadAttachment }, visiblePages.map((pageElement) => (React.createElement(PageFormElements, { key: pageElement.id, isActive: pageElement.id ===
665
+ currentPage.id, formId: definition.id, formElementsConditionallyShown: formElementsConditionallyShown, formElementsValidation: formElementsValidation, displayValidationMessages: hasAttemptedSubmit ||
666
+ isDisplayingCurrentPageError, pageElement: pageElement, onChange: handleChange, model: submission, setFormSubmission: setFormSubmission })))))))))))),
667
+ isShowingMultiplePages && (React.createElement("div", { className: "steps-actions" },
668
+ React.createElement("div", { className: "steps-action" },
669
+ React.createElement("button", { type: "button", onClick: goToPreviousPage, disabled: isFirstVisiblePage, className: "button is-light cypress-pages-previous" },
670
+ React.createElement("span", { className: "icon" },
671
+ React.createElement(MaterialIcon, null, "keyboard_arrow_left")),
672
+ React.createElement("span", null, "Back"))),
673
+ 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', {
631
674
  'is-active': currentPage.id === page.id,
632
675
  'is-completed': currentPageIndex > index,
633
- 'is-error': hasErrors,
634
- }), onClick: (e) => {
635
- e.stopPropagation();
636
- if (page.id !== currentPage.id) {
637
- setPageId(page.id);
638
- }
639
- } },
640
- React.createElement("div", { className: "step-marker step-marker-error ob-step-marker cypress-step-marker",
641
- // @ts-expect-error ???
642
- name: `cypress-page-stepper-${index + 1}`, value: index + 1 }, hasErrors ? (React.createElement(Tooltip, { title: "Page has errors" },
643
- React.createElement("span", { className: "icon tooltip has-tooltip-top cypress-page-error" },
644
- React.createElement(MaterialIcon, { className: "has-text-danger is-size-3" }, "warning")))) : (React.createElement("span", null, index + 1))),
645
- React.createElement("div", { className: "step-details ob-step-details" },
646
- React.createElement("p", { className: "step-title ob-step-title cypress-desktop-step-title", id: `steps-navigation-step-label-${page.id}` }, page.label))));
647
- }))))),
648
- React.createElement("div", { className: clsx('ob-steps-navigation__background', {
649
- 'is-active': isStepsHeaderActive,
650
- }), onClick: toggleStepsNavigation }),
651
- React.createElement("div", { className: "steps" },
652
- React.createElement("div", { className: clsx('steps-content', {
653
- 'is-single-step': !isShowingMultiplePages,
654
- }) },
655
- React.createElement(InjectPagesContext.Provider, { value: handlePagesLookupResult },
656
- React.createElement(GoogleMapsApiKeyContext.Provider, { value: googleMapsApiKey },
657
- React.createElement(AbnLookupAuthenticationGuidContext.Provider, { value: abnLookupAuthenticationGuid },
658
- React.createElement(CaptchaContext.Provider, { value: captchaContextValue },
659
- React.createElement(AttachmentBlobsProvider, null,
660
- React.createElement(FormIsReadOnlyContext.Provider, { value: isReadOnly },
661
- React.createElement(TaskContext.Provider, { value: taskContextValue },
662
- React.createElement(OnUploadAttachmentContext.Provider, { value: onUploadAttachment }, visiblePages.map((pageElement) => (React.createElement(PageFormElements, { key: pageElement.id, isActive: pageElement.id ===
663
- currentPage.id, formId: definition.id, formElementsConditionallyShown: formElementsConditionallyShown, formElementsValidation: formElementsValidation, displayValidationMessages: hasAttemptedSubmit ||
664
- isDisplayingCurrentPageError, pageElement: pageElement, onChange: handleChange, model: submission, setFormSubmission: setFormSubmission })))))))))))),
665
- isShowingMultiplePages && (React.createElement("div", { className: "steps-actions" },
666
- React.createElement("div", { className: "steps-action" },
667
- React.createElement("button", { type: "button", onClick: goToPreviousPage, disabled: isFirstVisiblePage, className: "button is-light cypress-pages-previous" },
668
- React.createElement("span", { className: "icon" },
669
- React.createElement(MaterialIcon, null, "keyboard_arrow_left")),
670
- React.createElement("span", null, "Back"))),
671
- 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', {
672
- 'is-active': currentPage.id === page.id,
673
- 'is-completed': currentPageIndex > index,
674
- 'has-background-danger': currentPage.id !== page.id &&
675
- checkDisplayPageError(page),
676
- }) })))),
677
- React.createElement("div", { className: "steps-action" },
678
- React.createElement("button", { type: "button", onClick: goToNextPage, disabled: isLastVisiblePage, className: "button is-light cypress-pages-next" },
679
- React.createElement("span", null, "Next"),
680
- React.createElement("span", { className: "icon" },
681
- React.createElement(MaterialIcon, null, "keyboard_arrow_right"))))))),
682
- !isReadOnly && (React.createElement("div", { className: "buttons ob-buttons ob-buttons-submit" },
683
- 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 },
684
- 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 }))),
685
- React.createElement("span", { className: "ob-buttons-submit__spacer" }),
686
- !isInfoPage && (React.createElement("button", { type: "button", className: "button ob-button is-light ob-button-submit-cancel cypress-cancel-form", onClick: handleCancel, disabled: isPreview || disabled },
687
- 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 }))),
688
- isLastVisiblePage && (React.createElement(Tooltip, { title: submissionConditionallyEnabled
689
- ? ''
690
- : 'Submission disabled: Your inputs have not met the criteria for submission' },
691
- 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 }, {
692
- 'ob-button-submit-is-disabled': submissionConditionallyEnabled,
693
- }), disabled: isPreview ||
694
- disabled ||
695
- isPreparingToSubmit ||
696
- !submissionConditionallyEnabled },
697
- React.createElement(CustomisableButtonInner, { label: isInfoPage
698
- ? 'Done'
699
- : ((_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 })))))))),
700
- !isReadOnly && !isPreview && (React.createElement(React.Fragment, null,
701
- React.createElement(Prompt, { when: isDirty && !isNavigationAllowed, message: handleBlockedNavigation }),
702
- 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,
703
- onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button is-success cypress-cancel-confirm-save-draft", onClick: () => handleSaveDraft(false) },
704
- 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 }))),
705
- React.createElement("span", { style: { flex: 1 } }),
706
- React.createElement("button", { type: "button", className: "button ob-button is-light cypress-cancel-confirm-back", onClick: handleKeepGoing },
707
- 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 })),
708
- React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-cancel-confirm-discard", onClick: handleDiscardUnsavedChanges, autoFocus: true },
709
- 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 }))) },
710
- React.createElement("p", null, "You have unsaved changes, are you sure you want discard them?")),
711
- 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,
712
- React.createElement("span", { style: { flex: 1 } }),
713
- React.createElement("button", { type: "button", className: "button ob-button is-light cypress-attachments-confirm-wait", onClick: handleWaitForAttachments }, "Wait"),
714
- React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-attachments-confirm-continue", onClick: handleContinueWithAttachments, autoFocus: true }, "Continue")) },
715
- 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.")),
716
- 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,
717
- onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button ob-button__offline-submission-attempt-save-draft is-success", onClick: () => handleSaveDraft(false) },
718
- 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 }))),
719
- React.createElement("span", { style: { flex: 1 } }),
720
- React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-cancel is-light", onClick: () => setPromptOfflineSubmissionAttempt(false) }, "Cancel"),
721
- React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-try-again is-primary", onClick: (e) => {
722
- setPromptOfflineSubmissionAttempt(false);
723
- handleSubmit(e, false);
724
- }, autoFocus: true }, "Try Again")) },
725
- React.createElement("p", { className: "ob-modal__offline-submission-attempt-message" },
726
- "You cannot submit this form while offline, please try again when connectivity is restored.",
727
- onSaveDraft && (React.createElement("span", { className: "ob-modal__offline-submission-attempt-save-draft-message" },
728
- ' ',
729
- "Alternatively, click the",
730
- ' ',
731
- React.createElement("b", null, ((_q = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _q === void 0 ? void 0 : _q.label) || 'Save Draft'),
732
- ' ',
733
- "button below to come back to this later."))),
734
- React.createElement(MaterialIcon, { className: "has-text-warning icon-x-large ob-modal__offline-submission-attempt-icon" }, "wifi_off")))),
735
- shouldUseNavigableValidationErrorsNotification &&
736
- !!formElementsValidation &&
737
- hasAttemptedSubmit && (React.createElement(ValidationErrorsCard, { 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 })))))))));
676
+ 'has-background-danger': currentPage.id !== page.id &&
677
+ checkDisplayPageError(page),
678
+ }) })))),
679
+ React.createElement("div", { className: "steps-action" },
680
+ React.createElement("button", { type: "button", onClick: goToNextPage, disabled: isLastVisiblePage, className: "button is-light cypress-pages-next" },
681
+ React.createElement("span", null, "Next"),
682
+ React.createElement("span", { className: "icon" },
683
+ React.createElement(MaterialIcon, null, "keyboard_arrow_right"))))))),
684
+ !isReadOnly && (React.createElement("div", { className: "buttons ob-buttons ob-buttons-submit" },
685
+ 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 },
686
+ 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 }))),
687
+ React.createElement("span", { className: "ob-buttons-submit__spacer" }),
688
+ !isInfoPage && (React.createElement("button", { type: "button", className: "button ob-button is-light ob-button-submit-cancel cypress-cancel-form", onClick: handleCancel, disabled: isPreview || disabled },
689
+ 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 }))),
690
+ isLastVisiblePage && (React.createElement(Tooltip, { title: submissionConditionallyEnabled
691
+ ? ''
692
+ : 'Submission disabled: Your inputs have not met the criteria for submission' },
693
+ 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 }, {
694
+ 'ob-button-submit-is-disabled': submissionConditionallyEnabled,
695
+ }), disabled: isPreview ||
696
+ disabled ||
697
+ isPreparingToSubmit ||
698
+ !submissionConditionallyEnabled },
699
+ React.createElement(CustomisableButtonInner, { label: isInfoPage
700
+ ? 'Done'
701
+ : ((_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 })))))))),
702
+ !isReadOnly && !isPreview && (React.createElement(React.Fragment, null,
703
+ React.createElement(Prompt, { when: isDirty && !isNavigationAllowed, message: handleBlockedNavigation }),
704
+ 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,
705
+ onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button is-success cypress-cancel-confirm-save-draft", onClick: () => handleSaveDraft(false) },
706
+ 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 }))),
707
+ React.createElement("span", { style: { flex: 1 } }),
708
+ React.createElement("button", { type: "button", className: "button ob-button is-light cypress-cancel-confirm-back", onClick: handleKeepGoing },
709
+ 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 })),
710
+ React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-cancel-confirm-discard", onClick: handleDiscardUnsavedChanges, autoFocus: true },
711
+ 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 }))) },
712
+ React.createElement("p", null, "You have unsaved changes, are you sure you want discard them?")),
713
+ 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,
714
+ React.createElement("span", { style: { flex: 1 } }),
715
+ React.createElement("button", { type: "button", className: "button ob-button is-light cypress-attachments-confirm-wait", onClick: handleWaitForAttachments }, "Wait"),
716
+ React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-attachments-confirm-continue", onClick: handleContinueWithAttachments, autoFocus: true }, "Continue")) },
717
+ 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.")),
718
+ 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,
719
+ onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button ob-button__offline-submission-attempt-save-draft is-success", onClick: () => handleSaveDraft(false) },
720
+ 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 }))),
721
+ React.createElement("span", { style: { flex: 1 } }),
722
+ React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-cancel is-light", onClick: () => setPromptOfflineSubmissionAttempt(false) }, "Cancel"),
723
+ React.createElement("button", { className: "button ob-button ob-button__offline-submission-attempt-try-again is-primary", onClick: (e) => {
724
+ setPromptOfflineSubmissionAttempt(false);
725
+ handleSubmit(e, false);
726
+ }, autoFocus: true }, "Try Again")) },
727
+ React.createElement("p", { className: "ob-modal__offline-submission-attempt-message" },
728
+ "You cannot submit this form while offline, please try again when connectivity is restored.",
729
+ onSaveDraft && (React.createElement("span", { className: "ob-modal__offline-submission-attempt-save-draft-message" },
730
+ ' ',
731
+ "Alternatively, click the",
732
+ ' ',
733
+ React.createElement("b", null, ((_q = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _q === void 0 ? void 0 : _q.label) || 'Save Draft'),
734
+ ' ',
735
+ "button below to come back to this later."))),
736
+ React.createElement(MaterialIcon, { className: "has-text-warning icon-x-large ob-modal__offline-submission-attempt-icon" }, "wifi_off")))),
737
+ shouldUseNavigableValidationErrorsNotification &&
738
+ !!formElementsValidation &&
739
+ hasAttemptedSubmit && (React.createElement(ValidationErrorsCard, { 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 }))))))))));
738
740
  }
739
741
  export default React.memo(OneBlinkFormBase);
740
742
  //# sourceMappingURL=OneBlinkFormBase.js.map