@procivis/one-react-native-components 0.3.53 → 0.3.71

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 (177) hide show
  1. package/lib/commonjs/components/credential/credential.js +6 -3
  2. package/lib/commonjs/components/credential/credential.js.map +1 -1
  3. package/lib/commonjs/components/history/history-list-item-icon.js +3 -1
  4. package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
  5. package/lib/commonjs/components/history/history-list-screen.js +2 -2
  6. package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
  7. package/lib/commonjs/components/proof-request/select-credential.js +7 -3
  8. package/lib/commonjs/components/proof-request/select-credential.js.map +1 -1
  9. package/lib/commonjs/components/proof-request/share-credential.js +6 -9
  10. package/lib/commonjs/components/proof-request/share-credential.js.map +1 -1
  11. package/lib/commonjs/ui-components/buttons/index.js +7 -0
  12. package/lib/commonjs/ui-components/buttons/index.js.map +1 -1
  13. package/lib/commonjs/ui-components/buttons/share-button.js +54 -0
  14. package/lib/commonjs/ui-components/buttons/share-button.js.map +1 -0
  15. package/lib/commonjs/ui-components/credential/card/credential-card.js +14 -29
  16. package/lib/commonjs/ui-components/credential/card/credential-card.js.map +1 -1
  17. package/lib/commonjs/ui-components/credential/card/credential-details-card.js +27 -28
  18. package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
  19. package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js +10 -6
  20. package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js.map +1 -1
  21. package/lib/commonjs/ui-components/header/header.js +7 -5
  22. package/lib/commonjs/ui-components/header/header.js.map +1 -1
  23. package/lib/commonjs/ui-components/history/history-details.js +3 -1
  24. package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
  25. package/lib/commonjs/ui-components/icons/icons.js +123 -1
  26. package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
  27. package/lib/commonjs/ui-components/index.js +11 -0
  28. package/lib/commonjs/ui-components/index.js.map +1 -1
  29. package/lib/commonjs/ui-components/loader/loading-result.js +8 -1
  30. package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
  31. package/lib/commonjs/ui-components/nfc/index.js +14 -0
  32. package/lib/commonjs/ui-components/nfc/index.js.map +1 -0
  33. package/lib/commonjs/ui-components/nfc/nfc-process.js +77 -0
  34. package/lib/commonjs/ui-components/nfc/nfc-process.js.map +1 -0
  35. package/lib/commonjs/ui-components/screens/section-list-screen.js +20 -5
  36. package/lib/commonjs/ui-components/screens/section-list-screen.js.map +1 -1
  37. package/lib/commonjs/ui-components/searchbar/animated-search-bar.js +10 -8
  38. package/lib/commonjs/ui-components/searchbar/animated-search-bar.js.map +1 -1
  39. package/lib/commonjs/utils/hooks/core/backup.js +1 -1
  40. package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
  41. package/lib/commonjs/utils/hooks/core/core-init.js +2 -1
  42. package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
  43. package/lib/commonjs/utils/hooks/core/credentials.js +4 -4
  44. package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
  45. package/lib/commonjs/utils/hooks/core/proofs.js +13 -3
  46. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  47. package/lib/commonjs/utils/hooks/index.js +11 -0
  48. package/lib/commonjs/utils/hooks/index.js.map +1 -1
  49. package/lib/commonjs/utils/hooks/nfc/nfc-status.js +40 -0
  50. package/lib/commonjs/utils/hooks/nfc/nfc-status.js.map +1 -0
  51. package/lib/commonjs/utils/index.js +12 -0
  52. package/lib/commonjs/utils/index.js.map +1 -1
  53. package/lib/commonjs/utils/parsers/credential-sharing.js +18 -1
  54. package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
  55. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  56. package/lib/commonjs/utils/parsers/query.js +1 -1
  57. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  58. package/lib/commonjs/utils/url.js +80 -0
  59. package/lib/commonjs/utils/url.js.map +1 -0
  60. package/lib/module/components/credential/credential.js +5 -3
  61. package/lib/module/components/credential/credential.js.map +1 -1
  62. package/lib/module/components/history/history-list-item-icon.js +3 -1
  63. package/lib/module/components/history/history-list-item-icon.js.map +1 -1
  64. package/lib/module/components/history/history-list-screen.js +2 -2
  65. package/lib/module/components/history/history-list-screen.js.map +1 -1
  66. package/lib/module/components/proof-request/select-credential.js +5 -2
  67. package/lib/module/components/proof-request/select-credential.js.map +1 -1
  68. package/lib/module/components/proof-request/share-credential.js +7 -10
  69. package/lib/module/components/proof-request/share-credential.js.map +1 -1
  70. package/lib/module/ui-components/buttons/index.js +2 -1
  71. package/lib/module/ui-components/buttons/index.js.map +1 -1
  72. package/lib/module/ui-components/buttons/share-button.js +47 -0
  73. package/lib/module/ui-components/buttons/share-button.js.map +1 -0
  74. package/lib/module/ui-components/credential/card/credential-card.js +15 -30
  75. package/lib/module/ui-components/credential/card/credential-card.js.map +1 -1
  76. package/lib/module/ui-components/credential/card/credential-details-card.js +27 -28
  77. package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
  78. package/lib/module/ui-components/credential/card/credential-details-list-item.js +10 -6
  79. package/lib/module/ui-components/credential/card/credential-details-list-item.js.map +1 -1
  80. package/lib/module/ui-components/header/header.js +7 -5
  81. package/lib/module/ui-components/header/header.js.map +1 -1
  82. package/lib/module/ui-components/history/history-details.js +4 -2
  83. package/lib/module/ui-components/history/history-details.js.map +1 -1
  84. package/lib/module/ui-components/icons/icons.js +117 -0
  85. package/lib/module/ui-components/icons/icons.js.map +1 -1
  86. package/lib/module/ui-components/index.js +1 -0
  87. package/lib/module/ui-components/index.js.map +1 -1
  88. package/lib/module/ui-components/loader/loading-result.js +8 -1
  89. package/lib/module/ui-components/loader/loading-result.js.map +1 -1
  90. package/lib/module/ui-components/nfc/index.js +3 -0
  91. package/lib/module/ui-components/nfc/index.js.map +1 -0
  92. package/lib/module/ui-components/nfc/nfc-process.js +69 -0
  93. package/lib/module/ui-components/nfc/nfc-process.js.map +1 -0
  94. package/lib/module/ui-components/screens/section-list-screen.js +21 -6
  95. package/lib/module/ui-components/screens/section-list-screen.js.map +1 -1
  96. package/lib/module/ui-components/searchbar/animated-search-bar.js +10 -8
  97. package/lib/module/ui-components/searchbar/animated-search-bar.js.map +1 -1
  98. package/lib/module/utils/hooks/core/backup.js +1 -1
  99. package/lib/module/utils/hooks/core/backup.js.map +1 -1
  100. package/lib/module/utils/hooks/core/core-init.js +1 -0
  101. package/lib/module/utils/hooks/core/core-init.js.map +1 -1
  102. package/lib/module/utils/hooks/core/credentials.js +4 -4
  103. package/lib/module/utils/hooks/core/credentials.js.map +1 -1
  104. package/lib/module/utils/hooks/core/proofs.js +12 -2
  105. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  106. package/lib/module/utils/hooks/index.js +1 -0
  107. package/lib/module/utils/hooks/index.js.map +1 -1
  108. package/lib/module/utils/hooks/nfc/nfc-status.js +32 -0
  109. package/lib/module/utils/hooks/nfc/nfc-status.js.map +1 -0
  110. package/lib/module/utils/index.js +1 -0
  111. package/lib/module/utils/index.js.map +1 -1
  112. package/lib/module/utils/parsers/credential-sharing.js +18 -1
  113. package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
  114. package/lib/module/utils/parsers/credential.js.map +1 -1
  115. package/lib/module/utils/parsers/query.js +1 -1
  116. package/lib/module/utils/parsers/query.js.map +1 -1
  117. package/lib/module/utils/url.js +71 -0
  118. package/lib/module/utils/url.js.map +1 -0
  119. package/lib/typescript/components/proof-request/share-credential.d.ts +4 -5
  120. package/lib/typescript/ui-components/buttons/index.d.ts +3 -1
  121. package/lib/typescript/ui-components/buttons/share-button.d.ts +10 -0
  122. package/lib/typescript/ui-components/credential/card/credential-card.d.ts +1 -0
  123. package/lib/typescript/ui-components/header/header.d.ts +1 -1
  124. package/lib/typescript/ui-components/icons/icons.d.ts +5 -0
  125. package/lib/typescript/ui-components/index.d.ts +1 -0
  126. package/lib/typescript/ui-components/loader/loading-result.d.ts +2 -0
  127. package/lib/typescript/ui-components/nfc/index.d.ts +2 -0
  128. package/lib/typescript/ui-components/nfc/nfc-process.d.ts +17 -0
  129. package/lib/typescript/ui-components/screens/section-list-screen.d.ts +2 -1
  130. package/lib/typescript/ui-components/searchbar/animated-search-bar.d.ts +2 -2
  131. package/lib/typescript/utils/hooks/core/backup.d.ts +1 -1
  132. package/lib/typescript/utils/hooks/core/core-init.d.ts +2 -1
  133. package/lib/typescript/utils/hooks/core/credentials.d.ts +2 -6
  134. package/lib/typescript/utils/hooks/core/proofs.d.ts +9 -1
  135. package/lib/typescript/utils/hooks/index.d.ts +1 -0
  136. package/lib/typescript/utils/hooks/nfc/nfc-status.d.ts +6 -0
  137. package/lib/typescript/utils/index.d.ts +1 -0
  138. package/lib/typescript/utils/parsers/credential-sharing.d.ts +6 -6
  139. package/lib/typescript/utils/parsers/credential.d.ts +6 -3
  140. package/lib/typescript/utils/url.d.ts +19 -0
  141. package/package.json +7 -3
  142. package/src/components/credential/credential.tsx +4 -2
  143. package/src/components/history/history-list-item-icon.tsx +2 -0
  144. package/src/components/history/history-list-screen.tsx +9 -7
  145. package/src/components/proof-request/select-credential.tsx +4 -2
  146. package/src/components/proof-request/share-credential.tsx +10 -10
  147. package/src/ui-components/buttons/index.ts +4 -0
  148. package/src/ui-components/buttons/share-button.stories.tsx +25 -0
  149. package/src/ui-components/buttons/share-button.tsx +55 -0
  150. package/src/ui-components/credential/card/credential-card.stories.tsx +14 -2
  151. package/src/ui-components/credential/card/credential-card.tsx +16 -23
  152. package/src/ui-components/credential/card/credential-details-card.stories.tsx +14 -4
  153. package/src/ui-components/credential/card/credential-details-card.tsx +32 -34
  154. package/src/ui-components/credential/card/credential-details-list-item.tsx +10 -6
  155. package/src/ui-components/detail/detail.stories.tsx +3 -3
  156. package/src/ui-components/header/header.stories.tsx +8 -6
  157. package/src/ui-components/header/header.tsx +7 -5
  158. package/src/ui-components/history/history-details.tsx +3 -1
  159. package/src/ui-components/icons/icons.tsx +107 -0
  160. package/src/ui-components/index.ts +1 -0
  161. package/src/ui-components/loader/loading-result.stories.tsx +4 -1
  162. package/src/ui-components/loader/loading-result.tsx +7 -0
  163. package/src/ui-components/nfc/index.ts +3 -0
  164. package/src/ui-components/nfc/nfc-process.tsx +80 -0
  165. package/src/ui-components/screens/section-list-screen.tsx +21 -4
  166. package/src/ui-components/searchbar/animated-search-bar.tsx +11 -9
  167. package/src/utils/hooks/core/backup.ts +5 -2
  168. package/src/utils/hooks/core/core-init.ts +5 -1
  169. package/src/utils/hooks/core/credentials.ts +3 -3
  170. package/src/utils/hooks/core/proofs.ts +20 -5
  171. package/src/utils/hooks/index.ts +1 -0
  172. package/src/utils/hooks/nfc/nfc-status.ts +31 -0
  173. package/src/utils/index.ts +1 -0
  174. package/src/utils/parsers/credential-sharing.tsx +34 -11
  175. package/src/utils/parsers/credential.ts +8 -4
  176. package/src/utils/parsers/query.ts +1 -0
  177. package/src/utils/url.ts +61 -0
