react-native-unit-components 1.0.1 → 1.0.3

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 (218) hide show
  1. package/README.md +75 -6
  2. package/android/src/main/AndroidManifest.xml +12 -1
  3. package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsPackage.kt +2 -1
  4. package/android/src/main/java/com/unitreactnativecomponents/sharepdf/UNSharePDF.kt +75 -0
  5. package/android/src/main/res/layout/un_black_add_to_googlepay_button.xml +2 -2
  6. package/android/src/main/res/layout/un_view_google_push_provisioning.xml +1 -13
  7. package/android/src/main/res/layout/un_white_add_to_googlepay_button.xml +1 -1
  8. package/android/src/main/res/layout/un_white_add_to_googlepay_button_no_shadow.xml +1 -1
  9. package/android/src/main/res/xml/file_paths.xml +4 -0
  10. package/ios/UnitReactNativeComponentsViewManager.m +0 -1
  11. package/ios/UnitReactNativeComponentsViewManager.swift +6 -2
  12. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +103 -0
  13. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -0
  14. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js +47 -0
  15. package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -0
  16. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +63 -8
  17. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  18. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +18 -3
  19. package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  20. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js +56 -13
  21. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
  22. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +4 -3
  23. package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -1
  24. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +3 -3
  25. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -1
  26. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +114 -46
  27. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  28. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +4 -8
  29. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  30. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js +95 -0
  31. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js.map +1 -0
  32. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.styles.js +31 -0
  33. package/lib/commonjs/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.styles.js.map +1 -0
  34. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +65 -7
  35. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
  36. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js +56 -10
  37. package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
  38. package/lib/commonjs/components/UNCardComponent/networking/common/UNNetworkConstants.js +20 -0
  39. package/lib/commonjs/components/UNCardComponent/networking/common/UNNetworkConstants.js.map +1 -0
  40. package/lib/commonjs/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.js +44 -0
  41. package/lib/commonjs/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.js.map +1 -0
  42. package/lib/commonjs/components/index.js +13 -0
  43. package/lib/commonjs/components/index.js.map +1 -1
  44. package/lib/commonjs/helpers/BottomSheet/BottomSheet.js +32 -12
  45. package/lib/commonjs/helpers/BottomSheet/BottomSheet.js.map +1 -1
  46. package/lib/commonjs/helpers/BottomSheet/BottomSheet.styles.js +1 -1
  47. package/lib/commonjs/helpers/BottomSheet/BottomSheet.styles.js.map +1 -1
  48. package/lib/commonjs/helpers/EventBus.js.map +1 -1
  49. package/lib/commonjs/messages/nativeMessages/cardMessage.js +36 -0
  50. package/lib/commonjs/messages/nativeMessages/cardMessage.js.map +1 -0
  51. package/lib/commonjs/messages/nativeMessages/index.js +0 -7
  52. package/lib/commonjs/messages/nativeMessages/index.js.map +1 -1
  53. package/lib/commonjs/messages/nativeMessages/sdkMessage.js +14 -0
  54. package/lib/commonjs/messages/nativeMessages/sdkMessage.js.map +1 -0
  55. package/lib/commonjs/messages/webMessages/unitMessages.js +1 -0
  56. package/lib/commonjs/messages/webMessages/unitMessages.js.map +1 -1
  57. package/lib/commonjs/nativeComponent/{UNNativeAddToWalletButton.js → UnitAddToWalletButton.js} +1 -1
  58. package/lib/commonjs/nativeComponent/UnitAddToWalletButton.js.map +1 -0
  59. package/lib/commonjs/scripts/html/bodyHtml.js +1 -1
  60. package/lib/commonjs/scripts/html/bodyHtml.js.map +1 -1
  61. package/lib/commonjs/scripts/html/bodyScript.js +22 -5
  62. package/lib/commonjs/scripts/html/bodyScript.js.map +1 -1
  63. package/lib/commonjs/sharedTypes/bookPayment.types.js.map +1 -1
  64. package/lib/commonjs/sharedTypes/card.types.js.map +1 -1
  65. package/lib/commonjs/sharedTypes/index.js +13 -0
  66. package/lib/commonjs/sharedTypes/index.js.map +1 -1
  67. package/lib/commonjs/sharedTypes/onLoadResponse.types.js +6 -0
  68. package/lib/commonjs/sharedTypes/onLoadResponse.types.js.map +1 -0
  69. package/lib/commonjs/sharedTypes/wallet.types.js +22 -0
  70. package/lib/commonjs/sharedTypes/wallet.types.js.map +1 -0
  71. package/lib/commonjs/unitSdkManager/UnitSdk.api.js +5 -3
  72. package/lib/commonjs/unitSdkManager/UnitSdk.api.js.map +1 -1
  73. package/lib/commonjs/unitSdkManager/UnitSdkManager.js +18 -0
  74. package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -1
  75. package/lib/commonjs/webComponent/WebComponent.js +35 -10
  76. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  77. package/lib/commonjs/webComponent/WebComponent.utils.js +41 -0
  78. package/lib/commonjs/webComponent/WebComponent.utils.js.map +1 -0
  79. package/lib/commonjs/webComponent/html.js +9 -1
  80. package/lib/commonjs/webComponent/html.js.map +1 -1
  81. package/lib/module/components/UNAccountComponent/UNAccountComponent.js +74 -0
  82. package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -0
  83. package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js +26 -0
  84. package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -0
  85. package/lib/module/components/UNActivityComponent/UNActivityComponent.js +56 -8
  86. package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
  87. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +10 -2
  88. package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
  89. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js +50 -12
  90. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
  91. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +3 -2
  92. package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -1
  93. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +1 -1
  94. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -1
  95. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +111 -46
  96. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  97. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +5 -9
  98. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  99. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js +68 -0
  100. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.js.map +1 -0
  101. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.styles.js +21 -0
  102. package/lib/module/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.styles.js.map +1 -0
  103. package/lib/module/components/UNCardComponent/UNCardComponent.js +65 -9
  104. package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
  105. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js +48 -9
  106. package/lib/module/components/UNCardComponent/UNCardComponent.utils.js.map +1 -1
  107. package/lib/module/components/UNCardComponent/networking/common/UNNetworkConstants.js +10 -0
  108. package/lib/module/components/UNCardComponent/networking/common/UNNetworkConstants.js.map +1 -0
  109. package/lib/module/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.js +29 -0
  110. package/lib/module/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.js.map +1 -0
  111. package/lib/module/components/index.js +1 -0
  112. package/lib/module/components/index.js.map +1 -1
  113. package/lib/module/helpers/BottomSheet/BottomSheet.js +30 -13
  114. package/lib/module/helpers/BottomSheet/BottomSheet.js.map +1 -1
  115. package/lib/module/helpers/BottomSheet/BottomSheet.styles.js +2 -2
  116. package/lib/module/helpers/BottomSheet/BottomSheet.styles.js.map +1 -1
  117. package/lib/module/helpers/EventBus.js.map +1 -1
  118. package/lib/module/messages/nativeMessages/cardMessage.js +27 -0
  119. package/lib/module/messages/nativeMessages/cardMessage.js.map +1 -0
  120. package/lib/module/messages/nativeMessages/index.js +1 -5
  121. package/lib/module/messages/nativeMessages/index.js.map +1 -1
  122. package/lib/module/messages/nativeMessages/sdkMessage.js +7 -0
  123. package/lib/module/messages/nativeMessages/sdkMessage.js.map +1 -0
  124. package/lib/module/messages/webMessages/unitMessages.js +1 -0
  125. package/lib/module/messages/webMessages/unitMessages.js.map +1 -1
  126. package/lib/module/nativeComponent/{UNNativeAddToWalletButton.js → UnitAddToWalletButton.js} +1 -1
  127. package/lib/module/nativeComponent/UnitAddToWalletButton.js.map +1 -0
  128. package/lib/module/scripts/html/bodyHtml.js +1 -1
  129. package/lib/module/scripts/html/bodyHtml.js.map +1 -1
  130. package/lib/module/scripts/html/bodyScript.js +19 -3
  131. package/lib/module/scripts/html/bodyScript.js.map +1 -1
  132. package/lib/module/sharedTypes/bookPayment.types.js.map +1 -1
  133. package/lib/module/sharedTypes/card.types.js.map +1 -1
  134. package/lib/module/sharedTypes/index.js +1 -0
  135. package/lib/module/sharedTypes/index.js.map +1 -1
  136. package/lib/module/sharedTypes/onLoadResponse.types.js +2 -0
  137. package/lib/module/sharedTypes/onLoadResponse.types.js.map +1 -0
  138. package/lib/module/sharedTypes/wallet.types.js +14 -0
  139. package/lib/module/sharedTypes/wallet.types.js.map +1 -0
  140. package/lib/module/unitSdkManager/UnitSdk.api.js +4 -3
  141. package/lib/module/unitSdkManager/UnitSdk.api.js.map +1 -1
  142. package/lib/module/unitSdkManager/UnitSdkManager.js +13 -0
  143. package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -1
  144. package/lib/module/webComponent/WebComponent.js +32 -10
  145. package/lib/module/webComponent/WebComponent.js.map +1 -1
  146. package/lib/module/webComponent/WebComponent.utils.js +27 -0
  147. package/lib/module/webComponent/WebComponent.utils.js.map +1 -0
  148. package/lib/module/webComponent/html.js +9 -2
  149. package/lib/module/webComponent/html.js.map +1 -1
  150. package/lib/typescript/components/UNAccountComponent/UNAccountComponent.d.ts +12 -0
  151. package/lib/typescript/components/UNAccountComponent/UNAccountComponent.utils.d.ts +7 -0
  152. package/lib/typescript/components/UNActivityComponent/UNActivityComponent.d.ts +2 -0
  153. package/lib/typescript/components/UNActivityComponent/UNActivityComponent.utils.d.ts +4 -0
  154. package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +2 -1
  155. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts +1 -1
  156. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.d.ts +9 -2
  157. package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +2 -1
  158. package/lib/typescript/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.d.ts +6 -0
  159. package/lib/typescript/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.styles.d.ts +17 -0
  160. package/lib/typescript/components/UNCardComponent/UNCardComponent.d.ts +4 -1
  161. package/lib/typescript/components/UNCardComponent/UNCardComponent.utils.d.ts +9 -1
  162. package/lib/typescript/components/UNCardComponent/networking/common/UNNetworkConstants.d.ts +8 -0
  163. package/lib/typescript/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.d.ts +1 -0
  164. package/lib/typescript/components/index.d.ts +1 -0
  165. package/lib/typescript/helpers/EventBus.d.ts +3 -3
  166. package/lib/typescript/messages/nativeMessages/cardMessage.d.ts +28 -0
  167. package/lib/typescript/messages/nativeMessages/index.d.ts +7 -2
  168. package/lib/typescript/messages/nativeMessages/sdkMessage.d.ts +8 -0
  169. package/lib/typescript/messages/webMessages/unitMessages.d.ts +16 -6
  170. package/lib/typescript/scripts/html/bodyScript.d.ts +4 -1
  171. package/lib/typescript/sharedTypes/bookPayment.types.d.ts +3 -3
  172. package/lib/typescript/sharedTypes/card.types.d.ts +6 -6
  173. package/lib/typescript/sharedTypes/index.d.ts +1 -0
  174. package/lib/typescript/sharedTypes/onLoadResponse.types.d.ts +18 -0
  175. package/lib/typescript/sharedTypes/wallet.types.d.ts +14 -0
  176. package/lib/typescript/unitSdkManager/UnitSdkManager.d.ts +3 -0
  177. package/lib/typescript/webComponent/WebComponent.d.ts +4 -1
  178. package/lib/typescript/webComponent/WebComponent.utils.d.ts +2 -0
  179. package/package.json +2 -1
  180. package/src/components/UNAccountComponent/UNAccountComponent.tsx +82 -0
  181. package/src/components/UNAccountComponent/UNAccountComponent.utils.ts +30 -0
  182. package/src/components/UNActivityComponent/UNActivityComponent.tsx +57 -8
  183. package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +14 -2
  184. package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +47 -13
  185. package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.ts +3 -2
  186. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.ts +1 -1
  187. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +120 -44
  188. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +7 -10
  189. package/src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.styles.ts +21 -0
  190. package/src/components/UNBottomSheetComponent/components/UNAddToWalletBottomSheetItem.tsx +74 -0
  191. package/src/components/UNCardComponent/UNCardComponent.tsx +68 -13
  192. package/src/components/UNCardComponent/UNCardComponent.utils.ts +47 -9
  193. package/src/components/UNCardComponent/networking/common/UNNetworkConstants.ts +11 -0
  194. package/src/components/UNCardComponent/networking/requests/UNWalletPayloadRequest.ts +34 -0
  195. package/src/components/index.ts +1 -0
  196. package/src/helpers/BottomSheet/BottomSheet.styles.ts +2 -2
  197. package/src/helpers/BottomSheet/BottomSheet.tsx +28 -12
  198. package/src/helpers/EventBus.ts +3 -3
  199. package/src/messages/nativeMessages/cardMessage.ts +37 -0
  200. package/src/messages/nativeMessages/index.ts +14 -2
  201. package/src/messages/nativeMessages/sdkMessage.ts +11 -0
  202. package/src/messages/webMessages/unitMessages.ts +20 -7
  203. package/src/scripts/html/bodyHtml.ts +1 -1
  204. package/src/scripts/html/bodyScript.ts +21 -4
  205. package/src/sharedTypes/bookPayment.types.ts +3 -3
  206. package/src/sharedTypes/card.types.ts +6 -6
  207. package/src/sharedTypes/index.ts +1 -0
  208. package/src/sharedTypes/onLoadResponse.types.ts +27 -0
  209. package/src/sharedTypes/wallet.types.ts +17 -0
  210. package/src/unitSdkManager/UnitSdk.api.ts +3 -2
  211. package/src/unitSdkManager/UnitSdkManager.ts +12 -0
  212. package/src/webComponent/WebComponent.tsx +35 -12
  213. package/src/webComponent/WebComponent.utils.ts +26 -0
  214. package/src/webComponent/html.ts +9 -2
  215. package/lib/commonjs/nativeComponent/UNNativeAddToWalletButton.js.map +0 -1
  216. package/lib/module/nativeComponent/UNNativeAddToWalletButton.js.map +0 -1
  217. /package/lib/typescript/nativeComponent/{UNNativeAddToWalletButton.d.ts → UnitAddToWalletButton.d.ts} +0 -0
  218. /package/src/nativeComponent/{UNNativeAddToWalletButton.tsx → UnitAddToWalletButton.tsx} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["getActivityParams","props","accountId","customerToken","theme","UnitSDK","getTheme"],"sources":["UNActivityComponent.utils.ts"],"sourcesContent":["import { UnitSDK } from '../../unitSdkManager/UnitSdkManager';\nimport type { UNActivityComponentProps } from './UNActivityComponent';\n\nexport const getActivityParams = (props: UNActivityComponentProps) => {\n return `\n account-id=\"${props.accountId}\"\n customer-token=\"${props.customerToken}\"\n theme=\"${props.theme ?? UnitSDK.getTheme()}\"\n style=\"height: 100%\"\n `;\n};\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,iBAAiB,GAAIC,KAAD,IAAqC;EACpE,OAAQ;AACV,kBAAkBA,KAAK,CAACC,SAAU;AAClC,sBAAsBD,KAAK,CAACE,aAAc;AAC1C,aAAaF,KAAK,CAACG,KAAN,IAAeC,uBAAA,CAAQC,QAAR,EAAmB;AAC/C;AACA,GALE;AAMD,CAPM"}
