@veridid/workflow-ui 0.0.0-stage → 0.1.1

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.
Files changed (445) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +217 -2
  3. package/build/module/WorkflowFontScaleContext.js +67 -0
  4. package/build/module/WorkflowFontScaleContext.js.map +1 -0
  5. package/build/module/adapter/WalletAdapter.js +152 -0
  6. package/build/module/adapter/WalletAdapter.js.map +1 -0
  7. package/build/module/components/FallbackVideoPlayer.js +8 -0
  8. package/build/module/components/FallbackVideoPlayer.js.map +1 -0
  9. package/build/module/components/FallbackVideoPlayer.native.js +10 -0
  10. package/build/module/components/FallbackVideoPlayer.native.js.map +1 -0
  11. package/build/module/components/FallbackVideoPlayer.web.js +35 -0
  12. package/build/module/components/FallbackVideoPlayer.web.js.map +1 -0
  13. package/build/module/components/WorkflowButtonLabel.js +32 -0
  14. package/build/module/components/WorkflowButtonLabel.js.map +1 -0
  15. package/build/module/components/WorkflowCalendarIcon.js +73 -0
  16. package/build/module/components/WorkflowCalendarIcon.js.map +1 -0
  17. package/build/module/components/WorkflowText.js +92 -0
  18. package/build/module/components/WorkflowText.js.map +1 -0
  19. package/build/module/content/BadgeContent.js +73 -0
  20. package/build/module/content/BadgeContent.js.map +1 -0
  21. package/build/module/content/BarChartContent.js +97 -0
  22. package/build/module/content/BarChartContent.js.map +1 -0
  23. package/build/module/content/BarcodeContent.js +78 -0
  24. package/build/module/content/BarcodeContent.js.map +1 -0
  25. package/build/module/content/BasicTableContent.js +145 -0
  26. package/build/module/content/BasicTableContent.js.map +1 -0
  27. package/build/module/content/ButtonContent.js +130 -0
  28. package/build/module/content/ButtonContent.js.map +1 -0
  29. package/build/module/content/CalendarContent.js +173 -0
  30. package/build/module/content/CalendarContent.js.map +1 -0
  31. package/build/module/content/CardContent.js +114 -0
  32. package/build/module/content/CardContent.js.map +1 -0
  33. package/build/module/content/CarouselContent.js +173 -0
  34. package/build/module/content/CarouselContent.js.map +1 -0
  35. package/build/module/content/ChipContent.js +214 -0
  36. package/build/module/content/ChipContent.js.map +1 -0
  37. package/build/module/content/ChipRowContent.js +127 -0
  38. package/build/module/content/ChipRowContent.js.map +1 -0
  39. package/build/module/content/CredentialOfferContent.js +312 -0
  40. package/build/module/content/CredentialOfferContent.js.map +1 -0
  41. package/build/module/content/DialContent.js +101 -0
  42. package/build/module/content/DialContent.js.map +1 -0
  43. package/build/module/content/DividerContent.js +26 -0
  44. package/build/module/content/DividerContent.js.map +1 -0
  45. package/build/module/content/DonutChartContent.js +118 -0
  46. package/build/module/content/DonutChartContent.js.map +1 -0
  47. package/build/module/content/FormContent.js +141 -0
  48. package/build/module/content/FormContent.js.map +1 -0
  49. package/build/module/content/FormFieldBridge.js +157 -0
  50. package/build/module/content/FormFieldBridge.js.map +1 -0
  51. package/build/module/content/GaugeContent.js +77 -0
  52. package/build/module/content/GaugeContent.js.map +1 -0
  53. package/build/module/content/GridLayoutContent.js +227 -0
  54. package/build/module/content/GridLayoutContent.js.map +1 -0
  55. package/build/module/content/ImageContent.js +190 -0
  56. package/build/module/content/ImageContent.js.map +1 -0
  57. package/build/module/content/ListContent.js +121 -0
  58. package/build/module/content/ListContent.js.map +1 -0
  59. package/build/module/content/LocationContent.js +148 -0
  60. package/build/module/content/LocationContent.js.map +1 -0
  61. package/build/module/content/MapContent.js +213 -0
  62. package/build/module/content/MapContent.js.map +1 -0
  63. package/build/module/content/MultipleChoiceContent.js +91 -0
  64. package/build/module/content/MultipleChoiceContent.js.map +1 -0
  65. package/build/module/content/OpenBadgePreviewContent.js +141 -0
  66. package/build/module/content/OpenBadgePreviewContent.js.map +1 -0
  67. package/build/module/content/PhotoContent.js +154 -0
  68. package/build/module/content/PhotoContent.js.map +1 -0
  69. package/build/module/content/PieChartContent.js +129 -0
  70. package/build/module/content/PieChartContent.js.map +1 -0
  71. package/build/module/content/ProofPresentationContent.js +154 -0
  72. package/build/module/content/ProofPresentationContent.js.map +1 -0
  73. package/build/module/content/RadioButtonContent.js +136 -0
  74. package/build/module/content/RadioButtonContent.js.map +1 -0
  75. package/build/module/content/RowContent.js +539 -0
  76. package/build/module/content/RowContent.js.map +1 -0
  77. package/build/module/content/SectionContent.js +123 -0
  78. package/build/module/content/SectionContent.js.map +1 -0
  79. package/build/module/content/ShareEntryContent.js +111 -0
  80. package/build/module/content/ShareEntryContent.js.map +1 -0
  81. package/build/module/content/SimulatedHint.js +33 -0
  82. package/build/module/content/SimulatedHint.js.map +1 -0
  83. package/build/module/content/SliderContent.js +46 -0
  84. package/build/module/content/SliderContent.js.map +1 -0
  85. package/build/module/content/SpacerContent.js +21 -0
  86. package/build/module/content/SpacerContent.js.map +1 -0
  87. package/build/module/content/SpinnerContent.js +33 -0
  88. package/build/module/content/SpinnerContent.js.map +1 -0
  89. package/build/module/content/SubmitButtonContent.js +281 -0
  90. package/build/module/content/SubmitButtonContent.js.map +1 -0
  91. package/build/module/content/TextContent.js +127 -0
  92. package/build/module/content/TextContent.js.map +1 -0
  93. package/build/module/content/TileContent.js +237 -0
  94. package/build/module/content/TileContent.js.map +1 -0
  95. package/build/module/content/TimelineContent.js +120 -0
  96. package/build/module/content/TimelineContent.js.map +1 -0
  97. package/build/module/content/TitleContent.js +55 -0
  98. package/build/module/content/TitleContent.js.map +1 -0
  99. package/build/module/content/VideoContent.js +142 -0
  100. package/build/module/content/VideoContent.js.map +1 -0
  101. package/build/module/content/WebLinkContent.js +95 -0
  102. package/build/module/content/WebLinkContent.js.map +1 -0
  103. package/build/module/content/index.js +48 -0
  104. package/build/module/content/index.js.map +1 -0
  105. package/build/module/form-fields/CheckboxField.js +47 -0
  106. package/build/module/form-fields/CheckboxField.js.map +1 -0
  107. package/build/module/form-fields/DateField.js +8 -0
  108. package/build/module/form-fields/DateField.js.map +1 -0
  109. package/build/module/form-fields/DateField.native.js +141 -0
  110. package/build/module/form-fields/DateField.native.js.map +1 -0
  111. package/build/module/form-fields/DateField.web.js +45 -0
  112. package/build/module/form-fields/DateField.web.js.map +1 -0
  113. package/build/module/form-fields/DropdownField.js +172 -0
  114. package/build/module/form-fields/DropdownField.js.map +1 -0
  115. package/build/module/form-fields/MCQField.js +100 -0
  116. package/build/module/form-fields/MCQField.js.map +1 -0
  117. package/build/module/form-fields/RadioField.js +56 -0
  118. package/build/module/form-fields/RadioField.js.map +1 -0
  119. package/build/module/form-fields/SliderField.js +8 -0
  120. package/build/module/form-fields/SliderField.js.map +1 -0
  121. package/build/module/form-fields/SliderField.native.js +77 -0
  122. package/build/module/form-fields/SliderField.native.js.map +1 -0
  123. package/build/module/form-fields/SliderField.web.js +82 -0
  124. package/build/module/form-fields/SliderField.web.js.map +1 -0
  125. package/build/module/form-fields/SubmitButtonField.js +42 -0
  126. package/build/module/form-fields/SubmitButtonField.js.map +1 -0
  127. package/build/module/form-fields/TextField.js +56 -0
  128. package/build/module/form-fields/TextField.js.map +1 -0
  129. package/build/module/form-fields/index.js +15 -0
  130. package/build/module/form-fields/index.js.map +1 -0
  131. package/build/module/i18n/WorkflowI18n.js +94 -0
  132. package/build/module/i18n/WorkflowI18n.js.map +1 -0
  133. package/build/module/icons/VectorIcon.js +23 -0
  134. package/build/module/icons/VectorIcon.js.map +1 -0
  135. package/build/module/icons/VectorIcon.web.js +62 -0
  136. package/build/module/icons/VectorIcon.web.js.map +1 -0
  137. package/build/module/icons/WorkflowIcon.js +36 -0
  138. package/build/module/icons/WorkflowIcon.js.map +1 -0
  139. package/build/module/icons/types.js +4 -0
  140. package/build/module/icons/types.js.map +1 -0
  141. package/build/module/imageUriCache.js +25 -0
  142. package/build/module/imageUriCache.js.map +1 -0
  143. package/build/module/index.js +50 -0
  144. package/build/module/index.js.map +1 -0
  145. package/build/module/modal/WorkflowModal.js +115 -0
  146. package/build/module/modal/WorkflowModal.js.map +1 -0
  147. package/build/module/package.json +1 -0
  148. package/build/module/platform/platformName.js +10 -0
  149. package/build/module/platform/platformName.js.map +1 -0
  150. package/build/module/platform/platformName.web.js +5 -0
  151. package/build/module/platform/platformName.web.js.map +1 -0
  152. package/build/module/protocol/controlSnapshotStore.js +19 -0
  153. package/build/module/protocol/controlSnapshotStore.js.map +1 -0
  154. package/build/module/protocol/useProtocolExchange.js +168 -0
  155. package/build/module/protocol/useProtocolExchange.js.map +1 -0
  156. package/build/module/registries/ContentRegistry.js +53 -0
  157. package/build/module/registries/ContentRegistry.js.map +1 -0
  158. package/build/module/registries/FormFieldRegistry.js +56 -0
  159. package/build/module/registries/FormFieldRegistry.js.map +1 -0
  160. package/build/module/render/NodeBoundary.js +73 -0
  161. package/build/module/render/NodeBoundary.js.map +1 -0
  162. package/build/module/render/RenderTree.js +52 -0
  163. package/build/module/render/RenderTree.js.map +1 -0
  164. package/build/module/render/WorkflowRenderContext.js +34 -0
  165. package/build/module/render/WorkflowRenderContext.js.map +1 -0
  166. package/build/module/render/nodes.js +103 -0
  167. package/build/module/render/nodes.js.map +1 -0
  168. package/build/module/responsive/ResponsiveProvider.js +63 -0
  169. package/build/module/responsive/ResponsiveProvider.js.map +1 -0
  170. package/build/module/responsive/index.js +4 -0
  171. package/build/module/responsive/index.js.map +1 -0
  172. package/build/module/responsive/responsive.js +56 -0
  173. package/build/module/responsive/responsive.js.map +1 -0
  174. package/build/module/style/resolveDisplayHintStyle.js +145 -0
  175. package/build/module/style/resolveDisplayHintStyle.js.map +1 -0
  176. package/build/module/theme/WorkflowTheme.js +200 -0
  177. package/build/module/theme/WorkflowTheme.js.map +1 -0
  178. package/build/module/utils/testable.js +12 -0
  179. package/build/module/utils/testable.js.map +1 -0
  180. package/build/typescript/WorkflowFontScaleContext.d.ts +7 -0
  181. package/build/typescript/WorkflowFontScaleContext.d.ts.map +1 -0
  182. package/build/typescript/adapter/WalletAdapter.d.ts +145 -0
  183. package/build/typescript/adapter/WalletAdapter.d.ts.map +1 -0
  184. package/build/typescript/components/FallbackVideoPlayer.d.ts +6 -0
  185. package/build/typescript/components/FallbackVideoPlayer.d.ts.map +1 -0
  186. package/build/typescript/components/FallbackVideoPlayer.native.d.ts +7 -0
  187. package/build/typescript/components/FallbackVideoPlayer.native.d.ts.map +1 -0
  188. package/build/typescript/components/FallbackVideoPlayer.web.d.ts +9 -0
  189. package/build/typescript/components/FallbackVideoPlayer.web.d.ts.map +1 -0
  190. package/build/typescript/components/WorkflowButtonLabel.d.ts +11 -0
  191. package/build/typescript/components/WorkflowButtonLabel.d.ts.map +1 -0
  192. package/build/typescript/components/WorkflowCalendarIcon.d.ts +11 -0
  193. package/build/typescript/components/WorkflowCalendarIcon.d.ts.map +1 -0
  194. package/build/typescript/components/WorkflowText.d.ts +13 -0
  195. package/build/typescript/components/WorkflowText.d.ts.map +1 -0
  196. package/build/typescript/content/BadgeContent.d.ts +5 -0
  197. package/build/typescript/content/BadgeContent.d.ts.map +1 -0
  198. package/build/typescript/content/BarChartContent.d.ts +5 -0
  199. package/build/typescript/content/BarChartContent.d.ts.map +1 -0
  200. package/build/typescript/content/BarcodeContent.d.ts +11 -0
  201. package/build/typescript/content/BarcodeContent.d.ts.map +1 -0
  202. package/build/typescript/content/BasicTableContent.d.ts +5 -0
  203. package/build/typescript/content/BasicTableContent.d.ts.map +1 -0
  204. package/build/typescript/content/ButtonContent.d.ts +5 -0
  205. package/build/typescript/content/ButtonContent.d.ts.map +1 -0
  206. package/build/typescript/content/CalendarContent.d.ts +19 -0
  207. package/build/typescript/content/CalendarContent.d.ts.map +1 -0
  208. package/build/typescript/content/CardContent.d.ts +5 -0
  209. package/build/typescript/content/CardContent.d.ts.map +1 -0
  210. package/build/typescript/content/CarouselContent.d.ts +5 -0
  211. package/build/typescript/content/CarouselContent.d.ts.map +1 -0
  212. package/build/typescript/content/ChipContent.d.ts +5 -0
  213. package/build/typescript/content/ChipContent.d.ts.map +1 -0
  214. package/build/typescript/content/ChipRowContent.d.ts +8 -0
  215. package/build/typescript/content/ChipRowContent.d.ts.map +1 -0
  216. package/build/typescript/content/CredentialOfferContent.d.ts +98 -0
  217. package/build/typescript/content/CredentialOfferContent.d.ts.map +1 -0
  218. package/build/typescript/content/DialContent.d.ts +5 -0
  219. package/build/typescript/content/DialContent.d.ts.map +1 -0
  220. package/build/typescript/content/DividerContent.d.ts +5 -0
  221. package/build/typescript/content/DividerContent.d.ts.map +1 -0
  222. package/build/typescript/content/DonutChartContent.d.ts +5 -0
  223. package/build/typescript/content/DonutChartContent.d.ts.map +1 -0
  224. package/build/typescript/content/FormContent.d.ts +19 -0
  225. package/build/typescript/content/FormContent.d.ts.map +1 -0
  226. package/build/typescript/content/FormFieldBridge.d.ts +2 -0
  227. package/build/typescript/content/FormFieldBridge.d.ts.map +1 -0
  228. package/build/typescript/content/GaugeContent.d.ts +5 -0
  229. package/build/typescript/content/GaugeContent.d.ts.map +1 -0
  230. package/build/typescript/content/GridLayoutContent.d.ts +5 -0
  231. package/build/typescript/content/GridLayoutContent.d.ts.map +1 -0
  232. package/build/typescript/content/ImageContent.d.ts +5 -0
  233. package/build/typescript/content/ImageContent.d.ts.map +1 -0
  234. package/build/typescript/content/ListContent.d.ts +5 -0
  235. package/build/typescript/content/ListContent.d.ts.map +1 -0
  236. package/build/typescript/content/LocationContent.d.ts +32 -0
  237. package/build/typescript/content/LocationContent.d.ts.map +1 -0
  238. package/build/typescript/content/MapContent.d.ts +11 -0
  239. package/build/typescript/content/MapContent.d.ts.map +1 -0
  240. package/build/typescript/content/MultipleChoiceContent.d.ts +5 -0
  241. package/build/typescript/content/MultipleChoiceContent.d.ts.map +1 -0
  242. package/build/typescript/content/OpenBadgePreviewContent.d.ts +14 -0
  243. package/build/typescript/content/OpenBadgePreviewContent.d.ts.map +1 -0
  244. package/build/typescript/content/PhotoContent.d.ts +57 -0
  245. package/build/typescript/content/PhotoContent.d.ts.map +1 -0
  246. package/build/typescript/content/PieChartContent.d.ts +5 -0
  247. package/build/typescript/content/PieChartContent.d.ts.map +1 -0
  248. package/build/typescript/content/ProofPresentationContent.d.ts +14 -0
  249. package/build/typescript/content/ProofPresentationContent.d.ts.map +1 -0
  250. package/build/typescript/content/RadioButtonContent.d.ts +5 -0
  251. package/build/typescript/content/RadioButtonContent.d.ts.map +1 -0
  252. package/build/typescript/content/RowContent.d.ts +5 -0
  253. package/build/typescript/content/RowContent.d.ts.map +1 -0
  254. package/build/typescript/content/SectionContent.d.ts +5 -0
  255. package/build/typescript/content/SectionContent.d.ts.map +1 -0
  256. package/build/typescript/content/ShareEntryContent.d.ts +15 -0
  257. package/build/typescript/content/ShareEntryContent.d.ts.map +1 -0
  258. package/build/typescript/content/SimulatedHint.d.ts +9 -0
  259. package/build/typescript/content/SimulatedHint.d.ts.map +1 -0
  260. package/build/typescript/content/SliderContent.d.ts +10 -0
  261. package/build/typescript/content/SliderContent.d.ts.map +1 -0
  262. package/build/typescript/content/SpacerContent.d.ts +5 -0
  263. package/build/typescript/content/SpacerContent.d.ts.map +1 -0
  264. package/build/typescript/content/SpinnerContent.d.ts +5 -0
  265. package/build/typescript/content/SpinnerContent.d.ts.map +1 -0
  266. package/build/typescript/content/SubmitButtonContent.d.ts +9 -0
  267. package/build/typescript/content/SubmitButtonContent.d.ts.map +1 -0
  268. package/build/typescript/content/TextContent.d.ts +5 -0
  269. package/build/typescript/content/TextContent.d.ts.map +1 -0
  270. package/build/typescript/content/TileContent.d.ts +5 -0
  271. package/build/typescript/content/TileContent.d.ts.map +1 -0
  272. package/build/typescript/content/TimelineContent.d.ts +5 -0
  273. package/build/typescript/content/TimelineContent.d.ts.map +1 -0
  274. package/build/typescript/content/TitleContent.d.ts +5 -0
  275. package/build/typescript/content/TitleContent.d.ts.map +1 -0
  276. package/build/typescript/content/VideoContent.d.ts +10 -0
  277. package/build/typescript/content/VideoContent.d.ts.map +1 -0
  278. package/build/typescript/content/WebLinkContent.d.ts +5 -0
  279. package/build/typescript/content/WebLinkContent.d.ts.map +1 -0
  280. package/build/typescript/content/index.d.ts +46 -0
  281. package/build/typescript/content/index.d.ts.map +1 -0
  282. package/build/typescript/form-fields/CheckboxField.d.ts +5 -0
  283. package/build/typescript/form-fields/CheckboxField.d.ts.map +1 -0
  284. package/build/typescript/form-fields/DateField.d.ts +6 -0
  285. package/build/typescript/form-fields/DateField.d.ts.map +1 -0
  286. package/build/typescript/form-fields/DateField.native.d.ts +5 -0
  287. package/build/typescript/form-fields/DateField.native.d.ts.map +1 -0
  288. package/build/typescript/form-fields/DateField.web.d.ts +9 -0
  289. package/build/typescript/form-fields/DateField.web.d.ts.map +1 -0
  290. package/build/typescript/form-fields/DropdownField.d.ts +5 -0
  291. package/build/typescript/form-fields/DropdownField.d.ts.map +1 -0
  292. package/build/typescript/form-fields/MCQField.d.ts +5 -0
  293. package/build/typescript/form-fields/MCQField.d.ts.map +1 -0
  294. package/build/typescript/form-fields/RadioField.d.ts +5 -0
  295. package/build/typescript/form-fields/RadioField.d.ts.map +1 -0
  296. package/build/typescript/form-fields/SliderField.d.ts +6 -0
  297. package/build/typescript/form-fields/SliderField.d.ts.map +1 -0
  298. package/build/typescript/form-fields/SliderField.native.d.ts +5 -0
  299. package/build/typescript/form-fields/SliderField.native.d.ts.map +1 -0
  300. package/build/typescript/form-fields/SliderField.web.d.ts +11 -0
  301. package/build/typescript/form-fields/SliderField.web.d.ts.map +1 -0
  302. package/build/typescript/form-fields/SubmitButtonField.d.ts +5 -0
  303. package/build/typescript/form-fields/SubmitButtonField.d.ts.map +1 -0
  304. package/build/typescript/form-fields/TextField.d.ts +5 -0
  305. package/build/typescript/form-fields/TextField.d.ts.map +1 -0
  306. package/build/typescript/form-fields/index.d.ts +13 -0
  307. package/build/typescript/form-fields/index.d.ts.map +1 -0
  308. package/build/typescript/i18n/WorkflowI18n.d.ts +75 -0
  309. package/build/typescript/i18n/WorkflowI18n.d.ts.map +1 -0
  310. package/build/typescript/icons/VectorIcon.d.ts +4 -0
  311. package/build/typescript/icons/VectorIcon.d.ts.map +1 -0
  312. package/build/typescript/icons/VectorIcon.web.d.ts +16 -0
  313. package/build/typescript/icons/VectorIcon.web.d.ts.map +1 -0
  314. package/build/typescript/icons/WorkflowIcon.d.ts +19 -0
  315. package/build/typescript/icons/WorkflowIcon.d.ts.map +1 -0
  316. package/build/typescript/icons/types.d.ts +12 -0
  317. package/build/typescript/icons/types.d.ts.map +1 -0
  318. package/build/typescript/imageUriCache.d.ts +7 -0
  319. package/build/typescript/imageUriCache.d.ts.map +1 -0
  320. package/build/typescript/index.d.ts +48 -0
  321. package/build/typescript/index.d.ts.map +1 -0
  322. package/build/typescript/modal/WorkflowModal.d.ts +33 -0
  323. package/build/typescript/modal/WorkflowModal.d.ts.map +1 -0
  324. package/build/typescript/package.json +1 -0
  325. package/build/typescript/platform/platformName.d.ts +8 -0
  326. package/build/typescript/platform/platformName.d.ts.map +1 -0
  327. package/build/typescript/platform/platformName.web.d.ts +3 -0
  328. package/build/typescript/platform/platformName.web.d.ts.map +1 -0
  329. package/build/typescript/protocol/controlSnapshotStore.d.ts +12 -0
  330. package/build/typescript/protocol/controlSnapshotStore.d.ts.map +1 -0
  331. package/build/typescript/protocol/useProtocolExchange.d.ts +40 -0
  332. package/build/typescript/protocol/useProtocolExchange.d.ts.map +1 -0
  333. package/build/typescript/registries/ContentRegistry.d.ts +57 -0
  334. package/build/typescript/registries/ContentRegistry.d.ts.map +1 -0
  335. package/build/typescript/registries/FormFieldRegistry.d.ts +37 -0
  336. package/build/typescript/registries/FormFieldRegistry.d.ts.map +1 -0
  337. package/build/typescript/render/NodeBoundary.d.ts +25 -0
  338. package/build/typescript/render/NodeBoundary.d.ts.map +1 -0
  339. package/build/typescript/render/RenderTree.d.ts +23 -0
  340. package/build/typescript/render/RenderTree.d.ts.map +1 -0
  341. package/build/typescript/render/WorkflowRenderContext.d.ts +57 -0
  342. package/build/typescript/render/WorkflowRenderContext.d.ts.map +1 -0
  343. package/build/typescript/render/nodes.d.ts +49 -0
  344. package/build/typescript/render/nodes.d.ts.map +1 -0
  345. package/build/typescript/responsive/ResponsiveProvider.d.ts +39 -0
  346. package/build/typescript/responsive/ResponsiveProvider.d.ts.map +1 -0
  347. package/build/typescript/responsive/index.d.ts +3 -0
  348. package/build/typescript/responsive/index.d.ts.map +1 -0
  349. package/build/typescript/responsive/responsive.d.ts +24 -0
  350. package/build/typescript/responsive/responsive.d.ts.map +1 -0
  351. package/build/typescript/style/resolveDisplayHintStyle.d.ts +23 -0
  352. package/build/typescript/style/resolveDisplayHintStyle.d.ts.map +1 -0
  353. package/build/typescript/theme/WorkflowTheme.d.ts +177 -0
  354. package/build/typescript/theme/WorkflowTheme.d.ts.map +1 -0
  355. package/build/typescript/utils/testable.d.ts +8 -0
  356. package/build/typescript/utils/testable.d.ts.map +1 -0
  357. package/package.json +104 -3
  358. package/src/WorkflowFontScaleContext.tsx +74 -0
  359. package/src/adapter/WalletAdapter.tsx +225 -0
  360. package/src/components/FallbackVideoPlayer.native.tsx +9 -0
  361. package/src/components/FallbackVideoPlayer.tsx +5 -0
  362. package/src/components/FallbackVideoPlayer.web.tsx +24 -0
  363. package/src/components/WorkflowButtonLabel.tsx +41 -0
  364. package/src/components/WorkflowCalendarIcon.tsx +52 -0
  365. package/src/components/WorkflowText.tsx +121 -0
  366. package/src/content/BadgeContent.tsx +57 -0
  367. package/src/content/BarChartContent.tsx +76 -0
  368. package/src/content/BarcodeContent.tsx +59 -0
  369. package/src/content/BasicTableContent.tsx +139 -0
  370. package/src/content/ButtonContent.tsx +124 -0
  371. package/src/content/CalendarContent.tsx +178 -0
  372. package/src/content/CardContent.tsx +137 -0
  373. package/src/content/CarouselContent.tsx +197 -0
  374. package/src/content/ChipContent.tsx +209 -0
  375. package/src/content/ChipRowContent.tsx +133 -0
  376. package/src/content/CredentialOfferContent.tsx +229 -0
  377. package/src/content/DialContent.tsx +96 -0
  378. package/src/content/DividerContent.tsx +33 -0
  379. package/src/content/DonutChartContent.tsx +110 -0
  380. package/src/content/FormContent.tsx +158 -0
  381. package/src/content/FormFieldBridge.tsx +144 -0
  382. package/src/content/GaugeContent.tsx +66 -0
  383. package/src/content/GridLayoutContent.tsx +285 -0
  384. package/src/content/ImageContent.tsx +222 -0
  385. package/src/content/ListContent.tsx +98 -0
  386. package/src/content/LocationContent.tsx +135 -0
  387. package/src/content/MapContent.tsx +232 -0
  388. package/src/content/MultipleChoiceContent.tsx +74 -0
  389. package/src/content/OpenBadgePreviewContent.tsx +93 -0
  390. package/src/content/PhotoContent.tsx +110 -0
  391. package/src/content/PieChartContent.tsx +121 -0
  392. package/src/content/ProofPresentationContent.tsx +127 -0
  393. package/src/content/RadioButtonContent.tsx +129 -0
  394. package/src/content/RowContent.tsx +627 -0
  395. package/src/content/SectionContent.tsx +133 -0
  396. package/src/content/ShareEntryContent.tsx +109 -0
  397. package/src/content/SimulatedHint.tsx +20 -0
  398. package/src/content/SliderContent.tsx +56 -0
  399. package/src/content/SpacerContent.tsx +15 -0
  400. package/src/content/SpinnerContent.tsx +24 -0
  401. package/src/content/SubmitButtonContent.tsx +256 -0
  402. package/src/content/TextContent.tsx +140 -0
  403. package/src/content/TileContent.tsx +216 -0
  404. package/src/content/TimelineContent.tsx +91 -0
  405. package/src/content/TitleContent.tsx +49 -0
  406. package/src/content/VideoContent.tsx +131 -0
  407. package/src/content/WebLinkContent.tsx +87 -0
  408. package/src/content/index.ts +45 -0
  409. package/src/form-fields/CheckboxField.tsx +29 -0
  410. package/src/form-fields/DateField.native.tsx +123 -0
  411. package/src/form-fields/DateField.tsx +5 -0
  412. package/src/form-fields/DateField.web.tsx +32 -0
  413. package/src/form-fields/DropdownField.tsx +137 -0
  414. package/src/form-fields/MCQField.tsx +68 -0
  415. package/src/form-fields/RadioField.tsx +53 -0
  416. package/src/form-fields/SliderField.native.tsx +53 -0
  417. package/src/form-fields/SliderField.tsx +5 -0
  418. package/src/form-fields/SliderField.web.tsx +58 -0
  419. package/src/form-fields/SubmitButtonField.tsx +33 -0
  420. package/src/form-fields/TextField.tsx +49 -0
  421. package/src/form-fields/index.ts +12 -0
  422. package/src/i18n/WorkflowI18n.tsx +100 -0
  423. package/src/icons/VectorIcon.tsx +10 -0
  424. package/src/icons/VectorIcon.web.tsx +55 -0
  425. package/src/icons/WorkflowIcon.tsx +30 -0
  426. package/src/icons/types.ts +13 -0
  427. package/src/imageUriCache.ts +27 -0
  428. package/src/index.ts +97 -0
  429. package/src/modal/WorkflowModal.tsx +119 -0
  430. package/src/platform/platformName.ts +7 -0
  431. package/src/platform/platformName.web.ts +2 -0
  432. package/src/protocol/controlSnapshotStore.ts +25 -0
  433. package/src/protocol/useProtocolExchange.ts +185 -0
  434. package/src/registries/ContentRegistry.tsx +130 -0
  435. package/src/registries/FormFieldRegistry.tsx +83 -0
  436. package/src/render/NodeBoundary.tsx +69 -0
  437. package/src/render/RenderTree.tsx +63 -0
  438. package/src/render/WorkflowRenderContext.tsx +71 -0
  439. package/src/render/nodes.ts +104 -0
  440. package/src/responsive/ResponsiveProvider.tsx +103 -0
  441. package/src/responsive/index.ts +7 -0
  442. package/src/responsive/responsive.ts +67 -0
  443. package/src/style/resolveDisplayHintStyle.ts +153 -0
  444. package/src/theme/WorkflowTheme.tsx +162 -0
  445. package/src/utils/testable.ts +10 -0
