@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.mjs
CHANGED
|
@@ -441,7 +441,7 @@ var nl_default = {
|
|
|
441
441
|
"dynamicFlows.ControlFeedback.type": "Onjuist type",
|
|
442
442
|
"dynamicFlows.DownloadFeedback.failed": "Downloaden mislukt",
|
|
443
443
|
"dynamicFlows.DownloadFeedback.started": "Downloaden...",
|
|
444
|
-
"dynamicFlows.DownloadFeedback.successful": "
|
|
444
|
+
"dynamicFlows.DownloadFeedback.successful": "Downloaden gelukt",
|
|
445
445
|
"dynamicFlows.DynamicParagraph.copied": "Naar klembord gekopieerd",
|
|
446
446
|
"dynamicFlows.DynamicParagraph.copy": "Kopi\xEBren",
|
|
447
447
|
"dynamicFlows.ErrorBoundary.errorAlert": "Er is iets misgegaan.",
|
|
@@ -521,7 +521,7 @@ var pt_default = {
|
|
|
521
521
|
"dynamicFlows.ControlFeedback.type": "Tipo incorreto",
|
|
522
522
|
"dynamicFlows.DownloadFeedback.failed": "Falha no envio",
|
|
523
523
|
"dynamicFlows.DownloadFeedback.started": "Baixando...",
|
|
524
|
-
"dynamicFlows.DownloadFeedback.successful": "Download
|
|
524
|
+
"dynamicFlows.DownloadFeedback.successful": "Download realizado",
|
|
525
525
|
"dynamicFlows.DynamicParagraph.copied": "Copiado",
|
|
526
526
|
"dynamicFlows.DynamicParagraph.copy": "Copiar",
|
|
527
527
|
"dynamicFlows.ErrorBoundary.errorAlert": "Algo deu errado.",
|
|
@@ -601,7 +601,7 @@ var ru_default = {
|
|
|
601
601
|
"dynamicFlows.ControlFeedback.type": "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0442\u0438\u043F",
|
|
602
602
|
"dynamicFlows.DownloadFeedback.failed": "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043A\u0430\u0447\u0430\u0442\u044C",
|
|
603
603
|
"dynamicFlows.DownloadFeedback.started": "\u0421\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435...",
|
|
604
|
-
"dynamicFlows.DownloadFeedback.successful": "
|
|
604
|
+
"dynamicFlows.DownloadFeedback.successful": "\u0421\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E",
|
|
605
605
|
"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",
|
|
606
606
|
"dynamicFlows.DynamicParagraph.copy": "\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C",
|
|
607
607
|
"dynamicFlows.ErrorBoundary.errorAlert": "\u0427\u0442\u043E-\u0442\u043E \u043F\u043E\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A.",
|
|
@@ -641,7 +641,7 @@ var th_default = {
|
|
|
641
641
|
"dynamicFlows.ControlFeedback.type": "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07",
|
|
642
642
|
"dynamicFlows.DownloadFeedback.failed": "\u0E14\u0E32\u0E27\u0E19\u0E4C\u0E42\u0E2B\u0E25\u0E14\u0E25\u0E49\u0E21\u0E40\u0E2B\u0E25\u0E27",
|
|
643
643
|
"dynamicFlows.DownloadFeedback.started": "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E14\u0E32\u0E27\u0E19\u0E4C\u0E42\u0E2B\u0E25\u0E14...",
|
|
644
|
-
"dynamicFlows.DownloadFeedback.successful": "
|
|
644
|
+
"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",
|
|
645
645
|
"dynamicFlows.DynamicParagraph.copied": "\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01\u0E44\u0E1B\u0E22\u0E31\u0E07\u0E04\u0E25\u0E34\u0E1B\u0E1A\u0E2D\u0E23\u0E4C\u0E14",
|
|
646
646
|
"dynamicFlows.DynamicParagraph.copy": "\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01",
|
|
647
647
|
"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",
|
|
@@ -681,7 +681,7 @@ var tr_default = {
|
|
|
681
681
|
"dynamicFlows.ControlFeedback.type": "Ge\xE7ersiz se\xE7im",
|
|
682
682
|
"dynamicFlows.DownloadFeedback.failed": "\u0130ndirme ba\u015Far\u0131s\u0131z",
|
|
683
683
|
"dynamicFlows.DownloadFeedback.started": "\u0130ndiriliyor...",
|
|
684
|
-
"dynamicFlows.DownloadFeedback.successful": "
|
|
684
|
+
"dynamicFlows.DownloadFeedback.successful": "\u0130ndirme ba\u015Far\u0131l\u0131",
|
|
685
685
|
"dynamicFlows.DynamicParagraph.copied": "Panoya kopyaland\u0131",
|
|
686
686
|
"dynamicFlows.DynamicParagraph.copy": "Kopyala",
|
|
687
687
|
"dynamicFlows.ErrorBoundary.errorAlert": "Bir sorun olu\u015Ftu.",
|
|
@@ -720,8 +720,8 @@ var zh_CN_default = {
|
|
|
720
720
|
"dynamicFlows.ControlFeedback.required": "\u8BF7\u586B\u5199\u6B64\u5B57\u6BB5\u3002",
|
|
721
721
|
"dynamicFlows.ControlFeedback.type": "\u7C7B\u578B\u9519\u8BEF",
|
|
722
722
|
"dynamicFlows.DownloadFeedback.failed": "\u4E0B\u8F7D\u5931\u8D25",
|
|
723
|
-
"dynamicFlows.DownloadFeedback.started": "\u6B63\u5728\u4E0B\u8F7D
|
|
724
|
-
"dynamicFlows.DownloadFeedback.successful": "
|
|
723
|
+
"dynamicFlows.DownloadFeedback.started": "\u6B63\u5728\u4E0B\u8F7D\u2026\u2026",
|
|
724
|
+
"dynamicFlows.DownloadFeedback.successful": "\u4E0B\u8F7D\u6210\u529F",
|
|
725
725
|
"dynamicFlows.DynamicParagraph.copied": "\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F",
|
|
726
726
|
"dynamicFlows.DynamicParagraph.copy": "\u590D\u5236",
|
|
727
727
|
"dynamicFlows.ErrorBoundary.errorAlert": "\u51FA\u9519\u4E86\u3002",
|
|
@@ -731,14 +731,14 @@ var zh_CN_default = {
|
|
|
731
731
|
"dynamicFlows.ExternalConfirmation.open": "\u5728\u65B0\u6807\u7B7E\u9875\u4E2D\u6253\u5F00",
|
|
732
732
|
"dynamicFlows.ExternalConfirmation.title": "\u8BF7\u786E\u8BA4",
|
|
733
733
|
"dynamicFlows.FileUploadSchema.maxFileSizeError": "\u62B1\u6B49\uFF0C\u8BE5\u6587\u4EF6\u592A\u5927\u3002\u8BF7\u4E0A\u4F20\u4E00\u4E2A\u66F4\u5C0F\u7684\u6587\u4EF6\u3002",
|
|
734
|
-
"dynamicFlows.FileUploadSchema.wrongFileTypeError": "\u62B1\u6B49\uFF0C\u4E0D\u652F\u6301\u8BE5\u6587\u4EF6\u683C\u5F0F\u3002\u8BF7\u4E0A\u4F20\u5176\u4ED6\u6587\u4EF6\u3002",
|
|
734
|
+
"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",
|
|
735
735
|
"dynamicFlows.Help.ariaLabel": "\u70B9\u51FB\u6B64\u5904\u83B7\u53D6\u66F4\u591A\u4FE1\u606F\u3002",
|
|
736
736
|
"dynamicFlows.MultiSelect.summary": "{first} \u548C\u5176\u4ED6 {count} \u4E2A",
|
|
737
737
|
"dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "\u62B1\u6B49\uFF0C\u8BE5\u6587\u4EF6\u592A\u5927\u3002\u8BF7\u4E0A\u4F20\u4E00\u4E2A\u66F4\u5C0F\u7684\u6587\u4EF6\u3002",
|
|
738
738
|
"dynamicFlows.MultipleFileUploadSchema.maxItemsError": "\u8BF7\u4E0A\u4F20\u4E0D\u8D85\u8FC7 {maxItems} \u4E2A\u6587\u4EF6\u3002",
|
|
739
739
|
"dynamicFlows.MultipleFileUploadSchema.minItemsError": "\u8BF7\u4E0A\u4F20\u81F3\u5C11 {minItems} \u4E2A\u6587\u4EF6\u3002",
|
|
740
740
|
"dynamicFlows.PersistAsyncSchema.genericError": "\u51FA\u9519\u4E86\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
741
|
-
"dynamicFlows.SearchLayout.loading": "\u6B63\u5728\u52A0\u8F7D\u2026"
|
|
741
|
+
"dynamicFlows.SearchLayout.loading": "\u6B63\u5728\u52A0\u8F7D\u2026\u2026"
|
|
742
742
|
};
|
|
743
743
|
|
|
744
744
|
// src/i18n/zh_HK.json
|
|
@@ -1018,7 +1018,7 @@ var getInputUpdateFunction = (onComponentUpdate) => {
|
|
|
1018
1018
|
// src/domain/components/RootDomainComponent.ts
|
|
1019
1019
|
var createRootDomainComponent = (onComponentUpdate, scrollToTop, backConfig, requestCache) => {
|
|
1020
1020
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
1021
|
-
const
|
|
1021
|
+
const component = {
|
|
1022
1022
|
type: "root",
|
|
1023
1023
|
kind: "step",
|
|
1024
1024
|
uid: "root",
|
|
@@ -1026,107 +1026,104 @@ var createRootDomainComponent = (onComponentUpdate, scrollToTop, backConfig, req
|
|
|
1026
1026
|
stepStack: [],
|
|
1027
1027
|
backConfig,
|
|
1028
1028
|
requestCache,
|
|
1029
|
-
_update(updateFn) {
|
|
1030
|
-
update(this, updateFn);
|
|
1031
|
-
},
|
|
1032
1029
|
dismissAllModals() {
|
|
1033
1030
|
var _a;
|
|
1034
|
-
(_a =
|
|
1031
|
+
(_a = component.getStep()) == null ? void 0 : _a.dismissAllModals();
|
|
1035
1032
|
},
|
|
1036
1033
|
dismissModal() {
|
|
1037
1034
|
var _a;
|
|
1038
|
-
(_a =
|
|
1035
|
+
(_a = component.getStep()) == null ? void 0 : _a.dismissModal();
|
|
1039
1036
|
},
|
|
1040
1037
|
showModal(modal) {
|
|
1041
1038
|
var _a;
|
|
1042
|
-
(_a =
|
|
1039
|
+
(_a = component.getStep()) == null ? void 0 : _a.showModal(modal);
|
|
1043
1040
|
},
|
|
1044
1041
|
getChildren() {
|
|
1045
|
-
const step =
|
|
1042
|
+
const step = component.getStep();
|
|
1046
1043
|
return step ? [step, ...step.getModals()] : [];
|
|
1047
1044
|
},
|
|
1048
1045
|
getLocalValue() {
|
|
1049
1046
|
var _a, _b;
|
|
1050
|
-
return (_b = (_a =
|
|
1047
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.getLocalValue()) != null ? _b : null;
|
|
1051
1048
|
},
|
|
1052
1049
|
async getSubmittableValue() {
|
|
1053
1050
|
var _a, _b;
|
|
1054
|
-
return (_b = (_a =
|
|
1051
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.getSubmittableValue()) != null ? _b : null;
|
|
1055
1052
|
},
|
|
1056
1053
|
getSubmittableValueSync() {
|
|
1057
1054
|
var _a, _b;
|
|
1058
|
-
return (_b = (_a =
|
|
1055
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.getSubmittableValueSync()) != null ? _b : null;
|
|
1059
1056
|
},
|
|
1060
1057
|
validate() {
|
|
1061
1058
|
var _a, _b;
|
|
1062
|
-
return (_b = (_a =
|
|
1059
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.validate()) != null ? _b : false;
|
|
1063
1060
|
},
|
|
1064
1061
|
setLoadingState(loadingState) {
|
|
1065
1062
|
var _a;
|
|
1066
|
-
(_a =
|
|
1063
|
+
(_a = component.getStep()) == null ? void 0 : _a.setLoadingState(loadingState);
|
|
1067
1064
|
},
|
|
1068
1065
|
getLoadingState() {
|
|
1069
1066
|
var _a, _b;
|
|
1070
|
-
return (_b = (_a =
|
|
1067
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.loadingState) != null ? _b : "initial";
|
|
1071
1068
|
},
|
|
1072
1069
|
getSchemaComponents() {
|
|
1073
1070
|
var _a, _b;
|
|
1074
|
-
return (_b = (_a =
|
|
1071
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.schemaComponents) != null ? _b : [];
|
|
1075
1072
|
},
|
|
1076
1073
|
getTrackEvent() {
|
|
1077
1074
|
var _a, _b;
|
|
1078
|
-
return (_b = (_a =
|
|
1075
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.trackEvent) != null ? _b : null;
|
|
1079
1076
|
},
|
|
1080
1077
|
isBusy() {
|
|
1081
|
-
const loadingState =
|
|
1078
|
+
const loadingState = component.getLoadingState();
|
|
1082
1079
|
return loadingState === "submitting" || loadingState === "refreshing";
|
|
1083
1080
|
},
|
|
1084
1081
|
hasStep() {
|
|
1085
|
-
return Boolean(
|
|
1082
|
+
return Boolean(component.stepStack.length > 0);
|
|
1086
1083
|
},
|
|
1087
1084
|
getStep() {
|
|
1088
1085
|
var _a;
|
|
1089
|
-
return (_a =
|
|
1086
|
+
return (_a = component.stepStack[component.stepStack.length - 1]) != null ? _a : null;
|
|
1090
1087
|
},
|
|
1091
1088
|
addSubflow(subflow) {
|
|
1092
1089
|
var _a;
|
|
1093
|
-
(_a =
|
|
1090
|
+
(_a = component.getStep()) == null ? void 0 : _a.addSubflow(subflow);
|
|
1094
1091
|
},
|
|
1095
1092
|
closeSubflow() {
|
|
1096
1093
|
var _a;
|
|
1097
|
-
(_a =
|
|
1094
|
+
(_a = component.getStep()) == null ? void 0 : _a.closeSubflow();
|
|
1098
1095
|
},
|
|
1099
1096
|
getSubflow() {
|
|
1100
1097
|
var _a, _b;
|
|
1101
|
-
return (_b = (_a =
|
|
1098
|
+
return (_b = (_a = component.getStep()) == null ? void 0 : _a.subflow) != null ? _b : null;
|
|
1102
1099
|
},
|
|
1103
1100
|
start() {
|
|
1104
1101
|
var _a;
|
|
1105
|
-
(_a =
|
|
1102
|
+
(_a = component.getStep()) == null ? void 0 : _a.start();
|
|
1106
1103
|
},
|
|
1107
1104
|
stop() {
|
|
1108
1105
|
var _a;
|
|
1109
|
-
(_a =
|
|
1106
|
+
(_a = component.getStep()) == null ? void 0 : _a.stop();
|
|
1110
1107
|
},
|
|
1111
1108
|
updateStep(stepComponent) {
|
|
1112
1109
|
var _a;
|
|
1113
|
-
|
|
1114
|
-
const shouldScroll = shouldScrollOnStepUpdate(stepComponent,
|
|
1115
|
-
|
|
1110
|
+
component.closeSubflow();
|
|
1111
|
+
const shouldScroll = shouldScrollOnStepUpdate(stepComponent, component.getStep());
|
|
1112
|
+
update(component, (draft) => {
|
|
1116
1113
|
draft.stepStack = draft.stepStack.slice(0, -1);
|
|
1117
1114
|
draft.stepStack.push(stepComponent);
|
|
1118
1115
|
});
|
|
1119
1116
|
if (shouldScroll) {
|
|
1120
1117
|
scrollToTop == null ? void 0 : scrollToTop("smooth");
|
|
1121
1118
|
}
|
|
1122
|
-
(_a =
|
|
1119
|
+
(_a = component.getStep()) == null ? void 0 : _a.start();
|
|
1123
1120
|
},
|
|
1124
1121
|
pushStep(stepComponent) {
|
|
1125
1122
|
var _a;
|
|
1126
|
-
|
|
1127
|
-
const previousStep =
|
|
1123
|
+
component.closeSubflow();
|
|
1124
|
+
const previousStep = component.getStep();
|
|
1128
1125
|
const previousStepHasPolling = previousStep == null ? void 0 : previousStep.step.polling;
|
|
1129
|
-
|
|
1126
|
+
update(component, (draft) => {
|
|
1130
1127
|
switch (stepComponent.stackBehavior) {
|
|
1131
1128
|
case "remove-previous":
|
|
1132
1129
|
case "replace-current":
|
|
@@ -1143,41 +1140,41 @@ var createRootDomainComponent = (onComponentUpdate, scrollToTop, backConfig, req
|
|
|
1143
1140
|
}
|
|
1144
1141
|
});
|
|
1145
1142
|
if (previousStep != null) {
|
|
1146
|
-
(_a =
|
|
1143
|
+
(_a = component.getStep()) == null ? void 0 : _a.start();
|
|
1147
1144
|
scrollToTop == null ? void 0 : scrollToTop("instant");
|
|
1148
1145
|
}
|
|
1149
1146
|
},
|
|
1150
1147
|
clearStack() {
|
|
1151
|
-
const currentStep =
|
|
1148
|
+
const currentStep = component.getStep();
|
|
1152
1149
|
if (currentStep) {
|
|
1153
|
-
|
|
1150
|
+
update(component, (draft) => {
|
|
1154
1151
|
draft.stepStack = [currentStep];
|
|
1155
1152
|
});
|
|
1156
1153
|
}
|
|
1157
1154
|
},
|
|
1158
1155
|
getRefreshUrl() {
|
|
1159
1156
|
var _a, _b, _c, _d;
|
|
1160
|
-
return (_d = (_c = (_a =
|
|
1157
|
+
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;
|
|
1161
1158
|
},
|
|
1162
1159
|
navigateBack() {
|
|
1163
1160
|
var _a;
|
|
1164
|
-
|
|
1165
|
-
if (
|
|
1161
|
+
component.closeSubflow();
|
|
1162
|
+
if (component.stepStack.length === 1) {
|
|
1166
1163
|
return;
|
|
1167
1164
|
}
|
|
1168
|
-
|
|
1165
|
+
update(component, (draft) => {
|
|
1169
1166
|
draft.stepStack = draft.stepStack.slice(0, -1);
|
|
1170
1167
|
});
|
|
1171
|
-
(_a =
|
|
1168
|
+
(_a = component.getStep()) == null ? void 0 : _a.start();
|
|
1172
1169
|
},
|
|
1173
1170
|
canPerformBack() {
|
|
1174
1171
|
var _a, _b;
|
|
1175
|
-
const navigation = (_a =
|
|
1172
|
+
const navigation = (_a = component.getStep()) == null ? void 0 : _a.step.navigation;
|
|
1176
1173
|
const stepHasBehavior = Boolean((_b = navigation == null ? void 0 : navigation.back) != null ? _b : navigation == null ? void 0 : navigation.backButton);
|
|
1177
|
-
return
|
|
1174
|
+
return component.backConfig.isFlowCancellable || component.stepStack.length > 1 && component.backConfig.isNativeBackEnabled || stepHasBehavior;
|
|
1178
1175
|
}
|
|
1179
1176
|
};
|
|
1180
|
-
return
|
|
1177
|
+
return component;
|
|
1181
1178
|
};
|
|
1182
1179
|
var shouldScrollOnStepUpdate = (newStep, currentStep) => {
|
|
1183
1180
|
if (!currentStep) {
|
|
@@ -1186,6 +1183,15 @@ var shouldScrollOnStepUpdate = (newStep, currentStep) => {
|
|
|
1186
1183
|
return newStep.error != null && newStep.error !== currentStep.error;
|
|
1187
1184
|
};
|
|
1188
1185
|
|
|
1186
|
+
// src/domain/features/events.ts
|
|
1187
|
+
var trackBehaviorTriggered = (trackEvent, behavior) => {
|
|
1188
|
+
if (behavior.track) {
|
|
1189
|
+
trackEvent("Behavior Triggered", __spreadProps(__spreadValues({}, behavior.analytics), {
|
|
1190
|
+
behaviorType: behavior.type
|
|
1191
|
+
}));
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1189
1195
|
// src/domain/features/prefetch/request-cache.ts
|
|
1190
1196
|
var makeRequestCacheWithParent = (parent) => {
|
|
1191
1197
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -1236,36 +1242,33 @@ var makeRequestCacheKey = (requestParams) => {
|
|
|
1236
1242
|
};
|
|
1237
1243
|
|
|
1238
1244
|
// src/domain/components/ModalComponent.ts
|
|
1239
|
-
var createModalContentComponent = (
|
|
1245
|
+
var createModalContentComponent = (props, onComponentUpdate) => {
|
|
1240
1246
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
1241
|
-
const
|
|
1247
|
+
const component = __spreadProps(__spreadValues({
|
|
1242
1248
|
type: "modal",
|
|
1243
1249
|
kind: "layout",
|
|
1244
1250
|
open: true
|
|
1245
|
-
},
|
|
1246
|
-
_update(updateFn) {
|
|
1247
|
-
update(this, updateFn);
|
|
1248
|
-
},
|
|
1251
|
+
}, props), {
|
|
1249
1252
|
getChildren() {
|
|
1250
|
-
return
|
|
1253
|
+
return component.components;
|
|
1251
1254
|
},
|
|
1252
1255
|
close() {
|
|
1253
|
-
update(
|
|
1256
|
+
update(component, (draft) => {
|
|
1254
1257
|
draft.open = false;
|
|
1255
1258
|
});
|
|
1256
1259
|
}
|
|
1257
1260
|
});
|
|
1258
|
-
return
|
|
1261
|
+
return component;
|
|
1259
1262
|
};
|
|
1260
1263
|
|
|
1261
1264
|
// src/domain/components/utils/getRandomId.ts
|
|
1262
1265
|
var getRandomId = () => Math.random().toString(36).substring(2);
|
|
1263
1266
|
|
|
1264
1267
|
// src/domain/components/AlertComponent.ts
|
|
1265
|
-
var createAlertComponent = (
|
|
1268
|
+
var createAlertComponent = (props) => __spreadValues({
|
|
1266
1269
|
type: "alert",
|
|
1267
1270
|
kind: "layout"
|
|
1268
|
-
},
|
|
1271
|
+
}, props);
|
|
1269
1272
|
|
|
1270
1273
|
// src/domain/mappers/utils/behavior-utils.ts
|
|
1271
1274
|
var getDomainLayerBehavior = ({ action, behavior: specBehavior }, stepActions, registerSubmissionBehavior) => {
|
|
@@ -1279,29 +1282,31 @@ var getDomainLayerBehavior = ({ action, behavior: specBehavior }, stepActions, r
|
|
|
1279
1282
|
registerSubmissionBehavior == null ? void 0 : registerSubmissionBehavior(behavior);
|
|
1280
1283
|
return behavior;
|
|
1281
1284
|
}
|
|
1282
|
-
return { type: "none" };
|
|
1285
|
+
return { type: "none", track: false };
|
|
1283
1286
|
};
|
|
1284
1287
|
var normaliseBehavior = (behavior, stepActions) => {
|
|
1285
1288
|
if ("type" in behavior) {
|
|
1286
1289
|
if (behavior.type === "subflow") {
|
|
1287
1290
|
return __spreadProps(__spreadValues({}, behavior), {
|
|
1291
|
+
track: true,
|
|
1288
1292
|
onCompletion: behavior.onCompletion ? normaliseBehavior(behavior.onCompletion, stepActions) : void 0,
|
|
1289
1293
|
onError: behavior.onError ? normaliseBehavior(behavior.onError, stepActions) : void 0
|
|
1290
1294
|
});
|
|
1291
1295
|
}
|
|
1292
|
-
return behavior;
|
|
1296
|
+
return __spreadProps(__spreadValues({}, behavior), { track: true });
|
|
1293
1297
|
}
|
|
1294
1298
|
if ("action" in behavior && behavior.action) {
|
|
1295
1299
|
return actionToBehavior(behavior.action, stepActions);
|
|
1296
1300
|
}
|
|
1297
1301
|
if ("link" in behavior && behavior.link) {
|
|
1298
|
-
return { type: "link", url: behavior.link.url };
|
|
1302
|
+
return { type: "link", url: behavior.link.url, track: true };
|
|
1299
1303
|
}
|
|
1300
|
-
return { type: "none" };
|
|
1304
|
+
return { type: "none", track: false };
|
|
1301
1305
|
};
|
|
1302
1306
|
var actionToBehavior = (action, stepActions) => ({
|
|
1303
1307
|
type: "action",
|
|
1304
|
-
action: inlineAction(action, stepActions)
|
|
1308
|
+
action: inlineAction(action, stepActions),
|
|
1309
|
+
track: false
|
|
1305
1310
|
});
|
|
1306
1311
|
var inlineAction = (action, stepActions = []) => action.$ref ? __spreadValues(__spreadValues({}, getActionByReference(action.$ref, stepActions)), action) : action;
|
|
1307
1312
|
var getActionByReference = ($ref, actions = []) => {
|
|
@@ -1312,6 +1317,30 @@ var getActionByReference = ($ref, actions = []) => {
|
|
|
1312
1317
|
return action;
|
|
1313
1318
|
};
|
|
1314
1319
|
|
|
1320
|
+
// src/domain/mappers/utils/getHrefWithTracking.ts
|
|
1321
|
+
var getHrefWithTracking = ({
|
|
1322
|
+
behavior,
|
|
1323
|
+
onBehavior,
|
|
1324
|
+
trackEvent
|
|
1325
|
+
}) => {
|
|
1326
|
+
if (behavior.type === "link" && behavior.url) {
|
|
1327
|
+
return () => ({
|
|
1328
|
+
href: behavior.url,
|
|
1329
|
+
target: "_blank",
|
|
1330
|
+
onClick: () => {
|
|
1331
|
+
trackEvent("Behavior Triggered", __spreadProps(__spreadValues({}, behavior.analytics), {
|
|
1332
|
+
behaviorType: behavior.type
|
|
1333
|
+
}));
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
return () => ({
|
|
1338
|
+
onClick: () => {
|
|
1339
|
+
void onBehavior(behavior);
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
};
|
|
1343
|
+
|
|
1315
1344
|
// src/domain/mappers/utils/legacy-utils.ts
|
|
1316
1345
|
var mapLegacyContext = (context) => {
|
|
1317
1346
|
switch (context) {
|
|
@@ -1369,15 +1398,17 @@ function getDomainLayerCallToAction(cta, mapperProps) {
|
|
|
1369
1398
|
if (!cta) {
|
|
1370
1399
|
return void 0;
|
|
1371
1400
|
}
|
|
1372
|
-
const { step, onBehavior, registerSubmissionBehavior } = mapperProps;
|
|
1401
|
+
const { step, onBehavior, trackEvent, registerSubmissionBehavior } = mapperProps;
|
|
1373
1402
|
const stepActions = (_a = step.actions) != null ? _a : [];
|
|
1374
1403
|
const behavior = getDomainLayerBehavior(cta, stepActions, registerSubmissionBehavior);
|
|
1404
|
+
const isLink = behavior.type === "link";
|
|
1375
1405
|
return {
|
|
1376
1406
|
type: behavior.type,
|
|
1377
1407
|
title: (_b = cta.title) != null ? _b : "",
|
|
1378
1408
|
context: cta.context ? mapLegacyContext(cta.context) : void 0,
|
|
1379
1409
|
accessibilityDescription: cta.accessibilityDescription,
|
|
1380
|
-
href:
|
|
1410
|
+
href: isLink ? behavior.url : void 0,
|
|
1411
|
+
hrefWithTracking: getHrefWithTracking({ behavior, onBehavior, trackEvent }),
|
|
1381
1412
|
onClick: () => {
|
|
1382
1413
|
void onBehavior(behavior);
|
|
1383
1414
|
}
|
|
@@ -1408,11 +1439,11 @@ var alertLayoutToComponent = (uid, {
|
|
|
1408
1439
|
};
|
|
1409
1440
|
|
|
1410
1441
|
// src/domain/components/BoxComponent.ts
|
|
1411
|
-
var createBoxComponent = (
|
|
1442
|
+
var createBoxComponent = (props) => __spreadProps(__spreadValues({}, props), {
|
|
1412
1443
|
type: "box",
|
|
1413
1444
|
kind: "layout",
|
|
1414
1445
|
getChildren() {
|
|
1415
|
-
return
|
|
1446
|
+
return props.components;
|
|
1416
1447
|
}
|
|
1417
1448
|
});
|
|
1418
1449
|
|
|
@@ -1439,10 +1470,10 @@ var boxLayoutToComponent = (uid, { border = false, components, control, margin,
|
|
|
1439
1470
|
});
|
|
1440
1471
|
|
|
1441
1472
|
// src/domain/components/ButtonComponent.ts
|
|
1442
|
-
var createButtonComponent = (
|
|
1473
|
+
var createButtonComponent = (props) => __spreadValues({
|
|
1443
1474
|
type: "button",
|
|
1444
1475
|
kind: "layout"
|
|
1445
|
-
},
|
|
1476
|
+
}, props);
|
|
1446
1477
|
|
|
1447
1478
|
// src/domain/mappers/utils/image.ts
|
|
1448
1479
|
var mapSpecImage = (image) => {
|
|
@@ -1526,7 +1557,7 @@ var buttonLayoutToComponentWithAction = (uid, button, mapperProps) => {
|
|
|
1526
1557
|
const { action } = button;
|
|
1527
1558
|
const inlinedAction = action ? inlineAction(action, step == null ? void 0 : step.actions) : {};
|
|
1528
1559
|
const onClick = () => {
|
|
1529
|
-
void onBehavior({ type: "action", action: inlinedAction });
|
|
1560
|
+
void onBehavior({ type: "action", action: inlinedAction, track: false });
|
|
1530
1561
|
};
|
|
1531
1562
|
return createButtonComponent({
|
|
1532
1563
|
uid,
|
|
@@ -1568,11 +1599,11 @@ var getButtonContext = ({ context, action }) => {
|
|
|
1568
1599
|
};
|
|
1569
1600
|
|
|
1570
1601
|
// src/domain/components/ColumnsComponent.ts
|
|
1571
|
-
var createColumnsComponent = (
|
|
1602
|
+
var createColumnsComponent = (props) => __spreadProps(__spreadValues({}, props), {
|
|
1572
1603
|
type: "columns",
|
|
1573
1604
|
kind: "layout",
|
|
1574
1605
|
getChildren() {
|
|
1575
|
-
return [...
|
|
1606
|
+
return [...props.startComponents, ...props.endComponents];
|
|
1576
1607
|
}
|
|
1577
1608
|
});
|
|
1578
1609
|
|
|
@@ -1598,10 +1629,10 @@ var columnsLayoutToComponent = (uid, { control, left, right, bias, margin, analy
|
|
|
1598
1629
|
});
|
|
1599
1630
|
|
|
1600
1631
|
// src/domain/components/DecisionComponent.ts
|
|
1601
|
-
var createDecisionComponent = (
|
|
1632
|
+
var createDecisionComponent = (props) => __spreadValues({
|
|
1602
1633
|
type: "decision",
|
|
1603
1634
|
kind: "layout"
|
|
1604
|
-
},
|
|
1635
|
+
}, props);
|
|
1605
1636
|
|
|
1606
1637
|
// src/domain/mappers/utils/tags-utils.ts
|
|
1607
1638
|
var mapTags = ({ tag, tags }) => tags != null ? tags : tag != null ? [tag] : void 0;
|
|
@@ -1614,12 +1645,18 @@ var mapInlineAlert = (alert) => {
|
|
|
1614
1645
|
} : void 0;
|
|
1615
1646
|
};
|
|
1616
1647
|
var mapAdditionalInfo = (info, mapperProps) => {
|
|
1617
|
-
const { onBehavior, registerSubmissionBehavior } = mapperProps;
|
|
1648
|
+
const { onBehavior, trackEvent, registerSubmissionBehavior } = mapperProps;
|
|
1618
1649
|
if (info) {
|
|
1619
1650
|
const behavior = getDomainLayerBehavior(info, [], registerSubmissionBehavior);
|
|
1651
|
+
const isLink = behavior.type === "link";
|
|
1620
1652
|
return {
|
|
1621
1653
|
text: info.text,
|
|
1622
|
-
href:
|
|
1654
|
+
href: isLink ? behavior.url : void 0,
|
|
1655
|
+
hrefWithTracking: getHrefWithTracking({
|
|
1656
|
+
behavior,
|
|
1657
|
+
onBehavior,
|
|
1658
|
+
trackEvent
|
|
1659
|
+
}),
|
|
1623
1660
|
accessibilityDescription: info.accessibilityDescription,
|
|
1624
1661
|
onClick: behavior.type === "none" ? void 0 : () => {
|
|
1625
1662
|
void onBehavior(behavior);
|
|
@@ -1654,14 +1691,16 @@ var decisionLayoutToComponent = (uid, {
|
|
|
1654
1691
|
});
|
|
1655
1692
|
var mapOption = (option, mapperProps) => {
|
|
1656
1693
|
var _a, _b;
|
|
1657
|
-
const { step, onBehavior, registerSubmissionBehavior } = mapperProps;
|
|
1694
|
+
const { step, onBehavior, trackEvent, registerSubmissionBehavior } = mapperProps;
|
|
1658
1695
|
const behavior = getDomainLayerBehavior(option, (_a = step.actions) != null ? _a : [], registerSubmissionBehavior);
|
|
1696
|
+
const isLink = behavior.type === "link";
|
|
1659
1697
|
return __spreadProps(__spreadValues({}, option), {
|
|
1660
1698
|
disabled: (_b = option.disabled) != null ? _b : false,
|
|
1661
|
-
href:
|
|
1699
|
+
href: isLink ? behavior.url : void 0,
|
|
1662
1700
|
media: getDomainLayerMedia(option),
|
|
1663
1701
|
inlineAlert: mapInlineAlert(option.inlineAlert),
|
|
1664
1702
|
tags: mapTags(option),
|
|
1703
|
+
hrefWithTracking: getHrefWithTracking({ behavior, onBehavior, trackEvent }),
|
|
1665
1704
|
onClick: () => {
|
|
1666
1705
|
void onBehavior(behavior);
|
|
1667
1706
|
}
|
|
@@ -1669,10 +1708,10 @@ var mapOption = (option, mapperProps) => {
|
|
|
1669
1708
|
};
|
|
1670
1709
|
|
|
1671
1710
|
// src/domain/components/StatusListComponent.ts
|
|
1672
|
-
var createStatusListComponent = (
|
|
1711
|
+
var createStatusListComponent = (props) => __spreadValues({
|
|
1673
1712
|
type: "status-list",
|
|
1674
1713
|
kind: "layout"
|
|
1675
|
-
},
|
|
1714
|
+
}, props);
|
|
1676
1715
|
|
|
1677
1716
|
// src/domain/mappers/layout/deprecatedListLayoutToComponent.ts
|
|
1678
1717
|
var isDeprecatedListLayout = (layout) => {
|
|
@@ -1715,11 +1754,11 @@ var createDividerComponent = (props) => __spreadValues({
|
|
|
1715
1754
|
var dividerLayoutToComponent = (uid, { control, margin, analyticsId, tags }) => createDividerComponent({ uid, analyticsId, control, margin: margin != null ? margin : "md", tags });
|
|
1716
1755
|
|
|
1717
1756
|
// src/domain/components/FormComponent.ts
|
|
1718
|
-
var createFormComponent = (
|
|
1757
|
+
var createFormComponent = (props) => __spreadProps(__spreadValues({}, props), {
|
|
1719
1758
|
type: "form",
|
|
1720
1759
|
kind: "layout",
|
|
1721
1760
|
getChildren() {
|
|
1722
|
-
return [
|
|
1761
|
+
return [props.schemaComponent];
|
|
1723
1762
|
}
|
|
1724
1763
|
});
|
|
1725
1764
|
|
|
@@ -1748,10 +1787,10 @@ var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, co
|
|
|
1748
1787
|
};
|
|
1749
1788
|
|
|
1750
1789
|
// src/domain/components/HeadingComponent.ts
|
|
1751
|
-
var createHeadingComponent = (
|
|
1790
|
+
var createHeadingComponent = (props) => __spreadValues({
|
|
1752
1791
|
type: "heading",
|
|
1753
1792
|
kind: "layout"
|
|
1754
|
-
},
|
|
1793
|
+
}, props);
|
|
1755
1794
|
|
|
1756
1795
|
// src/domain/mappers/layout/headingLayoutToComponent.ts
|
|
1757
1796
|
var headingLayoutToComponent = (uid, { analyticsId, align, margin, size, control, tags, text }) => createHeadingComponent({
|
|
@@ -1766,10 +1805,10 @@ var headingLayoutToComponent = (uid, { analyticsId, align, margin, size, control
|
|
|
1766
1805
|
});
|
|
1767
1806
|
|
|
1768
1807
|
// src/domain/components/ImageComponent.ts
|
|
1769
|
-
var createImageComponent = (
|
|
1808
|
+
var createImageComponent = (props) => __spreadValues({
|
|
1770
1809
|
type: "image",
|
|
1771
1810
|
kind: "layout"
|
|
1772
|
-
},
|
|
1811
|
+
}, props);
|
|
1773
1812
|
|
|
1774
1813
|
// src/domain/mappers/layout/imageLayoutToComponent.ts
|
|
1775
1814
|
var imageLayoutToComponent = (uid, {
|
|
@@ -1801,10 +1840,10 @@ var imageLayoutToComponent = (uid, {
|
|
|
1801
1840
|
};
|
|
1802
1841
|
|
|
1803
1842
|
// src/domain/components/MarkdownComponent.ts
|
|
1804
|
-
var createMarkdownComponent = (
|
|
1843
|
+
var createMarkdownComponent = (props) => __spreadValues({
|
|
1805
1844
|
type: "markdown",
|
|
1806
1845
|
kind: "layout"
|
|
1807
|
-
},
|
|
1846
|
+
}, props);
|
|
1808
1847
|
|
|
1809
1848
|
// src/domain/mappers/layout/infoLayoutToComponent.ts
|
|
1810
1849
|
var infoLayoutToComponent = (uid, { analyticsId, align, control, margin, markdown: content, tags }) => createMarkdownComponent({
|
|
@@ -1819,10 +1858,10 @@ var infoLayoutToComponent = (uid, { analyticsId, align, control, margin, markdow
|
|
|
1819
1858
|
});
|
|
1820
1859
|
|
|
1821
1860
|
// src/domain/components/InstructionsComponent.ts
|
|
1822
|
-
var createInstructionsComponent = (
|
|
1861
|
+
var createInstructionsComponent = (props) => __spreadValues({
|
|
1823
1862
|
type: "instructions",
|
|
1824
1863
|
kind: "layout"
|
|
1825
|
-
},
|
|
1864
|
+
}, props);
|
|
1826
1865
|
|
|
1827
1866
|
// src/domain/mappers/layout/instructionsLayoutToComponent.ts
|
|
1828
1867
|
var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin, tags, title }) => createInstructionsComponent({
|
|
@@ -1839,10 +1878,10 @@ var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin,
|
|
|
1839
1878
|
});
|
|
1840
1879
|
|
|
1841
1880
|
// src/domain/components/ListComponent.ts
|
|
1842
|
-
var createListComponent = (
|
|
1881
|
+
var createListComponent = (props) => __spreadValues({
|
|
1843
1882
|
type: "list",
|
|
1844
1883
|
kind: "layout"
|
|
1845
|
-
},
|
|
1884
|
+
}, props);
|
|
1846
1885
|
|
|
1847
1886
|
// src/domain/mappers/layout/listLayoutToComponent.ts
|
|
1848
1887
|
var listLayoutToComponent = (uid, { analyticsId, callToAction, control, items, margin, tags, title }, mapperProps) => {
|
|
@@ -1900,10 +1939,10 @@ var mapSupportingValues = (item) => {
|
|
|
1900
1939
|
};
|
|
1901
1940
|
|
|
1902
1941
|
// src/domain/components/LoadingIndicatorComponent.ts
|
|
1903
|
-
var createLoadingIndicatorComponent = (
|
|
1942
|
+
var createLoadingIndicatorComponent = (props) => __spreadValues({
|
|
1904
1943
|
type: "loading-indicator",
|
|
1905
1944
|
kind: "layout"
|
|
1906
|
-
},
|
|
1945
|
+
}, props);
|
|
1907
1946
|
|
|
1908
1947
|
// src/domain/mappers/layout/loadingIndicatorLayoutToComponent.ts
|
|
1909
1948
|
var loadingIndicatorLayoutToComponent = (uid, { analyticsId, control, margin, size, tags }) => createLoadingIndicatorComponent({
|
|
@@ -1954,12 +1993,12 @@ var mediaLayoutToComponent = (uid, { analyticsId, align, control, margin, media,
|
|
|
1954
1993
|
});
|
|
1955
1994
|
|
|
1956
1995
|
// src/domain/components/ModalLayoutComponent.ts
|
|
1957
|
-
var createModalComponent = (
|
|
1996
|
+
var createModalComponent = (props) => __spreadProps(__spreadValues({
|
|
1958
1997
|
type: "modal-layout",
|
|
1959
1998
|
kind: "layout"
|
|
1960
|
-
},
|
|
1999
|
+
}, props), {
|
|
1961
2000
|
getChildren() {
|
|
1962
|
-
return
|
|
2001
|
+
return props.content.components;
|
|
1963
2002
|
}
|
|
1964
2003
|
});
|
|
1965
2004
|
|
|
@@ -1983,10 +2022,10 @@ var modalLayoutToComponent = (uid, { analyticsId, content, control, margin, tags
|
|
|
1983
2022
|
};
|
|
1984
2023
|
|
|
1985
2024
|
// src/domain/components/ParagraphComponent.ts
|
|
1986
|
-
var createParagraphComponent = (
|
|
2025
|
+
var createParagraphComponent = (props) => __spreadValues({
|
|
1987
2026
|
type: "paragraph",
|
|
1988
2027
|
kind: "layout"
|
|
1989
|
-
},
|
|
2028
|
+
}, props);
|
|
1990
2029
|
|
|
1991
2030
|
// src/domain/mappers/layout/paragraphLayoutToComponent.ts
|
|
1992
2031
|
var paragraphLayoutToComponent = (uid, { analyticsId, align, control, margin, size, tags, text }) => createParagraphComponent({
|
|
@@ -2001,10 +2040,10 @@ var paragraphLayoutToComponent = (uid, { analyticsId, align, control, margin, si
|
|
|
2001
2040
|
});
|
|
2002
2041
|
|
|
2003
2042
|
// src/domain/components/ProgressComponent.ts
|
|
2004
|
-
var createProgressComponent = (
|
|
2043
|
+
var createProgressComponent = (props) => __spreadValues({
|
|
2005
2044
|
type: "progress",
|
|
2006
2045
|
kind: "layout"
|
|
2007
|
-
},
|
|
2046
|
+
}, props);
|
|
2008
2047
|
|
|
2009
2048
|
// src/domain/mappers/layout/progressLayoutToComponent.ts
|
|
2010
2049
|
var progressLayoutToComponent = (uid, {
|
|
@@ -2033,10 +2072,10 @@ var progressLayoutToComponent = (uid, {
|
|
|
2033
2072
|
});
|
|
2034
2073
|
|
|
2035
2074
|
// src/domain/components/ReviewComponent.ts
|
|
2036
|
-
var createReviewComponent = (
|
|
2075
|
+
var createReviewComponent = (props) => __spreadValues({
|
|
2037
2076
|
type: "review",
|
|
2038
2077
|
kind: "layout"
|
|
2039
|
-
},
|
|
2078
|
+
}, props);
|
|
2040
2079
|
|
|
2041
2080
|
// src/domain/mappers/layout/reviewLayoutToComponent.ts
|
|
2042
2081
|
var reviewLayoutToComponent = (uid, {
|
|
@@ -2068,12 +2107,15 @@ var getCallToAction = ({
|
|
|
2068
2107
|
return getDomainLayerCallToAction(callToAction, mapperProps);
|
|
2069
2108
|
}
|
|
2070
2109
|
if (action == null ? void 0 : action.title) {
|
|
2110
|
+
const behavior = { type: "action", action, track: true };
|
|
2111
|
+
const { onBehavior, trackEvent } = mapperProps;
|
|
2071
2112
|
return {
|
|
2072
2113
|
type: "action",
|
|
2073
2114
|
title: action.title,
|
|
2074
2115
|
onClick: () => {
|
|
2075
|
-
void
|
|
2076
|
-
}
|
|
2116
|
+
void onBehavior(behavior);
|
|
2117
|
+
},
|
|
2118
|
+
hrefWithTracking: getHrefWithTracking({ behavior, onBehavior, trackEvent })
|
|
2077
2119
|
};
|
|
2078
2120
|
}
|
|
2079
2121
|
return void 0;
|
|
@@ -2110,7 +2152,7 @@ var debounce = (callback, waitMs) => {
|
|
|
2110
2152
|
let timeoutId = null;
|
|
2111
2153
|
let lastArgs = null;
|
|
2112
2154
|
const clearTimer = () => {
|
|
2113
|
-
if (timeoutId) {
|
|
2155
|
+
if (timeoutId !== null) {
|
|
2114
2156
|
clearTimeout(timeoutId);
|
|
2115
2157
|
timeoutId = null;
|
|
2116
2158
|
}
|
|
@@ -2143,8 +2185,8 @@ var debounce = (callback, waitMs) => {
|
|
|
2143
2185
|
|
|
2144
2186
|
// src/domain/components/searchComponent/SearchComponent.ts
|
|
2145
2187
|
var DEBOUNCE_TIME = 400;
|
|
2146
|
-
var createSearchComponent = (
|
|
2147
|
-
const { uid, analyticsId, control, emptyMessage, initialState, hint, margin, tags, title } =
|
|
2188
|
+
var createSearchComponent = (props, performSearch, onBehavior, onComponentUpdate) => {
|
|
2189
|
+
const { uid, analyticsId, control, emptyMessage, initialState, hint, margin, tags, title } = props;
|
|
2148
2190
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
2149
2191
|
let abortController = new AbortController();
|
|
2150
2192
|
const search = (component2, query, searchConfig) => {
|
|
@@ -2188,16 +2230,13 @@ var createSearchComponent = (searchProps, performSearch, onBehavior, onComponent
|
|
|
2188
2230
|
title,
|
|
2189
2231
|
isLoading: false,
|
|
2190
2232
|
query: "",
|
|
2191
|
-
|
|
2192
|
-
update(this, updateFn);
|
|
2193
|
-
},
|
|
2194
|
-
onChange(query) {
|
|
2233
|
+
setQuery(query) {
|
|
2195
2234
|
if (query.trim()) {
|
|
2196
|
-
|
|
2235
|
+
update(component, (draft) => {
|
|
2197
2236
|
draft.query = query;
|
|
2198
2237
|
draft.isLoading = true;
|
|
2199
2238
|
});
|
|
2200
|
-
debouncedSearch(
|
|
2239
|
+
debouncedSearch(component, query.trim());
|
|
2201
2240
|
} else {
|
|
2202
2241
|
abortController.abort();
|
|
2203
2242
|
debouncedSearch.cancel();
|
|
@@ -2209,15 +2248,15 @@ var createSearchComponent = (searchProps, performSearch, onBehavior, onComponent
|
|
|
2209
2248
|
});
|
|
2210
2249
|
}
|
|
2211
2250
|
},
|
|
2212
|
-
|
|
2251
|
+
selectResult({ type, value }) {
|
|
2213
2252
|
if (type === "action") {
|
|
2214
|
-
void onBehavior({ type: "action", action: value });
|
|
2253
|
+
void onBehavior({ type: "action", action: value, track: false });
|
|
2215
2254
|
} else {
|
|
2216
|
-
|
|
2255
|
+
update(component, (draft) => {
|
|
2217
2256
|
draft.query = value.query;
|
|
2218
2257
|
draft.isLoading = true;
|
|
2219
2258
|
});
|
|
2220
|
-
search(
|
|
2259
|
+
search(component, value.query, {
|
|
2221
2260
|
method: value.method,
|
|
2222
2261
|
param: value.param,
|
|
2223
2262
|
url: value.url
|
|
@@ -2368,15 +2407,13 @@ var emptyInitialState = {
|
|
|
2368
2407
|
};
|
|
2369
2408
|
|
|
2370
2409
|
// src/domain/components/SectionComponent.ts
|
|
2371
|
-
var createSectionComponent = (props) => {
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
});
|
|
2379
|
-
};
|
|
2410
|
+
var createSectionComponent = (props) => __spreadProps(__spreadValues({}, props), {
|
|
2411
|
+
type: "section",
|
|
2412
|
+
kind: "layout",
|
|
2413
|
+
getChildren() {
|
|
2414
|
+
return props.components;
|
|
2415
|
+
}
|
|
2416
|
+
});
|
|
2380
2417
|
|
|
2381
2418
|
// src/domain/mappers/layout/sectionLayoutToComponent.ts
|
|
2382
2419
|
var sectionLayoutToComponent = (uid, { analyticsId, control, title, components, callToAction, margin, tags }, mapperProps, schemaComponents) => {
|
|
@@ -2409,7 +2446,7 @@ var statusListLayoutToComponent = (uid, { analyticsId, control, items, margin, t
|
|
|
2409
2446
|
});
|
|
2410
2447
|
|
|
2411
2448
|
// src/domain/components/TabsComponent.ts
|
|
2412
|
-
var createTabsComponent = (
|
|
2449
|
+
var createTabsComponent = (props) => __spreadProps(__spreadValues({}, props), {
|
|
2413
2450
|
type: "tabs",
|
|
2414
2451
|
kind: "layout"
|
|
2415
2452
|
});
|
|
@@ -2437,19 +2474,19 @@ var mapTabs = (tabs, uid, mapperProps, schemaComponents) => tabs.map(({ componen
|
|
|
2437
2474
|
}));
|
|
2438
2475
|
|
|
2439
2476
|
// src/domain/components/UpsellComponent.ts
|
|
2440
|
-
var createUpsellComponent = (
|
|
2477
|
+
var createUpsellComponent = (props, onComponentUpdate) => {
|
|
2441
2478
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
2442
|
-
const _a =
|
|
2479
|
+
const _a = props, { dismiss } = _a, restProps = __objRest(_a, ["dismiss"]);
|
|
2443
2480
|
const component = __spreadProps(__spreadValues({
|
|
2444
2481
|
type: "upsell",
|
|
2445
2482
|
kind: "layout"
|
|
2446
2483
|
}, restProps), {
|
|
2447
2484
|
visible: true,
|
|
2448
|
-
|
|
2485
|
+
dismiss: dismiss ? () => {
|
|
2449
2486
|
update(component, (draft) => {
|
|
2450
2487
|
draft.visible = false;
|
|
2451
2488
|
});
|
|
2452
|
-
|
|
2489
|
+
dismiss();
|
|
2453
2490
|
} : void 0
|
|
2454
2491
|
});
|
|
2455
2492
|
return component;
|
|
@@ -2468,7 +2505,7 @@ var upsellLayoutToComponent = (uid, { analyticsId, callToAction, control, margin
|
|
|
2468
2505
|
media: getDomainLayerMedia({ media }),
|
|
2469
2506
|
tags,
|
|
2470
2507
|
text,
|
|
2471
|
-
|
|
2508
|
+
dismiss: onDismiss ? () => {
|
|
2472
2509
|
const { url, method } = onDismiss;
|
|
2473
2510
|
const body = method === "GET" ? void 0 : JSON.stringify(onDismiss.body);
|
|
2474
2511
|
void mapperProps.httpClient(url, { method, body }).catch(() => {
|
|
@@ -2550,26 +2587,27 @@ var modalToComponent = (uid, { content, title }, mapperProps, schemaComponents)
|
|
|
2550
2587
|
// src/domain/components/step/ExternalConfirmationComponent.ts
|
|
2551
2588
|
var createExternalConfirmation = (uid, url, onLink, onComponentUpdate) => {
|
|
2552
2589
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
2553
|
-
|
|
2590
|
+
const component = {
|
|
2554
2591
|
type: "external-confirmation",
|
|
2555
2592
|
kind: "layout",
|
|
2556
2593
|
uid,
|
|
2557
2594
|
url,
|
|
2558
2595
|
status: "initial",
|
|
2559
2596
|
open() {
|
|
2560
|
-
if (
|
|
2561
|
-
const success = onLink(
|
|
2562
|
-
update(
|
|
2597
|
+
if (component.status === "initial" || component.status === "failure") {
|
|
2598
|
+
const success = onLink(component.url);
|
|
2599
|
+
update(component, (draft) => {
|
|
2563
2600
|
draft.status = success ? "success" : "failure";
|
|
2564
2601
|
});
|
|
2565
2602
|
}
|
|
2566
2603
|
},
|
|
2567
2604
|
onCancel() {
|
|
2568
|
-
update(
|
|
2605
|
+
update(component, (draft) => {
|
|
2569
2606
|
draft.status = "dismissed";
|
|
2570
2607
|
});
|
|
2571
2608
|
}
|
|
2572
2609
|
};
|
|
2610
|
+
return component;
|
|
2573
2611
|
};
|
|
2574
2612
|
|
|
2575
2613
|
// src/utils/recursiveMerge.ts
|
|
@@ -2619,8 +2657,26 @@ var getSubmittableDataSync = (components) => components.map((component) => compo
|
|
|
2619
2657
|
var getLocalValues = (components) => components.map((component) => component.getLocalValue()).reduce((acc, value) => recursiveMerge(acc, value), null);
|
|
2620
2658
|
|
|
2621
2659
|
// src/domain/components/step/StepDomainComponent.ts
|
|
2622
|
-
var createStepComponent = (
|
|
2623
|
-
const _a =
|
|
2660
|
+
var createStepComponent = (props) => {
|
|
2661
|
+
const _a = props, {
|
|
2662
|
+
uid,
|
|
2663
|
+
stepPolling,
|
|
2664
|
+
stepRefreshAfter,
|
|
2665
|
+
stepPrefetch,
|
|
2666
|
+
features,
|
|
2667
|
+
logEvent,
|
|
2668
|
+
onComponentUpdate,
|
|
2669
|
+
onLoad
|
|
2670
|
+
} = _a, rest = __objRest(_a, [
|
|
2671
|
+
"uid",
|
|
2672
|
+
"stepPolling",
|
|
2673
|
+
"stepRefreshAfter",
|
|
2674
|
+
"stepPrefetch",
|
|
2675
|
+
"features",
|
|
2676
|
+
"logEvent",
|
|
2677
|
+
"onComponentUpdate",
|
|
2678
|
+
"onLoad"
|
|
2679
|
+
]);
|
|
2624
2680
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
2625
2681
|
const component = __spreadProps(__spreadValues({
|
|
2626
2682
|
uid
|
|
@@ -2633,78 +2689,73 @@ var createStepComponent = (stepProps) => {
|
|
|
2633
2689
|
subflow: null,
|
|
2634
2690
|
dismissModal() {
|
|
2635
2691
|
var _a2;
|
|
2636
|
-
(_a2 =
|
|
2692
|
+
(_a2 = component.modals.at(-1)) == null ? void 0 : _a2.close();
|
|
2637
2693
|
},
|
|
2638
2694
|
dismissAllModals() {
|
|
2639
|
-
|
|
2695
|
+
update(component, (draft) => {
|
|
2640
2696
|
draft.modals = draft.modals.map((m) => __spreadProps(__spreadValues({}, m), { open: false }));
|
|
2641
2697
|
});
|
|
2642
2698
|
},
|
|
2643
2699
|
showModal(modal) {
|
|
2644
|
-
|
|
2700
|
+
update(component, (draft) => {
|
|
2645
2701
|
draft.modals = [...draft.modals, modal];
|
|
2646
2702
|
});
|
|
2647
2703
|
},
|
|
2648
|
-
_update(updateFn) {
|
|
2649
|
-
update(this, updateFn);
|
|
2650
|
-
},
|
|
2651
2704
|
getChildren() {
|
|
2652
|
-
return
|
|
2705
|
+
return component.externalConfirmation ? [...component.layoutComponents, component.externalConfirmation] : component.layoutComponents;
|
|
2653
2706
|
},
|
|
2654
2707
|
getModals() {
|
|
2655
|
-
return
|
|
2708
|
+
return component.modals;
|
|
2656
2709
|
},
|
|
2657
2710
|
async getSubmittableValue() {
|
|
2658
|
-
return getSubmittableData(
|
|
2711
|
+
return getSubmittableData(component.schemaComponents);
|
|
2659
2712
|
},
|
|
2660
2713
|
getSubmittableValueSync() {
|
|
2661
|
-
return getSubmittableDataSync(
|
|
2714
|
+
return getSubmittableDataSync(component.schemaComponents);
|
|
2662
2715
|
},
|
|
2663
2716
|
getLocalValue() {
|
|
2664
|
-
return getLocalValues(
|
|
2717
|
+
return getLocalValues(component.schemaComponents);
|
|
2665
2718
|
},
|
|
2666
2719
|
validate() {
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
}
|
|
2672
|
-
);
|
|
2720
|
+
const isStrict = features.isEnabled("validateUnreferencedSchemas");
|
|
2721
|
+
return component.schemaComponents.map(
|
|
2722
|
+
(inputComponent) => validateInputComponent(component, inputComponent, isStrict, logEvent)
|
|
2723
|
+
).every(Boolean);
|
|
2673
2724
|
},
|
|
2674
2725
|
setLoadingState(loadingState) {
|
|
2675
|
-
|
|
2726
|
+
update(component, (draft) => {
|
|
2676
2727
|
draft.loadingState = loadingState;
|
|
2677
2728
|
});
|
|
2678
2729
|
},
|
|
2679
2730
|
addSubflow(subflow) {
|
|
2680
|
-
|
|
2731
|
+
update(component, (draft) => {
|
|
2681
2732
|
draft.subflow = subflow;
|
|
2682
2733
|
});
|
|
2683
2734
|
},
|
|
2684
2735
|
closeSubflow() {
|
|
2685
|
-
if (!
|
|
2736
|
+
if (!component.subflow) {
|
|
2686
2737
|
return;
|
|
2687
2738
|
}
|
|
2688
|
-
|
|
2739
|
+
update(component, (draft) => {
|
|
2689
2740
|
draft.subflow = null;
|
|
2690
2741
|
});
|
|
2691
2742
|
},
|
|
2692
2743
|
start() {
|
|
2693
|
-
if (
|
|
2744
|
+
if (component.state === "initial") {
|
|
2694
2745
|
onLoad == null ? void 0 : onLoad();
|
|
2695
2746
|
}
|
|
2696
|
-
|
|
2747
|
+
update(component, (draft) => {
|
|
2697
2748
|
draft.state = "started";
|
|
2698
2749
|
});
|
|
2699
2750
|
stepPolling == null ? void 0 : stepPolling.start();
|
|
2700
2751
|
stepRefreshAfter == null ? void 0 : stepRefreshAfter.start();
|
|
2701
|
-
stepPrefetch.start(
|
|
2752
|
+
stepPrefetch.start(component.getSubmittableValueSync());
|
|
2702
2753
|
},
|
|
2703
2754
|
stop() {
|
|
2704
2755
|
stepPolling == null ? void 0 : stepPolling.stop();
|
|
2705
2756
|
stepRefreshAfter == null ? void 0 : stepRefreshAfter.stop();
|
|
2706
2757
|
stepPrefetch.stop();
|
|
2707
|
-
|
|
2758
|
+
update(component, (draft) => {
|
|
2708
2759
|
draft.state = "stopped";
|
|
2709
2760
|
draft.modals = [];
|
|
2710
2761
|
});
|
|
@@ -2712,6 +2763,22 @@ var createStepComponent = (stepProps) => {
|
|
|
2712
2763
|
});
|
|
2713
2764
|
return component;
|
|
2714
2765
|
};
|
|
2766
|
+
var validateInputComponent = (component, inputComponent, isStrict, logEvent) => {
|
|
2767
|
+
var _a;
|
|
2768
|
+
const isSchemaReferenced = component.referencedSchemaIds.includes((_a = inputComponent.schemaId) != null ? _a : "");
|
|
2769
|
+
const isValid = inputComponent.validate();
|
|
2770
|
+
if (!isSchemaReferenced && !isValid) {
|
|
2771
|
+
logEvent(
|
|
2772
|
+
isStrict ? "error" : "warning",
|
|
2773
|
+
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.",
|
|
2774
|
+
{
|
|
2775
|
+
unreferencedSchemaId: inputComponent.schemaId,
|
|
2776
|
+
componentUid: component.uid
|
|
2777
|
+
}
|
|
2778
|
+
);
|
|
2779
|
+
}
|
|
2780
|
+
return isSchemaReferenced || isStrict ? isValid : true;
|
|
2781
|
+
};
|
|
2715
2782
|
|
|
2716
2783
|
// src/domain/features/polling/getStepPolling.ts
|
|
2717
2784
|
var getStepPolling = ({
|
|
@@ -2914,7 +2981,7 @@ var executeRequest = async (props) => {
|
|
|
2914
2981
|
url,
|
|
2915
2982
|
{
|
|
2916
2983
|
method,
|
|
2917
|
-
body: body ? JSON.stringify(body) : void 0,
|
|
2984
|
+
body: body != null ? JSON.stringify(body) : void 0,
|
|
2918
2985
|
headers: { "Content-Type": "application/json" }
|
|
2919
2986
|
}
|
|
2920
2987
|
],
|
|
@@ -2950,7 +3017,8 @@ var executeRequest = async (props) => {
|
|
|
2950
3017
|
type: "behavior",
|
|
2951
3018
|
behavior: {
|
|
2952
3019
|
type: "action",
|
|
2953
|
-
action: responseBody.action
|
|
3020
|
+
action: responseBody.action,
|
|
3021
|
+
track: false
|
|
2954
3022
|
}
|
|
2955
3023
|
};
|
|
2956
3024
|
}
|
|
@@ -2961,7 +3029,8 @@ var executeRequest = async (props) => {
|
|
|
2961
3029
|
behavior: __spreadProps(__spreadValues({}, responseBody), {
|
|
2962
3030
|
type: "subflow",
|
|
2963
3031
|
onCompletion: responseBody.onCompletion ? normaliseBehavior(responseBody.onCompletion, []) : void 0,
|
|
2964
|
-
onError: responseBody.onError ? normaliseBehavior(responseBody.onError, []) : void 0
|
|
3032
|
+
onError: responseBody.onError ? normaliseBehavior(responseBody.onError, []) : void 0,
|
|
3033
|
+
track: false
|
|
2965
3034
|
})
|
|
2966
3035
|
} : {
|
|
2967
3036
|
type: "error",
|
|
@@ -2970,7 +3039,7 @@ var executeRequest = async (props) => {
|
|
|
2970
3039
|
}
|
|
2971
3040
|
case "modal": {
|
|
2972
3041
|
assertModalResponseBody(responseBody);
|
|
2973
|
-
return !isInitial ? { type: "behavior", behavior: __spreadProps(__spreadValues({}, responseBody), { type: "modal" }) } : {
|
|
3042
|
+
return !isInitial ? { type: "behavior", behavior: __spreadProps(__spreadValues({}, responseBody), { type: "modal", track: false }) } : {
|
|
2974
3043
|
type: "error",
|
|
2975
3044
|
body: { errors: { error: "Cannot show modal without a current step" } }
|
|
2976
3045
|
};
|
|
@@ -3132,7 +3201,7 @@ var getStepRefreshAfter = ({
|
|
|
3132
3201
|
const start = () => {
|
|
3133
3202
|
const timeLeft = Math.max(targetTime - Date.now(), ONE_SECOND);
|
|
3134
3203
|
timeout = setTimeout(() => {
|
|
3135
|
-
void onBehavior({ type: "refresh", analytics: { schema: "refreshAfter" } });
|
|
3204
|
+
void onBehavior({ type: "refresh", analytics: { schema: "refreshAfter" }, track: false });
|
|
3136
3205
|
}, timeLeft);
|
|
3137
3206
|
};
|
|
3138
3207
|
return {
|
|
@@ -3285,8 +3354,8 @@ var getComponentValidationAsync = (update, performValidationAsync) => (
|
|
|
3285
3354
|
var getDebouncedComponentValidationAsync = (update, performValidationAsync) => debounce(getComponentValidationAsync(update, performValidationAsync), 1e3);
|
|
3286
3355
|
|
|
3287
3356
|
// src/domain/components/NumberInputComponent.ts
|
|
3288
|
-
var createNumberInputComponent = (
|
|
3289
|
-
const _a =
|
|
3357
|
+
var createNumberInputComponent = (props, onComponentUpdate) => {
|
|
3358
|
+
const _a = props, {
|
|
3290
3359
|
uid,
|
|
3291
3360
|
id,
|
|
3292
3361
|
checks,
|
|
@@ -3306,32 +3375,31 @@ var createNumberInputComponent = (numberInputProps, onComponentUpdate) => {
|
|
|
3306
3375
|
"summariser"
|
|
3307
3376
|
]);
|
|
3308
3377
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
3378
|
+
const onValueChangeDebounced = debounce(onValueChange, 1e3);
|
|
3309
3379
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
3310
3380
|
const performOnChange = getDebouncedSchemaOnChange(schemaOnChange, getValidationErrors);
|
|
3311
3381
|
const validateAsync = performValidationAsync ? getDebouncedComponentValidationAsync(update, performValidationAsync) : void 0;
|
|
3312
|
-
const
|
|
3382
|
+
const component = __spreadValues({
|
|
3313
3383
|
type: "number",
|
|
3314
3384
|
kind: "input",
|
|
3315
3385
|
uid,
|
|
3316
3386
|
id,
|
|
3317
|
-
_update(updateFn) {
|
|
3318
|
-
update(this, updateFn);
|
|
3319
|
-
},
|
|
3320
3387
|
onBlur() {
|
|
3321
|
-
const isValid =
|
|
3388
|
+
const isValid = component.validate();
|
|
3322
3389
|
performOnChange == null ? void 0 : performOnChange.flush();
|
|
3323
3390
|
if (isValid) {
|
|
3324
3391
|
void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
|
|
3325
3392
|
}));
|
|
3326
3393
|
validateAsync == null ? void 0 : validateAsync.flush();
|
|
3327
3394
|
}
|
|
3395
|
+
onValueChangeDebounced.flush();
|
|
3328
3396
|
},
|
|
3329
3397
|
onFocus() {
|
|
3330
3398
|
},
|
|
3331
3399
|
// Noop
|
|
3332
|
-
|
|
3333
|
-
const prevValue =
|
|
3334
|
-
|
|
3400
|
+
setValue(updatedValue) {
|
|
3401
|
+
const prevValue = component.value;
|
|
3402
|
+
update(component, (draft) => {
|
|
3335
3403
|
draft.errors = [];
|
|
3336
3404
|
draft.validationAsyncState.messages = {};
|
|
3337
3405
|
draft.value = updatedValue;
|
|
@@ -3339,32 +3407,32 @@ var createNumberInputComponent = (numberInputProps, onComponentUpdate) => {
|
|
|
3339
3407
|
performOnChange == null ? void 0 : performOnChange(prevValue, updatedValue);
|
|
3340
3408
|
const isValid = getValidationErrors(updatedValue).length === 0;
|
|
3341
3409
|
if (isValid) {
|
|
3342
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
3410
|
+
validateAsync == null ? void 0 : validateAsync(component, updatedValue);
|
|
3343
3411
|
}
|
|
3344
|
-
|
|
3412
|
+
onValueChangeDebounced();
|
|
3345
3413
|
},
|
|
3346
3414
|
async getSubmittableValue() {
|
|
3347
|
-
return
|
|
3415
|
+
return component.getSubmittableValueSync();
|
|
3348
3416
|
},
|
|
3349
3417
|
getSubmittableValueSync() {
|
|
3350
3418
|
var _a2;
|
|
3351
|
-
return (_a2 =
|
|
3419
|
+
return (_a2 = component.getLocalValue()) != null ? _a2 : null;
|
|
3352
3420
|
},
|
|
3353
3421
|
getSummary() {
|
|
3354
|
-
return summariser(
|
|
3422
|
+
return summariser(component.getLocalValue());
|
|
3355
3423
|
},
|
|
3356
3424
|
getLocalValue() {
|
|
3357
|
-
return
|
|
3425
|
+
return component.value;
|
|
3358
3426
|
},
|
|
3359
3427
|
validate() {
|
|
3360
|
-
const errors = getValidationErrors(
|
|
3361
|
-
|
|
3428
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
3429
|
+
update(component, (draft) => {
|
|
3362
3430
|
draft.errors = errors;
|
|
3363
3431
|
});
|
|
3364
3432
|
return errors.length === 0;
|
|
3365
3433
|
}
|
|
3366
3434
|
}, rest);
|
|
3367
|
-
return
|
|
3435
|
+
return component;
|
|
3368
3436
|
};
|
|
3369
3437
|
|
|
3370
3438
|
// src/domain/features/schema-on-change/getSchemaOnChange.ts
|
|
@@ -3396,7 +3464,8 @@ var getBehaviorFromSchemaRefreshStepOnChange = (schema) => {
|
|
|
3396
3464
|
const behavior = {
|
|
3397
3465
|
type: "refresh",
|
|
3398
3466
|
analytics: { schema: (_c = analyticsId != null ? analyticsId : $id) != null ? _c : "" },
|
|
3399
|
-
url: refreshUrl != null ? refreshUrl : refreshFormUrl
|
|
3467
|
+
url: refreshUrl != null ? refreshUrl : refreshFormUrl,
|
|
3468
|
+
track: false
|
|
3400
3469
|
};
|
|
3401
3470
|
return behavior;
|
|
3402
3471
|
}
|
|
@@ -3533,11 +3602,14 @@ var getRequiredCheck = (required, messageFunctions) => (value) => {
|
|
|
3533
3602
|
if (isArray(value) && value.length === 0) {
|
|
3534
3603
|
return messageFunctions.required();
|
|
3535
3604
|
}
|
|
3536
|
-
if (value === "") {
|
|
3537
|
-
return messageFunctions.required();
|
|
3538
|
-
}
|
|
3539
3605
|
return isNullish(value) ? messageFunctions.required() : null;
|
|
3540
3606
|
};
|
|
3607
|
+
var getStringRequiredCheck = (required, messageFunctions) => (value) => {
|
|
3608
|
+
if (!required) {
|
|
3609
|
+
return null;
|
|
3610
|
+
}
|
|
3611
|
+
return isNullish(value) || value === "" ? messageFunctions.required() : null;
|
|
3612
|
+
};
|
|
3541
3613
|
var getValidDateCheck = (required, messageFunctions) => (value) => {
|
|
3542
3614
|
if (required && !isValidDate(value)) {
|
|
3543
3615
|
return messageFunctions.required();
|
|
@@ -3799,9 +3871,16 @@ var schemaHasPlaceholder = (schema) => Boolean("placeholder" in schema && schema
|
|
|
3799
3871
|
|
|
3800
3872
|
// src/domain/mappers/schema/numberSchemaToComponent.ts
|
|
3801
3873
|
var numberSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
3802
|
-
const {
|
|
3874
|
+
const {
|
|
3875
|
+
schema,
|
|
3876
|
+
model,
|
|
3877
|
+
localValue,
|
|
3878
|
+
required = false,
|
|
3879
|
+
onPersistAsync,
|
|
3880
|
+
onValueChange
|
|
3881
|
+
} = schemaMapperProps;
|
|
3803
3882
|
const { autocompleteHint, validationMessages, default: defaultValue, maximum, minimum } = schema;
|
|
3804
|
-
const { getErrorMessageFunctions, onComponentUpdate, onBehavior
|
|
3883
|
+
const { getErrorMessageFunctions, onComponentUpdate, onBehavior } = mapperProps;
|
|
3805
3884
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
3806
3885
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
3807
3886
|
schemaMapperProps,
|
|
@@ -3852,7 +3931,7 @@ var isStringSchemaWithUpload = (schema) => isStringSchema(schema) && schema.form
|
|
|
3852
3931
|
var isSchemaWithPersistAsync = (schema) => "persistAsync" in schema && !isNullish(schema.persistAsync);
|
|
3853
3932
|
|
|
3854
3933
|
// src/domain/components/AllOfComponent.ts
|
|
3855
|
-
var createAllOfComponent = (
|
|
3934
|
+
var createAllOfComponent = (props) => {
|
|
3856
3935
|
const {
|
|
3857
3936
|
uid,
|
|
3858
3937
|
schemaId,
|
|
@@ -3866,8 +3945,8 @@ var createAllOfComponent = (allOfProps) => {
|
|
|
3866
3945
|
media,
|
|
3867
3946
|
title,
|
|
3868
3947
|
tags
|
|
3869
|
-
} =
|
|
3870
|
-
|
|
3948
|
+
} = props;
|
|
3949
|
+
const component = {
|
|
3871
3950
|
type: "all-of",
|
|
3872
3951
|
kind: "input",
|
|
3873
3952
|
uid,
|
|
@@ -3883,29 +3962,30 @@ var createAllOfComponent = (allOfProps) => {
|
|
|
3883
3962
|
title,
|
|
3884
3963
|
tags,
|
|
3885
3964
|
getChildren() {
|
|
3886
|
-
return
|
|
3965
|
+
return component.components;
|
|
3887
3966
|
},
|
|
3888
3967
|
getSummary() {
|
|
3889
|
-
return summariseFromChildren(
|
|
3968
|
+
return summariseFromChildren(component.getChildren());
|
|
3890
3969
|
},
|
|
3891
3970
|
async getSubmittableValue() {
|
|
3892
|
-
return getSubmittableData(
|
|
3971
|
+
return getSubmittableData(component.components);
|
|
3893
3972
|
},
|
|
3894
3973
|
getSubmittableValueSync() {
|
|
3895
|
-
return getSubmittableDataSync(
|
|
3974
|
+
return getSubmittableDataSync(component.components);
|
|
3896
3975
|
},
|
|
3897
3976
|
getLocalValue() {
|
|
3898
|
-
return getLocalValues(
|
|
3977
|
+
return getLocalValues(component.components);
|
|
3899
3978
|
},
|
|
3900
3979
|
validate() {
|
|
3901
|
-
return hidden ? true : validateComponents(
|
|
3980
|
+
return hidden ? true : validateComponents(component.getChildren());
|
|
3902
3981
|
}
|
|
3903
3982
|
};
|
|
3983
|
+
return component;
|
|
3904
3984
|
};
|
|
3905
3985
|
|
|
3906
3986
|
// src/domain/mappers/schema/allOfSchemaToComponent.ts
|
|
3907
3987
|
var allOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
3908
|
-
const { uid, schema, localValue, model, required, validationErrors } = schemaMapperProps;
|
|
3988
|
+
const { uid, schema, localValue, model, required, validationErrors, onValueChange } = schemaMapperProps;
|
|
3909
3989
|
const { allOf } = schema;
|
|
3910
3990
|
const components = allOf.map(
|
|
3911
3991
|
(childSchema, index) => mapSchemaToComponent(
|
|
@@ -3915,7 +3995,8 @@ var allOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
3915
3995
|
model,
|
|
3916
3996
|
localValue,
|
|
3917
3997
|
required,
|
|
3918
|
-
validationErrors
|
|
3998
|
+
validationErrors,
|
|
3999
|
+
onValueChange
|
|
3919
4000
|
},
|
|
3920
4001
|
mapperProps
|
|
3921
4002
|
)
|
|
@@ -3926,8 +4007,8 @@ var allOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
3926
4007
|
};
|
|
3927
4008
|
|
|
3928
4009
|
// src/domain/components/RepeatableComponent.ts
|
|
3929
|
-
var createRepeatableComponent = (
|
|
3930
|
-
const _a =
|
|
4010
|
+
var createRepeatableComponent = (props, onComponentUpdate) => {
|
|
4011
|
+
const _a = props, {
|
|
3931
4012
|
uid,
|
|
3932
4013
|
schemaId,
|
|
3933
4014
|
analyticsId,
|
|
@@ -3950,7 +4031,7 @@ var createRepeatableComponent = (repeatableProps, onComponentUpdate) => {
|
|
|
3950
4031
|
]);
|
|
3951
4032
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
3952
4033
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
3953
|
-
const
|
|
4034
|
+
const component = __spreadProps(__spreadValues({
|
|
3954
4035
|
uid,
|
|
3955
4036
|
schemaId,
|
|
3956
4037
|
analyticsId,
|
|
@@ -3965,37 +4046,34 @@ var createRepeatableComponent = (repeatableProps, onComponentUpdate) => {
|
|
|
3965
4046
|
media: summary == null ? void 0 : summary.defaultMedia
|
|
3966
4047
|
}
|
|
3967
4048
|
}, componentProps), {
|
|
3968
|
-
|
|
3969
|
-
update(
|
|
3970
|
-
},
|
|
3971
|
-
onEdit(itemIndex) {
|
|
3972
|
-
this._update((draft) => {
|
|
4049
|
+
editComponent(itemIndex) {
|
|
4050
|
+
update(component, (draft) => {
|
|
3973
4051
|
draft.editableComponent = createEditableComponent(
|
|
3974
4052
|
draft.components[itemIndex].getLocalValue()
|
|
3975
4053
|
);
|
|
3976
4054
|
draft.editableIndex = itemIndex;
|
|
3977
4055
|
});
|
|
3978
4056
|
},
|
|
3979
|
-
|
|
3980
|
-
|
|
4057
|
+
addComponent() {
|
|
4058
|
+
update(component, (draft) => {
|
|
3981
4059
|
draft.editableComponent = createEditableComponent(null);
|
|
3982
4060
|
draft.editableIndex = null;
|
|
3983
4061
|
draft.errors = [];
|
|
3984
4062
|
});
|
|
3985
4063
|
},
|
|
3986
|
-
|
|
4064
|
+
saveComponent() {
|
|
3987
4065
|
var _a2;
|
|
3988
|
-
const isValid = (_a2 =
|
|
4066
|
+
const isValid = (_a2 = component.editableComponent) == null ? void 0 : _a2.validate();
|
|
3989
4067
|
if (!isValid) {
|
|
3990
4068
|
return false;
|
|
3991
4069
|
}
|
|
3992
|
-
|
|
4070
|
+
update(component, (draft) => {
|
|
3993
4071
|
if (draft.editableComponent === null) {
|
|
3994
4072
|
return;
|
|
3995
4073
|
}
|
|
3996
4074
|
if (draft.editableIndex === null) {
|
|
3997
4075
|
const newComponent = __spreadValues({}, draft.editableComponent);
|
|
3998
|
-
draft.components = [...
|
|
4076
|
+
draft.components = [...component.components, newComponent];
|
|
3999
4077
|
} else {
|
|
4000
4078
|
draft.components[draft.editableIndex] = __spreadProps(__spreadValues({}, draft.editableComponent), {
|
|
4001
4079
|
uid: draft.components[draft.editableIndex].uid
|
|
@@ -4007,8 +4085,8 @@ var createRepeatableComponent = (repeatableProps, onComponentUpdate) => {
|
|
|
4007
4085
|
onValueChange();
|
|
4008
4086
|
return true;
|
|
4009
4087
|
},
|
|
4010
|
-
|
|
4011
|
-
|
|
4088
|
+
removeComponent() {
|
|
4089
|
+
update(component, (draft) => {
|
|
4012
4090
|
if (draft.editableIndex === null) {
|
|
4013
4091
|
return;
|
|
4014
4092
|
}
|
|
@@ -4019,30 +4097,32 @@ var createRepeatableComponent = (repeatableProps, onComponentUpdate) => {
|
|
|
4019
4097
|
onValueChange();
|
|
4020
4098
|
},
|
|
4021
4099
|
getChildren() {
|
|
4022
|
-
return
|
|
4100
|
+
return component.editableComponent !== null ? [...component.components, component.editableComponent] : component.components;
|
|
4023
4101
|
},
|
|
4024
4102
|
async getSubmittableValue() {
|
|
4025
|
-
return Promise.all(
|
|
4103
|
+
return Promise.all(
|
|
4104
|
+
component.components.map(async (childComponent) => childComponent.getSubmittableValue())
|
|
4105
|
+
);
|
|
4026
4106
|
},
|
|
4027
4107
|
getSubmittableValueSync() {
|
|
4028
|
-
return
|
|
4108
|
+
return component.components.map((childComponent) => childComponent.getSubmittableValueSync());
|
|
4029
4109
|
},
|
|
4030
4110
|
getSummary() {
|
|
4031
4111
|
return summariser(null);
|
|
4032
4112
|
},
|
|
4033
4113
|
getLocalValue() {
|
|
4034
|
-
return
|
|
4114
|
+
return component.components.map((childComponent) => childComponent.getLocalValue());
|
|
4035
4115
|
},
|
|
4036
4116
|
validate() {
|
|
4037
|
-
const messages = getValidationErrors(
|
|
4038
|
-
const childComponentsValid = validateComponents(
|
|
4039
|
-
|
|
4117
|
+
const messages = getValidationErrors(component.getLocalValue());
|
|
4118
|
+
const childComponentsValid = validateComponents(component.getChildren());
|
|
4119
|
+
update(component, (draft) => {
|
|
4040
4120
|
draft.errors = messages;
|
|
4041
4121
|
});
|
|
4042
4122
|
return messages.length === 0 && childComponentsValid;
|
|
4043
4123
|
}
|
|
4044
4124
|
});
|
|
4045
|
-
return
|
|
4125
|
+
return component;
|
|
4046
4126
|
};
|
|
4047
4127
|
|
|
4048
4128
|
// src/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.ts
|
|
@@ -4054,7 +4134,8 @@ var arraySchemaToRepeatableComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4054
4134
|
schema,
|
|
4055
4135
|
model: initialModel,
|
|
4056
4136
|
required = false,
|
|
4057
|
-
validationErrors
|
|
4137
|
+
validationErrors,
|
|
4138
|
+
onValueChange
|
|
4058
4139
|
} = schemaMapperProps;
|
|
4059
4140
|
const { items, addItemTitle, editItemTitle, maxItems, minItems, summary } = schema;
|
|
4060
4141
|
const value = isArray(localValue) ? localValue : [];
|
|
@@ -4066,7 +4147,8 @@ var arraySchemaToRepeatableComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4066
4147
|
model: item,
|
|
4067
4148
|
localValue: value == null ? void 0 : value[index],
|
|
4068
4149
|
// TODO tests for this
|
|
4069
|
-
validationErrors
|
|
4150
|
+
validationErrors,
|
|
4151
|
+
onValueChange
|
|
4070
4152
|
},
|
|
4071
4153
|
mapperProps
|
|
4072
4154
|
)
|
|
@@ -4078,11 +4160,11 @@ var arraySchemaToRepeatableComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4078
4160
|
localValue: editableValue,
|
|
4079
4161
|
model: localValueToJsonElement(editableValue),
|
|
4080
4162
|
validationErrors: void 0,
|
|
4081
|
-
required: true
|
|
4163
|
+
required: true,
|
|
4164
|
+
onValueChange
|
|
4082
4165
|
},
|
|
4083
4166
|
mapperProps
|
|
4084
4167
|
);
|
|
4085
|
-
const { onValueChange } = mapperProps;
|
|
4086
4168
|
const errorMessageFunctions = getErrorMessageFunctions(schema.validationMessages);
|
|
4087
4169
|
return createRepeatableComponent(
|
|
4088
4170
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
@@ -4192,8 +4274,8 @@ var base64ToBytes = (base64) => {
|
|
|
4192
4274
|
};
|
|
4193
4275
|
|
|
4194
4276
|
// src/domain/components/MultiUploadInputComponent.ts
|
|
4195
|
-
var createMultiUploadInputComponent = (
|
|
4196
|
-
const _a =
|
|
4277
|
+
var createMultiUploadInputComponent = (props, onComponentUpdate) => {
|
|
4278
|
+
const _a = props, {
|
|
4197
4279
|
uid,
|
|
4198
4280
|
id,
|
|
4199
4281
|
checks,
|
|
@@ -4216,77 +4298,74 @@ var createMultiUploadInputComponent = (uploadInputProps, onComponentUpdate) => {
|
|
|
4216
4298
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
4217
4299
|
const getFileValidationErrors = getLocalValueValidator(fileChecks);
|
|
4218
4300
|
const persist = performPersistAsync ? getComponentMultiPersistAsync(update, performPersistAsync) : void 0;
|
|
4219
|
-
const
|
|
4301
|
+
const component = __spreadValues({
|
|
4220
4302
|
type: "multi-upload",
|
|
4221
4303
|
kind: "input",
|
|
4222
4304
|
uid,
|
|
4223
4305
|
id,
|
|
4224
4306
|
format,
|
|
4225
4307
|
files: [],
|
|
4226
|
-
_update(updateFn) {
|
|
4227
|
-
update(this, updateFn);
|
|
4228
|
-
},
|
|
4229
4308
|
onBlur() {
|
|
4230
|
-
|
|
4309
|
+
component.validate();
|
|
4231
4310
|
},
|
|
4232
4311
|
onFocus() {
|
|
4233
4312
|
},
|
|
4234
4313
|
// Noop
|
|
4235
|
-
async
|
|
4314
|
+
async removeFile(index) {
|
|
4236
4315
|
var _a2;
|
|
4237
|
-
|
|
4316
|
+
update(component, (draft) => {
|
|
4238
4317
|
draft.value.splice(index, 1);
|
|
4239
4318
|
draft.files.splice(index, 1);
|
|
4240
4319
|
});
|
|
4241
4320
|
if (persist) {
|
|
4242
|
-
(_a2 =
|
|
4243
|
-
|
|
4321
|
+
(_a2 = component.persistedState[index]) == null ? void 0 : _a2.abortController.abort();
|
|
4322
|
+
update(component, (draft) => {
|
|
4244
4323
|
draft.persistedState.splice(index, 1);
|
|
4245
4324
|
});
|
|
4246
4325
|
}
|
|
4247
4326
|
},
|
|
4248
|
-
async
|
|
4327
|
+
async insertFile(index, file) {
|
|
4249
4328
|
const fileErrors = getFileValidationErrors(file);
|
|
4250
4329
|
const fileId = getRandomId();
|
|
4251
4330
|
const base64Value = format === "base64" ? await toBase64(file) : null;
|
|
4252
|
-
|
|
4331
|
+
update(component, (draft) => {
|
|
4253
4332
|
draft.value.splice(index, 0, file);
|
|
4254
4333
|
draft.files.splice(index, 0, { file, id: fileId, errors: fileErrors, base64Value });
|
|
4255
4334
|
draft.errors = [];
|
|
4256
4335
|
});
|
|
4257
4336
|
if (persist) {
|
|
4258
|
-
await persist(
|
|
4337
|
+
await persist(component, index, format === "blob" ? file : base64Value);
|
|
4259
4338
|
}
|
|
4260
4339
|
onValueChange();
|
|
4261
4340
|
return fileId;
|
|
4262
4341
|
},
|
|
4263
4342
|
async getSubmittableValue() {
|
|
4264
4343
|
if (persist) {
|
|
4265
|
-
return Promise.all(
|
|
4344
|
+
return Promise.all(component.persistedState.map(async ({ submission }) => submission));
|
|
4266
4345
|
}
|
|
4267
|
-
return
|
|
4346
|
+
return component.files.map(({ base64Value }) => base64Value);
|
|
4268
4347
|
},
|
|
4269
4348
|
getSubmittableValueSync() {
|
|
4270
4349
|
if (persist) {
|
|
4271
|
-
return
|
|
4350
|
+
return component.persistedState.map(({ lastResponse }) => lastResponse);
|
|
4272
4351
|
}
|
|
4273
|
-
return
|
|
4352
|
+
return component.files.map(({ base64Value }) => base64Value);
|
|
4274
4353
|
},
|
|
4275
4354
|
getSummary() {
|
|
4276
|
-
return summariser(
|
|
4355
|
+
return summariser(component.getLocalValue().map(({ name }) => name));
|
|
4277
4356
|
},
|
|
4278
4357
|
getLocalValue() {
|
|
4279
|
-
return
|
|
4358
|
+
return component.value;
|
|
4280
4359
|
},
|
|
4281
4360
|
validate() {
|
|
4282
|
-
const errorMsgs = getValidationErrors(
|
|
4283
|
-
|
|
4361
|
+
const errorMsgs = getValidationErrors(component.getLocalValue());
|
|
4362
|
+
update(component, (draft) => {
|
|
4284
4363
|
draft.errors = errorMsgs;
|
|
4285
4364
|
});
|
|
4286
|
-
return errorMsgs.length === 0 &&
|
|
4365
|
+
return errorMsgs.length === 0 && component.files.every(({ errors }) => errors.length === 0);
|
|
4287
4366
|
}
|
|
4288
4367
|
}, rest);
|
|
4289
|
-
return
|
|
4368
|
+
return component;
|
|
4290
4369
|
};
|
|
4291
4370
|
|
|
4292
4371
|
// src/domain/features/persistAsync/getInitialPersistedState.ts
|
|
@@ -4369,7 +4448,7 @@ var schemaHasValidationMessages = (schema) => Boolean("validationMessages" in sc
|
|
|
4369
4448
|
var arraySchemaToMultiUploadComponent = (schemaMapperProps, mapperProps) => {
|
|
4370
4449
|
var _a;
|
|
4371
4450
|
const { getErrorMessageFunctions } = mapperProps;
|
|
4372
|
-
const { localValue, model, schema, required = false } = schemaMapperProps;
|
|
4451
|
+
const { localValue, model, schema, required = false, onValueChange } = schemaMapperProps;
|
|
4373
4452
|
const uploadSchema = getUploadSchema(schema.items);
|
|
4374
4453
|
const { accepts, cameraConfig, maxSize } = uploadSchema;
|
|
4375
4454
|
const { minItems, maxItems, title, validationMessages } = schema;
|
|
@@ -4390,7 +4469,6 @@ var arraySchemaToMultiUploadComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4390
4469
|
persistAsyncConfig,
|
|
4391
4470
|
schema: __spreadProps(__spreadValues({}, uploadSchema), { hidden: (_a = schema.hidden) != null ? _a : uploadSchema.hidden, alert: schema.alert })
|
|
4392
4471
|
});
|
|
4393
|
-
const { onValueChange } = mapperProps;
|
|
4394
4472
|
const performPersistAsync = persistAsyncConfig ? getPerformPersistAsyncFn(combinedSchemaProps.schema, persistAsyncConfig, mapperProps) : void 0;
|
|
4395
4473
|
const value = performPersistAsync ? getValueForPersistAsync(localValue) : [];
|
|
4396
4474
|
const persistedState = performPersistAsync && isArray(model) ? model.map((itemModel) => getInitialPersistedState(null, itemModel)) : [];
|
|
@@ -4440,8 +4518,8 @@ var getPersistAsyncConfig = (schema) => {
|
|
|
4440
4518
|
var getValueForPersistAsync = (localValue) => isArray(localValue) && localValue.every(isFile) ? localValue : [];
|
|
4441
4519
|
|
|
4442
4520
|
// src/domain/components/MultiSelectInputComponent.ts
|
|
4443
|
-
var createMultiSelectComponent = (
|
|
4444
|
-
const _a =
|
|
4521
|
+
var createMultiSelectComponent = (props, onComponentUpdate) => {
|
|
4522
|
+
const _a = props, {
|
|
4445
4523
|
uid,
|
|
4446
4524
|
checks,
|
|
4447
4525
|
options,
|
|
@@ -4472,21 +4550,18 @@ var createMultiSelectComponent = (multiSelectProps, onComponentUpdate) => {
|
|
|
4472
4550
|
selectedIndices,
|
|
4473
4551
|
value: null
|
|
4474
4552
|
}, rest), {
|
|
4475
|
-
|
|
4476
|
-
update(
|
|
4477
|
-
},
|
|
4478
|
-
onSelect(indices) {
|
|
4479
|
-
this._update((draft) => {
|
|
4553
|
+
selectIndices(indices) {
|
|
4554
|
+
update(component, (draft) => {
|
|
4480
4555
|
draft.selectedIndices = indices;
|
|
4481
4556
|
draft.errors = [];
|
|
4482
4557
|
});
|
|
4483
4558
|
void (schemaOnChange == null ? void 0 : schemaOnChange());
|
|
4484
|
-
const errors = getValidationErrors(
|
|
4485
|
-
|
|
4559
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
4560
|
+
update(component, (draft) => {
|
|
4486
4561
|
draft.errors = errors;
|
|
4487
4562
|
});
|
|
4488
|
-
if (
|
|
4489
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
4563
|
+
if (component.validate()) {
|
|
4564
|
+
validateAsync == null ? void 0 : validateAsync(component, component.getLocalValue()).catch(() => {
|
|
4490
4565
|
});
|
|
4491
4566
|
}
|
|
4492
4567
|
onValueChange();
|
|
@@ -4499,17 +4574,17 @@ var createMultiSelectComponent = (multiSelectProps, onComponentUpdate) => {
|
|
|
4499
4574
|
// Noop
|
|
4500
4575
|
getLocalValue() {
|
|
4501
4576
|
var _a2, _b;
|
|
4502
|
-
return (_b = (_a2 =
|
|
4577
|
+
return (_b = (_a2 = component.getSelectedChildren()) == null ? void 0 : _a2.map((child) => child.getLocalValue())) != null ? _b : null;
|
|
4503
4578
|
},
|
|
4504
4579
|
validate() {
|
|
4505
|
-
const errors = getValidationErrors(
|
|
4506
|
-
|
|
4580
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
4581
|
+
update(component, (draft) => {
|
|
4507
4582
|
draft.errors = errors;
|
|
4508
4583
|
});
|
|
4509
4584
|
return errors.length === 0;
|
|
4510
4585
|
},
|
|
4511
4586
|
async getSubmittableValue() {
|
|
4512
|
-
const selected =
|
|
4587
|
+
const selected = component.getSelectedChildren();
|
|
4513
4588
|
if (selected) {
|
|
4514
4589
|
return Promise.all(selected.map(async (child) => child.getSubmittableValue()));
|
|
4515
4590
|
}
|
|
@@ -4517,14 +4592,14 @@ var createMultiSelectComponent = (multiSelectProps, onComponentUpdate) => {
|
|
|
4517
4592
|
},
|
|
4518
4593
|
getSubmittableValueSync() {
|
|
4519
4594
|
var _a2, _b;
|
|
4520
|
-
return (_b = (_a2 =
|
|
4595
|
+
return (_b = (_a2 = component.getSelectedChildren()) == null ? void 0 : _a2.map((child) => child.getSubmittableValueSync())) != null ? _b : null;
|
|
4521
4596
|
},
|
|
4522
4597
|
getSummary: () => ({}),
|
|
4523
4598
|
getChildren() {
|
|
4524
|
-
return
|
|
4599
|
+
return component.children;
|
|
4525
4600
|
},
|
|
4526
4601
|
getSelectedChildren() {
|
|
4527
|
-
return
|
|
4602
|
+
return component.selectedIndices.map((i) => component.children[i]);
|
|
4528
4603
|
}
|
|
4529
4604
|
});
|
|
4530
4605
|
return component;
|
|
@@ -4544,7 +4619,8 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4544
4619
|
schema,
|
|
4545
4620
|
model,
|
|
4546
4621
|
required = false,
|
|
4547
|
-
validationErrors: initialError
|
|
4622
|
+
validationErrors: initialError,
|
|
4623
|
+
onValueChange
|
|
4548
4624
|
} = schemaMapperProps;
|
|
4549
4625
|
const initialModel = model != null ? model : null;
|
|
4550
4626
|
const options = schema.items.oneOf.map((childSchema, index) => {
|
|
@@ -4568,14 +4644,15 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4568
4644
|
model: initialModel,
|
|
4569
4645
|
localValue,
|
|
4570
4646
|
validationErrors: initialError,
|
|
4571
|
-
required
|
|
4647
|
+
required,
|
|
4648
|
+
onValueChange
|
|
4572
4649
|
},
|
|
4573
4650
|
mapperProps
|
|
4574
4651
|
)
|
|
4575
4652
|
};
|
|
4576
4653
|
});
|
|
4577
4654
|
const { maxItems, minItems, title, validationMessages } = schema;
|
|
4578
|
-
const { getErrorMessageFunctions, onBehavior,
|
|
4655
|
+
const { getErrorMessageFunctions, onBehavior, onComponentUpdate } = mapperProps;
|
|
4579
4656
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
4580
4657
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
4581
4658
|
schemaMapperProps,
|
|
@@ -4606,7 +4683,7 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4606
4683
|
};
|
|
4607
4684
|
|
|
4608
4685
|
// src/domain/components/TupleComponent.ts
|
|
4609
|
-
var createTupleComponent = (
|
|
4686
|
+
var createTupleComponent = (props) => {
|
|
4610
4687
|
const {
|
|
4611
4688
|
uid,
|
|
4612
4689
|
schemaId,
|
|
@@ -4621,8 +4698,8 @@ var createTupleComponent = (tupleProps) => {
|
|
|
4621
4698
|
summariser,
|
|
4622
4699
|
title,
|
|
4623
4700
|
tags
|
|
4624
|
-
} =
|
|
4625
|
-
|
|
4701
|
+
} = props;
|
|
4702
|
+
const component = {
|
|
4626
4703
|
type: "tuple",
|
|
4627
4704
|
kind: "input",
|
|
4628
4705
|
uid,
|
|
@@ -4638,26 +4715,27 @@ var createTupleComponent = (tupleProps) => {
|
|
|
4638
4715
|
title,
|
|
4639
4716
|
tags,
|
|
4640
4717
|
getChildren() {
|
|
4641
|
-
return
|
|
4718
|
+
return component.components;
|
|
4642
4719
|
},
|
|
4643
4720
|
async getSubmittableValue() {
|
|
4644
|
-
return Promise.all(
|
|
4721
|
+
return Promise.all(component.components.map(async (child) => child.getSubmittableValue()));
|
|
4645
4722
|
},
|
|
4646
4723
|
getSubmittableValueSync() {
|
|
4647
|
-
return
|
|
4724
|
+
return component.components.map((child) => child.getSubmittableValueSync());
|
|
4648
4725
|
},
|
|
4649
4726
|
getSummary() {
|
|
4650
|
-
const summary = summariser(
|
|
4651
|
-
const childSummary = summariseFromChildren(
|
|
4727
|
+
const summary = summariser(component.getLocalValue());
|
|
4728
|
+
const childSummary = summariseFromChildren(component.getChildren());
|
|
4652
4729
|
return mergeSummaries(summary, childSummary);
|
|
4653
4730
|
},
|
|
4654
4731
|
getLocalValue() {
|
|
4655
|
-
return
|
|
4732
|
+
return component.components.map((child) => child.getLocalValue());
|
|
4656
4733
|
},
|
|
4657
4734
|
validate() {
|
|
4658
|
-
return hidden ? true : validateComponents(
|
|
4735
|
+
return hidden ? true : validateComponents(component.getChildren());
|
|
4659
4736
|
}
|
|
4660
4737
|
};
|
|
4738
|
+
return component;
|
|
4661
4739
|
};
|
|
4662
4740
|
|
|
4663
4741
|
// src/domain/mappers/schema/arraySchemaToComponent/arraySchemaToTupleComponent.ts
|
|
@@ -4668,7 +4746,8 @@ var arraySchemaToTupleComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4668
4746
|
schema,
|
|
4669
4747
|
model: initialModel,
|
|
4670
4748
|
required = false,
|
|
4671
|
-
validationErrors
|
|
4749
|
+
validationErrors,
|
|
4750
|
+
onValueChange
|
|
4672
4751
|
} = schemaMapperProps;
|
|
4673
4752
|
const { items } = schema;
|
|
4674
4753
|
const components = items.map(
|
|
@@ -4681,7 +4760,8 @@ var arraySchemaToTupleComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4681
4760
|
model: isArray(initialModel) ? (_a = initialModel[index]) != null ? _a : null : null,
|
|
4682
4761
|
localValue: isArray(localValue) ? (_b = localValue[index]) != null ? _b : null : null,
|
|
4683
4762
|
validationErrors: isArray(validationErrors) ? validationErrors[index] : void 0,
|
|
4684
|
-
required
|
|
4763
|
+
required,
|
|
4764
|
+
onValueChange
|
|
4685
4765
|
},
|
|
4686
4766
|
mapperProps
|
|
4687
4767
|
);
|
|
@@ -4712,8 +4792,8 @@ var isPersistAsyncWithUploadSchema = (schema) => isSchemaWithPersistAsync(schema
|
|
|
4712
4792
|
var isArraySchemaListWithMultiSelect = (schema) => isArrayListSchema(schema) && "oneOf" in schema.items && schema.items.oneOf.every(isConstSchema);
|
|
4713
4793
|
|
|
4714
4794
|
// src/domain/components/UploadInputComponent.ts
|
|
4715
|
-
var createUploadInputComponent = (
|
|
4716
|
-
const _a =
|
|
4795
|
+
var createUploadInputComponent = (props, onComponentUpdate) => {
|
|
4796
|
+
const _a = props, {
|
|
4717
4797
|
uid,
|
|
4718
4798
|
id,
|
|
4719
4799
|
checks,
|
|
@@ -4736,7 +4816,7 @@ var createUploadInputComponent = (uploadInputProps, onComponentUpdate) => {
|
|
|
4736
4816
|
]);
|
|
4737
4817
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
4738
4818
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
4739
|
-
const
|
|
4819
|
+
const component = __spreadValues({
|
|
4740
4820
|
type: "upload",
|
|
4741
4821
|
kind: "input",
|
|
4742
4822
|
uid,
|
|
@@ -4744,18 +4824,15 @@ var createUploadInputComponent = (uploadInputProps, onComponentUpdate) => {
|
|
|
4744
4824
|
format,
|
|
4745
4825
|
value,
|
|
4746
4826
|
base64Value: null,
|
|
4747
|
-
_update(updateFn) {
|
|
4748
|
-
update(this, updateFn);
|
|
4749
|
-
},
|
|
4750
4827
|
onBlur() {
|
|
4751
|
-
|
|
4828
|
+
component.validate();
|
|
4752
4829
|
},
|
|
4753
4830
|
onFocus() {
|
|
4754
4831
|
},
|
|
4755
4832
|
// Noop
|
|
4756
|
-
async
|
|
4757
|
-
const base64Value =
|
|
4758
|
-
|
|
4833
|
+
async setValue(updatedValue) {
|
|
4834
|
+
const base64Value = component.format === "base64" && updatedValue ? await toBase64(updatedValue) : null;
|
|
4835
|
+
update(component, (draft) => {
|
|
4759
4836
|
draft.errors = [];
|
|
4760
4837
|
draft.value = updatedValue;
|
|
4761
4838
|
draft.base64Value = base64Value;
|
|
@@ -4763,57 +4840,61 @@ var createUploadInputComponent = (uploadInputProps, onComponentUpdate) => {
|
|
|
4763
4840
|
void (schemaOnChange == null ? void 0 : schemaOnChange());
|
|
4764
4841
|
onValueChange();
|
|
4765
4842
|
await (onPersistAsync == null ? void 0 : onPersistAsync().catch((e) => {
|
|
4766
|
-
|
|
4843
|
+
update(component, (draft) => {
|
|
4767
4844
|
draft.value = null;
|
|
4768
4845
|
});
|
|
4769
4846
|
throw e;
|
|
4770
4847
|
}));
|
|
4771
4848
|
},
|
|
4772
4849
|
async getSubmittableValue() {
|
|
4773
|
-
const file =
|
|
4774
|
-
if (
|
|
4850
|
+
const file = component.getLocalValue();
|
|
4851
|
+
if (component.format === "base64" && file) {
|
|
4775
4852
|
return toBase64(file);
|
|
4776
4853
|
}
|
|
4777
4854
|
return null;
|
|
4778
4855
|
},
|
|
4779
4856
|
getSubmittableValueSync() {
|
|
4780
|
-
return
|
|
4857
|
+
return component.base64Value;
|
|
4781
4858
|
},
|
|
4782
4859
|
getSummary() {
|
|
4783
4860
|
var _a2, _b;
|
|
4784
|
-
return summariser((_b = (_a2 =
|
|
4861
|
+
return summariser((_b = (_a2 = component.getLocalValue()) == null ? void 0 : _a2.name) != null ? _b : null);
|
|
4785
4862
|
},
|
|
4786
4863
|
getLocalValue() {
|
|
4787
|
-
return
|
|
4864
|
+
return component.value;
|
|
4788
4865
|
},
|
|
4789
4866
|
validate() {
|
|
4790
|
-
const errors = getValidationErrors(
|
|
4791
|
-
|
|
4867
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
4868
|
+
update(component, (draft) => {
|
|
4792
4869
|
draft.errors = errors;
|
|
4793
4870
|
});
|
|
4794
4871
|
return errors.length === 0;
|
|
4795
4872
|
}
|
|
4796
4873
|
}, rest);
|
|
4797
4874
|
if (format === "base64" && value && !onPersistAsync) {
|
|
4798
|
-
void
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
const base64Value = format === "base64" && value ? await toBase64(value) : null;
|
|
4805
|
-
if (base64Value) {
|
|
4806
|
-
uploadComponent._update((draft) => {
|
|
4807
|
-
draft.base64Value = base64Value;
|
|
4875
|
+
void toBase64(value).then((base64Value) => {
|
|
4876
|
+
if (base64Value) {
|
|
4877
|
+
update(component, (draft) => {
|
|
4878
|
+
draft.base64Value = base64Value;
|
|
4879
|
+
});
|
|
4880
|
+
}
|
|
4808
4881
|
});
|
|
4809
4882
|
}
|
|
4883
|
+
return component;
|
|
4810
4884
|
};
|
|
4811
4885
|
|
|
4812
4886
|
// src/domain/mappers/schema/blobSchemaToComponent.ts
|
|
4813
4887
|
var blobSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
4814
|
-
const {
|
|
4888
|
+
const {
|
|
4889
|
+
schema,
|
|
4890
|
+
localValue,
|
|
4891
|
+
model,
|
|
4892
|
+
required = false,
|
|
4893
|
+
onPersistAsync,
|
|
4894
|
+
onValueChange
|
|
4895
|
+
} = schemaMapperProps;
|
|
4815
4896
|
const { accepts, cameraConfig, maxSize, source, validationMessages } = schema;
|
|
4816
|
-
const { getErrorMessageFunctions, onComponentUpdate
|
|
4897
|
+
const { getErrorMessageFunctions, onComponentUpdate } = mapperProps;
|
|
4817
4898
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
4818
4899
|
const validLocalValue = isFile(localValue) ? localValue : null;
|
|
4819
4900
|
const value = onPersistAsync && model !== null ? validLocalValue : null;
|
|
@@ -4835,8 +4916,8 @@ var blobSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
4835
4916
|
};
|
|
4836
4917
|
|
|
4837
4918
|
// src/domain/components/BooleanInputComponent.ts
|
|
4838
|
-
var createBooleanInputComponent = (
|
|
4839
|
-
const _a =
|
|
4919
|
+
var createBooleanInputComponent = (props, onComponentUpdate) => {
|
|
4920
|
+
const _a = props, {
|
|
4840
4921
|
uid,
|
|
4841
4922
|
id,
|
|
4842
4923
|
value,
|
|
@@ -4857,56 +4938,53 @@ var createBooleanInputComponent = (booleanInputProps, onComponentUpdate) => {
|
|
|
4857
4938
|
]);
|
|
4858
4939
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
4859
4940
|
const validateAsync = performValidationAsync ? getComponentValidationAsync(update, performValidationAsync) : void 0;
|
|
4860
|
-
const
|
|
4941
|
+
const component = __spreadValues({
|
|
4861
4942
|
type: "boolean",
|
|
4862
4943
|
kind: "input",
|
|
4863
4944
|
uid,
|
|
4864
4945
|
id,
|
|
4865
4946
|
autoComplete: "",
|
|
4866
4947
|
value,
|
|
4867
|
-
_update(updateFn) {
|
|
4868
|
-
update(this, updateFn);
|
|
4869
|
-
},
|
|
4870
4948
|
onBlur() {
|
|
4871
4949
|
},
|
|
4872
4950
|
// Noop
|
|
4873
4951
|
onFocus() {
|
|
4874
4952
|
},
|
|
4875
4953
|
// Noop
|
|
4876
|
-
|
|
4877
|
-
|
|
4954
|
+
setValue(updatedValue) {
|
|
4955
|
+
update(component, (draft) => {
|
|
4878
4956
|
draft.errors = [];
|
|
4879
4957
|
draft.value = updatedValue;
|
|
4880
4958
|
});
|
|
4881
4959
|
void (schemaOnChange == null ? void 0 : schemaOnChange());
|
|
4882
4960
|
void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
|
|
4883
4961
|
}));
|
|
4884
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
4962
|
+
validateAsync == null ? void 0 : validateAsync(component, component.getLocalValue()).catch(() => {
|
|
4885
4963
|
});
|
|
4886
4964
|
onValueChange();
|
|
4887
4965
|
},
|
|
4888
4966
|
async getSubmittableValue() {
|
|
4889
|
-
return
|
|
4967
|
+
return component.getSubmittableValueSync();
|
|
4890
4968
|
},
|
|
4891
4969
|
getSubmittableValueSync() {
|
|
4892
|
-
return
|
|
4970
|
+
return component.getLocalValue();
|
|
4893
4971
|
},
|
|
4894
4972
|
getSummary() {
|
|
4895
|
-
return summariser(
|
|
4973
|
+
return summariser(component.getLocalValue());
|
|
4896
4974
|
},
|
|
4897
4975
|
getLocalValue() {
|
|
4898
|
-
return
|
|
4976
|
+
return component.value;
|
|
4899
4977
|
},
|
|
4900
4978
|
validate: () => true
|
|
4901
4979
|
}, rest);
|
|
4902
|
-
return
|
|
4980
|
+
return component;
|
|
4903
4981
|
};
|
|
4904
4982
|
|
|
4905
4983
|
// src/domain/mappers/schema/booleanSchemaToComponent.ts
|
|
4906
4984
|
var booleanSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
4907
|
-
const { schema, localValue, model, onPersistAsync } = schemaMapperProps;
|
|
4985
|
+
const { schema, localValue, model, onPersistAsync, onValueChange } = schemaMapperProps;
|
|
4908
4986
|
const { default: defaultValue, additionalText, inlineAlert, supportingValues } = schema;
|
|
4909
|
-
const { onComponentUpdate, onBehavior
|
|
4987
|
+
const { onComponentUpdate, onBehavior } = mapperProps;
|
|
4910
4988
|
const schemaOnChange = getSchemaOnChange(schema, onBehavior);
|
|
4911
4989
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
4912
4990
|
schemaMapperProps,
|
|
@@ -4940,8 +5018,8 @@ var getValidModel = (model, defaultValue) => {
|
|
|
4940
5018
|
};
|
|
4941
5019
|
|
|
4942
5020
|
// src/domain/components/ConstComponent.ts
|
|
4943
|
-
var createConstComponent = (
|
|
4944
|
-
const { uid, schemaId, analyticsId, value, summary, layout, hidden, tags } =
|
|
5021
|
+
var createConstComponent = (props) => {
|
|
5022
|
+
const { uid, schemaId, analyticsId, value, summary, layout, hidden, tags } = props;
|
|
4945
5023
|
return {
|
|
4946
5024
|
type: "const",
|
|
4947
5025
|
kind: "input",
|
|
@@ -4984,8 +5062,8 @@ var getConstLayout = (uid, mapperProps, layout, alert) => {
|
|
|
4984
5062
|
};
|
|
4985
5063
|
|
|
4986
5064
|
// src/domain/components/IntegerInputComponent.ts
|
|
4987
|
-
var createIntegerInputComponent = (
|
|
4988
|
-
const _a =
|
|
5065
|
+
var createIntegerInputComponent = (props, onComponentUpdate) => {
|
|
5066
|
+
const _a = props, {
|
|
4989
5067
|
uid,
|
|
4990
5068
|
id,
|
|
4991
5069
|
checks,
|
|
@@ -5007,33 +5085,32 @@ var createIntegerInputComponent = (integerInputProps, onComponentUpdate) => {
|
|
|
5007
5085
|
"summariser"
|
|
5008
5086
|
]);
|
|
5009
5087
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
5088
|
+
const onValueChangeDebounced = debounce(onValueChange, 1e3);
|
|
5010
5089
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
5011
5090
|
const performOnChange = getDebouncedSchemaOnChange(schemaOnChange, getValidationErrors);
|
|
5012
5091
|
const validateAsync = performValidationAsync ? getDebouncedComponentValidationAsync(update, performValidationAsync) : void 0;
|
|
5013
|
-
const
|
|
5092
|
+
const component = __spreadValues({
|
|
5014
5093
|
type: "integer",
|
|
5015
5094
|
kind: "input",
|
|
5016
5095
|
uid,
|
|
5017
5096
|
id,
|
|
5018
5097
|
value,
|
|
5019
|
-
_update(updateFn) {
|
|
5020
|
-
update(this, updateFn);
|
|
5021
|
-
},
|
|
5022
5098
|
onBlur() {
|
|
5023
|
-
const isValid =
|
|
5099
|
+
const isValid = component.validate();
|
|
5024
5100
|
performOnChange == null ? void 0 : performOnChange.flush();
|
|
5025
5101
|
if (isValid) {
|
|
5026
5102
|
void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
|
|
5027
5103
|
}));
|
|
5028
5104
|
validateAsync == null ? void 0 : validateAsync.flush();
|
|
5029
5105
|
}
|
|
5106
|
+
onValueChangeDebounced.flush();
|
|
5030
5107
|
},
|
|
5031
5108
|
onFocus() {
|
|
5032
5109
|
},
|
|
5033
5110
|
// Noop
|
|
5034
|
-
|
|
5035
|
-
const prevValue =
|
|
5036
|
-
|
|
5111
|
+
setValue(updatedValue) {
|
|
5112
|
+
const prevValue = component.value;
|
|
5113
|
+
update(component, (draft) => {
|
|
5037
5114
|
draft.errors = [];
|
|
5038
5115
|
draft.validationAsyncState.messages = {};
|
|
5039
5116
|
draft.value = updatedValue;
|
|
@@ -5041,39 +5118,46 @@ var createIntegerInputComponent = (integerInputProps, onComponentUpdate) => {
|
|
|
5041
5118
|
performOnChange == null ? void 0 : performOnChange(prevValue, updatedValue);
|
|
5042
5119
|
const isValid = getValidationErrors(updatedValue).length === 0;
|
|
5043
5120
|
if (isValid) {
|
|
5044
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
5121
|
+
validateAsync == null ? void 0 : validateAsync(component, updatedValue);
|
|
5045
5122
|
}
|
|
5046
|
-
|
|
5123
|
+
onValueChangeDebounced();
|
|
5047
5124
|
},
|
|
5048
5125
|
async getSubmittableValue() {
|
|
5049
|
-
return
|
|
5126
|
+
return component.getSubmittableValueSync();
|
|
5050
5127
|
},
|
|
5051
5128
|
getSubmittableValueSync() {
|
|
5052
5129
|
var _a2;
|
|
5053
|
-
return (_a2 =
|
|
5130
|
+
return (_a2 = component.getLocalValue()) != null ? _a2 : null;
|
|
5054
5131
|
},
|
|
5055
5132
|
getSummary() {
|
|
5056
|
-
return summariser(
|
|
5133
|
+
return summariser(component.getLocalValue());
|
|
5057
5134
|
},
|
|
5058
5135
|
getLocalValue() {
|
|
5059
|
-
return
|
|
5136
|
+
return component.value;
|
|
5060
5137
|
},
|
|
5061
5138
|
validate() {
|
|
5062
|
-
const errors = getValidationErrors(
|
|
5063
|
-
|
|
5139
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
5140
|
+
update(component, (draft) => {
|
|
5064
5141
|
draft.errors = errors;
|
|
5065
5142
|
});
|
|
5066
5143
|
return errors.length === 0;
|
|
5067
5144
|
}
|
|
5068
5145
|
}, rest);
|
|
5069
|
-
return
|
|
5146
|
+
return component;
|
|
5070
5147
|
};
|
|
5071
5148
|
|
|
5072
5149
|
// src/domain/mappers/schema/integerSchemaToComponent.ts
|
|
5073
5150
|
var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
5074
|
-
const {
|
|
5151
|
+
const {
|
|
5152
|
+
schema,
|
|
5153
|
+
localValue,
|
|
5154
|
+
model,
|
|
5155
|
+
required = false,
|
|
5156
|
+
onPersistAsync,
|
|
5157
|
+
onValueChange
|
|
5158
|
+
} = schemaMapperProps;
|
|
5075
5159
|
const { autocompleteHint, validationMessages, default: defaultValue, maximum, minimum } = schema;
|
|
5076
|
-
const { getErrorMessageFunctions, onComponentUpdate, onBehavior
|
|
5160
|
+
const { getErrorMessageFunctions, onComponentUpdate, onBehavior } = mapperProps;
|
|
5077
5161
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
5078
5162
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
5079
5163
|
schemaMapperProps,
|
|
@@ -5124,7 +5208,7 @@ var createFormattedValueComponent = (props, onComponentUpdate) => {
|
|
|
5124
5208
|
schemaOnChange
|
|
5125
5209
|
} = props;
|
|
5126
5210
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
5127
|
-
|
|
5211
|
+
const component = {
|
|
5128
5212
|
type: "formatted-value",
|
|
5129
5213
|
kind: "input",
|
|
5130
5214
|
uid,
|
|
@@ -5142,27 +5226,28 @@ var createFormattedValueComponent = (props, onComponentUpdate) => {
|
|
|
5142
5226
|
tags,
|
|
5143
5227
|
value,
|
|
5144
5228
|
async getSubmittableValue() {
|
|
5145
|
-
return
|
|
5229
|
+
return component.getSubmittableValueSync();
|
|
5146
5230
|
},
|
|
5147
5231
|
getSubmittableValueSync() {
|
|
5148
|
-
return
|
|
5232
|
+
return component.getLocalValue();
|
|
5149
5233
|
},
|
|
5150
5234
|
getSummary() {
|
|
5151
|
-
return summariser(
|
|
5235
|
+
return summariser(component.getLocalValue());
|
|
5152
5236
|
},
|
|
5153
5237
|
getLocalValue() {
|
|
5154
|
-
return
|
|
5238
|
+
return component.value;
|
|
5155
5239
|
},
|
|
5156
5240
|
validate() {
|
|
5157
5241
|
return true;
|
|
5158
5242
|
},
|
|
5159
|
-
|
|
5160
|
-
update(
|
|
5243
|
+
setValue(newValue) {
|
|
5244
|
+
update(component, (draft) => {
|
|
5161
5245
|
draft.value = newValue;
|
|
5162
5246
|
});
|
|
5163
5247
|
void (schemaOnChange == null ? void 0 : schemaOnChange());
|
|
5164
5248
|
}
|
|
5165
5249
|
};
|
|
5250
|
+
return component;
|
|
5166
5251
|
};
|
|
5167
5252
|
|
|
5168
5253
|
// src/domain/mappers/schema/objectSchemaToComponent/objectSchemaToFormattedValueComponent.ts
|
|
@@ -5181,8 +5266,8 @@ var objectSchemaToFormattedValueComponent = (schemaMapperProps, mapperProps) =>
|
|
|
5181
5266
|
};
|
|
5182
5267
|
|
|
5183
5268
|
// src/domain/components/MoneyInputComponent.ts
|
|
5184
|
-
var createMoneyInputComponent = (
|
|
5185
|
-
const _a =
|
|
5269
|
+
var createMoneyInputComponent = (props, onComponentUpdate) => {
|
|
5270
|
+
const _a = props, {
|
|
5186
5271
|
id,
|
|
5187
5272
|
uid,
|
|
5188
5273
|
schemaId,
|
|
@@ -5223,7 +5308,7 @@ var createMoneyInputComponent = (moneyInputProps, onComponentUpdate) => {
|
|
|
5223
5308
|
]);
|
|
5224
5309
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
5225
5310
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
5226
|
-
const
|
|
5311
|
+
const component = __spreadValues({
|
|
5227
5312
|
type: "money-input",
|
|
5228
5313
|
kind: "input",
|
|
5229
5314
|
id,
|
|
@@ -5242,9 +5327,6 @@ var createMoneyInputComponent = (moneyInputProps, onComponentUpdate) => {
|
|
|
5242
5327
|
[amountKey]: amountComponent.getLocalValue(),
|
|
5243
5328
|
[currencyKey]: currencyComponent.getLocalValue()
|
|
5244
5329
|
},
|
|
5245
|
-
_update(updateFn) {
|
|
5246
|
-
update(this, updateFn);
|
|
5247
|
-
},
|
|
5248
5330
|
components: {
|
|
5249
5331
|
amount: amountComponent,
|
|
5250
5332
|
currency: currencyComponent
|
|
@@ -5268,11 +5350,11 @@ var createMoneyInputComponent = (moneyInputProps, onComponentUpdate) => {
|
|
|
5268
5350
|
}, extraValues);
|
|
5269
5351
|
},
|
|
5270
5352
|
getSummary() {
|
|
5271
|
-
return summariser(
|
|
5353
|
+
return summariser(component.getLocalValue());
|
|
5272
5354
|
},
|
|
5273
5355
|
validate() {
|
|
5274
5356
|
const errors = getValidationErrors(amountComponent.getLocalValue());
|
|
5275
|
-
|
|
5357
|
+
update(component, (draft) => {
|
|
5276
5358
|
draft.errors = errors;
|
|
5277
5359
|
});
|
|
5278
5360
|
return amountComponent.validate() && currencyComponent.validate() && errors.length === 0;
|
|
@@ -5283,11 +5365,11 @@ var createMoneyInputComponent = (moneyInputProps, onComponentUpdate) => {
|
|
|
5283
5365
|
onFocus() {
|
|
5284
5366
|
}
|
|
5285
5367
|
}, rest);
|
|
5286
|
-
return
|
|
5368
|
+
return component;
|
|
5287
5369
|
};
|
|
5288
5370
|
|
|
5289
5371
|
// src/domain/components/ObjectComponent.ts
|
|
5290
|
-
var createObjectComponent = (
|
|
5372
|
+
var createObjectComponent = (props) => {
|
|
5291
5373
|
const {
|
|
5292
5374
|
uid,
|
|
5293
5375
|
schemaId,
|
|
@@ -5303,8 +5385,8 @@ var createObjectComponent = (objectProps) => {
|
|
|
5303
5385
|
summariser,
|
|
5304
5386
|
title,
|
|
5305
5387
|
tags
|
|
5306
|
-
} =
|
|
5307
|
-
|
|
5388
|
+
} = props;
|
|
5389
|
+
const component = {
|
|
5308
5390
|
type: "object",
|
|
5309
5391
|
kind: "input",
|
|
5310
5392
|
uid,
|
|
@@ -5320,12 +5402,12 @@ var createObjectComponent = (objectProps) => {
|
|
|
5320
5402
|
title,
|
|
5321
5403
|
tags,
|
|
5322
5404
|
getChildren() {
|
|
5323
|
-
return displayOrder.map((propName) =>
|
|
5405
|
+
return displayOrder.map((propName) => component.componentMap[propName]);
|
|
5324
5406
|
},
|
|
5325
5407
|
async getSubmittableValue() {
|
|
5326
5408
|
return Promise.all(
|
|
5327
5409
|
displayOrder.map(
|
|
5328
|
-
async (propName) =>
|
|
5410
|
+
async (propName) => component.componentMap[propName].getSubmittableValue().then((value) => ({ value, propName }))
|
|
5329
5411
|
)
|
|
5330
5412
|
).then(
|
|
5331
5413
|
(values) => values.reduce(
|
|
@@ -5337,24 +5419,25 @@ var createObjectComponent = (objectProps) => {
|
|
|
5337
5419
|
getSubmittableValueSync() {
|
|
5338
5420
|
return mergeChildrenValues(
|
|
5339
5421
|
displayOrder,
|
|
5340
|
-
(propName) =>
|
|
5422
|
+
(propName) => component.componentMap[propName].getSubmittableValueSync()
|
|
5341
5423
|
);
|
|
5342
5424
|
},
|
|
5343
5425
|
getSummary() {
|
|
5344
|
-
const summary = summariser(
|
|
5345
|
-
const childSummary = summariseFromChildren(
|
|
5426
|
+
const summary = summariser(component.getLocalValue());
|
|
5427
|
+
const childSummary = summariseFromChildren(component.getChildren());
|
|
5346
5428
|
return mergeSummaries(summary, childSummary);
|
|
5347
5429
|
},
|
|
5348
5430
|
getLocalValue() {
|
|
5349
5431
|
return mergeChildrenValues(
|
|
5350
5432
|
displayOrder,
|
|
5351
|
-
(propName) =>
|
|
5433
|
+
(propName) => component.componentMap[propName].getLocalValue()
|
|
5352
5434
|
);
|
|
5353
5435
|
},
|
|
5354
5436
|
validate() {
|
|
5355
|
-
return hidden ? true : validateComponents(
|
|
5437
|
+
return hidden ? true : validateComponents(component.getChildren());
|
|
5356
5438
|
}
|
|
5357
5439
|
};
|
|
5440
|
+
return component;
|
|
5358
5441
|
};
|
|
5359
5442
|
var mergeChildrenValues = (displayOrder, getComponentValue) => displayOrder.reduce((acc, propName) => {
|
|
5360
5443
|
const componentValue = getComponentValue(propName);
|
|
@@ -5396,7 +5479,7 @@ var objectSchemaToObjectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5396
5479
|
}));
|
|
5397
5480
|
};
|
|
5398
5481
|
var createComponentMap = (schemaMapperProps, mapperProps, uidPrefix) => {
|
|
5399
|
-
const { uid, localValue, schema, model, validationErrors } = schemaMapperProps;
|
|
5482
|
+
const { uid, localValue, schema, model, validationErrors, onValueChange } = schemaMapperProps;
|
|
5400
5483
|
const { $id, displayOrder, properties, required } = schema;
|
|
5401
5484
|
const initialReducerValue = {};
|
|
5402
5485
|
return displayOrder.reduce((acc, propName) => {
|
|
@@ -5413,7 +5496,8 @@ var createComponentMap = (schemaMapperProps, mapperProps, uidPrefix) => {
|
|
|
5413
5496
|
model: isObjectModel(model) ? model[propName] : null,
|
|
5414
5497
|
localValue: isObjectLocalValue(localValue) ? localValue[propName] : null,
|
|
5415
5498
|
required: (_a = required == null ? void 0 : required.includes(propName)) != null ? _a : false,
|
|
5416
|
-
validationErrors: isObject(validationErrors) ? validationErrors[propName] : void 0
|
|
5499
|
+
validationErrors: isObject(validationErrors) ? validationErrors[propName] : void 0,
|
|
5500
|
+
onValueChange
|
|
5417
5501
|
},
|
|
5418
5502
|
mapperProps
|
|
5419
5503
|
)
|
|
@@ -5540,8 +5624,8 @@ var isPartialModelMatch = (localModel, incomingModel) => {
|
|
|
5540
5624
|
var nonNullishKeys = (model) => Object.keys(model).filter((key) => !isNullish(model[key]));
|
|
5541
5625
|
|
|
5542
5626
|
// src/domain/components/SelectInputComponent.ts
|
|
5543
|
-
var createSelectInputComponent = (
|
|
5544
|
-
const _a =
|
|
5627
|
+
var createSelectInputComponent = (props, onComponentUpdate) => {
|
|
5628
|
+
const _a = props, { uid, checks, initialModel, options, schemaOnChange, onValueChange, summariser } = _a, rest = __objRest(_a, ["uid", "checks", "initialModel", "options", "schemaOnChange", "onValueChange", "summariser"]);
|
|
5545
5629
|
const children = options.map((option) => option.component);
|
|
5546
5630
|
const matchingOptions = options.map(
|
|
5547
5631
|
(option) => isPartialModelMatch(option.component.getSubmittableValueSync(), initialModel)
|
|
@@ -5558,54 +5642,51 @@ var createSelectInputComponent = (selectProps, onComponentUpdate) => {
|
|
|
5558
5642
|
selectedIndex,
|
|
5559
5643
|
value: null
|
|
5560
5644
|
}, rest), {
|
|
5561
|
-
_update(updateFn) {
|
|
5562
|
-
update(this, updateFn);
|
|
5563
|
-
},
|
|
5564
5645
|
getChildren() {
|
|
5565
|
-
return
|
|
5646
|
+
return component.children;
|
|
5566
5647
|
},
|
|
5567
5648
|
getSelectedChild() {
|
|
5568
|
-
return
|
|
5649
|
+
return component.selectedIndex !== null ? component.children[component.selectedIndex] : null;
|
|
5569
5650
|
},
|
|
5570
5651
|
async getSubmittableValue() {
|
|
5571
5652
|
var _a2, _b;
|
|
5572
|
-
return (_b = await ((_a2 =
|
|
5653
|
+
return (_b = await ((_a2 = component.getSelectedChild()) == null ? void 0 : _a2.getSubmittableValue())) != null ? _b : null;
|
|
5573
5654
|
},
|
|
5574
5655
|
getSubmittableValueSync() {
|
|
5575
5656
|
var _a2, _b;
|
|
5576
|
-
return (_b = (_a2 =
|
|
5657
|
+
return (_b = (_a2 = component.getSelectedChild()) == null ? void 0 : _a2.getSubmittableValueSync()) != null ? _b : null;
|
|
5577
5658
|
},
|
|
5578
5659
|
getSummary() {
|
|
5579
5660
|
var _a2, _b;
|
|
5580
|
-
return (_b = (_a2 =
|
|
5661
|
+
return (_b = (_a2 = component.getSelectedChild()) == null ? void 0 : _a2.getSummary()) != null ? _b : {};
|
|
5581
5662
|
},
|
|
5582
5663
|
getLocalValue() {
|
|
5583
5664
|
var _a2, _b;
|
|
5584
|
-
return (_b = (_a2 =
|
|
5665
|
+
return (_b = (_a2 = component.getSelectedChild()) == null ? void 0 : _a2.getLocalValue()) != null ? _b : null;
|
|
5585
5666
|
},
|
|
5586
5667
|
onBlur() {
|
|
5587
|
-
|
|
5668
|
+
component.validate();
|
|
5588
5669
|
},
|
|
5589
5670
|
onFocus() {
|
|
5590
5671
|
},
|
|
5591
5672
|
// noop
|
|
5592
|
-
|
|
5593
|
-
if (updatedIndex ===
|
|
5673
|
+
selectIndex(updatedIndex) {
|
|
5674
|
+
if (updatedIndex === component.selectedIndex) {
|
|
5594
5675
|
return;
|
|
5595
5676
|
}
|
|
5596
5677
|
if (updatedIndex !== null) {
|
|
5597
|
-
|
|
5598
|
-
schema:
|
|
5599
|
-
selectedOption:
|
|
5678
|
+
props.trackEvent("OneOf Option Selected", {
|
|
5679
|
+
schema: component.analyticsId,
|
|
5680
|
+
selectedOption: component.children[updatedIndex].analyticsId
|
|
5600
5681
|
});
|
|
5601
|
-
if (
|
|
5602
|
-
|
|
5603
|
-
oneOfId:
|
|
5604
|
-
schemaId:
|
|
5682
|
+
if (component.analyticsId) {
|
|
5683
|
+
props.trackEvent("OneOf Selected", {
|
|
5684
|
+
oneOfId: component.analyticsId,
|
|
5685
|
+
schemaId: component.children[updatedIndex].analyticsId
|
|
5605
5686
|
});
|
|
5606
5687
|
}
|
|
5607
5688
|
}
|
|
5608
|
-
|
|
5689
|
+
update(component, (draft) => {
|
|
5609
5690
|
draft.errors = [];
|
|
5610
5691
|
draft.selectedIndex = updatedIndex;
|
|
5611
5692
|
});
|
|
@@ -5614,9 +5695,9 @@ var createSelectInputComponent = (selectProps, onComponentUpdate) => {
|
|
|
5614
5695
|
},
|
|
5615
5696
|
validate() {
|
|
5616
5697
|
var _a2, _b;
|
|
5617
|
-
const validChild = (_b = (_a2 =
|
|
5618
|
-
const errors = getValidationErrors(
|
|
5619
|
-
|
|
5698
|
+
const validChild = (_b = (_a2 = component.getSelectedChild()) == null ? void 0 : _a2.validate()) != null ? _b : true;
|
|
5699
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
5700
|
+
update(component, (draft) => {
|
|
5620
5701
|
draft.errors = errors;
|
|
5621
5702
|
});
|
|
5622
5703
|
return errors.length === 0 && validChild;
|
|
@@ -5634,7 +5715,8 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5634
5715
|
schema,
|
|
5635
5716
|
model,
|
|
5636
5717
|
validationErrors: initialError,
|
|
5637
|
-
required = false
|
|
5718
|
+
required = false,
|
|
5719
|
+
onValueChange
|
|
5638
5720
|
} = schemaMapperProps;
|
|
5639
5721
|
const initialModel = (_a = model != null ? model : schema.default) != null ? _a : null;
|
|
5640
5722
|
const options = schema.oneOf.map((childSchema, index) => {
|
|
@@ -5669,13 +5751,14 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5669
5751
|
model: initialModel,
|
|
5670
5752
|
localValue,
|
|
5671
5753
|
validationErrors: initialError,
|
|
5672
|
-
required
|
|
5754
|
+
required,
|
|
5755
|
+
onValueChange
|
|
5673
5756
|
},
|
|
5674
5757
|
mapperProps
|
|
5675
5758
|
)
|
|
5676
5759
|
};
|
|
5677
5760
|
});
|
|
5678
|
-
const { getErrorMessageFunctions, onComponentUpdate, trackEvent, onBehavior
|
|
5761
|
+
const { getErrorMessageFunctions, onComponentUpdate, trackEvent, onBehavior } = mapperProps;
|
|
5679
5762
|
const { validationMessages } = schema;
|
|
5680
5763
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
5681
5764
|
return createSelectInputComponent(
|
|
@@ -5712,15 +5795,24 @@ var isExactLocalValueMatch = (valueA, valueB) => {
|
|
|
5712
5795
|
|
|
5713
5796
|
// src/domain/components/PersistAsyncComponent.ts
|
|
5714
5797
|
var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, onComponentUpdate) => {
|
|
5715
|
-
const {
|
|
5798
|
+
const {
|
|
5799
|
+
uid,
|
|
5800
|
+
analyticsId,
|
|
5801
|
+
schemaId,
|
|
5802
|
+
component: childComponent,
|
|
5803
|
+
hidden,
|
|
5804
|
+
model,
|
|
5805
|
+
localValue,
|
|
5806
|
+
tags
|
|
5807
|
+
} = props;
|
|
5716
5808
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
5717
|
-
const
|
|
5809
|
+
const component = {
|
|
5718
5810
|
type: "persist-async",
|
|
5719
5811
|
kind: "input",
|
|
5720
5812
|
uid,
|
|
5721
5813
|
analyticsId,
|
|
5722
5814
|
schemaId,
|
|
5723
|
-
component,
|
|
5815
|
+
component: childComponent,
|
|
5724
5816
|
hidden,
|
|
5725
5817
|
status: "idle",
|
|
5726
5818
|
lastSubmitted: model != null ? localValue != null ? localValue : null : null,
|
|
@@ -5729,33 +5821,30 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, o
|
|
|
5729
5821
|
abortController: new AbortController(),
|
|
5730
5822
|
errors: [],
|
|
5731
5823
|
tags,
|
|
5732
|
-
_update(updateFn) {
|
|
5733
|
-
update(this, updateFn);
|
|
5734
|
-
},
|
|
5735
5824
|
validate() {
|
|
5736
|
-
return
|
|
5825
|
+
return component.component.validate();
|
|
5737
5826
|
},
|
|
5738
5827
|
getLocalValue() {
|
|
5739
|
-
return
|
|
5828
|
+
return component.component.getLocalValue();
|
|
5740
5829
|
},
|
|
5741
5830
|
async getSubmittableValue() {
|
|
5742
|
-
return
|
|
5831
|
+
return component.persist();
|
|
5743
5832
|
},
|
|
5744
5833
|
getSubmittableValueSync() {
|
|
5745
|
-
return
|
|
5834
|
+
return component.lastResponse;
|
|
5746
5835
|
},
|
|
5747
5836
|
getSummary() {
|
|
5748
|
-
return
|
|
5837
|
+
return component.component.getSummary();
|
|
5749
5838
|
},
|
|
5750
5839
|
async persist() {
|
|
5751
|
-
const childLocalValue =
|
|
5752
|
-
if (isExactLocalValueMatch(childLocalValue,
|
|
5753
|
-
return
|
|
5840
|
+
const childLocalValue = component.component.getLocalValue();
|
|
5841
|
+
if (isExactLocalValueMatch(childLocalValue, component.lastSubmitted)) {
|
|
5842
|
+
return component.submission;
|
|
5754
5843
|
}
|
|
5755
|
-
const newAbortController = abortAndResetController(
|
|
5844
|
+
const newAbortController = abortAndResetController(component.abortController);
|
|
5756
5845
|
if (childLocalValue == null || childLocalValue === "") {
|
|
5757
5846
|
const resolvedNull = Promise.resolve(null);
|
|
5758
|
-
|
|
5847
|
+
update(component, (draft) => {
|
|
5759
5848
|
draft.abortController = newAbortController;
|
|
5760
5849
|
draft.lastResponse = null;
|
|
5761
5850
|
draft.lastSubmitted = childLocalValue;
|
|
@@ -5768,7 +5857,7 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, o
|
|
|
5768
5857
|
}
|
|
5769
5858
|
const { signal } = newAbortController;
|
|
5770
5859
|
const newSubmission = performPersistAsync({ value: childLocalValue, signal }).then((token) => {
|
|
5771
|
-
|
|
5860
|
+
update(component, (draft) => {
|
|
5772
5861
|
draft.lastResponse = token;
|
|
5773
5862
|
draft.errors = [];
|
|
5774
5863
|
draft.status = "success";
|
|
@@ -5779,18 +5868,18 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, o
|
|
|
5779
5868
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
5780
5869
|
return null;
|
|
5781
5870
|
}
|
|
5782
|
-
|
|
5871
|
+
update(component, (draft) => {
|
|
5783
5872
|
draft.lastResponse = null;
|
|
5784
5873
|
draft.lastSubmitted = null;
|
|
5785
5874
|
draft.submission = Promise.resolve(null);
|
|
5786
5875
|
draft.status = "error";
|
|
5787
|
-
if (
|
|
5876
|
+
if (component.component.type !== "upload") {
|
|
5788
5877
|
draft.errors = error instanceof Error ? [error.message] : [];
|
|
5789
5878
|
}
|
|
5790
5879
|
});
|
|
5791
5880
|
throw error;
|
|
5792
5881
|
});
|
|
5793
|
-
|
|
5882
|
+
update(component, (draft) => {
|
|
5794
5883
|
draft.abortController = newAbortController;
|
|
5795
5884
|
draft.lastSubmitted = childLocalValue;
|
|
5796
5885
|
draft.lastResponse = null;
|
|
@@ -5801,7 +5890,7 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, o
|
|
|
5801
5890
|
return newSubmission;
|
|
5802
5891
|
}
|
|
5803
5892
|
};
|
|
5804
|
-
return
|
|
5893
|
+
return component;
|
|
5805
5894
|
};
|
|
5806
5895
|
|
|
5807
5896
|
// src/domain/mappers/schema/persistAsyncSchemaToComponent.ts
|
|
@@ -5840,8 +5929,8 @@ var persistAsyncSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5840
5929
|
};
|
|
5841
5930
|
|
|
5842
5931
|
// src/domain/components/DateInputComponent.ts
|
|
5843
|
-
var createDateInputComponent = (
|
|
5844
|
-
const _a =
|
|
5932
|
+
var createDateInputComponent = (props, onComponentUpdate) => {
|
|
5933
|
+
const _a = props, {
|
|
5845
5934
|
uid,
|
|
5846
5935
|
id,
|
|
5847
5936
|
checks,
|
|
@@ -5865,28 +5954,25 @@ var createDateInputComponent = (textInputProps, onComponentUpdate) => {
|
|
|
5865
5954
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
5866
5955
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
5867
5956
|
const validateAsync = performValidationAsync ? getComponentValidationAsync(update, performValidationAsync) : void 0;
|
|
5868
|
-
const
|
|
5957
|
+
const component = __spreadValues({
|
|
5869
5958
|
type: "date",
|
|
5870
5959
|
kind: "input",
|
|
5871
5960
|
uid,
|
|
5872
5961
|
id,
|
|
5873
5962
|
value,
|
|
5874
|
-
_update(updateFn) {
|
|
5875
|
-
update(this, updateFn);
|
|
5876
|
-
},
|
|
5877
5963
|
onBlur() {
|
|
5878
|
-
const isValid =
|
|
5964
|
+
const isValid = component.validate();
|
|
5879
5965
|
if (isValid) {
|
|
5880
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
5966
|
+
validateAsync == null ? void 0 : validateAsync(component, component.getLocalValue()).catch(() => {
|
|
5881
5967
|
});
|
|
5882
5968
|
}
|
|
5883
5969
|
},
|
|
5884
5970
|
onFocus() {
|
|
5885
5971
|
},
|
|
5886
5972
|
// Noop
|
|
5887
|
-
|
|
5888
|
-
const prevValue =
|
|
5889
|
-
|
|
5973
|
+
setValue(updatedValue) {
|
|
5974
|
+
const prevValue = component.value;
|
|
5975
|
+
update(component, (draft) => {
|
|
5890
5976
|
draft.errors = [];
|
|
5891
5977
|
draft.validationAsyncState.messages = {};
|
|
5892
5978
|
draft.value = updatedValue;
|
|
@@ -5901,29 +5987,29 @@ var createDateInputComponent = (textInputProps, onComponentUpdate) => {
|
|
|
5901
5987
|
}
|
|
5902
5988
|
},
|
|
5903
5989
|
async getSubmittableValue() {
|
|
5904
|
-
return
|
|
5990
|
+
return component.getSubmittableValueSync();
|
|
5905
5991
|
},
|
|
5906
5992
|
getSubmittableValueSync() {
|
|
5907
|
-
if (isValidDate(
|
|
5908
|
-
return
|
|
5993
|
+
if (isValidDate(component.getLocalValue())) {
|
|
5994
|
+
return component.getLocalValue();
|
|
5909
5995
|
}
|
|
5910
5996
|
return null;
|
|
5911
5997
|
},
|
|
5912
5998
|
getSummary() {
|
|
5913
|
-
return summariser(
|
|
5999
|
+
return summariser(component.getLocalValue());
|
|
5914
6000
|
},
|
|
5915
6001
|
getLocalValue() {
|
|
5916
|
-
return
|
|
6002
|
+
return component.value;
|
|
5917
6003
|
},
|
|
5918
6004
|
validate() {
|
|
5919
|
-
const errors = getValidationErrors(
|
|
5920
|
-
|
|
6005
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
6006
|
+
update(component, (draft) => {
|
|
5921
6007
|
draft.errors = errors;
|
|
5922
6008
|
});
|
|
5923
6009
|
return errors.length === 0;
|
|
5924
6010
|
}
|
|
5925
6011
|
}, rest);
|
|
5926
|
-
return
|
|
6012
|
+
return component;
|
|
5927
6013
|
};
|
|
5928
6014
|
|
|
5929
6015
|
// src/domain/mappers/utils/suggestions-utils.ts
|
|
@@ -5950,7 +6036,14 @@ var mapStringSchemaSuggestions = (suggestions, logEvent) => {
|
|
|
5950
6036
|
// src/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.ts
|
|
5951
6037
|
var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
5952
6038
|
var _a;
|
|
5953
|
-
const {
|
|
6039
|
+
const {
|
|
6040
|
+
schema,
|
|
6041
|
+
localValue,
|
|
6042
|
+
model,
|
|
6043
|
+
required = false,
|
|
6044
|
+
onPersistAsync,
|
|
6045
|
+
onValueChange
|
|
6046
|
+
} = schemaMapperProps;
|
|
5954
6047
|
const {
|
|
5955
6048
|
autocompleteHint,
|
|
5956
6049
|
default: defaultValue,
|
|
@@ -5958,7 +6051,7 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5958
6051
|
maximum: maximumDate,
|
|
5959
6052
|
suggestions
|
|
5960
6053
|
} = schema;
|
|
5961
|
-
const { getErrorMessageFunctions, onComponentUpdate, onBehavior
|
|
6054
|
+
const { getErrorMessageFunctions, onComponentUpdate, onBehavior } = mapperProps;
|
|
5962
6055
|
const errorMessageFunctions = getErrorMessageFunctions(schema.validationMessages);
|
|
5963
6056
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
5964
6057
|
schemaMapperProps,
|
|
@@ -5971,7 +6064,7 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5971
6064
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
5972
6065
|
autoComplete: getAutocompleteString(autocompleteHint),
|
|
5973
6066
|
checks: schema.hidden ? [] : [
|
|
5974
|
-
|
|
6067
|
+
getStringRequiredCheck(required, errorMessageFunctions),
|
|
5975
6068
|
getValidDateCheck(required, errorMessageFunctions),
|
|
5976
6069
|
getAboveMaximumDateCheck(schema, errorMessageFunctions),
|
|
5977
6070
|
getBelowMinimumDateCheck(schema, errorMessageFunctions)
|
|
@@ -6007,9 +6100,9 @@ var getValidDate = (model) => {
|
|
|
6007
6100
|
// src/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.ts
|
|
6008
6101
|
var stringSchemaToUploadInputComponent = (schemaMapperProps, mapperProps) => {
|
|
6009
6102
|
var _a;
|
|
6010
|
-
const { schema, localValue, model, required = false } = schemaMapperProps;
|
|
6103
|
+
const { schema, localValue, model, required = false, onValueChange } = schemaMapperProps;
|
|
6011
6104
|
const { accepts, autocompleteHint, cameraConfig, hidden, maxSize, source, validationMessages } = schema;
|
|
6012
|
-
const { getErrorMessageFunctions, onComponentUpdate, onBehavior
|
|
6105
|
+
const { getErrorMessageFunctions, onComponentUpdate, onBehavior } = mapperProps;
|
|
6013
6106
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
6014
6107
|
const validLocalValue = isFile(localValue) ? localValue : null;
|
|
6015
6108
|
const value = (_a = getFileFromModel(model)) != null ? _a : validLocalValue;
|
|
@@ -6037,8 +6130,8 @@ var stringSchemaToUploadInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6037
6130
|
var getFileFromModel = (model) => isString(model) ? base64dataUrltoFile(model, "") : null;
|
|
6038
6131
|
|
|
6039
6132
|
// src/domain/components/TextInputComponent.ts
|
|
6040
|
-
var createTextInputComponent = (
|
|
6041
|
-
const _a =
|
|
6133
|
+
var createTextInputComponent = (props, onComponentUpdate) => {
|
|
6134
|
+
const _a = props, {
|
|
6042
6135
|
uid,
|
|
6043
6136
|
id,
|
|
6044
6137
|
checks,
|
|
@@ -6060,33 +6153,32 @@ var createTextInputComponent = (textInputProps, onComponentUpdate) => {
|
|
|
6060
6153
|
"value"
|
|
6061
6154
|
]);
|
|
6062
6155
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
6156
|
+
const onValueChangeDebounced = debounce(onValueChange, 1e3);
|
|
6063
6157
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
6064
6158
|
const performOnChange = getDebouncedSchemaOnChange(schemaOnChange, getValidationErrors);
|
|
6065
6159
|
const validateAsync = performValidationAsync ? getDebouncedComponentValidationAsync(update, performValidationAsync) : void 0;
|
|
6066
|
-
const
|
|
6160
|
+
const component = __spreadValues({
|
|
6067
6161
|
type: "text",
|
|
6068
6162
|
kind: "input",
|
|
6069
6163
|
uid,
|
|
6070
6164
|
id,
|
|
6071
6165
|
value,
|
|
6072
|
-
_update(updateFn) {
|
|
6073
|
-
update(this, updateFn);
|
|
6074
|
-
},
|
|
6075
6166
|
onBlur() {
|
|
6076
|
-
const isValid =
|
|
6167
|
+
const isValid = component.validate();
|
|
6077
6168
|
performOnChange == null ? void 0 : performOnChange.flush();
|
|
6078
6169
|
if (isValid) {
|
|
6079
6170
|
void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
|
|
6080
6171
|
}));
|
|
6081
6172
|
validateAsync == null ? void 0 : validateAsync.flush();
|
|
6082
6173
|
}
|
|
6174
|
+
onValueChangeDebounced.flush();
|
|
6083
6175
|
},
|
|
6084
6176
|
onFocus() {
|
|
6085
6177
|
},
|
|
6086
6178
|
// Noop
|
|
6087
|
-
|
|
6088
|
-
const prevValue =
|
|
6089
|
-
|
|
6179
|
+
setValue(updatedValue) {
|
|
6180
|
+
const prevValue = component.value;
|
|
6181
|
+
update(component, (draft) => {
|
|
6090
6182
|
draft.errors = [];
|
|
6091
6183
|
draft.validationAsyncState.messages = {};
|
|
6092
6184
|
draft.value = updatedValue;
|
|
@@ -6094,39 +6186,46 @@ var createTextInputComponent = (textInputProps, onComponentUpdate) => {
|
|
|
6094
6186
|
performOnChange == null ? void 0 : performOnChange(prevValue, updatedValue);
|
|
6095
6187
|
const isValid = getValidationErrors(updatedValue).length === 0;
|
|
6096
6188
|
if (isValid) {
|
|
6097
|
-
validateAsync == null ? void 0 : validateAsync(
|
|
6189
|
+
validateAsync == null ? void 0 : validateAsync(component, updatedValue);
|
|
6098
6190
|
}
|
|
6099
6191
|
if (!updatedValue) {
|
|
6100
6192
|
validateAsync == null ? void 0 : validateAsync.cancel();
|
|
6101
6193
|
}
|
|
6102
|
-
|
|
6194
|
+
onValueChangeDebounced();
|
|
6103
6195
|
},
|
|
6104
6196
|
async getSubmittableValue() {
|
|
6105
|
-
return
|
|
6197
|
+
return component.getSubmittableValueSync();
|
|
6106
6198
|
},
|
|
6107
6199
|
getSubmittableValueSync() {
|
|
6108
|
-
return
|
|
6200
|
+
return component.getLocalValue() || null;
|
|
6109
6201
|
},
|
|
6110
6202
|
getSummary() {
|
|
6111
|
-
return summariser(
|
|
6203
|
+
return summariser(component.getLocalValue());
|
|
6112
6204
|
},
|
|
6113
6205
|
getLocalValue() {
|
|
6114
|
-
return
|
|
6206
|
+
return component.value;
|
|
6115
6207
|
},
|
|
6116
6208
|
validate() {
|
|
6117
|
-
const errors = getValidationErrors(
|
|
6118
|
-
|
|
6209
|
+
const errors = getValidationErrors(component.getLocalValue());
|
|
6210
|
+
update(component, (draft) => {
|
|
6119
6211
|
draft.errors = errors;
|
|
6120
6212
|
});
|
|
6121
6213
|
return errors.length === 0;
|
|
6122
6214
|
}
|
|
6123
6215
|
}, rest);
|
|
6124
|
-
return
|
|
6216
|
+
return component;
|
|
6125
6217
|
};
|
|
6126
6218
|
|
|
6127
6219
|
// src/domain/mappers/schema/stringSchemaToComponent/stringSchemaToTextInputComponent.ts
|
|
6128
6220
|
var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
6129
|
-
const {
|
|
6221
|
+
const {
|
|
6222
|
+
schema,
|
|
6223
|
+
localValue,
|
|
6224
|
+
model,
|
|
6225
|
+
required = false,
|
|
6226
|
+
onPersistAsync,
|
|
6227
|
+
onValueChange
|
|
6228
|
+
} = schemaMapperProps;
|
|
6130
6229
|
const {
|
|
6131
6230
|
autocapitalization,
|
|
6132
6231
|
autocompleteHint,
|
|
@@ -6140,7 +6239,7 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6140
6239
|
suggestions,
|
|
6141
6240
|
validationMessages
|
|
6142
6241
|
} = schema;
|
|
6143
|
-
const { getErrorMessageFunctions, onComponentUpdate, onBehavior,
|
|
6242
|
+
const { getErrorMessageFunctions, onComponentUpdate, onBehavior, logEvent } = mapperProps;
|
|
6144
6243
|
const controlForLegacyFormat = getControlForLegacyFormat(format);
|
|
6145
6244
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
6146
6245
|
const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
|
|
@@ -6155,7 +6254,7 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6155
6254
|
autocapitalization,
|
|
6156
6255
|
autoComplete: getAutocompleteString(autocompleteHint),
|
|
6157
6256
|
checks: schema.hidden ? [] : [
|
|
6158
|
-
|
|
6257
|
+
getStringRequiredCheck(required, errorMessageFunctions),
|
|
6159
6258
|
getAboveMaxLengthCheck(schema, errorMessageFunctions),
|
|
6160
6259
|
getBelowMinLengthCheck(schema, errorMessageFunctions),
|
|
6161
6260
|
getNotAdheringToPatternCheck(schema, errorMessageFunctions, { logEvent })
|
|
@@ -6254,6 +6353,8 @@ var mapSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6254
6353
|
};
|
|
6255
6354
|
|
|
6256
6355
|
// src/domain/mappers/mapStepSchemas.ts
|
|
6356
|
+
var noop2 = () => {
|
|
6357
|
+
};
|
|
6257
6358
|
var mapStepSchemas = (uid, step, stepLocalValue, mapperProps) => {
|
|
6258
6359
|
return step.schemas.map(
|
|
6259
6360
|
(schema, i) => {
|
|
@@ -6266,7 +6367,8 @@ var mapStepSchemas = (uid, step, stepLocalValue, mapperProps) => {
|
|
|
6266
6367
|
model: (_a = step.model) != null ? _a : null,
|
|
6267
6368
|
localValue: stepLocalValue,
|
|
6268
6369
|
validationErrors: (_b = step.errors) == null ? void 0 : _b.validation,
|
|
6269
|
-
required: true
|
|
6370
|
+
required: true,
|
|
6371
|
+
onValueChange: noop2
|
|
6270
6372
|
},
|
|
6271
6373
|
mapperProps
|
|
6272
6374
|
);
|
|
@@ -6445,8 +6547,10 @@ var mapStepToComponent = (_a) => {
|
|
|
6445
6547
|
stepPrefetch,
|
|
6446
6548
|
step,
|
|
6447
6549
|
referencedSchemaIds,
|
|
6550
|
+
features,
|
|
6448
6551
|
onComponentUpdate,
|
|
6449
6552
|
trackEvent,
|
|
6553
|
+
logEvent,
|
|
6450
6554
|
onBehavior,
|
|
6451
6555
|
onLoad: stepOnLoad
|
|
6452
6556
|
});
|
|
@@ -6462,7 +6566,7 @@ var getReferencedSchemaId = (step) => {
|
|
|
6462
6566
|
var mapBackNavigation = (navigation, onBehavior, isNativeBackEnabled) => {
|
|
6463
6567
|
var _a;
|
|
6464
6568
|
const backNavigation = (_a = navigation == null ? void 0 : navigation.back) != null ? _a : navigation == null ? void 0 : navigation.backButton;
|
|
6465
|
-
const backBehavior = { type: "back", action: backNavigation == null ? void 0 : backNavigation.action };
|
|
6569
|
+
const backBehavior = { type: "back", action: backNavigation == null ? void 0 : backNavigation.action, track: false };
|
|
6466
6570
|
return backNavigation || isNativeBackEnabled ? {
|
|
6467
6571
|
title: backNavigation == null ? void 0 : backNavigation.title,
|
|
6468
6572
|
onClick: () => {
|
|
@@ -6678,10 +6782,10 @@ var executePoll = async (props) => {
|
|
|
6678
6782
|
}
|
|
6679
6783
|
case "modal": {
|
|
6680
6784
|
assertModalResponseBody(body);
|
|
6681
|
-
return { type: "behavior", behavior: __spreadValues({ type: "modal" }, body) };
|
|
6785
|
+
return { type: "behavior", behavior: __spreadProps(__spreadValues({ type: "modal" }, body), { track: false }) };
|
|
6682
6786
|
}
|
|
6683
6787
|
case "no-op": {
|
|
6684
|
-
return { type: "behavior", behavior: { type: "none" } };
|
|
6788
|
+
return { type: "behavior", behavior: { type: "none", track: false } };
|
|
6685
6789
|
}
|
|
6686
6790
|
case "subflow": {
|
|
6687
6791
|
assertSubflowResponseBody(body);
|
|
@@ -6706,7 +6810,8 @@ var executePoll = async (props) => {
|
|
|
6706
6810
|
};
|
|
6707
6811
|
var actionResponseBodyToBehavior = (body) => ({
|
|
6708
6812
|
type: "non-merging-action",
|
|
6709
|
-
action: body.action
|
|
6813
|
+
action: body.action,
|
|
6814
|
+
track: false
|
|
6710
6815
|
});
|
|
6711
6816
|
|
|
6712
6817
|
// src/controller/executeRefresh.ts
|
|
@@ -6761,36 +6866,30 @@ var executeRefresh = async (props) => {
|
|
|
6761
6866
|
};
|
|
6762
6867
|
|
|
6763
6868
|
// src/domain/components/SubflowComponent.ts
|
|
6764
|
-
var createSubflowComponent = (
|
|
6765
|
-
switch (
|
|
6869
|
+
var createSubflowComponent = (props, onComponentUpdate) => {
|
|
6870
|
+
switch (props.subflowType) {
|
|
6766
6871
|
case "dynamic":
|
|
6767
|
-
return createDynamicSubflowComponent(
|
|
6872
|
+
return createDynamicSubflowComponent(props, onComponentUpdate);
|
|
6768
6873
|
case "native":
|
|
6769
|
-
return createNativeSubflowComponent(
|
|
6874
|
+
return createNativeSubflowComponent(props);
|
|
6770
6875
|
}
|
|
6771
6876
|
};
|
|
6772
|
-
var createDynamicSubflowComponent = (
|
|
6877
|
+
var createDynamicSubflowComponent = (props, onComponentUpdate) => {
|
|
6773
6878
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
6774
|
-
|
|
6879
|
+
return __spreadValues({
|
|
6775
6880
|
uid: `subflow-dynamic-${getRandomId()}`,
|
|
6776
6881
|
type: "subflow",
|
|
6777
6882
|
subflowType: "dynamic",
|
|
6778
6883
|
kind: "layout"
|
|
6779
|
-
},
|
|
6780
|
-
_update(updateFn) {
|
|
6781
|
-
update(this, updateFn);
|
|
6782
|
-
}
|
|
6783
|
-
});
|
|
6784
|
-
return subflowComponent;
|
|
6884
|
+
}, props);
|
|
6785
6885
|
};
|
|
6786
|
-
var createNativeSubflowComponent = (
|
|
6787
|
-
|
|
6886
|
+
var createNativeSubflowComponent = (props) => {
|
|
6887
|
+
return __spreadValues({
|
|
6788
6888
|
uid: `subflow-native-${getRandomId()}`,
|
|
6789
6889
|
type: "subflow",
|
|
6790
6890
|
subflowType: "native",
|
|
6791
6891
|
kind: "layout"
|
|
6792
|
-
},
|
|
6793
|
-
return subflowComponent;
|
|
6892
|
+
}, props);
|
|
6794
6893
|
};
|
|
6795
6894
|
|
|
6796
6895
|
// src/controller/executeSubflow.ts
|
|
@@ -6938,8 +7037,7 @@ var createFlowController = (props) => {
|
|
|
6938
7037
|
onNotification,
|
|
6939
7038
|
onError,
|
|
6940
7039
|
onEvent,
|
|
6941
|
-
onLog
|
|
6942
|
-
onValueChange
|
|
7040
|
+
onLog
|
|
6943
7041
|
} = props;
|
|
6944
7042
|
const httpClient = getHttpClientWithCapabilities(props.httpClient, nativeSubflowHandlers);
|
|
6945
7043
|
const rootComponent = createRootDomainComponent(
|
|
@@ -6980,8 +7078,7 @@ var createFlowController = (props) => {
|
|
|
6980
7078
|
httpClient,
|
|
6981
7079
|
onBehavior,
|
|
6982
7080
|
onLink,
|
|
6983
|
-
onPoll
|
|
6984
|
-
onValueChange
|
|
7081
|
+
onPoll
|
|
6985
7082
|
});
|
|
6986
7083
|
const createStepComponent2 = (newStep, etag, localValue) => {
|
|
6987
7084
|
rootComponent.stop();
|
|
@@ -7044,6 +7141,7 @@ var createFlowController = (props) => {
|
|
|
7044
7141
|
};
|
|
7045
7142
|
const onBehavior = async (behavior) => {
|
|
7046
7143
|
var _a;
|
|
7144
|
+
trackBehaviorTriggered(trackEvent, behavior);
|
|
7047
7145
|
switch (behavior.type) {
|
|
7048
7146
|
case "download": {
|
|
7049
7147
|
try {
|
|
@@ -7304,6 +7402,7 @@ var createFlowController = (props) => {
|
|
|
7304
7402
|
switch (command.type) {
|
|
7305
7403
|
case "replace-step":
|
|
7306
7404
|
createStep(command.step, command.etag);
|
|
7405
|
+
trackCoreEvent("Step Shown", { isFirstStep: false });
|
|
7307
7406
|
return true;
|
|
7308
7407
|
case "behavior":
|
|
7309
7408
|
void onBehavior(command.behavior);
|
|
@@ -7646,6 +7745,28 @@ var formatDateOptions = {
|
|
|
7646
7745
|
dateStyle: "long"
|
|
7647
7746
|
};
|
|
7648
7747
|
|
|
7748
|
+
// src/renderers/mappers/utils/mapCallToAction.ts
|
|
7749
|
+
var mapCallToAction = (_a) => {
|
|
7750
|
+
var _b = _a, {
|
|
7751
|
+
hrefWithTracking
|
|
7752
|
+
} = _b, cta = __objRest(_b, [
|
|
7753
|
+
"hrefWithTracking"
|
|
7754
|
+
]);
|
|
7755
|
+
return __spreadProps(__spreadValues({}, cta), {
|
|
7756
|
+
getAnchorProps: hrefWithTracking
|
|
7757
|
+
});
|
|
7758
|
+
};
|
|
7759
|
+
var mapCallToActionOptional = (cta) => cta ? mapCallToAction(cta) : void 0;
|
|
7760
|
+
var mapAdditionalInfo2 = (info) => {
|
|
7761
|
+
if (info) {
|
|
7762
|
+
const _a = info, { hrefWithTracking } = _a, rest = __objRest(_a, ["hrefWithTracking"]);
|
|
7763
|
+
return __spreadProps(__spreadValues({}, rest), {
|
|
7764
|
+
getAnchorProps: hrefWithTracking
|
|
7765
|
+
});
|
|
7766
|
+
}
|
|
7767
|
+
return void 0;
|
|
7768
|
+
};
|
|
7769
|
+
|
|
7649
7770
|
// src/renderers/mappers/utils/pick.ts
|
|
7650
7771
|
function pick(obj, ...keys) {
|
|
7651
7772
|
const result = {};
|
|
@@ -7656,18 +7777,9 @@ function pick(obj, ...keys) {
|
|
|
7656
7777
|
}
|
|
7657
7778
|
|
|
7658
7779
|
// src/renderers/mappers/alertComponentToProps.ts
|
|
7659
|
-
var alertComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(
|
|
7660
|
-
component
|
|
7661
|
-
|
|
7662
|
-
"analyticsId",
|
|
7663
|
-
"type",
|
|
7664
|
-
"callToAction",
|
|
7665
|
-
"context",
|
|
7666
|
-
"control",
|
|
7667
|
-
"margin",
|
|
7668
|
-
"markdown",
|
|
7669
|
-
"tags"
|
|
7670
|
-
)), rendererMapperProps);
|
|
7780
|
+
var alertComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "context", "control", "margin", "markdown", "tags")), {
|
|
7781
|
+
callToAction: mapCallToActionOptional(component.callToAction)
|
|
7782
|
+
}), rendererMapperProps);
|
|
7671
7783
|
|
|
7672
7784
|
// src/renderers/mappers/allOfComponentToProps.ts
|
|
7673
7785
|
var allOfComponentToProps = (component, rendererMapperProps) => {
|
|
@@ -7719,48 +7831,32 @@ var getValidationState = (errors, validationAsyncState) => {
|
|
|
7719
7831
|
// src/renderers/mappers/utils/inputComponentToProps.ts
|
|
7720
7832
|
var inputComponentToProps = (component, type) => {
|
|
7721
7833
|
var _a;
|
|
7722
|
-
const {
|
|
7723
|
-
uid,
|
|
7724
|
-
analyticsId,
|
|
7725
|
-
control,
|
|
7726
|
-
description,
|
|
7727
|
-
disabled,
|
|
7728
|
-
errors,
|
|
7729
|
-
help,
|
|
7730
|
-
id,
|
|
7731
|
-
media,
|
|
7732
|
-
placeholder,
|
|
7733
|
-
required,
|
|
7734
|
-
title,
|
|
7735
|
-
tags,
|
|
7736
|
-
validationAsyncState,
|
|
7737
|
-
inlineAlert,
|
|
7738
|
-
onBlur,
|
|
7739
|
-
onFocus
|
|
7740
|
-
} = component;
|
|
7834
|
+
const { errors, validationAsyncState } = component;
|
|
7741
7835
|
const { messages } = validationAsyncState != null ? validationAsyncState : {};
|
|
7742
|
-
return {
|
|
7743
|
-
|
|
7744
|
-
|
|
7836
|
+
return __spreadProps(__spreadValues({}, pick(
|
|
7837
|
+
component,
|
|
7838
|
+
"uid",
|
|
7839
|
+
"analyticsId",
|
|
7840
|
+
"control",
|
|
7841
|
+
"description",
|
|
7842
|
+
"disabled",
|
|
7843
|
+
"help",
|
|
7844
|
+
"id",
|
|
7845
|
+
"media",
|
|
7846
|
+
"placeholder",
|
|
7847
|
+
"required",
|
|
7848
|
+
"title",
|
|
7849
|
+
"tags",
|
|
7850
|
+
"inlineAlert",
|
|
7851
|
+
"onBlur",
|
|
7852
|
+
"onFocus"
|
|
7853
|
+
)), {
|
|
7745
7854
|
type,
|
|
7746
|
-
control,
|
|
7747
|
-
description,
|
|
7748
|
-
disabled,
|
|
7749
7855
|
error: (_a = messages == null ? void 0 : messages.error) != null ? _a : errors == null ? void 0 : errors[0],
|
|
7750
|
-
help,
|
|
7751
|
-
id,
|
|
7752
|
-
media,
|
|
7753
|
-
placeholder,
|
|
7754
|
-
required,
|
|
7755
|
-
title,
|
|
7756
|
-
tags,
|
|
7757
7856
|
value: component.getLocalValue(),
|
|
7758
7857
|
validationState: getValidationState(errors, validationAsyncState),
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
onBlur: onBlur.bind(component),
|
|
7762
|
-
onFocus: onFocus.bind(component)
|
|
7763
|
-
};
|
|
7858
|
+
fieldLoadingState: getFieldLoadingState(component)
|
|
7859
|
+
});
|
|
7764
7860
|
};
|
|
7765
7861
|
var getFieldLoadingState = (component) => {
|
|
7766
7862
|
const { validationAsyncState } = component;
|
|
@@ -7773,12 +7869,9 @@ var getFieldLoadingState = (component) => {
|
|
|
7773
7869
|
// src/renderers/mappers/booleanInputComponentToProps.ts
|
|
7774
7870
|
var booleanInputComponentToProps = (component, rendererMapperProps) => {
|
|
7775
7871
|
var _a;
|
|
7776
|
-
return __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-checkbox")), rendererMapperProps), {
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
inlineAlert: component.inlineAlert,
|
|
7780
|
-
value: (_a = component.value) != null ? _a : false,
|
|
7781
|
-
onChange: component.onChange.bind(component)
|
|
7872
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-checkbox")), rendererMapperProps), pick(component, "additionalText", "supportingValues", "inlineAlert")), {
|
|
7873
|
+
onChange: component.setValue,
|
|
7874
|
+
value: (_a = component.value) != null ? _a : false
|
|
7782
7875
|
});
|
|
7783
7876
|
};
|
|
7784
7877
|
|
|
@@ -7827,30 +7920,14 @@ var buttonComponentToProps = (component, rendererMapperProps) => {
|
|
|
7827
7920
|
};
|
|
7828
7921
|
|
|
7829
7922
|
// src/renderers/mappers/columnsComponentToProps.ts
|
|
7830
|
-
var columnsComponentToProps = ({
|
|
7831
|
-
|
|
7832
|
-
analyticsId,
|
|
7833
|
-
bias,
|
|
7834
|
-
control,
|
|
7835
|
-
margin,
|
|
7836
|
-
tags,
|
|
7837
|
-
startComponents,
|
|
7838
|
-
endComponents
|
|
7839
|
-
}, rendererMapperProps) => {
|
|
7840
|
-
const startChildrenProps = startComponents.map(
|
|
7923
|
+
var columnsComponentToProps = (component, rendererMapperProps) => {
|
|
7924
|
+
const startChildrenProps = component.startComponents.map(
|
|
7841
7925
|
(c) => componentToRendererProps(c, rendererMapperProps)
|
|
7842
7926
|
);
|
|
7843
|
-
const endChildrenProps = endComponents.map(
|
|
7927
|
+
const endChildrenProps = component.endComponents.map(
|
|
7844
7928
|
(c) => componentToRendererProps(c, rendererMapperProps)
|
|
7845
7929
|
);
|
|
7846
|
-
return __spreadProps(__spreadValues({}, rendererMapperProps), {
|
|
7847
|
-
uid,
|
|
7848
|
-
analyticsId,
|
|
7849
|
-
type: "columns",
|
|
7850
|
-
bias,
|
|
7851
|
-
control,
|
|
7852
|
-
margin,
|
|
7853
|
-
tags,
|
|
7930
|
+
return __spreadProps(__spreadValues(__spreadValues({}, rendererMapperProps), pick(component, "uid", "analyticsId", "type", "bias", "control", "margin", "tags")), {
|
|
7854
7931
|
startChildren: startChildrenProps.map(rendererMapperProps.render),
|
|
7855
7932
|
endChildren: endChildrenProps.map(rendererMapperProps.render),
|
|
7856
7933
|
startChildrenProps,
|
|
@@ -7874,29 +7951,24 @@ var constComponentToProps = (component, rendererMapperProps) => {
|
|
|
7874
7951
|
// src/renderers/mappers/containerComponentToProps.ts
|
|
7875
7952
|
var containerComponentToProps = (component, rendererMapperProps) => {
|
|
7876
7953
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
7877
|
-
return __spreadValues({
|
|
7878
|
-
type: "container",
|
|
7879
|
-
uid: component.uid,
|
|
7954
|
+
return __spreadValues(__spreadProps(__spreadValues({}, pick(component, "type", "uid")), {
|
|
7880
7955
|
children: childrenProps.map(rendererMapperProps.render),
|
|
7881
7956
|
childrenProps
|
|
7882
|
-
}, rendererMapperProps);
|
|
7957
|
+
}), rendererMapperProps);
|
|
7883
7958
|
};
|
|
7884
7959
|
|
|
7885
7960
|
// src/renderers/mappers/dateInputComponentToProps.ts
|
|
7886
|
-
var dateInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-date")), rendererMapperProps), {
|
|
7887
|
-
|
|
7888
|
-
minimumDate: component.minimumDate,
|
|
7889
|
-
maximumDate: component.maximumDate,
|
|
7890
|
-
suggestions: component.suggestions,
|
|
7891
|
-
onChange: component.onChange.bind(component)
|
|
7961
|
+
var dateInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-date")), rendererMapperProps), pick(component, "autoComplete", "minimumDate", "maximumDate", "suggestions")), {
|
|
7962
|
+
onChange: component.setValue
|
|
7892
7963
|
});
|
|
7893
7964
|
|
|
7894
7965
|
// src/renderers/mappers/decisionComponentToProps.ts
|
|
7895
7966
|
var decisionComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "title", "tags")), rendererMapperProps), {
|
|
7896
7967
|
options: component.options.map((_a) => {
|
|
7897
|
-
var _b = _a, { disabled } = _b,
|
|
7898
|
-
return __spreadProps(__spreadValues({},
|
|
7899
|
-
disabled: disabled || rendererMapperProps.stepLoadingState !== "idle"
|
|
7968
|
+
var _b = _a, { disabled } = _b, option = __objRest(_b, ["disabled"]);
|
|
7969
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
7970
|
+
disabled: disabled || rendererMapperProps.stepLoadingState !== "idle",
|
|
7971
|
+
getAnchorProps: option.hrefWithTracking
|
|
7900
7972
|
});
|
|
7901
7973
|
})
|
|
7902
7974
|
});
|
|
@@ -7906,14 +7978,11 @@ var dividerComponentToProps = (component, rendererMapperProps) => __spreadValues
|
|
|
7906
7978
|
|
|
7907
7979
|
// src/renderers/mappers/externalComponentToProps.ts
|
|
7908
7980
|
var externalComponentToProps = (component, rendererMapperProps) => {
|
|
7909
|
-
return __spreadValues({
|
|
7910
|
-
type: "external-confirmation"
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
open: component.open.bind(component),
|
|
7915
|
-
onCancel: component.onCancel.bind(component)
|
|
7916
|
-
}, rendererMapperProps);
|
|
7981
|
+
return __spreadValues(__spreadProps(__spreadValues({
|
|
7982
|
+
type: "external-confirmation"
|
|
7983
|
+
}, pick(component, "uid", "url", "open", "onCancel")), {
|
|
7984
|
+
visible: component.status === "failure"
|
|
7985
|
+
}), rendererMapperProps);
|
|
7917
7986
|
};
|
|
7918
7987
|
|
|
7919
7988
|
// src/renderers/mappers/formattedValueComponentToProps.ts
|
|
@@ -7934,25 +8003,18 @@ var formattedValueComponentToProps = (component, rendererMapperProps) => {
|
|
|
7934
8003
|
// for now, we don't want to pass `value` down to the renderer to avoid the "WhateverComponent".
|
|
7935
8004
|
// 'value',
|
|
7936
8005
|
)), {
|
|
7937
|
-
|
|
7938
|
-
|
|
8006
|
+
onChange: component.setValue,
|
|
8007
|
+
validationState: getValidationState(component.errors, void 0)
|
|
7939
8008
|
}), rendererMapperProps);
|
|
7940
8009
|
};
|
|
7941
8010
|
|
|
7942
8011
|
// src/renderers/mappers/formComponentToProps.ts
|
|
7943
8012
|
var formComponentToProps = (component, rendererMapperProps) => {
|
|
7944
8013
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
7945
|
-
|
|
7946
|
-
return __spreadValues({
|
|
7947
|
-
uid,
|
|
7948
|
-
analyticsId,
|
|
7949
|
-
type: "form",
|
|
8014
|
+
return __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "tags")), {
|
|
7950
8015
|
children: childrenProps.map(rendererMapperProps.render),
|
|
7951
|
-
childrenProps
|
|
7952
|
-
|
|
7953
|
-
margin,
|
|
7954
|
-
tags
|
|
7955
|
-
}, rendererMapperProps);
|
|
8016
|
+
childrenProps
|
|
8017
|
+
}), rendererMapperProps);
|
|
7956
8018
|
};
|
|
7957
8019
|
|
|
7958
8020
|
// src/renderers/mappers/headingComponentToProps.ts
|
|
@@ -7985,26 +8047,18 @@ var imageComponentToProps = (component, rendererMapperProps) => __spreadProps(__
|
|
|
7985
8047
|
var instructionsComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "items", "margin", "title", "tags")), rendererMapperProps);
|
|
7986
8048
|
|
|
7987
8049
|
// src/renderers/mappers/integerInputComponentToProps.ts
|
|
7988
|
-
var integerInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-integer")), rendererMapperProps), {
|
|
7989
|
-
|
|
7990
|
-
maximum: component.maximum,
|
|
7991
|
-
minimum: component.minimum,
|
|
7992
|
-
onChange: component.onChange.bind(component)
|
|
8050
|
+
var integerInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-integer")), rendererMapperProps), pick(component, "autoComplete", "maximum", "minimum")), {
|
|
8051
|
+
onChange: component.setValue
|
|
7993
8052
|
});
|
|
7994
8053
|
|
|
7995
8054
|
// src/renderers/mappers/listComponentToProps.ts
|
|
7996
|
-
var listComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(
|
|
7997
|
-
component,
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
"items",
|
|
8004
|
-
"margin",
|
|
8005
|
-
"title",
|
|
8006
|
-
"tags"
|
|
8007
|
-
)), rendererMapperProps);
|
|
8055
|
+
var listComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "title", "tags")), {
|
|
8056
|
+
callToAction: mapCallToActionOptional(component.callToAction),
|
|
8057
|
+
items: component.items.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
8058
|
+
callToAction: mapCallToActionOptional(item.callToAction),
|
|
8059
|
+
additionalInfo: mapAdditionalInfo2(item.additionalInfo)
|
|
8060
|
+
}))
|
|
8061
|
+
}), rendererMapperProps);
|
|
8008
8062
|
|
|
8009
8063
|
// src/renderers/mappers/loadingIndicatorComponentToProps.ts
|
|
8010
8064
|
var loadingIndicatorComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "size", "tags")), rendererMapperProps);
|
|
@@ -8028,39 +8082,25 @@ var mediaComponentToProps = (component, rendererMapperProps) => __spreadValues(_
|
|
|
8028
8082
|
|
|
8029
8083
|
// src/renderers/mappers/modalComponentToProps.ts
|
|
8030
8084
|
var modalComponentToProps = (component, rendererMapperProps) => {
|
|
8031
|
-
const { uid, analyticsId, open, tags, title, close } = component;
|
|
8032
8085
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
8033
|
-
return __spreadValues({
|
|
8034
|
-
uid,
|
|
8035
|
-
analyticsId,
|
|
8036
|
-
type: "modal",
|
|
8037
|
-
open,
|
|
8038
|
-
tags,
|
|
8039
|
-
title,
|
|
8086
|
+
return __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "open", "tags", "title")), {
|
|
8040
8087
|
children: childrenProps.map(rendererMapperProps.render),
|
|
8041
8088
|
childrenProps,
|
|
8042
|
-
onClose: close
|
|
8043
|
-
}, rendererMapperProps);
|
|
8089
|
+
onClose: component.close
|
|
8090
|
+
}), rendererMapperProps);
|
|
8044
8091
|
};
|
|
8045
8092
|
|
|
8046
8093
|
// src/renderers/mappers/modalLayoutComponentToProps.ts
|
|
8047
8094
|
var modalLayoutComponentToProps = (component, rendererMapperProps) => {
|
|
8048
|
-
const {
|
|
8095
|
+
const { content } = component;
|
|
8049
8096
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
8050
|
-
return __spreadValues({
|
|
8051
|
-
uid,
|
|
8052
|
-
analyticsId,
|
|
8053
|
-
type: "modal-layout",
|
|
8097
|
+
return __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "tags", "trigger")), {
|
|
8054
8098
|
content: {
|
|
8055
8099
|
children: childrenProps.map(rendererMapperProps.render),
|
|
8056
8100
|
childrenProps,
|
|
8057
8101
|
title: content.title
|
|
8058
|
-
}
|
|
8059
|
-
|
|
8060
|
-
margin,
|
|
8061
|
-
tags,
|
|
8062
|
-
trigger
|
|
8063
|
-
}, rendererMapperProps);
|
|
8102
|
+
}
|
|
8103
|
+
}), rendererMapperProps);
|
|
8064
8104
|
};
|
|
8065
8105
|
|
|
8066
8106
|
// src/renderers/mappers/moneyInputComponentToProps.ts
|
|
@@ -8087,8 +8127,8 @@ var moneyInputComponentToProps = (component, rendererMapperProps) => {
|
|
|
8087
8127
|
return __spreadValues(__spreadProps(__spreadValues({}, inputComponentToProps(component, "money-input")), {
|
|
8088
8128
|
amountValue: amountComponent.getLocalValue(),
|
|
8089
8129
|
selectedCurrencyIndex: currencyComponent.selectedIndex,
|
|
8090
|
-
onAmountChange: amountComponent.
|
|
8091
|
-
onCurrencyChange: currencyComponent.
|
|
8130
|
+
onAmountChange: amountComponent.setValue,
|
|
8131
|
+
onCurrencyChange: currencyComponent.selectIndex,
|
|
8092
8132
|
placeholder: amountComponent.placeholder,
|
|
8093
8133
|
currencies,
|
|
8094
8134
|
validationState
|
|
@@ -8120,47 +8160,42 @@ var selectInputOptionsToProps = (options, children, rendererMapperProps) => {
|
|
|
8120
8160
|
|
|
8121
8161
|
// src/renderers/mappers/multiSelectComponentToProps.ts
|
|
8122
8162
|
var multiSelectInputComponentToProps = (component, rendererMapperProps) => {
|
|
8123
|
-
const { autoComplete, maxItems, minItems, selectedIndices, onSelect } = component;
|
|
8124
8163
|
const _a = inputComponentToProps(component, "input-multi-select"), { required, value } = _a, props = __objRest(_a, ["required", "value"]);
|
|
8125
8164
|
const options = selectInputOptionsToProps(
|
|
8126
8165
|
component.options,
|
|
8127
8166
|
component.getChildren(),
|
|
8128
8167
|
rendererMapperProps
|
|
8129
8168
|
);
|
|
8130
|
-
return __spreadProps(__spreadValues(__spreadValues({}, props), rendererMapperProps), {
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
minItems,
|
|
8134
|
-
options,
|
|
8135
|
-
selectedIndices,
|
|
8136
|
-
onSelect: onSelect.bind(component)
|
|
8169
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, props), rendererMapperProps), pick(component, "autoComplete", "maxItems", "minItems", "selectedIndices")), {
|
|
8170
|
+
onSelect: component.selectIndices,
|
|
8171
|
+
options
|
|
8137
8172
|
});
|
|
8138
8173
|
};
|
|
8139
8174
|
|
|
8140
8175
|
// src/renderers/mappers/multiUploadInputComponentToProps.ts
|
|
8141
8176
|
var multiUploadInputComponentToProps = (component, rendererMapperProps) => {
|
|
8142
|
-
const {
|
|
8143
|
-
return __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-upload-multi")), rendererMapperProps),
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8177
|
+
const { files } = component;
|
|
8178
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-upload-multi")), rendererMapperProps), pick(
|
|
8179
|
+
component,
|
|
8180
|
+
"accepts",
|
|
8181
|
+
"cameraConfig",
|
|
8182
|
+
"maxSize",
|
|
8183
|
+
"minItems",
|
|
8184
|
+
"maxItems",
|
|
8185
|
+
"source",
|
|
8186
|
+
"uploadLabel"
|
|
8187
|
+
)), {
|
|
8151
8188
|
value: files.map((file) => __spreadProps(__spreadValues({}, file), {
|
|
8152
8189
|
validationState: mapErrorsToValidationState(file.errors)
|
|
8153
8190
|
})),
|
|
8154
|
-
onInsertFile: component.
|
|
8155
|
-
onRemoveFile: component.
|
|
8191
|
+
onInsertFile: component.insertFile,
|
|
8192
|
+
onRemoveFile: component.removeFile
|
|
8156
8193
|
});
|
|
8157
8194
|
};
|
|
8158
8195
|
|
|
8159
8196
|
// src/renderers/mappers/numberInputComponentToProps.ts
|
|
8160
|
-
var numberInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-number")), rendererMapperProps), {
|
|
8161
|
-
|
|
8162
|
-
minimum: component.minimum,
|
|
8163
|
-
onChange: component.onChange.bind(component)
|
|
8197
|
+
var numberInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-number")), rendererMapperProps), pick(component, "maximum", "minimum")), {
|
|
8198
|
+
onChange: component.setValue
|
|
8164
8199
|
});
|
|
8165
8200
|
|
|
8166
8201
|
// src/renderers/mappers/objectComponentToProps.ts
|
|
@@ -8225,27 +8260,7 @@ var progressComponentToProps = (component, rendererMapperProps) => __spreadValue
|
|
|
8225
8260
|
|
|
8226
8261
|
// src/renderers/mappers/repeatableComponentToProps.ts
|
|
8227
8262
|
var repeatableComponentToProps = (component, rendererMapperProps) => {
|
|
8228
|
-
const {
|
|
8229
|
-
uid,
|
|
8230
|
-
analyticsId,
|
|
8231
|
-
addItemTitle,
|
|
8232
|
-
control,
|
|
8233
|
-
components,
|
|
8234
|
-
description,
|
|
8235
|
-
editableComponent,
|
|
8236
|
-
editItemTitle,
|
|
8237
|
-
errors,
|
|
8238
|
-
maxItems,
|
|
8239
|
-
media,
|
|
8240
|
-
minItems,
|
|
8241
|
-
summaryDefaults,
|
|
8242
|
-
title = "",
|
|
8243
|
-
tags,
|
|
8244
|
-
onEdit,
|
|
8245
|
-
onAdd,
|
|
8246
|
-
onSave,
|
|
8247
|
-
onRemove
|
|
8248
|
-
} = component;
|
|
8263
|
+
const { components, editableComponent, errors, summaryDefaults, title = "" } = component;
|
|
8249
8264
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
8250
8265
|
const editableItemProps = editableComponent ? componentToRendererProps(editableComponent, rendererMapperProps) : null;
|
|
8251
8266
|
const getSummary = (componentSummary) => {
|
|
@@ -8259,75 +8274,63 @@ var repeatableComponentToProps = (component, rendererMapperProps) => {
|
|
|
8259
8274
|
const itemProps = components.map((childComponent) => __spreadProps(__spreadValues({}, getSummary(childComponent.getSummary())), {
|
|
8260
8275
|
id: `${childComponent.uid}-summary`
|
|
8261
8276
|
}));
|
|
8262
|
-
return __spreadValues({
|
|
8263
|
-
uid,
|
|
8264
|
-
analyticsId,
|
|
8277
|
+
return __spreadValues(__spreadProps(__spreadValues({
|
|
8265
8278
|
type: "repeatable",
|
|
8279
|
+
title
|
|
8280
|
+
}, pick(
|
|
8281
|
+
component,
|
|
8282
|
+
"control",
|
|
8283
|
+
"description",
|
|
8284
|
+
"media",
|
|
8285
|
+
"tags",
|
|
8286
|
+
"uid",
|
|
8287
|
+
"analyticsId",
|
|
8288
|
+
"editItemTitle",
|
|
8289
|
+
"addItemTitle",
|
|
8290
|
+
"maxItems",
|
|
8291
|
+
"minItems"
|
|
8292
|
+
)), {
|
|
8266
8293
|
children: childrenProps.map(rendererMapperProps.render),
|
|
8267
8294
|
childrenProps,
|
|
8268
|
-
addItemTitle,
|
|
8269
|
-
control,
|
|
8270
|
-
description,
|
|
8271
8295
|
editableItem: rendererMapperProps.render(editableItemProps),
|
|
8272
8296
|
editableItemProps,
|
|
8273
|
-
editItemTitle,
|
|
8274
8297
|
items: itemProps,
|
|
8275
|
-
maxItems,
|
|
8276
|
-
media,
|
|
8277
|
-
minItems,
|
|
8278
|
-
title,
|
|
8279
|
-
tags,
|
|
8280
8298
|
validationState: mapErrorsToValidationState(errors),
|
|
8281
|
-
onAdd:
|
|
8282
|
-
onEdit:
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
}, rendererMapperProps);
|
|
8299
|
+
onAdd: component.addComponent,
|
|
8300
|
+
onEdit: component.editComponent,
|
|
8301
|
+
onRemove: component.removeComponent,
|
|
8302
|
+
onSave: component.saveComponent
|
|
8303
|
+
}), rendererMapperProps);
|
|
8286
8304
|
};
|
|
8287
8305
|
|
|
8288
8306
|
// src/renderers/mappers/reviewComponentToProps.ts
|
|
8289
|
-
var reviewComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(
|
|
8290
|
-
component,
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
"fields",
|
|
8297
|
-
"margin",
|
|
8298
|
-
"title",
|
|
8299
|
-
"tags"
|
|
8300
|
-
)), rendererMapperProps);
|
|
8307
|
+
var reviewComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "title", "tags")), {
|
|
8308
|
+
callToAction: mapCallToActionOptional(component.callToAction),
|
|
8309
|
+
fields: component.fields.map((field) => __spreadProps(__spreadValues({}, field), {
|
|
8310
|
+
callToAction: mapCallToActionOptional(field.callToAction),
|
|
8311
|
+
additionalInfo: mapAdditionalInfo2(field.additionalInfo)
|
|
8312
|
+
}))
|
|
8313
|
+
}), rendererMapperProps);
|
|
8301
8314
|
|
|
8302
8315
|
// src/renderers/mappers/searchComponentToProps.ts
|
|
8303
8316
|
var searchComponentToProps = (component, rendererMapperProps) => {
|
|
8304
|
-
const { uid,
|
|
8305
|
-
const onChange = component.onChange.bind(component);
|
|
8306
|
-
const onSelect = component.onSelect.bind(component);
|
|
8317
|
+
const { uid, emptyMessage, error, query, setQuery, selectResult } = component;
|
|
8307
8318
|
const state = getSearchState({
|
|
8308
8319
|
emptyMessage,
|
|
8309
8320
|
error,
|
|
8310
|
-
isLoading,
|
|
8321
|
+
isLoading: component.isLoading,
|
|
8311
8322
|
query,
|
|
8312
8323
|
state: component.state,
|
|
8313
8324
|
rendererMapperProps,
|
|
8314
|
-
|
|
8315
|
-
|
|
8325
|
+
setQuery,
|
|
8326
|
+
selectResult
|
|
8316
8327
|
});
|
|
8317
|
-
return __spreadValues({
|
|
8318
|
-
|
|
8328
|
+
return __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "control", "hint", "isLoading", "margin", "query", "title", "tags")), {
|
|
8329
|
+
onChange: setQuery,
|
|
8319
8330
|
type: "search",
|
|
8320
8331
|
id: uid,
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
isLoading,
|
|
8324
|
-
margin,
|
|
8325
|
-
query,
|
|
8326
|
-
state,
|
|
8327
|
-
title,
|
|
8328
|
-
tags,
|
|
8329
|
-
onChange
|
|
8330
|
-
}, rendererMapperProps);
|
|
8332
|
+
state
|
|
8333
|
+
}), rendererMapperProps);
|
|
8331
8334
|
};
|
|
8332
8335
|
var getSearchState = ({
|
|
8333
8336
|
emptyMessage,
|
|
@@ -8336,14 +8339,14 @@ var getSearchState = ({
|
|
|
8336
8339
|
query,
|
|
8337
8340
|
state,
|
|
8338
8341
|
rendererMapperProps,
|
|
8339
|
-
|
|
8340
|
-
|
|
8342
|
+
setQuery,
|
|
8343
|
+
selectResult
|
|
8341
8344
|
}) => {
|
|
8342
8345
|
if (isLoading) {
|
|
8343
8346
|
return { type: "pending" };
|
|
8344
8347
|
}
|
|
8345
8348
|
if (error) {
|
|
8346
|
-
return { type: "error", onRetry: () =>
|
|
8349
|
+
return { type: "error", onRetry: () => setQuery(query) };
|
|
8347
8350
|
}
|
|
8348
8351
|
if (!state) {
|
|
8349
8352
|
return { type: "noResults", message: emptyMessage };
|
|
@@ -8370,7 +8373,7 @@ var getSearchState = ({
|
|
|
8370
8373
|
id: result.type === "action" ? (_a = result.value.id) != null ? _a : result.value.$id : void 0,
|
|
8371
8374
|
image: mapSpecImage(result.image),
|
|
8372
8375
|
media: getDomainLayerMedia(result),
|
|
8373
|
-
onClick: () =>
|
|
8376
|
+
onClick: () => selectResult(result)
|
|
8374
8377
|
});
|
|
8375
8378
|
})
|
|
8376
8379
|
};
|
|
@@ -8381,17 +8384,9 @@ var sectionComponentToProps = (component, rendererMapperProps) => {
|
|
|
8381
8384
|
const childrenProps = component.components.map(
|
|
8382
8385
|
(c) => componentToRendererProps(c, rendererMapperProps)
|
|
8383
8386
|
);
|
|
8384
|
-
return __spreadProps(__spreadValues(__spreadValues({}, pick(
|
|
8385
|
-
component
|
|
8386
|
-
|
|
8387
|
-
"analyticsId",
|
|
8388
|
-
"type",
|
|
8389
|
-
"title",
|
|
8390
|
-
"margin",
|
|
8391
|
-
"control",
|
|
8392
|
-
"callToAction",
|
|
8393
|
-
"tags"
|
|
8394
|
-
)), rendererMapperProps), {
|
|
8387
|
+
return __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "title", "margin", "control", "tags")), {
|
|
8388
|
+
callToAction: mapCallToActionOptional(component.callToAction)
|
|
8389
|
+
}), rendererMapperProps), {
|
|
8395
8390
|
children: childrenProps.map(rendererMapperProps.render),
|
|
8396
8391
|
childrenProps
|
|
8397
8392
|
});
|
|
@@ -8400,7 +8395,7 @@ var sectionComponentToProps = (component, rendererMapperProps) => {
|
|
|
8400
8395
|
// src/renderers/mappers/selectInputComponentToProps.ts
|
|
8401
8396
|
var selectInputComponentToProps = (component, rendererMapperProps) => {
|
|
8402
8397
|
var _b;
|
|
8403
|
-
const { autoComplete, selectedIndex,
|
|
8398
|
+
const { autoComplete, selectedIndex, selectIndex } = component;
|
|
8404
8399
|
const selectedChild = component.getSelectedChild();
|
|
8405
8400
|
const childrenProps = selectedChild ? componentToRendererProps(selectedChild, rendererMapperProps) : null;
|
|
8406
8401
|
const _a = inputComponentToProps(component, "input-select"), { value } = _a, props = __objRest(_a, ["value"]);
|
|
@@ -8412,7 +8407,7 @@ var selectInputComponentToProps = (component, rendererMapperProps) => {
|
|
|
8412
8407
|
if (options.length === 1 && ((_b = options[0].childrenProps) == null ? void 0 : _b.type) === "form-section") {
|
|
8413
8408
|
if (selectedIndex == null) {
|
|
8414
8409
|
rendererMapperProps.trackEvent("OneOf Option Selected - Auto-select single-option", {});
|
|
8415
|
-
|
|
8410
|
+
selectIndex(0);
|
|
8416
8411
|
}
|
|
8417
8412
|
return options[0].childrenProps;
|
|
8418
8413
|
}
|
|
@@ -8420,14 +8415,18 @@ var selectInputComponentToProps = (component, rendererMapperProps) => {
|
|
|
8420
8415
|
autoComplete,
|
|
8421
8416
|
options,
|
|
8422
8417
|
selectedIndex,
|
|
8423
|
-
onSelect:
|
|
8418
|
+
onSelect: component.selectIndex,
|
|
8424
8419
|
children: rendererMapperProps.render(childrenProps),
|
|
8425
8420
|
childrenProps
|
|
8426
8421
|
});
|
|
8427
8422
|
};
|
|
8428
8423
|
|
|
8429
8424
|
// src/renderers/mappers/statusListComponentToProps.ts
|
|
8430
|
-
var statusListComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "
|
|
8425
|
+
var statusListComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "title", "tags")), {
|
|
8426
|
+
items: component.items.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
8427
|
+
callToAction: mapCallToActionOptional(item.callToAction)
|
|
8428
|
+
}))
|
|
8429
|
+
}), rendererMapperProps);
|
|
8431
8430
|
|
|
8432
8431
|
// src/renderers/mappers/tabsComponentToProps.ts
|
|
8433
8432
|
var tabsComponentToProps = (component, rendererMapperProps) => {
|
|
@@ -8446,15 +8445,17 @@ var tabsComponentToProps = (component, rendererMapperProps) => {
|
|
|
8446
8445
|
};
|
|
8447
8446
|
|
|
8448
8447
|
// src/renderers/mappers/textInputComponentToProps.ts
|
|
8449
|
-
var textInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-text")), rendererMapperProps),
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
displayFormat
|
|
8453
|
-
maxLength
|
|
8454
|
-
minLength
|
|
8455
|
-
pattern
|
|
8456
|
-
suggestions
|
|
8457
|
-
|
|
8448
|
+
var textInputComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-text")), rendererMapperProps), pick(
|
|
8449
|
+
component,
|
|
8450
|
+
"autoComplete",
|
|
8451
|
+
"displayFormat",
|
|
8452
|
+
"maxLength",
|
|
8453
|
+
"minLength",
|
|
8454
|
+
"pattern",
|
|
8455
|
+
"suggestions"
|
|
8456
|
+
)), {
|
|
8457
|
+
onChange: component.setValue,
|
|
8458
|
+
autoCapitalize: component == null ? void 0 : component.autocapitalization
|
|
8458
8459
|
});
|
|
8459
8460
|
|
|
8460
8461
|
// src/renderers/mappers/tupleComponentToProps.ts
|
|
@@ -8480,30 +8481,15 @@ var tupleComponentToProps = (component, rendererMapperProps) => {
|
|
|
8480
8481
|
|
|
8481
8482
|
// src/renderers/mappers/uploadInputComponentToProps.ts
|
|
8482
8483
|
var uploadInputComponentToProps = (component, rendererMapperProps) => {
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
cameraConfig,
|
|
8486
|
-
source,
|
|
8487
|
-
accepts,
|
|
8488
|
-
maxSize,
|
|
8489
|
-
onUpload: component.onUpload.bind(component)
|
|
8484
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-upload")), rendererMapperProps), pick(component, "accepts", "cameraConfig", "maxSize", "source")), {
|
|
8485
|
+
onUpload: component.setValue
|
|
8490
8486
|
});
|
|
8491
8487
|
};
|
|
8492
8488
|
|
|
8493
8489
|
// src/renderers/mappers/upsellComponentToProps.ts
|
|
8494
|
-
var upsellComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(
|
|
8495
|
-
component,
|
|
8496
|
-
|
|
8497
|
-
"analyticsId",
|
|
8498
|
-
"type",
|
|
8499
|
-
"callToAction",
|
|
8500
|
-
"control",
|
|
8501
|
-
"margin",
|
|
8502
|
-
"media",
|
|
8503
|
-
"tags",
|
|
8504
|
-
"text"
|
|
8505
|
-
)), {
|
|
8506
|
-
onDismiss: component.onDismiss ? component.onDismiss.bind(component) : void 0
|
|
8490
|
+
var upsellComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "media", "tags", "text")), {
|
|
8491
|
+
callToAction: mapCallToAction(component.callToAction),
|
|
8492
|
+
onDismiss: component.dismiss
|
|
8507
8493
|
}), rendererMapperProps);
|
|
8508
8494
|
|
|
8509
8495
|
// src/renderers/mappers/componentToRendererProps.ts
|
|
@@ -8660,7 +8646,7 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
8660
8646
|
footer: footerProps.map(rendererMapperProps.render),
|
|
8661
8647
|
footerProps,
|
|
8662
8648
|
__onAction: (action) => {
|
|
8663
|
-
void onBehavior({ type: "action", action });
|
|
8649
|
+
void onBehavior({ type: "action", action, track: false });
|
|
8664
8650
|
}
|
|
8665
8651
|
}, restMapperProps);
|
|
8666
8652
|
};
|
|
@@ -8703,27 +8689,33 @@ var subflowComponentToRendererProps = (subflow, rendererMapperProps, nativeSubfl
|
|
|
8703
8689
|
}
|
|
8704
8690
|
};
|
|
8705
8691
|
var dynamicSubflowComponentToRendererProps = (component, rendererMapperProps) => {
|
|
8706
|
-
return __spreadValues(
|
|
8707
|
-
uid: component.uid,
|
|
8692
|
+
return __spreadValues(__spreadValues({
|
|
8708
8693
|
type: "subflow-dynamic"
|
|
8709
|
-
}, pick(
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8694
|
+
}, pick(
|
|
8695
|
+
component,
|
|
8696
|
+
"uid",
|
|
8697
|
+
"requestCache",
|
|
8698
|
+
"presentation",
|
|
8699
|
+
"initialRequest",
|
|
8700
|
+
"onCancellation",
|
|
8701
|
+
"onCompletion",
|
|
8702
|
+
"onError",
|
|
8703
|
+
"onEvent"
|
|
8704
|
+
)), rendererMapperProps);
|
|
8715
8705
|
};
|
|
8716
8706
|
var nativeSubflowComponentToRendererProps = (component, rendererMapperProps) => {
|
|
8717
|
-
return __spreadValues({
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8707
|
+
return __spreadValues(__spreadValues({
|
|
8708
|
+
type: "subflow-native"
|
|
8709
|
+
}, pick(
|
|
8710
|
+
component,
|
|
8711
|
+
"uid",
|
|
8712
|
+
"id",
|
|
8713
|
+
"payload",
|
|
8714
|
+
"onCancellation",
|
|
8715
|
+
"onCompletion",
|
|
8716
|
+
"onError",
|
|
8717
|
+
"onEvent"
|
|
8718
|
+
)), rendererMapperProps);
|
|
8727
8719
|
};
|
|
8728
8720
|
|
|
8729
8721
|
// src/renderers/mappers/rootComponentToProps.ts
|
|
@@ -8801,8 +8793,6 @@ function useStableCallback(handler) {
|
|
|
8801
8793
|
// src/useDynamicFlow.tsx
|
|
8802
8794
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
8803
8795
|
var className = "dynamic-flow";
|
|
8804
|
-
var noop2 = () => {
|
|
8805
|
-
};
|
|
8806
8796
|
function useDynamicFlow(props) {
|
|
8807
8797
|
var _a, _b;
|
|
8808
8798
|
const { flowId, renderers } = props;
|
|
@@ -8824,7 +8814,6 @@ function useDynamicFlow(props) {
|
|
|
8824
8814
|
const onError = useStableCallback(props.onError);
|
|
8825
8815
|
const onEvent = useStableCallback(props.onEvent);
|
|
8826
8816
|
const onLog = useStableCallback(props.onLog);
|
|
8827
|
-
const onValueChange = noop2;
|
|
8828
8817
|
const { formatMessage, locale } = useIntl2();
|
|
8829
8818
|
const getErrorMessageFunctions = useMemo(
|
|
8830
8819
|
() => getSchemaErrorMessageFunction(formatMessage, locale),
|
|
@@ -8846,7 +8835,6 @@ function useDynamicFlow(props) {
|
|
|
8846
8835
|
onError,
|
|
8847
8836
|
onEvent,
|
|
8848
8837
|
onLog,
|
|
8849
|
-
onValueChange,
|
|
8850
8838
|
scrollToTop
|
|
8851
8839
|
}));
|
|
8852
8840
|
const render = useMemo(
|
|
@@ -9000,7 +8988,8 @@ var eventNames = [
|
|
|
9000
8988
|
"Native Subflow Triggered",
|
|
9001
8989
|
"Native Subflow Succeeded",
|
|
9002
8990
|
"Native Subflow Failed",
|
|
9003
|
-
"Native Subflow Cancelled"
|
|
8991
|
+
"Native Subflow Cancelled",
|
|
8992
|
+
"Behavior Triggered"
|
|
9004
8993
|
];
|
|
9005
8994
|
|
|
9006
8995
|
// src/renderers/subflow/getDynamicSubflowRenderer.tsx
|