1
+ {"version":3,"names":["getActivityParams","props","accountId","customerToken","getActivityScript","DISPATCH_REQUEST_REFRESH","injectRefreshEventIfNeeded","currentWeb","requestRefreshEvent","dependencies","includes","WebComponentType","activity","valueOf","injectJavaScript","JSON","stringify"],"sources":["UNActivityComponent.utils.ts"],"sourcesContent":["import { WebComponentType } from './../../webComponent/WebComponent';\nimport type { RequestRefreshEvent } from './../../messages/webMessages/unitMessages';\nimport type { WebView } from 'react-native-webview';\nimport { DISPATCH_REQUEST_REFRESH } from './../../scripts/html/bodyScript';\nimport type { UNActivityComponentProps } from './UNActivityComponent';\n\nexport const getActivityParams = (props: UNActivityComponentProps) => {\n return `\n account-id=\"${props.accountId}\"\n customer-token=\"${props.customerToken}\"\n style=\"height: 100%\"\n `;\n};\n\nexport const getActivityScript = () => {\n return DISPATCH_REQUEST_REFRESH;\n};\n\nexport const injectRefreshEventIfNeeded = (currentWeb: WebView | null, requestRefreshEvent: RequestRefreshEvent | null) => {\n if (requestRefreshEvent && requestRefreshEvent.dependencies.includes(WebComponentType.activity.valueOf())) {\n currentWeb?.injectJavaScript(`dispatchRefreshEvent('${JSON.stringify(requestRefreshEvent)}')`);\n }\n};\n"],"mappings":";;;;;;;AAAA;;AAGA;;AAGO,MAAMA,iBAAiB,GAAIC,KAAD,IAAqC;EACpE,OAAQ;AACV,kBAAkBA,KAAK,CAACC,SAAU;AAClC,sBAAsBD,KAAK,CAACE,aAAc;AAC1C;AACA,GAJE;AAKD,CANM;;;;AAQA,MAAMC,iBAAiB,GAAG,MAAM;EACrC,OAAOC,oCAAP;AACD,CAFM;;;;AAIA,MAAMC,0BAA0B,GAAG,CAACC,UAAD,EAA6BC,mBAA7B,KAAiF;EACzH,IAAIA,mBAAmB,IAAIA,mBAAmB,CAACC,YAApB,CAAiCC,QAAjC,CAA0CC,8BAAA,CAAiBC,QAAjB,CAA0BC,OAA1B,EAA1C,CAA3B,EAA2G;IACzGN,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU,CAAEO,gBAAZ,CAA8B,yBAAwBC,IAAI,CAACC,SAAL,CAAeR,mBAAf,CAAoC,IAA1F;EACD;AACF,CAJM"}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.UNBookPaymentComponent = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _WebComponent = require("../../webComponent/WebComponent");
11
11
 
@@ -15,24 +15,67 @@ var _UNBookPaymentComponent = require("./UNBookPaymentComponent.utils");
15
15
 
16
16
  var _bookPaymentMessage = require("../../messages/webMessages/bookPaymentMessage");
17
17
 
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ var _pageMessage = require("../../messages/webMessages/pageMessage");
19
+
20
+ var _reactNative = require("react-native");
21
+
22
+ var _unitMessages = require("../../messages/webMessages/unitMessages");
23
+
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
27
 
20
28
  const UNBookPaymentComponent = props => {
29
+ const [height, setHeight] = (0, _react.useState)(0);
30
+ const [presentationMode, setPresentationMode] = (0, _react.useState)(_bodyHtml.PresentationMode.Inherit);
31
+
21
32
  const handleWebViewMessage = message => {
22
- if (message.type === _bookPaymentMessage.BookPaymentMessage.PAYMENT_CREATED && props.onPaymentCreated) {
23
- const response = message.details;
24
- props.onPaymentCreated(response.data);
33
+ if (!message || !message.details) return;
34
+
35
+ switch (message.type) {
36
+ case _bookPaymentMessage.BookPaymentMessage.PAYMENT_CREATED:
37
+ props.onPaymentCreated && props.onPaymentCreated(message.details.data);
38
+ break;
39
+
40
+ case _unitMessages.UnitMessage.UNIT_ON_LOAD:
41
+ props.onLoad && props.onLoad(message.details);
42
+ break;
43
+
44
+ case _pageMessage.PageMessage.PAGE_HEIGHT:
45
+ {
46
+ const currentHeight = message.details.height;
47
+ setHeight(currentHeight);
48
+
49
+ if (presentationMode === _bodyHtml.PresentationMode.Inherit && currentHeight === 0) {
50
+ setPresentationMode(_bodyHtml.PresentationMode.Default);
51
+ }
52
+
53
+ break;
54
+ }
25
55
  }
26
56
  };
27
57
 
28
- return /*#__PURE__*/_react.default.createElement(_WebComponent.WebComponent, {
29
- type: _WebComponent.WebComponentType.bookPayment,
30
- presentationMode: _bodyHtml.PresentationMode.Inherit,
31
- params: (0, _UNBookPaymentComponent.getBookPaymentParams)(props),
32
- script: (0, _UNBookPaymentComponent.getBookPaymentScript)(),
33
- onMessage: message => handleWebViewMessage(message),
34
- isScrollable: false
35
- });
58
+ const renderBookPaymentWebView = () => {
59
+ return /*#__PURE__*/_react.default.createElement(_WebComponent.WebComponent, {
60
+ type: _WebComponent.WebComponentType.bookPayment,
61
+ presentationMode: presentationMode,
62
+ params: (0, _UNBookPaymentComponent.getBookPaymentParams)(props),
63
+ script: (0, _UNBookPaymentComponent.getBookPaymentScript)(),
64
+ onMessage: message => handleWebViewMessage(message),
65
+ isScrollable: false,
66
+ theme: props.theme
67
+ });
68
+ };
69
+
70
+ if (presentationMode === _bodyHtml.PresentationMode.Inherit) {
71
+ return renderBookPaymentWebView();
72
+ }
73
+
74
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
75
+ style: {
76
+ height: height
77
+ }
78
+ }, renderBookPaymentWebView());
36
79
  };