@@ -0,0 +1,58 @@
1
+ import React from 'react'
2
+ import { StyleSheet, Text, View } from 'react-native'
3
+ import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
4
+
5
+ /**
6
+ * Web version of the slider: the browser's own range input. The community
7
+ * slider ships CommonJS that pulls a second copy of react-native-web into web
8
+ * bundles (~400 kB). Same behaviour as the native field: the label follows the
9
+ * thumb live, and the value is committed when the user lets go.
10
+ */
11
+ const SliderField: React.FC<FormFieldProps> = ({ field, value, onChange, colors }) => {
12
+ const min = field.min ?? 0
13
+ const max = field.max ?? 100
14
+
15
+ const toNum = (v: unknown): number => {
16
+ const n = typeof v === 'string' ? Number.parseFloat(v) : (v as number)
17
+ return Number.isFinite(n) ? n : min
18
+ }
19
+
20
+ const [display, setDisplay] = React.useState<number>(toNum(value))
21
+
22
+ // biome-ignore lint/correctness/useExhaustiveDependencies: sync the live label only when the committed value changes
23
+ React.useEffect(() => {
24
+ setDisplay(toNum(value))
25
+ }, [value])
26
+
27
+ const commit = () => onChange(Math.round(display).toString())
28
+
29
+ return (
30
+ <View style={s.wrap}>
31
+ {!!field.label && <Text style={[s.label, { color: colors.text }]}>{field.label}</Text>}
32
+ {React.createElement('input', {
33
+ type: 'range',
34
+ min,
35
+ max,
36
+ step: 1,
37
+ value: display,
38
+ 'aria-label': field.label || 'Slider',
39
+ style: { width: '100%', height: 40, accentColor: colors.primary },
40
+ onChange: (event: { target: { value: string } }) => setDisplay(Number(event.target.value)),
41
+ onPointerUp: commit,
42
+ onKeyUp: commit,
43
+ onBlur: commit,
44
+ })}
45
+ <Text style={[s.value, { color: colors.primary }]}>{Math.round(display)}</Text>
46
+ </View>
47
+ )
48
+ }
49
+
50
+ const s = StyleSheet.create({
51
+ wrap: { marginBottom: 8 },
52
+ label: { fontSize: 14, fontWeight: '600', marginBottom: 4 },
53
+ value: { fontSize: 16, fontWeight: '700', textAlign: 'center', marginTop: 2 },
54
+ })
55
+
56
+ FormFieldRegistry.register('slider', SliderField)
57
+
58
+ export default SliderField
@@ -0,0 +1,33 @@
1
+ /* eslint-disable no-console */
2
+
3
+ import React from 'react'
4
+ import { TouchableOpacity } from 'react-native'
5
+ import WorkflowButtonLabel from '../components/WorkflowButtonLabel'
6
+ import { useWorkflowT } from '../i18n/WorkflowI18n'
7
+ import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
8
+
9
+ const SubmitButtonField: React.FC<FormFieldProps> = ({ field, onChange, styles, colors, groupFontScale = 1 }) => {
10
+ const t = useWorkflowT()
11
+ const handlePress = () => {
12
+ // Trigger onChange which will be caught by ActionMenuBubble
13
+ if (onChange) {
14
+ onChange('submit')
15
+ }
16
+ }
17
+
18
+ return (
19
+ <TouchableOpacity
20
+ style={[styles.button, { backgroundColor: colors.primary, borderColor: colors.primary, marginTop: 8 }]}
21
+ onPress={handlePress}
22
+ activeOpacity={0.8}
23
+ >
24
+ <WorkflowButtonLabel style={styles.buttonText} groupFontScale={groupFontScale}>
25
+ {field.label || t('WorkflowUi.Submit')}
26
+ </WorkflowButtonLabel>
27
+ </TouchableOpacity>
28
+ )
29
+ }
30
+
31
+ FormFieldRegistry.register('submit-button', SubmitButtonField)
32
+
33
+ export default SubmitButtonField
@@ -0,0 +1,49 @@
1
+ import React from 'react'
2
+ import { TextInput, View } from 'react-native'
3
+ import WorkflowText from '../components/WorkflowText'
4
+ import { type FormFieldProps, FormFieldRegistry } from '../registries/FormFieldRegistry'
5
+ import { testIdWithKey } from '../utils/testable'
6
+
7
+ const TextField: React.FC<FormFieldProps> = ({ field, value, onChange, styles, colors }) => {
8
+ const isMultiline = field.type === 'text-area' || field.type === 'textarea'
9
+ const borderColor = colors.border || colors.primary || '#7EB8B8'
10
+ const backgroundColor = colors.background || 'rgba(255,255,255,0.08)'
11
+
12
+ return (
13
+ <View style={styles.fieldContainer}>
14
+ <WorkflowText variant="label" style={[styles.label, { color: colors.text }]}>
15
+ {field.label}
16
+ </WorkflowText>
17
+ <TextInput
18
+ testID={testIdWithKey(`WorkflowTextInput-${field.name || 'field'}`)}
19
+ accessibilityLabel={field.label || 'Text input'}
20
+ style={[
21
+ styles.input,
22
+ {
23
+ borderWidth: 1.5,
24
+ borderColor,
25
+ color: colors.text,
26
+ backgroundColor,
27
+ },
28
+ isMultiline ? { minHeight: 80, textAlignVertical: 'top' } : null,
29
+ ]}
30
+ value={value || ''}
31
+ onChangeText={onChange}
32
+ placeholder={field.placeholder}
33
+ placeholderTextColor={colors.border || '#9AA0A6'}
34
+ multiline={isMultiline}
35
+ numberOfLines={isMultiline ? 3 : undefined}
36
+ editable={field.disabled !== true}
37
+ underlineColorAndroid="transparent"
38
+ />
39
+ </View>
40
+ )
41
+ }
42
+
43
+ FormFieldRegistry.register('text', TextField)
44
+ FormFieldRegistry.register('text-field', TextField)
45
+ FormFieldRegistry.register('text-input', TextField)
46
+ FormFieldRegistry.register('textarea', TextField)
47
+ FormFieldRegistry.register('text-area', TextField)
48
+
49
+ export default TextField
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Registers the form-field renderers with FormFieldRegistry.
3
+ * Imported for its side effects by the package entry point.
4
+ */
5
+ import './TextField'
6
+ import './CheckboxField'
7
+ import './RadioField'
8
+ import './MCQField'
9
+ import './DateField'
10
+ import './SliderField'
11
+ import './DropdownField'
12
+ import './SubmitButtonField'
@@ -0,0 +1,100 @@
1
+ import { createContext, type ReactNode, useCallback, useContext } from 'react'
2
+
3
+ /**
4
+ * English text for every string the workflow controls show. Keys match the
5
+ * wallet's i18n keys (`Workflow.*`, `Global.*`), so the wallet can pass its own
6
+ * translate function straight through; new keys use the `WorkflowUi.*` prefix.
7
+ */
8
+ export const DEFAULT_WORKFLOW_STRINGS = {
9
+ 'Global.Decline': 'Decline',
10
+ 'Workflow.CredentialOffer': 'Credential offer',
11
+ 'Workflow.ProofRequest': 'Proof request',
12
+ 'Workflow.AcceptCredential': 'Accept credential',
13
+ 'Workflow.PresentProof': 'Present proof',
14
+ 'Workflow.WaitingForOffer': 'Waiting for the credential offer…',
15
+ 'Workflow.ReceivingCredential': 'Receiving credential…',
16
+ 'Workflow.CredentialReceived': 'Credential received',
17
+ 'Workflow.OfferDeclined': 'Offer declined',
18
+ 'Workflow.OfferFailed': 'Something went wrong receiving the credential',
19
+ 'Workflow.WaitingForProofRequest': 'Waiting for the proof request…',
20
+ 'Workflow.PresentingProof': 'Presenting proof…',
21
+ 'Workflow.ProofPresented': 'Proof presented',
22
+ 'Workflow.ProofDeclined': 'Proof request declined',
23
+ 'Workflow.ProofFailed': 'Something went wrong presenting the proof',
24
+ 'WorkflowUi.Select': 'Select...',
25
+ 'WorkflowUi.SelectDate': 'Select date...',
26
+ 'WorkflowUi.Submit': 'Submit',
27
+ 'WorkflowUi.Done': 'Done',
28
+ 'WorkflowUi.Error': 'Error',
29
+ 'WorkflowUi.InvalidLink': 'Invalid link',
30
+ 'WorkflowUi.InvalidLinkMessage': 'Only http(s) links are supported.',
31
+ 'WorkflowUi.LinkFailed': 'Unable to open link',
32
+ 'WorkflowUi.TakePhoto': 'Take a photo',
33
+ 'WorkflowUi.Retake': 'Retake',
34
+ 'WorkflowUi.PhotoFailed': 'Failed to take photo. Please try again.',
35
+ 'WorkflowUi.ScanCode': 'Scan QR code',
36
+ 'WorkflowUi.ShareLocation': 'Share location',
37
+ 'WorkflowUi.LocationUnavailable': 'Location unavailable',
38
+ 'WorkflowUi.LocationUnavailableMessage':
39
+ 'Could not get your current GPS position. Turn on Location / GPS and try again.',
40
+ 'WorkflowUi.MyLocation': 'My location coordinates:',
41
+ 'WorkflowUi.Share': 'Share',
42
+ 'WorkflowUi.ShareFailed': 'Failed to share content',
43
+ 'WorkflowUi.ReportTitle': 'DigiCred Wallet Report',
44
+ 'WorkflowUi.Responses': 'Responses:',
45
+ 'WorkflowUi.NoData': 'No data entered yet.',
46
+ 'WorkflowUi.AddToCalendar': 'Add to Calendar',
47
+ 'WorkflowUi.InvalidDate': 'Invalid date',
48
+ 'WorkflowUi.InvalidDateMessage': 'This event is missing a valid start or end time.',
49
+ 'WorkflowUi.CalendarAdded': 'Event added to your calendar!',
50
+ 'WorkflowUi.CalendarFailed': 'Failed to add event to calendar.',
51
+ 'WorkflowUi.Event': 'Event',
52
+ 'WorkflowUi.Location': 'Location',
53
+ 'WorkflowUi.OpenInMaps': 'Tap to open in Maps',
54
+ 'WorkflowUi.VideoFailed': 'Failed to load video',
55
+ 'WorkflowUi.Simulated': 'Simulated on the web',
56
+ 'WorkflowUi.OpenBadge': 'Open badge',
57
+ 'WorkflowUi.OpenBadgeDescription':
58
+ 'Preview of the badge signed onto this artifact. Tap {{label}} to accept and store it.',
59
+ 'WorkflowUi.AddToWallet': 'Add to Wallet',
60
+ } as const
61
+
62
+ export type WorkflowStringKey = keyof typeof DEFAULT_WORKFLOW_STRINGS
63
+
64
+ /**
65
+ * Returns the text for `key`. `defaultValue` is the English text; `params`
66
+ * fill `{{name}}` placeholders. Same shape as i18next's `t(key, { defaultValue, ...params })`.
67
+ */
68
+ export type WorkflowTranslate = (key: string, defaultValue: string, params?: Record<string, string | number>) => string
69
+
70
+ const fill = (text: string, params?: Record<string, string | number>) =>
71
+ params
72
+ ? text.replace(/\{\{\s*(\w+)\s*\}\}/g, (match, name: string) => (name in params ? String(params[name]) : match))
73
+ : text
74
+
75
+ const englishTranslate: WorkflowTranslate = (_key, defaultValue, params) => fill(defaultValue, params)
76
+
77
+ const WorkflowI18nContext = createContext<WorkflowTranslate>(englishTranslate)
78
+
79
+ export type WorkflowI18nProviderProps = { translate: WorkflowTranslate; children?: ReactNode }
80
+
81
+ /**
82
+ * Supplies translations for the workflow controls. Without it they show
83
+ * English. Wallet: `translate={(key, defaultValue, params) => t(key, { defaultValue, ...params })}`.
84
+ */
85
+ export function WorkflowI18nProvider({ translate, children }: WorkflowI18nProviderProps) {
86
+ return <WorkflowI18nContext.Provider value={translate}>{children}</WorkflowI18nContext.Provider>
87
+ }
88
+
89
+ /** `t('Global.Decline')` returns the translated text, falling back to English. */
90
+ export function useWorkflowT(): (key: WorkflowStringKey, params?: Record<string, string | number>) => string {
91
+ const translate = useContext(WorkflowI18nContext)
92
+ return useCallback(
93
+ (key: WorkflowStringKey, params?: Record<string, string | number>) => {
94
+ const text = translate(key, DEFAULT_WORKFLOW_STRINGS[key], params)
95
+ // A translate function that does not know the key may return the key itself.
96
+ return text && text !== key ? fill(text, params) : fill(DEFAULT_WORKFLOW_STRINGS[key], params)
97
+ },
98
+ [translate]
99
+ )
100
+ }
@@ -0,0 +1,10 @@
1
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
2
+ import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
3
+ import type { WorkflowIconProps } from './types'
4
+
5
+ /** Native: the vector-icon fonts the wallet already bundles. */
6
+ export function VectorIcon({ set = 'material', name, size, color, style }: WorkflowIconProps) {
7
+ const Family = set === 'material-community' ? MaterialCommunityIcons : MaterialIcons
8
+ // vector-icons' typings use the old @types/react-native StyleProp; same runtime shape.
9
+ return <Family name={name} size={size} color={color} style={style as never} />
10
+ }
@@ -0,0 +1,55 @@
1
+ import { Text } from 'react-native'
2
+ import type { WorkflowIconProps, WorkflowIconSet } from './types'
3
+
4
+ /**
5
+ * Web: `react-native-vector-icons` can't load in a browser (Flow source and a
6
+ * native TurboModule lookup at import time), so the glyphs the controls use are
7
+ * drawn as text in the same fonts. The host page loads the fonts once:
8
+ *
9
+ * @font-face { font-family: 'MaterialIcons'; src: url(react-native-vector-icons/Fonts/MaterialIcons.ttf); }
10
+ * @font-face { font-family: 'MaterialCommunityIcons'; src: url(react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf); }
11
+ *
12
+ * Or replace icons entirely with `WorkflowIconProvider`. Names not listed here
13
+ * draw nothing; add a codepoint when a control starts using a new icon
14
+ * (`icons.test.tsx` checks every name the controls use).
15
+ */
16
+ export const WEB_GLYPHS: Record<WorkflowIconSet, Record<string, number>> = {
17
+ material: {
18
+ phone: 57549,
19
+ share: 59405,
20
+ check: 58826,
21
+ info: 59534,
22
+ warning: 57346,
23
+ error: 57344,
24
+ 'check-circle': 59500,
25
+ cancel: 58825,
26
+ },
27
+ 'material-community': {
28
+ 'qrcode-scan': 984115,
29
+ 'image-off-outline': 987601,
30
+ 'camera-retake-outline': 986650,
31
+ 'camera-outline': 986461,
32
+ },
33
+ }
34
+
35
+ const FONT_FAMILY: Record<WorkflowIconSet, string> = {
36
+ material: 'MaterialIcons',
37
+ 'material-community': 'MaterialCommunityIcons',
38
+ }
39
+
40
+ export function VectorIcon({ set = 'material', name, size, color, style }: WorkflowIconProps) {
41
+ const codepoint = WEB_GLYPHS[set][name]
42
+ if (codepoint === undefined) return null
43
+ return (
44
+ <Text
45
+ selectable={false}
46
+ style={[
47
+ { fontSize: size, color, lineHeight: size },
48
+ style,
49
+ { fontFamily: FONT_FAMILY[set], fontWeight: 'normal', fontStyle: 'normal' },
50
+ ]}
51
+ >
52
+ {String.fromCodePoint(codepoint)}
53
+ </Text>
54
+ )
55
+ }
@@ -0,0 +1,30 @@
1
+ import { createContext, type ReactNode, useContext } from 'react'
2
+ import type { WorkflowIconProps } from './types'
3
+ import { VectorIcon } from './VectorIcon'
4
+
5
+ export type { WorkflowIconProps, WorkflowIconSet } from './types'
6
+
7
+ /** Draws one icon. Return `null` to fall back to the built-in vector icons. */
8
+ export type WorkflowIconRenderer = (props: WorkflowIconProps) => ReactNode | null
9
+
10
+ const WorkflowIconContext = createContext<WorkflowIconRenderer | null>(null)
11
+
12
+ export type WorkflowIconProviderProps = { renderIcon: WorkflowIconRenderer; children?: ReactNode }
13
+
14
+ /**
15
+ * Replaces the icons every control draws (e.g. the designer can use its own
16
+ * icon set). Without it, controls use `react-native-vector-icons` on native,
17
+ * like the wallet, and the same fonts drawn as text on the web (the page loads
18
+ * the fonts; see `VectorIcon.web.tsx`).
19
+ */
20
+ export function WorkflowIconProvider({ renderIcon, children }: WorkflowIconProviderProps) {
21
+ return <WorkflowIconContext.Provider value={renderIcon}>{children}</WorkflowIconContext.Provider>
22
+ }
23
+
24
+ /** The one place controls draw icons. */
25
+ export function WorkflowIcon(props: WorkflowIconProps) {
26
+ const renderIcon = useContext(WorkflowIconContext)
27
+ const custom = renderIcon?.(props)
28
+ if (custom != null) return <>{custom}</>
29
+ return <VectorIcon {...props} />
30
+ }
@@ -0,0 +1,13 @@
1
+ import type { StyleProp, TextStyle } from 'react-native'
2
+
3
+ /** Icon families the controls use (names are the vector-icons names). */
4
+ export type WorkflowIconSet = 'material' | 'material-community'
5
+
6
+ export type WorkflowIconProps = {
7
+ name: string
8
+ /** Default `material`. */
9
+ set?: WorkflowIconSet
10
+ size: number
11
+ color: string
12
+ style?: StyleProp<TextStyle>
13
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Deduped Image.prefetch for workflow tile/card URLs.
3
+ */
4
+
5
+ import { Image } from 'react-native'
6
+
7
+ const prefetched = new Set<string>()
8
+ const inflight = new Set<string>()
9
+
10
+ export function prefetchImageUri(uri: string | undefined): void {
11
+ const trimmed = uri?.trim()
12
+ if (!trimmed || !trimmed.startsWith('http')) return
13
+ if (prefetched.has(trimmed) || inflight.has(trimmed)) return
14
+ inflight.add(trimmed)
15
+ void Image.prefetch(trimmed)
16
+ .then(() => {
17
+ prefetched.add(trimmed)
18
+ })
19
+ .catch(() => {})
20
+ .finally(() => inflight.delete(trimmed))
21
+ }
22
+
23
+ /** Test-only. */
24
+ export function clearImageUriCache(): void {
25
+ prefetched.clear()
26
+ inflight.clear()
27
+ }
package/src/index.ts ADDED
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @veridid/workflow-ui
3
+ *
4
+ * React Native components for workflow display hints. Written once with React
5
+ * Native primitives:
6
+ * - the DigiCred wallet renders them natively (Metro)
7
+ * - the CrMS designer renders them through react-native-web (Vite)
8
+ *
9
+ * The wallet is the reference renderer. Device-only controls (camera, barcode,
10
+ * location, …) get a `.web.tsx` placeholder and talk to the device through an
11
+ * adapter, never through a native module imported directly.
12
+ */
13
+ export { CONTRACT_VERSION } from '@veridid/workflow-core'
14
+ // App providers: theme, translations, icons, device and credential access, popups
15
+ export type {
16
+ CalendarEvent,
17
+ Coordinates,
18
+ CredentialCardRequest,
19
+ ExchangeAttribute,
20
+ ExchangeKind,
21
+ ExchangeRecord,
22
+ ExchangeStatus,
23
+ ShareRequest,
24
+ SimulatedWalletOptions,
25
+ VideoPlayerProps,
26
+ WalletAdapter,
27
+ WalletAdapterProviderProps,
28
+ } from './adapter/WalletAdapter'
29
+ export {
30
+ createSimulatedWalletAdapter,
31
+ SIMULATED_LOCATION,
32
+ SIMULATED_PHOTO_URI,
33
+ useWalletAdapter,
34
+ WalletAdapterProvider,
35
+ } from './adapter/WalletAdapter'
36
+ export { default as WorkflowButtonLabel } from './components/WorkflowButtonLabel'
37
+ // Building blocks for host-rendered controls
38
+ export type { WorkflowTextProps } from './components/WorkflowText'
39
+ export { default as WorkflowText, WORKFLOW_TEXT_BASE_SIZES } from './components/WorkflowText'
40
+ export { coerceToChipRowItem } from './content/ChipRowContent'
41
+ export { isFormFieldChild } from './content/FormContent'
42
+ export type { WorkflowI18nProviderProps, WorkflowStringKey, WorkflowTranslate } from './i18n/WorkflowI18n'
43
+ export { DEFAULT_WORKFLOW_STRINGS, useWorkflowT, WorkflowI18nProvider } from './i18n/WorkflowI18n'
44
+ export type {
45
+ WorkflowIconProps,
46
+ WorkflowIconProviderProps,
47
+ WorkflowIconRenderer,
48
+ WorkflowIconSet,
49
+ } from './icons/WorkflowIcon'
50
+ export { WorkflowIcon, WorkflowIconProvider } from './icons/WorkflowIcon'
51
+ export { clearImageUriCache, prefetchImageUri } from './imageUriCache'
52
+ export type { WorkflowModalHostProps, WorkflowModalProps } from './modal/WorkflowModal'
53
+ export { useModalPosition, WorkflowModal, WorkflowModalHost } from './modal/WorkflowModal'
54
+ export { platformName } from './platform/platformName'
55
+ export { clearControlSnapshots } from './protocol/controlSnapshotStore'
56
+ // Registries: map a display-hint `type` to its renderer
57
+ export type { ContentProps, ContentRenderer } from './registries/ContentRegistry'
58
+ export { ContentRegistry } from './registries/ContentRegistry'
59
+ export type { FormFieldProps, FormFieldRenderer } from './registries/FormFieldRegistry'
60
+ export { FormFieldRegistry } from './registries/FormFieldRegistry'
61
+ // Rendering a screen: RenderTree + optional provider for expressions and designer hooks
62
+ export type { WorkflowNode, WorkflowNodePath } from './render/nodes'
63
+ export { deriveNode, resolveNode } from './render/nodes'
64
+ export type { RenderTreeProps } from './render/RenderTree'
65
+ export { RenderTree } from './render/RenderTree'
66
+ export type {
67
+ WorkflowNodeInfo,
68
+ WorkflowRenderOptions,
69
+ WorkflowRenderProviderProps,
70
+ } from './render/WorkflowRenderContext'
71
+ export { WorkflowRenderProvider } from './render/WorkflowRenderContext'
72
+ // Providers the host app wraps the workflow screen in
73
+ export type { ResponsiveContext, ResponsiveProviderProps, ScreenSize } from './responsive'
74
+ export { ResponsiveProvider, ResponsiveRule, useDigiCredStyles, useResponsive } from './responsive'
75
+ export * from './style/resolveDisplayHintStyle'
76
+ export type {
77
+ WorkflowCardColors,
78
+ WorkflowColors,
79
+ WorkflowTheme,
80
+ WorkflowThemeOverrides,
81
+ WorkflowThemeProviderProps,
82
+ } from './theme/WorkflowTheme'
83
+ export {
84
+ DEFAULT_WORKFLOW_THEME,
85
+ mergeWorkflowTheme,
86
+ useWorkflowTheme,
87
+ WorkflowThemeProvider,
88
+ } from './theme/WorkflowTheme'
89
+ export {
90
+ useRegisterTitleGroupScale,
91
+ useWorkflowTitleScale,
92
+ WorkflowFontScaleProvider,
93
+ } from './WorkflowFontScaleContext'
94
+
95
+ // Side effects: register the built-in form fields and content components.
96
+ import './form-fields'
97
+ import './content'
@@ -0,0 +1,119 @@
1
+ import {
2
+ createContext,
3
+ type ReactNode,
4
+ useCallback,
5
+ useContext,
6
+ useEffect,
7
+ useId,
8
+ useMemo,
9
+ useRef,
10
+ useState,
11
+ } from 'react'
12
+ import { Modal, type ModalProps, type StyleProp, StyleSheet, View, type ViewStyle } from 'react-native'
13
+
14
+ type Origin = { x: number; y: number }
15
+
16
+ type ModalHostApi = {
17
+ show(id: string, node: ReactNode): void
18
+ hide(id: string): void
19
+ /** Window position of the host, so popups can convert window coordinates. */
20
+ measureOrigin(callback: (origin: Origin) => void): void
21
+ }
22
+
23
+ const ModalHostContext = createContext<ModalHostApi | null>(null)
24
+
25
+ export type WorkflowModalHostProps = { children?: ReactNode; style?: StyleProp<ViewStyle> }
26
+
27
+ /**
28
+ * Optional. Popups (dropdown list, date sheet) of the controls inside open
29
+ * over this view instead of over the whole window. The designer wraps its
30
+ * phone frame in it, so a dropdown stays inside the phone and the rest of
31
+ * the designer remains usable. Put it outside any ScrollView.
32
+ */
33
+ export function WorkflowModalHost({ children, style }: WorkflowModalHostProps) {
34
+ const [entries, setEntries] = useState<Array<{ id: string; node: ReactNode }>>([])
35
+ const ref = useRef<View>(null)
36
+
37
+ const api = useMemo<ModalHostApi>(
38
+ () => ({
39
+ show: (id, node) =>
40
+ setEntries((prev) => {
41
+ const index = prev.findIndex((e) => e.id === id)
42
+ if (index === -1) return [...prev, { id, node }]
43
+ const next = prev.slice()
44
+ next[index] = { id, node }
45
+ return next
46
+ }),
47
+ hide: (id) => setEntries((prev) => prev.filter((e) => e.id !== id)),
48
+ measureOrigin: (callback) => {
49
+ const node = ref.current
50
+ if (!node) return callback({ x: 0, y: 0 })
51
+ node.measureInWindow((x, y) => callback({ x, y }))
52
+ },
53
+ }),
54
+ []
55
+ )
56
+
57
+ return (
58
+ <ModalHostContext.Provider value={api}>
59
+ <View ref={ref} collapsable={false} style={[host.root, style]}>
60
+ {children}
61
+ {entries.map((entry) => (
62
+ <View key={entry.id} style={StyleSheet.absoluteFill} pointerEvents="box-none">
63
+ {entry.node}
64
+ </View>
65
+ ))}
66
+ </View>
67
+ </ModalHostContext.Provider>
68
+ )
69
+ }
70
+
71
+ export type WorkflowModalProps = Pick<ModalProps, 'visible' | 'transparent' | 'animationType' | 'onRequestClose'> & {
72
+ children?: ReactNode
73
+ }
74
+
75
+ /**
76
+ * React Native's `Modal`, or a layer in the nearest {@link WorkflowModalHost}
77
+ * when there is one. Same props as the subset of `Modal` the controls use.
78
+ */
79
+ export function WorkflowModal({ visible, transparent, animationType, onRequestClose, children }: WorkflowModalProps) {
80
+ const hostApi = useContext(ModalHostContext)
81
+ const id = useId()
82
+
83
+ useEffect(() => {
84
+ if (!hostApi) return
85
+ if (visible)
86
+ hostApi.show(id, <View style={[StyleSheet.absoluteFill, transparent ? null : host.opaque]}>{children}</View>)
87
+ else hostApi.hide(id)
88
+ }, [hostApi, id, visible, transparent, children])
89
+
90
+ useEffect(() => () => hostApi?.hide(id), [hostApi, id])
91
+
92
+ if (hostApi) return null
93
+ return (
94
+ <Modal visible={visible} transparent={transparent} animationType={animationType} onRequestClose={onRequestClose}>
95
+ {children}
96
+ </Modal>
97
+ )
98
+ }
99
+
100
+ /**
101
+ * Converts a window position (from `measureInWindow`) into the coordinate
102
+ * space popups are drawn in: the host's when there is one, the window's
103
+ * otherwise.
104
+ */
105
+ export function useModalPosition(): (window: Origin, callback: (local: Origin) => void) => void {
106
+ const hostApi = useContext(ModalHostContext)
107
+ return useCallback(
108
+ (window, callback) => {
109
+ if (!hostApi) return callback(window)
110
+ hostApi.measureOrigin((origin) => callback({ x: window.x - origin.x, y: window.y - origin.y }))
111
+ },
112
+ [hostApi]
113
+ )
114
+ }
115
+
116
+ const host = StyleSheet.create({
117
+ root: { position: 'relative', overflow: 'hidden' },
118
+ opaque: { backgroundColor: '#000000' },
119
+ })
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Native implementation (wallet). The web build ships `platformName.web.ts`
3
+ * next to this file; Metro picks this one, Vite (with `.web.*` extensions
4
+ * first) picks the web one. Device-only controls use the same pattern so web
5
+ * placeholders never import native modules.
6
+ */
7
+ export const platformName: 'native' | 'web' = 'native'
@@ -0,0 +1,2 @@
1
+ /** Web implementation (CrMS designer through react-native-web). */
2
+ export const platformName: 'native' | 'web' = 'web'
@@ -0,0 +1,25 @@
1
+ // Module-level store so a protocol-aware control's phase survives the
2
+ // component being unmounted and remounted (leaving and re-entering the
3
+ // workflow screen). Without this, a remount resets the control to its initial
4
+ // phase and resurrects the action buttons — a second tap then re-fires the
5
+ // workflow event, and templates with self-loop transitions duplicate real
6
+ // protocol work (e.g. a second credential offer for the same instance).
7
+ // v1: in-memory only — an app restart falls back to the initial phase.
8
+ export interface ControlSnapshot {
9
+ phase: string
10
+ recordId: string | null
11
+ armedAt: number | null
12
+ handledIds: string[]
13
+ outcomeSent: boolean
14
+ }
15
+
16
+ const snapshots = new Map<string, ControlSnapshot>()
17
+
18
+ export const getControlSnapshot = (key?: string): ControlSnapshot | undefined => (key ? snapshots.get(key) : undefined)
19
+
20
+ export const saveControlSnapshot = (key: string | undefined, snapshot: ControlSnapshot): void => {
21
+ if (key) snapshots.set(key, snapshot)
22
+ }
23
+
24
+ /** Forget every saved phase (tests, or a host resetting a preview). */
25
+ export const clearControlSnapshots = (): void => snapshots.clear()