@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,74 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
4
|
+
|
|
5
|
+
const MultipleChoiceContent: React.FC<ContentProps> = ({ item, styles, colors, formData, onFieldChange }) => {
|
|
6
|
+
const fieldName = (item['form-id'] as string | undefined) ?? 'mcq'
|
|
7
|
+
const initialValue: string[] = Array.isArray(formData?.[fieldName]) ? formData?.[fieldName] : []
|
|
8
|
+
const [selected, setSelected] = useState<string[]>(initialValue)
|
|
9
|
+
|
|
10
|
+
const externalValue = formData?.[fieldName]
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setSelected(Array.isArray(externalValue) ? externalValue : [])
|
|
13
|
+
}, [externalValue])
|
|
14
|
+
|
|
15
|
+
const options: string[] = Array.isArray(item.options)
|
|
16
|
+
? (item.options as string[])
|
|
17
|
+
: Array.isArray(item.answers)
|
|
18
|
+
? (item.answers as any[]).map((a: any) => String(a.option ?? a))
|
|
19
|
+
: []
|
|
20
|
+
|
|
21
|
+
const label = ((item.label ?? item.question) as string | undefined) ?? ''
|
|
22
|
+
|
|
23
|
+
const toggle = (opt: string) => {
|
|
24
|
+
const next = selected.includes(opt) ? selected.filter((o) => o !== opt) : [...selected, opt]
|
|
25
|
+
setSelected(next)
|
|
26
|
+
onFieldChange?.(fieldName, next)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (options.length === 0) return null
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<View style={[styles.fieldContainer, { borderWidth: 1, borderColor: colors.border, borderRadius: 8, padding: 12 }]}>
|
|
33
|
+
{label ? (
|
|
34
|
+
<Text style={[styles.label, { color: colors.text, marginBottom: 8, flexShrink: 1 }]}>{label}</Text>
|
|
35
|
+
) : null}
|
|
36
|
+
{options.map((opt, i) => {
|
|
37
|
+
const isSelected = selected.includes(opt)
|
|
38
|
+
return (
|
|
39
|
+
<TouchableOpacity
|
|
40
|
+
key={i}
|
|
41
|
+
onPress={() => toggle(opt)}
|
|
42
|
+
activeOpacity={0.7}
|
|
43
|
+
style={{ flexDirection: 'row', alignItems: 'flex-start', paddingVertical: 10, minWidth: 0 }}
|
|
44
|
+
>
|
|
45
|
+
<View
|
|
46
|
+
style={{
|
|
47
|
+
width: 22,
|
|
48
|
+
height: 22,
|
|
49
|
+
borderRadius: 6,
|
|
50
|
+
borderWidth: 2,
|
|
51
|
+
borderColor: colors.primary,
|
|
52
|
+
backgroundColor: isSelected ? colors.primary : 'transparent',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
marginRight: 10,
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{isSelected ? (
|
|
59
|
+
<Text style={{ color: colors.buttonText ?? '#FFFFFF', fontSize: 13, fontWeight: '800' }}>✓</Text>
|
|
60
|
+
) : null}
|
|
61
|
+
</View>
|
|
62
|
+
<Text style={{ color: colors.text, fontSize: 15, flex: 1, flexShrink: 1 }}>{opt}</Text>
|
|
63
|
+
</TouchableOpacity>
|
|
64
|
+
)
|
|
65
|
+
})}
|
|
66
|
+
</View>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
ContentRegistry.register('multiple-choice', MultipleChoiceContent)
|
|
71
|
+
// Contract alias (HINT_ALIASES); the wallet rendered nothing for it at top level.
|
|
72
|
+
ContentRegistry.register('mcq', MultipleChoiceContent)
|
|
73
|
+
|
|
74
|
+
export default MultipleChoiceContent
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import WorkflowText from '../components/WorkflowText'
|
|
4
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
5
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
6
|
+
import { useResponsive } from '../responsive'
|
|
7
|
+
|
|
8
|
+
const BADGE_GREEN = '#166534'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Preview card for an Open Badge signed onto a workflow artifact, with
|
|
12
|
+
* accept / decline actions. Ported from the CrMS designer (the wallet had no
|
|
13
|
+
* component for this type and rendered nothing).
|
|
14
|
+
*
|
|
15
|
+
* Props: `label` (accept button, default "Add to Wallet"), `artifact_key`
|
|
16
|
+
* (shown as a reference), `event` (default `accept`), `decline-event`
|
|
17
|
+
* (default `decline`).
|
|
18
|
+
*/
|
|
19
|
+
const OpenBadgePreviewContent: React.FC<ContentProps> = ({ item, onAction, colors, disabled }) => {
|
|
20
|
+
const { s } = useResponsive()
|
|
21
|
+
const t = useWorkflowT()
|
|
22
|
+
const artifactKey = typeof item.artifact_key === 'string' ? item.artifact_key : ''
|
|
23
|
+
const acceptEvent = (item.event as string | undefined) || 'accept'
|
|
24
|
+
const declineEvent = (item['decline-event'] as string | undefined) || 'decline'
|
|
25
|
+
const label = (item.label as string | undefined) || t('WorkflowUi.AddToWallet')
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<View
|
|
29
|
+
style={[
|
|
30
|
+
local.card,
|
|
31
|
+
{ padding: s(12), gap: s(8), borderColor: colors.border, backgroundColor: colors.background },
|
|
32
|
+
]}
|
|
33
|
+
>
|
|
34
|
+
<View style={[local.row, { gap: s(8) }]}>
|
|
35
|
+
<WorkflowText variant="badge" style={{ color: BADGE_GREEN, fontWeight: '700' }}>
|
|
36
|
+
{t('WorkflowUi.OpenBadge').toUpperCase()}
|
|
37
|
+
</WorkflowText>
|
|
38
|
+
{artifactKey ? (
|
|
39
|
+
<WorkflowText variant="badge" numberOfLines={1} style={{ color: colors.border, flexShrink: 1 }}>
|
|
40
|
+
{artifactKey}
|
|
41
|
+
</WorkflowText>
|
|
42
|
+
) : null}
|
|
43
|
+
</View>
|
|
44
|
+
<WorkflowText variant="caption" style={{ color: colors.text }}>
|
|
45
|
+
{t('WorkflowUi.OpenBadgeDescription', { label })}
|
|
46
|
+
</WorkflowText>
|
|
47
|
+
<View style={[local.actions, { gap: s(8) }]}>
|
|
48
|
+
<TouchableOpacity
|
|
49
|
+
accessibilityRole="button"
|
|
50
|
+
accessibilityState={{ disabled: !!disabled }}
|
|
51
|
+
disabled={disabled}
|
|
52
|
+
onPress={() => onAction(acceptEvent, undefined)}
|
|
53
|
+
style={[
|
|
54
|
+
local.button,
|
|
55
|
+
{ paddingHorizontal: s(12), paddingVertical: s(8), backgroundColor: colors.primary },
|
|
56
|
+
disabled ? local.disabled : null,
|
|
57
|
+
]}
|
|
58
|
+
>
|
|
59
|
+
<WorkflowText variant="label" style={{ color: colors.buttonText ?? colors.background }}>
|
|
60
|
+
{label}
|
|
61
|
+
</WorkflowText>
|
|
62
|
+
</TouchableOpacity>
|
|
63
|
+
<TouchableOpacity
|
|
64
|
+
accessibilityRole="button"
|
|
65
|
+
accessibilityState={{ disabled: !!disabled }}
|
|
66
|
+
disabled={disabled}
|
|
67
|
+
onPress={() => onAction(declineEvent, undefined)}
|
|
68
|
+
style={[
|
|
69
|
+
local.button,
|
|
70
|
+
{ paddingHorizontal: s(12), paddingVertical: s(8), borderWidth: 1, borderColor: colors.border },
|
|
71
|
+
disabled ? local.disabled : null,
|
|
72
|
+
]}
|
|
73
|
+
>
|
|
74
|
+
<WorkflowText variant="label" style={{ color: colors.text }}>
|
|
75
|
+
{t('Global.Decline')}
|
|
76
|
+
</WorkflowText>
|
|
77
|
+
</TouchableOpacity>
|
|
78
|
+
</View>
|
|
79
|
+
</View>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const local = StyleSheet.create({
|
|
84
|
+
card: { borderRadius: 10, borderWidth: 1, width: '100%' },
|
|
85
|
+
row: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' },
|
|
86
|
+
actions: { flexDirection: 'row', justifyContent: 'flex-end' },
|
|
87
|
+
button: { borderRadius: 8 },
|
|
88
|
+
disabled: { opacity: 0.5 },
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
ContentRegistry.register('open-badge-preview', OpenBadgePreviewContent)
|
|
92
|
+
|
|
93
|
+
export default OpenBadgePreviewContent
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import { useWalletAdapter } from '../adapter/WalletAdapter'
|
|
4
|
+
import { useWorkflowT } from '../i18n/WorkflowI18n'
|
|
5
|
+
import { WorkflowIcon } from '../icons/WorkflowIcon'
|
|
6
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
7
|
+
import { resolveItemSurfaceStyle } from '../style/resolveDisplayHintStyle'
|
|
8
|
+
import { testIdWithKey } from '../utils/testable'
|
|
9
|
+
import { SimulatedHint } from './SimulatedHint'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Photo capture: a dashed "take a photo" button, then the thumbnail with a
|
|
13
|
+
* retake overlay. The camera itself is the app's (`adapter.capturePhoto()`:
|
|
14
|
+
* the wallet's full-screen camera, a sample image in the designer). The photo
|
|
15
|
+
* URI goes to `form-id` and to `actionID` / `event` as `{ uri }`.
|
|
16
|
+
*/
|
|
17
|
+
const PhotoContent: React.FC<ContentProps> = ({ item, styles, colors, onAction, onFieldChange, disabled }) => {
|
|
18
|
+
const t = useWorkflowT()
|
|
19
|
+
const adapter = useWalletAdapter()
|
|
20
|
+
const label = (typeof item.label === 'string' && item.label) || t('WorkflowUi.TakePhoto')
|
|
21
|
+
const formId = item['form-id'] as string | undefined
|
|
22
|
+
const actionId = (item.actionID as string | undefined) || (item.event as string | undefined)
|
|
23
|
+
const [capturedUri, setCapturedUri] = useState<string | null>(null)
|
|
24
|
+
const [busy, setBusy] = useState(false)
|
|
25
|
+
|
|
26
|
+
const handlePress = async () => {
|
|
27
|
+
if (busy || disabled) return
|
|
28
|
+
setBusy(true)
|
|
29
|
+
try {
|
|
30
|
+
const photo = await adapter.capturePhoto()
|
|
31
|
+
if (!photo) return
|
|
32
|
+
setCapturedUri(photo.uri)
|
|
33
|
+
if (formId) onFieldChange?.(formId, photo.uri)
|
|
34
|
+
if (actionId) onAction(actionId, { uri: photo.uri })
|
|
35
|
+
} catch {
|
|
36
|
+
adapter.alert(t('WorkflowUi.Error'), t('WorkflowUi.PhotoFailed'))
|
|
37
|
+
} finally {
|
|
38
|
+
setBusy(false)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<View style={[styles.fieldContainer, resolveItemSurfaceStyle(item as any)]}>
|
|
44
|
+
{item.label ? <Text style={[styles.label, { color: colors.text }]}>{label}</Text> : null}
|
|
45
|
+
{capturedUri ? (
|
|
46
|
+
<TouchableOpacity
|
|
47
|
+
testID={testIdWithKey('WorkflowTakePhoto')}
|
|
48
|
+
accessibilityLabel={label}
|
|
49
|
+
accessibilityRole="button"
|
|
50
|
+
onPress={handlePress}
|
|
51
|
+
activeOpacity={0.85}
|
|
52
|
+
style={local.thumbnailContainer}
|
|
53
|
+
>
|
|
54
|
+
<Image source={{ uri: capturedUri }} style={local.thumbnail} resizeMode="cover" />
|
|
55
|
+
<View style={local.retakeOverlay}>
|
|
56
|
+
<WorkflowIcon set="material-community" name="camera-retake-outline" size={20} color="#fff" />
|
|
57
|
+
<Text style={local.retakeText}>{t('WorkflowUi.Retake')}</Text>
|
|
58
|
+
</View>
|
|
59
|
+
</TouchableOpacity>
|
|
60
|
+
) : (
|
|
61
|
+
<TouchableOpacity
|
|
62
|
+
testID={testIdWithKey('WorkflowTakePhoto')}
|
|
63
|
+
accessibilityLabel={label}
|
|
64
|
+
accessibilityRole="button"
|
|
65
|
+
onPress={handlePress}
|
|
66
|
+
activeOpacity={0.8}
|
|
67
|
+
style={[local.dashedButton, { borderColor: colors.border }, disabled ? local.disabled : null]}
|
|
68
|
+
>
|
|
69
|
+
<WorkflowIcon set="material-community" name="camera-outline" size={32} color="#FFFFFF" />
|
|
70
|
+
<Text style={local.dashedLabel}>{label}</Text>
|
|
71
|
+
</TouchableOpacity>
|
|
72
|
+
)}
|
|
73
|
+
{adapter.simulated ? <SimulatedHint /> : null}
|
|
74
|
+
</View>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Shared by the photo and barcode controls (the wallet's dashed device button). */
|
|
79
|
+
export const local = StyleSheet.create({
|
|
80
|
+
dashedButton: {
|
|
81
|
+
borderWidth: 1,
|
|
82
|
+
borderStyle: 'dashed',
|
|
83
|
+
borderRadius: 8,
|
|
84
|
+
padding: 24,
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
justifyContent: 'center',
|
|
87
|
+
gap: 8,
|
|
88
|
+
},
|
|
89
|
+
dashedLabel: { fontSize: 14, fontWeight: '600', color: '#FFFFFF' },
|
|
90
|
+
thumbnailContainer: { borderRadius: 8, overflow: 'hidden', height: 200 },
|
|
91
|
+
thumbnail: { width: '100%', height: '100%' },
|
|
92
|
+
retakeOverlay: {
|
|
93
|
+
position: 'absolute',
|
|
94
|
+
bottom: 0,
|
|
95
|
+
left: 0,
|
|
96
|
+
right: 0,
|
|
97
|
+
backgroundColor: 'rgba(0,0,0,0.45)',
|
|
98
|
+
flexDirection: 'row',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
paddingVertical: 8,
|
|
102
|
+
gap: 6,
|
|
103
|
+
},
|
|
104
|
+
retakeText: { color: '#fff', fontSize: 13, fontWeight: '600' },
|
|
105
|
+
disabled: { opacity: 0.5 },
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
ContentRegistry.register('photo', PhotoContent)
|
|
109
|
+
|
|
110
|
+
export default PhotoContent
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Text, View } from 'react-native'
|
|
3
|
+
import Svg, { G, Path } from 'react-native-svg'
|
|
4
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
5
|
+
import { resolveItemSurfaceStyle } from '../style/resolveDisplayHintStyle'
|
|
6
|
+
|
|
7
|
+
interface SliceItem {
|
|
8
|
+
label: string
|
|
9
|
+
count: number | string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const parseCount = (count: number | string): number => {
|
|
13
|
+
if (typeof count === 'number') return count
|
|
14
|
+
return parseFloat(count) || 0
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const DEFAULT_SLICES: SliceItem[] = [
|
|
18
|
+
{ label: 'Category A', count: 40 },
|
|
19
|
+
{ label: 'Category B', count: 30 },
|
|
20
|
+
{ label: 'Category C', count: 20 },
|
|
21
|
+
{ label: 'Category D', count: 10 },
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
const PieChartContent: React.FC<ContentProps> = ({ item, styles, colors }) => {
|
|
25
|
+
const rawSlices: SliceItem[] = item.slices || []
|
|
26
|
+
const slices = rawSlices.length > 0 ? rawSlices : DEFAULT_SLICES
|
|
27
|
+
|
|
28
|
+
const size = 200
|
|
29
|
+
const radius = size / 2
|
|
30
|
+
const centerX = size / 2
|
|
31
|
+
const centerY = size / 2
|
|
32
|
+
|
|
33
|
+
// Calculate total for percentages
|
|
34
|
+
const total = slices.reduce((sum, slice) => sum + parseCount(slice.count), 0)
|
|
35
|
+
|
|
36
|
+
// Predefined colors for slices
|
|
37
|
+
const sliceColors = ['#FF6384', '#36A2EB', '#FFCE56', '#4BC0C0', '#9966FF', '#FF9F40']
|
|
38
|
+
|
|
39
|
+
// Helper function to convert angle to coordinates
|
|
40
|
+
const polarToCartesian = (centerX: number, centerY: number, radius: number, angleInDegrees: number) => {
|
|
41
|
+
const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0
|
|
42
|
+
return {
|
|
43
|
+
x: centerX + radius * Math.cos(angleInRadians),
|
|
44
|
+
y: centerY + radius * Math.sin(angleInRadians),
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Create pie slice path
|
|
49
|
+
const createPieSlice = (startAngle: number, endAngle: number) => {
|
|
50
|
+
const start = polarToCartesian(centerX, centerY, radius, endAngle)
|
|
51
|
+
const end = polarToCartesian(centerX, centerY, radius, startAngle)
|
|
52
|
+
const largeArcFlag = endAngle - startAngle <= 180 ? '0' : '1'
|
|
53
|
+
|
|
54
|
+
return [
|
|
55
|
+
`M ${centerX} ${centerY}`,
|
|
56
|
+
`L ${start.x} ${start.y}`,
|
|
57
|
+
`A ${radius} ${radius} 0 ${largeArcFlag} 0 ${end.x} ${end.y}`,
|
|
58
|
+
'Z',
|
|
59
|
+
].join(' ')
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let currentAngle = 0
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<View style={[styles.fieldContainer, resolveItemSurfaceStyle(item)]}>
|
|
66
|
+
{item.title && (
|
|
67
|
+
<Text style={[styles.formLabel, { color: colors.text, marginBottom: 12, textAlign: 'center' }]}>
|
|
68
|
+
{item.title}
|
|
69
|
+
</Text>
|
|
70
|
+
)}
|
|
71
|
+
|
|
72
|
+
<View style={{ alignItems: 'center' }}>
|
|
73
|
+
<Svg width={size} height={size}>
|
|
74
|
+
<G>
|
|
75
|
+
{slices.map((slice, index) => {
|
|
76
|
+
const count = parseCount(slice.count)
|
|
77
|
+
const percentage = (count / total) * 100
|
|
78
|
+
const angle = (percentage / 100) * 360
|
|
79
|
+
const startAngle = currentAngle
|
|
80
|
+
const endAngle = currentAngle + angle
|
|
81
|
+
|
|
82
|
+
currentAngle += angle
|
|
83
|
+
|
|
84
|
+
const path = createPieSlice(startAngle, endAngle)
|
|
85
|
+
|
|
86
|
+
return <Path key={index} d={path} fill={sliceColors[index % sliceColors.length]} />
|
|
87
|
+
})}
|
|
88
|
+
</G>
|
|
89
|
+
</Svg>
|
|
90
|
+
|
|
91
|
+
{/* Legend */}
|
|
92
|
+
<View style={{ marginTop: 16, width: '100%' }}>
|
|
93
|
+
{slices.map((slice, index) => {
|
|
94
|
+
const count = parseCount(slice.count)
|
|
95
|
+
const percentage = ((count / total) * 100).toFixed(1)
|
|
96
|
+
return (
|
|
97
|
+
<View key={index} style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 8 }}>
|
|
98
|
+
<View
|
|
99
|
+
style={{
|
|
100
|
+
width: 16,
|
|
101
|
+
height: 16,
|
|
102
|
+
backgroundColor: sliceColors[index % sliceColors.length],
|
|
103
|
+
borderRadius: 2,
|
|
104
|
+
marginRight: 8,
|
|
105
|
+
}}
|
|
106
|
+
/>
|
|
107
|
+
<Text style={[styles.description, { color: colors.text, fontSize: 13 }]}>
|
|
108
|
+
{slice.label}: {count} ({percentage}%)
|
|
109
|
+
</Text>
|
|
110
|
+
</View>
|
|
111
|
+
)
|
|
112
|
+
})}
|
|
113
|
+
</View>
|
|
114
|
+
</View>
|
|
115
|
+
</View>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
ContentRegistry.register('pie-chart', PieChartContent)
|
|
120
|
+
|
|
121
|
+
export default PieChartContent
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ActivityIndicator, Text, 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 { useProtocolExchange } from '../protocol/useProtocolExchange'
|
|
7
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
8
|
+
import { useResponsive } from '../responsive'
|
|
9
|
+
import { resolveButtonFillStyle, resolveSurfaceBackground } from '../style/resolveDisplayHintStyle'
|
|
10
|
+
import { useWorkflowTheme } from '../theme/WorkflowTheme'
|
|
11
|
+
import { testIdWithKey } from '../utils/testable'
|
|
12
|
+
import { s, shortId } from './CredentialOfferContent'
|
|
13
|
+
import { SimulatedHint } from './SimulatedHint'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Proof request card (CrMS contract): present fires `item.event` (default
|
|
17
|
+
* `present`), decline fires `decline-event` (default `decline`), `label` is the
|
|
18
|
+
* present button text, `requested` lists the requested fields.
|
|
19
|
+
*
|
|
20
|
+
* Moved from the wallet with credo replaced by the WalletAdapter
|
|
21
|
+
* (`useExchanges('proof')`, `acceptExchange` presents with automatically
|
|
22
|
+
* selected credentials).
|
|
23
|
+
*/
|
|
24
|
+
const ProofPresentationContent: React.FC<ContentProps> = (props) => {
|
|
25
|
+
const { item, styles, groupFontScale = 1 } = props
|
|
26
|
+
const t = useWorkflowT()
|
|
27
|
+
const { ms } = useResponsive()
|
|
28
|
+
const { card } = useWorkflowTheme()
|
|
29
|
+
const adapter = useWalletAdapter()
|
|
30
|
+
const { phase, consent, decline } = useProtocolExchange({
|
|
31
|
+
...props,
|
|
32
|
+
kind: 'proof',
|
|
33
|
+
adapter,
|
|
34
|
+
defaultEvent: 'present',
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const presentLabel = (typeof item.label === 'string' && item.label.trim()) || t('Workflow.PresentProof')
|
|
38
|
+
const presDefId = typeof item['pres-def-id'] === 'string' ? item['pres-def-id'] : ''
|
|
39
|
+
const requested = Array.isArray(item.requested) ? (item.requested as unknown[]).map(String) : []
|
|
40
|
+
const fill = resolveSurfaceBackground(item.bgColor as string | undefined)
|
|
41
|
+
const statusText: Record<string, string> = {
|
|
42
|
+
awaiting: t('Workflow.WaitingForProofRequest'),
|
|
43
|
+
working: t('Workflow.PresentingProof'),
|
|
44
|
+
done: t('Workflow.ProofPresented'),
|
|
45
|
+
declined: t('Workflow.ProofDeclined'),
|
|
46
|
+
error: t('Workflow.ProofFailed'),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<TouchableOpacity
|
|
51
|
+
activeOpacity={1}
|
|
52
|
+
testID={testIdWithKey('WorkflowProofPresentation')}
|
|
53
|
+
accessibilityLabel={t('Workflow.ProofRequest')}
|
|
54
|
+
>
|
|
55
|
+
<View
|
|
56
|
+
style={[
|
|
57
|
+
styles.fieldContainer,
|
|
58
|
+
s.card,
|
|
59
|
+
{ backgroundColor: card.surface, borderColor: card.accent },
|
|
60
|
+
fill !== 'transparent' ? { backgroundColor: fill } : null,
|
|
61
|
+
]}
|
|
62
|
+
>
|
|
63
|
+
<View style={s.headerRow}>
|
|
64
|
+
<Text style={[s.kicker, { color: card.accent }]}>{t('Workflow.ProofRequest').toUpperCase()}</Text>
|
|
65
|
+
{presDefId ? <Text style={[s.id, { color: card.mutedId }]}>{shortId(presDefId)}</Text> : null}
|
|
66
|
+
</View>
|
|
67
|
+
{item.text ? (
|
|
68
|
+
<Text style={[styles.description, { color: card.text, marginBottom: 4 }]}>{String(item.text)}</Text>
|
|
69
|
+
) : null}
|
|
70
|
+
{requested.length > 0 ? (
|
|
71
|
+
<View style={s.attrList}>
|
|
72
|
+
{requested.map((field, i) => (
|
|
73
|
+
<Text key={`${field}-${i}`} style={[s.attrLine, { color: card.text }]}>
|
|
74
|
+
• {field}
|
|
75
|
+
</Text>
|
|
76
|
+
))}
|
|
77
|
+
</View>
|
|
78
|
+
) : null}
|
|
79
|
+
|
|
80
|
+
{phase === 'ready' ? (
|
|
81
|
+
<View style={s.btnRow}>
|
|
82
|
+
<TouchableOpacity
|
|
83
|
+
style={[s.primaryBtn, { backgroundColor: card.accent }, resolveButtonFillStyle(item)]}
|
|
84
|
+
onPress={consent}
|
|
85
|
+
disabled={props.disabled}
|
|
86
|
+
activeOpacity={0.85}
|
|
87
|
+
testID={testIdWithKey('WorkflowProofPresentationPresent')}
|
|
88
|
+
>
|
|
89
|
+
<WorkflowButtonLabel
|
|
90
|
+
style={[s.btnText, { fontSize: ms(13), color: card.buttonText }]}
|
|
91
|
+
groupFontScale={groupFontScale}
|
|
92
|
+
>
|
|
93
|
+
{presentLabel}
|
|
94
|
+
</WorkflowButtonLabel>
|
|
95
|
+
</TouchableOpacity>
|
|
96
|
+
<TouchableOpacity
|
|
97
|
+
style={[s.secondaryBtn, { borderColor: card.border }]}
|
|
98
|
+
onPress={decline}
|
|
99
|
+
disabled={props.disabled}
|
|
100
|
+
activeOpacity={0.7}
|
|
101
|
+
testID={testIdWithKey('WorkflowProofPresentationDecline')}
|
|
102
|
+
>
|
|
103
|
+
<WorkflowButtonLabel
|
|
104
|
+
style={[s.btnText, { fontSize: ms(13), color: card.text }]}
|
|
105
|
+
groupFontScale={groupFontScale}
|
|
106
|
+
>
|
|
107
|
+
{t('Global.Decline')}
|
|
108
|
+
</WorkflowButtonLabel>
|
|
109
|
+
</TouchableOpacity>
|
|
110
|
+
</View>
|
|
111
|
+
) : (
|
|
112
|
+
<View style={s.statusRow}>
|
|
113
|
+
{phase === 'awaiting' || phase === 'working' ? (
|
|
114
|
+
<ActivityIndicator size="small" color={card.accent} />
|
|
115
|
+
) : null}
|
|
116
|
+
<Text style={[s.statusText, { color: card.text }]}>{statusText[phase]}</Text>
|
|
117
|
+
</View>
|
|
118
|
+
)}
|
|
119
|
+
{adapter.simulated ? <SimulatedHint color={card.mutedId} /> : null}
|
|
120
|
+
</View>
|
|
121
|
+
</TouchableOpacity>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
ContentRegistry.register('proof-presentation', ProofPresentationContent)
|
|
126
|
+
|
|
127
|
+
export default ProofPresentationContent
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import { Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
|
|
4
|
+
|
|
5
|
+
const radioSubs = new Map<string, Set<(val: string) => void>>()
|
|
6
|
+
const radioSelected = new Map<string, string>()
|
|
7
|
+
|
|
8
|
+
const radioSubscribe = (formId: string, setter: (val: string) => void): (() => void) => {
|
|
9
|
+
if (!radioSubs.has(formId)) radioSubs.set(formId, new Set())
|
|
10
|
+
radioSubs.get(formId)?.add(setter)
|
|
11
|
+
return () => {
|
|
12
|
+
radioSubs.get(formId)?.delete(setter)
|
|
13
|
+
if (radioSubs.get(formId)?.size === 0) {
|
|
14
|
+
radioSubs.delete(formId)
|
|
15
|
+
radioSelected.delete(formId)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const radioBroadcast = (formId: string, val: string) => {
|
|
21
|
+
radioSelected.set(formId, val)
|
|
22
|
+
radioSubs.get(formId)?.forEach((setter) => {
|
|
23
|
+
setter(val)
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const RadioButtonContent: React.FC<ContentProps> = ({ item, styles, colors, formData, onFieldChange }) => {
|
|
28
|
+
const fieldName = (item['form-id'] as string | undefined) ?? 'radio'
|
|
29
|
+
const optionValue = String((item.value ?? item.label ?? '') as string)
|
|
30
|
+
const optionLabel = String((item.label ?? item.value ?? '') as string)
|
|
31
|
+
|
|
32
|
+
const groupLabel = Array.isArray(item.options) ? (((item.label ?? item.text) as string | undefined) ?? '') : ''
|
|
33
|
+
|
|
34
|
+
const options: Array<{ label: string; value: string }> = Array.isArray(item.options)
|
|
35
|
+
? (item.options as string[]).map((o) => ({ label: o, value: o }))
|
|
36
|
+
: optionValue
|
|
37
|
+
? [{ label: optionLabel, value: optionValue }]
|
|
38
|
+
: []
|
|
39
|
+
|
|
40
|
+
const resolveInitial = (): string => {
|
|
41
|
+
if (formData?.[fieldName] != null) return String(formData[fieldName])
|
|
42
|
+
if (radioSelected.has(fieldName)) return radioSelected.get(fieldName) ?? ''
|
|
43
|
+
return ''
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const [selected, setSelected] = useState<string>(resolveInitial)
|
|
47
|
+
const committedRef = useRef(formData?.[fieldName] != null)
|
|
48
|
+
const defaultValue = options[0]?.value
|
|
49
|
+
const onFieldChangeRef = useRef(onFieldChange)
|
|
50
|
+
onFieldChangeRef.current = onFieldChange
|
|
51
|
+
|
|
52
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: subscribe once per field and default; formData is read only for the initial commit
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const unsub = radioSubscribe(fieldName, setSelected)
|
|
55
|
+
if (formData?.[fieldName] == null && defaultValue) {
|
|
56
|
+
radioBroadcast(fieldName, defaultValue)
|
|
57
|
+
onFieldChangeRef.current?.(fieldName, defaultValue)
|
|
58
|
+
committedRef.current = true
|
|
59
|
+
}
|
|
60
|
+
return unsub
|
|
61
|
+
}, [fieldName, defaultValue])
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (formData?.[fieldName] == null) return
|
|
65
|
+
const next = String(formData[fieldName])
|
|
66
|
+
setSelected(next)
|
|
67
|
+
radioSelected.set(fieldName, next)
|
|
68
|
+
committedRef.current = true
|
|
69
|
+
}, [fieldName, formData?.[fieldName]])
|
|
70
|
+
|
|
71
|
+
const select = (val: string) => {
|
|
72
|
+
if (val === selected && committedRef.current && formData?.[fieldName] != null) return
|
|
73
|
+
radioBroadcast(fieldName, val)
|
|
74
|
+
onFieldChange?.(fieldName, val)
|
|
75
|
+
committedRef.current = true
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (options.length === 0) return null
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<View style={styles.fieldContainer}>
|
|
82
|
+
{groupLabel ? <Text style={[styles.label, { color: colors.text, marginBottom: 8 }]}>{groupLabel}</Text> : null}
|
|
83
|
+
{options.map((opt, i) => {
|
|
84
|
+
const isSelected = selected === opt.value
|
|
85
|
+
return (
|
|
86
|
+
<TouchableOpacity
|
|
87
|
+
key={i}
|
|
88
|
+
onPress={() => select(opt.value)}
|
|
89
|
+
activeOpacity={0.7}
|
|
90
|
+
style={{ flexDirection: 'row', alignItems: 'flex-start', paddingVertical: 8, minWidth: 0 }}
|
|
91
|
+
>
|
|
92
|
+
<View
|
|
93
|
+
style={{
|
|
94
|
+
width: 22,
|
|
95
|
+
height: 22,
|
|
96
|
+
borderRadius: 11,
|
|
97
|
+
borderWidth: 2,
|
|
98
|
+
borderColor: colors.primary,
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
marginRight: 10,
|
|
102
|
+
backgroundColor: 'transparent',
|
|
103
|
+
marginTop: 2,
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{isSelected ? (
|
|
107
|
+
<View
|
|
108
|
+
style={{
|
|
109
|
+
width: 10,
|
|
110
|
+
height: 10,
|
|
111
|
+
borderRadius: 5,
|
|
112
|
+
backgroundColor: colors.primary,
|
|
113
|
+
}}
|
|
114
|
+
/>
|
|
115
|
+
) : null}
|
|
116
|
+
</View>
|
|
117
|
+
<Text style={{ color: colors.text, fontSize: 15, flex: 1, flexShrink: 1 }}>{opt.label}</Text>
|
|
118
|
+
</TouchableOpacity>
|
|
119
|
+
)
|
|
120
|
+
})}
|
|
121
|
+
</View>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
ContentRegistry.register('radio-button', RadioButtonContent)
|
|
126
|
+
// Contract alias (HINT_ALIASES); the wallet rendered nothing for it at top level.
|
|
127
|
+
ContentRegistry.register('radio', RadioButtonContent)
|
|
128
|
+
|
|
129
|
+
export default RadioButtonContent
|