37
80
 
38
81
  exports.UNBookPaymentComponent = UNBookPaymentComponent;
@@ -1 +1 @@
1
- {"version":3,"names":["UNBookPaymentComponent","props","handleWebViewMessage","message","type","BookPaymentMessage","PAYMENT_CREATED","onPaymentCreated","response","details","data","WebComponentType","bookPayment","PresentationMode","Inherit","getBookPaymentParams","getBookPaymentScript"],"sources":["UNBookPaymentComponent.tsx"],"sourcesContent":["import React from 'react';\nimport { WebComponent, WebComponentType } from '../../webComponent/WebComponent';\nimport { PresentationMode } from '../../scripts/html/bodyHtml';\nimport { getBookPaymentParams, getBookPaymentScript } from './UNBookPaymentComponent.utils';\nimport type { WebViewMessage } from '../../messages/webMessages';\nimport { BookPaymentEvent, BookPaymentMessage } from '../../messages/webMessages/bookPaymentMessage';\nimport type { UNBookPaymentData } from '../../sharedTypes';\n\nexport interface UNBookPaymentComponentProps {\n accountId: string;\n customerToken: string;\n isSameCustomer: boolean;\n counterPartyAccountId: string;\n counterPartyName: string;\n theme?: string;\n onPaymentCreated?: (data: UNBookPaymentData) => void;\n}\n\nexport const UNBookPaymentComponent = (props: UNBookPaymentComponentProps) => {\n const handleWebViewMessage = (message: WebViewMessage) => {\n if (message.type === BookPaymentMessage.PAYMENT_CREATED && props.onPaymentCreated) {\n const response = message.details as BookPaymentEvent;\n props.onPaymentCreated(response.data);\n }\n };\n\n return (\n <WebComponent\n type={WebComponentType.bookPayment}\n presentationMode={PresentationMode.Inherit}\n params={getBookPaymentParams(props)}\n script={getBookPaymentScript()}\n onMessage={(message: WebViewMessage) => handleWebViewMessage(message)}\n isScrollable={false}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;AAaO,MAAMA,sBAAsB,GAAIC,KAAD,IAAwC;EAC5E,MAAMC,oBAAoB,GAAIC,OAAD,IAA6B;IACxD,IAAIA,OAAO,CAACC,IAAR,KAAiBC,sCAAA,CAAmBC,eAApC,IAAuDL,KAAK,CAACM,gBAAjE,EAAmF;MACjF,MAAMC,QAAQ,GAAGL,OAAO,CAACM,OAAzB;MACAR,KAAK,CAACM,gBAAN,CAAuBC,QAAQ,CAACE,IAAhC;IACD;EACF,CALD;;EAOA,oBACE,6BAAC,0BAAD;IACE,IAAI,EAAEC,8BAAA,CAAiBC,WADzB;IAEE,gBAAgB,EAAEC,0BAAA,CAAiBC,OAFrC;IAGE,MAAM,EAAE,IAAAC,4CAAA,EAAqBd,KAArB,CAHV;IAIE,MAAM,EAAE,IAAAe,4CAAA,GAJV;IAKE,SAAS,EAAGb,OAAD,IAA6BD,oBAAoB,CAACC,OAAD,CAL9D;IAME,YAAY,EAAE;EANhB,EADF;AAUD,CAlBM"}
1
+ {"version":3,"names":["UNBookPaymentComponent","props","height","setHeight","useState","presentationMode","setPresentationMode","PresentationMode","Inherit","handleWebViewMessage","message","details","type","BookPaymentMessage","PAYMENT_CREATED","onPaymentCreated","data","UnitMessage","UNIT_ON_LOAD","onLoad","PageMessage","PAGE_HEIGHT","currentHeight","Default","renderBookPaymentWebView","WebComponentType","bookPayment","getBookPaymentParams","getBookPaymentScript","theme"],"sources":["UNBookPaymentComponent.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { WebComponent, WebComponentType } from '../../webComponent/WebComponent';\nimport { PresentationMode } from '../../scripts/html/bodyHtml';\nimport { getBookPaymentParams, getBookPaymentScript } from './UNBookPaymentComponent.utils';\nimport type { WebViewMessage } from '../../messages/webMessages';\nimport { BookPaymentEvent, BookPaymentMessage } from '../../messages/webMessages/bookPaymentMessage';\nimport type { ResponseUnitOnLoadEvent, UNBookPaymentData } from '../../sharedTypes';\nimport { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';\nimport { View } from 'react-native';\nimport { UnitMessage } from '../../messages/webMessages/unitMessages';\n\nexport interface UNBookPaymentComponentProps {\n accountId: string;\n customerToken: string;\n isSameCustomer: boolean;\n counterPartyAccountId: string;\n counterPartyName: string;\n theme?: string;\n onPaymentCreated?: (data: UNBookPaymentData) => void;\n onLoad?: (response: ResponseUnitOnLoadEvent) => void;\n}\n\nexport const UNBookPaymentComponent = (props: UNBookPaymentComponentProps) => {\n const [height, setHeight] = useState<number>(0);\n const [presentationMode, setPresentationMode] = useState<PresentationMode>(PresentationMode.Inherit);\n\n const handleWebViewMessage = (message: WebViewMessage) => {\n if (!message || !message.details) return;\n\n switch (message.type) {\n case BookPaymentMessage.PAYMENT_CREATED:\n props.onPaymentCreated && props.onPaymentCreated((message.details as BookPaymentEvent).data);\n break;\n case UnitMessage.UNIT_ON_LOAD:\n props.onLoad && props.onLoad(message.details as ResponseUnitOnLoadEvent);\n break;\n case PageMessage.PAGE_HEIGHT: {\n const currentHeight = (message.details as HeightEvent).height;\n setHeight(currentHeight);\n if (presentationMode === PresentationMode.Inherit && currentHeight === 0) {\n setPresentationMode(PresentationMode.Default);\n }\n break;\n }\n }\n };\n\n const renderBookPaymentWebView = () => {\n return (\n <WebComponent\n type={WebComponentType.bookPayment}\n presentationMode={presentationMode}\n params={getBookPaymentParams(props)}\n script={getBookPaymentScript()}\n onMessage={(message: WebViewMessage) => handleWebViewMessage(message)}\n isScrollable={false}\n theme={props.theme}\n />\n );\n };\n\n if (presentationMode === PresentationMode.Inherit) {\n return renderBookPaymentWebView();\n }\n\n return (\n <View style={{ height: height }}>\n {renderBookPaymentWebView()}\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;;;;;AAaO,MAAMA,sBAAsB,GAAIC,KAAD,IAAwC;EAC5E,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsB,IAAAC,eAAA,EAAiB,CAAjB,CAA5B;EACA,MAAM,CAACC,gBAAD,EAAmBC,mBAAnB,IAA0C,IAAAF,eAAA,EAA2BG,0BAAA,CAAiBC,OAA5C,CAAhD;;EAEA,MAAMC,oBAAoB,GAAIC,OAAD,IAA6B;IACxD,IAAI,CAACA,OAAD,IAAY,CAACA,OAAO,CAACC,OAAzB,EAAkC;;IAElC,QAAQD,OAAO,CAACE,IAAhB;MACE,KAAKC,sCAAA,CAAmBC,eAAxB;QACEb,KAAK,CAACc,gBAAN,IAA0Bd,KAAK,CAACc,gBAAN,CAAwBL,OAAO,CAACC,OAAT,CAAsCK,IAA7D,CAA1B;QACA;;MACF,KAAKC,yBAAA,CAAYC,YAAjB;QACEjB,KAAK,CAACkB,MAAN,IAAgBlB,KAAK,CAACkB,MAAN,CAAaT,OAAO,CAACC,OAArB,CAAhB;QACA;;MACF,KAAKS,wBAAA,CAAYC,WAAjB;QAA8B;UAC5B,MAAMC,aAAa,GAAIZ,OAAO,CAACC,OAAT,CAAiCT,MAAvD;UACAC,SAAS,CAACmB,aAAD,CAAT;;UACA,IAAIjB,gBAAgB,KAAKE,0BAAA,CAAiBC,OAAtC,IAAiDc,aAAa,KAAK,CAAvE,EAA0E;YACxEhB,mBAAmB,CAACC,0BAAA,CAAiBgB,OAAlB,CAAnB;UACD;;UACD;QACD;IAdH;EAgBD,CAnBD;;EAqBA,MAAMC,wBAAwB,GAAG,MAAM;IACrC,oBACE,6BAAC,0BAAD;MACE,IAAI,EAAEC,8BAAA,CAAiBC,WADzB;MAEE,gBAAgB,EAAErB,gBAFpB;MAGE,MAAM,EAAE,IAAAsB,4CAAA,EAAqB1B,KAArB,CAHV;MAIE,MAAM,EAAE,IAAA2B,4CAAA,GAJV;MAKE,SAAS,EAAGlB,OAAD,IAA6BD,oBAAoB,CAACC,OAAD,CAL9D;MAME,YAAY,EAAE,KANhB;MAOE,KAAK,EAAET,KAAK,CAAC4B;IAPf,EADF;EAWD,CAZD;;EAcA,IAAIxB,gBAAgB,KAAKE,0BAAA,CAAiBC,OAA1C,EAAmD;IACjD,OAAOgB,wBAAwB,EAA/B;EACD;;EAED,oBACE,6BAAC,iBAAD;IAAM,KAAK,EAAE;MAAEtB,MAAM,EAAEA;IAAV;EAAb,GACGsB,wBAAwB,EAD3B,CADF;AAKD,CAhDM"}
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getBookPaymentScript = exports.getBookPaymentParams = void 0;
7
7
 
8
- var _bookPaymentMessage = require("../../messages/webMessages/bookPaymentMessage");
8
+ var _bodyScript = require("./../../scripts/html/bodyScript");
9
9
 
10
- var _UnitSdkManager = require("../../unitSdkManager/UnitSdkManager");
10
+ var _bookPaymentMessage = require("../../messages/webMessages/bookPaymentMessage");
11
11
 
12
12
  const getBookPaymentParams = props => {
13
13
  return `
@@ -16,7 +16,6 @@ const getBookPaymentParams = props => {
16
16
  is-same-customer="${props.isSameCustomer}"
17
17
  counterparty-account-id="${props.counterPartyAccountId}"
18
18
  counterparty-name="${props.counterPartyName}"
19
- theme="${props.theme ?? _UnitSdkManager.UnitSDK.getTheme()}"
20
19
  style="height: 100%"
21
20
  `;
22
21
  };
@@ -33,6 +32,8 @@ const getBookPaymentScript = () => {
33
32
  console.log(e)
34
33
  })
35
34
  });
