@wise/dynamic-flow-client 5.16.1 → 5.17.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/build/i18n/nl.json +1 -1
- package/build/i18n/pt.json +1 -1
- package/build/i18n/ru.json +1 -1
- package/build/i18n/sv.json +38 -0
- package/build/i18n/th.json +1 -1
- package/build/i18n/tr.json +1 -1
- package/build/i18n/zh_CN.json +4 -4
- package/build/main.js +814 -825
- package/build/main.mjs +814 -825
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/build/types/controller/FlowController.d.ts +1 -2
- package/build/types/controller/FlowController.d.ts.map +1 -1
- package/build/types/controller/executeRequest.d.ts.map +1 -1
- package/build/types/domain/components/AlertComponent.d.ts +1 -1
- package/build/types/domain/components/AlertComponent.d.ts.map +1 -1
- package/build/types/domain/components/AllOfComponent.d.ts +1 -1
- package/build/types/domain/components/AllOfComponent.d.ts.map +1 -1
- package/build/types/domain/components/BooleanInputComponent.d.ts +2 -2
- package/build/types/domain/components/BooleanInputComponent.d.ts.map +1 -1
- package/build/types/domain/components/BoxComponent.d.ts +1 -1
- package/build/types/domain/components/BoxComponent.d.ts.map +1 -1
- package/build/types/domain/components/ButtonComponent.d.ts +1 -1
- package/build/types/domain/components/ButtonComponent.d.ts.map +1 -1
- package/build/types/domain/components/ColumnsComponent.d.ts +1 -1
- package/build/types/domain/components/ColumnsComponent.d.ts.map +1 -1
- package/build/types/domain/components/ConstComponent.d.ts +1 -1
- package/build/types/domain/components/ConstComponent.d.ts.map +1 -1
- package/build/types/domain/components/ContainerComponent.d.ts +1 -1
- package/build/types/domain/components/ContainerComponent.d.ts.map +1 -1
- package/build/types/domain/components/DateInputComponent.d.ts +2 -2
- package/build/types/domain/components/DateInputComponent.d.ts.map +1 -1
- package/build/types/domain/components/DecisionComponent.d.ts +3 -2
- package/build/types/domain/components/DecisionComponent.d.ts.map +1 -1
- package/build/types/domain/components/FormComponent.d.ts +1 -1
- package/build/types/domain/components/FormComponent.d.ts.map +1 -1
- package/build/types/domain/components/FormattedValueComponent.d.ts +1 -1
- package/build/types/domain/components/FormattedValueComponent.d.ts.map +1 -1
- package/build/types/domain/components/HeadingComponent.d.ts +1 -1
- package/build/types/domain/components/HeadingComponent.d.ts.map +1 -1
- package/build/types/domain/components/ImageComponent.d.ts +1 -1
- package/build/types/domain/components/ImageComponent.d.ts.map +1 -1
- package/build/types/domain/components/InstructionsComponent.d.ts +1 -1
- package/build/types/domain/components/InstructionsComponent.d.ts.map +1 -1
- package/build/types/domain/components/IntegerInputComponent.d.ts +2 -2
- package/build/types/domain/components/IntegerInputComponent.d.ts.map +1 -1
- package/build/types/domain/components/ListComponent.d.ts +1 -1
- package/build/types/domain/components/ListComponent.d.ts.map +1 -1
- package/build/types/domain/components/LoadingIndicatorComponent.d.ts +1 -1
- package/build/types/domain/components/LoadingIndicatorComponent.d.ts.map +1 -1
- package/build/types/domain/components/MarkdownComponent.d.ts +1 -1
- package/build/types/domain/components/MarkdownComponent.d.ts.map +1 -1
- package/build/types/domain/components/ModalComponent.d.ts +1 -1
- package/build/types/domain/components/ModalComponent.d.ts.map +1 -1
- package/build/types/domain/components/ModalLayoutComponent.d.ts +1 -1
- package/build/types/domain/components/ModalLayoutComponent.d.ts.map +1 -1
- package/build/types/domain/components/MoneyInputComponent.d.ts +1 -1
- package/build/types/domain/components/MoneyInputComponent.d.ts.map +1 -1
- package/build/types/domain/components/MultiSelectInputComponent.d.ts +2 -2
- package/build/types/domain/components/MultiSelectInputComponent.d.ts.map +1 -1
- package/build/types/domain/components/MultiUploadInputComponent.d.ts +3 -3
- package/build/types/domain/components/MultiUploadInputComponent.d.ts.map +1 -1
- package/build/types/domain/components/NumberInputComponent.d.ts +2 -2
- package/build/types/domain/components/NumberInputComponent.d.ts.map +1 -1
- package/build/types/domain/components/ObjectComponent.d.ts +1 -1
- package/build/types/domain/components/ObjectComponent.d.ts.map +1 -1
- package/build/types/domain/components/ParagraphComponent.d.ts +1 -1
- package/build/types/domain/components/ParagraphComponent.d.ts.map +1 -1
- package/build/types/domain/components/PersistAsyncComponent.d.ts.map +1 -1
- package/build/types/domain/components/ProgressComponent.d.ts +1 -1
- package/build/types/domain/components/ProgressComponent.d.ts.map +1 -1
- package/build/types/domain/components/RepeatableComponent.d.ts +5 -5
- package/build/types/domain/components/RepeatableComponent.d.ts.map +1 -1
- package/build/types/domain/components/ReviewComponent.d.ts +1 -1
- package/build/types/domain/components/ReviewComponent.d.ts.map +1 -1
- package/build/types/domain/components/RootDomainComponent.d.ts.map +1 -1
- package/build/types/domain/components/SectionComponent.d.ts.map +1 -1
- package/build/types/domain/components/SelectInputComponent.d.ts +2 -2
- package/build/types/domain/components/SelectInputComponent.d.ts.map +1 -1
- package/build/types/domain/components/StatusListComponent.d.ts +1 -1
- package/build/types/domain/components/StatusListComponent.d.ts.map +1 -1
- package/build/types/domain/components/SubflowComponent.d.ts +1 -1
- package/build/types/domain/components/SubflowComponent.d.ts.map +1 -1
- package/build/types/domain/components/TabsComponent.d.ts +1 -1
- package/build/types/domain/components/TabsComponent.d.ts.map +1 -1
- package/build/types/domain/components/TextInputComponent.d.ts +2 -2
- package/build/types/domain/components/TextInputComponent.d.ts.map +1 -1
- package/build/types/domain/components/TupleComponent.d.ts +1 -1
- package/build/types/domain/components/TupleComponent.d.ts.map +1 -1
- package/build/types/domain/components/UploadInputComponent.d.ts +2 -2
- package/build/types/domain/components/UploadInputComponent.d.ts.map +1 -1
- package/build/types/domain/components/UpsellComponent.d.ts +2 -2
- package/build/types/domain/components/UpsellComponent.d.ts.map +1 -1
- package/build/types/domain/components/searchComponent/SearchComponent.d.ts +3 -3
- package/build/types/domain/components/searchComponent/SearchComponent.d.ts.map +1 -1
- package/build/types/domain/components/step/ExternalConfirmationComponent.d.ts.map +1 -1
- package/build/types/domain/components/step/StepDomainComponent.d.ts +5 -2
- package/build/types/domain/components/step/StepDomainComponent.d.ts.map +1 -1
- package/build/types/domain/features/eventNames.d.ts +1 -1
- package/build/types/domain/features/eventNames.d.ts.map +1 -1
- package/build/types/domain/features/events.d.ts +2 -0
- package/build/types/domain/features/events.d.ts.map +1 -1
- package/build/types/domain/features/validation/value-checks.d.ts +1 -0
- package/build/types/domain/features/validation/value-checks.d.ts.map +1 -1
- package/build/types/domain/mappers/layout/decisionLayoutToComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/layout/reviewLayoutToComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/mapStepSchemas.d.ts.map +1 -1
- package/build/types/domain/mappers/mapStepToComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/allOfSchemaToComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiSelectComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiUploadComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/arraySchemaToComponent/arraySchemaToTupleComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/blobSchemaToComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/integerSchemaToComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/numberSchemaToComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/objectSchemaToComponent/objectSchemaToObjectComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/persistAsyncSchemaToComponent.d.ts +15 -15
- package/build/types/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/stringSchemaToComponent/stringSchemaToTextInputComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/schema/types.d.ts +1 -1
- package/build/types/domain/mappers/schema/types.d.ts.map +1 -1
- package/build/types/domain/mappers/utils/FeatureFlags.d.ts +1 -1
- package/build/types/domain/mappers/utils/FeatureFlags.d.ts.map +1 -1
- package/build/types/domain/mappers/utils/behavior-utils.d.ts.map +1 -1
- package/build/types/domain/mappers/utils/call-to-action-utils.d.ts.map +1 -1
- package/build/types/domain/mappers/utils/getHrefWithTracking.d.ts +8 -0
- package/build/types/domain/mappers/utils/getHrefWithTracking.d.ts.map +1 -0
- package/build/types/domain/mappers/utils/utils.d.ts.map +1 -1
- package/build/types/domain/types.d.ts +10 -0
- package/build/types/domain/types.d.ts.map +1 -1
- package/build/types/renderers/mappers/alertComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/booleanInputComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/columnsComponentToProps.d.ts +1 -1
- package/build/types/renderers/mappers/columnsComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/containerComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/dateInputComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/decisionComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/externalComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/formComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/integerInputComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/listComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/modalComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/modalLayoutComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/multiSelectComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/multiUploadInputComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/numberInputComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/repeatableComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/reviewComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/searchComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/sectionComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/selectInputComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/statusListComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/textInputComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/uploadInputComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/upsellComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/utils/inputComponentToProps.d.ts +13 -13
- package/build/types/renderers/mappers/utils/inputComponentToProps.d.ts.map +1 -1
- package/build/types/renderers/mappers/utils/mapCallToAction.d.ts +6 -0
- package/build/types/renderers/mappers/utils/mapCallToAction.d.ts.map +1 -0
- package/build/types/stories/utils/render-utils.d.ts.map +1 -1
- package/build/types/test-utils/DynamicFlowWise.d.ts.map +1 -1
- package/build/types/useDynamicFlow.d.ts.map +1 -1
- package/package.json +9 -9
- package/build/types/domain/components/utils/WithUpdate.d.ts +0 -5
- package/build/types/domain/components/utils/WithUpdate.d.ts.map +0 -1
package/build/main.js
CHANGED
|
@@ -472,7 +472,7 @@ var nl_default = {
|
|
|
472
472
|
"dynamicFlows.ControlFeedback.type": "Onjuist type",
|
|
473
473
|
"dynamicFlows.DownloadFeedback.failed": "Downloaden mislukt",
|
|
474
474
|
"dynamicFlows.DownloadFeedback.started": "Downloaden...",
|
|
475
|
-
"dynamicFlows.DownloadFeedback.successful": "
|
|
475
|
+
"dynamicFlows.DownloadFeedback.successful": "Downloaden gelukt",
|
|
476
476
|
"dynamicFlows.DynamicParagraph.copied": "Naar klembord gekopieerd",
|
|
477
477
|
"dynamicFlows.DynamicParagraph.copy": "Kopi\xEBren",
|
|
478
478
|
"dynamicFlows.ErrorBoundary.errorAlert": "Er is iets misgegaan.",
|
|
@@ -552,7 +552,7 @@ var pt_default = {
|
|
|
552
552
|
"dynamicFlows.ControlFeedback.type": "Tipo incorreto",
|
|
553
553
|
"dynamicFlows.DownloadFeedback.failed": "Falha no envio",
|
|
554
554
|
"dynamicFlows.DownloadFeedback.started": "Baixando...",
|
|
555
|
-
"dynamicFlows.DownloadFeedback.successful": "Download
|
|
555
|
+
"dynamicFlows.DownloadFeedback.successful": "Download realizado",
|
|
556
556
|
"dynamicFlows.DynamicParagraph.copied": "Copiado",
|
|
557
557
|
"dynamicFlows.DynamicParagraph.copy": "Copiar",
|
|
558
558
|
"dynamicFlows.ErrorBoundary.errorAlert": "Algo deu errado.",
|
|
@@ -632,7 +632,7 @@ var ru_default = {
|
|
|
632
632
|
"dynamicFlows.ControlFeedback.type": "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0442\u0438\u043F",
|
|
633
633
|
"dynamicFlows.DownloadFeedback.failed": "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043A\u0430\u0447\u0430\u0442\u044C",
|
|
634
634
|
"dynamicFlows.DownloadFeedback.started": "\u0421\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435...",
|
|
635
|
-
"dynamicFlows.DownloadFeedback.successful": "
|
|
635
|
+
"dynamicFlows.DownloadFeedback.successful": "\u0421\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E",
|
|
636
636
|
"dynamicFlows.DynamicParagraph.copied": "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E \u0432 \u0431\u0443\u0444\u0435\u0440 \u043E\u0431\u043C\u0435\u043D\u0430",
|
|
637
637
|
"dynamicFlows.DynamicParagraph.copy": "\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C",
|
|
638
638
|
"dynamicFlows.ErrorBoundary.errorAlert": "\u0427\u0442\u043E-\u0442\u043E \u043F\u043E\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A.",
|
|
@@ -672,7 +672,7 @@ var th_default = {
|
|
|
672
672
|
"dynamicFlows.ControlFeedback.type": "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07",
|
|
673
673
|
"dynamicFlows.DownloadFeedback.failed": "\u0E14\u0E32\u0E27\u0E19\u0E4C\u0E42\u0E2B\u0E25\u0E14\u0E25\u0E49\u0E21\u0E40\u0E2B\u0E25\u0E27",
|
|
674
674
|
"dynamicFlows.DownloadFeedback.started": "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E14\u0E32\u0E27\u0E19\u0E4C\u0E42\u0E2B\u0E25\u0E14...",
|
|
675
|
-
"dynamicFlows.DownloadFeedback.successful": "
|
|
675
|
+
"dynamicFlows.DownloadFeedback.successful": "\u0E14\u0E32\u0E27\u0E19\u0E4C\u0E42\u0E2B\u0E25\u0E14\u0E40\u0E23\u0E35\u0E22\u0E1A\u0E23\u0E49\u0E2D\u0E22\u0E41\u0E25\u0E49\u0E27",
|
|
676
676
|
"dynamicFlows.DynamicParagraph.copied": "\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01\u0E44\u0E1B\u0E22\u0E31\u0E07\u0E04\u0E25\u0E34\u0E1B\u0E1A\u0E2D\u0E23\u0E4C\u0E14",
|
|
677
677
|
"dynamicFlows.DynamicParagraph.copy": "\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01",
|
|
678
678
|
"dynamicFlows.ErrorBoundary.errorAlert": "\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14\u0E1A\u0E32\u0E07\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E02\u0E36\u0E49\u0E19",
|
|
@@ -712,7 +712,7 @@ var tr_default = {
|
|
|
712
712
|
"dynamicFlows.ControlFeedback.type": "Ge\xE7ersiz se\xE7im",
|
|
713
713
|
"dynamicFlows.DownloadFeedback.failed": "\u0130ndirme ba\u015Far\u0131s\u0131z",
|
|
714
714
|
"dynamicFlows.DownloadFeedback.started": "\u0130ndiriliyor...",
|
|
715
|
-
"dynamicFlows.DownloadFeedback.successful": "
|
|
715
|
+
"dynamicFlows.DownloadFeedback.successful": "\u0130ndirme ba\u015Far\u0131l\u0131",
|
|
716
716
|
"dynamicFlows.DynamicParagraph.copied": "Panoya kopyaland\u0131",
|
|
717
717
|
"dynamicFlows.DynamicParagraph.copy": "Kopyala",
|
|
718
718
|
"dynamicFlows.ErrorBoundary.errorAlert": "Bir sorun olu\u015Ftu.",
|
|
@@ -751,8 +751,8 @@ var zh_CN_default = {
|
|
|
751
751
|
"dynamicFlows.ControlFeedback.required": "\u8BF7\u586B\u5199\u6B64\u5B57\u6BB5\u3002",
|
|
752
752
|
"dynamicFlows.ControlFeedback.type": "\u7C7B\u578B\u9519\u8BEF",
|
|
753
753
|
"dynamicFlows.DownloadFeedback.failed": "\u4E0B\u8F7D\u5931\u8D25",
|
|
754
|
-
"dynamicFlows.DownloadFeedback.started": "\u6B63\u5728\u4E0B\u8F7D
|
|
755
|
-
"dynamicFlows.DownloadFeedback.successful": "
|
|
754
|
+
"dynamicFlows.DownloadFeedback.started": "\u6B63\u5728\u4E0B\u8F7D\u2026\u2026",
|
|
755
|
+
"dynamicFlows.DownloadFeedback.successful": "\u4E0B\u8F7D\u6210\u529F",
|
|
756
756
|
"dynamicFlows.DynamicParagraph.copied": "\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F",
|
|
757
757
|
"dynamicFlows.DynamicParagraph.copy": "\u590D\u5236",
|
|
758
758
|
"dynamicFlows.ErrorBoundary.errorAlert": "\u51FA\u9519\u4E86\u3002",
|
|
@@ -762,14 +762,14 @@ var zh_CN_default = {
|
|
|
762
762
|
"dynamicFlows.ExternalConfirmation.open": "\u5728\u65B0\u6807\u7B7E\u9875\u4E2D\u6253\u5F00",
|
|
763
763
|
"dynamicFlows.ExternalConfirmation.title": "\u8BF7\u786E\u8BA4",
|
|
764
764
|
"dynamicFlows.FileUploadSchema.maxFileSizeError": "\u62B1\u6B49\uFF0C\u8BE5\u6587\u4EF6\u592A\u5927\u3002\u8BF7\u4E0A\u4F20\u4E00\u4E2A\u66F4\u5C0F\u7684\u6587\u4EF6\u3002",
|
|
765
|
-
"dynamicFlows.FileUploadSchema.wrongFileTypeError": "\u62B1\u6B49\uFF0C\u4E0D\u652F\u6301\u8BE5\u6587\u4EF6\u683C\u5F0F\u3002\u8BF7\u4E0A\u4F20\u5176\u4ED6\u6587\u4EF6\u3002",
|
|
765
|
+
"dynamicFlows.FileUploadSchema.wrongFileTypeError": "\u62B1\u6B49\uFF0C\u7CFB\u7EDF\u6682\u4E0D\u652F\u6301\u8BE5\u6587\u4EF6\u683C\u5F0F\u3002\u8BF7\u4E0A\u4F20\u5176\u4ED6\u6587\u4EF6\u3002",
|
|
766
766
|
"dynamicFlows.Help.ariaLabel": "\u70B9\u51FB\u6B64\u5904\u83B7\u53D6\u66F4\u591A\u4FE1\u606F\u3002",
|
|
767
767
|
"dynamicFlows.MultiSelect.summary": "{first} \u548C\u5176\u4ED6 {count} \u4E2A",
|
|
768
768
|
"dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "\u62B1\u6B49\uFF0C\u8BE5\u6587\u4EF6\u592A\u5927\u3002\u8BF7\u4E0A\u4F20\u4E00\u4E2A\u66F4\u5C0F\u7684\u6587\u4EF6\u3002",
|
|
769
769
|
"dynamicFlows.MultipleFileUploadSchema.maxItemsError": "\u8BF7\u4E0A\u4F20\u4E0D\u8D85\u8FC7 {maxItems} \u4E2A\u6587\u4EF6\u3002",
|
|
770
770
|
"dynamicFlows.MultipleFileUploadSchema.minItemsError": "\u8BF7\u4E0A\u4F20\u81F3\u5C11 {minItems} \u4E2A\u6587\u4EF6\u3002",
|
|
771
771
|
"dynamicFlows.PersistAsyncSchema.genericError": "\u51FA\u9519\u4E86\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
772
|
-
"dynamicFlows.SearchLayout.loading": "\u6B63\u5728\u52A0\u8F7D\u2026"
|
|
772
|
+
"dynamicFlows.SearchLayout.loading": "\u6B63\u5728\u52A0\u8F7D\u2026\u2026"
|
|
773
773
|
};
|
|
774
774
|
|
|
775
775
|
// src/i18n/zh_HK.json
|
|
@@ -1049,7 +1049,7 @@ var getInputUpdateFunction = (onComponentUpdate) => {
|
|
|
1049
1049
|
// src/domain/components/RootDomainComponent.ts
|
|
1050
1050
|
var createRootDomainComponent = (onComponentUpdate, scrollToTop, backConfig, requestCache) => {
|
|
1051
1051
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
1052
|
-
const
|
|
1052
|
+
const component = {
|
|
1053
1053
|
type: "root",
|
|
1054
1054
|
kind: "step",
|
|
1055
1055
|
uid: "root",
|
|
@@ -1057,107 +1057,104 @@ var createRootDomainComponent = (onComponentUpdate, scrollToTop, backConfig, req
|
|
|
1057
1057
|
stepStack: [],
|
|
1058
1058
|
backConfig,
|
|
1059
1059
|
requestCache,
|
|
1060
|
-
_update(updateFn) {
|
|
1061
|
-
update(this, updateFn);
|
|
1062
|
-
},
|
|
1063
1060
|
dismissAllModals() {
|
|
1064
1061
|
var _a;
|
|
1065
|
-
(_a =
|
|
1062
|
+
(_a = component.getStep()) == null ? void 0 : _a.dismissAllModals();
|
|
1066
1063
|
},
|
|
1067
1064
|
dismissModal() {
|
|
1068
1065
|
var _a;
|
|
1069
|
-
(_a =
|
|
1066
|
+
(_a = component.getStep()) == null ? void 0 : _a.dismissModal();
|
|
1070
1067
|
},
|
|
1071
1068
|
showModal(modal) {
|
|
1072
1069
|
var _a;
|
|
1073
|
-
(_a =
|
|
1070
|
+
(_a = component.getStep()) == null ? void 0 : _a.showModal(modal);
|
|
1074
1071
|
},
|
|
1075
1072
|
getChildren() {
|
|
1076
|
-
const step =
|
|
1073
|
+
const step = component.getStep();
|
|
1077
1074
|
return step ? [step, ...step.getModals()] : [];
|
|
1078
1075
|
},
|
|
1079
1076
|
getLocalValue() {
|
|
1080
1077
|
var _a, _b;
|
|
1081
|
-
return (_b = (_a =
|
|
1078
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.getLocalValue()) != null ? _b : null;
|
|
1082
1079
|
},
|
|
1083
1080
|
async getSubmittableValue() {
|
|
1084
1081
|
var _a, _b;
|
|
1085
|
-
return (_b = (_a =
|
|
1082
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.getSubmittableValue()) != null ? _b : null;
|
|
1086
1083
|
},
|
|
1087
1084
|
getSubmittableValueSync() {
|
|
1088
1085
|
var _a, _b;
|
|
1089
|
-
return (_b = (_a =
|
|
1086
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.getSubmittableValueSync()) != null ? _b : null;
|
|
1090
1087
|
},
|
|
1091
1088
|
validate() {
|
|
1092
1089
|
var _a, _b;
|
|
1093
|
-
return (_b = (_a =
|
|
1090
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.validate()) != null ? _b : false;
|
|
1094
1091
|
},
|
|
1095
1092
|
setLoadingState(loadingState) {
|
|
1096
1093
|
var _a;
|
|
1097
|
-
(_a =
|
|
1094
|
+
(_a = component.getStep()) == null ? void 0 : _a.setLoadingState(loadingState);
|
|
1098
1095
|
},
|
|
1099
1096
|
getLoadingState() {
|
|
1100
1097
|
var _a, _b;
|
|
1101
|
-
return (_b = (_a =
|
|
1098
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.loadingState) != null ? _b : "initial";
|
|
1102
1099
|
},
|
|
1103
1100
|
getSchemaComponents() {
|
|
1104
1101
|
var _a, _b;
|
|
1105
|
-
return (_b = (_a =
|
|
1102
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.schemaComponents) != null ? _b : [];
|
|
1106
1103
|
},
|
|
1107
1104
|
getTrackEvent() {
|
|
1108
1105
|
var _a, _b;
|
|
1109
|
-
return (_b = (_a =
|
|
1106
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.trackEvent) != null ? _b : null;
|
|
1110
1107
|
},
|
|
1111
1108
|
isBusy() {
|
|
1112
|
-
const loadingState =
|
|
1109
|
+
const loadingState = component.getLoadingState();
|
|
1113
1110
|
return loadingState === "submitting" || loadingState === "refreshing";
|
|
1114
1111
|
},
|
|
1115
1112
|
hasStep() {
|
|
1116
|
-
return Boolean(
|
|
1113
|
+
return Boolean(component.stepStack.length > 0);
|
|
1117
1114
|
},
|
|
1118
1115
|
getStep() {
|
|
1119
1116
|
var _a;
|
|
1120
|
-
return (_a =
|
|
1117
|
+
return (_a = component.stepStack[component.stepStack.length - 1]) != null ? _a : null;
|
|
1121
1118
|
},
|
|
1122
1119
|
addSubflow(subflow) {
|
|
1123
1120
|
var _a;
|
|
1124
|
-
(_a =
|
|
1121
|
+
(_a = component.getStep()) == null ? void 0 : _a.addSubflow(subflow);
|
|
1125
1122
|
},
|
|
1126
1123
|
closeSubflow() {
|
|
1127
1124
|
var _a;
|
|
1128
|
-
(_a =
|
|
1125
|
+
(_a = component.getStep()) == null ? void 0 : _a.closeSubflow();
|
|
1129
1126
|
},
|
|
1130
1127
|
getSubflow() {
|
|
1131
1128
|
var _a, _b;
|
|
1132
|
-
return (_b = (_a =
|
|
1129
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.subflow) != null ? _b : null;
|
|
1133
1130
|
},
|
|
1134
1131
|
start() {
|
|
1135
1132
|
var _a;
|
|
1136
|
-
(_a =
|
|
1133
|
+
(_a = component.getStep()) == null ? void 0 : _a.start();
|
|
1137
1134
|
},
|
|
1138
1135
|
stop() {
|
|
1139
1136
|
var _a;
|
|
1140
|
-
(_a =
|
|
1137
|
+
(_a = component.getStep()) == null ? void 0 : _a.stop();
|
|
1141
1138
|
},
|
|
1142
1139
|
updateStep(stepComponent) {
|
|
1143
1140
|
var _a;
|
|
1144
|
-
|
|
1145
|
-
const shouldScroll = shouldScrollOnStepUpdate(stepComponent,
|
|
1146
|
-
|
|
1141
|
+
component.closeSubflow();
|
|
1142
|
+
const shouldScroll = shouldScrollOnStepUpdate(stepComponent, component.getStep());
|
|
1143
|
+
update(component, (draft) => {
|
|
1147
1144
|
draft.stepStack = draft.stepStack.slice(0, -1);
|
|
1148
1145
|
draft.stepStack.push(stepComponent);
|
|
1149
1146
|
});
|
|
1150
1147
|
if (shouldScroll) {
|
|
1151
1148
|
scrollToTop == null ? void 0 : scrollToTop("smooth");
|
|
1152
1149
|
}
|
|
1153
|
-
(_a =
|
|
1150
|
+
(_a = component.getStep()) == null ? void 0 : _a.start();
|
|
1154
1151
|
},
|
|
1155
1152
|
pushStep(stepComponent) {
|
|
1156
1153
|
var _a;
|
|
1157
|
-
|
|
1158
|
-
const previousStep =
|
|
1154
|
+
component.closeSubflow();
|
|
1155
|
+
const previousStep = component.getStep();
|
|
1159
1156
|
const previousStepHasPolling = previousStep == null ? void 0 : previousStep.step.polling;
|
|
1160
|
-
|
|
1157
|
+
update(component, (draft) => {
|
|
1161
1158
|
switch (stepComponent.stackBehavior) {
|
|
1162
1159
|
case "remove-previous":
|
|
1163
1160
|
case "replace-current":
|
|
@@ -1174,41 +1171,41 @@ var createRootDomainComponent = (onComponentUpdate, scrollToTop, backConfig, req
|
|
|
1174
1171
|
}
|
|
1175
1172
|
});
|
|
1176
1173
|
if (previousStep != null) {
|
|
1177
|
-
(_a =
|
|
1174
|
+
(_a = component.getStep()) == null ? void 0 : _a.start();
|
|
1178
1175
|
scrollToTop == null ? void 0 : scrollToTop("instant");
|
|
1179
1176
|
}
|
|
1180
1177
|
},
|
|
1181
1178
|
clearStack() {
|
|
1182
|
-
const currentStep =
|
|
1179
|
+
const currentStep = component.getStep();
|
|
1183
1180
|
if (currentStep) {
|
|
1184
|
-
|
|
1181
|
+
update(component, (draft) => {
|
|
1185
1182
|
draft.stepStack = [currentStep];
|
|
1186
1183
|
});
|
|
1187
1184
|
}
|
|
1188
1185
|
},
|
|
1189
1186
|
getRefreshUrl() {
|
|
1190
1187
|
var _a, _b, _c, _d;
|
|
1191
|
-
return (_d = (_c = (_a =
|
|
1188
|
+
return (_d = (_c = (_a = component.getStep()) == null ? void 0 : _a.step.refreshUrl) != null ? _c : (_b = component.getStep()) == null ? void 0 : _b.step.refreshFormUrl) != null ? _d : null;
|
|
1192
1189
|
},
|
|
1193
1190
|
navigateBack() {
|
|
1194
1191
|
var _a;
|
|
1195
|
-
|
|
1196
|
-
if (
|
|
1192
|
+
component.closeSubflow();
|
|
1193
|
+
if (component.stepStack.length === 1) {
|
|
1197
1194
|
return;
|
|
1198
1195
|
}
|
|
1199
|
-
|
|
1196
|
+
update(component, (draft) => {
|
|
1200
1197
|
draft.stepStack = draft.stepStack.slice(0, -1);
|
|
1201
1198
|
});
|
|
1202
|
-
(_a =
|
|
1199
|
+
(_a = component.getStep()) == null ? void 0 : _a.start();
|
|
1203
1200
|
},
|
|
1204
1201
|
canPerformBack() {
|
|
1205
1202
|
var _a, _b;
|
|
1206
|
-
const navigation = (_a =
|
|
1203
|
+
const navigation = (_a = component.getStep()) == null ? void 0 : _a.step.navigation;
|
|
1207
1204
|
const stepHasBehavior = Boolean((_b = navigation == null ? void 0 : navigation.back) != null ? _b : navigation == null ? void 0 : navigation.backButton);
|
|
1208
|
-
return
|
|
1205
|
+
return component.backConfig.isFlowCancellable || component.stepStack.length > 1 && component.backConfig.isNativeBackEnabled || stepHasBehavior;
|
|
1209
1206
|
}
|
|
1210
1207
|
};
|
|
1211
|
-
return
|
|
1208
|
+
return component;
|
|
1212
1209
|
};
|
|
1213
1210
|
var shouldScrollOnStepUpdate = (newStep, currentStep) => {
|
|
1214
1211
|
if (!currentStep) {
|
|
@@ -1217,6 +1214,15 @@ var shouldScrollOnStepUpdate = (newStep, currentStep) => {
|
|
|
1217
1214
|
return newStep.error != null && newStep.error !== currentStep.error;
|
|
1218
1215
|
};
|
|
1219
1216
|
|
|
1217
|
+
// src/domain/features/events.ts
|
|
1218
|
+
var trackBehaviorTriggered = (trackEvent, behavior) => {
|
|
1219
|
+
if (behavior.track) {
|
|
1220
|
+
trackEvent("Behavior Triggered", __spreadProps(__spreadValues({}, behavior.analytics), {
|
|
1221
|
+
behaviorType: behavior.type
|
|
1222
|
+
}));
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1220
1226
|
// src/domain/features/prefetch/request-cache.ts
|
|
1221
1227
|
var makeRequestCacheWithParent = (parent) => {
|
|
1222
1228
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -1267,36 +1273,33 @@ var makeRequestCacheKey = (requestParams) => {
|
|
|
1267
1273
|
};
|
|
1268
1274
|
|
|
1269
1275
|
// src/domain/components/ModalComponent.ts
|
|
1270
|
-
var createModalContentComponent = (
|
|
1276
|
+
var createModalContentComponent = (props, onComponentUpdate) => {
|
|
1271
1277
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
1272
|
-
const
|
|
1278
|
+
const component = __spreadProps(__spreadValues({
|
|
1273
1279
|
type: "modal",
|
|
1274
1280
|
kind: "layout",
|
|
1275
1281
|
open: true
|
|
1276
|
-
},
|
|
1277
|
-
_update(updateFn) {
|
|
1278
|
-
update(this, updateFn);
|
|
1279
|
-
},
|
|
1282
|
+
}, props), {
|
|
1280
1283
|
getChildren() {
|
|
1281
|
-
return
|
|
1284
|
+
return component.components;
|
|
1282
1285
|
},
|
|
1283
1286
|
close() {
|
|
1284
|
-
update(
|
|
1287
|
+
update(component, (draft) => {
|
|
1285
1288
|
draft.open = false;
|
|
1286
1289
|
});
|
|
1287
1290
|
}
|
|
1288
1291
|
});
|
|
1289
|
-
return
|
|
1292
|
+
return component;
|
|
1290
1293
|
};
|
|
1291
1294
|
|
|
1292
1295
|
// src/domain/components/utils/getRandomId.ts
|
|
1293
1296
|
var getRandomId = () => Math.random().toString(36).substring(2);
|
|
1294
1297
|
|
|
1295
1298
|
// src/domain/components/AlertComponent.ts
|
|
1296
|
-
var createAlertComponent = (
|
|
1299
|
+
var createAlertComponent = (props) => __spreadValues({
|
|
1297
1300
|
type: "alert",
|
|
1298
1301
|
kind: "layout"
|
|
1299
|
-
},
|
|
1302
|
+
}, props);
|
|
1300
1303
|
|
|
1301
1304
|
// src/domain/mappers/utils/behavior-utils.ts
|
|
1302
1305
|
var getDomainLayerBehavior = ({ action, behavior: specBehavior }, stepActions, registerSubmissionBehavior) => {
|
|
@@ -1310,29 +1313,31 @@ var getDomainLayerBehavior = ({ action, behavior: specBehavior }, stepActions, r
|
|
|
1310
1313
|
registerSubmissionBehavior == null ? void 0 : registerSubmissionBehavior(behavior);
|
|
1311
1314
|
return behavior;
|
|
1312
1315
|
}
|
|
1313
|
-
return { type: "none" };
|
|
1316
|
+
return { type: "none", track: false };
|
|
1314
1317
|
};
|
|
1315
1318
|
var normaliseBehavior = (behavior, stepActions) => {
|
|
1316
1319
|
if ("type" in behavior) {
|
|
1317
1320
|
if (behavior.type === "subflow") {
|
|
1318
1321
|
return __spreadProps(__spreadValues({}, behavior), {
|
|
1322
|
+
track: true,
|
|
1319
1323
|
onCompletion: behavior.onCompletion ? normaliseBehavior(behavior.onCompletion, stepActions) : void 0,
|
|
1320
1324
|
onError: behavior.onError ? normaliseBehavior(behavior.onError, stepActions) : void 0
|
|
1321
1325
|
});
|
|
1322
1326
|
}
|
|
1323
|
-
return behavior;
|
|
1327
|
+
return __spreadProps(__spreadValues({}, behavior), { track: true });
|
|
1324
1328
|
}
|
|
1325
1329
|
if ("action" in behavior && behavior.action) {
|
|
1326
1330
|
return actionToBehavior(behavior.action, stepActions);
|
|
1327
1331
|
}
|
|
1328
1332
|
if ("link" in behavior && behavior.link) {
|
|
1329
|
-
return { type: "link", url: behavior.link.url };
|
|
1333
|
+
return { type: "link", url: behavior.link.url, track: true };
|
|
1330
1334
|
}
|
|
1331
|
-
return { type: "none" };
|
|
1335
|
+
return { type: "none", track: false };
|
|
1332
1336
|
};
|
|
1333
1337
|
var actionToBehavior = (action, stepActions) => ({
|
|
1334
1338
|
type: "action",
|
|
1335
|
-
action: inlineAction(action, stepActions)
|
|
1339
|
+
action: inlineAction(action, stepActions),
|
|
1340
|
+
track: false
|
|
1336
1341
|
});
|
|
1337
1342
|
var inlineAction = (action, stepActions = []) => action.$ref ? __spreadValues(__spreadValues({}, getActionByReference(action.$ref, stepActions)), action) : action;
|
|
1338
1343
|
var getActionByReference = ($ref, actions = []) => {
|
|
@@ -1343,6 +1348,30 @@ var getActionByReference = ($ref, actions = []) => {
|
|
|
1343
1348
|
return action;
|
|
1344
1349
|
};
|
|
1345
1350
|
|
|
1351
|
+
// src/domain/mappers/utils/getHrefWithTracking.ts
|
|
1352
|
+
var getHrefWithTracking = ({
|
|
1353
|
+
behavior,
|
|
1354
|
+
onBehavior,
|
|
1355
|
+
trackEvent
|
|
1356
|
+
}) => {
|
|
1357
|
+
if (behavior.type === "link" && behavior.url) {
|
|
1358
|
+
return () => ({
|
|
1359
|
+
href: behavior.url,
|
|
1360
|
+
target: "_blank",
|
|
1361
|
+
onClick: () => {
|
|
1362
|
+
trackEvent("Behavior Triggered", __spreadProps(__spreadValues({}, behavior.analytics), {
|
|
1363
|
+
behaviorType: behavior.type
|
|
1364
|
+
}));
|
|
1365
|
+
}
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
return () => ({
|
|
1369
|
+
onClick: () => {
|
|
1370
|
+
void onBehavior(behavior);
|
|
1371
|
+
}
|
|
1372
|
+
});
|
|
1373
|
+
};
|
|
1374
|
+
|
|
1346
1375
|
// src/domain/mappers/utils/legacy-utils.ts
|
|
1347
1376
|
var mapLegacyContext = (context) => {
|
|
1348
1377
|
switch (context) {
|
|
@@ -1400,15 +1429,17 @@ function getDomainLayerCallToAction(cta, mapperProps) {
|
|
|
1400
1429
|
if (!cta) {
|
|
1401
1430
|
return void 0;
|
|
1402
1431
|
}
|
|
1403
|
-
const { step, onBehavior, registerSubmissionBehavior } = mapperProps;
|
|
1432
|
+
const { step, onBehavior, trackEvent, registerSubmissionBehavior } = mapperProps;
|
|
1404
1433
|
const stepActions = (_a = step.actions) != null ? _a : [];
|
|
1405
1434
|
const behavior = getDomainLayerBehavior(cta, stepActions, registerSubmissionBehavior);
|
|
1435
|
+
const isLink = behavior.type === "link";
|
|
1406
1436
|
return {
|
|
1407
1437
|
type: behavior.type,
|
|
1408
1438
|
title: (_b = cta.title) != null ? _b : "",
|
|
1409
1439
|
context: cta.context ? mapLegacyContext(cta.context) : void 0,
|
|
1410
1440
|
accessibilityDescription: cta.accessibilityDescription,
|
|
1411
|
-
href:
|
|
1441
|
+
href: isLink ? behavior.url : void 0,
|
|
1442
|
+
hrefWithTracking: getHrefWithTracking({ behavior, onBehavior, trackEvent }),
|
|
1412
1443
|
onClick: () => {
|
|
1413
1444
|
void onBehavior(behavior);
|
|
1414
1445
|
}
|
|
@@ -1439,11 +1470,11 @@ var alertLayoutToComponent = (uid, {
|
|
|
1439
1470
|
};
|
|
1440
1471
|
|
|
1441
1472
|
// src/domain/components/BoxComponent.ts
|
|
1442
|
-
var createBoxComponent = (
|
|
1473
|
+
var createBoxComponent = (props) => __spreadProps(__spreadValues({}, props), {
|
|
1443
1474
|
type: "box",
|
|
1444
1475
|
kind: "layout",
|
|
1445
1476
|
getChildren() {
|
|
1446
|
-
return
|
|
1477
|
+
return props.components;
|
|
1447
1478
|
}
|
|
1448
1479
|
});
|
|
1449
1480
|
|
|
@@ -1470,10 +1501,10 @@ var boxLayoutToComponent = (uid, { border = false, components, control, margin,
|
|
|
1470
1501
|
});
|
|
1471
1502
|
|
|
1472
1503
|
// src/domain/components/ButtonComponent.ts
|
|
1473
|
-
var createButtonComponent = (
|
|
1504
|
+
var createButtonComponent = (props) => __spreadValues({
|
|
1474
1505
|
type: "button",
|
|
1475
1506
|
kind: "layout"
|
|
1476
|
-
},
|
|
1507
|
+
}, props);
|
|
1477
1508
|
|
|
1478
1509
|
// src/domain/mappers/utils/image.ts
|
|
1479
1510
|
var mapSpecImage = (image) => {
|
|
@@ -1557,7 +1588,7 @@ var buttonLayoutToComponentWithAction = (uid, button, mapperProps) => {
|
|
|
1557
1588
|
const { action } = button;
|
|
1558
1589
|
const inlinedAction = action ? inlineAction(action, step == null ? void 0 : step.actions) : {};
|
|
1559
1590
|
const onClick = () => {
|
|
1560
|
-
void onBehavior({ type: "action", action: inlinedAction });
|
|
1591
|
+
void onBehavior({ type: "action", action: inlinedAction, track: false });
|
|
1561
1592
|
};
|
|
1562
1593
|
return createButtonComponent({
|
|
1563
1594
|
uid,
|
|
@@ -1599,11 +1630,11 @@ var getButtonContext = ({ context, action }) => {
|
|
|
1599
1630
|
};
|
|
1600
1631
|
|
|
1601
1632
|
// src/domain/components/ColumnsComponent.ts
|
|
1602
|
-
var createColumnsComponent = (
|
|
1633
|
+
var createColumnsComponent = (props) => __spreadProps(__spreadValues({}, props), {
|
|
1603
1634
|
type: "columns",
|
|
1604
1635
|
kind: "layout",
|
|
1605
1636
|
getChildren() {
|
|
1606
|
-
return [...
|
|
1637
|
+
return [...props.startComponents, ...props.endComponents];
|
|
1607
1638
|
}
|
|
1608
1639
|
});
|
|
1609
1640
|
|
|
@@ -1629,10 +1660,10 @@ var columnsLayoutToComponent = (uid, { control, left, right, bias, margin, analy
|
|
|
1629
1660
|
});
|
|
1630
1661
|
|
|
1631
1662
|
// src/domain/components/DecisionComponent.ts
|
|
1632
|
-
var createDecisionComponent = (
|
|
1663
|
+
var createDecisionComponent = (props) => __spreadValues({
|
|
1633
1664
|
type: "decision",
|
|
1634
1665
|
kind: "layout"
|
|
1635
|
-
},
|
|
1666
|
+
}, props);
|
|
1636
1667
|
|
|
1637
1668
|
// src/domain/mappers/utils/tags-utils.ts
|
|
1638
1669
|
var mapTags = ({ tag, tags }) => tags != null ? tags : tag != null ? [tag] : void 0;
|
|
@@ -1645,12 +1676,18 @@ var mapInlineAlert = (alert) => {
|
|
|
1645
1676
|
} : void 0;
|
|
1646
1677
|
};
|
|
1647
1678
|
var mapAdditionalInfo = (info, mapperProps) => {
|
|
1648
|
-
const { onBehavior, registerSubmissionBehavior } = mapperProps;
|
|
1679
|
+
const { onBehavior, trackEvent, registerSubmissionBehavior } = mapperProps;
|
|
1649
1680
|
if (info) {
|
|
1650
1681
|
const behavior = getDomainLayerBehavior(info, [], registerSubmissionBehavior);
|
|
1682
|
+
const isLink = behavior.type === "link";
|
|
1651
1683
|
return {
|
|
1652
1684
|
text: info.text,
|
|
1653
|
-
href:
|
|
1685
|
+
href: isLink ? behavior.url : void 0,
|
|
1686
|
+
hrefWithTracking: getHrefWithTracking({
|
|
1687
|
+
behavior,
|
|
1688
|
+
onBehavior,
|
|
1689
|
+
trackEvent
|
|
1690
|
+
}),
|
|
1654
1691
|
accessibilityDescription: info.accessibilityDescription,
|
|
1655
1692
|
onClick: behavior.type === "none" ? void 0 : () => {
|
|
1656
1693
|
void onBehavior(behavior);
|
|
@@ -1685,14 +1722,16 @@ var decisionLayoutToComponent = (uid, {
|
|
|
1685
1722
|
});
|
|
1686
1723
|
var mapOption = (option, mapperProps) => {
|
|
1687
1724
|
var _a, _b;
|
|
1688
|
-
const { step, onBehavior, registerSubmissionBehavior } = mapperProps;
|
|
1725
|
+
const { step, onBehavior, trackEvent, registerSubmissionBehavior } = mapperProps;
|
|
1689
1726
|
const behavior = getDomainLayerBehavior(option, (_a = step.actions) != null ? _a : [], registerSubmissionBehavior);
|
|
1727
|
+
const isLink = behavior.type === "link";
|
|
1690
1728
|
return __spreadProps(__spreadValues({}, option), {
|
|
1691
1729
|
disabled: (_b = option.disabled) != null ? _b : false,
|
|
1692
|
-
href:
|
|
1730
|
+
href: isLink ? behavior.url : void 0,
|
|
1693
1731
|
media: getDomainLayerMedia(option),
|
|
1694
1732
|
inlineAlert: mapInlineAlert(option.inlineAlert),
|
|
1695
1733
|
tags: mapTags(option),
|
|
1734
|
+
hrefWithTracking: getHrefWithTracking({ behavior, onBehavior, trackEvent }),
|
|
1696
1735
|
onClick: () => {
|
|
1697
1736
|
void onBehavior(behavior);
|
|
1698
1737
|
}
|
|
@@ -1700,10 +1739,10 @@ var mapOption = (option, mapperProps) => {
|
|
|
1700
1739
|
};
|
|
1701
1740
|
|
|
1702
1741
|
// src/domain/components/StatusListComponent.ts
|
|
1703
|
-
var createStatusListComponent = (
|
|
1742
|
+
var createStatusListComponent = (props) => __spreadValues({
|
|
1704
1743
|
type: "status-list",
|
|
1705
1744
|
kind: "layout"
|
|
1706
|
-
},
|
|
1745
|
+
}, props);
|
|
1707
1746
|
|
|
1708
1747
|
// src/domain/mappers/layout/deprecatedListLayoutToComponent.ts
|
|
1709
1748
|
var isDeprecatedListLayout = (layout) => {
|
|
@@ -1746,11 +1785,11 @@ var createDividerComponent = (props) => __spreadValues({
|
|
|
1746
1785
|
var dividerLayoutToComponent = (uid, { control, margin, analyticsId, tags }) => createDividerComponent({ uid, analyticsId, control, margin: margin != null ? margin : "md", tags });
|
|
1747
1786
|
|
|
1748
1787
|
// src/domain/components/FormComponent.ts
|
|
1749
|
-
var createFormComponent = (
|
|
1788
|
+
var createFormComponent = (props) => __spreadProps(__spreadValues({}, props), {
|
|
1750
1789
|
type: "form",
|
|
1751
1790
|
kind: "layout",
|
|
1752
1791
|
getChildren() {
|
|
1753
|
-
return [
|
|
1792
|
+
return [props.schemaComponent];
|
|
1754
1793
|
}
|
|
1755
1794
|
});
|
|
1756
1795
|
|
|
@@ -1779,10 +1818,10 @@ var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, co
|
|
|
1779
1818
|
};
|
|
1780
1819
|
|
|
1781
1820
|
// src/domain/components/HeadingComponent.ts
|
|
1782
|
-
var createHeadingComponent = (
|
|
1821
|
+
var createHeadingComponent = (props) => __spreadValues({
|
|
1783
1822
|
type: "heading",
|
|
1784
1823
|
kind: "layout"
|
|
1785
|
-
},
|
|
1824
|
+
}, props);
|
|
1786
1825
|
|
|
1787
1826
|
// src/domain/mappers/layout/headingLayoutToComponent.ts
|
|
1788
1827
|
var headingLayoutToComponent = (uid, { analyticsId, align, margin, size, control, tags, text }) => createHeadingComponent({
|
|
@@ -1797,10 +1836,10 @@ var headingLayoutToComponent = (uid, { analyticsId, align, margin, size, control
|
|
|
1797
1836
|
});
|
|
1798
1837
|
|
|
1799
1838
|
// src/domain/components/ImageComponent.ts
|
|
1800
|
-
var createImageComponent = (
|
|
1839
|
+
var createImageComponent = (props) => __spreadValues({
|
|
1801
1840
|
type: "image",
|
|
1802
1841
|
kind: "layout"
|
|
1803
|
-
},
|
|
1842
|
+
}, props);
|
|
1804
1843
|
|
|
1805
1844
|
// src/domain/mappers/layout/imageLayoutToComponent.ts
|
|
1806
1845
|
var imageLayoutToComponent = (uid, {
|
|
@@ -1832,10 +1871,10 @@ var imageLayoutToComponent = (uid, {
|
|
|
1832
1871
|
};
|
|
1833
1872
|
|
|
1834
1873
|
// src/domain/components/MarkdownComponent.ts
|
|
1835
|
-
var createMarkdownComponent = (
|
|
1874
|
+
var createMarkdownComponent = (props) => __spreadValues({
|
|
1836
1875
|
type: "markdown",
|
|
1837
1876
|
kind: "layout"
|
|
1838
|
-
},
|
|
1877
|
+
}, props);
|
|
1839
1878
|
|
|
1840
1879
|
// src/domain/mappers/layout/infoLayoutToComponent.ts
|
|
1841
1880
|
var infoLayoutToComponent = (uid, { analyticsId, align, control, margin, markdown: content, tags }) => createMarkdownComponent({
|
|
@@ -1850,10 +1889,10 @@ var infoLayoutToComponent = (uid, { analyticsId, align, control, margin, markdow
|
|
|
1850
1889
|
});
|
|
1851
1890
|
|
|
1852
1891
|
// src/domain/components/InstructionsComponent.ts
|
|
1853
|
-
var createInstructionsComponent = (
|
|
1892
|
+
var createInstructionsComponent = (props) => __spreadValues({
|
|
1854
1893
|
type: "instructions",
|
|
1855
1894
|
kind: "layout"
|
|
1856
|
-
},
|
|
1895
|
+
}, props);
|
|
1857
1896
|
|
|
1858
1897
|
// src/domain/mappers/layout/instructionsLayoutToComponent.ts
|
|
1859
1898
|
var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin, tags, title }) => createInstructionsComponent({
|
|
@@ -1870,10 +1909,10 @@ var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin,
|
|
|
1870
1909
|
});
|
|
1871
1910
|
|
|
1872
1911
|
// src/domain/components/ListComponent.ts
|
|
1873
|
-
var createListComponent = (
|
|
1912
|
+
var createListComponent = (props) => __spreadValues({
|
|
1874
1913
|
type: "list",
|
|
1875
1914
|
kind: "layout"
|
|
1876
|
-
},
|
|
1915
|
+
}, props);
|
|
1877
1916
|
|
|
1878
1917
|
// src/domain/mappers/layout/listLayoutToComponent.ts
|
|
1879
1918
|
var listLayoutToComponent = (uid, { analyticsId, callToAction, control, items, margin, tags, title }, mapperProps) => {
|
|
@@ -1931,10 +1970,10 @@ var mapSupportingValues = (item) => {
|
|
|
1931
1970
|
};
|
|
1932
1971
|
|
|
1933
1972
|
// src/domain/components/LoadingIndicatorComponent.ts
|
|
1934
|
-
var createLoadingIndicatorComponent = (
|
|
1973
|
+
var createLoadingIndicatorComponent = (props) => __spreadValues({
|
|
1935
1974
|
type: "loading-indicator",
|
|
1936
1975
|
kind: "layout"
|
|
1937
|
-
},
|
|
1976
|
+
}, props);
|
|
1938
1977
|
|
|
1939
1978
|
// src/domain/mappers/layout/loadingIndicatorLayoutToComponent.ts
|
|
1940
1979
|
var loadingIndicatorLayoutToComponent = (uid, { analyticsId, control, margin, size, tags }) => createLoadingIndicatorComponent({
|
|
@@ -1985,12 +2024,12 @@ var mediaLayoutToComponent = (uid, { analyticsId, align, control, margin, media,
|
|
|
1985
2024
|
});
|
|
1986
2025
|
|
|
1987
2026
|
// src/domain/components/ModalLayoutComponent.ts
|
|
1988
|
-
var createModalComponent = (
|
|
2027
|
+
var createModalComponent = (props) => __spreadProps(__spreadValues({
|
|
1989
2028
|
type: "modal-layout",
|
|
1990
2029
|
kind: "layout"
|
|
1991
|
-
},
|
|
2030
|
+
}, props), {
|
|
1992
2031
|
getChildren() {
|
|
1993
|
-
return
|
|
2032
|
+
return props.content.components;
|
|
1994
2033
|
}
|
|
1995
2034
|
});
|
|
1996
2035
|
|
|
@@ -2014,10 +2053,10 @@ var modalLayoutToComponent = (uid, { analyticsId, content, control, margin, tags
|
|
|
2014
2053
|
};
|
|
2015
2054
|
|
|
2016
2055
|
// src/domain/components/ParagraphComponent.ts
|
|
2017
|
-
var createParagraphComponent = (
|
|
2056
|
+
var createParagraphComponent = (props) => __spreadValues({
|
|
2018
2057
|
type: "paragraph",
|
|
2019
2058
|
kind: "layout"
|
|
2020
|
-
},
|
|
2059
|
+
}, props);
|
|
2021
2060
|
|
|
2022
2061
|
// src/domain/mappers/layout/paragraphLayoutToComponent.ts
|
|
2023
2062
|
var paragraphLayoutToComponent = (uid, { analyticsId, align, control, margin, size, tags, text }) => createParagraphComponent({
|
|
@@ -2032,10 +2071,10 @@ var paragraphLayoutToComponent = (uid, { analyticsId, align, control, margin, si
|
|
|
2032
2071
|
});
|
|
2033
2072
|
|
|
2034
2073
|
// src/domain/components/ProgressComponent.ts
|
|
2035
|
-
var createProgressComponent = (
|
|
2074
|
+
var createProgressComponent = (props) => __spreadValues({
|
|
2036
2075
|
type: "progress",
|
|
2037
2076
|
kind: "layout"
|
|
2038
|
-
},
|
|
2077
|
+
}, props);
|
|
2039
2078
|
|
|
2040
2079
|
// src/domain/mappers/layout/progressLayoutToComponent.ts
|
|
2041
2080
|
var progressLayoutToComponent = (uid, {
|
|
@@ -2064,10 +2103,10 @@ var progressLayoutToComponent = (uid, {
|
|
|
2064
2103
|
});
|
|
2065
2104
|
|
|
2066
2105
|
// src/domain/components/ReviewComponent.ts
|
|
2067
|
-
var createReviewComponent = (
|
|
2106
|
+
var createReviewComponent = (props) => __spreadValues({
|
|
2068
2107
|
type: "review",
|
|
2069
2108
|
kind: "layout"
|
|
2070
|
-
},
|
|
2109
|
+
}, props);
|
|
2071
2110
|
|
|
2072
2111
|
// src/domain/mappers/layout/reviewLayoutToComponent.ts
|
|
2073
2112
|
var reviewLayoutToComponent = (uid, {
|
|
@@ -2099,12 +2138,15 @@ var getCallToAction = ({
|
|
|
2099
2138
|
return getDomainLayerCallToAction(callToAction, mapperProps);
|
|
2100
2139
|
}
|
|
2101
2140
|
if (action == null ? void 0 : action.title) {
|
|
2141
|
+
const behavior = { type: "action", action, track: true };
|
|
2142
|
+
const { onBehavior, trackEvent } = mapperProps;
|
|
2102
2143
|
return {
|
|
2103
2144
|
type: "action",
|
|
2104
2145
|
title: action.title,
|
|
2105
2146
|
onClick: () => {
|
|
2106
|
-
void
|
|
2107
|
-
}
|
|
2147
|
+
void onBehavior(behavior);
|
|
2148
|
+
},
|
|
2149
|
+
hrefWithTracking: getHrefWithTracking({ behavior, onBehavior, trackEvent })
|
|
2108
2150
|
};
|
|
2109
2151
|
}
|
|
2110
2152
|
return void 0;
|
|
@@ -2141,7 +2183,7 @@ var debounce = (callback, waitMs) => {
|
|
|
2141
2183
|
let timeoutId = null;
|
|
2142
2184
|
let lastArgs = null;
|
|
2143
2185
|
const clearTimer = () => {
|
|
2144
|
-
if (timeoutId) {
|
|
2186
|
+
if (timeoutId !== null) {
|
|
2145
2187
|
clearTimeout(timeoutId);
|
|
2146
2188
|
timeoutId = null;
|
|
2147
2189
|
}
|
|
@@ -2174,8 +2216,8 @@ var debounce = (callback, waitMs) => {
|
|
|
2174
2216
|
|
|
2175
2217
|
// src/domain/components/searchComponent/SearchComponent.ts
|
|
2176
2218
|
var DEBOUNCE_TIME = 400;
|
|
2177
|
-
var createSearchComponent = (
|
|
2178
|
-
const { uid, analyticsId, control, emptyMessage, initialState, hint, margin, tags, title } =
|
|
2219
|
+
var createSearchComponent = (props, performSearch, onBehavior, onComponentUpdate) => {
|
|
2220
|
+
const { uid, analyticsId, control, emptyMessage, initialState, hint, margin, tags, title } = props;
|
|
2179
2221
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
2180
2222
|
let abortController = new AbortController();
|
|
2181
2223
|
const search = (component2, query, searchConfig) => {
|
|
@@ -2219,16 +2261,13 @@ var createSearchComponent = (searchProps, performSearch, onBehavior, onComponent
|
|
|
2219
2261
|
title,
|
|
2220
2262
|
isLoading: false,
|
|
2221
2263
|
query: "",
|
|
2222
|
-
|
|
2223
|
-
update(this, updateFn);
|
|
2224
|
-
},
|
|
2225
|
-
onChange(query) {
|
|
2264
|
+
setQuery(query) {
|
|
2226
2265
|
if (query.trim()) {
|
|
2227
|
-
|
|
2266
|
+
update(component, (draft) => {
|
|
2228
2267
|
draft.query = query;
|
|
2229
2268
|
draft.isLoading = true;
|
|
2230
2269
|
});
|
|
2231
|
-
debouncedSearch(
|
|
2270
|
+
debouncedSearch(component, query.trim());
|
|
2232
2271
|
} else {
|
|
2233
2272
|
abortController.abort();
|
|
2234
2273
|
debouncedSearch.cancel();
|
|
@@ -2240,15 +2279,15 @@ var createSearchComponent = (searchProps, performSearch, onBehavior, onComponent
|
|
|
2240
2279
|
});
|
|
2241
2280
|
}
|
|
2242
2281
|
},
|
|
2243
|
-
|
|
2282
|
+
selectResult({ type, value }) {
|
|
2244
2283
|
if (type === "action") {
|
|
2245
|
-
void onBehavior({ type: "action", action: value });
|
|
2284
|
+
void onBehavior({ type: "action", action: value, track: false });
|
|
2246
2285
|
} else {
|
|
2247
|
-
|
|
2286
|
+
update(component, (draft) => {
|
|
2248
2287
|
draft.query = value.query;
|
|
2249
2288
|
draft.isLoading = true;
|
|
2250
2289
|
});
|
|
2251
|
-
search(
|
|
2290
|
+
search(component, value.query, {
|
|
2252
2291
|
method: value.method,
|
|
2253
2292
|
param: value.param,
|
|
2254
2293
|
url: value.url
|
|
@@ -2399,15 +2438,13 @@ var emptyInitialState = {
|
|
|
2399
2438
|
};
|
|
2400
2439
|
|
|
2401
2440
|
// src/domain/components/SectionComponent.ts
|
|
2402
|
-
var createSectionComponent = (props) => {
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
});
|
|
2410
|
-
};
|
|
2441
|
+
var createSectionComponent = (props) => __spreadProps(__spreadValues({}, props), {
|
|
2442
|
+
type: "section",
|
|
2443
|
+
kind: "layout",
|
|
2444
|
+
getChildren() {
|
|
2445
|
+
return props.components;
|
|
2446
|
+
}
|
|
2447
|
+
});
|
|
2411
2448
|
|
|
2412
2449
|
// src/domain/mappers/layout/sectionLayoutToComponent.ts
|
|
2413
2450
|
var sectionLayoutToComponent = (uid, { analyticsId, control, title, components, callToAction, margin, tags }, mapperProps, schemaComponents) => {
|
|
@@ -2440,7 +2477,7 @@ var statusListLayoutToComponent = (uid, { analyticsId, control, items, margin, t
|
|
|
2440
2477
|
});
|
|
2441
2478
|
|
|
2442
2479
|
// src/domain/components/TabsComponent.ts
|
|
2443
|
-
var createTabsComponent = (
|
|
2480
|
+
var createTabsComponent = (props) => __spreadProps(__spreadValues({}, props), {
|
|
2444
2481
|
type: "tabs",
|
|
2445
2482
|
kind: "layout"
|
|
2446
2483
|
});
|
|
@@ -2468,19 +2505,19 @@ var mapTabs = (tabs, uid, mapperProps, schemaComponents) => tabs.map(({ componen
|
|
|
2468
2505
|
}));
|
|
2469
2506
|
|
|
2470
2507
|
// src/domain/components/UpsellComponent.ts
|
|
2471
|
-
var createUpsellComponent = (
|
|
2508
|
+
var createUpsellComponent = (props, onComponentUpdate) => {
|
|
2472
2509
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
2473
|
-
const _a =
|
|
2510
|
+
const _a = props, { dismiss } = _a, restProps = __objRest(_a, ["dismiss"]);
|
|
2474
2511
|
const component = __spreadProps(__spreadValues({
|
|
2475
2512
|
type: "upsell",
|
|
2476
2513
|
kind: "layout"
|
|
2477
2514
|
}, restProps), {
|
|
2478
2515
|
visible: true,
|
|
2479
|
-
|
|
2516
|
+
dismiss: dismiss ? () => {
|
|
2480
2517
|
update(component, (draft) => {
|
|
2481
2518
|
draft.visible = false;
|
|
2482
2519
|
});
|
|
2483
|
-
|
|
2520
|
+
dismiss();
|
|
2484
2521
|
} : void 0
|
|
2485
2522
|
});
|
|
2486
2523
|
return component;
|
|
@@ -2499,7 +2536,7 @@ var upsellLayoutToComponent = (uid, { analyticsId, callToAction, control, margin
|
|
|
2499
2536
|
media: getDomainLayerMedia({ media }),
|
|
2500
2537
|
tags,
|
|
2501
2538
|
text,
|
|
2502
|
-
|
|
2539
|
+
dismiss: onDismiss ? () => {
|
|
2503
2540
|
const { url, method } = onDismiss;
|
|
2504
2541
|
const body = method === "GET" ? void 0 : JSON.stringify(onDismiss.body);
|
|
2505
2542
|
void mapperProps.httpClient(url, { method, body }).catch(() => {
|
|
@@ -2581,26 +2618,27 @@ var modalToComponent = (uid, { content, title }, mapperProps, schemaComponents)
|
|
|
2581
2618
|
// src/domain/components/step/ExternalConfirmationComponent.ts
|
|
2582
2619
|
var createExternalConfirmation = (uid, url, onLink, onComponentUpdate) => {
|
|
2583
2620
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
2584
|
-
|
|
2621
|
+
const component = {
|
|
2585
2622
|
type: "external-confirmation",
|
|
2586
2623
|
kind: "layout",
|
|
2587
2624
|
uid,
|
|
2588
2625
|
url,
|
|
2589
2626
|
status: "initial",
|
|
2590
2627
|
open() {
|
|
2591
|
-
if (
|
|
2592
|
-
const success = onLink(
|
|
2593
|
-
update(
|
|
2628
|
+
if (component.status === "initial" || component.status === "failure") {
|
|
2629
|
+
const success = onLink(component.url);
|
|
2630
|
+
update(component, (draft) => {
|
|
2594
2631
|
draft.status = success ? "success" : "failure";
|
|
2595
2632
|
});
|
|
2596
2633
|
}
|
|
2597
2634
|
},
|
|
2598
2635
|
onCancel() {
|
|
2599
|
-
update(
|
|
2636
|
+
update(component, (draft) => {
|
|
2600
2637
|
draft.status = "dismissed";
|
|
2601
2638
|
});
|
|
2602
2639
|
}
|
|
2603
2640
|
};
|
|
2641
|
+
return component;
|
|
2604
2642
|
};
|
|
2605
2643
|
|
|
2606
2644
|
// src/utils/recursiveMerge.ts
|
|
@@ -2650,8 +2688,26 @@ var getSubmittableDataSync = (components) => components.map((component) => compo
|
|
|
2650
2688
|
var getLocalValues = (components) => components.map((component) => component.getLocalValue()).reduce((acc, value) => recursiveMerge(acc, value), null);
|
|
2651
2689
|
|
|
2652
2690
|
// src/domain/components/step/StepDomainComponent.ts
|
|
2653
|
-
var createStepComponent = (
|
|
2654
|
-
const _a =
|
|
2691
|
+
var createStepComponent = (props) => {
|
|
2692
|
+
const _a = props, {
|
|
2693
|
+
uid,
|
|
2694
|
+
stepPolling,
|
|
2695
|
+
stepRefreshAfter,
|
|
2696
|
+
stepPrefetch,
|
|
2697
|
+
features,
|
|
2698
|
+
logEvent,
|
|
2699
|
+
onComponentUpdate,
|
|
2700
|
+
onLoad
|
|
2701
|
+
} = _a, rest = __objRest(_a, [
|
|
2702
|
+
"uid",
|
|
2703
|
+
"stepPolling",
|
|
2704
|
+
"stepRefreshAfter",
|
|
2705
|
+
"stepPrefetch",
|
|
2706
|
+
"features",
|
|
2707
|
+
"logEvent",
|
|
2708
|
+
"onComponentUpdate",
|
|
2709
|
+
"onLoad"
|
|
2710
|
+
]);
|
|
2655
2711
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
2656
2712
|
const component = __spreadProps(__spreadValues({
|
|
2657
2713
|
uid
|
|
@@ -2664,78 +2720,73 @@ var createStepComponent = (stepProps) => {
|
|
|
2664
2720
|
subflow: null,
|
|
2665
2721
|
dismissModal() {
|
|
2666
2722
|
var _a2;
|
|
2667
|
-
(_a2 =
|
|
2723
|
+
(_a2 = component.modals.at(-1)) == null ? void 0 : _a2.close();
|
|
2668
2724
|
},
|
|
2669
2725
|
dismissAllModals() {
|
|
2670
|
-
|
|
2726
|
+
update(component, (draft) => {
|
|
2671
2727
|
draft.modals = draft.modals.map((m) => __spreadProps(__spreadValues({}, m), { open: false }));
|
|
2672
2728
|
});
|
|
2673
2729
|
},
|
|
2674
2730
|
showModal(modal) {
|
|
2675
|
-
|
|
2731
|
+
update(component, (draft) => {
|
|
2676
2732
|
draft.modals = [...draft.modals, modal];
|
|
2677
2733
|
});
|
|
2678
2734
|
},
|
|
2679
|
-
_update(updateFn) {
|
|
2680
|
-
update(this, updateFn);
|
|
2681
|
-
},
|
|
2682
2735
|
getChildren() {
|
|
2683
|
-
return
|
|
2736
|
+
return component.externalConfirmation ? [...component.layoutComponents, component.externalConfirmation] : component.layoutComponents;
|
|
2684
2737
|
},
|
|
2685
2738
|
getModals() {
|
|
2686
|
-
return
|
|
2739
|
+
return component.modals;
|
|
2687
2740
|
},
|
|
2688
2741
|
async getSubmittableValue() {
|
|
2689
|
-
return getSubmittableData(
|
|
2742
|
+
return getSubmittableData(component.schemaComponents);
|
|
2690
2743
|
},
|
|
2691
2744
|
getSubmittableValueSync() {
|
|
2692
|
-
return getSubmittableDataSync(
|
|
2745
|
+
return getSubmittableDataSync(component.schemaComponents);
|
|
2693
2746
|
},
|
|
2694
2747
|
getLocalValue() {
|
|
2695
|
-
return getLocalValues(
|
|
2748
|
+
return getLocalValues(component.schemaComponents);
|
|
2696
2749
|
},
|
|
2697
2750
|
validate() {
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
}
|
|
2703
|
-
);
|
|
2751
|
+
const isStrict = features.isEnabled("validateUnreferencedSchemas");
|
|
2752
|
+
return component.schemaComponents.map(
|
|
2753
|
+
(inputComponent) => validateInputComponent(component, inputComponent, isStrict, logEvent)
|
|
2754
|
+
).every(Boolean);
|
|
2704
2755
|
},
|
|
2705
2756
|
setLoadingState(loadingState) {
|
|
2706
|
-
|
|
2757
|
+
update(component, (draft) => {
|
|
2707
2758
|
draft.loadingState = loadingState;
|
|
2708
2759
|
});
|
|
2709
2760
|
},
|
|
2710
2761
|
addSubflow(subflow) {
|
|
2711
|
-
|
|
2762
|
+
update(component, (draft) => {
|
|
2712
2763
|
draft.subflow = subflow;
|
|
2713
2764
|
});
|
|
2714
2765
|
},
|
|
2715
2766
|
closeSubflow() {
|
|
2716
|
-
if (!
|
|
2767
|
+
if (!component.subflow) {
|
|
2717
2768
|
return;
|
|
2718
2769
|
}
|
|
2719
|
-
|
|
2770
|
+
update(component, (draft) => {
|
|
2720
2771
|
draft.subflow = null;
|
|
2721
2772
|
});
|
|
2722
2773
|
},
|
|
2723
2774
|
start() {
|
|
2724
|
-
if (
|
|
2775
|
+
if (component.state === "initial") {
|
|
2725
2776
|
onLoad == null ? void 0 : onLoad();
|
|
2726
2777
|
}
|
|
2727
|
-
|
|
2778
|
+
update(component, (draft) => {
|
|
2728
2779
|
draft.state = "started";
|
|
2729
2780
|
});
|
|
2730
2781
|
stepPolling == null ? void 0 : stepPolling.start();
|
|
2731
2782
|
stepRefreshAfter == null ? void 0 : stepRefreshAfter.start();
|
|
2732
|
-
stepPrefetch.start(
|
|
2783
|
+
stepPrefetch.start(component.getSubmittableValueSync());
|
|
2733
2784
|
},
|
|
2734
2785
|
stop() {
|
|
2735
2786
|
stepPolling == null ? void 0 : stepPolling.stop();
|
|
2736
2787
|
stepRefreshAfter == null ? void 0 : stepRefreshAfter.stop();
|
|
2737
2788
|
stepPrefetch.stop();
|
|
2738
|
-
|
|
2789
|
+
update(component, (draft) => {
|
|
2739
2790
|
draft.state = "stopped";
|
|
2740
2791
|
draft.modals = [];
|
|
2741
2792
|
});
|
|
@@ -2743,6 +2794,22 @@ var createStepComponent = (stepProps) => {
|
|
|
2743
2794
|
});
|
|
2744
2795
|
return component;
|
|
2745
2796
|
};
|
|
2797
|
+
var validateInputComponent = (component, inputComponent, isStrict, logEvent) => {
|
|
2798
|
+
var _a;
|
|
2799
|
+
const isSchemaReferenced = component.referencedSchemaIds.includes((_a = inputComponent.schemaId) != null ? _a : "");
|
|
2800
|
+
const isValid = inputComponent.validate();
|
|
2801
|
+
if (!isSchemaReferenced && !isValid) {
|
|
2802
|
+
logEvent(
|
|
2803
|
+
isStrict ? "error" : "warning",
|
|
2804
|
+
isStrict ? "Unreferenced schema does not pass validation. This blocks submission. You must fix your step." : "Unreferenced schema does not pass validation. This blocks submission on iOS and Android, and soon it will on web. You should fix your step.",
|
|
2805
|
+
{
|
|
2806
|
+
unreferencedSchemaId: inputComponent.schemaId,
|
|
2807
|
+
componentUid: component.uid
|
|
2808
|
+
}
|
|
2809
|
+
);
|
|
2810
|
+
}
|
|
2811
|
+
return isSchemaReferenced || isStrict ? isValid : true;
|
|
2812
|
+
};
|
|
2746
2813
|
|
|
2747
2814
|
// src/domain/features/polling/getStepPolling.ts
|
|
2748
2815
|
var getStepPolling = ({
|
|
@@ -2945,7 +3012,7 @@ var executeRequest = async (props) => {
|
|
|
2945
3012
|
url,
|
|
2946
3013
|
{
|
|
2947
3014
|
method,
|
|
2948
|
-
body: body ? JSON.stringify(body) : void 0,
|
|
3015
|
+
body: body != null ? JSON.stringify(body) : void 0,
|
|
2949
3016
|
headers: { "Content-Type": "application/json" }
|
|
2950
3017
|
}
|
|
2951
3018
|
],
|
|
@@ -2981,7 +3048,8 @@ var executeRequest = async (props) => {
|
|
|
2981
3048
|
type: "behavior",
|
|
2982
3049
|
behavior: {
|
|
2983
3050
|
type: "action",
|
|
2984
|
-
action: responseBody.action
|
|
3051
|
+
action: responseBody.action,
|
|
3052
|
+
track: false
|
|
2985
3053
|
}
|
|
2986
3054
|
};
|
|
2987
3055
|
}
|
|
@@ -2992,7 +3060,8 @@ var executeRequest = async (props) => {
|
|
|
2992
3060
|
behavior: __spreadProps(__spreadValues({}, responseBody), {
|
|
2993
3061
|
type: "subflow",
|
|
2994
3062
|
onCompletion: responseBody.onCompletion ? normaliseBehavior(responseBody.onCompletion, []) : void 0,
|
|
2995
|
-
onError: responseBody.onError ? normaliseBehavior(responseBody.onError, []) : void 0
|
|
3063
|
+
onError: responseBody.onError ? normaliseBehavior(responseBody.onError, []) : void 0,
|
|
3064
|
+
track: false
|
|
2996
3065
|
})
|
|
2997
3066
|
} : {
|
|
2998
3067
|
type: "error",
|
|
@@ -3001,7 +3070,7 @@ var executeRequest = async (props) => {
|
|
|
3001
3070
|
}
|
|
3002
3071
|
case "modal": {
|
|
3003
3072
|
assertModalResponseBody(responseBody);
|
|
3004
|
-
return !isInitial ? { type: "behavior", behavior: __spreadProps(__spreadValues({}, responseBody), { type: "modal" }) } : {
|
|
3073
|
+
return !isInitial ? { type: "behavior", behavior: __spreadProps(__spreadValues({}, responseBody), { type: "modal", track: false }) } : {
|
|
3005
3074
|
type: "error",
|
|
3006
3075
|
body: { errors: { error: "Cannot show modal without a current step" } }
|
|
3007
3076
|
};
|
|
@@ -3163,7 +3232,7 @@ var getStepRefreshAfter = ({
|
|
|
3163
3232
|
const start = () => {
|
|
3164
3233
|
const timeLeft = Math.max(targetTime - Date.now(), ONE_SECOND);
|
|
3165
3234
|
timeout = setTimeout(() => {
|
|
3166
|
-
void onBehavior({ type: "refresh", analytics: { schema: "refreshAfter" } });
|
|
3235
|
+
void onBehavior({ type: "refresh", analytics: { schema: "refreshAfter" }, track: false });
|
|
3167
3236
|
}, timeLeft);
|
|
3168
3237
|
};
|
|
3169
3238
|
return {
|
|
@@ -3316,8 +3385,8 @@ var getComponentValidationAsync = (update, performValidationAsync) => (
|
|
|
3316
3385
|
var getDebouncedComponentValidationAsync = (update, performValidationAsync) => debounce(getComponentValidationAsync(update, performValidationAsync), 1e3);
|
|
3317
3386
|
|
|
3318
3387
|
// src/domain/components/NumberInputComponent.ts
|
|
3319
|
-
var createNumberInputComponent = (
|
|
3320
|
-
const _a =
|
|
3388
|
+
var createNumberInputComponent = (props, onComponentUpdate) => {
|
|
3389
|
+
const _a = props, {
|
|
3321
3390
|
uid,
|
|
3322
3391
|
id,
|
|
3323
3392
|
checks,
|
|
@@ -3337,32 +3406,31 @@ var createNumberInputComponent = (numberInputProps, onComponentUpdate) => {
|
|
|
3337
3406
|
"summariser"
|
|
3338
3407
|
]);
|
|
3339
3408
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
3409
|
+
const onValueChangeDebounced = debounce(onValueChange, 1e3);
|
|
3340
3410
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
3341
3411
|
const performOnChange = getDebouncedSchemaOnChange(schemaOnChange, getValidationErrors);
|
|
3342
3412
|
const validateAsync = performValidationAsync ? getDebouncedComponentValidationAsync(update, performValidationAsync) : void 0;
|
|
3343
|
-
const
|
|
3413
|
+
const component = __spreadValues({
|
|
3344
3414
|
type: "number",
|
|
3345
3415
|
kind: "input",
|
|
3346
3416
|
uid,
|
|
3347
3417
|
id,
|
|
3348
|
-
_update(updateFn) {
|
|
3349
|
-
update(this, updateFn);
|
|
3350
|
-
},
|
|
3351
3418
|
onBlur() {
|
|
3352
|
-
const isValid =
|
|
3419
|
+
const isValid = component.validate();
|
|
3353
3420
|
performOnChange == null ? void 0 : performOnChange.flush();
|
|
3354
3421
|
if (isValid) {
|
|
3355
3422
|
void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
|
|
3356
3423
|
}));
|
|
3357
3424
|
validateAsync == null ? void 0 : validateAsync.flush();
|
|
3358
3425
|
}
|
|
3426
|
+
onValueChangeDebounced.flush();
|
|
3359
3427
|
},
|
|
3360
3428
|
onFocus() {
|
|
3361
3429
|
},
|
|
3362
3430
|
// Noop
|
|
3363
|
-
|
|
3364
|
-
const prevValue =
|
|
3365
|
-
|
|
3431
|
+
setValue(updatedValue) {
|
|
3432
|
+
const prevValue = component.value;
|
|
3433
|
+
update(component, (draft) => {
|
|
3366
3434
|
draft.errors = [];
|
|
3367
3435
|
draft.validationAsyncState.messages = {};
|
|
3368
3436
|
draft.value = updatedValue;
|
|
@@ -3370,32 +3438,32 @@ var createNumberInputComponent = (numberInputProps, onComponentUpdate) => {
|
|
|
3370
3438
|
performOnChange == null ? void 0 : performOnChange(prevValue, updatedValue);
|
|
3371
3439
|
const isValid = getValidationErrors(updatedValue).length === 0;
|
|
3372
3440
|
if (isValid) {
|
|
3373
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
3441
|
+
validateAsync == null ? void 0 : validateAsync(component, updatedValue);
|
|
3374
3442
|
}
|
|
3375
|
-
|
|
3443
|
+
onValueChangeDebounced();
|
|
3376
3444
|
},
|
|
3377
3445
|
async getSubmittableValue() {
|
|
3378
|
-
return
|
|
3446
|
+
return component.getSubmittableValueSync();
|
|
3379
3447
|
},
|
|
3380
3448
|
getSubmittableValueSync() {
|
|
3381
3449
|
var _a2;
|
|
3382
|
-
return (_a2 =
|
|
3450
|
+
return (_a2 = component.getLocalValue()) != null ? _a2 : null;
|
|
3383
3451
|
},
|
|
3384
3452
|
getSummary() {
|
|
3385
|
-
return summariser(
|
|
3453
|
+
return summariser(component.getLocalValue());
|
|
3386
3454
|
},
|
|
3387
3455
|
getLocalValue() {
|
|
3388
|
-
return
|
|
3456
|
+
return component.value;
|
|
3389
3457
|
},
|
|
3390
3458
|
validate() {
|
|
3391
|
-
const errors = getValidationErrors(
|
|
3392
|
-
|
|
3459
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
3460
|
+
update(component, (draft) => {
|
|
3393
3461
|
draft.errors = errors;
|
|
3394
3462
|
});
|
|
3395
3463
|
return errors.length === 0;
|
|
3396
3464
|
}
|
|
3397
3465
|
}, rest);
|
|
3398
|
-
return
|
|
3466
|
+
return component;
|
|
3399
3467
|
};
|
|
3400
3468
|
|
|
3401
3469
|
// src/domain/features/schema-on-change/getSchemaOnChange.ts
|
|
@@ -3427,7 +3495,8 @@ var getBehaviorFromSchemaRefreshStepOnChange = (schema) => {
|
|
|
3427
3495
|
const behavior = {
|
|
3428
3496
|
type: "refresh",
|
|
3429
3497
|
analytics: { schema: (_c = analyticsId != null ? analyticsId : $id) != null ? _c : "" },
|
|
3430
|
-
url: refreshUrl != null ? refreshUrl : refreshFormUrl
|
|
3498
|
+
url: refreshUrl != null ? refreshUrl : refreshFormUrl,
|
|
3499
|
+
track: false
|
|
3431
3500
|
};
|
|
3432
3501
|
return behavior;
|
|
3433
3502
|
}
|
|
@@ -3564,11 +3633,14 @@ var getRequiredCheck = (required, messageFunctions) => (value) => {
|
|
|
3564
3633
|
if (isArray(value) && value.length === 0) {
|
|
3565
3634
|
return messageFunctions.required();
|
|
3566
3635
|
}
|
|
3567
|
-
if (value === "") {
|
|
3568
|
-
return messageFunctions.required();
|
|
3569
|
-
}
|
|
3570
3636
|
return isNullish(value) ? messageFunctions.required() : null;
|
|
3571
3637
|
};
|
|
3638
|
+
var getStringRequiredCheck = (required, messageFunctions) => (value) => {
|
|
3639
|
+
if (!required) {
|
|
3640
|
+
return null;
|
|
3641
|
+
}
|
|
3642
|
+
return isNullish(value) || value === "" ? messageFunctions.required() : null;
|
|
3643
|
+
};
|
|
3572
3644
|
var getValidDateCheck = (required, messageFunctions) => (value) => {
|
|
3573
3645
|
if (required && !isValidDate(value)) {
|
|
3574
3646
|
return messageFunctions.required();
|
|
@@ -3830,9 +3902,16 @@ var schemaHasPlaceholder = (schema) => Boolean("placeholder" in schema && schema
|
|
|
3830
3902
|
|
|
3831
3903
|
// src/domain/mappers/schema/numberSchemaToComponent.ts
|
|
3832
3904
|
var numberSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
3833
|
-
const {
|
|
3905
|
+
const {
|
|
3906
|
+
schema,
|
|
3907
|
+
model,
|
|
3908
|
+
localValue,
|
|
3909
|
+
required = false,
|
|
3910
|
+
onPersistAsync,
|
|
3911
|
+
onValueChange
|
|
3912
|
+
} = schemaMapperProps;
|
|
3834
3913
|
const { autocompleteHint, validationMessages, default: defaultValue, maximum, minimum } = schema;
|
|
3835
|
-
const { getErrorMessageFunctions, onComponentUpdate, onBehavior
|
|
3914
|
+
const { getErrorMessageFunctions, onComponentUpdate, onBehavior } = mapperProps;
|
|
3836
3915
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
3837
3916
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
3838
3917
|
schemaMapperProps,
|
|
@@ -3883,7 +3962,7 @@ var isStringSchemaWithUpload = (schema) => isStringSchema(schema) && schema.form
|
|
|
3883
3962
|
var isSchemaWithPersistAsync = (schema) => "persistAsync" in schema && !isNullish(schema.persistAsync);
|
|
3884
3963
|
|
|
3885
3964
|
// src/domain/components/AllOfComponent.ts
|
|
3886
|
-
var createAllOfComponent = (
|
|
3965
|
+
var createAllOfComponent = (props) => {
|
|
3887
3966
|
const {
|
|
3888
3967
|
uid,
|
|
3889
3968
|
schemaId,
|
|
@@ -3897,8 +3976,8 @@ var createAllOfComponent = (allOfProps) => {
|
|
|
3897
3976
|
media,
|
|
3898
3977
|
title,
|
|
3899
3978
|
tags
|
|
3900
|
-
} =
|
|
3901
|
-
|
|
3979
|
+
} = props;
|
|
3980
|
+
const component = {
|
|
3902
3981
|
type: "all-of",
|
|
3903
3982
|
kind: "input",
|
|
3904
3983
|
uid,
|
|
@@ -3914,29 +3993,30 @@ var createAllOfComponent = (allOfProps) => {
|
|
|
3914
3993
|
title,
|
|
3915
3994
|
tags,
|
|
3916
3995
|
getChildren() {
|
|
3917
|
-
return
|
|
3996
|
+
return component.components;
|
|
3918
3997
|
},
|
|
3919
3998
|
getSummary() {
|
|
3920
|
-
return summariseFromChildren(
|
|
3999
|
+
return summariseFromChildren(component.getChildren());
|
|
3921
4000
|
},
|
|
3922
4001
|
async getSubmittableValue() {
|
|
3923
|
-
return getSubmittableData(
|
|
4002
|
+
return getSubmittableData(component.components);
|
|
3924
4003
|
},
|
|
3925
4004
|
getSubmittableValueSync() {
|
|
3926
|
-
return getSubmittableDataSync(
|
|
4005
|
+
return getSubmittableDataSync(component.components);
|
|
3927
4006
|
},
|
|
3928
4007
|
getLocalValue() {
|
|
3929
|
-
return getLocalValues(
|
|
4008
|
+
return getLocalValues(component.components);
|
|
3930
4009
|
},
|
|
3931
4010
|
validate() {
|
|
3932
|
-
return hidden ? true : validateComponents(
|
|
4011
|
+
return hidden ? true : validateComponents(component.getChildren());
|
|
3933
4012
|
}
|
|
3934
4013
|
};
|
|
4014
|
+
return component;
|
|
3935
4015
|
};
|
|
3936
4016
|
|
|
3937
4017
|
// src/domain/mappers/schema/allOfSchemaToComponent.ts
|
|
3938
4018
|
var allOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
3939
|
-
const { uid, schema, localValue, model, required, validationErrors } = schemaMapperProps;
|
|
4019
|
+
const { uid, schema, localValue, model, required, validationErrors, onValueChange } = schemaMapperProps;
|
|
3940
4020
|
const { allOf } = schema;
|
|
3941
4021
|
const components = allOf.map(
|
|
3942
4022
|
(childSchema, index) => mapSchemaToComponent(
|
|
@@ -3946,7 +4026,8 @@ var allOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
3946
4026
|
model,
|
|
3947
4027
|
localValue,
|
|
3948
4028
|
required,
|
|
3949
|
-
validationErrors
|
|
4029
|
+
validationErrors,
|
|
4030
|
+
onValueChange
|
|
3950
4031
|
},
|
|
3951
4032
|
mapperProps
|
|
3952
4033
|
)
|
|
@@ -3957,8 +4038,8 @@ var allOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
3957
4038
|
};
|
|
3958
4039
|
|
|
3959
4040
|
// src/domain/components/RepeatableComponent.ts
|
|
3960
|
-
var createRepeatableComponent = (
|
|
3961
|
-
const _a =
|
|
4041
|
+
var createRepeatableComponent = (props, onComponentUpdate) => {
|
|
4042
|
+
const _a = props, {
|
|
3962
4043
|
uid,
|
|
3963
4044
|
schemaId,
|
|
3964
4045
|
analyticsId,
|
|
@@ -3981,7 +4062,7 @@ var createRepeatableComponent = (repeatableProps, onComponentUpdate) => {
|
|
|
3981
4062
|
]);
|
|
3982
4063
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
3983
4064
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
3984
|
-
const
|
|
4065
|
+
const component = __spreadProps(__spreadValues({
|
|
3985
4066
|
uid,
|
|
3986
4067
|
schemaId,
|
|
3987
4068
|
analyticsId,
|
|
@@ -3996,37 +4077,34 @@ var createRepeatableComponent = (repeatableProps, onComponentUpdate) => {
|
|
|
3996
4077
|
media: summary == null ? void 0 : summary.defaultMedia
|
|
3997
4078
|
}
|
|
3998
4079
|
}, componentProps), {
|
|
3999
|
-
|
|
4000
|
-
update(
|
|
4001
|
-
},
|
|
4002
|
-
onEdit(itemIndex) {
|
|
4003
|
-
this._update((draft) => {
|
|
4080
|
+
editComponent(itemIndex) {
|
|
4081
|
+
update(component, (draft) => {
|
|
4004
4082
|
draft.editableComponent = createEditableComponent(
|
|
4005
4083
|
draft.components[itemIndex].getLocalValue()
|
|
4006
4084
|
);
|
|
4007
4085
|
draft.editableIndex = itemIndex;
|
|
4008
4086
|
});
|
|
4009
4087
|
},
|
|
4010
|
-
|
|
4011
|
-
|
|
4088
|
+
addComponent() {
|
|
4089
|
+
update(component, (draft) => {
|
|
4012
4090
|
draft.editableComponent = createEditableComponent(null);
|
|
4013
4091
|
draft.editableIndex = null;
|
|
4014
4092
|
draft.errors = [];
|
|
4015
4093
|
});
|
|
4016
4094
|
},
|
|
4017
|
-
|
|
4095
|
+
saveComponent() {
|
|
4018
4096
|
var _a2;
|
|
4019
|
-
const isValid = (_a2 =
|
|
4097
|
+
const isValid = (_a2 = component.editableComponent) == null ? void 0 : _a2.validate();
|
|
4020
4098
|
if (!isValid) {
|
|
4021
4099
|
return false;
|
|
4022
4100
|
}
|
|
4023
|
-
|
|
4101
|
+
update(component, (draft) => {
|
|
4024
4102
|
if (draft.editableComponent === null) {
|
|
4025
4103
|
return;
|
|
4026
4104
|
}
|
|
4027
4105
|
if (draft.editableIndex === null) {
|
|
4028
4106
|
const newComponent = __spreadValues({}, draft.editableComponent);
|
|
4029
|
-
draft.components = [...
|
|
4107
|
+
draft.components = [...component.components, newComponent];
|
|
4030
4108
|
} else {
|
|
4031
4109
|
draft.components[draft.editableIndex] = __spreadProps(__spreadValues({}, draft.editableComponent), {
|
|
4032
4110
|
uid: draft.components[draft.editableIndex].uid
|
|
@@ -4038,8 +4116,8 @@ var createRepeatableComponent = (repeatableProps, onComponentUpdate) => {
|
|
|
4038
4116
|
onValueChange();
|
|
4039
4117
|
return true;
|
|
4040
4118
|
},
|
|
4041
|
-
|
|
4042
|
-
|
|
4119
|
+
removeComponent() {
|
|
4120
|
+
update(component, (draft) => {
|
|
4043
4121
|
if (draft.editableIndex === null) {
|
|
4044
4122
|
return;
|
|
4045
4123
|
}
|
|
@@ -4050,30 +4128,32 @@ var createRepeatableComponent = (repeatableProps, onComponentUpdate) => {
|
|
|
4050
4128
|
onValueChange();
|
|
4051
4129
|
},
|
|
4052
4130
|
getChildren() {
|
|
4053
|
-
return
|
|
4131
|
+
return component.editableComponent !== null ? [...component.components, component.editableComponent] : component.components;
|
|
4054
4132
|
},
|
|
4055
4133
|
async getSubmittableValue() {
|
|
4056
|
-
return Promise.all(
|
|
4134
|
+
return Promise.all(
|
|
4135
|
+
component.components.map(async (childComponent) => childComponent.getSubmittableValue())
|
|
4136
|
+
);
|
|
4057
4137
|
},
|
|
4058
4138
|
getSubmittableValueSync() {
|
|
4059
|
-
return
|
|
4139
|
+
return component.components.map((childComponent) => childComponent.getSubmittableValueSync());
|
|
4060
4140
|
},
|
|
4061
4141
|
getSummary() {
|
|
4062
4142
|
return summariser(null);
|
|
4063
4143
|
},
|
|
4064
4144
|
getLocalValue() {
|
|
4065
|
-
return
|
|
4145
|
+
return component.components.map((childComponent) => childComponent.getLocalValue());
|
|
4066
4146
|
},
|
|
4067
4147
|
validate() {
|
|
4068
|
-
const messages = getValidationErrors(
|
|
4069
|
-
const childComponentsValid = validateComponents(
|
|
4070
|
-
|
|
4148
|
+
const messages = getValidationErrors(component.getLocalValue());
|
|
4149
|
+
const childComponentsValid = validateComponents(component.getChildren());
|
|
4150
|
+
update(component, (draft) => {
|
|
4071
4151
|
draft.errors = messages;
|
|
4072
4152
|
});
|
|
4073
4153
|
return messages.length === 0 && childComponentsValid;
|
|
4074
4154
|
}
|
|
4075
4155
|
});
|
|
4076
|
-
return
|
|
4156
|
+
return component;
|
|
4077
4157
|
};
|
|
4078
4158
|
|
|
4079
4159
|
// src/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.ts
|
|
@@ -4085,7 +4165,8 @@ var arraySchemaToRepeatableComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4085
4165
|
schema,
|
|
4086
4166
|
model: initialModel,
|
|
4087
4167
|
required = false,
|
|
4088
|
-
validationErrors
|
|
4168
|
+
validationErrors,
|
|
4169
|
+
onValueChange
|
|
4089
4170
|
} = schemaMapperProps;
|
|
4090
4171
|
const { items, addItemTitle, editItemTitle, maxItems, minItems, summary } = schema;
|
|
4091
4172
|
const value = isArray(localValue) ? localValue : [];
|
|
@@ -4097,7 +4178,8 @@ var arraySchemaToRepeatableComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4097
4178
|
model: item,
|
|
4098
4179
|
localValue: value == null ? void 0 : value[index],
|
|
4099
4180
|
// TODO tests for this
|
|
4100
|
-
validationErrors
|
|
4181
|
+
validationErrors,
|
|
4182
|
+
onValueChange
|
|
4101
4183
|
},
|
|
4102
4184
|
mapperProps
|
|
4103
4185
|
)
|
|
@@ -4109,11 +4191,11 @@ var arraySchemaToRepeatableComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4109
4191
|
localValue: editableValue,
|
|
4110
4192
|
model: localValueToJsonElement(editableValue),
|
|
4111
4193
|
validationErrors: void 0,
|
|
4112
|
-
required: true
|
|
4194
|
+
required: true,
|
|
4195
|
+
onValueChange
|
|
4113
4196
|
},
|
|
4114
4197
|
mapperProps
|
|
4115
4198
|
);
|
|
4116
|
-
const { onValueChange } = mapperProps;
|
|
4117
4199
|
const errorMessageFunctions = getErrorMessageFunctions(schema.validationMessages);
|
|
4118
4200
|
return createRepeatableComponent(
|
|
4119
4201
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
@@ -4223,8 +4305,8 @@ var base64ToBytes = (base64) => {
|
|
|
4223
4305
|
};
|
|
4224
4306
|
|
|
4225
4307
|
// src/domain/components/MultiUploadInputComponent.ts
|
|
4226
|
-
var createMultiUploadInputComponent = (
|
|
4227
|
-
const _a =
|
|
4308
|
+
var createMultiUploadInputComponent = (props, onComponentUpdate) => {
|
|
4309
|
+
const _a = props, {
|
|
4228
4310
|
uid,
|
|
4229
4311
|
id,
|
|
4230
4312
|
checks,
|
|
@@ -4247,77 +4329,74 @@ var createMultiUploadInputComponent = (uploadInputProps, onComponentUpdate) => {
|
|
|
4247
4329
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
4248
4330
|
const getFileValidationErrors = getLocalValueValidator(fileChecks);
|
|
4249
4331
|
const persist = performPersistAsync ? getComponentMultiPersistAsync(update, performPersistAsync) : void 0;
|
|
4250
|
-
const
|
|
4332
|
+
const component = __spreadValues({
|
|
4251
4333
|
type: "multi-upload",
|
|
4252
4334
|
kind: "input",
|
|
4253
4335
|
uid,
|
|
4254
4336
|
id,
|
|
4255
4337
|
format,
|
|
4256
4338
|
files: [],
|
|
4257
|
-
_update(updateFn) {
|
|
4258
|
-
update(this, updateFn);
|
|
4259
|
-
},
|
|
4260
4339
|
onBlur() {
|
|
4261
|
-
|
|
4340
|
+
component.validate();
|
|
4262
4341
|
},
|
|
4263
4342
|
onFocus() {
|
|
4264
4343
|
},
|
|
4265
4344
|
// Noop
|
|
4266
|
-
async
|
|
4345
|
+
async removeFile(index) {
|
|
4267
4346
|
var _a2;
|
|
4268
|
-
|
|
4347
|
+
update(component, (draft) => {
|
|
4269
4348
|
draft.value.splice(index, 1);
|
|
4270
4349
|
draft.files.splice(index, 1);
|
|
4271
4350
|
});
|
|
4272
4351
|
if (persist) {
|
|
4273
|
-
(_a2 =
|
|
4274
|
-
|
|
4352
|
+
(_a2 = component.persistedState[index]) == null ? void 0 : _a2.abortController.abort();
|
|
4353
|
+
update(component, (draft) => {
|
|
4275
4354
|
draft.persistedState.splice(index, 1);
|
|
4276
4355
|
});
|
|
4277
4356
|
}
|
|
4278
4357
|
},
|
|
4279
|
-
async
|
|
4358
|
+
async insertFile(index, file) {
|
|
4280
4359
|
const fileErrors = getFileValidationErrors(file);
|
|
4281
4360
|
const fileId = getRandomId();
|
|
4282
4361
|
const base64Value = format === "base64" ? await toBase64(file) : null;
|
|
4283
|
-
|
|
4362
|
+
update(component, (draft) => {
|
|
4284
4363
|
draft.value.splice(index, 0, file);
|
|
4285
4364
|
draft.files.splice(index, 0, { file, id: fileId, errors: fileErrors, base64Value });
|
|
4286
4365
|
draft.errors = [];
|
|
4287
4366
|
});
|
|
4288
4367
|
if (persist) {
|
|
4289
|
-
await persist(
|
|
4368
|
+
await persist(component, index, format === "blob" ? file : base64Value);
|
|
4290
4369
|
}
|
|
4291
4370
|
onValueChange();
|
|
4292
4371
|
return fileId;
|
|
4293
4372
|
},
|
|
4294
4373
|
async getSubmittableValue() {
|
|
4295
4374
|
if (persist) {
|
|
4296
|
-
return Promise.all(
|
|
4375
|
+
return Promise.all(component.persistedState.map(async ({ submission }) => submission));
|
|
4297
4376
|
}
|
|
4298
|
-
return
|
|
4377
|
+
return component.files.map(({ base64Value }) => base64Value);
|
|
4299
4378
|
},
|
|
4300
4379
|
getSubmittableValueSync() {
|
|
4301
4380
|
if (persist) {
|
|
4302
|
-
return
|
|
4381
|
+
return component.persistedState.map(({ lastResponse }) => lastResponse);
|
|
4303
4382
|
}
|
|
4304
|
-
return
|
|
4383
|
+
return component.files.map(({ base64Value }) => base64Value);
|
|
4305
4384
|
},
|
|
4306
4385
|
getSummary() {
|
|
4307
|
-
return summariser(
|
|
4386
|
+
return summariser(component.getLocalValue().map(({ name }) => name));
|
|
4308
4387
|
},
|
|
4309
4388
|
getLocalValue() {
|
|
4310
|
-
return
|
|
4389
|
+
return component.value;
|
|
4311
4390
|
},
|
|
4312
4391
|
validate() {
|
|
4313
|
-
const errorMsgs = getValidationErrors(
|
|
4314
|
-
|
|
4392
|
+
const errorMsgs = getValidationErrors(component.getLocalValue());
|
|
4393
|
+
update(component, (draft) => {
|
|
4315
4394
|
draft.errors = errorMsgs;
|
|
4316
4395
|
});
|
|
4317
|
-
return errorMsgs.length === 0 &&
|
|
4396
|
+
return errorMsgs.length === 0 && component.files.every(({ errors }) => errors.length === 0);
|
|
4318
4397
|
}
|
|
4319
4398
|
}, rest);
|
|
4320
|
-
return
|
|
4399
|
+
return component;
|
|
4321
4400
|
};
|
|
4322
4401
|
|
|
4323
4402
|
// src/domain/features/persistAsync/getInitialPersistedState.ts
|
|
@@ -4400,7 +4479,7 @@ var schemaHasValidationMessages = (schema) => Boolean("validationMessages" in sc
|
|
|
4400
4479
|
var arraySchemaToMultiUploadComponent = (schemaMapperProps, mapperProps) => {
|
|
4401
4480
|
var _a;
|
|
4402
4481
|
const { getErrorMessageFunctions } = mapperProps;
|
|
4403
|
-
const { localValue, model, schema, required = false } = schemaMapperProps;
|
|
4482
|
+
const { localValue, model, schema, required = false, onValueChange } = schemaMapperProps;
|
|
4404
4483
|
const uploadSchema = getUploadSchema(schema.items);
|
|
4405
4484
|
const { accepts, cameraConfig, maxSize } = uploadSchema;
|
|
4406
4485
|
const { minItems, maxItems, title, validationMessages } = schema;
|
|
@@ -4421,7 +4500,6 @@ var arraySchemaToMultiUploadComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4421
4500
|
persistAsyncConfig,
|
|
4422
4501
|
schema: __spreadProps(__spreadValues({}, uploadSchema), { hidden: (_a = schema.hidden) != null ? _a : uploadSchema.hidden, alert: schema.alert })
|
|
4423
4502
|
});
|
|
4424
|
-
const { onValueChange } = mapperProps;
|
|
4425
4503
|
const performPersistAsync = persistAsyncConfig ? getPerformPersistAsyncFn(combinedSchemaProps.schema, persistAsyncConfig, mapperProps) : void 0;
|
|
4426
4504
|
const value = performPersistAsync ? getValueForPersistAsync(localValue) : [];
|
|
4427
4505
|
const persistedState = performPersistAsync && isArray(model) ? model.map((itemModel) => getInitialPersistedState(null, itemModel)) : [];
|
|
@@ -4471,8 +4549,8 @@ var getPersistAsyncConfig = (schema) => {
|
|
|
4471
4549
|
var getValueForPersistAsync = (localValue) => isArray(localValue) && localValue.every(isFile) ? localValue : [];
|
|
4472
4550
|
|
|
4473
4551
|
// src/domain/components/MultiSelectInputComponent.ts
|
|
4474
|
-
var createMultiSelectComponent = (
|
|
4475
|
-
const _a =
|
|
4552
|
+
var createMultiSelectComponent = (props, onComponentUpdate) => {
|
|
4553
|
+
const _a = props, {
|
|
4476
4554
|
uid,
|
|
4477
4555
|
checks,
|
|
4478
4556
|
options,
|
|
@@ -4503,21 +4581,18 @@ var createMultiSelectComponent = (multiSelectProps, onComponentUpdate) => {
|
|
|
4503
4581
|
selectedIndices,
|
|
4504
4582
|
value: null
|
|
4505
4583
|
}, rest), {
|
|
4506
|
-
|
|
4507
|
-
update(
|
|
4508
|
-
},
|
|
4509
|
-
onSelect(indices) {
|
|
4510
|
-
this._update((draft) => {
|
|
4584
|
+
selectIndices(indices) {
|
|
4585
|
+
update(component, (draft) => {
|
|
4511
4586
|
draft.selectedIndices = indices;
|
|
4512
4587
|
draft.errors = [];
|
|
4513
4588
|
});
|
|
4514
4589
|
void (schemaOnChange == null ? void 0 : schemaOnChange());
|
|
4515
|
-
const errors = getValidationErrors(
|
|
4516
|
-
|
|
4590
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
4591
|
+
update(component, (draft) => {
|
|
4517
4592
|
draft.errors = errors;
|
|
4518
4593
|
});
|
|
4519
|
-
if (
|
|
4520
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
4594
|
+
if (component.validate()) {
|
|
4595
|
+
validateAsync == null ? void 0 : validateAsync(component, component.getLocalValue()).catch(() => {
|
|
4521
4596
|
});
|
|
4522
4597
|
}
|
|
4523
4598
|
onValueChange();
|
|
@@ -4530,17 +4605,17 @@ var createMultiSelectComponent = (multiSelectProps, onComponentUpdate) => {
|
|
|
4530
4605
|
// Noop
|
|
4531
4606
|
getLocalValue() {
|
|
4532
4607
|
var _a2, _b;
|
|
4533
|
-
return (_b = (_a2 =
|
|
4608
|
+
return (_b = (_a2 = component.getSelectedChildren()) == null ? void 0 : _a2.map((child) => child.getLocalValue())) != null ? _b : null;
|
|
4534
4609
|
},
|
|
4535
4610
|
validate() {
|
|
4536
|
-
const errors = getValidationErrors(
|
|
4537
|
-
|
|
4611
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
4612
|
+
update(component, (draft) => {
|
|
4538
4613
|
draft.errors = errors;
|
|
4539
4614
|
});
|
|
4540
4615
|
return errors.length === 0;
|
|
4541
4616
|
},
|
|
4542
4617
|
async getSubmittableValue() {
|
|
4543
|
-
const selected =
|
|
4618
|
+
const selected = component.getSelectedChildren();
|
|
4544
4619
|
if (selected) {
|
|
4545
4620
|
return Promise.all(selected.map(async (child) => child.getSubmittableValue()));
|
|
4546
4621
|
}
|
|
@@ -4548,14 +4623,14 @@ var createMultiSelectComponent = (multiSelectProps, onComponentUpdate) => {
|
|
|
4548
4623
|
},
|
|
4549
4624
|
getSubmittableValueSync() {
|
|
4550
4625
|
var _a2, _b;
|
|
4551
|
-
return (_b = (_a2 =
|
|
4626
|
+
return (_b = (_a2 = component.getSelectedChildren()) == null ? void 0 : _a2.map((child) => child.getSubmittableValueSync())) != null ? _b : null;
|
|
4552
4627
|
},
|
|
4553
4628
|
getSummary: () => ({}),
|
|
4554
4629
|
getChildren() {
|
|
4555
|
-
return
|
|
4630
|
+
return component.children;
|
|
4556
4631
|
},
|
|
4557
4632
|
getSelectedChildren() {
|
|
4558
|
-
return
|
|
4633
|
+
return component.selectedIndices.map((i) => component.children[i]);
|
|
4559
4634
|
}
|
|
4560
4635
|
});
|
|
4561
4636
|
return component;
|
|
@@ -4575,7 +4650,8 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4575
4650
|
schema,
|
|
4576
4651
|
model,
|
|
4577
4652
|
required = false,
|
|
4578
|
-
validationErrors: initialError
|
|
4653
|
+
validationErrors: initialError,
|
|
4654
|
+
onValueChange
|
|
4579
4655
|
} = schemaMapperProps;
|
|
4580
4656
|
const initialModel = model != null ? model : null;
|
|
4581
4657
|
const options = schema.items.oneOf.map((childSchema, index) => {
|
|
@@ -4599,14 +4675,15 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4599
4675
|
model: initialModel,
|
|
4600
4676
|
localValue,
|
|
4601
4677
|
validationErrors: initialError,
|
|
4602
|
-
required
|
|
4678
|
+
required,
|
|
4679
|
+
onValueChange
|
|
4603
4680
|
},
|
|
4604
4681
|
mapperProps
|
|
4605
4682
|
)
|
|
4606
4683
|
};
|
|
4607
4684
|
});
|
|
4608
4685
|
const { maxItems, minItems, title, validationMessages } = schema;
|
|
4609
|
-
const { getErrorMessageFunctions, onBehavior,
|
|
4686
|
+
const { getErrorMessageFunctions, onBehavior, onComponentUpdate } = mapperProps;
|
|
4610
4687
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
4611
4688
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
4612
4689
|
schemaMapperProps,
|
|
@@ -4637,7 +4714,7 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4637
4714
|
};
|
|
4638
4715
|
|
|
4639
4716
|
// src/domain/components/TupleComponent.ts
|
|
4640
|
-
var createTupleComponent = (
|
|
4717
|
+
var createTupleComponent = (props) => {
|
|
4641
4718
|
const {
|
|
4642
4719
|
uid,
|
|
4643
4720
|
schemaId,
|
|
@@ -4652,8 +4729,8 @@ var createTupleComponent = (tupleProps) => {
|
|
|
4652
4729
|
summariser,
|
|
4653
4730
|
title,
|
|
4654
4731
|
tags
|
|
4655
|
-
} =
|
|
4656
|
-
|
|
4732
|
+
} = props;
|
|
4733
|
+
const component = {
|
|
4657
4734
|
type: "tuple",
|
|
4658
4735
|
kind: "input",
|
|
4659
4736
|
uid,
|
|
@@ -4669,26 +4746,27 @@ var createTupleComponent = (tupleProps) => {
|
|
|
4669
4746
|
title,
|
|
4670
4747
|
tags,
|
|
4671
4748
|
getChildren() {
|
|
4672
|
-
return
|
|
4749
|
+
return component.components;
|
|
4673
4750
|
},
|
|
4674
4751
|
async getSubmittableValue() {
|
|
4675
|
-
return Promise.all(
|
|
4752
|
+
return Promise.all(component.components.map(async (child) => child.getSubmittableValue()));
|
|
4676
4753
|
},
|
|
4677
4754
|
getSubmittableValueSync() {
|
|
4678
|
-
return
|
|
4755
|
+
return component.components.map((child) => child.getSubmittableValueSync());
|
|
4679
4756
|
},
|
|
4680
4757
|
getSummary() {
|
|
4681
|
-
const summary = summariser(
|
|
4682
|
-
const childSummary = summariseFromChildren(
|
|
4758
|
+
const summary = summariser(component.getLocalValue());
|
|
4759
|
+
const childSummary = summariseFromChildren(component.getChildren());
|
|
4683
4760
|
return mergeSummaries(summary, childSummary);
|
|
4684
4761
|
},
|
|
4685
4762
|
getLocalValue() {
|
|
4686
|
-
return
|
|
4763
|
+
return component.components.map((child) => child.getLocalValue());
|
|
4687
4764
|
},
|
|
4688
4765
|
validate() {
|
|
4689
|
-
return hidden ? true : validateComponents(
|
|
4766
|
+
return hidden ? true : validateComponents(component.getChildren());
|
|
4690
4767
|
}
|
|
4691
4768
|
};
|
|
4769
|
+
return component;
|
|
4692
4770
|
};
|
|
4693
4771
|
|
|
4694
4772
|
// src/domain/mappers/schema/arraySchemaToComponent/arraySchemaToTupleComponent.ts
|
|
@@ -4699,7 +4777,8 @@ var arraySchemaToTupleComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4699
4777
|
schema,
|
|
4700
4778
|
model: initialModel,
|
|
4701
4779
|
required = false,
|
|
4702
|
-
validationErrors
|
|
4780
|
+
validationErrors,
|
|
4781
|
+
onValueChange
|
|
4703
4782
|
} = schemaMapperProps;
|
|
4704
4783
|
const { items } = schema;
|
|
4705
4784
|
const components = items.map(
|
|
@@ -4712,7 +4791,8 @@ var arraySchemaToTupleComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4712
4791
|
model: isArray(initialModel) ? (_a = initialModel[index]) != null ? _a : null : null,
|
|
4713
4792
|
localValue: isArray(localValue) ? (_b = localValue[index]) != null ? _b : null : null,
|
|
4714
4793
|
validationErrors: isArray(validationErrors) ? validationErrors[index] : void 0,
|
|
4715
|
-
required
|
|
4794
|
+
required,
|
|
4795
|
+
onValueChange
|
|
4716
4796
|
},
|
|
4717
4797
|
mapperProps
|
|
4718
4798
|
);
|
|
@@ -4743,8 +4823,8 @@ var isPersistAsyncWithUploadSchema = (schema) => isSchemaWithPersistAsync(schema
|
|
|
4743
4823
|
var isArraySchemaListWithMultiSelect = (schema) => isArrayListSchema(schema) && "oneOf" in schema.items && schema.items.oneOf.every(isConstSchema);
|
|
4744
4824
|
|
|
4745
4825
|
// src/domain/components/UploadInputComponent.ts
|
|
4746
|
-
var createUploadInputComponent = (
|
|
4747
|
-
const _a =
|
|
4826
|
+
var createUploadInputComponent = (props, onComponentUpdate) => {
|
|
4827
|
+
const _a = props, {
|
|
4748
4828
|
uid,
|
|
4749
4829
|
id,
|
|
4750
4830
|
checks,
|
|
@@ -4767,7 +4847,7 @@ var createUploadInputComponent = (uploadInputProps, onComponentUpdate) => {
|
|
|
4767
4847
|
]);
|
|
4768
4848
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
4769
4849
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
4770
|
-
const
|
|
4850
|
+
const component = __spreadValues({
|
|
4771
4851
|
type: "upload",
|
|
4772
4852
|
kind: "input",
|
|
4773
4853
|
uid,
|
|
@@ -4775,18 +4855,15 @@ var createUploadInputComponent = (uploadInputProps, onComponentUpdate) => {
|
|
|
4775
4855
|
format,
|
|
4776
4856
|
value,
|
|
4777
4857
|
base64Value: null,
|
|
4778
|
-
_update(updateFn) {
|
|
4779
|
-
update(this, updateFn);
|
|
4780
|
-
},
|
|
4781
4858
|
onBlur() {
|
|
4782
|
-
|
|
4859
|
+
component.validate();
|
|
4783
4860
|
},
|
|
4784
4861
|
onFocus() {
|
|
4785
4862
|
},
|
|
4786
4863
|
// Noop
|
|
4787
|
-
async
|
|
4788
|
-
const base64Value =
|
|
4789
|
-
|
|
4864
|
+
async setValue(updatedValue) {
|
|
4865
|
+
const base64Value = component.format === "base64" && updatedValue ? await toBase64(updatedValue) : null;
|
|
4866
|
+
update(component, (draft) => {
|
|
4790
4867
|
draft.errors = [];
|
|
4791
4868
|
draft.value = updatedValue;
|
|
4792
4869
|
draft.base64Value = base64Value;
|
|
@@ -4794,57 +4871,61 @@ var createUploadInputComponent = (uploadInputProps, onComponentUpdate) => {
|
|
|
4794
4871
|
void (schemaOnChange == null ? void 0 : schemaOnChange());
|
|
4795
4872
|
onValueChange();
|
|
4796
4873
|
await (onPersistAsync == null ? void 0 : onPersistAsync().catch((e) => {
|
|
4797
|
-
|
|
4874
|
+
update(component, (draft) => {
|
|
4798
4875
|
draft.value = null;
|
|
4799
4876
|
});
|
|
4800
4877
|
throw e;
|
|
4801
4878
|
}));
|
|
4802
4879
|
},
|
|
4803
4880
|
async getSubmittableValue() {
|
|
4804
|
-
const file =
|
|
4805
|
-
if (
|
|
4881
|
+
const file = component.getLocalValue();
|
|
4882
|
+
if (component.format === "base64" && file) {
|
|
4806
4883
|
return toBase64(file);
|
|
4807
4884
|
}
|
|
4808
4885
|
return null;
|
|
4809
4886
|
},
|
|
4810
4887
|
getSubmittableValueSync() {
|
|
4811
|
-
return
|
|
4888
|
+
return component.base64Value;
|
|
4812
4889
|
},
|
|
4813
4890
|
getSummary() {
|
|
4814
4891
|
var _a2, _b;
|
|
4815
|
-
return summariser((_b = (_a2 =
|
|
4892
|
+
return summariser((_b = (_a2 = component.getLocalValue()) == null ? void 0 : _a2.name) != null ? _b : null);
|
|
4816
4893
|
},
|
|
4817
4894
|
getLocalValue() {
|
|
4818
|
-
return
|
|
4895
|
+
return component.value;
|
|
4819
4896
|
},
|
|
4820
4897
|
validate() {
|
|
4821
|
-
const errors = getValidationErrors(
|
|
4822
|
-
|
|
4898
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
4899
|
+
update(component, (draft) => {
|
|
4823
4900
|
draft.errors = errors;
|
|
4824
4901
|
});
|
|
4825
4902
|
return errors.length === 0;
|
|
4826
4903
|
}
|
|
4827
4904
|
}, rest);
|
|
4828
4905
|
if (format === "base64" && value && !onPersistAsync) {
|
|
4829
|
-
void
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
const base64Value = format === "base64" && value ? await toBase64(value) : null;
|
|
4836
|
-
if (base64Value) {
|
|
4837
|
-
uploadComponent._update((draft) => {
|
|
4838
|
-
draft.base64Value = base64Value;
|
|
4906
|
+
void toBase64(value).then((base64Value) => {
|
|
4907
|
+
if (base64Value) {
|
|
4908
|
+
update(component, (draft) => {
|
|
4909
|
+
draft.base64Value = base64Value;
|
|
4910
|
+
});
|
|
4911
|
+
}
|
|
4839
4912
|
});
|
|
4840
4913
|
}
|
|
4914
|
+
return component;
|
|
4841
4915
|
};
|
|
4842
4916
|
|
|
4843
4917
|
// src/domain/mappers/schema/blobSchemaToComponent.ts
|
|
4844
4918
|
var blobSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
4845
|
-
const {
|
|
4919
|
+
const {
|
|
4920
|
+
schema,
|
|
4921
|
+
localValue,
|
|
4922
|
+
model,
|
|
4923
|
+
required = false,
|
|
4924
|
+
onPersistAsync,
|
|
4925
|
+
onValueChange
|
|
4926
|
+
} = schemaMapperProps;
|
|
4846
4927
|
const { accepts, cameraConfig, maxSize, source, validationMessages } = schema;
|
|
4847
|
-
const { getErrorMessageFunctions, onComponentUpdate
|
|
4928
|
+
const { getErrorMessageFunctions, onComponentUpdate } = mapperProps;
|
|
4848
4929
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
4849
4930
|
const validLocalValue = isFile(localValue) ? localValue : null;
|
|
4850
4931
|
const value = onPersistAsync && model !== null ? validLocalValue : null;
|
|
@@ -4866,8 +4947,8 @@ var blobSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4866
4947
|
};
|
|
4867
4948
|
|
|
4868
4949
|
// src/domain/components/BooleanInputComponent.ts
|
|
4869
|
-
var createBooleanInputComponent = (
|
|
4870
|
-
const _a =
|
|
4950
|
+
var createBooleanInputComponent = (props, onComponentUpdate) => {
|
|
4951
|
+
const _a = props, {
|
|
4871
4952
|
uid,
|
|
4872
4953
|
id,
|
|
4873
4954
|
value,
|
|
@@ -4888,56 +4969,53 @@ var createBooleanInputComponent = (booleanInputProps, onComponentUpdate) => {
|
|
|
4888
4969
|
]);
|
|
4889
4970
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
4890
4971
|
const validateAsync = performValidationAsync ? getComponentValidationAsync(update, performValidationAsync) : void 0;
|
|
4891
|
-
const
|
|
4972
|
+
const component = __spreadValues({
|
|
4892
4973
|
type: "boolean",
|
|
4893
4974
|
kind: "input",
|
|
4894
4975
|
uid,
|
|
4895
4976
|
id,
|
|
4896
4977
|
autoComplete: "",
|
|
4897
4978
|
value,
|
|
4898
|
-
_update(updateFn) {
|
|
4899
|
-
update(this, updateFn);
|
|
4900
|
-
},
|
|
4901
4979
|
onBlur() {
|
|
4902
4980
|
},
|
|
4903
4981
|
// Noop
|
|
4904
4982
|
onFocus() {
|
|
4905
4983
|
},
|
|
4906
4984
|
// Noop
|
|
4907
|
-
|
|
4908
|
-
|
|
4985
|
+
setValue(updatedValue) {
|
|
4986
|
+
update(component, (draft) => {
|
|
4909
4987
|
draft.errors = [];
|
|
4910
4988
|
draft.value = updatedValue;
|
|
4911
4989
|
});
|
|
4912
4990
|
void (schemaOnChange == null ? void 0 : schemaOnChange());
|
|
4913
4991
|
void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
|
|
4914
4992
|
}));
|
|
4915
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
4993
|
+
validateAsync == null ? void 0 : validateAsync(component, component.getLocalValue()).catch(() => {
|
|
4916
4994
|
});
|
|
4917
4995
|
onValueChange();
|
|
4918
4996
|
},
|
|
4919
4997
|
async getSubmittableValue() {
|
|
4920
|
-
return
|
|
4998
|
+
return component.getSubmittableValueSync();
|
|
4921
4999
|
},
|
|
4922
5000
|
getSubmittableValueSync() {
|
|
4923
|
-
return
|
|
5001
|
+
return component.getLocalValue();
|
|
4924
5002
|
},
|
|
4925
5003
|
getSummary() {
|
|
4926
|
-
return summariser(
|
|
5004
|
+
return summariser(component.getLocalValue());
|
|
4927
5005
|
},
|
|
4928
5006
|
getLocalValue() {
|
|
4929
|
-
return
|
|
5007
|
+
return component.value;
|
|
4930
5008
|
},
|
|
4931
5009
|
validate: () => true
|
|
4932
5010
|
}, rest);
|
|
4933
|
-
return
|
|
5011
|
+
return component;
|
|
4934
5012
|
};
|
|
4935
5013
|
|
|
4936
5014
|
// src/domain/mappers/schema/booleanSchemaToComponent.ts
|
|
4937
5015
|
var booleanSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
4938
|
-
const { schema, localValue, model, onPersistAsync } = schemaMapperProps;
|
|
5016
|
+
const { schema, localValue, model, onPersistAsync, onValueChange } = schemaMapperProps;
|
|
4939
5017
|
const { default: defaultValue, additionalText, inlineAlert, supportingValues } = schema;
|
|
4940
|
-
const { onComponentUpdate, onBehavior
|
|
5018
|
+
const { onComponentUpdate, onBehavior } = mapperProps;
|
|
4941
5019
|
const schemaOnChange = getSchemaOnChange(schema, onBehavior);
|
|
4942
5020
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
4943
5021
|
schemaMapperProps,
|
|
@@ -4971,8 +5049,8 @@ var getValidModel = (model, defaultValue) => {
|
|
|
4971
5049
|
};
|
|
4972
5050
|
|
|
4973
5051
|
// src/domain/components/ConstComponent.ts
|
|
4974
|
-
var createConstComponent = (
|
|
4975
|
-
const { uid, schemaId, analyticsId, value, summary, layout, hidden, tags } =
|
|
5052
|
+
var createConstComponent = (props) => {
|
|
5053
|
+
const { uid, schemaId, analyticsId, value, summary, layout, hidden, tags } = props;
|
|
4976
5054
|
return {
|
|
4977
5055
|
type: "const",
|
|
4978
5056
|
kind: "input",
|
|
@@ -5015,8 +5093,8 @@ var getConstLayout = (uid, mapperProps, layout, alert) => {
|
|
|
5015
5093
|
};
|
|
5016
5094
|
|
|
5017
5095
|
// src/domain/components/IntegerInputComponent.ts
|
|
5018
|
-
var createIntegerInputComponent = (
|
|
5019
|
-
const _a =
|
|
5096
|
+
var createIntegerInputComponent = (props, onComponentUpdate) => {
|
|
5097
|
+
const _a = props, {
|
|
5020
5098
|
uid,
|
|
5021
5099
|
id,
|
|
5022
5100
|
checks,
|
|
@@ -5038,33 +5116,32 @@ var createIntegerInputComponent = (integerInputProps, onComponentUpdate) => {
|
|
|
5038
5116
|
"summariser"
|
|
5039
5117
|
]);
|
|
5040
5118
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
5119
|
+
const onValueChangeDebounced = debounce(onValueChange, 1e3);
|
|
5041
5120
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
5042
5121
|
const performOnChange = getDebouncedSchemaOnChange(schemaOnChange, getValidationErrors);
|
|
5043
5122
|
const validateAsync = performValidationAsync ? getDebouncedComponentValidationAsync(update, performValidationAsync) : void 0;
|
|
5044
|
-
const
|
|
5123
|
+
const component = __spreadValues({
|
|
5045
5124
|
type: "integer",
|
|
5046
5125
|
kind: "input",
|
|
5047
5126
|
uid,
|
|
5048
5127
|
id,
|
|
5049
5128
|
value,
|
|
5050
|
-
_update(updateFn) {
|
|
5051
|
-
update(this, updateFn);
|
|
5052
|
-
},
|
|
5053
5129
|
onBlur() {
|
|
5054
|
-
const isValid =
|
|
5130
|
+
const isValid = component.validate();
|
|
5055
5131
|
performOnChange == null ? void 0 : performOnChange.flush();
|
|
5056
5132
|
if (isValid) {
|
|
5057
5133
|
void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
|
|
5058
5134
|
}));
|
|
5059
5135
|
validateAsync == null ? void 0 : validateAsync.flush();
|
|
5060
5136
|
}
|
|
5137
|
+
onValueChangeDebounced.flush();
|
|
5061
5138
|
},
|
|
5062
5139
|
onFocus() {
|
|
5063
5140
|
},
|
|
5064
5141
|
// Noop
|
|
5065
|
-
|
|
5066
|
-
const prevValue =
|
|
5067
|
-
|
|
5142
|
+
setValue(updatedValue) {
|
|
5143
|
+
const prevValue = component.value;
|
|
5144
|
+
update(component, (draft) => {
|
|
5068
5145
|
draft.errors = [];
|
|
5069
5146
|
draft.validationAsyncState.messages = {};
|
|
5070
5147
|
draft.value = updatedValue;
|
|
@@ -5072,39 +5149,46 @@ var createIntegerInputComponent = (integerInputProps, onComponentUpdate) => {
|
|
|
5072
5149
|
performOnChange == null ? void 0 : performOnChange(prevValue, updatedValue);
|
|
5073
5150
|
const isValid = getValidationErrors(updatedValue).length === 0;
|
|
5074
5151
|
if (isValid) {
|
|
5075
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
5152
|
+
validateAsync == null ? void 0 : validateAsync(component, updatedValue);
|
|
5076
5153
|
}
|
|
5077
|
-
|
|
5154
|
+
onValueChangeDebounced();
|
|
5078
5155
|
},
|
|
5079
5156
|
async getSubmittableValue() {
|
|
5080
|
-
return
|
|
5157
|
+
return component.getSubmittableValueSync();
|
|
5081
5158
|
},
|
|
5082
5159
|
getSubmittableValueSync() {
|
|
5083
5160
|
var _a2;
|
|
5084
|
-
return (_a2 =
|
|
5161
|
+
return (_a2 = component.getLocalValue()) != null ? _a2 : null;
|
|
5085
5162
|
},
|
|
5086
5163
|
getSummary() {
|
|
5087
|
-
return summariser(
|
|
5164
|
+
return summariser(component.getLocalValue());
|
|
5088
5165
|
},
|
|
5089
5166
|
getLocalValue() {
|
|
5090
|
-
return
|
|
5167
|
+
return component.value;
|
|
5091
5168
|
},
|
|
5092
5169
|
validate() {
|
|
5093
|
-
const errors = getValidationErrors(
|
|
5094
|
-
|
|
5170
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
5171
|
+
update(component, (draft) => {
|
|
5095
5172
|
draft.errors = errors;
|
|
5096
5173
|
});
|
|
5097
5174
|
return errors.length === 0;
|
|
5098
5175
|
}
|
|
5099
5176
|
}, rest);
|
|
5100
|
-
return
|
|
5177
|
+
return component;
|
|
5101
5178
|
};
|
|
5102
5179
|
|
|
5103
5180
|
// src/domain/mappers/schema/integerSchemaToComponent.ts
|
|
5104
5181
|
var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
5105
|
-
const {
|
|
5182
|
+
const {
|
|
5183
|
+
schema,
|
|
5184
|
+
localValue,
|
|
5185
|
+
model,
|
|
5186
|
+
required = false,
|
|
5187
|
+
onPersistAsync,
|
|
5188
|
+
onValueChange
|
|
5189
|
+
} = schemaMapperProps;
|
|
5106
5190
|
const { autocompleteHint, validationMessages, default: defaultValue, maximum, minimum } = schema;
|
|
5107
|
-
const { getErrorMessageFunctions, onComponentUpdate, onBehavior
|
|
5191
|
+
const { getErrorMessageFunctions, onComponentUpdate, onBehavior } = mapperProps;
|
|
5108
5192
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
5109
5193
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
5110
5194
|
schemaMapperProps,
|
|
@@ -5155,7 +5239,7 @@ var createFormattedValueComponent = (props, onComponentUpdate) => {
|
|
|
5155
5239
|
schemaOnChange
|
|
5156
5240
|
} = props;
|
|
5157
5241
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
5158
|
-
|
|
5242
|
+
const component = {
|
|
5159
5243
|
type: "formatted-value",
|
|
5160
5244
|
kind: "input",
|
|
5161
5245
|
uid,
|
|
@@ -5173,27 +5257,28 @@ var createFormattedValueComponent = (props, onComponentUpdate) => {
|
|
|
5173
5257
|
tags,
|
|
5174
5258
|
value,
|
|
5175
5259
|
async getSubmittableValue() {
|
|
5176
|
-
return
|
|
5260
|
+
return component.getSubmittableValueSync();
|
|
5177
5261
|
},
|
|
5178
5262
|
getSubmittableValueSync() {
|
|
5179
|
-
return
|
|
5263
|
+
return component.getLocalValue();
|
|
5180
5264
|
},
|
|
5181
5265
|
getSummary() {
|
|
5182
|
-
return summariser(
|
|
5266
|
+
return summariser(component.getLocalValue());
|
|
5183
5267
|
},
|
|
5184
5268
|
getLocalValue() {
|
|
5185
|
-
return
|
|
5269
|
+
return component.value;
|
|
5186
5270
|
},
|
|
5187
5271
|
validate() {
|
|
5188
5272
|
return true;
|
|
5189
5273
|
},
|
|
5190
|
-
|
|
5191
|
-
update(
|
|
5274
|
+
setValue(newValue) {
|
|
5275
|
+
update(component, (draft) => {
|
|
5192
5276
|
draft.value = newValue;
|
|
5193
5277
|
});
|
|
5194
5278
|
void (schemaOnChange == null ? void 0 : schemaOnChange());
|
|
5195
5279
|
}
|
|
5196
5280
|
};
|
|
5281
|
+
return component;
|
|
5197
5282
|
};
|
|
5198
5283
|
|
|
5199
5284
|
// src/domain/mappers/schema/objectSchemaToComponent/objectSchemaToFormattedValueComponent.ts
|
|
@@ -5212,8 +5297,8 @@ var objectSchemaToFormattedValueComponent = (schemaMapperProps, mapperProps) =>
|
|
|
5212
5297
|
};
|
|
5213
5298
|
|
|
5214
5299
|
// src/domain/components/MoneyInputComponent.ts
|
|
5215
|
-
var createMoneyInputComponent = (
|
|
5216
|
-
const _a =
|
|
5300
|
+
var createMoneyInputComponent = (props, onComponentUpdate) => {
|
|
5301
|
+
const _a = props, {
|
|
5217
5302
|
id,
|
|
5218
5303
|
uid,
|
|
5219
5304
|
schemaId,
|
|
@@ -5254,7 +5339,7 @@ var createMoneyInputComponent = (moneyInputProps, onComponentUpdate) => {
|
|
|
5254
5339
|
]);
|
|
5255
5340
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
5256
5341
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
5257
|
-
const
|
|
5342
|
+
const component = __spreadValues({
|
|
5258
5343
|
type: "money-input",
|
|
5259
5344
|
kind: "input",
|
|
5260
5345
|
id,
|
|
@@ -5273,9 +5358,6 @@ var createMoneyInputComponent = (moneyInputProps, onComponentUpdate) => {
|
|
|
5273
5358
|
[amountKey]: amountComponent.getLocalValue(),
|
|
5274
5359
|
[currencyKey]: currencyComponent.getLocalValue()
|
|
5275
5360
|
},
|
|
5276
|
-
_update(updateFn) {
|
|
5277
|
-
update(this, updateFn);
|
|
5278
|
-
},
|
|
5279
5361
|
components: {
|
|
5280
5362
|
amount: amountComponent,
|
|
5281
5363
|
currency: currencyComponent
|
|
@@ -5299,11 +5381,11 @@ var createMoneyInputComponent = (moneyInputProps, onComponentUpdate) => {
|
|
|
5299
5381
|
}, extraValues);
|
|
5300
5382
|
},
|
|
5301
5383
|
getSummary() {
|
|
5302
|
-
return summariser(
|
|
5384
|
+
return summariser(component.getLocalValue());
|
|
5303
5385
|
},
|
|
5304
5386
|
validate() {
|
|
5305
5387
|
const errors = getValidationErrors(amountComponent.getLocalValue());
|
|
5306
|
-
|
|
5388
|
+
update(component, (draft) => {
|
|
5307
5389
|
draft.errors = errors;
|
|
5308
5390
|
});
|
|
5309
5391
|
return amountComponent.validate() && currencyComponent.validate() && errors.length === 0;
|
|
@@ -5314,11 +5396,11 @@ var createMoneyInputComponent = (moneyInputProps, onComponentUpdate) => {
|
|
|
5314
5396
|
onFocus() {
|
|
5315
5397
|
}
|
|
5316
5398
|
}, rest);
|
|
5317
|
-
return
|
|
5399
|
+
return component;
|
|
5318
5400
|
};
|
|
5319
5401
|
|
|
5320
5402
|
// src/domain/components/ObjectComponent.ts
|
|
5321
|
-
var createObjectComponent = (
|
|
5403
|
+
var createObjectComponent = (props) => {
|
|
5322
5404
|
const {
|
|
5323
5405
|
uid,
|
|
5324
5406
|
schemaId,
|
|
@@ -5334,8 +5416,8 @@ var createObjectComponent = (objectProps) => {
|
|
|
5334
5416
|
summariser,
|
|
5335
5417
|
title,
|
|
5336
5418
|
tags
|
|
5337
|
-
} =
|
|
5338
|
-
|
|
5419
|
+
} = props;
|
|
5420
|
+
const component = {
|
|
5339
5421
|
type: "object",
|
|
5340
5422
|
kind: "input",
|
|
5341
5423
|
uid,
|
|
@@ -5351,12 +5433,12 @@ var createObjectComponent = (objectProps) => {
|
|
|
5351
5433
|
title,
|
|
5352
5434
|
tags,
|
|
5353
5435
|
getChildren() {
|
|
5354
|
-
return displayOrder.map((propName) =>
|
|
5436
|
+
return displayOrder.map((propName) => component.componentMap[propName]);
|
|
5355
5437
|
},
|
|
5356
5438
|
async getSubmittableValue() {
|
|
5357
5439
|
return Promise.all(
|
|
5358
5440
|
displayOrder.map(
|
|
5359
|
-
async (propName) =>
|
|
5441
|
+
async (propName) => component.componentMap[propName].getSubmittableValue().then((value) => ({ value, propName }))
|
|
5360
5442
|
)
|
|
5361
5443
|
).then(
|
|
5362
5444
|
(values) => values.reduce(
|
|
@@ -5368,24 +5450,25 @@ var createObjectComponent = (objectProps) => {
|
|
|
5368
5450
|
getSubmittableValueSync() {
|
|
5369
5451
|
return mergeChildrenValues(
|
|
5370
5452
|
displayOrder,
|
|
5371
|
-
(propName) =>
|
|
5453
|
+
(propName) => component.componentMap[propName].getSubmittableValueSync()
|
|
5372
5454
|
);
|
|
5373
5455
|
},
|
|
5374
5456
|
getSummary() {
|
|
5375
|
-
const summary = summariser(
|
|
5376
|
-
const childSummary = summariseFromChildren(
|
|
5457
|
+
const summary = summariser(component.getLocalValue());
|
|
5458
|
+
const childSummary = summariseFromChildren(component.getChildren());
|
|
5377
5459
|
return mergeSummaries(summary, childSummary);
|
|
5378
5460
|
},
|
|
5379
5461
|
getLocalValue() {
|
|
5380
5462
|
return mergeChildrenValues(
|
|
5381
5463
|
displayOrder,
|
|
5382
|
-
(propName) =>
|
|
5464
|
+
(propName) => component.componentMap[propName].getLocalValue()
|
|
5383
5465
|
);
|
|
5384
5466
|
},
|
|
5385
5467
|
validate() {
|
|
5386
|
-
return hidden ? true : validateComponents(
|
|
5468
|
+
return hidden ? true : validateComponents(component.getChildren());
|
|
5387
5469
|
}
|
|
5388
5470
|
};
|
|
5471
|
+
return component;
|
|
5389
5472
|
};
|
|
5390
5473
|
var mergeChildrenValues = (displayOrder, getComponentValue) => displayOrder.reduce((acc, propName) => {
|
|
5391
5474
|
const componentValue = getComponentValue(propName);
|
|
@@ -5427,7 +5510,7 @@ var objectSchemaToObjectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5427
5510
|
}));
|
|
5428
5511
|
};
|
|
5429
5512
|
var createComponentMap = (schemaMapperProps, mapperProps, uidPrefix) => {
|
|
5430
|
-
const { uid, localValue, schema, model, validationErrors } = schemaMapperProps;
|
|
5513
|
+
const { uid, localValue, schema, model, validationErrors, onValueChange } = schemaMapperProps;
|
|
5431
5514
|
const { $id, displayOrder, properties, required } = schema;
|
|
5432
5515
|
const initialReducerValue = {};
|
|
5433
5516
|
return displayOrder.reduce((acc, propName) => {
|
|
@@ -5444,7 +5527,8 @@ var createComponentMap = (schemaMapperProps, mapperProps, uidPrefix) => {
|
|
|
5444
5527
|
model: isObjectModel(model) ? model[propName] : null,
|
|
5445
5528
|
localValue: isObjectLocalValue(localValue) ? localValue[propName] : null,
|
|
5446
5529
|
required: (_a = required == null ? void 0 : required.includes(propName)) != null ? _a : false,
|
|
5447
|
-
validationErrors: isObject(validationErrors) ? validationErrors[propName] : void 0
|
|
5530
|
+
validationErrors: isObject(validationErrors) ? validationErrors[propName] : void 0,
|
|
5531
|
+
onValueChange
|
|
5448
5532
|
},
|
|
5449
5533
|
mapperProps
|
|
5450
5534
|
)
|
|
@@ -5571,8 +5655,8 @@ var isPartialModelMatch = (localModel, incomingModel) => {
|
|
|
5571
5655
|
var nonNullishKeys = (model) => Object.keys(model).filter((key) => !isNullish(model[key]));
|
|
5572
5656
|
|
|
5573
5657
|
// src/domain/components/SelectInputComponent.ts
|
|
5574
|
-
var createSelectInputComponent = (
|
|
5575
|
-
const _a =
|
|
5658
|
+
var createSelectInputComponent = (props, onComponentUpdate) => {
|
|
5659
|
+
const _a = props, { uid, checks, initialModel, options, schemaOnChange, onValueChange, summariser } = _a, rest = __objRest(_a, ["uid", "checks", "initialModel", "options", "schemaOnChange", "onValueChange", "summariser"]);
|
|
5576
5660
|
const children = options.map((option) => option.component);
|
|
5577
5661
|
const matchingOptions = options.map(
|
|
5578
5662
|
(option) => isPartialModelMatch(option.component.getSubmittableValueSync(), initialModel)
|
|
@@ -5589,54 +5673,51 @@ var createSelectInputComponent = (selectProps, onComponentUpdate) => {
|
|
|
5589
5673
|
selectedIndex,
|
|
5590
5674
|
value: null
|
|
5591
5675
|
}, rest), {
|
|
5592
|
-
_update(updateFn) {
|
|
5593
|
-
update(this, updateFn);
|
|
5594
|
-
},
|
|
5595
5676
|
getChildren() {
|
|
5596
|
-
return
|
|
5677
|
+
return component.children;
|
|
5597
5678
|
},
|
|
5598
5679
|
getSelectedChild() {
|
|
5599
|
-
return
|
|
5680
|
+
return component.selectedIndex !== null ? component.children[component.selectedIndex] : null;
|
|
5600
5681
|
},
|
|
5601
5682
|
async getSubmittableValue() {
|
|
5602
5683
|
var _a2, _b;
|
|
5603
|
-
return (_b = await ((_a2 =
|
|
5684
|
+
return (_b = await ((_a2 = component.getSelectedChild()) == null ? void 0 : _a2.getSubmittableValue())) != null ? _b : null;
|
|
5604
5685
|
},
|
|
5605
5686
|
getSubmittableValueSync() {
|
|
5606
5687
|
var _a2, _b;
|
|
5607
|
-
return (_b = (_a2 =
|
|
5688
|
+
return (_b = (_a2 = component.getSelectedChild()) == null ? void 0 : _a2.getSubmittableValueSync()) != null ? _b : null;
|
|
5608
5689
|
},
|
|
5609
5690
|
getSummary() {
|
|
5610
5691
|
var _a2, _b;
|
|
5611
|
-
return (_b = (_a2 =
|
|
5692
|
+
return (_b = (_a2 = component.getSelectedChild()) == null ? void 0 : _a2.getSummary()) != null ? _b : {};
|
|
5612
5693
|
},
|
|
5613
5694
|
getLocalValue() {
|
|
5614
5695
|
var _a2, _b;
|
|
5615
|
-
return (_b = (_a2 =
|
|
5696
|
+
return (_b = (_a2 = component.getSelectedChild()) == null ? void 0 : _a2.getLocalValue()) != null ? _b : null;
|
|
5616
5697
|
},
|
|
5617
5698
|
onBlur() {
|
|
5618
|
-
|
|
5699
|
+
component.validate();
|
|
5619
5700
|
},
|
|
5620
5701
|
onFocus() {
|
|
5621
5702
|
},
|
|
5622
5703
|
// noop
|
|
5623
|
-
|
|
5624
|
-
if (updatedIndex ===
|
|
5704
|
+
selectIndex(updatedIndex) {
|
|
5705
|
+
if (updatedIndex === component.selectedIndex) {
|
|
5625
5706
|
return;
|
|
5626
5707
|
}
|
|
5627
5708
|
if (updatedIndex !== null) {
|
|
5628
|
-
|
|
5629
|
-
schema:
|
|
5630
|
-
selectedOption:
|
|
5709
|
+
props.trackEvent("OneOf Option Selected", {
|
|
5710
|
+
schema: component.analyticsId,
|
|
5711
|
+
selectedOption: component.children[updatedIndex].analyticsId
|
|
5631
5712
|
});
|
|
5632
|
-
if (
|
|
5633
|
-
|
|
5634
|
-
oneOfId:
|
|
5635
|
-
schemaId:
|
|
5713
|
+
if (component.analyticsId) {
|
|
5714
|
+
props.trackEvent("OneOf Selected", {
|
|
5715
|
+
oneOfId: component.analyticsId,
|
|
5716
|
+
schemaId: component.children[updatedIndex].analyticsId
|
|
5636
5717
|
});
|
|
5637
5718
|
}
|
|
5638
5719
|
}
|
|
5639
|
-
|
|
5720
|
+
update(component, (draft) => {
|
|
5640
5721
|
draft.errors = [];
|
|
5641
5722
|
draft.selectedIndex = updatedIndex;
|
|
5642
5723
|
});
|
|
@@ -5645,9 +5726,9 @@ var createSelectInputComponent = (selectProps, onComponentUpdate) => {
|
|
|
5645
5726
|
},
|
|
5646
5727
|
validate() {
|
|
5647
5728
|
var _a2, _b;
|
|
5648
|
-
const validChild = (_b = (_a2 =
|
|
5649
|
-
const errors = getValidationErrors(
|
|
5650
|
-
|
|
5729
|
+
const validChild = (_b = (_a2 = component.getSelectedChild()) == null ? void 0 : _a2.validate()) != null ? _b : true;
|
|
5730
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
5731
|
+
update(component, (draft) => {
|
|
5651
5732
|
draft.errors = errors;
|
|
5652
5733
|
});
|
|
5653
5734
|
return errors.length === 0 && validChild;
|
|
@@ -5665,7 +5746,8 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5665
5746
|
schema,
|
|
5666
5747
|
model,
|
|
5667
5748
|
validationErrors: initialError,
|
|
5668
|
-
required = false
|
|
5749
|
+
required = false,
|
|
5750
|
+
onValueChange
|
|
5669
5751
|
} = schemaMapperProps;
|
|
5670
5752
|
const initialModel = (_a = model != null ? model : schema.default) != null ? _a : null;
|
|
5671
5753
|
const options = schema.oneOf.map((childSchema, index) => {
|
|
@@ -5700,13 +5782,14 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5700
5782
|
model: initialModel,
|
|
5701
5783
|
localValue,
|
|
5702
5784
|
validationErrors: initialError,
|
|
5703
|
-
required
|
|
5785
|
+
required,
|
|
5786
|
+
onValueChange
|
|
5704
5787
|
},
|
|
5705
5788
|
mapperProps
|
|
5706
5789
|
)
|
|
5707
5790
|
};
|
|
5708
5791
|
});
|
|
5709
|
-
const { getErrorMessageFunctions, onComponentUpdate, trackEvent, onBehavior
|
|
5792
|
+
const { getErrorMessageFunctions, onComponentUpdate, trackEvent, onBehavior } = mapperProps;
|
|
5710
5793
|
const { validationMessages } = schema;
|
|
5711
5794
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
5712
5795
|
return createSelectInputComponent(
|
|
@@ -5743,15 +5826,24 @@ var isExactLocalValueMatch = (valueA, valueB) => {
|
|
|
5743
5826
|
|
|
5744
5827
|
// src/domain/components/PersistAsyncComponent.ts
|
|
5745
5828
|
var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, onComponentUpdate) => {
|
|
5746
|
-
const {
|
|
5829
|
+
const {
|
|
5830
|
+
uid,
|
|
5831
|
+
analyticsId,
|
|
5832
|
+
schemaId,
|
|
5833
|
+
component: childComponent,
|
|
5834
|
+
hidden,
|
|
5835
|
+
model,
|
|
5836
|
+
localValue,
|
|
5837
|
+
tags
|
|
5838
|
+
} = props;
|
|
5747
5839
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
5748
|
-
const
|
|
5840
|
+
const component = {
|
|
5749
5841
|
type: "persist-async",
|
|
5750
5842
|
kind: "input",
|
|
5751
5843
|
uid,
|
|
5752
5844
|
analyticsId,
|
|
5753
5845
|
schemaId,
|
|
5754
|
-
component,
|
|
5846
|
+
component: childComponent,
|
|
5755
5847
|
hidden,
|
|
5756
5848
|
status: "idle",
|
|
5757
5849
|
lastSubmitted: model != null ? localValue != null ? localValue : null : null,
|
|
@@ -5760,33 +5852,30 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, o
|
|
|
5760
5852
|
abortController: new AbortController(),
|
|
5761
5853
|
errors: [],
|
|
5762
5854
|
tags,
|
|
5763
|
-
_update(updateFn) {
|
|
5764
|
-
update(this, updateFn);
|
|
5765
|
-
},
|
|
5766
5855
|
validate() {
|
|
5767
|
-
return
|
|
5856
|
+
return component.component.validate();
|
|
5768
5857
|
},
|
|
5769
5858
|
getLocalValue() {
|
|
5770
|
-
return
|
|
5859
|
+
return component.component.getLocalValue();
|
|
5771
5860
|
},
|
|
5772
5861
|
async getSubmittableValue() {
|
|
5773
|
-
return
|
|
5862
|
+
return component.persist();
|
|
5774
5863
|
},
|
|
5775
5864
|
getSubmittableValueSync() {
|
|
5776
|
-
return
|
|
5865
|
+
return component.lastResponse;
|
|
5777
5866
|
},
|
|
5778
5867
|
getSummary() {
|
|
5779
|
-
return
|
|
5868
|
+
return component.component.getSummary();
|
|
5780
5869
|
},
|
|
5781
5870
|
async persist() {
|
|
5782
|
-
const childLocalValue =
|
|
5783
|
-
if (isExactLocalValueMatch(childLocalValue,
|
|
5784
|
-
return
|
|
5871
|
+
const childLocalValue = component.component.getLocalValue();
|
|
5872
|
+
if (isExactLocalValueMatch(childLocalValue, component.lastSubmitted)) {
|
|
5873
|
+
return component.submission;
|
|
5785
5874
|
}
|
|
5786
|
-
const newAbortController = abortAndResetController(
|
|
5875
|
+
const newAbortController = abortAndResetController(component.abortController);
|
|
5787
5876
|
if (childLocalValue == null || childLocalValue === "") {
|
|
5788
5877
|
const resolvedNull = Promise.resolve(null);
|
|
5789
|
-
|
|
5878
|
+
update(component, (draft) => {
|
|
5790
5879
|
draft.abortController = newAbortController;
|
|
5791
5880
|
draft.lastResponse = null;
|
|
5792
5881
|
draft.lastSubmitted = childLocalValue;
|
|
@@ -5799,7 +5888,7 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, o
|
|
|
5799
5888
|
}
|
|
5800
5889
|
const { signal } = newAbortController;
|
|
5801
5890
|
const newSubmission = performPersistAsync({ value: childLocalValue, signal }).then((token) => {
|
|
5802
|
-
|
|
5891
|
+
update(component, (draft) => {
|
|
5803
5892
|
draft.lastResponse = token;
|
|
5804
5893
|
draft.errors = [];
|
|
5805
5894
|
draft.status = "success";
|
|
@@ -5810,18 +5899,18 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, o
|
|
|
5810
5899
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
5811
5900
|
return null;
|
|
5812
5901
|
}
|
|
5813
|
-
|
|
5902
|
+
update(component, (draft) => {
|
|
5814
5903
|
draft.lastResponse = null;
|
|
5815
5904
|
draft.lastSubmitted = null;
|
|
5816
5905
|
draft.submission = Promise.resolve(null);
|
|
5817
5906
|
draft.status = "error";
|
|
5818
|
-
if (
|
|
5907
|
+
if (component.component.type !== "upload") {
|
|
5819
5908
|
draft.errors = error instanceof Error ? [error.message] : [];
|
|
5820
5909
|
}
|
|
5821
5910
|
});
|
|
5822
5911
|
throw error;
|
|
5823
5912
|
});
|
|
5824
|
-
|
|
5913
|
+
update(component, (draft) => {
|
|
5825
5914
|
draft.abortController = newAbortController;
|
|
5826
5915
|
draft.lastSubmitted = childLocalValue;
|
|
5827
5916
|
draft.lastResponse = null;
|
|
@@ -5832,7 +5921,7 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, o
|
|
|
5832
5921
|
return newSubmission;
|
|
5833
5922
|
}
|
|
5834
5923
|
};
|
|
5835
|
-
return
|
|
5924
|
+
return component;
|
|
5836
5925
|
};
|
|
5837
5926
|
|
|
5838
5927
|
// src/domain/mappers/schema/persistAsyncSchemaToComponent.ts
|
|
@@ -5871,8 +5960,8 @@ var persistAsyncSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5871
5960
|
};
|
|
5872
5961
|
|
|
5873
5962
|
// src/domain/components/DateInputComponent.ts
|
|
5874
|
-
var createDateInputComponent = (
|
|
5875
|
-
const _a =
|
|
5963
|
+
var createDateInputComponent = (props, onComponentUpdate) => {
|
|
5964
|
+
const _a = props, {
|
|
5876
5965
|
uid,
|
|
5877
5966
|
id,
|
|
5878
5967
|
checks,
|
|
@@ -5896,28 +5985,25 @@ var createDateInputComponent = (textInputProps, onComponentUpdate) => {
|
|
|
5896
5985
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
5897
5986
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
5898
5987
|
const validateAsync = performValidationAsync ? getComponentValidationAsync(update, performValidationAsync) : void 0;
|
|
5899
|
-
const
|
|
5988
|
+
const component = __spreadValues({
|
|
5900
5989
|
type: "date",
|
|
5901
5990
|
kind: "input",
|
|
5902
5991
|
uid,
|
|
5903
5992
|
id,
|
|
5904
5993
|
value,
|
|
5905
|
-
_update(updateFn) {
|
|
5906
|
-
update(this, updateFn);
|
|
5907
|
-
},
|
|
5908
5994
|
onBlur() {
|
|
5909
|
-
const isValid =
|
|
5995
|
+
const isValid = component.validate();
|
|
5910
5996
|
if (isValid) {
|
|
5911
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
5997
|
+
validateAsync == null ? void 0 : validateAsync(component, component.getLocalValue()).catch(() => {
|
|
5912
5998
|
});
|
|
5913
5999
|
}
|
|
5914
6000
|
},
|
|
5915
6001
|
onFocus() {
|
|
5916
6002
|
},
|
|
5917
6003
|
// Noop
|
|
5918
|
-
|
|
5919
|
-
const prevValue =
|
|
5920
|
-
|
|
6004
|
+
setValue(updatedValue) {
|
|
6005
|
+
const prevValue = component.value;
|
|
6006
|
+
update(component, (draft) => {
|
|
5921
6007
|
draft.errors = [];
|
|
5922
6008
|
draft.validationAsyncState.messages = {};
|
|
5923
6009
|
draft.value = updatedValue;
|
|
@@ -5932,29 +6018,29 @@ var createDateInputComponent = (textInputProps, onComponentUpdate) => {
|
|
|
5932
6018
|
}
|
|
5933
6019
|
},
|
|
5934
6020
|
async getSubmittableValue() {
|
|
5935
|
-
return
|
|
6021
|
+
return component.getSubmittableValueSync();
|
|
5936
6022
|
},
|
|
5937
6023
|
getSubmittableValueSync() {
|
|
5938
|
-
if (isValidDate(
|
|
5939
|
-
return
|
|
6024
|
+
if (isValidDate(component.getLocalValue())) {
|
|
6025
|
+
return component.getLocalValue();
|
|
5940
6026
|
}
|
|
5941
6027
|
return null;
|
|
5942
6028
|
},
|
|
5943
6029
|
getSummary() {
|
|
5944
|
-
return summariser(
|
|
6030
|
+
return summariser(component.getLocalValue());
|
|
5945
6031
|
},
|
|
5946
6032
|
getLocalValue() {
|
|
5947
|
-
return
|
|
6033
|
+
return component.value;
|
|
5948
6034
|
},
|
|
5949
6035
|
validate() {
|
|
5950
|
-
const errors = getValidationErrors(
|
|
5951
|
-
|
|
6036
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
6037
|
+
update(component, (draft) => {
|
|
5952
6038
|
draft.errors = errors;
|
|
5953
6039
|
});
|
|
5954
6040
|
return errors.length === 0;
|
|
5955
6041
|
}
|
|
5956
6042
|
}, rest);
|
|
5957
|
-
return
|
|
6043
|
+
return component;
|
|
5958
6044
|
};
|
|
5959
6045
|
|
|
5960
6046
|
// src/domain/mappers/utils/suggestions-utils.ts
|
|
@@ -5981,7 +6067,14 @@ var mapStringSchemaSuggestions = (suggestions, logEvent) => {
|
|
|
5981
6067
|
// src/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.ts
|
|
5982
6068
|
var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
5983
6069
|
var _a;
|
|
5984
|
-
const {
|
|
6070
|
+
const {
|
|
6071
|
+
schema,
|
|
6072
|
+
localValue,
|
|
6073
|
+
model,
|
|
6074
|
+
required = false,
|
|
6075
|
+
onPersistAsync,
|
|
6076
|
+
onValueChange
|
|
6077
|
+
} = schemaMapperProps;
|
|
5985
6078
|
const {
|
|
5986
6079
|
autocompleteHint,
|
|
5987
6080
|
default: defaultValue,
|
|
@@ -5989,7 +6082,7 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5989
6082
|
maximum: maximumDate,
|
|
5990
6083
|
suggestions
|
|
5991
6084
|
} = schema;
|
|
5992
|
-
const { getErrorMessageFunctions, onComponentUpdate, onBehavior
|
|
6085
|
+
const { getErrorMessageFunctions, onComponentUpdate, onBehavior } = mapperProps;
|
|
5993
6086
|
const errorMessageFunctions = getErrorMessageFunctions(schema.validationMessages);
|
|
5994
6087
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
5995
6088
|
schemaMapperProps,
|
|
@@ -6002,7 +6095,7 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6002
6095
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
6003
6096
|
autoComplete: getAutocompleteString(autocompleteHint),
|
|
6004
6097
|
checks: schema.hidden ? [] : [
|
|
6005
|
-
|
|
6098
|
+
getStringRequiredCheck(required, errorMessageFunctions),
|
|
6006
6099
|
getValidDateCheck(required, errorMessageFunctions),
|
|
6007
6100
|
getAboveMaximumDateCheck(schema, errorMessageFunctions),
|
|
6008
6101
|
getBelowMinimumDateCheck(schema, errorMessageFunctions)
|
|
@@ -6038,9 +6131,9 @@ var getValidDate = (model) => {
|
|
|
6038
6131
|
// src/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.ts
|
|
6039
6132
|
var stringSchemaToUploadInputComponent = (schemaMapperProps, mapperProps) => {
|
|
6040
6133
|
var _a;
|
|
6041
|
-
const { schema, localValue, model, required = false } = schemaMapperProps;
|
|
6134
|
+
const { schema, localValue, model, required = false, onValueChange } = schemaMapperProps;
|
|
6042
6135
|
const { accepts, autocompleteHint, cameraConfig, hidden, maxSize, source, validationMessages } = schema;
|
|
6043
|
-
const { getErrorMessageFunctions, onComponentUpdate, onBehavior
|
|
6136
|
+
const { getErrorMessageFunctions, onComponentUpdate, onBehavior } = mapperProps;
|
|
6044
6137
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
6045
6138
|
const validLocalValue = isFile(localValue) ? localValue : null;
|
|
6046
6139
|
const value = (_a = getFileFromModel(model)) != null ? _a : validLocalValue;
|
|
@@ -6068,8 +6161,8 @@ var stringSchemaToUploadInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6068
6161
|
var getFileFromModel = (model) => isString(model) ? base64dataUrltoFile(model, "") : null;
|
|
6069
6162
|
|
|
6070
6163
|
// src/domain/components/TextInputComponent.ts
|
|
6071
|
-
var createTextInputComponent = (
|
|
6072
|
-
const _a =
|
|
6164
|
+
var createTextInputComponent = (props, onComponentUpdate) => {
|
|
6165
|
+
const _a = props, {
|
|
6073
6166
|
uid,
|
|
6074
6167
|
id,
|
|
6075
6168
|
checks,
|
|
@@ -6091,33 +6184,32 @@ var createTextInputComponent = (textInputProps, onComponentUpdate) => {
|
|
|
6091
6184
|
"value"
|
|
6092
6185
|
]);
|
|
6093
6186
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
6187
|
+
const onValueChangeDebounced = debounce(onValueChange, 1e3);
|
|
6094
6188
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
6095
6189
|
const performOnChange = getDebouncedSchemaOnChange(schemaOnChange, getValidationErrors);
|
|
6096
6190
|
const validateAsync = performValidationAsync ? getDebouncedComponentValidationAsync(update, performValidationAsync) : void 0;
|
|
6097
|
-
const
|
|
6191
|
+
const component = __spreadValues({
|
|
6098
6192
|
type: "text",
|
|
6099
6193
|
kind: "input",
|
|
6100
6194
|
uid,
|
|
6101
6195
|
id,
|
|
6102
6196
|
value,
|
|
6103
|
-
_update(updateFn) {
|
|
6104
|
-
update(this, updateFn);
|
|
6105
|
-
},
|
|
6106
6197
|
onBlur() {
|
|
6107
|
-
const isValid =
|
|
6198
|
+
const isValid = component.validate();
|
|
6108
6199
|
performOnChange == null ? void 0 : performOnChange.flush();
|
|
6109
6200
|
if (isValid) {
|
|
6110
6201
|
void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
|
|
6111
6202
|
}));
|
|
6112
6203
|
validateAsync == null ? void 0 : validateAsync.flush();
|
|
6113
6204
|
}
|
|
6205
|
+
onValueChangeDebounced.flush();
|
|
6114
6206
|
},
|
|
6115
6207
|
onFocus() {
|
|
6116
6208
|
},
|
|
6117
6209
|
// Noop
|
|
6118
|
-
|
|
6119
|
-
const prevValue =
|
|
6120
|
-
|
|
6210
|
+
setValue(updatedValue) {
|
|
6211
|
+
const prevValue = component.value;
|
|
6212
|
+
update(component, (draft) => {
|
|
6121
6213
|
draft.errors = [];
|
|
6122
6214
|
draft.validationAsyncState.messages = {};
|
|
6123
6215
|
draft.value = updatedValue;
|
|
@@ -6125,39 +6217,46 @@ var createTextInputComponent = (textInputProps, onComponentUpdate) => {
|
|
|
6125
6217
|
performOnChange == null ? void 0 : performOnChange(prevValue, updatedValue);
|
|
6126
6218
|
const isValid = getValidationErrors(updatedValue).length === 0;
|
|
6127
6219
|
if (isValid) {
|
|
6128
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
6220
|
+
validateAsync == null ? void 0 : validateAsync(component, updatedValue);
|
|
6129
6221
|
}
|
|
6130
6222
|
if (!updatedValue) {
|
|
6131
6223
|
validateAsync == null ? void 0 : validateAsync.cancel();
|
|
6132
6224
|
}
|
|
6133
|
-
|
|
6225
|
+
onValueChangeDebounced();
|
|
6134
6226
|
},
|
|
6135
6227
|
async getSubmittableValue() {
|
|
6136
|
-
return
|
|
6228
|
+
return component.getSubmittableValueSync();
|
|
6137
6229
|
},
|
|
6138
6230
|
getSubmittableValueSync() {
|
|
6139
|
-
return
|
|
6231
|
+
return component.getLocalValue() || null;
|
|
6140
6232
|
},
|
|
6141
6233
|
getSummary() {
|
|
6142
|
-
return summariser(
|
|
6234
|
+
return summariser(component.getLocalValue());
|
|
6143
6235
|
},
|
|
6144
6236
|
getLocalValue() {
|
|
6145
|
-
return
|
|
6237
|
+
return component.value;
|
|
6146
6238
|
},
|
|
6147
6239
|
validate() {
|
|
6148
|
-
const errors = getValidationErrors(
|
|
6149
|
-
|
|
6240
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
6241
|
+
update(component, (draft) => {
|
|
6150
6242
|
draft.errors = errors;
|
|
6151
6243
|
});
|
|
6152
6244
|
return errors.length === 0;
|
|
6153
6245
|
}
|
|
6154
6246
|
}, rest);
|
|
6155
|
-
return
|
|
6247
|
+
return component;
|
|
6156
6248
|
};
|
|
6157
6249
|
|
|
6158
6250
|
// src/domain/mappers/schema/stringSchemaToComponent/stringSchemaToTextInputComponent.ts
|
|
6159
6251
|
var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
6160
|
-
const {
|
|
6252
|
+
const {
|
|
6253
|
+
schema,
|
|
6254
|
+
localValue,
|
|
6255
|
+
model,
|
|
6256
|
+
required = false,
|
|
6257
|
+
onPersistAsync,
|
|
6258
|
+
onValueChange
|
|
6259
|
+
} = schemaMapperProps;
|
|
6161
6260
|
const {
|
|
6162
6261
|
autocapitalization,
|
|
6163
6262
|
autocompleteHint,
|
|
@@ -6171,7 +6270,7 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6171
6270
|
suggestions,
|
|
6172
6271
|
validationMessages
|
|
6173
6272
|
} = schema;
|
|
6174
|
-
const { getErrorMessageFunctions, onComponentUpdate, onBehavior,
|
|
6273
|
+
const { getErrorMessageFunctions, onComponentUpdate, onBehavior, logEvent } = mapperProps;
|
|
6175
6274
|
const controlForLegacyFormat = getControlForLegacyFormat(format);
|
|
6176
6275
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
6177
6276
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
@@ -6186,7 +6285,7 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6186
6285
|
autocapitalization,
|
|
6187
6286
|
autoComplete: getAutocompleteString(autocompleteHint),
|
|
6188
6287
|
checks: schema.hidden ? [] : [
|
|
6189
|
-
|
|
6288
|
+
getStringRequiredCheck(required, errorMessageFunctions),
|
|
6190
6289
|
getAboveMaxLengthCheck(schema, errorMessageFunctions),
|
|
6191
6290
|
getBelowMinLengthCheck(schema, errorMessageFunctions),
|
|
6192
6291
|
getNotAdheringToPatternCheck(schema, errorMessageFunctions, { logEvent })
|
|
@@ -6285,6 +6384,8 @@ var mapSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6285
6384
|
};
|
|
6286
6385
|
|
|
6287
6386
|
// src/domain/mappers/mapStepSchemas.ts
|
|
6387
|
+
var noop2 = () => {
|
|
6388
|
+
};
|
|
6288
6389
|
var mapStepSchemas = (uid, step, stepLocalValue, mapperProps) => {
|
|
6289
6390
|
return step.schemas.map(
|
|
6290
6391
|
(schema, i) => {
|
|
@@ -6297,7 +6398,8 @@ var mapStepSchemas = (uid, step, stepLocalValue, mapperProps) => {
|
|
|
6297
6398
|
model: (_a = step.model) != null ? _a : null,
|
|
6298
6399
|
localValue: stepLocalValue,
|
|
6299
6400
|
validationErrors: (_b = step.errors) == null ? void 0 : _b.validation,
|
|
6300
|
-
required: true
|
|
6401
|
+
required: true,
|
|
6402
|
+
onValueChange: noop2
|
|
6301
6403
|
},
|
|
6302
6404
|
mapperProps
|
|
6303
6405
|
);
|
|
@@ -6476,8 +6578,10 @@ var mapStepToComponent = (_a) => {
|
|
|
6476
6578
|
stepPrefetch,
|
|
6477
6579
|
step,
|
|
6478
6580
|
referencedSchemaIds,
|
|
6581
|
+
features,
|
|
6479
6582
|
onComponentUpdate,
|
|
6480
6583
|
trackEvent,
|
|
6584
|
+
logEvent,
|
|
6481
6585
|
onBehavior,
|
|
6482
6586
|
onLoad: stepOnLoad
|
|
6483
6587
|
});
|
|
@@ -6493,7 +6597,7 @@ var getReferencedSchemaId = (step) => {
|
|
|
6493
6597
|
var mapBackNavigation = (navigation, onBehavior, isNativeBackEnabled) => {
|
|
6494
6598
|
var _a;
|
|
6495
6599
|
const backNavigation = (_a = navigation == null ? void 0 : navigation.back) != null ? _a : navigation == null ? void 0 : navigation.backButton;
|
|
6496
|
-
const backBehavior = { type: "back", action: backNavigation == null ? void 0 : backNavigation.action };
|
|
6600
|
+
const backBehavior = { type: "back", action: backNavigation == null ? void 0 : backNavigation.action, track: false };
|
|
6497
6601
|
return backNavigation || isNativeBackEnabled ? {
|
|
6498
6602
|
title: backNavigation == null ? void 0 : backNavigation.title,
|
|
6499
6603
|
onClick: () => {
|
|
@@ -6709,10 +6813,10 @@ var executePoll = async (props) => {
|
|
|
6709
6813
|
}
|
|
6710
6814
|
case "modal": {
|
|
6711
6815
|
assertModalResponseBody(body);
|
|
6712
|
-
return { type: "behavior", behavior: __spreadValues({ type: "modal" }, body) };
|
|
6816
|
+
return { type: "behavior", behavior: __spreadProps(__spreadValues({ type: "modal" }, body), { track: false }) };
|
|
6713
6817
|
}
|
|
6714
6818
|
case "no-op": {
|
|
6715
|
-
return { type: "behavior", behavior: { type: "none" } };
|
|
6819
|
+
return { type: "behavior", behavior: { type: "none", track: false } };
|
|
6716
6820
|
}
|
|
6717
6821
|
case "subflow": {
|
|
6718
6822
|
assertSubflowResponseBody(body);
|
|
@@ -6737,7 +6841,8 @@ var executePoll = async (props) => {
|
|
|
6737
6841
|
};
|
|
6738
6842
|
var actionResponseBodyToBehavior = (body) => ({
|
|
6739
6843
|
type: "non-merging-action",
|
|
6740
|
-
action: body.action
|
|
6844
|
+
action: body.action,
|
|
6845
|
+
track: false
|
|
6741
6846
|
});
|
|
6742
6847
|
|
|
6743
6848
|
// src/controller/executeRefresh.ts
|
|
@@ -6792,36 +6897,30 @@ var executeRefresh = async (props) => {
|
|
|
6792
6897
|
};
|
|
6793
6898
|
|
|
6794
6899
|
// src/domain/components/SubflowComponent.ts
|
|
6795
|
-
var createSubflowComponent = (
|
|
6796
|
-
switch (
|
|
6900
|
+
var createSubflowComponent = (props, onComponentUpdate) => {
|
|
6901
|
+
switch (props.subflowType) {
|
|
6797
6902
|
case "dynamic":
|
|
6798
|
-
return createDynamicSubflowComponent(
|
|
6903
|
+
return createDynamicSubflowComponent(props, onComponentUpdate);
|
|
6799
6904
|
case "native":
|
|
6800
|
-
return createNativeSubflowComponent(
|
|
6905
|
+
return createNativeSubflowComponent(props);
|
|
6801
6906
|
}
|
|
6802
6907
|
};
|
|
6803
|
-
var createDynamicSubflowComponent = (
|
|
6908
|
+
var createDynamicSubflowComponent = (props, onComponentUpdate) => {
|
|
6804
6909
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
6805
|
-
|
|
6910
|
+
return __spreadValues({
|
|
6806
6911
|
uid: `subflow-dynamic-${getRandomId()}`,
|
|
6807
6912
|
type: "subflow",
|
|
6808
6913
|
subflowType: "dynamic",
|
|
6809
6914
|
kind: "layout"
|
|
6810
|
-
},
|
|
6811
|
-
_update(updateFn) {
|
|
6812
|
-
update(this, updateFn);
|
|
6813
|
-
}
|
|
6814
|
-
});
|
|
6815
|
-
return subflowComponent;
|
|
6915
|
+
}, props);
|
|
6816
6916
|
};
|
|
6817
|
-
var createNativeSubflowComponent = (
|
|
6818
|
-
|
|
6917
|
+
var createNativeSubflowComponent = (props) => {
|
|
6918
|
+
return __spreadValues({
|
|
6819
6919
|
uid: `subflow-native-${getRandomId()}`,
|
|
6820
6920
|
type: "subflow",
|
|
6821
6921
|
subflowType: "native",
|
|
6822
6922
|
kind: "layout"
|
|
6823
|
-
},
|
|
6824
|
-
return subflowComponent;
|
|
6923
|
+
}, props);
|
|
6825
6924
|
};
|
|
6826
6925
|
|
|
6827
6926
|
// src/controller/executeSubflow.ts
|
|
@@ -6969,8 +7068,7 @@ var createFlowController = (props) => {
|
|
|
6969
7068
|
onNotification,
|
|
6970
7069
|
onError,
|
|
6971
7070
|
onEvent,
|
|
6972
|
-
onLog
|
|
6973
|
-
onValueChange
|
|
7071
|
+
onLog
|
|
6974
7072
|
} = props;
|
|
6975
7073
|
const httpClient = getHttpClientWithCapabilities(props.httpClient, nativeSubflowHandlers);
|
|
6976
7074
|
const rootComponent = createRootDomainComponent(
|
|
@@ -7011,8 +7109,7 @@ var createFlowController = (props) => {
|
|
|
7011
7109
|
httpClient,
|
|
7012
7110
|
onBehavior,
|
|
7013
7111
|
onLink,
|
|
7014
|
-
onPoll
|
|
7015
|
-
onValueChange
|
|
7112
|
+
onPoll
|
|
7016
7113
|
});
|
|
7017
7114
|
const createStepComponent2 = (newStep, etag, localValue) => {
|
|
7018
7115
|
rootComponent.stop();
|
|
@@ -7075,6 +7172,7 @@ var createFlowController = (props) => {
|
|
|
7075
7172
|
};
|
|
7076
7173
|
const onBehavior = async (behavior) => {
|
|
7077
7174
|
var _a;
|
|
7175
|
+
trackBehaviorTriggered(trackEvent, behavior);
|
|
7078
7176
|
switch (behavior.type) {
|
|
7079
7177
|
case "download": {
|
|
7080
7178
|
try {
|
|
@@ -7335,6 +7433,7 @@ var createFlowController = (props) => {
|
|
|
7335
7433
|
switch (command.type) {
|
|
7336
7434
|
case "replace-step":
|
|
7337
7435
|
createStep(command.step, command.etag);
|
|
7436
|
+
trackCoreEvent("Step Shown", { isFirstStep: false });
|
|
7338
7437
|
return true;
|
|
7339
7438
|
case "behavior":
|
|
7340
7439
|
void onBehavior(command.behavior);
|
|
@@ -7677,6 +7776,28 @@ var formatDateOptions = {
|
|
|
7677
7776
|
dateStyle: "long"
|
|
7678
7777
|
};
|
|
7679
7778
|
|
|
7779
|
+
// src/renderers/mappers/utils/mapCallToAction.ts
|
|
7780
|
+
var mapCallToAction = (_a) => {
|
|
7781
|
+
var _b = _a, {
|
|
7782
|
+
hrefWithTracking
|
|
7783
|
+
} = _b, cta = __objRest(_b, [
|
|
7784
|
+
"hrefWithTracking"
|
|
7785
|
+
]);
|
|
7786
|
+
return __spreadProps(__spreadValues({}, cta), {
|
|
7787
|
+
getAnchorProps: hrefWithTracking
|
|
7788
|
+
});
|
|
7789
|
+
};
|
|
7790
|
+
var mapCallToActionOptional = (cta) => cta ? mapCallToAction(cta) : void 0;
|
|
7791
|
+
var mapAdditionalInfo2 = (info) => {
|
|
7792
|
+
if (info) {
|
|
7793
|
+
const _a = info, { hrefWithTracking } = _a, rest = __objRest(_a, ["hrefWithTracking"]);
|
|
7794
|
+
return __spreadProps(__spreadValues({}, rest), {
|
|
7795
|
+
getAnchorProps: hrefWithTracking
|
|
7796
|
+
});
|
|
7797
|
+
}
|
|
7798
|
+
return void 0;
|
|
7799
|
+
};
|
|
7800
|
+
|
|
7680
7801
|
// src/renderers/mappers/utils/pick.ts
|
|
7681
7802
|
function pick(obj, ...keys) {
|
|
7682
7803
|
const result = {};
|
|
@@ -7687,18 +7808,9 @@ function pick(obj, ...keys) {
|
|
|
7687
7808
|
}
|
|
7688
7809
|
|
|
7689
7810
|
// src/renderers/mappers/alertComponentToProps.ts
|
|
7690
|
-
var alertComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(
|
|
7691
|
-
component
|
|
7692
|
-
|
|
7693
|
-
"analyticsId",
|
|
7694
|
-
"type",
|
|
7695
|
-
"callToAction",
|
|
7696
|
-
"context",
|
|
7697
|
-
"control",
|
|
7698
|
-
"margin",
|
|
7699
|
-
"markdown",
|
|
7700
|
-
"tags"
|
|
7701
|
-
)), rendererMapperProps);
|
|
7811
|
+
var alertComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "context", "control", "margin", "markdown", "tags")), {
|
|
7812
|
+
callToAction: mapCallToActionOptional(component.callToAction)
|
|
7813
|
+
}), rendererMapperProps);
|
|
7702
7814
|
|
|
7703
7815
|
// src/renderers/mappers/allOfComponentToProps.ts
|
|
7704
7816
|
var allOfComponentToProps = (component, rendererMapperProps) => {
|
|
@@ -7750,48 +7862,32 @@ var getValidationState = (errors, validationAsyncState) => {
|
|
|
7750
7862
|
// src/renderers/mappers/utils/inputComponentToProps.ts
|
|
7751
7863
|
var inputComponentToProps = (component, type) => {
|
|
7752
7864
|
var _a;
|
|
7753
|
-
const {
|
|
7754
|
-
uid,
|
|
7755
|
-
analyticsId,
|
|
7756
|
-
control,
|
|
7757
|
-
description,
|
|
7758
|
-
disabled,
|
|
7759
|
-
errors,
|
|
7760
|
-
help,
|
|
7761
|
-
id,
|
|
7762
|
-
media,
|
|
7763
|
-
placeholder,
|
|
7764
|
-
required,
|
|
7765
|
-
title,
|
|
7766
|
-
tags,
|
|
7767
|
-
validationAsyncState,
|
|
7768
|
-
inlineAlert,
|
|
7769
|
-
onBlur,
|
|
7770
|
-
onFocus
|
|
7771
|
-
} = component;
|
|
7865
|
+
const { errors, validationAsyncState } = component;
|
|
7772
7866
|
const { messages } = validationAsyncState != null ? validationAsyncState : {};
|
|
7773
|
-
return {
|
|
7774
|
-
|
|
7775
|
-
|
|
7867
|
+
return __spreadProps(__spreadValues({}, pick(
|
|
7868
|
+
component,
|
|
7869
|
+
"uid",
|
|
7870
|
+
"analyticsId",
|
|
7871
|
+
"control",
|
|
7872
|
+
"description",
|
|
7873
|
+
"disabled",
|
|
7874
|
+
"help",
|
|
7875
|
+
"id",
|
|
7876
|
+
"media",
|
|
7877
|
+
"placeholder",
|
|
7878
|
+
"required",
|
|
7879
|
+
"title",
|
|
7880
|
+
"tags",
|
|
7881
|
+
"inlineAlert",
|
|
7882
|
+
"onBlur",
|
|
7883
|
+
"onFocus"
|
|
7884
|
+
)), {
|
|
7776
7885
|
type,
|
|
7777
|
-
control,
|
|
7778
|
-
description,
|
|
7779
|
-
disabled,
|
|
7780
7886
|
error: (_a = messages == null ? void 0 : messages.error) != null ? _a : errors == null ? void 0 : errors[0],
|
|
7781
|
-
help,
|
|
7782
|
-
id,
|
|
7783
|
-
media,
|
|
7784
|
-
placeholder,
|
|
7785
|
-
required,
|
|
7786
|
-
title,
|
|
7787
|
-
tags,
|
|
7788
7887
|
value: component.getLocalValue(),
|
|
7789
7888
|
validationState: getValidationState(errors, validationAsyncState),
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
onBlur: onBlur.bind(component),
|
|
7793
|
-
onFocus: onFocus.bind(component)
|
|
7794
|
-
};
|
|
7889
|
+
fieldLoadingState: getFieldLoadingState(component)
|
|
7890
|
+
});
|
|
7795
7891
|
};
|
|
7796
7892
|
var getFieldLoadingState = (component) => {
|
|
7797
7893
|
const { validationAsyncState } = component;
|
|
@@ -7804,12 +7900,9 @@ var getFieldLoadingState = (component) => {
|
|
|
7804
7900
|
// src/renderers/mappers/booleanInputComponentToProps.ts
|
|
7805
7901
|
var booleanInputComponentToProps = (component, rendererMapperProps) => {
|
|
7806
7902
|
var _a;
|
|
7807
|
-
return __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-checkbox")), rendererMapperProps), {
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
inlineAlert: component.inlineAlert,
|
|
7811
|
-
value: (_a = component.value) != null ? _a : false,
|
|
7812
|
-
onChange: component.onChange.bind(component)
|
|
7903
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-checkbox")), rendererMapperProps), pick(component, "additionalText", "supportingValues", "inlineAlert")), {
|
|
7904
|
+
onChange: component.setValue,
|
|
7905
|
+
value: (_a = component.value) != null ? _a : false
|
|
7813
7906
|
});
|
|
7814
7907
|
};
|
|
7815
7908
|
|
|
@@ -7858,30 +7951,14 @@ var buttonComponentToProps = (component, rendererMapperProps) => {
|
|
|
7858
7951
|
};
|
|
7859
7952
|
|
|
7860
7953
|
// src/renderers/mappers/columnsComponentToProps.ts
|
|
7861
|
-
var columnsComponentToProps = ({
|
|
7862
|
-
|
|
7863
|
-
analyticsId,
|
|
7864
|
-
bias,
|
|
7865
|
-
control,
|
|
7866
|
-
margin,
|
|
7867
|
-
tags,
|
|
7868
|
-
startComponents,
|
|
7869
|
-
endComponents
|
|
7870
|
-
}, rendererMapperProps) => {
|
|
7871
|
-
const startChildrenProps = startComponents.map(
|
|
7954
|
+
var columnsComponentToProps = (component, rendererMapperProps) => {
|
|
7955
|
+
const startChildrenProps = component.startComponents.map(
|
|
7872
7956
|
(c) => componentToRendererProps(c, rendererMapperProps)
|
|
7873
7957
|
);
|
|
7874
|
-
const endChildrenProps = endComponents.map(
|
|
7958
|
+
const endChildrenProps = component.endComponents.map(
|
|
7875
7959
|
(c) => componentToRendererProps(c, rendererMapperProps)
|
|
7876
7960
|
);
|
|
7877
|
-
return __spreadProps(__spreadValues({}, rendererMapperProps), {
|
|
7878
|
-
uid,
|
|
7879
|
-
analyticsId,
|
|
7880
|
-
type: "columns",
|
|
7881
|
-
bias,
|
|
7882
|
-
control,
|
|
7883
|
-
margin,
|
|
7884
|
-
tags,
|
|
7961
|
+
return __spreadProps(__spreadValues(__spreadValues({}, rendererMapperProps), pick(component, "uid", "analyticsId", "type", "bias", "control", "margin", "tags")), {
|
|
7885
7962
|
startChildren: startChildrenProps.map(rendererMapperProps.render),
|
|
7886
7963
|
endChildren: endChildrenProps.map(rendererMapperProps.render),
|
|
7887
7964
|
startChildrenProps,
|
|
@@ -7905,29 +7982,24 @@ var constComponentToProps = (component, rendererMapperProps) => {
|
|
|
7905
7982
|
// src/renderers/mappers/containerComponentToProps.ts
|
|
7906
7983
|
var containerComponentToProps = (component, rendererMapperProps) => {
|
|
7907
7984
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
7908
|
-
return __spreadValues({
|
|
7909
|
-
type: "container",
|
|
7910
|
-
uid: component.uid,
|
|
7985
|
+
return __spreadValues(__spreadProps(__spreadValues({}, pick(component, "type", "uid")), {
|
|
7911
7986
|
children: childrenProps.map(rendererMapperProps.render),
|
|
7912
7987
|
childrenProps
|
|
7913
|
-
}, rendererMapperProps);
|
|
7988
|
+
}), rendererMapperProps);
|
|
7914
7989
|
};
|
|
7915
7990
|
|
|
7916
7991
|
// src/renderers/mappers/dateInputComponentToProps.ts
|
|
7917
|
-
var dateInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-date")), rendererMapperProps), {
|
|
7918
|
-
|
|
7919
|
-
minimumDate: component.minimumDate,
|
|
7920
|
-
maximumDate: component.maximumDate,
|
|
7921
|
-
suggestions: component.suggestions,
|
|
7922
|
-
onChange: component.onChange.bind(component)
|
|
7992
|
+
var dateInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-date")), rendererMapperProps), pick(component, "autoComplete", "minimumDate", "maximumDate", "suggestions")), {
|
|
7993
|
+
onChange: component.setValue
|
|
7923
7994
|
});
|
|
7924
7995
|
|
|
7925
7996
|
// src/renderers/mappers/decisionComponentToProps.ts
|
|
7926
7997
|
var decisionComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "title", "tags")), rendererMapperProps), {
|
|
7927
7998
|
options: component.options.map((_a) => {
|
|
7928
|
-
var _b = _a, { disabled } = _b,
|
|
7929
|
-
return __spreadProps(__spreadValues({},
|
|
7930
|
-
disabled: disabled || rendererMapperProps.stepLoadingState !== "idle"
|
|
7999
|
+
var _b = _a, { disabled } = _b, option = __objRest(_b, ["disabled"]);
|
|
8000
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
8001
|
+
disabled: disabled || rendererMapperProps.stepLoadingState !== "idle",
|
|
8002
|
+
getAnchorProps: option.hrefWithTracking
|
|
7931
8003
|
});
|
|
7932
8004
|
})
|
|
7933
8005
|
});
|
|
@@ -7937,14 +8009,11 @@ var dividerComponentToProps = (component, rendererMapperProps) => __spreadValues
|
|
|
7937
8009
|
|
|
7938
8010
|
// src/renderers/mappers/externalComponentToProps.ts
|
|
7939
8011
|
var externalComponentToProps = (component, rendererMapperProps) => {
|
|
7940
|
-
return __spreadValues({
|
|
7941
|
-
type: "external-confirmation"
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
open: component.open.bind(component),
|
|
7946
|
-
onCancel: component.onCancel.bind(component)
|
|
7947
|
-
}, rendererMapperProps);
|
|
8012
|
+
return __spreadValues(__spreadProps(__spreadValues({
|
|
8013
|
+
type: "external-confirmation"
|
|
8014
|
+
}, pick(component, "uid", "url", "open", "onCancel")), {
|
|
8015
|
+
visible: component.status === "failure"
|
|
8016
|
+
}), rendererMapperProps);
|
|
7948
8017
|
};
|
|
7949
8018
|
|
|
7950
8019
|
// src/renderers/mappers/formattedValueComponentToProps.ts
|
|
@@ -7965,25 +8034,18 @@ var formattedValueComponentToProps = (component, rendererMapperProps) => {
|
|
|
7965
8034
|
// for now, we don't want to pass `value` down to the renderer to avoid the "WhateverComponent".
|
|
7966
8035
|
// 'value',
|
|
7967
8036
|
)), {
|
|
7968
|
-
|
|
7969
|
-
|
|
8037
|
+
onChange: component.setValue,
|
|
8038
|
+
validationState: getValidationState(component.errors, void 0)
|
|
7970
8039
|
}), rendererMapperProps);
|
|
7971
8040
|
};
|
|
7972
8041
|
|
|
7973
8042
|
// src/renderers/mappers/formComponentToProps.ts
|
|
7974
8043
|
var formComponentToProps = (component, rendererMapperProps) => {
|
|
7975
8044
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
7976
|
-
|
|
7977
|
-
return __spreadValues({
|
|
7978
|
-
uid,
|
|
7979
|
-
analyticsId,
|
|
7980
|
-
type: "form",
|
|
8045
|
+
return __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "tags")), {
|
|
7981
8046
|
children: childrenProps.map(rendererMapperProps.render),
|
|
7982
|
-
childrenProps
|
|
7983
|
-
|
|
7984
|
-
margin,
|
|
7985
|
-
tags
|
|
7986
|
-
}, rendererMapperProps);
|
|
8047
|
+
childrenProps
|
|
8048
|
+
}), rendererMapperProps);
|
|
7987
8049
|
};
|
|
7988
8050
|
|
|
7989
8051
|
// src/renderers/mappers/headingComponentToProps.ts
|
|
@@ -8016,26 +8078,18 @@ var imageComponentToProps = (component, rendererMapperProps) => __spreadProps(__
|
|
|
8016
8078
|
var instructionsComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "items", "margin", "title", "tags")), rendererMapperProps);
|
|
8017
8079
|
|
|
8018
8080
|
// src/renderers/mappers/integerInputComponentToProps.ts
|
|
8019
|
-
var integerInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-integer")), rendererMapperProps), {
|
|
8020
|
-
|
|
8021
|
-
maximum: component.maximum,
|
|
8022
|
-
minimum: component.minimum,
|
|
8023
|
-
onChange: component.onChange.bind(component)
|
|
8081
|
+
var integerInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-integer")), rendererMapperProps), pick(component, "autoComplete", "maximum", "minimum")), {
|
|
8082
|
+
onChange: component.setValue
|
|
8024
8083
|
});
|
|
8025
8084
|
|
|
8026
8085
|
// src/renderers/mappers/listComponentToProps.ts
|
|
8027
|
-
var listComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(
|
|
8028
|
-
component,
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
"items",
|
|
8035
|
-
"margin",
|
|
8036
|
-
"title",
|
|
8037
|
-
"tags"
|
|
8038
|
-
)), rendererMapperProps);
|
|
8086
|
+
var listComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "title", "tags")), {
|
|
8087
|
+
callToAction: mapCallToActionOptional(component.callToAction),
|
|
8088
|
+
items: component.items.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
8089
|
+
callToAction: mapCallToActionOptional(item.callToAction),
|
|
8090
|
+
additionalInfo: mapAdditionalInfo2(item.additionalInfo)
|
|
8091
|
+
}))
|
|
8092
|
+
}), rendererMapperProps);
|
|
8039
8093
|
|
|
8040
8094
|
// src/renderers/mappers/loadingIndicatorComponentToProps.ts
|
|
8041
8095
|
var loadingIndicatorComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "size", "tags")), rendererMapperProps);
|
|
@@ -8059,39 +8113,25 @@ var mediaComponentToProps = (component, rendererMapperProps) => __spreadValues(_
|
|
|
8059
8113
|
|
|
8060
8114
|
// src/renderers/mappers/modalComponentToProps.ts
|
|
8061
8115
|
var modalComponentToProps = (component, rendererMapperProps) => {
|
|
8062
|
-
const { uid, analyticsId, open, tags, title, close } = component;
|
|
8063
8116
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
8064
|
-
return __spreadValues({
|
|
8065
|
-
uid,
|
|
8066
|
-
analyticsId,
|
|
8067
|
-
type: "modal",
|
|
8068
|
-
open,
|
|
8069
|
-
tags,
|
|
8070
|
-
title,
|
|
8117
|
+
return __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "open", "tags", "title")), {
|
|
8071
8118
|
children: childrenProps.map(rendererMapperProps.render),
|
|
8072
8119
|
childrenProps,
|
|
8073
|
-
onClose: close
|
|
8074
|
-
}, rendererMapperProps);
|
|
8120
|
+
onClose: component.close
|
|
8121
|
+
}), rendererMapperProps);
|
|
8075
8122
|
};
|
|
8076
8123
|
|
|
8077
8124
|
// src/renderers/mappers/modalLayoutComponentToProps.ts
|
|
8078
8125
|
var modalLayoutComponentToProps = (component, rendererMapperProps) => {
|
|
8079
|
-
const {
|
|
8126
|
+
const { content } = component;
|
|
8080
8127
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
8081
|
-
return __spreadValues({
|
|
8082
|
-
uid,
|
|
8083
|
-
analyticsId,
|
|
8084
|
-
type: "modal-layout",
|
|
8128
|
+
return __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "tags", "trigger")), {
|
|
8085
8129
|
content: {
|
|
8086
8130
|
children: childrenProps.map(rendererMapperProps.render),
|
|
8087
8131
|
childrenProps,
|
|
8088
8132
|
title: content.title
|
|
8089
|
-
}
|
|
8090
|
-
|
|
8091
|
-
margin,
|
|
8092
|
-
tags,
|
|
8093
|
-
trigger
|
|
8094
|
-
}, rendererMapperProps);
|
|
8133
|
+
}
|
|
8134
|
+
}), rendererMapperProps);
|
|
8095
8135
|
};
|
|
8096
8136
|
|
|
8097
8137
|
// src/renderers/mappers/moneyInputComponentToProps.ts
|
|
@@ -8118,8 +8158,8 @@ var moneyInputComponentToProps = (component, rendererMapperProps) => {
|
|
|
8118
8158
|
return __spreadValues(__spreadProps(__spreadValues({}, inputComponentToProps(component, "money-input")), {
|
|
8119
8159
|
amountValue: amountComponent.getLocalValue(),
|
|
8120
8160
|
selectedCurrencyIndex: currencyComponent.selectedIndex,
|
|
8121
|
-
onAmountChange: amountComponent.
|
|
8122
|
-
onCurrencyChange: currencyComponent.
|
|
8161
|
+
onAmountChange: amountComponent.setValue,
|
|
8162
|
+
onCurrencyChange: currencyComponent.selectIndex,
|
|
8123
8163
|
placeholder: amountComponent.placeholder,
|
|
8124
8164
|
currencies,
|
|
8125
8165
|
validationState
|
|
@@ -8151,47 +8191,42 @@ var selectInputOptionsToProps = (options, children, rendererMapperProps) => {
|
|
|
8151
8191
|
|
|
8152
8192
|
// src/renderers/mappers/multiSelectComponentToProps.ts
|
|
8153
8193
|
var multiSelectInputComponentToProps = (component, rendererMapperProps) => {
|
|
8154
|
-
const { autoComplete, maxItems, minItems, selectedIndices, onSelect } = component;
|
|
8155
8194
|
const _a = inputComponentToProps(component, "input-multi-select"), { required, value } = _a, props = __objRest(_a, ["required", "value"]);
|
|
8156
8195
|
const options = selectInputOptionsToProps(
|
|
8157
8196
|
component.options,
|
|
8158
8197
|
component.getChildren(),
|
|
8159
8198
|
rendererMapperProps
|
|
8160
8199
|
);
|
|
8161
|
-
return __spreadProps(__spreadValues(__spreadValues({}, props), rendererMapperProps), {
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
minItems,
|
|
8165
|
-
options,
|
|
8166
|
-
selectedIndices,
|
|
8167
|
-
onSelect: onSelect.bind(component)
|
|
8200
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, props), rendererMapperProps), pick(component, "autoComplete", "maxItems", "minItems", "selectedIndices")), {
|
|
8201
|
+
onSelect: component.selectIndices,
|
|
8202
|
+
options
|
|
8168
8203
|
});
|
|
8169
8204
|
};
|
|
8170
8205
|
|
|
8171
8206
|
// src/renderers/mappers/multiUploadInputComponentToProps.ts
|
|
8172
8207
|
var multiUploadInputComponentToProps = (component, rendererMapperProps) => {
|
|
8173
|
-
const {
|
|
8174
|
-
return __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-upload-multi")), rendererMapperProps),
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8208
|
+
const { files } = component;
|
|
8209
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-upload-multi")), rendererMapperProps), pick(
|
|
8210
|
+
component,
|
|
8211
|
+
"accepts",
|
|
8212
|
+
"cameraConfig",
|
|
8213
|
+
"maxSize",
|
|
8214
|
+
"minItems",
|
|
8215
|
+
"maxItems",
|
|
8216
|
+
"source",
|
|
8217
|
+
"uploadLabel"
|
|
8218
|
+
)), {
|
|
8182
8219
|
value: files.map((file) => __spreadProps(__spreadValues({}, file), {
|
|
8183
8220
|
validationState: mapErrorsToValidationState(file.errors)
|
|
8184
8221
|
})),
|
|
8185
|
-
onInsertFile: component.
|
|
8186
|
-
onRemoveFile: component.
|
|
8222
|
+
onInsertFile: component.insertFile,
|
|
8223
|
+
onRemoveFile: component.removeFile
|
|
8187
8224
|
});
|
|
8188
8225
|
};
|
|
8189
8226
|
|
|
8190
8227
|
// src/renderers/mappers/numberInputComponentToProps.ts
|
|
8191
|
-
var numberInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-number")), rendererMapperProps), {
|
|
8192
|
-
|
|
8193
|
-
minimum: component.minimum,
|
|
8194
|
-
onChange: component.onChange.bind(component)
|
|
8228
|
+
var numberInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-number")), rendererMapperProps), pick(component, "maximum", "minimum")), {
|
|
8229
|
+
onChange: component.setValue
|
|
8195
8230
|
});
|
|
8196
8231
|
|
|
8197
8232
|
// src/renderers/mappers/objectComponentToProps.ts
|
|
@@ -8256,27 +8291,7 @@ var progressComponentToProps = (component, rendererMapperProps) => __spreadValue
|
|
|
8256
8291
|
|
|
8257
8292
|
// src/renderers/mappers/repeatableComponentToProps.ts
|
|
8258
8293
|
var repeatableComponentToProps = (component, rendererMapperProps) => {
|
|
8259
|
-
const {
|
|
8260
|
-
uid,
|
|
8261
|
-
analyticsId,
|
|
8262
|
-
addItemTitle,
|
|
8263
|
-
control,
|
|
8264
|
-
components,
|
|
8265
|
-
description,
|
|
8266
|
-
editableComponent,
|
|
8267
|
-
editItemTitle,
|
|
8268
|
-
errors,
|
|
8269
|
-
maxItems,
|
|
8270
|
-
media,
|
|
8271
|
-
minItems,
|
|
8272
|
-
summaryDefaults,
|
|
8273
|
-
title = "",
|
|
8274
|
-
tags,
|
|
8275
|
-
onEdit,
|
|
8276
|
-
onAdd,
|
|
8277
|
-
onSave,
|
|
8278
|
-
onRemove
|
|
8279
|
-
} = component;
|
|
8294
|
+
const { components, editableComponent, errors, summaryDefaults, title = "" } = component;
|
|
8280
8295
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
8281
8296
|
const editableItemProps = editableComponent ? componentToRendererProps(editableComponent, rendererMapperProps) : null;
|
|
8282
8297
|
const getSummary = (componentSummary) => {
|
|
@@ -8290,75 +8305,63 @@ var repeatableComponentToProps = (component, rendererMapperProps) => {
|
|
|
8290
8305
|
const itemProps = components.map((childComponent) => __spreadProps(__spreadValues({}, getSummary(childComponent.getSummary())), {
|
|
8291
8306
|
id: `${childComponent.uid}-summary`
|
|
8292
8307
|
}));
|
|
8293
|
-
return __spreadValues({
|
|
8294
|
-
uid,
|
|
8295
|
-
analyticsId,
|
|
8308
|
+
return __spreadValues(__spreadProps(__spreadValues({
|
|
8296
8309
|
type: "repeatable",
|
|
8310
|
+
title
|
|
8311
|
+
}, pick(
|
|
8312
|
+
component,
|
|
8313
|
+
"control",
|
|
8314
|
+
"description",
|
|
8315
|
+
"media",
|
|
8316
|
+
"tags",
|
|
8317
|
+
"uid",
|
|
8318
|
+
"analyticsId",
|
|
8319
|
+
"editItemTitle",
|
|
8320
|
+
"addItemTitle",
|
|
8321
|
+
"maxItems",
|
|
8322
|
+
"minItems"
|
|
8323
|
+
)), {
|
|
8297
8324
|
children: childrenProps.map(rendererMapperProps.render),
|
|
8298
8325
|
childrenProps,
|
|
8299
|
-
addItemTitle,
|
|
8300
|
-
control,
|
|
8301
|
-
description,
|
|
8302
8326
|
editableItem: rendererMapperProps.render(editableItemProps),
|
|
8303
8327
|
editableItemProps,
|
|
8304
|
-
editItemTitle,
|
|
8305
8328
|
items: itemProps,
|
|
8306
|
-
maxItems,
|
|
8307
|
-
media,
|
|
8308
|
-
minItems,
|
|
8309
|
-
title,
|
|
8310
|
-
tags,
|
|
8311
8329
|
validationState: mapErrorsToValidationState(errors),
|
|
8312
|
-
onAdd:
|
|
8313
|
-
onEdit:
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
}, rendererMapperProps);
|
|
8330
|
+
onAdd: component.addComponent,
|
|
8331
|
+
onEdit: component.editComponent,
|
|
8332
|
+
onRemove: component.removeComponent,
|
|
8333
|
+
onSave: component.saveComponent
|
|
8334
|
+
}), rendererMapperProps);
|
|
8317
8335
|
};
|
|
8318
8336
|
|
|
8319
8337
|
// src/renderers/mappers/reviewComponentToProps.ts
|
|
8320
|
-
var reviewComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(
|
|
8321
|
-
component,
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
"fields",
|
|
8328
|
-
"margin",
|
|
8329
|
-
"title",
|
|
8330
|
-
"tags"
|
|
8331
|
-
)), rendererMapperProps);
|
|
8338
|
+
var reviewComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "title", "tags")), {
|
|
8339
|
+
callToAction: mapCallToActionOptional(component.callToAction),
|
|
8340
|
+
fields: component.fields.map((field) => __spreadProps(__spreadValues({}, field), {
|
|
8341
|
+
callToAction: mapCallToActionOptional(field.callToAction),
|
|
8342
|
+
additionalInfo: mapAdditionalInfo2(field.additionalInfo)
|
|
8343
|
+
}))
|
|
8344
|
+
}), rendererMapperProps);
|
|
8332
8345
|
|
|
8333
8346
|
// src/renderers/mappers/searchComponentToProps.ts
|
|
8334
8347
|
var searchComponentToProps = (component, rendererMapperProps) => {
|
|
8335
|
-
const { uid,
|
|
8336
|
-
const onChange = component.onChange.bind(component);
|
|
8337
|
-
const onSelect = component.onSelect.bind(component);
|
|
8348
|
+
const { uid, emptyMessage, error, query, setQuery, selectResult } = component;
|
|
8338
8349
|
const state = getSearchState({
|
|
8339
8350
|
emptyMessage,
|
|
8340
8351
|
error,
|
|
8341
|
-
isLoading,
|
|
8352
|
+
isLoading: component.isLoading,
|
|
8342
8353
|
query,
|
|
8343
8354
|
state: component.state,
|
|
8344
8355
|
rendererMapperProps,
|
|
8345
|
-
|
|
8346
|
-
|
|
8356
|
+
setQuery,
|
|
8357
|
+
selectResult
|
|
8347
8358
|
});
|
|
8348
|
-
return __spreadValues({
|
|
8349
|
-
|
|
8359
|
+
return __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "control", "hint", "isLoading", "margin", "query", "title", "tags")), {
|
|
8360
|
+
onChange: setQuery,
|
|
8350
8361
|
type: "search",
|
|
8351
8362
|
id: uid,
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
isLoading,
|
|
8355
|
-
margin,
|
|
8356
|
-
query,
|
|
8357
|
-
state,
|
|
8358
|
-
title,
|
|
8359
|
-
tags,
|
|
8360
|
-
onChange
|
|
8361
|
-
}, rendererMapperProps);
|
|
8363
|
+
state
|
|
8364
|
+
}), rendererMapperProps);
|
|
8362
8365
|
};
|
|
8363
8366
|
var getSearchState = ({
|
|
8364
8367
|
emptyMessage,
|
|
@@ -8367,14 +8370,14 @@ var getSearchState = ({
|
|
|
8367
8370
|
query,
|
|
8368
8371
|
state,
|
|
8369
8372
|
rendererMapperProps,
|
|
8370
|
-
|
|
8371
|
-
|
|
8373
|
+
setQuery,
|
|
8374
|
+
selectResult
|
|
8372
8375
|
}) => {
|
|
8373
8376
|
if (isLoading) {
|
|
8374
8377
|
return { type: "pending" };
|
|
8375
8378
|
}
|
|
8376
8379
|
if (error) {
|
|
8377
|
-
return { type: "error", onRetry: () =>
|
|
8380
|
+
return { type: "error", onRetry: () => setQuery(query) };
|
|
8378
8381
|
}
|
|
8379
8382
|
if (!state) {
|
|
8380
8383
|
return { type: "noResults", message: emptyMessage };
|
|
@@ -8401,7 +8404,7 @@ var getSearchState = ({
|
|
|
8401
8404
|
id: result.type === "action" ? (_a = result.value.id) != null ? _a : result.value.$id : void 0,
|
|
8402
8405
|
image: mapSpecImage(result.image),
|
|
8403
8406
|
media: getDomainLayerMedia(result),
|
|
8404
|
-
onClick: () =>
|
|
8407
|
+
onClick: () => selectResult(result)
|
|
8405
8408
|
});
|
|
8406
8409
|
})
|
|
8407
8410
|
};
|
|
@@ -8412,17 +8415,9 @@ var sectionComponentToProps = (component, rendererMapperProps) => {
|
|
|
8412
8415
|
const childrenProps = component.components.map(
|
|
8413
8416
|
(c) => componentToRendererProps(c, rendererMapperProps)
|
|
8414
8417
|
);
|
|
8415
|
-
return __spreadProps(__spreadValues(__spreadValues({}, pick(
|
|
8416
|
-
component
|
|
8417
|
-
|
|
8418
|
-
"analyticsId",
|
|
8419
|
-
"type",
|
|
8420
|
-
"title",
|
|
8421
|
-
"margin",
|
|
8422
|
-
"control",
|
|
8423
|
-
"callToAction",
|
|
8424
|
-
"tags"
|
|
8425
|
-
)), rendererMapperProps), {
|
|
8418
|
+
return __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "title", "margin", "control", "tags")), {
|
|
8419
|
+
callToAction: mapCallToActionOptional(component.callToAction)
|
|
8420
|
+
}), rendererMapperProps), {
|
|
8426
8421
|
children: childrenProps.map(rendererMapperProps.render),
|
|
8427
8422
|
childrenProps
|
|
8428
8423
|
});
|
|
@@ -8431,7 +8426,7 @@ var sectionComponentToProps = (component, rendererMapperProps) => {
|
|
|
8431
8426
|
// src/renderers/mappers/selectInputComponentToProps.ts
|
|
8432
8427
|
var selectInputComponentToProps = (component, rendererMapperProps) => {
|
|
8433
8428
|
var _b;
|
|
8434
|
-
const { autoComplete, selectedIndex,
|
|
8429
|
+
const { autoComplete, selectedIndex, selectIndex } = component;
|
|
8435
8430
|
const selectedChild = component.getSelectedChild();
|
|
8436
8431
|
const childrenProps = selectedChild ? componentToRendererProps(selectedChild, rendererMapperProps) : null;
|
|
8437
8432
|
const _a = inputComponentToProps(component, "input-select"), { value } = _a, props = __objRest(_a, ["value"]);
|
|
@@ -8443,7 +8438,7 @@ var selectInputComponentToProps = (component, rendererMapperProps) => {
|
|
|
8443
8438
|
if (options.length === 1 && ((_b = options[0].childrenProps) == null ? void 0 : _b.type) === "form-section") {
|
|
8444
8439
|
if (selectedIndex == null) {
|
|
8445
8440
|
rendererMapperProps.trackEvent("OneOf Option Selected - Auto-select single-option", {});
|
|
8446
|
-
|
|
8441
|
+
selectIndex(0);
|
|
8447
8442
|
}
|
|
8448
8443
|
return options[0].childrenProps;
|
|
8449
8444
|
}
|
|
@@ -8451,14 +8446,18 @@ var selectInputComponentToProps = (component, rendererMapperProps) => {
|
|
|
8451
8446
|
autoComplete,
|
|
8452
8447
|
options,
|
|
8453
8448
|
selectedIndex,
|
|
8454
|
-
onSelect:
|
|
8449
|
+
onSelect: component.selectIndex,
|
|
8455
8450
|
children: rendererMapperProps.render(childrenProps),
|
|
8456
8451
|
childrenProps
|
|
8457
8452
|
});
|
|
8458
8453
|
};
|
|
8459
8454
|
|
|
8460
8455
|
// src/renderers/mappers/statusListComponentToProps.ts
|
|
8461
|
-
var statusListComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "
|
|
8456
|
+
var statusListComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "title", "tags")), {
|
|
8457
|
+
items: component.items.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
8458
|
+
callToAction: mapCallToActionOptional(item.callToAction)
|
|
8459
|
+
}))
|
|
8460
|
+
}), rendererMapperProps);
|
|
8462
8461
|
|
|
8463
8462
|
// src/renderers/mappers/tabsComponentToProps.ts
|
|
8464
8463
|
var tabsComponentToProps = (component, rendererMapperProps) => {
|
|
@@ -8477,15 +8476,17 @@ var tabsComponentToProps = (component, rendererMapperProps) => {
|
|
|
8477
8476
|
};
|
|
8478
8477
|
|
|
8479
8478
|
// src/renderers/mappers/textInputComponentToProps.ts
|
|
8480
|
-
var textInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-text")), rendererMapperProps),
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
displayFormat
|
|
8484
|
-
maxLength
|
|
8485
|
-
minLength
|
|
8486
|
-
pattern
|
|
8487
|
-
suggestions
|
|
8488
|
-
|
|
8479
|
+
var textInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-text")), rendererMapperProps), pick(
|
|
8480
|
+
component,
|
|
8481
|
+
"autoComplete",
|
|
8482
|
+
"displayFormat",
|
|
8483
|
+
"maxLength",
|
|
8484
|
+
"minLength",
|
|
8485
|
+
"pattern",
|
|
8486
|
+
"suggestions"
|
|
8487
|
+
)), {
|
|
8488
|
+
onChange: component.setValue,
|
|
8489
|
+
autoCapitalize: component == null ? void 0 : component.autocapitalization
|
|
8489
8490
|
});
|
|
8490
8491
|
|
|
8491
8492
|
// src/renderers/mappers/tupleComponentToProps.ts
|
|
@@ -8511,30 +8512,15 @@ var tupleComponentToProps = (component, rendererMapperProps) => {
|
|
|
8511
8512
|
|
|
8512
8513
|
// src/renderers/mappers/uploadInputComponentToProps.ts
|
|
8513
8514
|
var uploadInputComponentToProps = (component, rendererMapperProps) => {
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
cameraConfig,
|
|
8517
|
-
source,
|
|
8518
|
-
accepts,
|
|
8519
|
-
maxSize,
|
|
8520
|
-
onUpload: component.onUpload.bind(component)
|
|
8515
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-upload")), rendererMapperProps), pick(component, "accepts", "cameraConfig", "maxSize", "source")), {
|
|
8516
|
+
onUpload: component.setValue
|
|
8521
8517
|
});
|
|
8522
8518
|
};
|
|
8523
8519
|
|
|
8524
8520
|
// src/renderers/mappers/upsellComponentToProps.ts
|
|
8525
|
-
var upsellComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(
|
|
8526
|
-
component,
|
|
8527
|
-
|
|
8528
|
-
"analyticsId",
|
|
8529
|
-
"type",
|
|
8530
|
-
"callToAction",
|
|
8531
|
-
"control",
|
|
8532
|
-
"margin",
|
|
8533
|
-
"media",
|
|
8534
|
-
"tags",
|
|
8535
|
-
"text"
|
|
8536
|
-
)), {
|
|
8537
|
-
onDismiss: component.onDismiss ? component.onDismiss.bind(component) : void 0
|
|
8521
|
+
var upsellComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "media", "tags", "text")), {
|
|
8522
|
+
callToAction: mapCallToAction(component.callToAction),
|
|
8523
|
+
onDismiss: component.dismiss
|
|
8538
8524
|
}), rendererMapperProps);
|
|
8539
8525
|
|
|
8540
8526
|
// src/renderers/mappers/componentToRendererProps.ts
|
|
@@ -8691,7 +8677,7 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
8691
8677
|
footer: footerProps.map(rendererMapperProps.render),
|
|
8692
8678
|
footerProps,
|
|
8693
8679
|
__onAction: (action) => {
|
|
8694
|
-
void onBehavior({ type: "action", action });
|
|
8680
|
+
void onBehavior({ type: "action", action, track: false });
|
|
8695
8681
|
}
|
|
8696
8682
|
}, restMapperProps);
|
|
8697
8683
|
};
|
|
@@ -8734,27 +8720,33 @@ var subflowComponentToRendererProps = (subflow, rendererMapperProps, nativeSubfl
|
|
|
8734
8720
|
}
|
|
8735
8721
|
};
|
|
8736
8722
|
var dynamicSubflowComponentToRendererProps = (component, rendererMapperProps) => {
|
|
8737
|
-
return __spreadValues(
|
|
8738
|
-
uid: component.uid,
|
|
8723
|
+
return __spreadValues(__spreadValues({
|
|
8739
8724
|
type: "subflow-dynamic"
|
|
8740
|
-
}, pick(
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8725
|
+
}, pick(
|
|
8726
|
+
component,
|
|
8727
|
+
"uid",
|
|
8728
|
+
"requestCache",
|
|
8729
|
+
"presentation",
|
|
8730
|
+
"initialRequest",
|
|
8731
|
+
"onCancellation",
|
|
8732
|
+
"onCompletion",
|
|
8733
|
+
"onError",
|
|
8734
|
+
"onEvent"
|
|
8735
|
+
)), rendererMapperProps);
|
|
8746
8736
|
};
|
|
8747
8737
|
var nativeSubflowComponentToRendererProps = (component, rendererMapperProps) => {
|
|
8748
|
-
return __spreadValues({
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8738
|
+
return __spreadValues(__spreadValues({
|
|
8739
|
+
type: "subflow-native"
|
|
8740
|
+
}, pick(
|
|
8741
|
+
component,
|
|
8742
|
+
"uid",
|
|
8743
|
+
"id",
|
|
8744
|
+
"payload",
|
|
8745
|
+
"onCancellation",
|
|
8746
|
+
"onCompletion",
|
|
8747
|
+
"onError",
|
|
8748
|
+
"onEvent"
|
|
8749
|
+
)), rendererMapperProps);
|
|
8758
8750
|
};
|
|
8759
8751
|
|
|
8760
8752
|
// src/renderers/mappers/rootComponentToProps.ts
|
|
@@ -8832,8 +8824,6 @@ function useStableCallback(handler) {
|
|
|
8832
8824
|
// src/useDynamicFlow.tsx
|
|
8833
8825
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
8834
8826
|
var className = "dynamic-flow";
|
|
8835
|
-
var noop2 = () => {
|
|
8836
|
-
};
|
|
8837
8827
|
function useDynamicFlow(props) {
|
|
8838
8828
|
var _a, _b;
|
|
8839
8829
|
const { flowId, renderers } = props;
|
|
@@ -8855,7 +8845,6 @@ function useDynamicFlow(props) {
|
|
|
8855
8845
|
const onError = useStableCallback(props.onError);
|
|
8856
8846
|
const onEvent = useStableCallback(props.onEvent);
|
|
8857
8847
|
const onLog = useStableCallback(props.onLog);
|
|
8858
|
-
const onValueChange = noop2;
|
|
8859
8848
|
const { formatMessage, locale } = (0, import_react_intl8.useIntl)();
|
|
8860
8849
|
const getErrorMessageFunctions = (0, import_react3.useMemo)(
|
|
8861
8850
|
() => getSchemaErrorMessageFunction(formatMessage, locale),
|
|
@@ -8877,7 +8866,6 @@ function useDynamicFlow(props) {
|
|
|
8877
8866
|
onError,
|
|
8878
8867
|
onEvent,
|
|
8879
8868
|
onLog,
|
|
8880
|
-
onValueChange,
|
|
8881
8869
|
scrollToTop
|
|
8882
8870
|
}));
|
|
8883
8871
|
const render = (0, import_react3.useMemo)(
|
|
@@ -9031,7 +9019,8 @@ var eventNames = [
|
|
|
9031
9019
|
"Native Subflow Triggered",
|
|
9032
9020
|
"Native Subflow Succeeded",
|
|
9033
9021
|
"Native Subflow Failed",
|
|
9034
|
-
"Native Subflow Cancelled"
|
|
9022
|
+
"Native Subflow Cancelled",
|
|
9023
|
+
"Behavior Triggered"
|
|
9035
9024
|
];
|
|
9036
9025
|
|
|
9037
9026
|
// src/renderers/subflow/getDynamicSubflowRenderer.tsx
|