@@ -16,12 +16,14 @@ const Render = ({ onBack, withBackButton, withRightButton, ...args }: Args) => {
16
16
  <Header
17
17
  {...args}
18
18
  onBack={withBackButton ? onBack : undefined}
19
- rightButton={
20
- withRightButton ? (
21
- <TouchableOpacity>
22
- <Placeholder id="R" style={styles.rightButton} />
23
- </TouchableOpacity>
24
- ) : undefined
19
+ rightButtons={
20
+ withRightButton
21
+ ? [
22
+ <TouchableOpacity>
23
+ <Placeholder id="R" style={styles.rightButton} />
24
+ </TouchableOpacity>,
25
+ ]
26
+ : undefined
25
27
  }
26
28
  />
27
29
  );
@@ -8,7 +8,7 @@ import { useAppColorScheme } from '../theme';
8
8
 
9
9
  export interface HeaderProps extends ViewProps {
10
10
  onBack?: () => void;
11
- rightButton?: ReactNode;
11
+ rightButtons?: ReactNode[];
12
12
  style?: StyleProp<ViewStyle>;
13
13
  titleRowStyle?: StyleProp<ViewStyle>;
14
14
  title: ReactNode;
@@ -22,7 +22,7 @@ const backButtonHitSlop: Insets = { top: 12, bottom: 12, left: 20, right: 20 };
22
22
  * Following the design: https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=425-18624
23
23
  * states (Default + Dashboard)
24
24
  */
25
- const Header: FC<HeaderProps> = ({ onBack, rightButton, style, titleRowStyle, testID, title, ...viewProps }) => {
25
+ const Header: FC<HeaderProps> = ({ onBack, rightButtons, style, titleRowStyle, testID, title, ...viewProps }) => {
26
26
  const colorScheme = useAppColorScheme();
27
27
 
28
28
  return (
@@ -31,7 +31,7 @@ const Header: FC<HeaderProps> = ({ onBack, rightButton, style, titleRowStyle, te
31
31
  <View style={styles.backButtonRow}>
32
32
  <BackButton hitSlop={backButtonHitSlop} onPress={onBack} testID={concatTestID(testID, 'back')} />
33
33
  <View />
34
- {rightButton}
34
+ {rightButtons}
35
35
  </View>
36
36
  )}
37
37
 
@@ -39,7 +39,7 @@ const Header: FC<HeaderProps> = ({ onBack, rightButton, style, titleRowStyle, te
39
39
  style={[
40
40
  styles.titleRow,
41
41
  onBack ? styles.titleRow2nd : styles.titleRowNoBackButton,
42
- (onBack || !rightButton) && styles.titleRowNoRightButton,
42
+ (onBack || !rightButtons) && styles.titleRowNoRightButton,
43
43
  titleRowStyle,
44
44
  ]}>
45
45
  {typeof title === 'string' ? (
@@ -55,7 +55,7 @@ const Header: FC<HeaderProps> = ({ onBack, rightButton, style, titleRowStyle, te
55
55
  <View style={styles.title}>{title}</View>
56
56
  )}
57
57
 
58
- {!onBack && rightButton && <View style={styles.rightButtonWrapper}>{rightButton}</View>}
58
+ {!onBack && rightButtons && <View style={styles.rightButtonWrapper}>{rightButtons}</View>}
59
59
  </View>
60
60
  </View>
61
61
  );
@@ -75,6 +75,8 @@ const styles = StyleSheet.create({
75
75
  },
76
76
  rightButtonWrapper: {
77
77
  alignItems: 'center',
78
+ flexDirection: 'row',
79
+ gap: '16',
78
80
  height: 48,
79
81
  justifyContent: 'center',
80
82
  paddingHorizontal: 12,
@@ -1,5 +1,5 @@
1
1
  import React, { ComponentType, FC, ReactElement, useEffect, useMemo } from 'react';
2
- import { ColorValue, ImageSourcePropType, StyleSheet, View } from 'react-native';
2
+ import { ColorValue, Dimensions, ImageSourcePropType, StyleSheet, View } from 'react-native';
3
3
 
4
4
  import { CredentialDetails, CredentialDetailsProps, EntityDetails, EntityDetailsProps } from '../../components';
5
5
  import { HeaderInfoButton } from '../../components/navigation/header-buttons';
@@ -92,6 +92,7 @@ export const HistoryDetailsView: FC<HistoryDetailsViewProps> = ({
92
92
  }) => {
93
93
  const colorScheme = useAppColorScheme();
94
94
  const { expandedCredential, onHeaderPress, setInitialCredential } = useCredentialListExpandedCard();
95
+ const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);
95
96
 
96
97
  // Expand the first credential
97
98
  useEffect(() => {
@@ -199,6 +200,7 @@ export const HistoryDetailsView: FC<HistoryDetailsViewProps> = ({
199
200
  card: {
200
201
  ...props.credentialCard.card,
201
202
  onHeaderPress: props.credentialCard.headerPressable === false ? undefined : onHeaderPress,
203
+ width: cardWidth,
202
204
  },
203
205
  };
204
206
  return (
@@ -145,3 +145,110 @@ export const PlusIcon: FC<SvgProps> = ({ color, ...props }) => {
145
145
  </Svg>
146
146
  );
147
147
  };
148
+
149
+ // https://www.figma.com/design/S3WwgTMHuqxAsfu5zElCzq/App-Icon-Library--Design-?node-id=660-148&t=vEKCP9Mq209PFHFX-0
150
+ export const WalletUnitAttestationIcon: FC<SvgProps> = ({ color, ...props }) => {
151
+ const colorScheme = useAppColorScheme();
152
+ const iconColor = color ?? colorScheme.text;
153
+
154
+ return (
155
+ <Svg width={24} height={24} viewBox="0 0 24 24" fill="none" {...props}>
156
+ <Rect x={7.5} y={7.5} width={8} height={11} rx={1.5} stroke={iconColor} />
157
+ <Path
158
+ fillRule="evenodd"
159
+ clipRule="evenodd"
160
+ d="M12.176 4.882h5.295c.487 0 .882.395.882.883v8.823a.882.882 0 01-.882.883v.882c.974 0 1.764-.79 1.764-1.765V5.765c0-.975-.79-1.765-1.764-1.765h-5.295c-.974 0-1.764.79-1.764 1.765h.882c0-.488.395-.883.882-.883z"
161
+ fill={iconColor}
162
+ />
163
+ <Path d="M10 17h3" stroke={iconColor} />
164
+ </Svg>
165
+ );
166
+ };
167
+
168
+ // https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=426-27862
169
+ export const StatusErrorIcon: FC<SvgProps> = (props) => {
170
+ const colorScheme = useAppColorScheme();
171
+ return (
172
+ <Svg fill="none" height="22" viewBox="0 0 22 22" width="22" {...props}>
173
+ <Path
174
+ d="M10.5747 20C9.40153 20 8.29753 19.7759 7.2627 19.3276C6.22786 18.8849 5.31478 18.2679 4.52344 17.4766C3.73763 16.6852 3.12061 15.7721 2.67236 14.7373C2.22412 13.7025 2 12.5985 2 11.4253C2 10.2521 2.22412 9.14811 2.67236 8.11328C3.12061 7.07845 3.73763 6.16813 4.52344 5.38232C5.31478 4.59098 6.2251 3.97119 7.25439 3.52295C8.28923 3.07471 9.39323 2.85059 10.5664 2.85059C11.7451 2.85059 12.8519 3.07471 13.8867 3.52295C14.9215 3.97119 15.8346 4.59098 16.626 5.38232C17.4173 6.16813 18.0371 7.07845 18.4854 8.11328C18.9336 9.14811 19.1577 10.2521 19.1577 11.4253C19.1577 12.5985 18.9336 13.7025 18.4854 14.7373C18.0371 15.7721 17.4173 16.6852 16.626 17.4766C15.8346 18.2679 14.9215 18.8849 13.8867 19.3276C12.8519 19.7759 11.7479 20 10.5747 20Z"
175
+ fill={colorScheme.error}
176
+ />
177
+ <Path
178
+ d="M3.81385 18.1812L3.81633 18.1837C4.69776 19.0651 5.71679 19.7536 6.86722 20.2461C8.032 20.7503 9.27117 21 10.5747 21C11.8782 21 13.1174 20.7503 14.2821 20.2461C15.4326 19.7537 16.4516 19.0651 17.3331 18.1837C18.2142 17.3026 18.9051 16.2842 19.403 15.1348C19.9077 13.9694 20.1577 12.7296 20.1577 11.4253C20.1577 10.121 19.9077 8.88117 19.403 7.71581C18.905 6.56624 18.2138 5.55009 17.3318 4.67398C16.451 3.79349 15.4331 3.103 14.2842 2.60533C13.1182 2.10029 11.8755 1.85059 10.5664 1.85059C9.26213 1.85059 8.02228 2.10055 6.85692 2.60533L6.85513 2.60611C5.71136 3.10421 4.69653 3.79502 3.81633 4.67522C2.94015 5.5514 2.25228 6.56718 1.75475 7.71581C1.24997 8.88117 1 10.121 1 11.4253C1 12.7296 1.24997 13.9694 1.75475 15.1348C2.252 16.2828 2.93915 17.3003 3.81385 18.1812Z"
179
+ stroke={colorScheme.white}
180
+ strokeOpacity="0.2"
181
+ strokeWidth="2"
182
+ />
183
+ <Path
184
+ d="M8.43311 14.7124C8.27262 14.8618 8.07894 14.9365 7.85205 14.9365C7.63623 14.9365 7.45085 14.8618 7.2959 14.7124C7.14648 14.5575 7.07178 14.3721 7.07178 14.1562C7.07178 13.9404 7.14925 13.7578 7.3042 13.6084L9.4707 11.4336L7.3042 9.27539C7.14925 9.11491 7.07178 8.93229 7.07178 8.72754C7.07178 8.50065 7.14648 8.31527 7.2959 8.17139C7.45085 8.02197 7.63623 7.94727 7.85205 7.94727C8.06787 7.94727 8.25326 8.01921 8.4082 8.16309L10.583 10.3296L12.7661 8.16309C12.9211 8.00814 13.1064 7.93066 13.3223 7.93066C13.5381 7.93066 13.7207 8.00814 13.8701 8.16309C14.0251 8.3125 14.1025 8.49512 14.1025 8.71094C14.1025 8.92122 14.0251 9.10661 13.8701 9.26709L11.6953 11.4336L13.8618 13.6001C14.0168 13.744 14.0942 13.9294 14.0942 14.1562C14.0942 14.3721 14.0168 14.5575 13.8618 14.7124C13.7124 14.8618 13.527 14.9365 13.3057 14.9365C13.0788 14.9365 12.8906 14.8618 12.7412 14.7124L10.583 12.5459L8.43311 14.7124Z"
185
+ fill={colorScheme.white}
186
+ />
187
+ </Svg>
188
+ );
189
+ };
190
+
191
+ // https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=454-100241
192
+ export const StatusSuccessIcon: FC<SvgProps> = (props) => {
193
+ const colorScheme = useAppColorScheme();
194
+ return (
195
+ <Svg fill="none" height="22" viewBox="0 0 22 22" width="22" {...props}>
196
+ <Path
197
+ d="M10.5747 20C9.40153 20 8.29753 19.7759 7.2627 19.3276C6.22786 18.8849 5.31478 18.2679 4.52344 17.4766C3.73763 16.6852 3.12061 15.7721 2.67236 14.7373C2.22412 13.7025 2 12.5985 2 11.4253C2 10.2521 2.22412 9.14811 2.67236 8.11328C3.12061 7.07845 3.73763 6.16813 4.52344 5.38232C5.31478 4.59098 6.2251 3.97119 7.25439 3.52295C8.28923 3.07471 9.39323 2.85059 10.5664 2.85059C11.7451 2.85059 12.8519 3.07471 13.8867 3.52295C14.9215 3.97119 15.8346 4.59098 16.626 5.38232C17.4173 6.16813 18.0371 7.07845 18.4854 8.11328C18.9336 9.14811 19.1577 10.2521 19.1577 11.4253C19.1577 12.5985 18.9336 13.7025 18.4854 14.7373C18.0371 15.7721 17.4173 16.6852 16.626 17.4766C15.8346 18.2679 14.9215 18.8849 13.8867 19.3276C12.8519 19.7759 11.7479 20 10.5747 20Z"
198
+ fill={colorScheme.success}
199
+ />
200
+ <Path
201
+ d="M3.81385 18.1812L3.81633 18.1837C4.69776 19.0651 5.71679 19.7536 6.86722 20.2461C8.032 20.7503 9.27117 21 10.5747 21C11.8782 21 13.1174 20.7503 14.2821 20.2461C15.4326 19.7537 16.4516 19.0651 17.3331 18.1837C18.2142 17.3026 18.9051 16.2842 19.403 15.1348C19.9077 13.9694 20.1577 12.7296 20.1577 11.4253C20.1577 10.121 19.9077 8.88117 19.403 7.71581C18.905 6.56624 18.2138 5.55009 17.3318 4.67398C16.451 3.79349 15.4331 3.103 14.2842 2.60533C13.1182 2.10029 11.8755 1.85059 10.5664 1.85059C9.26213 1.85059 8.02228 2.10055 6.85692 2.60533L6.85513 2.60611C5.71136 3.10421 4.69653 3.79502 3.81633 4.67522C2.94015 5.5514 2.25228 6.56718 1.75475 7.71581C1.24997 8.88117 1 10.121 1 11.4253C1 12.7296 1.24997 13.9694 1.75475 15.1348C2.252 16.2828 2.93915 17.3003 3.81385 18.1812Z"
202
+ stroke="white"
203
+ strokeOpacity="0.2"
204
+ strokeWidth="2"
205
+ />
206
+ <Path
207
+ d="M9.91406 15.3828C10.0703 15.3828 10.2135 15.3464 10.3438 15.2734C10.4792 15.1953 10.5938 15.0885 10.6875 14.9531L14.3359 9.3125C14.3932 9.22396 14.4401 9.13021 14.4766 9.03125C14.5182 8.93229 14.5391 8.83333 14.5391 8.73438C14.5391 8.51562 14.4557 8.33854 14.2891 8.20312C14.1276 8.06771 13.9427 8 13.7344 8C13.4583 8 13.2266 8.14844 13.0391 8.44531L9.89062 13.4766L8.44531 11.6641C8.34115 11.5339 8.23698 11.4427 8.13281 11.3906C8.02865 11.3333 7.91146 11.3047 7.78125 11.3047C7.5625 11.3047 7.3776 11.3828 7.22656 11.5391C7.07552 11.6901 7 11.875 7 12.0938C7 12.1979 7.01823 12.2995 7.05469 12.3984C7.09635 12.4922 7.15365 12.5885 7.22656 12.6875L9.10938 14.9531C9.22396 15.099 9.34635 15.2083 9.47656 15.2812C9.60677 15.349 9.7526 15.3828 9.91406 15.3828Z"
208
+ fill="white"
209
+ />
210
+ </Svg>
211
+ );
212
+ };
213
+
214
+ // https://www.figma.com/design/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=415-5641&m=dev
215
+ export const StatusWarningIcon: FC<SvgProps> = ({ ...props }) => (
216
+ <Svg fill="none" height={20} viewBox="0 0 22 20" width={22} {...props}>
217
+ <Path
218
+ d="M4.357 17.967c-.481 0-.899-.105-1.253-.315a2.196 2.196 0 01-.822-.847A2.473 2.473 0 012 15.627c0-.421.11-.822.332-1.204L8.757 3.225c.216-.393.506-.689.871-.888a2.36 2.36 0 011.146-.299c.398 0 .777.1 1.137.299.36.194.653.49.88.888l6.425 11.198a2.384 2.384 0 01.332 1.204c0 .431-.097.824-.29 1.178a2.196 2.196 0 01-.822.847c-.35.21-.764.315-1.246.315H4.357z"
219
+ fill="#F7BF0B"
220
+ />
221
+ <Path
222
+ d="M1.4 17.274h-.001l.006.011c.281.515.683.927 1.188 1.227.534.316 1.134.455 1.764.455H17.19c.63 0 1.229-.138 1.759-.457.504-.3.905-.711 1.186-1.225.28-.512.413-1.071.413-1.659a3.345 3.345 0 00-.467-1.705L13.66 2.73v-.002a3.226 3.226 0 00-1.27-1.27 3.312 3.312 0 00-1.616-.42 3.36 3.36 0 00-1.624.42 3.172 3.172 0 00-1.265 1.276L1.467 13.92l-.001.002A3.364 3.364 0 001 15.627c0 .582.128 1.138.4 1.647z"
223
+ stroke="#fff"
224
+ strokeOpacity={0.2}
225
+ strokeWidth={2}
226
+ />
227
+ <Path
228
+ d="M11.538 11.51c-.011.514-.263.771-.756.771-.503 0-.763-.254-.78-.763l-.116-4.184a.766.766 0 01.232-.614c.166-.166.385-.25.656-.25.266 0 .484.084.656.25.171.16.252.368.24.622l-.132 4.167zM11.496 14.871c-.2.177-.437.266-.714.266-.277 0-.517-.089-.722-.266a.87.87 0 01-.299-.68c0-.272.1-.499.3-.681.198-.183.439-.274.721-.274.277 0 .515.091.714.274.2.182.299.41.299.68a.87.87 0 01-.299.681z"
229
+ fill="#000"
230
+ />
231
+ </Svg>
232
+ );
233
+
234
+ export const NFCIcon: FC<SvgProps> = ({ color, ...props }) => {
235
+ const colorScheme = useAppColorScheme();
236
+ const iconColor = color ?? colorScheme.black;
237
+
238
+ return (
239
+ <Svg fill="none" height={64} viewBox="0 0 65 64" width={65} {...props}>
240
+ <Path
241
+ d="M37.459 53.317c12.2-12.201 12.2-31.984 0-44.186A1.6 1.6 0 0139.72 6.87c13.451 13.45 13.451 35.26 0 48.71a1.601 1.601 0 01-2.262-2.262z"
242
+ fill={iconColor}
243
+ />
244
+ <Path
245
+ d="M31.653 47.508c8.994-8.994 8.994-23.576 0-32.57a1.6 1.6 0 012.262-2.263c10.245 10.244 10.244 26.852 0 37.096a1.6 1.6 0 11-2.262-2.263z"
246
+ fill={iconColor}
247
+ />
248
+ <Path
249
+ d="M25.847 41.705c5.788-5.789 5.788-15.174 0-20.962a1.6 1.6 0 012.262-2.263c7.038 7.038 7.038 18.45 0 25.487a1.6 1.6 0 01-2.262-2.262zM21.172 33.159a2.737 2.737 0 11-3.87-3.87 2.737 2.737 0 013.87 3.87z"
250
+ fill={iconColor}
251
+ />
252
+ </Svg>
253
+ );
254
+ };
@@ -16,6 +16,7 @@ export * from './input';
16
16
  export * from './list';
17
17
  export * from './loader';
18
18
  export * from './nerd-view';
19
+ export * from './nfc';
19
20
  export * from './pin';
20
21
  export * from './screens';
21
22
  export * from './searchbar';
@@ -13,13 +13,15 @@ type Args = {
13
13
  withButton2: boolean;
14
14
  withButton3: boolean;
15
15
  withHeader: boolean;
16
+ withShareButton: boolean;
16
17
  };
17
18
 
18
- const Render = ({ label, state, withButton1, withButton2, withButton3, withHeader }: Args) => {
19
+ const Render = ({ label, state, withButton1, withButton2, withButton3, withHeader, withShareButton }: Args) => {
19
20
  return (
20
21
  <LoadingResultScreen
21
22
  button={withButton1 ? { title: 'Button 1' } : undefined}
22
23
  secondaryButton={withButton2 ? { type: ButtonType.Secondary, title: 'Button 2' } : undefined}
24
+ shareButton={withShareButton ? { title: 'qr-code-date.com' } : undefined}
23
25
  tertiaryButton={withButton3 ? { type: ButtonType.Secondary, title: 'Button 3' } : undefined}
24
26
  header={
25
27
  withHeader
@@ -46,6 +48,7 @@ const Basic: StoryObj<Args> = {
46
48
  withButton2: false,
47
49
  withButton3: false,
48
50
  withHeader: true,
51
+ withShareButton: false,
49
52
  },
50
53
  render: Render,
51
54
  };
@@ -7,6 +7,7 @@ import NavigationHeader, { NavigationHeaderProps } from '../header/navigation-he
7
7
  import Typography from '../text/typography';
8
8
  import { useAppColorScheme } from '../theme/color-scheme-context';
9
9
  import LoaderView, { LoaderViewProps } from './loader';
10
+ import ShareButton, { ShareButtonProps } from '../buttons/share-button';
10
11
 
11
12
  export type LoadingResultScreenProps = ViewProps & {
12
13
  button?: ButtonProps;
@@ -15,6 +16,7 @@ export type LoadingResultScreenProps = ViewProps & {
15
16
  label?: string;
16
17
  };
17
18
  secondaryButton?: ButtonProps;
19
+ shareButton?: ShareButtonProps;
18
20
  tertiaryButton?: ButtonProps;
19
21
  };
20
22
 
@@ -23,6 +25,7 @@ const LoadingResultScreen: FC<LoadingResultScreenProps> = ({
23
25
  header,
24
26
  loader: { label, ...loaderProps },
25
27
  secondaryButton: button2,
28
+ shareButton,
26
29
  style,
27
30
  tertiaryButton: button3,
28
31
  ...viewProps
@@ -55,6 +58,7 @@ const LoadingResultScreen: FC<LoadingResultScreenProps> = ({
55
58
  </Typography>
56
59
  </View>
57
60
  <View style={[styles.buttonWrapper, buttonsWrapperMarginStyle]}>
61
+ {shareButton && <ShareButton {...shareButton} style={styles.shareButton} />}
58
62
  {button && <Button {...button}>{button.title}</Button>}
59
63
  {button2 && <Button {...button2}>{button2.title}</Button>}
60
64
  {button3 && <Button {...button3}>{button3.title}</Button>}
@@ -92,6 +96,9 @@ const styles = StyleSheet.create({
92
96
  modalHeaderWithoutHandle: {
93
97
  paddingTop: 15,
94
98
  },
99
+ shareButton: {
100
+ alignSelf: 'center',
101
+ },
95
102
  });
96
103
 
97
104
  export default LoadingResultScreen;
@@ -0,0 +1,3 @@
1
+ import NFCProcess from './nfc-process';
2
+
3
+ export { NFCProcess };
@@ -0,0 +1,80 @@
1
+ import React, { FC, memo } from 'react';
2
+ import { Platform, StyleSheet, View } from 'react-native';
3
+
4
+ import { HeaderCloseButton } from '../../components';
5
+ import { useAppColorScheme } from '../../ui-components';
6
+ import { concatTestID } from '../../utils';
7
+ import { Typography } from '..';
8
+ import { Button, ButtonType } from '../buttons';
9
+ import { NFCIcon, StatusWarningIcon } from '../icons';
10
+ import { LoaderViewState } from '../loader';
11
+ import { ScrollViewScreen } from '../screens';
12
+
13
+ interface NFCProcessProps {
14
+ testID: string;
15
+ processState: LoaderViewState;
16
+ handleButtonClick: () => void;
17
+ labels: {
18
+ share: string;
19
+ connectivity: string;
20
+ close: string;
21
+ tryAgain: string;
22
+ conectivityInfo: string;
23
+ shareInfo: string;
24
+ };
25
+ }
26
+
27
+ const NFCProcess: FC<NFCProcessProps> = ({ testID, processState, labels, handleButtonClick }) => {
28
+ const colorScheme = useAppColorScheme();
29
+
30
+ return (
31
+ <ScrollViewScreen
32
+ header={{
33
+ leftItem: <HeaderCloseButton testID={concatTestID(testID, 'header.back')} />,
34
+ modalHandleVisible: Platform.OS === 'ios',
35
+ static: true,
36
+ testID: concatTestID(testID, 'header'),
37
+ title: processState === LoaderViewState.InProgress ? labels.share : labels.connectivity,
38
+ }}
39
+ scrollView={{
40
+ testID: concatTestID(testID, 'scroll'),
41
+ }}
42
+ testID={testID}>
43
+ <View style={styles.content} testID={concatTestID(testID, 'content')}>
44
+ <View style={styles.info}>
45
+ {processState === LoaderViewState.InProgress ? <NFCIcon width={50} height={50} /> : <StatusWarningIcon />}
46
+ <Typography align="center" color={colorScheme.black}>
47
+ {processState === LoaderViewState.InProgress ? labels.shareInfo : labels.conectivityInfo}
48
+ </Typography>
49
+ </View>
50
+ </View>
51
+ <View style={styles.bottom}>
52
+ <Button
53
+ onPress={handleButtonClick}
54
+ testID={concatTestID(testID, 'button')}
55
+ title={processState === LoaderViewState.InProgress ? labels.close : labels.tryAgain}
56
+ type={processState === LoaderViewState.InProgress ? ButtonType.Secondary : ButtonType.Primary}
57
+ />
58
+ </View>
59
+ </ScrollViewScreen>
60
+ );
61
+ };
62
+
63
+ const styles = StyleSheet.create({
64
+ bottom: {
65
+ paddingHorizontal: 12,
66
+ paddingTop: 16,
67
+ },
68
+ content: {
69
+ flex: 1,
70
+ paddingHorizontal: 16,
71
+ },
72
+ info: {
73
+ alignItems: 'center',
74
+ flex: 1,
75
+ gap: 20,
76
+ justifyContent: 'center',
77
+ },
78
+ });
79
+
80
+ export default memo(NFCProcess);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SectionList, SectionListProps, StyleSheet, View, ViewProps } from 'react-native';
2
+ import { Platform, SectionList, SectionListProps, StyleSheet, View, ViewProps, ViewStyle } from 'react-native';
3
3
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
4
 
5
5
  import { useOnScrollHeaderState } from '../../utils/hooks/header/on-scroll-header-state';
@@ -14,19 +14,33 @@ export type SectionListScreenProps<ItemT, SectionT> = ViewProps & {
14
14
  title: string;
15
15
  };
16
16
  list: Omit<SectionListProps<ItemT, SectionT>, 'ListHeaderComponent' | 'onScroll'>;
17
+ modalPresentation?: boolean;
17
18
  };
18
19
 
19
20
  const SectionListScreen = <ItemT, SectionT>({
20
21
  header,
21
22
  list: { contentContainerStyle, stickySectionHeadersEnabled, ...listProps },
23
+ modalPresentation,
22
24
  style,
23
25
  ...viewProps
24
26
  }: SectionListScreenProps<ItemT, SectionT>) => {
25
27
  const colorScheme = useAppColorScheme();
26
- const safeAreaInsets = useSafeAreaInsets();
27
- const contentInsetsStyle = useListContentInset();
28
+ const { top } = useSafeAreaInsets();
29
+ const contentInsetsStyle = useListContentInset({
30
+ headerHeight: modalPresentation && Platform.OS === 'ios' ? 63 : 48,
31
+ modalPresentation,
32
+ });
28
33
  const { titleVisible, onScroll } = useOnScrollHeaderState();
29
34
 
35
+ let headerPaddingStyle: ViewStyle | undefined;
36
+ if (!modalPresentation || Platform.OS === 'android') {
37
+ headerPaddingStyle = {
38
+ paddingTop: top,
39
+ };
40
+ } else if (modalPresentation && !header.modalHandleVisible && Platform.OS === 'ios') {
41
+ headerPaddingStyle = styles.modalHeaderWithoutHandle;
42
+ }
43
+
30
44
  return (
31
45
  <View style={[styles.container, { backgroundColor: colorScheme.background }, style]} {...viewProps}>
32
46
  <SectionList<ItemT, SectionT>
@@ -40,7 +54,7 @@ const SectionListScreen = <ItemT, SectionT>({
40
54
  <NavigationHeader
41
55
  animate
42
56
  blurred
43
- style={[styles.header, { paddingTop: safeAreaInsets.top }]}
57
+ style={[styles.header, headerPaddingStyle]}
44
58
  titleVisible={header.static || titleVisible}
45
59
  {...header}
46
60
  />
@@ -56,6 +70,9 @@ const styles = StyleSheet.create({
56
70
  position: 'absolute',
57
71
  width: '100%',
58
72
  },
73
+ modalHeaderWithoutHandle: {
74
+ paddingTop: 15,
75
+ },
59
76
  });
60
77
 
61
78
  export default SectionListScreen;
@@ -5,7 +5,7 @@ import SearchBar, { SearchBarProps } from './search-bar';
5
5
 
6
6
  export type AnimatedSearchBarProps = {
7
7
  collapsed: boolean;
8
- rightButton?: ReactNode;
8
+ rightButtons?: ReactNode[];
9
9
  rightButtonAlwaysVisible?: boolean;
10
10
  searchBarProps: SearchBarProps;
11
11
  };
@@ -17,10 +17,10 @@ const AnimatedSearchBar = ({
17
17
  collapsed,
18
18
  rightButtonAlwaysVisible = false,
19
19
  searchBarProps,
20
- rightButton,
20
+ rightButtons = [],
21
21
  }: AnimatedSearchBarProps) => {
22
22
  const [rightIconFadeAnimation] = useState(
23
- () => new Animated.Value(rightButton && rightButtonAlwaysVisible ? 1.5 : 0),
23
+ () => new Animated.Value(rightButtons && rightButtonAlwaysVisible ? 1.5 : 0),
24
24
  );
25
25
  const [searchPaddingAnimation] = useState(() => new Animated.Value(0));
26
26
 
@@ -39,10 +39,10 @@ const AnimatedSearchBar = ({
39
39
 
40
40
  Animated.timing(rightIconFadeAnimation, {
41
41
  duration: 250,
42
- toValue: collapsed && rightButton ? 1.5 : 0,
42
+ toValue: collapsed && rightButtons ? 1.5 : 0,
43
43
  useNativeDriver: false,
44
44
  }).start();
45
- }, [rightButtonAlwaysVisible, rightIconFadeAnimation, rightButton, collapsed]);
45
+ }, [rightButtonAlwaysVisible, rightIconFadeAnimation, rightButtons, collapsed]);
46
46
 
47
47
  const searchBarContainerAnimatedStyle = {
48
48
  paddingHorizontal: searchPaddingAnimation.interpolate({
@@ -64,7 +64,7 @@ const AnimatedSearchBar = ({
64
64
  width: rightIconFadeAnimation.interpolate({
65
65
  extrapolate: 'clamp',
66
66
  inputRange: [0, 1],
67
- outputRange: ['100%', '88%'],
67
+ outputRange: ['100%', `${100 - 12 * rightButtons.length}%`],
68
68
  }),
69
69
  };
70
70
 
@@ -74,8 +74,8 @@ const AnimatedSearchBar = ({
74
74
  <Animated.View style={searchBarAnimatedStyle}>
75
75
  <SearchBar {...searchProps} />
76
76
  </Animated.View>
77
- {rightButton && (
78
- <Animated.View style={[styles.rightButtonWrapper, optionsIconAnimatedStyle]}>{rightButton}</Animated.View>
77
+ {rightButtons && (
78
+ <Animated.View style={[styles.rightButtonWrapper, optionsIconAnimatedStyle]}>{rightButtons}</Animated.View>
79
79
  )}
80
80
  </Animated.View>
81
81
  );
@@ -83,7 +83,9 @@ const AnimatedSearchBar = ({
83
83
 
84
84
  const styles = StyleSheet.create({
85
85
  rightButtonWrapper: {
86
- alignItems: 'flex-end',
86
+ alignItems: 'center',
87
+ flexDirection: 'row',
88
+ gap: '16',
87
89
  justifyContent: 'center',
88
90
  },
89
91
  searchBarContainer: {
@@ -70,7 +70,10 @@ export const useRollbackImport = () => {
70
70
  * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be restored/created
71
71
  * @returns [hwIdentifierId, swIdentifierId]
72
72
  */
73
- export const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {
73
+ export const useBackupFinalizeImportProcedure = ({
74
+ generateHwKey,
75
+ generateSwKey,
76
+ }: IdentifiersInitializationConfig) => {
74
77
  const { mutateAsync: finalizeImport } = useFinalizeImport();
75
78
  const { core, organisationId } = useONECore();
76
79
 
@@ -98,5 +101,5 @@ export const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey
98
101
  reportException(err, 'Failed to create base identifiers');
99
102
  throw err;
100
103
  });
101
- }, [core, organisationId, finalizeImport, generateHwKey, generateSwKey]);
104
+ }, [finalizeImport, generateSwKey, generateHwKey, core, organisationId]);
102
105
  };
@@ -7,6 +7,7 @@ import { OneErrorCode } from './error-code';
7
7
 
8
8
  export const SW_DID_NAME_PREFIX = 'holder-did-sw-key';
9
9
  export const HW_DID_NAME_PREFIX = 'holder-did-hw-key';
10
+ export const ATTESTATION_DID_NAME_PREFIX = 'holder-did-attestation-key';
10
11
 
11
12
  export const generateHwIdentifier = async (core: ONECore, organisationId: string) => {
12
13
  const hwKeyId = await core
@@ -86,7 +87,10 @@ export interface IdentifiersInitializationConfig {
86
87
  * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created
87
88
  * @returns [hwIdentifierId, swIdentifierId]
88
89
  */
89
- export const useInitializeONECoreIdentifiers = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {
90
+ export const useInitializeONECoreIdentifiers = ({
91
+ generateHwKey,
92
+ generateSwKey,
93
+ }: IdentifiersInitializationConfig) => {
90
94
  const { core, organisationId } = useONECore();
91
95
 
92
96
  return useCallback(async () => {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  CredentialListQuery,
3
3
  CredentialStateEnum,
4
+ HandleInvitationRequest,
4
5
  InitiateIssuanceRequest,
5
6
  InvitationResult,
6
7
  OneError,
@@ -8,7 +9,6 @@ import {
8
9
  import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-query';
9
10
 
10
11
  import { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';
11
- import { Transport } from '../connectivity/connectivity';
12
12
  import { useONECore } from './core-context';
13
13
  import { CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';
14
14
  import { OneErrorCode } from './error-code';
@@ -83,8 +83,8 @@ export const useInvitationHandler = () => {
83
83
  const { core, organisationId } = useONECore();
84
84
 
85
85
  return useMutation(
86
- async ({ invitationUrl, transport }: { invitationUrl: string; transport: Transport }) =>
87
- core.handleInvitation(invitationUrl, organisationId, [transport]),
86
+ async (request: Omit<HandleInvitationRequest, 'organisationId'>) =>
87
+ core.handleInvitation({ organisationId, ...request }),
88
88
  {
89
89
  onSuccess: async (result: InvitationResult) => {
90
90
  if ('credentialIds' in result) {
@@ -13,6 +13,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
13
13
  import { useMutation, useQuery, useQueryClient } from 'react-query';
14
14
 
15
15
  import { getQueryKeyFromProofListQueryParams } from '../../parsers/query';
16
+ import { reportException } from '../../reporting';
16
17
  import { Transport } from '../connectivity/connectivity';
17
18
  import { useCoreConfig } from './core-config';
18
19
  import { useONECore } from './core-context';
@@ -85,7 +86,8 @@ export const useProofAccept = () => {
85
86
  keyId?: string;
86
87
  }) => core.holderSubmitProof(interactionId, credentials, didId, identifierId, keyId),
87
88
  {
88
- onError: async () => {
89
+ onError: async (err) => {
90
+ reportException(err, 'Proof submission failure');
89
91
  await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
90
92
  },
91
93
  onSuccess: async () => {
@@ -129,15 +131,28 @@ export enum VerificationProtocol {
129
131
  SCAN_TO_VERIFY = 'SCAN_TO_VERIFY',
130
132
  }
131
133
 
134
+ export enum VerificationEngagement {
135
+ QR_CODE = 'QR_CODE',
136
+ NFC = 'NFC',
137
+ }
138
+
139
+ export interface ProposeProofRequest {
140
+ exchange: VerificationProtocol;
141
+ engagement: VerificationEngagement[];
142
+ }
143
+
132
144
  export const useProposeProof = () => {
133
145
  const queryClient = useQueryClient();
134
146
  const { core, organisationId } = useONECore();
135
147
 
136
- return useMutation(async (exchange: VerificationProtocol) => core.proposeProof(exchange, organisationId), {
137
- onSuccess: async () => {
138
- await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
148
+ return useMutation(
149
+ async ({ exchange, engagement }: ProposeProofRequest) => core.proposeProof(exchange, organisationId, engagement),
150
+ {
151
+ onSuccess: async () => {
152
+ await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
153
+ },
139
154
  },
140
- });
155
+ );
141
156
  };
142
157
 
143
158
  export const useProofDelete = () => {
@@ -4,5 +4,6 @@ export * from './credential-card/credential-card-expanding';
4
4
  export * from './header/on-scroll-header-state';
5
5
  export * from './list/list-content-inset';
6
6
  export * from './navigation';
7
+ export * from './nfc/nfc-status';
7
8
  export * from './pin-security/pin-security';
8
9
  export * from './revocation/credential-status';
@@ -0,0 +1,31 @@
1
+ import { useCallback, useEffect, useState } from 'react';
2
+ import NfcManager from 'react-native-nfc-manager';
3
+
4
+ export const useNFCStatus = () => {
5
+ const [isNFCEnabled, setIsNFCEnabled] = useState<boolean>();
6
+ const [isLoading, setIsLoading] = useState<boolean>();
7
+ const [error, setError] = useState<unknown>();
8
+
9
+ const checkNFCStatus = useCallback(async () => {
10
+ try {
11
+ setIsLoading(true);
12
+ const isEnabled = await NfcManager.isEnabled();
13
+ setIsNFCEnabled(isEnabled);
14
+ setIsLoading(false);
15
+ } catch (e) {
16
+ setError(e);
17
+ }
18
+ }, []);
19
+
20
+ useEffect(() => {
21
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
22
+ checkNFCStatus();
23
+ }, [checkNFCStatus]);
24
+
25
+ const recheck = useCallback(() => {
26
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
27
+ checkNFCStatus();
28
+ }, [checkNFCStatus]);
29
+
30
+ return { error, isLoading, isNFCEnabled, recheck };
31
+ };