35
+
36
+ ${_bodyScript.LISTENERS.requestRefresh}
36
37
  `;
37
38
  };
38
39
 
@@ -1 +1 @@
1
- {"version":3,"names":["getBookPaymentParams","props","accountId","customerToken","isSameCustomer","counterPartyAccountId","counterPartyName","theme","UnitSDK","getTheme","getBookPaymentScript","BookPaymentMessage","PAYMENT_CREATED"],"sources":["UNBookPaymentComponent.utils.ts"],"sourcesContent":["import type { UNBookPaymentComponentProps } from './UNBookPaymentComponent';\n\nimport { BookPaymentMessage } from '../../messages/webMessages/bookPaymentMessage';\nimport { UnitSDK } from '../../unitSdkManager/UnitSdkManager';\n\nexport const getBookPaymentParams = (props: UNBookPaymentComponentProps) => {\n return `\n account-id=\"${props.accountId}\"\n customer-token=\"${props.customerToken}\"\n is-same-customer=\"${props.isSameCustomer}\"\n counterparty-account-id=\"${props.counterPartyAccountId}\"\n counterparty-name=\"${props.counterPartyName}\"\n theme=\"${props.theme ?? UnitSDK.getTheme()}\"\n style=\"height: 100%\"\n `;\n};\n\nexport const getBookPaymentScript = () => {\n return `\n window.addEventListener(\"${BookPaymentMessage.PAYMENT_CREATED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${BookPaymentMessage.PAYMENT_CREATED}\", details: { data: JSON.stringify(data.data) }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `;\n};\n"],"mappings":";;;;;;;AAEA;;AACA;;AAEO,MAAMA,oBAAoB,GAAIC,KAAD,IAAwC;EAC1E,OAAQ;AACV,kBAAkBA,KAAK,CAACC,SAAU;AAClC,sBAAsBD,KAAK,CAACE,aAAc;AAC1C,wBAAwBF,KAAK,CAACG,cAAe;AAC7C,+BAA+BH,KAAK,CAACI,qBAAsB;AAC3D,yBAAyBJ,KAAK,CAACK,gBAAiB;AAChD,aAAaL,KAAK,CAACM,KAAN,IAAeC,uBAAA,CAAQC,QAAR,EAAmB;AAC/C;AACA,GARE;AASD,CAVM;;;;AAYA,MAAMC,oBAAoB,GAAG,MAAM;EACxC,OAAQ;AACV,+BAA+BC,sCAAA,CAAmBC,eAAgB;AAClE;AACA;AACA,sCAAsCD,sCAAA,CAAmBC,eAAgB;AACzE;AACA;AACA;AACA;AACA,GATE;AAUD,CAXM"}
1
+ {"version":3,"names":["getBookPaymentParams","props","accountId","customerToken","isSameCustomer","counterPartyAccountId","counterPartyName","getBookPaymentScript","BookPaymentMessage","PAYMENT_CREATED","LISTENERS","requestRefresh"],"sources":["UNBookPaymentComponent.utils.ts"],"sourcesContent":["import { LISTENERS } from './../../scripts/html/bodyScript';\nimport type { UNBookPaymentComponentProps } from './UNBookPaymentComponent';\n\nimport { BookPaymentMessage } from '../../messages/webMessages/bookPaymentMessage';\n\nexport const getBookPaymentParams = (props: UNBookPaymentComponentProps) => {\n return `\n account-id=\"${props.accountId}\"\n customer-token=\"${props.customerToken}\"\n is-same-customer=\"${props.isSameCustomer}\"\n counterparty-account-id=\"${props.counterPartyAccountId}\"\n counterparty-name=\"${props.counterPartyName}\"\n style=\"height: 100%\"\n `;\n};\n\nexport const getBookPaymentScript = () => {\n return `\n window.addEventListener(\"${BookPaymentMessage.PAYMENT_CREATED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${BookPaymentMessage.PAYMENT_CREATED}\", details: { data: JSON.stringify(data.data) }})\n }).catch((e) => {\n console.log(e)\n })\n });\n\n ${LISTENERS.requestRefresh}\n `;\n};\n"],"mappings":";;;;;;;AAAA;;AAGA;;AAEO,MAAMA,oBAAoB,GAAIC,KAAD,IAAwC;EAC1E,OAAQ;AACV,kBAAkBA,KAAK,CAACC,SAAU;AAClC,sBAAsBD,KAAK,CAACE,aAAc;AAC1C,wBAAwBF,KAAK,CAACG,cAAe;AAC7C,+BAA+BH,KAAK,CAACI,qBAAsB;AAC3D,yBAAyBJ,KAAK,CAACK,gBAAiB;AAChD;AACA,GAPE;AAQD,CATM;;;;AAWA,MAAMC,oBAAoB,GAAG,MAAM;EACxC,OAAQ;AACV,+BAA+BC,sCAAA,CAAmBC,eAAgB;AAClE;AACA;AACA,sCAAsCD,sCAAA,CAAmBC,eAAgB;AACzE;AACA;AACA;AACA;AACA;AACA,MAAMC,qBAAA,CAAUC,cAAe;AAC/B,GAXE;AAYD,CAbM"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.BOTTOM_SHEET_MAX_PRECANTAGE_SIZE = void 0;
7
- const BOTTOM_SHEET_MAX_PRECANTAGE_SIZE = 0.9;
8
- exports.BOTTOM_SHEET_MAX_PRECANTAGE_SIZE = BOTTOM_SHEET_MAX_PRECANTAGE_SIZE;
6
+ exports.BOTTOM_SHEET_MAX_PERCENTAGE_SIZE = void 0;
7
+ const BOTTOM_SHEET_MAX_PERCENTAGE_SIZE = 0.9;
8
+ exports.BOTTOM_SHEET_MAX_PERCENTAGE_SIZE = BOTTOM_SHEET_MAX_PERCENTAGE_SIZE;
9
9
  //# sourceMappingURL=UNBottomSheetComponent.constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BOTTOM_SHEET_MAX_PRECANTAGE_SIZE"],"sources":["UNBottomSheetComponent.constants.ts"],"sourcesContent":["export const BOTTOM_SHEET_MAX_PRECANTAGE_SIZE = 0.9;\n"],"mappings":";;;;;;AAAO,MAAMA,gCAAgC,GAAG,GAAzC"}
1
+ {"version":3,"names":["BOTTOM_SHEET_MAX_PERCENTAGE_SIZE"],"sources":["UNBottomSheetComponent.constants.ts"],"sourcesContent":["export const BOTTOM_SHEET_MAX_PERCENTAGE_SIZE = 0.9;\n"],"mappings":";;;;;;AAAO,MAAMA,gCAAgC,GAAG,GAAzC"}
@@ -31,6 +31,12 @@ var _bodyHtml = require("../../scripts/html/bodyHtml");
31
31
 
32
32
  var _useAppStateListener = require("../../hooks/useAppStateListener");
33
33
 
34
+ var _UNAddToWalletBottomSheetItem = require("./components/UNAddToWalletBottomSheetItem");
35
+
36
+ var _UNAccountComponent = require("../UNAccountComponent/UNAccountComponent.utils");
37
+
38
+ var _UNAccountComponent2 = require("../UNAccountComponent/UNAccountComponent");
39
+
34
40
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
41
 
36
42
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -43,45 +49,57 @@ exports.ScrollState = ScrollState;
43
49
 
44
50
  (function (ScrollState) {
45
51
  ScrollState["onTop"] = "onTop";
52
+ ScrollState["unScrollable"] = "unScrollable";
46
53
  ScrollState["onlyWebView"] = "webViewScroll";
47
54
  ScrollState["onlyBottomSheet"] = "onlyBottomSheet";
48
- ScrollState["unScrollable"] = "unScrollable";
49
55
  })(ScrollState || (exports.ScrollState = ScrollState = {}));
50
56
 
57
+ var CustomDialog;
58
+
59
+ (function (CustomDialog) {
60
+ CustomDialog[CustomDialog["addToWallet"] = 0] = "addToWallet";
61
+ })(CustomDialog || (CustomDialog = {}));
62
+
51
63
  const UNBottomSheetComponent = () => {
52
64
  const [isBottomSheetActive, setIsBottomSheetActive] = (0, _react.useState)(false);
53
65
  const [height, setHeight] = (0, _react.useState)(0);
54
- const [renderingRequest, setRenderingRequest] = (0, _react.useState)(null);
66
+ const [bottomSheetSlotData, setBottomSheetSlotData] = (0, _react.useState)();
67
+ const [requestRenderingEvent, setRequestRenderingEvent] = (0, _react.useState)();
55
68
  const [scrollState, setScrollState] = (0, _react.useState)(ScrollState.onTop);
56
69
  const [waitForLoadingNewComponent, setWaitForLoadingNewComponent] = (0, _react.useState)(false);
57
70
  const [newHeightMessage, setNewHeightMessage] = (0, _react.useState)(null);
71
+ const [customDialog, setCustomDialog] = (0, _react.useState)(null);
58
72
  const isAppActive = (0, _useAppStateListener.useAppStateListener)();
59
73
  const styles = (0, _UNBottomSheetComponent2.getStylesObject)();
60
74
  const webRef = (0, _react.useRef)(null);
61
75
 
62
- const listenerAction = data => {
63
- setRenderingRequest(data);
76
+ const handleRequestRendering = data => {
77
+ setBottomSheetSlotData(data);
64
78
  setIsBottomSheetActive(true);
79
+ setRequestRenderingEvent(data.requestRenderingEvent);
80
+ };
81
+
82
+ const handleCloseFlow = () => {
83
+ setIsBottomSheetActive(false);
65
84
  };
66
85
 
67
86
  (0, _react.useEffect)(() => {
68
- if (!isAppActive) {
69
- setIsBottomSheetActive(false);
70
- }
71
- }, [isAppActive]);
87
+ setRequestRenderingEvent(bottomSheetSlotData === null || bottomSheetSlotData === void 0 ? void 0 : bottomSheetSlotData.requestRenderingEvent);
88
+ }, [bottomSheetSlotData]);
72
89
  (0, _react.useEffect)(() => {
73
90
  if (!webRef.current) return;
74
91
 
75
- if (renderingRequest) {
76
- (0, _UNBottomSheetComponent.renderingBottomSheetRequest)(webRef.current, renderingRequest);
92
+ if (requestRenderingEvent) {
93
+ (0, _UNBottomSheetComponent.renderingBottomSheetRequest)(webRef.current, requestRenderingEvent);
77
94
  }
78
- }, [webRef.current, renderingRequest]);
95
+ }, [webRef.current, requestRenderingEvent]);
79
96
  (0, _react.useEffect)(() => {
80
97
  if (!isBottomSheetActive) {
81
98
  webRef.current && (0, _UNBottomSheetComponent.resetHtml)(webRef.current);
82
99
  setHeight(0);
83
- setRenderingRequest(null);
100
+ setRequestRenderingEvent(undefined);
84
101
  setScrollState(ScrollState.onTop);
102
+ setCustomDialog(null);
85
103
  }
86
104
  }, [isBottomSheetActive]);
