@veridid/workflow-ui 0.0.0-stage → 0.1.0
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/LICENSE +202 -0
- package/README.md +202 -2
- package/build/module/WorkflowFontScaleContext.js +67 -0
- package/build/module/WorkflowFontScaleContext.js.map +1 -0
- package/build/module/adapter/WalletAdapter.js +152 -0
- package/build/module/adapter/WalletAdapter.js.map +1 -0
- package/build/module/components/FallbackVideoPlayer.js +8 -0
- package/build/module/components/FallbackVideoPlayer.js.map +1 -0
- package/build/module/components/FallbackVideoPlayer.native.js +10 -0
- package/build/module/components/FallbackVideoPlayer.native.js.map +1 -0
- package/build/module/components/FallbackVideoPlayer.web.js +35 -0
- package/build/module/components/FallbackVideoPlayer.web.js.map +1 -0
- package/build/module/components/WorkflowButtonLabel.js +32 -0
- package/build/module/components/WorkflowButtonLabel.js.map +1 -0
- package/build/module/components/WorkflowCalendarIcon.js +73 -0
- package/build/module/components/WorkflowCalendarIcon.js.map +1 -0
- package/build/module/components/WorkflowText.js +92 -0
- package/build/module/components/WorkflowText.js.map +1 -0
- package/build/module/content/BadgeContent.js +73 -0
- package/build/module/content/BadgeContent.js.map +1 -0
- package/build/module/content/BarChartContent.js +97 -0
- package/build/module/content/BarChartContent.js.map +1 -0
- package/build/module/content/BarcodeContent.js +78 -0
- package/build/module/content/BarcodeContent.js.map +1 -0
- package/build/module/content/BasicTableContent.js +145 -0
- package/build/module/content/BasicTableContent.js.map +1 -0
- package/build/module/content/ButtonContent.js +130 -0
- package/build/module/content/ButtonContent.js.map +1 -0
- package/build/module/content/CalendarContent.js +173 -0
- package/build/module/content/CalendarContent.js.map +1 -0
- package/build/module/content/CardContent.js +114 -0
- package/build/module/content/CardContent.js.map +1 -0
- package/build/module/content/CarouselContent.js +173 -0
- package/build/module/content/CarouselContent.js.map +1 -0
- package/build/module/content/ChipContent.js +214 -0
- package/build/module/content/ChipContent.js.map +1 -0
- package/build/module/content/ChipRowContent.js +127 -0
- package/build/module/content/ChipRowContent.js.map +1 -0
- package/build/module/content/CredentialOfferContent.js +312 -0
- package/build/module/content/CredentialOfferContent.js.map +1 -0
- package/build/module/content/DialContent.js +101 -0
- package/build/module/content/DialContent.js.map +1 -0
- package/build/module/content/DividerContent.js +26 -0
- package/build/module/content/DividerContent.js.map +1 -0
- package/build/module/content/DonutChartContent.js +118 -0
- package/build/module/content/DonutChartContent.js.map +1 -0
- package/build/module/content/FormContent.js +141 -0
- package/build/module/content/FormContent.js.map +1 -0
- package/build/module/content/FormFieldBridge.js +157 -0
- package/build/module/content/FormFieldBridge.js.map +1 -0
- package/build/module/content/GaugeContent.js +77 -0
- package/build/module/content/GaugeContent.js.map +1 -0
- package/build/module/content/GridLayoutContent.js +227 -0
- package/build/module/content/GridLayoutContent.js.map +1 -0
- package/build/module/content/ImageContent.js +190 -0
- package/build/module/content/ImageContent.js.map +1 -0
- package/build/module/content/ListContent.js +107 -0
- package/build/module/content/ListContent.js.map +1 -0
- package/build/module/content/LocationContent.js +148 -0
- package/build/module/content/LocationContent.js.map +1 -0
- package/build/module/content/MapContent.js +213 -0
- package/build/module/content/MapContent.js.map +1 -0
- package/build/module/content/MultipleChoiceContent.js +91 -0
- package/build/module/content/MultipleChoiceContent.js.map +1 -0
- package/build/module/content/OpenBadgePreviewContent.js +141 -0
- package/build/module/content/OpenBadgePreviewContent.js.map +1 -0
- package/build/module/content/PhotoContent.js +154 -0
- package/build/module/content/PhotoContent.js.map +1 -0
- package/build/module/content/PieChartContent.js +129 -0
- package/build/module/content/PieChartContent.js.map +1 -0
- package/build/module/content/ProofPresentationContent.js +154 -0
- package/build/module/content/ProofPresentationContent.js.map +1 -0
- package/build/module/content/RadioButtonContent.js +136 -0
- package/build/module/content/RadioButtonContent.js.map +1 -0
- package/build/module/content/RowContent.js +539 -0
- package/build/module/content/RowContent.js.map +1 -0
- package/build/module/content/SectionContent.js +123 -0
- package/build/module/content/SectionContent.js.map +1 -0
- package/build/module/content/ShareEntryContent.js +111 -0
- package/build/module/content/ShareEntryContent.js.map +1 -0
- package/build/module/content/SimulatedHint.js +33 -0
- package/build/module/content/SimulatedHint.js.map +1 -0
- package/build/module/content/SliderContent.js +46 -0
- package/build/module/content/SliderContent.js.map +1 -0
- package/build/module/content/SpacerContent.js +21 -0
- package/build/module/content/SpacerContent.js.map +1 -0
- package/build/module/content/SpinnerContent.js +33 -0
- package/build/module/content/SpinnerContent.js.map +1 -0
- package/build/module/content/SubmitButtonContent.js +281 -0
- package/build/module/content/SubmitButtonContent.js.map +1 -0
- package/build/module/content/TextContent.js +127 -0
- package/build/module/content/TextContent.js.map +1 -0
- package/build/module/content/TileContent.js +237 -0
- package/build/module/content/TileContent.js.map +1 -0
- package/build/module/content/TimelineContent.js +120 -0
- package/build/module/content/TimelineContent.js.map +1 -0
- package/build/module/content/TitleContent.js +55 -0
- package/build/module/content/TitleContent.js.map +1 -0
- package/build/module/content/VideoContent.js +142 -0
- package/build/module/content/VideoContent.js.map +1 -0
- package/build/module/content/WebLinkContent.js +95 -0
- package/build/module/content/WebLinkContent.js.map +1 -0
- package/build/module/content/index.js +48 -0
- package/build/module/content/index.js.map +1 -0
- package/build/module/form-fields/CheckboxField.js +47 -0
- package/build/module/form-fields/CheckboxField.js.map +1 -0
- package/build/module/form-fields/DateField.js +8 -0
- package/build/module/form-fields/DateField.js.map +1 -0
- package/build/module/form-fields/DateField.native.js +141 -0
- package/build/module/form-fields/DateField.native.js.map +1 -0
- package/build/module/form-fields/DateField.web.js +45 -0
- package/build/module/form-fields/DateField.web.js.map +1 -0
- package/build/module/form-fields/DropdownField.js +172 -0
- package/build/module/form-fields/DropdownField.js.map +1 -0
- package/build/module/form-fields/MCQField.js +100 -0
- package/build/module/form-fields/MCQField.js.map +1 -0
- package/build/module/form-fields/RadioField.js +56 -0
- package/build/module/form-fields/RadioField.js.map +1 -0
- package/build/module/form-fields/SliderField.js +8 -0
- package/build/module/form-fields/SliderField.js.map +1 -0
- package/build/module/form-fields/SliderField.native.js +77 -0
- package/build/module/form-fields/SliderField.native.js.map +1 -0
- package/build/module/form-fields/SliderField.web.js +82 -0
- package/build/module/form-fields/SliderField.web.js.map +1 -0
- package/build/module/form-fields/SubmitButtonField.js +42 -0
- package/build/module/form-fields/SubmitButtonField.js.map +1 -0
- package/build/module/form-fields/TextField.js +56 -0
- package/build/module/form-fields/TextField.js.map +1 -0
- package/build/module/form-fields/index.js +15 -0
- package/build/module/form-fields/index.js.map +1 -0
- package/build/module/i18n/WorkflowI18n.js +94 -0
- package/build/module/i18n/WorkflowI18n.js.map +1 -0
- package/build/module/icons/WorkflowIcon.js +50 -0
- package/build/module/icons/WorkflowIcon.js.map +1 -0
- package/build/module/imageUriCache.js +25 -0
- package/build/module/imageUriCache.js.map +1 -0
- package/build/module/index.js +49 -0
- package/build/module/index.js.map +1 -0
- package/build/module/modal/WorkflowModal.js +115 -0
- package/build/module/modal/WorkflowModal.js.map +1 -0
- package/build/module/package.json +1 -0
- package/build/module/platform/platformName.js +10 -0
- package/build/module/platform/platformName.js.map +1 -0
- package/build/module/platform/platformName.web.js +5 -0
- package/build/module/platform/platformName.web.js.map +1 -0
- package/build/module/protocol/controlSnapshotStore.js +19 -0
- package/build/module/protocol/controlSnapshotStore.js.map +1 -0
- package/build/module/protocol/useProtocolExchange.js +168 -0
- package/build/module/protocol/useProtocolExchange.js.map +1 -0
- package/build/module/registries/ContentRegistry.js +53 -0
- package/build/module/registries/ContentRegistry.js.map +1 -0
- package/build/module/registries/FormFieldRegistry.js +56 -0
- package/build/module/registries/FormFieldRegistry.js.map +1 -0
- package/build/module/render/NodeBoundary.js +73 -0
- package/build/module/render/NodeBoundary.js.map +1 -0
- package/build/module/render/RenderTree.js +52 -0
- package/build/module/render/RenderTree.js.map +1 -0
- package/build/module/render/WorkflowRenderContext.js +34 -0
- package/build/module/render/WorkflowRenderContext.js.map +1 -0
- package/build/module/render/nodes.js +103 -0
- package/build/module/render/nodes.js.map +1 -0
- package/build/module/responsive/ResponsiveProvider.js +63 -0
- package/build/module/responsive/ResponsiveProvider.js.map +1 -0
- package/build/module/responsive/index.js +4 -0
- package/build/module/responsive/index.js.map +1 -0
- package/build/module/responsive/responsive.js +56 -0
- package/build/module/responsive/responsive.js.map +1 -0
- package/build/module/style/resolveDisplayHintStyle.js +145 -0
- package/build/module/style/resolveDisplayHintStyle.js.map +1 -0
- package/build/module/theme/WorkflowTheme.js +200 -0
- package/build/module/theme/WorkflowTheme.js.map +1 -0
- package/build/module/utils/testable.js +12 -0
- package/build/module/utils/testable.js.map +1 -0
- package/build/typescript/WorkflowFontScaleContext.d.ts +7 -0
- package/build/typescript/WorkflowFontScaleContext.d.ts.map +1 -0
- package/build/typescript/adapter/WalletAdapter.d.ts +145 -0
- package/build/typescript/adapter/WalletAdapter.d.ts.map +1 -0
- package/build/typescript/components/FallbackVideoPlayer.d.ts +6 -0
- package/build/typescript/components/FallbackVideoPlayer.d.ts.map +1 -0
- package/build/typescript/components/FallbackVideoPlayer.native.d.ts +7 -0
- package/build/typescript/components/FallbackVideoPlayer.native.d.ts.map +1 -0
- package/build/typescript/components/FallbackVideoPlayer.web.d.ts +9 -0
- package/build/typescript/components/FallbackVideoPlayer.web.d.ts.map +1 -0
- package/build/typescript/components/WorkflowButtonLabel.d.ts +11 -0
- package/build/typescript/components/WorkflowButtonLabel.d.ts.map +1 -0
- package/build/typescript/components/WorkflowCalendarIcon.d.ts +11 -0
- package/build/typescript/components/WorkflowCalendarIcon.d.ts.map +1 -0
- package/build/typescript/components/WorkflowText.d.ts +13 -0
- package/build/typescript/components/WorkflowText.d.ts.map +1 -0
- package/build/typescript/content/BadgeContent.d.ts +5 -0
- package/build/typescript/content/BadgeContent.d.ts.map +1 -0
- package/build/typescript/content/BarChartContent.d.ts +5 -0
- package/build/typescript/content/BarChartContent.d.ts.map +1 -0
- package/build/typescript/content/BarcodeContent.d.ts +11 -0
- package/build/typescript/content/BarcodeContent.d.ts.map +1 -0
- package/build/typescript/content/BasicTableContent.d.ts +5 -0
- package/build/typescript/content/BasicTableContent.d.ts.map +1 -0
- package/build/typescript/content/ButtonContent.d.ts +5 -0
- package/build/typescript/content/ButtonContent.d.ts.map +1 -0
- package/build/typescript/content/CalendarContent.d.ts +19 -0
- package/build/typescript/content/CalendarContent.d.ts.map +1 -0
- package/build/typescript/content/CardContent.d.ts +5 -0
- package/build/typescript/content/CardContent.d.ts.map +1 -0
- package/build/typescript/content/CarouselContent.d.ts +5 -0
- package/build/typescript/content/CarouselContent.d.ts.map +1 -0
- package/build/typescript/content/ChipContent.d.ts +5 -0
- package/build/typescript/content/ChipContent.d.ts.map +1 -0
- package/build/typescript/content/ChipRowContent.d.ts +8 -0
- package/build/typescript/content/ChipRowContent.d.ts.map +1 -0
- package/build/typescript/content/CredentialOfferContent.d.ts +98 -0
- package/build/typescript/content/CredentialOfferContent.d.ts.map +1 -0
- package/build/typescript/content/DialContent.d.ts +5 -0
- package/build/typescript/content/DialContent.d.ts.map +1 -0
- package/build/typescript/content/DividerContent.d.ts +5 -0
- package/build/typescript/content/DividerContent.d.ts.map +1 -0
- package/build/typescript/content/DonutChartContent.d.ts +5 -0
- package/build/typescript/content/DonutChartContent.d.ts.map +1 -0
- package/build/typescript/content/FormContent.d.ts +19 -0
- package/build/typescript/content/FormContent.d.ts.map +1 -0
- package/build/typescript/content/FormFieldBridge.d.ts +2 -0
- package/build/typescript/content/FormFieldBridge.d.ts.map +1 -0
- package/build/typescript/content/GaugeContent.d.ts +5 -0
- package/build/typescript/content/GaugeContent.d.ts.map +1 -0
- package/build/typescript/content/GridLayoutContent.d.ts +5 -0
- package/build/typescript/content/GridLayoutContent.d.ts.map +1 -0
- package/build/typescript/content/ImageContent.d.ts +5 -0
- package/build/typescript/content/ImageContent.d.ts.map +1 -0
- package/build/typescript/content/ListContent.d.ts +5 -0
- package/build/typescript/content/ListContent.d.ts.map +1 -0
- package/build/typescript/content/LocationContent.d.ts +32 -0
- package/build/typescript/content/LocationContent.d.ts.map +1 -0
- package/build/typescript/content/MapContent.d.ts +11 -0
- package/build/typescript/content/MapContent.d.ts.map +1 -0
- package/build/typescript/content/MultipleChoiceContent.d.ts +5 -0
- package/build/typescript/content/MultipleChoiceContent.d.ts.map +1 -0
- package/build/typescript/content/OpenBadgePreviewContent.d.ts +14 -0
- package/build/typescript/content/OpenBadgePreviewContent.d.ts.map +1 -0
- package/build/typescript/content/PhotoContent.d.ts +57 -0
- package/build/typescript/content/PhotoContent.d.ts.map +1 -0
- package/build/typescript/content/PieChartContent.d.ts +5 -0
- package/build/typescript/content/PieChartContent.d.ts.map +1 -0
- package/build/typescript/content/ProofPresentationContent.d.ts +14 -0
- package/build/typescript/content/ProofPresentationContent.d.ts.map +1 -0
- package/build/typescript/content/RadioButtonContent.d.ts +5 -0
- package/build/typescript/content/RadioButtonContent.d.ts.map +1 -0
- package/build/typescript/content/RowContent.d.ts +5 -0
- package/build/typescript/content/RowContent.d.ts.map +1 -0
- package/build/typescript/content/SectionContent.d.ts +5 -0
- package/build/typescript/content/SectionContent.d.ts.map +1 -0
- package/build/typescript/content/ShareEntryContent.d.ts +15 -0
- package/build/typescript/content/ShareEntryContent.d.ts.map +1 -0
- package/build/typescript/content/SimulatedHint.d.ts +9 -0
- package/build/typescript/content/SimulatedHint.d.ts.map +1 -0
- package/build/typescript/content/SliderContent.d.ts +10 -0
- package/build/typescript/content/SliderContent.d.ts.map +1 -0
- package/build/typescript/content/SpacerContent.d.ts +5 -0
- package/build/typescript/content/SpacerContent.d.ts.map +1 -0
- package/build/typescript/content/SpinnerContent.d.ts +5 -0
- package/build/typescript/content/SpinnerContent.d.ts.map +1 -0
- package/build/typescript/content/SubmitButtonContent.d.ts +9 -0
- package/build/typescript/content/SubmitButtonContent.d.ts.map +1 -0
- package/build/typescript/content/TextContent.d.ts +5 -0
- package/build/typescript/content/TextContent.d.ts.map +1 -0
- package/build/typescript/content/TileContent.d.ts +5 -0
- package/build/typescript/content/TileContent.d.ts.map +1 -0
- package/build/typescript/content/TimelineContent.d.ts +5 -0
- package/build/typescript/content/TimelineContent.d.ts.map +1 -0
- package/build/typescript/content/TitleContent.d.ts +5 -0
- package/build/typescript/content/TitleContent.d.ts.map +1 -0
- package/build/typescript/content/VideoContent.d.ts +10 -0
- package/build/typescript/content/VideoContent.d.ts.map +1 -0
- package/build/typescript/content/WebLinkContent.d.ts +5 -0
- package/build/typescript/content/WebLinkContent.d.ts.map +1 -0
- package/build/typescript/content/index.d.ts +46 -0
- package/build/typescript/content/index.d.ts.map +1 -0
- package/build/typescript/form-fields/CheckboxField.d.ts +5 -0
- package/build/typescript/form-fields/CheckboxField.d.ts.map +1 -0
- package/build/typescript/form-fields/DateField.d.ts +6 -0
- package/build/typescript/form-fields/DateField.d.ts.map +1 -0
- package/build/typescript/form-fields/DateField.native.d.ts +5 -0
- package/build/typescript/form-fields/DateField.native.d.ts.map +1 -0
- package/build/typescript/form-fields/DateField.web.d.ts +9 -0
- package/build/typescript/form-fields/DateField.web.d.ts.map +1 -0
- package/build/typescript/form-fields/DropdownField.d.ts +5 -0
- package/build/typescript/form-fields/DropdownField.d.ts.map +1 -0
- package/build/typescript/form-fields/MCQField.d.ts +5 -0
- package/build/typescript/form-fields/MCQField.d.ts.map +1 -0
- package/build/typescript/form-fields/RadioField.d.ts +5 -0
- package/build/typescript/form-fields/RadioField.d.ts.map +1 -0
- package/build/typescript/form-fields/SliderField.d.ts +6 -0
- package/build/typescript/form-fields/SliderField.d.ts.map +1 -0
- package/build/typescript/form-fields/SliderField.native.d.ts +5 -0
- package/build/typescript/form-fields/SliderField.native.d.ts.map +1 -0
- package/build/typescript/form-fields/SliderField.web.d.ts +11 -0
- package/build/typescript/form-fields/SliderField.web.d.ts.map +1 -0
- package/build/typescript/form-fields/SubmitButtonField.d.ts +5 -0
- package/build/typescript/form-fields/SubmitButtonField.d.ts.map +1 -0
- package/build/typescript/form-fields/TextField.d.ts +5 -0
- package/build/typescript/form-fields/TextField.d.ts.map +1 -0
- package/build/typescript/form-fields/index.d.ts +13 -0
- package/build/typescript/form-fields/index.d.ts.map +1 -0
- package/build/typescript/i18n/WorkflowI18n.d.ts +75 -0
- package/build/typescript/i18n/WorkflowI18n.d.ts.map +1 -0
- package/build/typescript/icons/WorkflowIcon.d.ts +27 -0
- package/build/typescript/icons/WorkflowIcon.d.ts.map +1 -0
- package/build/typescript/imageUriCache.d.ts +7 -0
- package/build/typescript/imageUriCache.d.ts.map +1 -0
- package/build/typescript/index.d.ts +47 -0
- package/build/typescript/index.d.ts.map +1 -0
- package/build/typescript/modal/WorkflowModal.d.ts +33 -0
- package/build/typescript/modal/WorkflowModal.d.ts.map +1 -0
- package/build/typescript/package.json +1 -0
- package/build/typescript/platform/platformName.d.ts +8 -0
- package/build/typescript/platform/platformName.d.ts.map +1 -0
- package/build/typescript/platform/platformName.web.d.ts +3 -0
- package/build/typescript/platform/platformName.web.d.ts.map +1 -0
- package/build/typescript/protocol/controlSnapshotStore.d.ts +12 -0
- package/build/typescript/protocol/controlSnapshotStore.d.ts.map +1 -0
- package/build/typescript/protocol/useProtocolExchange.d.ts +40 -0
- package/build/typescript/protocol/useProtocolExchange.d.ts.map +1 -0
- package/build/typescript/registries/ContentRegistry.d.ts +57 -0
- package/build/typescript/registries/ContentRegistry.d.ts.map +1 -0
- package/build/typescript/registries/FormFieldRegistry.d.ts +37 -0
- package/build/typescript/registries/FormFieldRegistry.d.ts.map +1 -0
- package/build/typescript/render/NodeBoundary.d.ts +25 -0
- package/build/typescript/render/NodeBoundary.d.ts.map +1 -0
- package/build/typescript/render/RenderTree.d.ts +23 -0
- package/build/typescript/render/RenderTree.d.ts.map +1 -0
- package/build/typescript/render/WorkflowRenderContext.d.ts +57 -0
- package/build/typescript/render/WorkflowRenderContext.d.ts.map +1 -0
- package/build/typescript/render/nodes.d.ts +49 -0
- package/build/typescript/render/nodes.d.ts.map +1 -0
- package/build/typescript/responsive/ResponsiveProvider.d.ts +39 -0
- package/build/typescript/responsive/ResponsiveProvider.d.ts.map +1 -0
- package/build/typescript/responsive/index.d.ts +3 -0
- package/build/typescript/responsive/index.d.ts.map +1 -0
- package/build/typescript/responsive/responsive.d.ts +24 -0
- package/build/typescript/responsive/responsive.d.ts.map +1 -0
- package/build/typescript/style/resolveDisplayHintStyle.d.ts +23 -0
- package/build/typescript/style/resolveDisplayHintStyle.d.ts.map +1 -0
- package/build/typescript/theme/WorkflowTheme.d.ts +177 -0
- package/build/typescript/theme/WorkflowTheme.d.ts.map +1 -0
- package/build/typescript/utils/testable.d.ts +8 -0
- package/build/typescript/utils/testable.d.ts.map +1 -0
- package/package.json +101 -3
- package/src/WorkflowFontScaleContext.tsx +74 -0
- package/src/adapter/WalletAdapter.tsx +225 -0
- package/src/components/FallbackVideoPlayer.native.tsx +9 -0
- package/src/components/FallbackVideoPlayer.tsx +5 -0
- package/src/components/FallbackVideoPlayer.web.tsx +24 -0
- package/src/components/WorkflowButtonLabel.tsx +41 -0
- package/src/components/WorkflowCalendarIcon.tsx +52 -0
- package/src/components/WorkflowText.tsx +121 -0
- package/src/content/BadgeContent.tsx +57 -0
- package/src/content/BarChartContent.tsx +76 -0
- package/src/content/BarcodeContent.tsx +59 -0
- package/src/content/BasicTableContent.tsx +139 -0
- package/src/content/ButtonContent.tsx +124 -0
- package/src/content/CalendarContent.tsx +178 -0
- package/src/content/CardContent.tsx +137 -0
- package/src/content/CarouselContent.tsx +197 -0
- package/src/content/ChipContent.tsx +209 -0
- package/src/content/ChipRowContent.tsx +133 -0
- package/src/content/CredentialOfferContent.tsx +229 -0
- package/src/content/DialContent.tsx +96 -0
- package/src/content/DividerContent.tsx +33 -0
- package/src/content/DonutChartContent.tsx +110 -0
- package/src/content/FormContent.tsx +158 -0
- package/src/content/FormFieldBridge.tsx +144 -0
- package/src/content/GaugeContent.tsx +66 -0
- package/src/content/GridLayoutContent.tsx +285 -0
- package/src/content/ImageContent.tsx +222 -0
- package/src/content/ListContent.tsx +98 -0
- package/src/content/LocationContent.tsx +135 -0
- package/src/content/MapContent.tsx +232 -0
- package/src/content/MultipleChoiceContent.tsx +74 -0
- package/src/content/OpenBadgePreviewContent.tsx +93 -0
- package/src/content/PhotoContent.tsx +110 -0
- package/src/content/PieChartContent.tsx +121 -0
- package/src/content/ProofPresentationContent.tsx +127 -0
- package/src/content/RadioButtonContent.tsx +129 -0
- package/src/content/RowContent.tsx +627 -0
- package/src/content/SectionContent.tsx +133 -0
- package/src/content/ShareEntryContent.tsx +109 -0
- package/src/content/SimulatedHint.tsx +20 -0
- package/src/content/SliderContent.tsx +56 -0
- package/src/content/SpacerContent.tsx +15 -0
- package/src/content/SpinnerContent.tsx +24 -0
- package/src/content/SubmitButtonContent.tsx +256 -0
- package/src/content/TextContent.tsx +140 -0
- package/src/content/TileContent.tsx +216 -0
- package/src/content/TimelineContent.tsx +91 -0
- package/src/content/TitleContent.tsx +49 -0
- package/src/content/VideoContent.tsx +131 -0
- package/src/content/WebLinkContent.tsx +87 -0
- package/src/content/index.ts +45 -0
- package/src/form-fields/CheckboxField.tsx +29 -0
- package/src/form-fields/DateField.native.tsx +123 -0
- package/src/form-fields/DateField.tsx +5 -0
- package/src/form-fields/DateField.web.tsx +32 -0
- package/src/form-fields/DropdownField.tsx +137 -0
- package/src/form-fields/MCQField.tsx +68 -0
- package/src/form-fields/RadioField.tsx +53 -0
- package/src/form-fields/SliderField.native.tsx +53 -0
- package/src/form-fields/SliderField.tsx +5 -0
- package/src/form-fields/SliderField.web.tsx +58 -0
- package/src/form-fields/SubmitButtonField.tsx +33 -0
- package/src/form-fields/TextField.tsx +49 -0
- package/src/form-fields/index.ts +12 -0
- package/src/i18n/WorkflowI18n.tsx +100 -0
- package/src/icons/WorkflowIcon.tsx +43 -0
- package/src/imageUriCache.ts +27 -0
- package/src/index.ts +96 -0
- package/src/modal/WorkflowModal.tsx +119 -0
- package/src/platform/platformName.ts +7 -0
- package/src/platform/platformName.web.ts +2 -0
- package/src/protocol/controlSnapshotStore.ts +25 -0
- package/src/protocol/useProtocolExchange.ts +185 -0
- package/src/registries/ContentRegistry.tsx +130 -0
- package/src/registries/FormFieldRegistry.tsx +83 -0
- package/src/render/NodeBoundary.tsx +69 -0
- package/src/render/RenderTree.tsx +63 -0
- package/src/render/WorkflowRenderContext.tsx +71 -0
- package/src/render/nodes.ts +104 -0
- package/src/responsive/ResponsiveProvider.tsx +103 -0
- package/src/responsive/index.ts +7 -0
- package/src/responsive/responsive.ts +67 -0
- package/src/style/resolveDisplayHintStyle.ts +153 -0
- package/src/theme/WorkflowTheme.tsx +162 -0
- package/src/utils/testable.ts +10 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View } from 'react-native'
|
|
3
|
+
|
|
4
|
+
import WorkflowText from '../components/WorkflowText'
|
|
5
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
6
|
+
import { FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
7
|
+
import { resolveItemBackgroundColor } from '../style/resolveDisplayHintStyle'
|
|
8
|
+
import { coerceToChipRowItem } from './ChipRowContent'
|
|
9
|
+
|
|
10
|
+
const mapTypeToRegistryType = (type: string): string => {
|
|
11
|
+
const typeMap: { [key: string]: string } = {
|
|
12
|
+
'text-field': 'text',
|
|
13
|
+
'check-box': 'checkbox',
|
|
14
|
+
'drop-down': 'dropdown',
|
|
15
|
+
'submit-button': 'submit-button',
|
|
16
|
+
'text-area': 'textarea',
|
|
17
|
+
'radio-button': 'radio',
|
|
18
|
+
mcq: 'mcq',
|
|
19
|
+
'multiple-choice': 'mcq',
|
|
20
|
+
'date-field': 'date',
|
|
21
|
+
'slider-field': 'slider',
|
|
22
|
+
}
|
|
23
|
+
return typeMap[type] || type
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const MEDIA_CHILD_TYPES = new Set(['image', 'video', 'photo'])
|
|
27
|
+
|
|
28
|
+
const SectionContent: React.FC<ContentProps> = ({
|
|
29
|
+
item,
|
|
30
|
+
onAction,
|
|
31
|
+
styles,
|
|
32
|
+
colors,
|
|
33
|
+
formData,
|
|
34
|
+
onFieldChange,
|
|
35
|
+
buttonVariant,
|
|
36
|
+
mediaFrame,
|
|
37
|
+
fillContainer,
|
|
38
|
+
disabled,
|
|
39
|
+
}) => {
|
|
40
|
+
const children = item.children as ContentProps['item'][] | undefined
|
|
41
|
+
if (!children || children.length === 0) return null
|
|
42
|
+
|
|
43
|
+
const chipRowItem = coerceToChipRowItem(item)
|
|
44
|
+
if (chipRowItem && ContentRegistry.has('chip-row')) {
|
|
45
|
+
return ContentRegistry.render('chip-row', {
|
|
46
|
+
item: chipRowItem,
|
|
47
|
+
onAction,
|
|
48
|
+
styles,
|
|
49
|
+
colors,
|
|
50
|
+
formData,
|
|
51
|
+
onFieldChange,
|
|
52
|
+
buttonVariant,
|
|
53
|
+
disabled,
|
|
54
|
+
}) as React.ReactElement
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const gap = typeof item.gap === 'number' ? item.gap : 10
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<View
|
|
61
|
+
style={[
|
|
62
|
+
{
|
|
63
|
+
gap,
|
|
64
|
+
backgroundColor: resolveItemBackgroundColor(item) ?? 'transparent',
|
|
65
|
+
padding: item.padding,
|
|
66
|
+
width: '100%',
|
|
67
|
+
justifyContent:
|
|
68
|
+
item.justify === 'center' ? 'center' : item.justify === 'flex-end' ? 'flex-end' : 'flex-start',
|
|
69
|
+
},
|
|
70
|
+
fillContainer ? { flex: 1, height: '100%' } : null,
|
|
71
|
+
]}
|
|
72
|
+
>
|
|
73
|
+
{item.title ? (
|
|
74
|
+
<WorkflowText
|
|
75
|
+
variant="heading"
|
|
76
|
+
numberOfLines={1}
|
|
77
|
+
style={{ color: colors.text, marginBottom: 12, width: '100%' }}
|
|
78
|
+
>
|
|
79
|
+
{item.title}
|
|
80
|
+
</WorkflowText>
|
|
81
|
+
) : null}
|
|
82
|
+
{children.map((child: ContentProps['item'], index: number) => {
|
|
83
|
+
const registryType = mapTypeToRegistryType(child.type)
|
|
84
|
+
const isFormField = child['form-id'] !== undefined && FormFieldRegistry.has(registryType)
|
|
85
|
+
const childMediaFrame = MEDIA_CHILD_TYPES.has(String(child.type)) ? mediaFrame : undefined
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<View key={`section-child-${index}`} style={{ minWidth: 0, width: '100%' }}>
|
|
89
|
+
{isFormField
|
|
90
|
+
? FormFieldRegistry.render(registryType, {
|
|
91
|
+
field: {
|
|
92
|
+
name: child['form-id'] || '',
|
|
93
|
+
label: child.label || '',
|
|
94
|
+
placeholder: child.placeholder,
|
|
95
|
+
options: child.values || child.options || [],
|
|
96
|
+
required: child.required,
|
|
97
|
+
type: registryType,
|
|
98
|
+
min: child.min ? Number(child.min) : undefined,
|
|
99
|
+
max: child.max ? Number(child.max) : undefined,
|
|
100
|
+
},
|
|
101
|
+
value: formData?.[child['form-id'] || ''],
|
|
102
|
+
onChange: (value: unknown) => {
|
|
103
|
+
if (child.type === 'submit-button' && child.actionID) {
|
|
104
|
+
onAction(child.actionID, formData)
|
|
105
|
+
} else if (child['form-id']) {
|
|
106
|
+
onFieldChange?.(child['form-id'], value)
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
styles,
|
|
110
|
+
colors,
|
|
111
|
+
})
|
|
112
|
+
: ContentRegistry.render(child.type, {
|
|
113
|
+
item: child,
|
|
114
|
+
onAction,
|
|
115
|
+
styles,
|
|
116
|
+
colors,
|
|
117
|
+
formData,
|
|
118
|
+
onFieldChange,
|
|
119
|
+
FormFieldRegistry,
|
|
120
|
+
buttonVariant,
|
|
121
|
+
mediaFrame: childMediaFrame,
|
|
122
|
+
disabled,
|
|
123
|
+
})}
|
|
124
|
+
</View>
|
|
125
|
+
)
|
|
126
|
+
})}
|
|
127
|
+
</View>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
ContentRegistry.register('section', SectionContent)
|
|
132
|
+
|
|
133
|
+
export default SectionContent
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import { useWalletAdapter } from '../adapter/WalletAdapter'
|
|
4
|
+
import WorkflowButtonLabel from '../components/WorkflowButtonLabel'
|
|
5
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
6
|
+
import { WorkflowIcon } from '../icons/WorkflowIcon'
|
|
7
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
8
|
+
import { useResponsive } from '../responsive'
|
|
9
|
+
import {
|
|
10
|
+
resolveButtonFillStyle,
|
|
11
|
+
resolveItemSurfaceStyle,
|
|
12
|
+
resolveSurfaceBackground,
|
|
13
|
+
} from '../style/resolveDisplayHintStyle'
|
|
14
|
+
import { pill } from './LocationContent'
|
|
15
|
+
import { SimulatedHint } from './SimulatedHint'
|
|
16
|
+
|
|
17
|
+
const escapeHtml = (input: string) =>
|
|
18
|
+
input
|
|
19
|
+
.replace(/&/g, '&')
|
|
20
|
+
.replace(/</g, '<')
|
|
21
|
+
.replace(/>/g, '>')
|
|
22
|
+
.replace(/"/g, '"')
|
|
23
|
+
.replace(/'/g, ''')
|
|
24
|
+
|
|
25
|
+
/** Plain-text report of the screen's answers (labels from the screen's items). */
|
|
26
|
+
export function buildShareReport(
|
|
27
|
+
formData: Record<string, unknown>,
|
|
28
|
+
content: Array<Record<string, unknown>>,
|
|
29
|
+
strings: { title: string; responses: string; noData: string },
|
|
30
|
+
now: Date = new Date()
|
|
31
|
+
): string {
|
|
32
|
+
let report = `${strings.title}\n${'='.repeat(40)}\n\n${now.toLocaleString()}\n\n`
|
|
33
|
+
const entries = Object.entries(formData)
|
|
34
|
+
if (entries.length === 0) return `${report}${strings.noData}\n`
|
|
35
|
+
report += `${strings.responses}\n${'-'.repeat(40)}\n\n`
|
|
36
|
+
for (const [fieldId, value] of entries) {
|
|
37
|
+
const field = content.find((c) => c['form-id'] === fieldId)
|
|
38
|
+
const label = (field?.label as string | undefined) || (field?.question as string | undefined) || fieldId
|
|
39
|
+
report += `${label}\n ${Array.isArray(value) ? value.join(', ') : String(value)}\n\n`
|
|
40
|
+
}
|
|
41
|
+
return report
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* "Share" pill: turns the screen's answers into a PDF report and opens the
|
|
46
|
+
* share sheet (`adapter.exportPdf` + `adapter.share`).
|
|
47
|
+
*/
|
|
48
|
+
const ShareEntryContent: React.FC<ContentProps> = ({
|
|
49
|
+
item,
|
|
50
|
+
formData = {},
|
|
51
|
+
content = [],
|
|
52
|
+
groupFontScale = 1,
|
|
53
|
+
disabled,
|
|
54
|
+
}) => {
|
|
55
|
+
const t = useWorkflowT()
|
|
56
|
+
const adapter = useWalletAdapter()
|
|
57
|
+
const { ms } = useResponsive()
|
|
58
|
+
|
|
59
|
+
const handleShare = async () => {
|
|
60
|
+
if (disabled) return
|
|
61
|
+
try {
|
|
62
|
+
const report = buildShareReport(formData, content, {
|
|
63
|
+
title: t('WorkflowUi.ReportTitle'),
|
|
64
|
+
responses: t('WorkflowUi.Responses'),
|
|
65
|
+
noData: t('WorkflowUi.NoData'),
|
|
66
|
+
})
|
|
67
|
+
const html = `<html><head><meta charset="utf-8" /><style>body { font-family: Arial, sans-serif; padding: 20px; } pre { white-space: pre-wrap; font-family: 'Courier New', monospace; }</style></head><body><pre>${escapeHtml(report)}</pre></body></html>`
|
|
68
|
+
const pdf = await adapter.exportPdf({ html, fileName: 'DigiCred_Report' })
|
|
69
|
+
if (!pdf?.uri) throw new Error('PDF generation failed')
|
|
70
|
+
await adapter.share({ url: pdf.uri, type: 'application/pdf', title: t('WorkflowUi.ReportTitle') })
|
|
71
|
+
} catch {
|
|
72
|
+
adapter.alert(t('WorkflowUi.Error'), t('WorkflowUi.ShareFailed'))
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const isTransparent = resolveSurfaceBackground(item.bgColor as string | undefined) === 'transparent'
|
|
77
|
+
const labelColor = '#FFFFFF'
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<View style={[pill.wrap, resolveItemSurfaceStyle(item as any)]}>
|
|
81
|
+
<TouchableOpacity
|
|
82
|
+
accessibilityRole="button"
|
|
83
|
+
style={[
|
|
84
|
+
pill.pill,
|
|
85
|
+
{ minHeight: 52, paddingVertical: 14, paddingHorizontal: 18, borderRadius: 26 },
|
|
86
|
+
resolveButtonFillStyle(item as any, { includePadding: false }),
|
|
87
|
+
isTransparent ? { backgroundColor: 'transparent', borderWidth: 1.5, borderColor: '#FFFFFF' } : null,
|
|
88
|
+
disabled ? pill.disabled : null,
|
|
89
|
+
]}
|
|
90
|
+
onPress={handleShare}
|
|
91
|
+
disabled={disabled}
|
|
92
|
+
activeOpacity={0.85}
|
|
93
|
+
>
|
|
94
|
+
<WorkflowIcon name="share" size={18} color={labelColor} style={{ marginRight: 8 }} />
|
|
95
|
+
<WorkflowButtonLabel
|
|
96
|
+
style={[pill.text, { fontSize: ms(15), color: labelColor }]}
|
|
97
|
+
groupFontScale={groupFontScale}
|
|
98
|
+
>
|
|
99
|
+
{(typeof item.label === 'string' && item.label) || t('WorkflowUi.Share')}
|
|
100
|
+
</WorkflowButtonLabel>
|
|
101
|
+
</TouchableOpacity>
|
|
102
|
+
{adapter.simulated ? <SimulatedHint /> : null}
|
|
103
|
+
</View>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
ContentRegistry.register('share-entry', ShareEntryContent)
|
|
108
|
+
|
|
109
|
+
export default ShareEntryContent
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StyleSheet, Text } from 'react-native'
|
|
2
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One line under a device or credential control when the adapter is the
|
|
6
|
+
* simulated one (the designer), so nobody mistakes the preview for a real
|
|
7
|
+
* camera, scan or credential exchange. Never shown in the wallet.
|
|
8
|
+
*/
|
|
9
|
+
export function SimulatedHint({ color }: { color?: string }) {
|
|
10
|
+
const t = useWorkflowT()
|
|
11
|
+
return (
|
|
12
|
+
<Text style={[hint.text, color ? { color } : null]} testID="workflow-simulated-hint">
|
|
13
|
+
{t('WorkflowUi.Simulated')}
|
|
14
|
+
</Text>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const hint = StyleSheet.create({
|
|
19
|
+
text: { fontSize: 11, fontStyle: 'italic', color: '#9CA3AF', textAlign: 'center', marginTop: 4 },
|
|
20
|
+
})
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { View } from 'react-native'
|
|
4
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
5
|
+
import { FormFieldRegistry } from '../registries/FormFieldRegistry'
|
|
6
|
+
|
|
7
|
+
interface SliderContentProps extends ContentProps {
|
|
8
|
+
formData?: Record<string, any>
|
|
9
|
+
onFieldChange?: (name: string, value: any) => void
|
|
10
|
+
FormFieldRegistry?: any
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const SliderContent: React.FC<SliderContentProps> = ({
|
|
14
|
+
item,
|
|
15
|
+
styles,
|
|
16
|
+
colors,
|
|
17
|
+
formData = {},
|
|
18
|
+
onFieldChange,
|
|
19
|
+
FormFieldRegistry: FormFieldReg,
|
|
20
|
+
}) => {
|
|
21
|
+
const fieldName = (item['form-id'] as string | undefined) ?? 'slider'
|
|
22
|
+
const currentValue = formData?.[fieldName] ?? item.value ?? 0
|
|
23
|
+
|
|
24
|
+
const handleChange = (value: any) => {
|
|
25
|
+
if (onFieldChange) {
|
|
26
|
+
onFieldChange(fieldName, value)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const field = {
|
|
31
|
+
type: 'slider',
|
|
32
|
+
name: fieldName,
|
|
33
|
+
label: ((item.label ?? item.question) as string | undefined) ?? '',
|
|
34
|
+
min: item.min != null ? Number(item.min) : 0,
|
|
35
|
+
max: item.max != null ? Number(item.max) : 100,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Use the passed FormFieldRegistry or import the global one
|
|
39
|
+
const registry = FormFieldReg || FormFieldRegistry
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<View>
|
|
43
|
+
{registry.render('slider', {
|
|
44
|
+
field,
|
|
45
|
+
value: currentValue,
|
|
46
|
+
onChange: handleChange,
|
|
47
|
+
styles,
|
|
48
|
+
colors,
|
|
49
|
+
})}
|
|
50
|
+
</View>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
ContentRegistry.register('slider', SliderContent)
|
|
55
|
+
|
|
56
|
+
export default SliderContent
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View } from 'react-native'
|
|
3
|
+
|
|
4
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
5
|
+
import { resolveSurfacePadding } from '../style/resolveDisplayHintStyle'
|
|
6
|
+
|
|
7
|
+
const SpacerContent: React.FC<ContentProps> = ({ item }) => {
|
|
8
|
+
const paddingHeight = resolveSurfacePadding(item.padding)
|
|
9
|
+
const height = paddingHeight ?? (typeof item.gap === 'number' ? item.gap : 16)
|
|
10
|
+
return <View style={{ height }} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
ContentRegistry.register('spacer', SpacerContent)
|
|
14
|
+
|
|
15
|
+
export default SpacerContent
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ActivityIndicator, Text, View } from 'react-native'
|
|
3
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
4
|
+
import { resolveItemSurfaceStyle } from '../style/resolveDisplayHintStyle'
|
|
5
|
+
|
|
6
|
+
const SpinnerContent: React.FC<ContentProps> = ({ item, styles, colors }) => {
|
|
7
|
+
return (
|
|
8
|
+
<View
|
|
9
|
+
style={[
|
|
10
|
+
styles.fieldContainer,
|
|
11
|
+
resolveItemSurfaceStyle(item),
|
|
12
|
+
{ flexDirection: 'row', alignItems: 'center', gap: 8 },
|
|
13
|
+
]}
|
|
14
|
+
>
|
|
15
|
+
<ActivityIndicator color={colors.primary} />
|
|
16
|
+
{item.label ? <Text style={{ color: colors.text, fontSize: 14 }}>{item.label}</Text> : null}
|
|
17
|
+
</View>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ContentRegistry.register('spinner', SpinnerContent)
|
|
22
|
+
ContentRegistry.register('loading', SpinnerContent)
|
|
23
|
+
|
|
24
|
+
export default SpinnerContent
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { buildInputFromValues, flattenInputSchema, type InputSchema, isInputComplete } from '@veridid/workflow-core'
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react'
|
|
3
|
+
import { ActivityIndicator, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native'
|
|
4
|
+
import WorkflowButtonLabel from '../components/WorkflowButtonLabel'
|
|
5
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
6
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
7
|
+
import { useResponsive } from '../responsive'
|
|
8
|
+
import { resolveButtonFillStyle, resolveSurfaceBackground } from '../style/resolveDisplayHintStyle'
|
|
9
|
+
import { testIdWithKey } from '../utils/testable'
|
|
10
|
+
|
|
11
|
+
interface SubmitButtonContentProps extends ContentProps {
|
|
12
|
+
formData?: Record<string, any>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const ERROR_FLASH_MS = 2200
|
|
16
|
+
const ERROR_COLOR = '#FFB020'
|
|
17
|
+
|
|
18
|
+
const SubmitButtonContent: React.FC<SubmitButtonContentProps> = ({
|
|
19
|
+
item,
|
|
20
|
+
onAction,
|
|
21
|
+
formData = {},
|
|
22
|
+
fillContainer,
|
|
23
|
+
groupFontScale = 1,
|
|
24
|
+
disabled,
|
|
25
|
+
}) => {
|
|
26
|
+
const { s, ms, isSmall } = useResponsive()
|
|
27
|
+
// Tracks whether THIS button was the one tapped — `disabled` alone (the
|
|
28
|
+
// screen-wide busy flag) can't distinguish that, it's the same `true` for
|
|
29
|
+
// every button on screen the instant any one of them fires. Only the
|
|
30
|
+
// tapped one swaps its label for a spinner; the rest just go inert.
|
|
31
|
+
const t = useWorkflowT()
|
|
32
|
+
const [isSubmitting, setIsSubmitting] = useState(false)
|
|
33
|
+
// Brief, self-clearing error indicator on THIS button when its own tap's
|
|
34
|
+
// advance() rejects — the exit path back to normal is automatic (a timer),
|
|
35
|
+
// never a dead end waiting on some other signal. Independent of `disabled`
|
|
36
|
+
// clearing (which can happen in the same tick via the host's own
|
|
37
|
+
// try/finally) so the flash is visible on its own terms.
|
|
38
|
+
const [hasError, setHasError] = useState(false)
|
|
39
|
+
const mountedRef = useRef(true)
|
|
40
|
+
const errorTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
return () => {
|
|
44
|
+
mountedRef.current = false
|
|
45
|
+
if (errorTimerRef.current) clearTimeout(errorTimerRef.current)
|
|
46
|
+
}
|
|
47
|
+
}, [])
|
|
48
|
+
|
|
49
|
+
// The screen clears `disabled` once advance() settles (success or error) —
|
|
50
|
+
// reset local state in lockstep so a later tap isn't stuck showing a
|
|
51
|
+
// spinner from a previous, already-finished submit. advance() itself is
|
|
52
|
+
// bounded by the workflow engine's own action timeout, so this is never an
|
|
53
|
+
// indefinite wait.
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!disabled) setIsSubmitting(false)
|
|
56
|
+
}, [disabled])
|
|
57
|
+
|
|
58
|
+
const handlePress = () => {
|
|
59
|
+
if (disabled) return
|
|
60
|
+
const id = (item.event as string | undefined) || (item.actionID as string | undefined)
|
|
61
|
+
if (!id) return
|
|
62
|
+
const input = item.input as Record<string, unknown> | undefined
|
|
63
|
+
const payload = input ? { ...formData, ...input } : formData
|
|
64
|
+
if (errorTimerRef.current) {
|
|
65
|
+
clearTimeout(errorTimerRef.current)
|
|
66
|
+
errorTimerRef.current = null
|
|
67
|
+
}
|
|
68
|
+
setHasError(false)
|
|
69
|
+
setIsSubmitting(true)
|
|
70
|
+
const result = onAction(id, payload)
|
|
71
|
+
if (result && typeof (result as Promise<unknown>).catch === 'function') {
|
|
72
|
+
;(result as Promise<unknown>).catch(() => {
|
|
73
|
+
if (!mountedRef.current) return
|
|
74
|
+
setHasError(true)
|
|
75
|
+
errorTimerRef.current = setTimeout(() => {
|
|
76
|
+
if (mountedRef.current) setHasError(false)
|
|
77
|
+
}, ERROR_FLASH_MS)
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const compact = (item as { compact?: boolean }).compact === true
|
|
83
|
+
const label = String(item.label || t('WorkflowUi.Submit'))
|
|
84
|
+
const icon = item.icon != null ? String(item.icon) : ''
|
|
85
|
+
const displayLabel = icon ? `${icon} ${label}` : label
|
|
86
|
+
const hasCustomFill = resolveSurfaceBackground(item.bgColor as string | undefined) !== 'transparent'
|
|
87
|
+
const outlineStyle = !hasCustomFill
|
|
88
|
+
? {
|
|
89
|
+
backgroundColor: 'transparent',
|
|
90
|
+
borderWidth: 1.5,
|
|
91
|
+
borderColor: '#FFFFFF',
|
|
92
|
+
}
|
|
93
|
+
: null
|
|
94
|
+
|
|
95
|
+
const fillStyle = resolveButtonFillStyle(item as any, { includePadding: false })
|
|
96
|
+
const labelColor = '#FFFFFF'
|
|
97
|
+
|
|
98
|
+
if (compact) {
|
|
99
|
+
return (
|
|
100
|
+
<TouchableOpacity
|
|
101
|
+
style={[
|
|
102
|
+
{
|
|
103
|
+
paddingHorizontal: s(12),
|
|
104
|
+
paddingVertical: s(8),
|
|
105
|
+
borderRadius: 999,
|
|
106
|
+
alignSelf: 'flex-end',
|
|
107
|
+
flexShrink: 1,
|
|
108
|
+
minWidth: 0,
|
|
109
|
+
},
|
|
110
|
+
fillStyle,
|
|
111
|
+
outlineStyle,
|
|
112
|
+
disabled ? sBase.disabled : null,
|
|
113
|
+
]}
|
|
114
|
+
onPress={handlePress}
|
|
115
|
+
disabled={disabled}
|
|
116
|
+
activeOpacity={0.8}
|
|
117
|
+
>
|
|
118
|
+
{isSubmitting ? (
|
|
119
|
+
<ActivityIndicator size="small" color={labelColor} />
|
|
120
|
+
) : (
|
|
121
|
+
<WorkflowButtonLabel
|
|
122
|
+
style={{ color: hasError ? ERROR_COLOR : labelColor, fontWeight: '700', fontSize: ms(13) }}
|
|
123
|
+
groupFontScale={groupFontScale}
|
|
124
|
+
>
|
|
125
|
+
{hasError ? `⚠ ${displayLabel}` : displayLabel}
|
|
126
|
+
</WorkflowButtonLabel>
|
|
127
|
+
)}
|
|
128
|
+
</TouchableOpacity>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const minHeight = s(isSmall ? 44 : 52)
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<TouchableOpacity
|
|
136
|
+
style={[
|
|
137
|
+
sBase.pill,
|
|
138
|
+
{
|
|
139
|
+
minHeight,
|
|
140
|
+
borderRadius: minHeight / 2,
|
|
141
|
+
paddingVertical: s(isSmall ? 10 : 14),
|
|
142
|
+
paddingHorizontal: s(isSmall ? 12 : 16),
|
|
143
|
+
marginTop: fillContainer ? 0 : s(8),
|
|
144
|
+
},
|
|
145
|
+
fillContainer ? { flex: 1, alignSelf: 'stretch', height: '100%', maxWidth: '100%' } : null,
|
|
146
|
+
fillStyle,
|
|
147
|
+
outlineStyle,
|
|
148
|
+
disabled ? sBase.disabled : null,
|
|
149
|
+
]}
|
|
150
|
+
onPress={handlePress}
|
|
151
|
+
disabled={disabled}
|
|
152
|
+
activeOpacity={0.85}
|
|
153
|
+
>
|
|
154
|
+
{isSubmitting ? (
|
|
155
|
+
<ActivityIndicator size="small" color={labelColor} />
|
|
156
|
+
) : (
|
|
157
|
+
<WorkflowButtonLabel
|
|
158
|
+
style={[sBase.pillText, { color: hasError ? ERROR_COLOR : labelColor, fontSize: ms(isSmall ? 13 : 15) }]}
|
|
159
|
+
groupFontScale={groupFontScale}
|
|
160
|
+
>
|
|
161
|
+
{hasError ? `⚠ ${displayLabel}` : displayLabel}
|
|
162
|
+
</WorkflowButtonLabel>
|
|
163
|
+
)}
|
|
164
|
+
</TouchableOpacity>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const sBase = StyleSheet.create({
|
|
169
|
+
pill: {
|
|
170
|
+
flexDirection: 'row',
|
|
171
|
+
width: '100%',
|
|
172
|
+
alignItems: 'center',
|
|
173
|
+
justifyContent: 'center',
|
|
174
|
+
flexShrink: 1,
|
|
175
|
+
minWidth: 0,
|
|
176
|
+
},
|
|
177
|
+
pillText: { fontWeight: '700', textAlign: 'center', width: '100%' },
|
|
178
|
+
disabled: { opacity: 0.5 },
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Submit button with an `input_schema`: renders one text field per schema
|
|
183
|
+
* leaf above the button, keeps the button disabled until required fields are
|
|
184
|
+
* filled, and sends the nested `input` built from the schema (not the screen's
|
|
185
|
+
* other form values or a static `input`). Same behaviour as the wallet's
|
|
186
|
+
* former inline renderer in WorkflowDetails.
|
|
187
|
+
*/
|
|
188
|
+
const SchemaSubmitButtonContent: React.FC<SubmitButtonContentProps> = (props) => {
|
|
189
|
+
const { item, colors, onAction, disabled } = props
|
|
190
|
+
const fields = useMemo(() => flattenInputSchema(item.input_schema as InputSchema | undefined), [item.input_schema])
|
|
191
|
+
const [values, setValues] = useState<Record<string, string>>({})
|
|
192
|
+
const complete = isInputComplete(fields, values)
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<View style={schemaStyles.container}>
|
|
196
|
+
<View style={[schemaStyles.fields, { borderColor: colors.border }]}>
|
|
197
|
+
{fields.map((field) => {
|
|
198
|
+
const key = field.path.join('.')
|
|
199
|
+
return (
|
|
200
|
+
<View key={key} style={schemaStyles.field}>
|
|
201
|
+
<Text style={[schemaStyles.label, { color: colors.text }]}>
|
|
202
|
+
{field.title}
|
|
203
|
+
{field.required ? <Text style={schemaStyles.required}> *</Text> : null}
|
|
204
|
+
</Text>
|
|
205
|
+
{field.description ? <Text style={schemaStyles.description}>{field.description}</Text> : null}
|
|
206
|
+
<TextInput
|
|
207
|
+
style={[schemaStyles.input, { borderColor: colors.border, color: colors.text }]}
|
|
208
|
+
value={values[key] ?? ''}
|
|
209
|
+
onChangeText={(value) => setValues((prev) => ({ ...prev, [key]: value }))}
|
|
210
|
+
placeholder={`Enter ${field.title.toLowerCase()}...`}
|
|
211
|
+
placeholderTextColor="#9CA3AF"
|
|
212
|
+
autoCapitalize="none"
|
|
213
|
+
autoCorrect={false}
|
|
214
|
+
testID={testIdWithKey(`FormField-${key}`)}
|
|
215
|
+
/>
|
|
216
|
+
</View>
|
|
217
|
+
)
|
|
218
|
+
})}
|
|
219
|
+
</View>
|
|
220
|
+
<SubmitButtonContent
|
|
221
|
+
{...props}
|
|
222
|
+
disabled={disabled || !complete}
|
|
223
|
+
onAction={(id) => onAction(id, buildInputFromValues(fields, values))}
|
|
224
|
+
/>
|
|
225
|
+
</View>
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const schemaStyles = StyleSheet.create({
|
|
230
|
+
container: { marginBottom: 12 },
|
|
231
|
+
fields: { borderRadius: 12, borderWidth: 1, padding: 16, marginBottom: 12 },
|
|
232
|
+
field: { marginBottom: 16 },
|
|
233
|
+
label: { fontSize: 14, fontWeight: '600', marginBottom: 4 },
|
|
234
|
+
required: { color: '#DC2626' },
|
|
235
|
+
description: { fontSize: 12, color: '#9CA3AF', marginBottom: 4 },
|
|
236
|
+
input: {
|
|
237
|
+
backgroundColor: 'transparent',
|
|
238
|
+
borderRadius: 8,
|
|
239
|
+
borderWidth: 1,
|
|
240
|
+
paddingHorizontal: 12,
|
|
241
|
+
paddingVertical: 10,
|
|
242
|
+
fontSize: 14,
|
|
243
|
+
},
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
/** Uses the schema form when the item declares an `input_schema` with fields. */
|
|
247
|
+
const SubmitButtonEntry: React.FC<SubmitButtonContentProps> = (props) =>
|
|
248
|
+
flattenInputSchema(props.item.input_schema as InputSchema | undefined).length > 0 ? (
|
|
249
|
+
<SchemaSubmitButtonContent {...props} />
|
|
250
|
+
) : (
|
|
251
|
+
<SubmitButtonContent {...props} />
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
ContentRegistry.register('submit-button', SubmitButtonEntry)
|
|
255
|
+
|
|
256
|
+
export default SubmitButtonEntry
|