@oneblink/apps-react 13.6.1-beta.1 → 13.7.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.
- package/dist/OneBlinkFormBase.js +8 -6
- package/dist/OneBlinkFormBase.js.map +1 -1
- package/dist/apps/services/integration-elements.js +3 -3
- package/dist/apps/services/integration-elements.js.map +1 -1
- package/dist/components/renderer/PageFormElements.js +10 -3
- package/dist/components/renderer/PageFormElements.js.map +1 -1
- package/dist/form-elements/FormElementABN.js +0 -9
- package/dist/form-elements/FormElementABN.js.map +1 -1
- package/dist/form-elements/FormElementAutocomplete.js +5 -6
- package/dist/form-elements/FormElementAutocomplete.js.map +1 -1
- package/dist/form-elements/FormElementBSB.js +30 -26
- package/dist/form-elements/FormElementBSB.js.map +1 -1
- package/dist/hooks/useFormValidation.js +3 -43
- package/dist/hooks/useFormValidation.js.map +1 -1
- package/dist/hooks/usePages.d.ts +4 -2
- package/dist/hooks/usePages.js +48 -39
- package/dist/hooks/usePages.js.map +1 -1
- package/dist/services/form-validation/getFormElementsValidatedForAudience.d.ts +6 -0
- package/dist/services/form-validation/getFormElementsValidatedForAudience.js +48 -0
- package/dist/services/form-validation/getFormElementsValidatedForAudience.js.map +1 -0
- package/dist/services/page-visibility.d.ts +13 -0
- package/dist/services/page-visibility.js +20 -0
- package/dist/services/page-visibility.js.map +1 -0
- package/package.json +1 -1
package/dist/OneBlinkFormBase.js
CHANGED
|
@@ -318,12 +318,13 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
318
318
|
//
|
|
319
319
|
// #region Pages
|
|
320
320
|
const [hasAttemptedSubmit, setHasAttemptedSubmit] = React.useState(false);
|
|
321
|
-
const { visiblePages, isFirstVisiblePage, isLastVisiblePage, isDisplayingCurrentPageError, isShowingMultiplePages, isStepsHeaderActive, toggleStepsNavigation, currentPageIndex, currentPage, currentPageNumber, checkDisplayPageError, setPageId, goToPreviousPage, goToNextPage, scrollToTopOfPageHTMLElementRef, } = usePages({
|
|
321
|
+
const { visiblePages, renderedPages, isFirstVisiblePage, isLastVisiblePage, isDisplayingCurrentPageError, isShowingMultiplePages, isStepsHeaderActive, toggleStepsNavigation, currentPageIndex, currentPage, currentPageNumber, checkDisplayPageError, setPageId, goToPreviousPage, goToNextPage, scrollToTopOfPageHTMLElementRef, } = usePages({
|
|
322
322
|
hasAttemptedSubmit,
|
|
323
323
|
pages,
|
|
324
324
|
formElementsValidation,
|
|
325
325
|
formElementsConditionallyShown,
|
|
326
326
|
scrollToTopOfPage,
|
|
327
|
+
audience,
|
|
327
328
|
});
|
|
328
329
|
// #endregion
|
|
329
330
|
//
|
|
@@ -898,7 +899,7 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
898
899
|
}
|
|
899
900
|
return (_jsx(FormMarkDirtyContextProvider, { markDirty: markFormDirty, children: _jsx(ThemeProvider, { theme: theme, children: _jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, children: _jsx(ReplaceInjectablesOverridesContext.Provider, { value: replaceInjectablesOverrides, children: _jsx(FormDefinitionContext.Provider, { value: definition, children: _jsx(FormElementOptionsContextProvider, { formIsReadOnly: isReadOnly, children: _jsx(FormElementLookupsContextProvider, { children: _jsx(OneBlinkFormContainerContext.Provider, { value: obFormContainerHTMLElementRef, children: _jsxs("div", { className: clsx('ob-form-container', {
|
|
900
901
|
'is-showing-pages': isShowingMultiplePages,
|
|
901
|
-
}), ref: obFormContainerHTMLElementRef, children: [_jsx("form", { name: "obForm", className: `ob-form cypress-ob-form ob-form__page-${currentPageIndex + 1}`, noValidate: true, onSubmit: (e) => handleSubmit(e, false), children: _jsxs("div", { children: [_jsx("div", { ref: scrollToTopOfPageHTMLElementRef }), isShowingMultiplePages && (_jsxs("div", { className: clsx('ob-steps-navigation', {
|
|
902
|
+
}), ref: obFormContainerHTMLElementRef, children: [_jsx("form", { name: "obForm", className: `ob-form cypress-ob-form ob-form__page-${currentPageIndex + 1}`, noValidate: true, onSubmit: (e) => handleSubmit(e, false), children: _jsxs("div", { children: [_jsx("div", { ref: scrollToTopOfPageHTMLElementRef }), isShowingMultiplePages && currentPage && (_jsxs("div", { className: clsx('ob-steps-navigation', {
|
|
902
903
|
'is-active': isStepsHeaderActive,
|
|
903
904
|
}), children: [_jsxs(Clickable, { className: clsx('ob-steps-navigation__header', {
|
|
904
905
|
'is-active': isStepsHeaderActive,
|
|
@@ -924,11 +925,11 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
924
925
|
'is-active': isStepsHeaderActive,
|
|
925
926
|
}), onClick: toggleStepsNavigation }), _jsxs("div", { className: "steps", children: [_jsx("div", { className: clsx('steps-content', {
|
|
926
927
|
'is-single-step': !isShowingMultiplePages,
|
|
927
|
-
}), children: _jsx(InjectPagesContext.Provider, { value: handlePagesLookupResult, children: _jsx(GoogleMapsApiKeyContext.Provider, { value: googleMapsApiKey, children: _jsx(AbnLookupAuthenticationGuidContext.Provider, { value: abnLookupAuthenticationGuid, children: _jsx(ValidationIconConfigurationContext.Provider, { value: validationIcon, children: _jsx(CaptchaContext.Provider, { value: captchaContextValue, children: _jsx(AttachmentBlobsProvider, { children: _jsx(FormIsReadOnlyContext.Provider, { value: isReadOnly, children: _jsx(EditableFormElementIdsContext.Provider, { value: expandedEditableFormElementIds, children: _jsx(FormAudienceContext.Provider, { value: audience, children: _jsx(TaskContext.Provider, { value: taskContextValue, children: _jsx(OnUploadAttachmentContext.Provider, { value: onUploadAttachment, children:
|
|
928
|
-
currentPage.id, formId: definition.id, formElementsConditionallyShown: formElementsConditionallyShown, formElementsValidation: formElementsValidation, displayValidationMessages: hasAttemptedSubmit ||
|
|
928
|
+
}), children: _jsx(InjectPagesContext.Provider, { value: handlePagesLookupResult, children: _jsx(GoogleMapsApiKeyContext.Provider, { value: googleMapsApiKey, children: _jsx(AbnLookupAuthenticationGuidContext.Provider, { value: abnLookupAuthenticationGuid, children: _jsx(ValidationIconConfigurationContext.Provider, { value: validationIcon, children: _jsx(CaptchaContext.Provider, { value: captchaContextValue, children: _jsx(AttachmentBlobsProvider, { children: _jsx(FormIsReadOnlyContext.Provider, { value: isReadOnly, children: _jsx(EditableFormElementIdsContext.Provider, { value: expandedEditableFormElementIds, children: _jsx(FormAudienceContext.Provider, { value: audience, children: _jsx(TaskContext.Provider, { value: taskContextValue, children: _jsx(OnUploadAttachmentContext.Provider, { value: onUploadAttachment, children: renderedPages.map((pageElement) => (_jsx(PageFormElements, { isActive: pageElement.id ===
|
|
929
|
+
(currentPage === null || currentPage === void 0 ? void 0 : currentPage.id), formId: definition.id, formElementsConditionallyShown: formElementsConditionallyShown, formElementsValidation: formElementsValidation, displayValidationMessages: hasAttemptedSubmit ||
|
|
929
930
|
(isDisplayingCurrentPageError &&
|
|
930
931
|
pageElement.id ===
|
|
931
|
-
currentPage.id), pageElement: pageElement, onChange: handleChange, model: submission, setFormSubmission: setFormSubmission, sectionState: sectionState }, pageElement.id))) }) }) }) }) }) }) }) }) }) }) }) }), isShowingMultiplePages && (_jsxs("div", { className: "steps-actions", children: [_jsx("div", { className: "steps-action", children: _jsxs("button", { type: "button", onClick: goToPreviousPage, disabled: isFirstVisiblePage, className: "button is-light cypress-pages-previous", children: [_jsx("span", { className: "icon", children: _jsx(MaterialIcon, { children: "keyboard_arrow_left" }) }), _jsx("span", { children: "Back" })] }) }), _jsx("div", { className: "step-progress-mobile cypress-steps-mobile", children: visiblePages.map((page, index) => (_jsx("div", { className: clsx('step-progress-mobile-dot', {
|
|
932
|
+
(currentPage === null || currentPage === void 0 ? void 0 : currentPage.id)), pageElement: pageElement, onChange: handleChange, model: submission, setFormSubmission: setFormSubmission, sectionState: sectionState }, pageElement.id))) }) }) }) }) }) }) }) }) }) }) }) }), isShowingMultiplePages && currentPage && (_jsxs("div", { className: "steps-actions", children: [_jsx("div", { className: "steps-action", children: _jsxs("button", { type: "button", onClick: goToPreviousPage, disabled: isFirstVisiblePage, className: "button is-light cypress-pages-previous", children: [_jsx("span", { className: "icon", children: _jsx(MaterialIcon, { children: "keyboard_arrow_left" }) }), _jsx("span", { children: "Back" })] }) }), _jsx("div", { className: "step-progress-mobile cypress-steps-mobile", children: visiblePages.map((page, index) => (_jsx("div", { className: clsx('step-progress-mobile-dot', {
|
|
932
933
|
'is-active': currentPage.id === page.id,
|
|
933
934
|
'is-completed': currentPageIndex > index,
|
|
934
935
|
'has-background-danger': currentPage.id !== page.id &&
|
|
@@ -949,7 +950,8 @@ function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captc
|
|
|
949
950
|
'Discard', icon: (_m = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptYes) === null || _m === void 0 ? void 0 : _m.icon }) })] }), children: _jsx("p", { children: "You have unsaved changes, are you sure you want discard them?" }) }), hostAttemptPhase.status === 'preparing' && (_jsx(HostPreparationEffect, { continueWithAttachments: hostAttemptPhase.continueWithAttachments, prepareSubmission: prepareSubmission, onResult: handleHostPreparationResult })), _jsx(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: _jsxs(_Fragment, { children: [_jsx("span", { style: { flex: 1 } }), _jsx("button", { type: "button", className: "button ob-button is-light cypress-attachments-confirm-wait", onClick: handleWaitForAttachments, children: "Wait" }), _jsx("button", { type: "button", className: "button ob-button is-primary cypress-attachments-confirm-continue", onClick: handleContinueWithAttachments, autoFocus: true, children: "Continue" })] }), children: _jsx("p", { children: "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." }) }), _jsxs(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: _jsxs(_Fragment, { children: [onSaveDraft && (_jsx("button", { type: "button", className: "button ob-button ob-button__offline-submission-attempt-save-draft is-success", onClick: () => handleSaveDraft(false), children: _jsx(CustomisableButtonInner, { label: ((_o = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _o === void 0 ? void 0 : _o.label) ||
|
|
950
951
|
'Save Draft', icon: (_p = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _p === void 0 ? void 0 : _p.icon }) })), _jsx("span", { style: { flex: 1 } }), _jsx("button", { className: "button ob-button ob-button__offline-submission-attempt-cancel is-light cypress-offline-submission-cancel", onClick: handleCancelOfflineSubmission, children: "Cancel" }), _jsx("button", { className: "button ob-button ob-button__offline-submission-attempt-try-again is-primary cypress-offline-submission-try-again", onClick: handleRetryOfflineSubmission, autoFocus: true, children: "Try Again" })] }), children: [_jsxs("p", { className: "ob-modal__offline-submission-attempt-message", children: ["You cannot submit this form while offline, please try again when connectivity is restored.", onSaveDraft && (_jsxs("span", { className: "ob-modal__offline-submission-attempt-save-draft-message", children: [' ', "Alternatively, click the", ' ', _jsx("b", { children: ((_q = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _q === void 0 ? void 0 : _q.label) ||
|
|
951
952
|
'Save Draft' }), ' ', "button below to come back to this later."] }))] }), _jsx(MaterialIcon, { className: "has-text-warning icon-x-large ob-modal__offline-submission-attempt-icon", children: "wifi_off" })] })] })), shouldUseNavigableValidationErrorsNotification &&
|
|
952
|
-
isShowingValidationErrorsCard &&
|
|
953
|
+
isShowingValidationErrorsCard &&
|
|
954
|
+
currentPage && (_jsx(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 }))] }) }) }) }) }) }) }) }) }));
|
|
953
955
|
}
|
|
954
956
|
export default React.memo(OneBlinkFormBase);
|
|
955
957
|
//# sourceMappingURL=OneBlinkFormBase.js.map
|