87
105
  (0, _react.useEffect)(() => {
@@ -92,44 +110,81 @@ const UNBottomSheetComponent = () => {
92
110
  }, [waitForLoadingNewComponent, newHeightMessage]);
93
111
  (0, _listenerToBus.useListenerToBus)([{
94
112
  busEventKey: _unitMessages.UnitMessage.UNIT_REQUEST_RENDERING,
95
- action: listenerAction
113
+ action: handleRequestRendering
114
+ }, {
115
+ busEventKey: _unitMessages.UnitMessage.UNIT_REQUEST_CLOSE_FLOW,
116
+ action: handleCloseFlow
96
117
  }]);
97
118
 
98
119
  const setNewHeight = message => {
99
- if (renderingRequest) {
100
- const nativePlace = JSON.parse(renderingRequest).nativePlace;
101
-
102
- if (nativePlace == 'overFullScreen') {
103
- const bottomSheetNewHeight = (0, _UNBottomSheetComponent.handleHtmlFullHeight)(webRef.current, _reactNative.Dimensions.get('window').height);
104
- setHeight(bottomSheetNewHeight);
105
- setScrollState(ScrollState.onTop);
106
- } else {
107
- setHeight(message.details.height);
108
- setScrollState(ScrollState.unScrollable);
109
- }
120
+ if (!requestRenderingEvent) return;
121
+
122
+ switch (bottomSheetSlotData === null || bottomSheetSlotData === void 0 ? void 0 : bottomSheetSlotData.componentName) {
123
+ case _WebComponent.WebComponentType.account:
124
+ {
125
+ const accountActionType = (0, _UNAccountComponent.getAccountActionType)(requestRenderingEvent);
126
+ setScrollState(accountActionType === _UNAccountComponent2.AccountAction.List ? ScrollState.onTop : ScrollState.unScrollable);
127
+ break;
128
+ }
129
+
130
+ case _WebComponent.WebComponentType.card:
131
+ {
132
+ if (customDialog === CustomDialog.addToWallet) {
133
+ setScrollState(ScrollState.unScrollable);
134
+ } else {
135
+ setScrollState(ScrollState.onTop);
136
+ }
137
+
138
+ break;
139
+ }
140
+
141
+ default:
142
+ {
143
+ const nativePlace = requestRenderingEvent === null || requestRenderingEvent === void 0 ? void 0 : requestRenderingEvent.data.nativePlace;
144
+
145
+ if (nativePlace == 'overFullScreen') {
146
+ setScrollState(ScrollState.onTop);
147
+ } else {
148
+ setScrollState(ScrollState.unScrollable);
149
+ }
150
+ }
151
+ }
152
+
153
+ const nativePlace = requestRenderingEvent === null || requestRenderingEvent === void 0 ? void 0 : requestRenderingEvent.data.nativePlace;
154
+
155
+ if (nativePlace == 'overFullScreen') {
156
+ const bottomSheetNewHeight = (0, _UNBottomSheetComponent.handleHtmlFullHeight)(webRef.current, _reactNative.Dimensions.get('window').height);
157
+ setHeight(bottomSheetNewHeight);
158
+ } else {
159
+ setHeight(message.details.height);
110
160
  }
111
161
  };
112
162
 
113
163
  const onWebMessage = message => {
114
164
  switch (message.type) {
115
165
  case _pageMessage.PageMessage.PAGE_HEIGHT:
116
- renderingRequest && setNewHeightMessage(message);
166
+ requestRenderingEvent && setNewHeightMessage(message);
117
167
  break;
118
168
 
119
169
  case _unitMessages.UnitMessage.UNIT_REQUEST_RENDERING:
120
- // eslint-disable-next-line no-case-declarations
121
- const {
122
- data
123
- } = message.details;
170
+ {
171
+ var _requestRenderingEven;
124
172
 
125
- if (data != renderingRequest) {
126
- setHeight(0);
127
- setRenderingRequest(data);
128
- setWaitForLoadingNewComponent(true);
129
- setTimeout(() => setWaitForLoadingNewComponent(false), 400);
130
- }
173
+ const requestRendering = message.details;
131
174
 
132
- break;
175
+ if (requestRendering.data.nativeComponent != (requestRenderingEvent === null || requestRenderingEvent === void 0 ? void 0 : (_requestRenderingEven = requestRenderingEvent.data) === null || _requestRenderingEven === void 0 ? void 0 : _requestRenderingEven.nativeComponent)) {
176
+ if (requestRendering.data.nativeComponent.includes('action=AddToWallet')) {
177
+ setCustomDialog(CustomDialog.addToWallet);
178
+ }
179
+
180
+ setHeight(0);
181
+ setRequestRenderingEvent(requestRendering);
182
+ setWaitForLoadingNewComponent(true);
183
+ setTimeout(() => setWaitForLoadingNewComponent(false), 400);
184
+ }
185
+
186
+ break;
187
+ }
133
188
 
134
189
  case _cardMessage.CardMessage.CARD_STATUS_CHANGED:
135
190
  _EventBus.default.Instance.event(_cardMessage.CardMessage.CARD_STATUS_CHANGED, message.details.card);
@@ -137,7 +192,7 @@ const UNBottomSheetComponent = () => {
137
192
  break;
138
193
 
139
194
  case _unitMessages.UnitMessage.UNIT_REQUEST_CLOSE_FLOW:
140
- setIsBottomSheetActive(false);
195
+ handleCloseFlow();
141
196
  break;
142
197
 
143
198
  case _unitMessages.UnitMessage.UNIT_REQUEST_OPEN_LINK:
@@ -170,6 +225,27 @@ const UNBottomSheetComponent = () => {
170
225
  setScrollState(ScrollState.onlyWebView);
171
226
  };
172
227
 
228
+ const renderBottomSheetItem = () => {
229
+ switch (customDialog) {
230
+ case CustomDialog.addToWallet:
231
+ return /*#__PURE__*/_react.default.createElement(_UNAddToWalletBottomSheetItem.UNAddToWalletBottomSheetItem, {
232
+ renderingRequest: requestRenderingEvent,
233
+ cardId: bottomSheetSlotData === null || bottomSheetSlotData === void 0 ? void 0 : bottomSheetSlotData.componentResourceId
234
+ });
235
+
236
+ default:
237
+ return /*#__PURE__*/_react.default.createElement(_WebComponent.WebComponent, {
238
+ ref: webRef,
239
+ type: _WebComponent.WebComponentType.slot,
240
+ presentationMode: _bodyHtml.PresentationMode.CoverInjectedHeight,
241
+ script: (0, _UNBottomSheetComponent.getBottomSheetScript)(),
242
+ onMessage: onWebMessage,
243
+ isScrollable: scrollState === ScrollState.onlyWebView || scrollState === ScrollState.onTop,
244
+ handleScroll: onScrollWebView
245
+ });
246
+ }
247
+ };
248
+
173
249
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
174
250
  pointerEvents: isBottomSheetActive ? undefined : 'none',
175
251
  style: styles.container
@@ -180,15 +256,7 @@ const UNBottomSheetComponent = () => {
180
256
  onOpen: () => setIsBottomSheetActive(true),
181
257
  handleWebViewScroll: () => handleWebViewScroll(),
182
258
  shouldEnableBottomSheetScroll: scrollState !== ScrollState.onlyWebView
183
- }, isAppActive && /*#__PURE__*/_react.default.createElement(_WebComponent.WebComponent, {
184
- ref: webRef,
185
- type: _WebComponent.WebComponentType.slot,
186
- presentationMode: _bodyHtml.PresentationMode.CoverInjectedHeight,
187
- script: (0, _UNBottomSheetComponent.getBottomSheetScript)(),
188
- onMessage: onWebMessage,
189
- isScrollable: scrollState === ScrollState.onlyWebView || scrollState === ScrollState.onTop,
190
- handleScroll: onScrollWebView
191
- }))));
259
+ }, isAppActive && renderBottomSheetItem())));
192
260
  };
193
261
 
194
262
  exports.UNBottomSheetComponent = UNBottomSheetComponent;
@@ -1 +1 @@
1
- {"version":3,"names":["ScrollState","UNBottomSheetComponent","isBottomSheetActive","setIsBottomSheetActive","useState","height","setHeight","renderingRequest","setRenderingRequest","scrollState","setScrollState","onTop","waitForLoadingNewComponent","setWaitForLoadingNewComponent","newHeightMessage","setNewHeightMessage","isAppActive","useAppStateListener","styles","getStylesObject","webRef","useRef","listenerAction","data","useEffect","current","renderingBottomSheetRequest","resetHtml","setNewHeight","useListenerToBus","busEventKey","UnitMessage","UNIT_REQUEST_RENDERING","action","message","nativePlace","JSON","parse","bottomSheetNewHeight","handleHtmlFullHeight","Dimensions","get","details","unScrollable","onWebMessage","type","PageMessage","PAGE_HEIGHT","setTimeout","CardMessage","CARD_STATUS_CHANGED","EventBus","Instance","event","card","UNIT_REQUEST_CLOSE_FLOW","UNIT_REQUEST_OPEN_LINK","href","Linking","openURL","onScrollWebView","currY","nativeEvent","contentOffset","y","onlyBottomSheet","onlyWebView","handleWebViewScroll","undefined","container","WebComponentType","slot","PresentationMode","CoverInjectedHeight","getBottomSheetScript"],"sources":["UNBottomSheetComponent.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useRef, useState } from 'react';\nimport type WebView from 'react-native-webview';\nimport { WebComponent, WebComponentType } from '../../webComponent/WebComponent';\nimport { Dimensions, Linking, View } from 'react-native';\nimport BottomSheet from '../../helpers/BottomSheet/BottomSheet';\nimport EventBus from '../../helpers/EventBus';\nimport { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';\nimport { RequestOpenLinkEvent, RequestRenderingData, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';\nimport { CardMessage, CardStatusChangedEvent } from '../../messages/webMessages/cardMessage';\nimport { useListenerToBus } from '../../hooks/listenerToBus';\nimport type { WebViewMessage } from '../../messages/webMessages';\nimport { getBottomSheetScript, handleHtmlFullHeight, renderingBottomSheetRequest, resetHtml } from './UNBottomSheetComponent.utils';\nimport { getStylesObject } from './UNBottomSheetComponent.styles';\nimport { PresentationMode } from '../../scripts/html/bodyHtml';\nimport { useAppStateListener } from '../../hooks/useAppStateListener';\n\nexport enum ScrollState {\n onTop = 'onTop',\n onlyWebView = 'webViewScroll',\n onlyBottomSheet = 'onlyBottomSheet',\n unScrollable = 'unScrollable'\n}\n\nexport const UNBottomSheetComponent = () => {\n const [isBottomSheetActive, setIsBottomSheetActive] = useState(false);\n const [height, setHeight] = useState(0);\n\n const [renderingRequest, setRenderingRequest] = useState<string | null>(null);\n const [scrollState, setScrollState] = useState<ScrollState>(ScrollState.onTop);\n\n const [waitForLoadingNewComponent, setWaitForLoadingNewComponent] = useState(false);\n const [newHeightMessage, setNewHeightMessage] = useState<WebViewMessage | null>(null);\n\n const isAppActive = useAppStateListener();\n\n const styles = getStylesObject();\n\n const webRef = useRef<WebView>(null);\n\n const listenerAction = (data: string) => {\n setRenderingRequest(data);\n setIsBottomSheetActive(true);\n };\n\n useEffect(() => {\n if (!isAppActive) {\n setIsBottomSheetActive(false);\n }\n }, [isAppActive]);\n\n useEffect(() => {\n if (!webRef.current) return;\n if (renderingRequest) {\n renderingBottomSheetRequest(webRef.current, renderingRequest);\n }\n }, [webRef.current, renderingRequest]);\n\n useEffect(() => {\n if (!isBottomSheetActive) {\n webRef.current && resetHtml(webRef.current);\n setHeight(0);\n setRenderingRequest(null);\n setScrollState(ScrollState.onTop);\n }\n }, [isBottomSheetActive]);\n\n useEffect(() => {\n if (!waitForLoadingNewComponent && newHeightMessage) {\n setWaitForLoadingNewComponent(false);\n setNewHeight(newHeightMessage);\n }\n }, [waitForLoadingNewComponent, newHeightMessage]);\n\n useListenerToBus([{ busEventKey: UnitMessage.UNIT_REQUEST_RENDERING, action: listenerAction }]);\n\n const setNewHeight = (message: WebViewMessage) => {\n if (renderingRequest) {\n const nativePlace = (JSON.parse(renderingRequest) as RequestRenderingData).nativePlace;\n if (nativePlace == 'overFullScreen') {\n const bottomSheetNewHeight = handleHtmlFullHeight(webRef.current, Dimensions.get('window').height);\n setHeight(bottomSheetNewHeight);\n setScrollState(ScrollState.onTop);\n } else {\n setHeight((message.details as HeightEvent).height);\n setScrollState(ScrollState.unScrollable);\n }\n }\n };\n\n const onWebMessage = (message: WebViewMessage) => {\n switch (message.type) {\n case PageMessage.PAGE_HEIGHT:\n renderingRequest && setNewHeightMessage(message);\n break;\n case UnitMessage.UNIT_REQUEST_RENDERING:\n // eslint-disable-next-line no-case-declarations\n const { data } = (message.details as RequestRenderingEvent);\n if (data != renderingRequest) {\n setHeight(0);\n setRenderingRequest(data);\n setWaitForLoadingNewComponent(true);\n setTimeout(() => setWaitForLoadingNewComponent(false), 400);\n }\n break;\n case CardMessage.CARD_STATUS_CHANGED:\n EventBus.Instance.event(CardMessage.CARD_STATUS_CHANGED, (message.details as CardStatusChangedEvent).card);\n break;\n case UnitMessage.UNIT_REQUEST_CLOSE_FLOW:\n setIsBottomSheetActive(false);\n break;\n case UnitMessage.UNIT_REQUEST_OPEN_LINK:\n // eslint-disable-next-line no-case-declarations\n const { href } = (message.details as RequestOpenLinkEvent);\n Linking.openURL(href);\n break;\n }\n };\n\n const onScrollWebView = (event: any) => {\n if (scrollState === ScrollState.unScrollable) return;\n\n const currY = event.nativeEvent.contentOffset.y;\n\n if (ScrollState.onTop && currY < 5) {\n setScrollState(ScrollState.onlyBottomSheet);\n }\n\n if ( scrollState !== ScrollState.onlyWebView && scrollState === ScrollState.onTop && currY > 5) {\n setScrollState(ScrollState.onlyWebView);\n }\n };\n\n const handleWebViewScroll = () => {\n if (scrollState === ScrollState.unScrollable) return;\n setScrollState(ScrollState.onlyWebView);\n };\n\n return (\n <>\n <View\n pointerEvents={isBottomSheetActive ? undefined : 'none'}\n style={styles.container}\n >\n <BottomSheet\n isOpen={isBottomSheetActive}\n height={height}\n onClose={() => setIsBottomSheetActive(false)}\n onOpen={() => setIsBottomSheetActive(true)}\n handleWebViewScroll={() => handleWebViewScroll()}\n shouldEnableBottomSheetScroll={scrollState !== ScrollState.onlyWebView}\n >\n { isAppActive && (\n <WebComponent\n ref={webRef}\n type={WebComponentType.slot}\n presentationMode={PresentationMode.CoverInjectedHeight}\n script={getBottomSheetScript()}\n onMessage={onWebMessage}\n isScrollable={scrollState === ScrollState.onlyWebView || scrollState === ScrollState.onTop}\n handleScroll={onScrollWebView}\n />)}\n </BottomSheet>\n </View>\n </>\n );\n};\n"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;AAfA;IAiBYA,W;;;WAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,2BAAAA,W;;AAOL,MAAMC,sBAAsB,GAAG,MAAM;EAC1C,MAAM,CAACC,mBAAD,EAAsBC,sBAAtB,IAAgD,IAAAC,eAAA,EAAS,KAAT,CAAtD;EACA,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsB,IAAAF,eAAA,EAAS,CAAT,CAA5B;EAEA,MAAM,CAACG,gBAAD,EAAmBC,mBAAnB,IAA0C,IAAAJ,eAAA,EAAwB,IAAxB,CAAhD;EACA,MAAM,CAACK,WAAD,EAAcC,cAAd,IAAgC,IAAAN,eAAA,EAAsBJ,WAAW,CAACW,KAAlC,CAAtC;EAEA,MAAM,CAACC,0BAAD,EAA6BC,6BAA7B,IAA8D,IAAAT,eAAA,EAAS,KAAT,CAApE;EACA,MAAM,CAACU,gBAAD,EAAmBC,mBAAn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CAJtC;IAKE,mBAAmB,EAAE,MAAOgE,mBAAmB,EALjD;IAME,6BAA6B,EAAE1D,WAAW,KAAKT,WAAW,CAACkE;EAN7D,GAQIlD,WAAW,iBACX,6BAAC,0BAAD;IACE,GAAG,EAAEI,MADP;IAEE,IAAI,EAAEkD,8BAAA,CAAiBC,IAFzB;IAGE,gBAAgB,EAAEC,0BAAA,CAAiBC,mBAHrC;IAIE,MAAM,EAAE,IAAAC,4CAAA,GAJV;IAKE,SAAS,EAAE9B,YALb;IAME,YAAY,EAAEnC,WAAW,KAAKT,WAAW,CAACkE,WAA5B,IAA2CzD,WAAW,KAAKT,WAAW,CAACW,KANvF;IAOE,YAAY,EAAEiD;EAPhB,EATJ,CAJF,CADF,CADF;AA4BD,CA9IM"}
1
+ {"version":3,"names":["ScrollState","CustomDialog","UNBottomSheetComponent","isBottomSheetActive","setIsBottomSheetActive","useState","height","setHeight","bottomSheetSlotData","setBottomSheetSlotData","requestRenderingEvent","setRequestRenderingEvent","scrollState","setScrollState","onTop","waitForLoadingNewComponent","setWaitForLoadingNewComponent","newHeightMessage","setNewHeightMessage","customDialog","setCustomDialog","isAppActive","useAppStateListener","styles","getStylesObject","webRef","useRef","handleRequestRendering","data","handleCloseFlow","useEffect","current","renderingBottomSheetRequest","resetHtml","undefined","setNewHeight","useListenerToBus","busEventKey","UnitMessage","UNIT_REQUEST_RENDERING","action","UNIT_REQUEST_CLOSE_FLOW","message","componentName","WebComponentType","account","accountActionType","getAccountActionType","AccountAction","List","unScrollable","card","addToWallet","nativePlace","bottomSheetNewHeight","handleHtmlFullHeight","Dimensions","get","details","onWebMessage","type","PageMessage","PAGE_HEIGHT","requestRendering","nativeComponent","includes","setTimeout","CardMessage","CARD_STATUS_CHANGED","EventBus","Instance","event","UNIT_REQUEST_OPEN_LINK","href","Linking","openURL","onScrollWebView","currY","nativeEvent","contentOffset","y","onlyBottomSheet","onlyWebView","handleWebViewScroll","renderBottomSheetItem","componentResourceId","slot","PresentationMode","CoverInjectedHeight","getBottomSheetScript","container"],"sources":["UNBottomSheetComponent.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useRef, useState } from 'react';\nimport type WebView from 'react-native-webview';\nimport { WebComponent, WebComponentType } from '../../webComponent/WebComponent';\nimport { Dimensions, Linking, View } from 'react-native';\nimport BottomSheet from '../../helpers/BottomSheet/BottomSheet';\nimport EventBus from '../../helpers/EventBus';\nimport { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';\nimport { RequestOpenLinkEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';\nimport { CardMessage, CardStatusChangedEvent } from '../../messages/webMessages/cardMessage';\nimport { useListenerToBus } from '../../hooks/listenerToBus';\nimport type { WebViewMessage } from '../../messages/webMessages';\nimport { getBottomSheetScript, handleHtmlFullHeight, renderingBottomSheetRequest, resetHtml } from './UNBottomSheetComponent.utils';\nimport { getStylesObject } from './UNBottomSheetComponent.styles';\nimport { PresentationMode } from '../../scripts/html/bodyHtml';\nimport { useAppStateListener } from '../../hooks/useAppStateListener';\nimport { UNAddToWalletBottomSheetItem } from './components/UNAddToWalletBottomSheetItem';\nimport { getAccountActionType } from '../UNAccountComponent/UNAccountComponent.utils';\nimport { AccountAction } from '../UNAccountComponent/UNAccountComponent';\n\nexport enum ScrollState {\n /*\n Web View ScrollState -\n - Initialization:\n 'onTop': for a scrollable webView.\n (onTop means that the webview is onTop of the BottomSheet and we need to recognize the scroll direction).\n Then, it recognize the scroll direction and update the scroll state as needed.\n\n -'unScrollable': for an unscrollable webView\n */\n onTop = 'onTop',\n unScrollable = 'unScrollable',\n\n /*\n These are only for maintain the bottom sheet scrollState (not an initialize scroll state).\n It relates to the current scroll state.\n onlyWebView means that now the scroll is on webview (only).\n onlyBottomSheet means that now the scroll is on bottomSheet (only).\n */\n onlyWebView = 'webViewScroll',\n onlyBottomSheet = 'onlyBottomSheet',\n}\n\nexport type BottomSheetSlotData = {\n // The data that rendered by the web view\n componentName?: WebComponentType,\n componentResourceId?: string,\n requestRenderingEvent: RequestRenderingEvent\n}\n\nenum CustomDialog {\n addToWallet\n}\n\nexport const UNBottomSheetComponent = () => {\n const [isBottomSheetActive, setIsBottomSheetActive] = useState(false);\n const [height, setHeight] = useState(0);\n\n const [bottomSheetSlotData, setBottomSheetSlotData] = useState<BottomSheetSlotData>();\n const [requestRenderingEvent, setRequestRenderingEvent] = useState<RequestRenderingEvent>();\n const [scrollState, setScrollState] = useState<ScrollState>(ScrollState.onTop);\n\n const [waitForLoadingNewComponent, setWaitForLoadingNewComponent] = useState(false);\n const [newHeightMessage, setNewHeightMessage] = useState<WebViewMessage | null>(null);\n\n const [customDialog, setCustomDialog] = useState<CustomDialog | null>(null);\n\n const isAppActive = useAppStateListener();\n\n const styles = getStylesObject();\n\n const webRef = useRef<WebView>(null);\n\n const handleRequestRendering = (data: BottomSheetSlotData) => {\n setBottomSheetSlotData(data);\n setIsBottomSheetActive(true);\n setRequestRenderingEvent(data.requestRenderingEvent);\n };\n\n const handleCloseFlow = () => {\n setIsBottomSheetActive(false);\n };\n\n useEffect(() => {\n setRequestRenderingEvent(bottomSheetSlotData?.requestRenderingEvent);\n }, [bottomSheetSlotData]);\n\n useEffect(() => {\n if (!webRef.current) return;\n if (requestRenderingEvent) {\n renderingBottomSheetRequest(webRef.current, requestRenderingEvent);\n }\n }, [webRef.current, requestRenderingEvent]);\n\n useEffect(() => {\n if (!isBottomSheetActive) {\n webRef.current && resetHtml(webRef.current);\n setHeight(0);\n setRequestRenderingEvent(undefined);\n setScrollState(ScrollState.onTop);\n setCustomDialog(null);\n }\n }, [isBottomSheetActive]);\n\n useEffect(() => {\n if (!waitForLoadingNewComponent && newHeightMessage) {\n setWaitForLoadingNewComponent(false);\n setNewHeight(newHeightMessage);\n }\n }, [waitForLoadingNewComponent, newHeightMessage]);\n\n useListenerToBus([\n { busEventKey: UnitMessage.UNIT_REQUEST_RENDERING, action: handleRequestRendering },\n { busEventKey: UnitMessage.UNIT_REQUEST_CLOSE_FLOW, action: handleCloseFlow }\n ]);\n\n const setNewHeight = (message: WebViewMessage) => {\n if (!requestRenderingEvent) return;\n switch (bottomSheetSlotData?.componentName) {\n case WebComponentType.account: {\n const accountActionType = getAccountActionType(requestRenderingEvent);\n setScrollState(\n accountActionType === AccountAction.List ? ScrollState.onTop : ScrollState.unScrollable\n );\n break;\n }\n case WebComponentType.card: {\n if (customDialog === CustomDialog.addToWallet) {\n setScrollState(ScrollState.unScrollable);\n } else {\n setScrollState(ScrollState.onTop);\n }\n break;\n }\n default: {\n const nativePlace = requestRenderingEvent?.data.nativePlace;\n if (nativePlace == 'overFullScreen') {\n setScrollState(ScrollState.onTop);\n } else {\n setScrollState(ScrollState.unScrollable);\n }\n }\n }\n const nativePlace = requestRenderingEvent?.data.nativePlace;\n if (nativePlace == 'overFullScreen') {\n const bottomSheetNewHeight = handleHtmlFullHeight(webRef.current, Dimensions.get('window').height);\n setHeight(bottomSheetNewHeight);\n } else {\n setHeight((message.details as HeightEvent).height);\n }\n };\n\n const onWebMessage = (message: WebViewMessage) => {\n switch (message.type) {\n case PageMessage.PAGE_HEIGHT:\n requestRenderingEvent && setNewHeightMessage(message);\n break;\n case UnitMessage.UNIT_REQUEST_RENDERING: {\n const requestRendering = (message.details as RequestRenderingEvent);\n if (requestRendering.data.nativeComponent != requestRenderingEvent?.data?.nativeComponent) {\n if (requestRendering.data.nativeComponent.includes('action=AddToWallet')) {\n setCustomDialog(CustomDialog.addToWallet);\n }\n\n setHeight(0);\n setRequestRenderingEvent(requestRendering);\n setWaitForLoadingNewComponent(true);\n setTimeout(() => setWaitForLoadingNewComponent(false), 400);\n }\n break;\n }\n case CardMessage.CARD_STATUS_CHANGED:\n EventBus.Instance.event(CardMessage.CARD_STATUS_CHANGED, (message.details as CardStatusChangedEvent).card);\n break;\n case UnitMessage.UNIT_REQUEST_CLOSE_FLOW:\n handleCloseFlow();\n break;\n case UnitMessage.UNIT_REQUEST_OPEN_LINK:\n // eslint-disable-next-line no-case-declarations\n const { href } = (message.details as RequestOpenLinkEvent);\n Linking.openURL(href);\n break;\n }\n };\n\n const onScrollWebView = (event: any) => {\n if (scrollState === ScrollState.unScrollable) return;\n\n const currY = event.nativeEvent.contentOffset.y;\n\n if (ScrollState.onTop && currY < 5) {\n setScrollState(ScrollState.onlyBottomSheet);\n }\n\n if (scrollState !== ScrollState.onlyWebView && scrollState === ScrollState.onTop && currY > 5) {\n setScrollState(ScrollState.onlyWebView);\n }\n };\n\n const handleWebViewScroll = () => {\n if (scrollState === ScrollState.unScrollable) return;\n setScrollState(ScrollState.onlyWebView);\n };\n\n const renderBottomSheetItem = () => {\n switch (customDialog) {\n case CustomDialog.addToWallet:\n return <UNAddToWalletBottomSheetItem renderingRequest={requestRenderingEvent} cardId={bottomSheetSlotData?.componentResourceId} />;\n default:\n return (\n <WebComponent\n ref={webRef}\n type={WebComponentType.slot}\n presentationMode={PresentationMode.CoverInjectedHeight}\n script={getBottomSheetScript()}\n onMessage={onWebMessage}\n isScrollable={scrollState === ScrollState.onlyWebView || scrollState === ScrollState.onTop}\n handleScroll={onScrollWebView}\n />\n );\n }\n };\n\n return (\n <>\n <View\n pointerEvents={isBottomSheetActive ? undefined : 'none'}\n style={styles.container}\n >\n <BottomSheet\n isOpen={isBottomSheetActive}\n height={height}\n onClose={() => setIsBottomSheetActive(false)}\n onOpen={() => setIsBottomSheetActive(true)}\n handleWebViewScroll={() => handleWebViewScroll()}\n shouldEnableBottomSheetScroll={scrollState !== ScrollState.onlyWebView}\n >\n {isAppActive && renderBottomSheetItem()}\n </BottomSheet >\n </View >\n </>\n );\n};\n"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAlBA;IAoBYA,W;;;WAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,2BAAAA,W;;IA8BPC,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,MAAMF,sBAAsB,CAAC,KAAD,CAHvC;IAIE,MAAM,EAAE,MAAMA,sBAAsB,CAAC,IAAD,CAJtC;IAKE,mBAAmB,EAAE,MAAM+E,mBAAmB,EALhD;IAME,6BAA6B,EAAEvE,WAAW,KAAKZ,WAAW,CAACkF;EAN7D,GAQG7D,WAAW,IAAI+D,qBAAqB,EARvC,CAJF,CADF,CADF;AAmBD,CA5LM"}
@@ -5,16 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.resetHtml = exports.renderingBottomSheetRequest = exports.handleHtmlFullHeight = exports.getBottomSheetScript = void 0;
7
7
 
8
- var _unitMessages = require("../../messages/webMessages/unitMessages");
8
+ var _bodyScript = require("./../../scripts/html/bodyScript");
9
9
 
10
10
  var _UNBottomSheetComponent = require("./UNBottomSheetComponent.constants");
11
11
 
12
12
  const getBottomSheetScript = () => {
13
- return `
14
- window.addEventListener("${_unitMessages.UnitMessage.UNIT_REQUEST_REFRESH}", (e) => {
15
- postMessageToSDK({ type: "${_unitMessages.UnitMessage.UNIT_REQUEST_REFRESH}", details: e.detail })
16
- });
17
- `;
13
+ return _bodyScript.LISTENERS.requestRefresh;
18
14
  };
19
15
 
20
16
  exports.getBottomSheetScript = getBottomSheetScript;
@@ -22,7 +18,7 @@ exports.getBottomSheetScript = getBottomSheetScript;
22
18
  const renderingBottomSheetRequest = (currentWebView, renderingRequest) => {
23
19
  currentWebView === null || currentWebView === void 0 ? void 0 : currentWebView.injectJavaScript(`
24
20
  document.activeElement && document.activeElement.blur();
25
- dispatchRenderingEvent('${renderingRequest}');
21
+ dispatchRenderingEvent('${JSON.stringify(renderingRequest.data)}');
26
22
  `);
27
23
  };
28
24
 
@@ -38,7 +34,7 @@ const resetHtml = currentWebView => {
38
34
  exports.resetHtml = resetHtml;
39
35
 
40
36
  const handleHtmlFullHeight = (currentWebView, windowHeight) => {
41
- const bottomSheetHeight = windowHeight * _UNBottomSheetComponent.BOTTOM_SHEET_MAX_PRECANTAGE_SIZE;
37
+ const bottomSheetHeight = windowHeight * _UNBottomSheetComponent.BOTTOM_SHEET_MAX_PERCENTAGE_SIZE;
42
38
  currentWebView && (currentWebView === null || currentWebView === void 0 ? void 0 : currentWebView.injectJavaScript(`
43
39
  document.getElementById('webViewContainer').style.height = '${bottomSheetHeight}px';
44
40
  `));
@@ -1 +1 @@
1
- {"version":3,"names":["getBottomSheetScript","UnitMessage","UNIT_REQUEST_REFRESH","renderingBottomSheetRequest","currentWebView","renderingRequest","injectJavaScript","resetHtml","handleHtmlFullHeight","windowHeight","bottomSheetHeight","BOTTOM_SHEET_MAX_PRECANTAGE_SIZE"],"sources":["UNBottomSheetComponent.utils.ts"],"sourcesContent":["import type WebView from 'react-native-webview';\nimport { UnitMessage } from '../../messages/webMessages/unitMessages';\nimport { BOTTOM_SHEET_MAX_PRECANTAGE_SIZE } from './UNBottomSheetComponent.constants';\n\nexport const getBottomSheetScript = () => {\n return `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_REFRESH}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_REFRESH}\", details: e.detail })\n });\n `;\n};\n\nexport const renderingBottomSheetRequest = (currentWebView: WebView, renderingRequest: string) => {\n currentWebView?.injectJavaScript(`\n document.activeElement && document.activeElement.blur();\n dispatchRenderingEvent('${renderingRequest}');\n `);\n};\n\nexport const resetHtml = (currentWebView: WebView) => {\n currentWebView?.injectJavaScript(`\n document.activeElement && document.activeElement.blur();\n document.getElementById('webViewContainer').style.height = null;\n `);\n};\n\nexport const handleHtmlFullHeight = (currentWebView: WebView | null, windowHeight: number) => {\n const bottomSheetHeight = windowHeight * BOTTOM_SHEET_MAX_PRECANTAGE_SIZE;\n currentWebView && currentWebView?.injectJavaScript(`\n document.getElementById('webViewContainer').style.height = '${bottomSheetHeight}px';\n `);\n\n return bottomSheetHeight;\n};\n"],"mappings":";;;;;;;AACA;;AACA;;AAEO,MAAMA,oBAAoB,GAAG,MAAM;EACxC,OAAQ;AACV,+BAA+BC,yBAAA,CAAYC,oBAAqB;AAChE,kCAAkCD,yBAAA,CAAYC,oBAAqB;AACnE;AACA,GAJE;AAKD,CANM;;;;AAQA,MAAMC,2BAA2B,GAAG,CAACC,cAAD,EAA0BC,gBAA1B,KAAuD;EAChGD,cAAc,SAAd,IAAAA,cAAc,WAAd,YAAAA,cAAc,CAAEE,gBAAhB,CAAkC;AACpC;AACA,8BAA8BD,gBAAiB;AAC/C,GAHE;AAID,CALM;;;;AAOA,MAAME,SAAS,GAAIH,cAAD,IAA6B;EACpDA,cAAc,SAAd,IAAAA,cAAc,WAAd,YAAAA,cAAc,CAAEE,gBAAhB,CAAkC;AACpC;AACA;AACA,GAHE;AAID,CALM;;;;AAOA,MAAME,oBAAoB,GAAG,CAACJ,cAAD,EAAiCK,YAAjC,KAA0D;EAC5F,MAAMC,iBAAiB,GAAGD,YAAY,GAAGE,wDAAzC;EACAP,cAAc,KAAIA,cAAJ,aAAIA,cAAJ,uBAAIA,cAAc,CAAEE,gBAAhB,CAAkC;AACtD,kEAAkEI,iBAAkB;AACpF,GAFoB,CAAJ,CAAd;EAIA,OAAOA,iBAAP;AACD,CAPM"}
1
+ {"version":3,"names":["getBottomSheetScript","LISTENERS","requestRefresh","renderingBottomSheetRequest","currentWebView","renderingRequest","injectJavaScript","JSON","stringify","data","resetHtml","handleHtmlFullHeight","windowHeight","bottomSheetHeight","BOTTOM_SHEET_MAX_PERCENTAGE_SIZE"],"sources":["UNBottomSheetComponent.utils.ts"],"sourcesContent":["import { LISTENERS } from './../../scripts/html/bodyScript';\nimport type WebView from 'react-native-webview';\nimport { BOTTOM_SHEET_MAX_PERCENTAGE_SIZE } from './UNBottomSheetComponent.constants';\nimport type { RequestRenderingEvent } from '../../messages/webMessages/unitMessages';\n\nexport const getBottomSheetScript = () => {\n return LISTENERS.requestRefresh;\n};\n\nexport const renderingBottomSheetRequest = (currentWebView: WebView, renderingRequest: RequestRenderingEvent) => {\n currentWebView?.injectJavaScript(`\n document.activeElement && document.activeElement.blur();\n dispatchRenderingEvent('${JSON.stringify(renderingRequest.data)}');\n `);\n};\n\nexport const resetHtml = (currentWebView: WebView) => {\n currentWebView?.injectJavaScript(`\n document.activeElement && document.activeElement.blur();\n document.getElementById('webViewContainer').style.height = null;\n `);\n};\n\nexport const handleHtmlFullHeight = (currentWebView: WebView | null, windowHeight: number) => {\n const bottomSheetHeight = windowHeight * BOTTOM_SHEET_MAX_PERCENTAGE_SIZE;\n currentWebView && currentWebView?.injectJavaScript(`\n document.getElementById('webViewContainer').style.height = '${bottomSheetHeight}px';\n `);\n\n return bottomSheetHeight;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAGO,MAAMA,oBAAoB,GAAG,MAAM;EACxC,OAAOC,qBAAA,CAAUC,cAAjB;AACD,CAFM;;;;AAIA,MAAMC,2BAA2B,GAAG,CAACC,cAAD,EAA0BC,gBAA1B,KAAsE;EAC/GD,cAAc,SAAd,IAAAA,cAAc,WAAd,YAAAA,cAAc,CAAEE,gBAAhB,CAAkC;AACpC;AACA,8BAA8BC,IAAI,CAACC,SAAL,CAAeH,gBAAgB,CAACI,IAAhC,CAAsC;AACpE,GAHE;AAID,CALM;;;;AAOA,MAAMC,SAAS,GAAIN,cAAD,IAA6B;EACpDA,cAAc,SAAd,IAAAA,cAAc,WAAd,YAAAA,cAAc,CAAEE,gBAAhB,CAAkC;AACpC;AACA;AACA,GAHE;AAID,CALM;;;;AAOA,MAAMK,oBAAoB,GAAG,CAACP,cAAD,EAAiCQ,YAAjC,KAA0D;EAC5F,MAAMC,iBAAiB,GAAGD,YAAY,GAAGE,wDAAzC;EACAV,cAAc,KAAIA,cAAJ,aAAIA,cAAJ,uBAAIA,cAAc,CAAEE,gBAAhB,CAAkC;AACtD,kEAAkEO,iBAAkB;AACpF,GAFoB,CAAJ,CAAd;EAIA,OAAOA,iBAAP;AACD,CAPM"}