react-native-unit-components 1.7.1 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +2 -1
  2. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  3. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js +2 -1
  4. package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
  5. package/lib/commonjs/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
  6. package/lib/commonjs/scripts/html/fontFaces.js +56 -0
  7. package/lib/commonjs/scripts/html/fontFaces.js.map +1 -0
  8. package/lib/commonjs/styles/fonts.js +71 -0
  9. package/lib/commonjs/styles/fonts.js.map +1 -0
  10. package/lib/commonjs/types/shared/fonts.types.js +20 -0
  11. package/lib/commonjs/types/shared/fonts.types.js.map +1 -0
  12. package/lib/commonjs/types/shared/index.js +22 -0
  13. package/lib/commonjs/types/shared/index.js.map +1 -1
  14. package/lib/commonjs/unitSdkManager/UnitSdkManager.js +6 -1
  15. package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -1
  16. package/lib/commonjs/webComponent/WebComponent.js +4 -1
  17. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  18. package/lib/commonjs/webComponent/html.js +11 -2
  19. package/lib/commonjs/webComponent/html.js.map +1 -1
  20. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +2 -1
  21. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
  22. package/lib/module/components/UNCardComponent/UNCardComponent.js +2 -1
  23. package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
  24. package/lib/module/helpers/pushProvisioningService/hooks/useCardWallet.js.map +1 -1
  25. package/lib/module/scripts/html/fontFaces.js +49 -0
  26. package/lib/module/scripts/html/fontFaces.js.map +1 -0
  27. package/lib/module/styles/fonts.js +64 -0
  28. package/lib/module/styles/fonts.js.map +1 -0
  29. package/lib/module/types/shared/fonts.types.js +13 -0
  30. package/lib/module/types/shared/fonts.types.js.map +1 -0
  31. package/lib/module/types/shared/index.js +2 -0
  32. package/lib/module/types/shared/index.js.map +1 -1
  33. package/lib/module/unitSdkManager/UnitSdkManager.js +6 -1
  34. package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -1
  35. package/lib/module/webComponent/WebComponent.js +4 -1
  36. package/lib/module/webComponent/WebComponent.js.map +1 -1
  37. package/lib/module/webComponent/html.js +11 -2
  38. package/lib/module/webComponent/html.js.map +1 -1
  39. package/lib/typescript/scripts/html/fontFaces.d.ts +2 -0
  40. package/lib/typescript/styles/fonts.d.ts +1 -0
  41. package/lib/typescript/types/shared/fonts.types.d.ts +23 -0
  42. package/lib/typescript/types/shared/index.d.ts +2 -0
  43. package/lib/typescript/unitSdkManager/UnitSdkManager.d.ts +4 -1
  44. package/lib/typescript/webComponent/html.d.ts +1 -0
  45. package/package.json +1 -20
  46. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +2 -1
  47. package/src/components/UNCardComponent/UNCardComponent.tsx +1 -1
  48. package/src/helpers/pushProvisioningService/hooks/useCardWallet.ts +2 -2
  49. package/src/scripts/html/fontFaces.ts +56 -0
  50. package/src/styles/fonts.ts +70 -0
  51. package/src/types/shared/fonts.types.ts +28 -0
  52. package/src/types/shared/index.ts +2 -0
  53. package/src/unitSdkManager/UnitSdkManager.ts +9 -1
  54. package/src/webComponent/WebComponent.tsx +6 -1
  55. package/src/webComponent/html.ts +11 -2
  56. package/android/src/main/res/drawable/ic_launcher_background.xml +0 -170
  57. package/android/src/main/res/drawable/un_ic_launcher_foreground.xml +0 -30
  58. package/android/src/main/res/drawable-v24/ic_launcher_background.xml +0 -170
  59. package/android/src/main/res/drawable-v24/un_ic_launcher_foreground.xml +0 -30
  60. package/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  61. package/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
  62. package/android/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  63. package/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  64. package/android/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  65. package/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  66. package/android/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  67. package/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  68. package/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  69. package/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  70. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  71. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
@@ -11,6 +11,7 @@ import { fetchUnitScript, globalUnitScript } from '../unitSdkManager/UnitSdk.api
11
11
  import { UnitSDK } from '../unitSdkManager/UnitSdkManager';
12
12
  import { SDKMessage } from '../messages/nativeMessages/sdkMessage';
13
13
  import { handleRequestDownload } from './WebComponent.utils';
14
+ import { getFontFacesString } from '../scripts/html/fontFaces';
14
15
  const {
15
16
  UNAppInfo
16
17
  } = NativeModules;
@@ -61,7 +62,9 @@ export const WebComponent = /*#__PURE__*/React.forwardRef(function WebComponent(
61
62
  const themeParam = componentCurrentTheme ? ` theme="${componentCurrentTheme}"` : '';
62
63
  const languageParam = componentCurrentLanguage ? ` language="${componentCurrentLanguage}"` : '';
63
64
  const componentParams = (props.params || '') + themeParam + languageParam;
65
+ const fontFaces = getFontFacesString(UnitSDK.getFonts());
64
66
  let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));
67
+ newHtml = newHtml.replace(HTML_PLACEHOLDER.FONT_FACES, fontFaces);
65
68
  newHtml = newHtml.replace(HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');
66
69
  newHtml = newHtml.replace(HTML_PLACEHOLDER.WINDOW_PARAMS, props.windowParams || '');
67
70
  setSourceHtml(newHtml);
@@ -110,7 +113,7 @@ export const WebComponent = /*#__PURE__*/React.forwardRef(function WebComponent(
110
113
  },
111
114
  source: {
112
115
  html: sourceHtml,
113
- baseUrl: `https://${baseName}`
116
+ baseUrl: Platform.OS === 'android' ? `https://${baseName}` : ''
114
117
  },
115
118
  onMessage: onMessage,
116
119
  androidHardwareAccelerationDisabled: true
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useState","NativeModules","Platform","WebView","EventBus","html","HTML_PLACEHOLDER","UnitMessage","useListenerToBus","getHtmlBody","fetchUnitScript","globalUnitScript","UnitSDK","SDKMessage","handleRequestDownload","UNAppInfo","WebComponent","forwardRef","props","webRef","unitScript","setUnitScript","sourceHtml","setSourceHtml","componentCurrentTheme","setComponentCurrentTheme","theme","getTheme","componentCurrentLanguage","setComponentCurrentLanguage","language","getLanguage","baseName","setBaseName","updateUnitScript","data","updateInitializedParams","busEventKey","IS_SCRIPT_FETCHED","action","IS_SDK_INITIALIZED","getAppName","OS","name","getBundleName","replace","error","console","themeParam","languageParam","componentParams","params","newHtml","BODY","type","valueOf","presentationMode","SCRIPT_FROM_NATIVE","script","WINDOW_PARAMS","windowParams","onMessage","e","message","JSON","parse","nativeEvent","UNIT_REQUEST_REFRESH","details","Instance","event","UNIT_REQUEST_DOWNLOAD","UNIT_REQUEST_CLOSE_FLOW","_onScroll","handleScroll","createElement","ref","originWhitelist","mediaPlaybackRequiresUserAction","allowsInlineMediaPlayback","cacheEnabled","scrollEnabled","isScrollable","nestedScrollEnabled","onScroll","overScrollMode","injectedJavaScript","style","width","flex","opacity","backgroundColor","source","baseUrl","androidHardwareAccelerationDisabled"],"sources":["WebComponent.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useState } from 'react';\nimport { NativeModules, Platform } from 'react-native';\nimport { WebView, WebViewMessageEvent } from 'react-native-webview';\nimport EventBus from '../helpers/EventBus';\nimport html, { HTML_PLACEHOLDER } from './html';\nimport { RequestRefreshEvent, UnitMessage, RequestDownloadEvent } from '../messages/webMessages/unitMessages';\nimport { useListenerToBus } from '../hooks/listenerToBus';\nimport { getHtmlBody } from '../scripts/html/bodyHtml';\nimport { fetchUnitScript, globalUnitScript } from '../unitSdkManager/UnitSdk.api';\nimport { UnitSDK } from '../unitSdkManager/UnitSdkManager';\nimport type { WebViewMessage } from '../messages/webMessages';\nimport { SDKMessage, SdkScriptFetched } from '../messages/nativeMessages/sdkMessage';\nimport { handleRequestDownload } from './WebComponent.utils';\nimport type { PresentationMode, WebComponentType } from '../types/internal/webComponent.types';\n\nconst { UNAppInfo } = NativeModules;\n\nexport interface WebComponentProps {\n type: WebComponentType;\n presentationMode?: PresentationMode,\n params?: string;\n theme?: string;\n language?: string;\n onMessage?: (message: WebViewMessage) => void;\n script?: string;\n isScrollable?: boolean,\n nestedScrollEnabled?: boolean,\n handleScroll?: (event: any) => void,\n windowParams?: string;\n}\n\nexport const WebComponent = React.forwardRef<WebView, WebComponentProps>(function WebComponent(props, webRef) {\n const [unitScript, setUnitScript] = useState<string | undefined>(globalUnitScript);\n const [sourceHtml, setSourceHtml] = useState<string | null>(null);\n const [componentCurrentTheme, setComponentCurrentTheme] = useState<string | undefined>(props.theme ?? UnitSDK.getTheme());\n const [componentCurrentLanguage, setComponentCurrentLanguage] = useState<string | undefined>(props.language ?? UnitSDK.getLanguage());\n const [baseName, setBaseName] = useState<string>();\n\n const updateUnitScript = (data: SdkScriptFetched) => {\n setUnitScript(data.unitScript);\n };\n\n const updateInitializedParams = () => {\n setComponentCurrentTheme(props.theme ?? UnitSDK.getTheme());\n setComponentCurrentLanguage(props.language ?? UnitSDK.getLanguage());\n };\n\n useListenerToBus({ busEventKey: SDKMessage.IS_SCRIPT_FETCHED, action: updateUnitScript });\n useListenerToBus({ busEventKey: SDKMessage.IS_SDK_INITIALIZED, action: updateInitializedParams });\n\n useEffect(() => {\n\n const getAppName = async () => {\n // For iOS, we extend the app name from the HTML to display a prettier access request message.\n // On Android, there is no request message sent from HTML.\n try {\n if (Platform.OS == 'ios') {\n const name = await UNAppInfo.getBundleName();\n setBaseName(name.replace(/ /g, '-'));\n } else { // android\n setBaseName('unit');\n }\n } catch (error: any) {\n console.error(error);\n }\n };\n\n getAppName();\n }, []);\n\n useEffect(() => {\n if (!unitScript) {\n fetchUnitScript();\n return;\n }\n\n const themeParam = componentCurrentTheme ? ` theme=\"${componentCurrentTheme}\"` : '';\n const languageParam = componentCurrentLanguage ? ` language=\"${componentCurrentLanguage}\"` : '';\n\n const componentParams = (props.params || '') + themeParam + languageParam;\n let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));\n newHtml = newHtml.replace(HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');\n newHtml = newHtml.replace(HTML_PLACEHOLDER.WINDOW_PARAMS, props.windowParams || '');\n setSourceHtml(newHtml);\n }, [props.params, unitScript, props.presentationMode, componentCurrentTheme, componentCurrentLanguage, props.script, props.windowParams]);\n\n const onMessage = (e: WebViewMessageEvent) => {\n const message = JSON.parse(e.nativeEvent.data) as WebViewMessage;\n switch (message.type) {\n case UnitMessage.UNIT_REQUEST_REFRESH:\n message.details &&\n EventBus.Instance.event(UnitMessage.UNIT_REQUEST_REFRESH, message.details as RequestRefreshEvent);\n break;\n case UnitMessage.UNIT_REQUEST_DOWNLOAD:\n message.details &&\n handleRequestDownload(message.details as RequestDownloadEvent, () => {\n EventBus.Instance.event(UnitMessage.UNIT_REQUEST_CLOSE_FLOW, {});\n });\n break;\n default:\n props.onMessage && props.onMessage(message);\n }\n };\n\n if (!sourceHtml) return null;\n\n const _onScroll = (event: any) => {\n if (props.handleScroll) {\n props.handleScroll(event);\n }\n\n return null;\n };\n\n if (!baseName) {\n return null;\n }\n\n return (\n <WebView\n ref={webRef}\n originWhitelist={['*']}\n mediaPlaybackRequiresUserAction={false}\n allowsInlineMediaPlayback={true}\n cacheEnabled={false}\n scrollEnabled={props.isScrollable}\n nestedScrollEnabled={props.nestedScrollEnabled}\n onScroll={_onScroll}\n overScrollMode=\"never\"\n injectedJavaScript={unitScript}\n style={{ width: '100%', flex: 1, opacity: 0.99, backgroundColor: 'transparent' }}\n source={{ html: sourceHtml, baseUrl: `https://${baseName}` }}\n onMessage={onMessage}\n androidHardwareAccelerationDisabled\n />\n );\n});\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,OAAO,QAA6B,sBAAsB;AACnE,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,OAAOC,IAAI,IAAIC,gBAAgB,QAAQ,QAAQ;AAC/C,SAA8BC,WAAW,QAA8B,sCAAsC;AAC7G,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,+BAA+B;AACjF,SAASC,OAAO,QAAQ,kCAAkC;AAE1D,SAASC,UAAU,QAA0B,uCAAuC;AACpF,SAASC,qBAAqB,QAAQ,sBAAsB;AAG5D,MAAM;EAAEC;AAAU,CAAC,GAAGd,aAAa;AAgBnC,OAAO,MAAMe,YAAY,gBAAGlB,KAAK,CAACmB,UAAU,CAA6B,SAASD,YAAYA,CAACE,KAAK,EAAEC,MAAM,EAAE;EAC5G,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGrB,QAAQ,CAAqBW,gBAAgB,CAAC;EAClF,MAAM,CAACW,UAAU,EAAEC,aAAa,CAAC,GAAGvB,QAAQ,CAAgB,IAAI,CAAC;EACjE,MAAM,CAACwB,qBAAqB,EAAEC,wBAAwB,CAAC,GAAGzB,QAAQ,CAAqBkB,KAAK,CAACQ,KAAK,IAAId,OAAO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AO,EAAG,WAAU7D,QAAS;IAAE,CAAE;IAC7D6B,SAAS,EAAEA,SAAU;IACrBiC,mCAAmC;EAAA,EACnC;AAEN,CAAC,CAAC"}
1
+ {"version":3,"names":["React","useEffect","useState","NativeModules","Platform","WebView","EventBus","html","HTML_PLACEHOLDER","UnitMessage","useListenerToBus","getHtmlBody","fetchUnitScript","globalUnitScript","UnitSDK","SDKMessage","handleRequestDownload","getFontFacesString","UNAppInfo","WebComponent","forwardRef","props","webRef","unitScript","setUnitScript","sourceHtml","setSourceHtml","componentCurrentTheme","setComponentCurrentTheme","theme","getTheme","componentCurrentLanguage","setComponentCurrentLanguage","language","getLanguage","baseName","setBaseName","updateUnitScript","data","updateInitializedParams","busEventKey","IS_SCRIPT_FETCHED","action","IS_SDK_INITIALIZED","getAppName","OS","name","getBundleName","replace","error","console","themeParam","languageParam","componentParams","params","fontFaces","getFonts","newHtml","BODY","type","valueOf","presentationMode","FONT_FACES","SCRIPT_FROM_NATIVE","script","WINDOW_PARAMS","windowParams","onMessage","e","message","JSON","parse","nativeEvent","UNIT_REQUEST_REFRESH","details","Instance","event","UNIT_REQUEST_DOWNLOAD","UNIT_REQUEST_CLOSE_FLOW","_onScroll","handleScroll","createElement","ref","originWhitelist","mediaPlaybackRequiresUserAction","allowsInlineMediaPlayback","cacheEnabled","scrollEnabled","isScrollable","nestedScrollEnabled","onScroll","overScrollMode","injectedJavaScript","style","width","flex","opacity","backgroundColor","source","baseUrl","androidHardwareAccelerationDisabled"],"sources":["WebComponent.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useState } from 'react';\nimport { NativeModules, Platform } from 'react-native';\nimport { WebView, WebViewMessageEvent } from 'react-native-webview';\nimport EventBus from '../helpers/EventBus';\nimport html, { HTML_PLACEHOLDER } from './html';\nimport { RequestRefreshEvent, UnitMessage, RequestDownloadEvent } from '../messages/webMessages/unitMessages';\nimport { useListenerToBus } from '../hooks/listenerToBus';\nimport { getHtmlBody } from '../scripts/html/bodyHtml';\nimport { fetchUnitScript, globalUnitScript } from '../unitSdkManager/UnitSdk.api';\nimport { UnitSDK } from '../unitSdkManager/UnitSdkManager';\nimport type { WebViewMessage } from '../messages/webMessages';\nimport { SDKMessage, SdkScriptFetched } from '../messages/nativeMessages/sdkMessage';\nimport { handleRequestDownload } from './WebComponent.utils';\nimport type { PresentationMode, WebComponentType } from '../types/internal/webComponent.types';\nimport { getFontFacesString } from '../scripts/html/fontFaces';\n\nconst { UNAppInfo } = NativeModules;\n\nexport interface WebComponentProps {\n type: WebComponentType;\n presentationMode?: PresentationMode,\n params?: string;\n theme?: string;\n language?: string;\n onMessage?: (message: WebViewMessage) => void;\n script?: string;\n isScrollable?: boolean,\n nestedScrollEnabled?: boolean,\n handleScroll?: (event: any) => void,\n windowParams?: string;\n}\n\nexport const WebComponent = React.forwardRef<WebView, WebComponentProps>(function WebComponent(props, webRef) {\n const [unitScript, setUnitScript] = useState<string | undefined>(globalUnitScript);\n const [sourceHtml, setSourceHtml] = useState<string | null>(null);\n const [componentCurrentTheme, setComponentCurrentTheme] = useState<string | undefined>(props.theme ?? UnitSDK.getTheme());\n const [componentCurrentLanguage, setComponentCurrentLanguage] = useState<string | undefined>(props.language ?? UnitSDK.getLanguage());\n const [baseName, setBaseName] = useState<string>();\n\n const updateUnitScript = (data: SdkScriptFetched) => {\n setUnitScript(data.unitScript);\n };\n\n const updateInitializedParams = () => {\n setComponentCurrentTheme(props.theme ?? UnitSDK.getTheme());\n setComponentCurrentLanguage(props.language ?? UnitSDK.getLanguage());\n };\n\n useListenerToBus({ busEventKey: SDKMessage.IS_SCRIPT_FETCHED, action: updateUnitScript });\n useListenerToBus({ busEventKey: SDKMessage.IS_SDK_INITIALIZED, action: updateInitializedParams });\n\n useEffect(() => {\n\n const getAppName = async () => {\n // For iOS, we extend the app name from the HTML to display a prettier access request message.\n // On Android, there is no request message sent from HTML.\n try {\n if (Platform.OS == 'ios') {\n const name = await UNAppInfo.getBundleName();\n setBaseName(name.replace(/ /g, '-'));\n } else { // android\n setBaseName('unit');\n }\n } catch (error: any) {\n console.error(error);\n }\n };\n\n getAppName();\n }, []);\n\n useEffect(() => {\n if (!unitScript) {\n fetchUnitScript();\n return;\n }\n\n const themeParam = componentCurrentTheme ? ` theme=\"${componentCurrentTheme}\"` : '';\n const languageParam = componentCurrentLanguage ? ` language=\"${componentCurrentLanguage}\"` : '';\n\n const componentParams = (props.params || '') + themeParam + languageParam;\n\n const fontFaces = getFontFacesString(UnitSDK.getFonts());\n\n let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));\n newHtml = newHtml.replace(HTML_PLACEHOLDER.FONT_FACES, fontFaces);\n newHtml = newHtml.replace(HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');\n newHtml = newHtml.replace(HTML_PLACEHOLDER.WINDOW_PARAMS, props.windowParams || '');\n setSourceHtml(newHtml);\n }, [props.params, unitScript, props.presentationMode, componentCurrentTheme, componentCurrentLanguage, props.script, props.windowParams]);\n\n const onMessage = (e: WebViewMessageEvent) => {\n const message = JSON.parse(e.nativeEvent.data) as WebViewMessage;\n switch (message.type) {\n case UnitMessage.UNIT_REQUEST_REFRESH:\n message.details &&\n EventBus.Instance.event(UnitMessage.UNIT_REQUEST_REFRESH, message.details as RequestRefreshEvent);\n break;\n case UnitMessage.UNIT_REQUEST_DOWNLOAD:\n message.details &&\n handleRequestDownload(message.details as RequestDownloadEvent, () => {\n EventBus.Instance.event(UnitMessage.UNIT_REQUEST_CLOSE_FLOW, {});\n });\n break;\n default:\n props.onMessage && props.onMessage(message);\n }\n };\n\n if (!sourceHtml) return null;\n\n const _onScroll = (event: any) => {\n if (props.handleScroll) {\n props.handleScroll(event);\n }\n\n return null;\n };\n\n if (!baseName) {\n return null;\n }\n\n return (\n <WebView\n ref={webRef}\n originWhitelist={['*']}\n mediaPlaybackRequiresUserAction={false}\n allowsInlineMediaPlayback={true}\n cacheEnabled={false}\n scrollEnabled={props.isScrollable}\n nestedScrollEnabled={props.nestedScrollEnabled}\n onScroll={_onScroll}\n overScrollMode=\"never\"\n injectedJavaScript={unitScript}\n style={{ width: '100%', flex: 1, opacity: 0.99, backgroundColor: 'transparent' }}\n source={{ html: sourceHtml, baseUrl: Platform.OS === 'android' ? `https://${baseName}` : ''}}\n onMessage={onMessage}\n androidHardwareAccelerationDisabled\n />\n );\n});\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,OAAO,QAA6B,sBAAsB;AACnE,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,OAAOC,IAAI,IAAIC,gBAAgB,QAAQ,QAAQ;AAC/C,SAA8BC,WAAW,QAA8B,sCAAsC;AAC7G,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,+BAA+B;AACjF,SAASC,OAAO,QAAQ,kCAAkC;AAE1D,SAASC,UAAU,QAA0B,uCAAuC;AACpF,SAASC,qBAAqB,QAAQ,sBAAsB;AAE5D,SAASC,kBAAkB,QAAQ,2BAA2B;AAE9D,MAAM;EAAEC;AAAU,CAAC,GAAGf,aAAa;AAgBnC,OAAO,MAAMgB,YAAY,gBAAGnB,KAAK,CAACoB,UAAU,CAA6B,SAASD,YAAYA,CAACE,KAAK,EAAEC,MAAM,EAAE;EAC5G,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGtB,QAAQ,CAAqBW,gBAAgB,CAAC;EAClF,MAAM,CAACY,UAAU,EAAEC,aAAa,CAAC,GAAGxB,QAAQ,CAAgB,IAAI,CAAC;EACjE,MAAM,CAACyB,qBAAqB,EAAEC,wBAAwB,CAAC,GAAG1B,QAAQ,CAAqBmB,KAAK,CAACQ,KAAK,IAAIf,OAAO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E;MAAEC,KAAK,EAAE,MAAM;MAAEC,IAAI,EAAE,CAAC;MAAEC,OAAO,EAAE,IAAI;MAAEC,eAAe,EAAE;IAAc,CAAE;IACjFC,MAAM,EAAE;MAAE3F,IAAI,EAAEkB,UAAU;MAAE0E,OAAO,EAAE/F,QAAQ,CAACyC,EAAE,KAAK,SAAS,GAAK,WAAUV,QAAS,EAAC,GAAG;IAAE,CAAE;IAC9FgC,SAAS,EAAEA,SAAU;IACrBiC,mCAAmC;EAAA,EACnC;AAEN,CAAC,CAAC"}
@@ -4,7 +4,8 @@ export const HTML_PLACEHOLDER = {
4
4
  SCRIPT_UNIT: '<SCRIPT_UNIT>',
5
5
  BODY: '<BODY_HTML_CODE>',
6
6
  SCRIPT_FROM_NATIVE: '<SCRIPT_FROM_NATIVE>',
7
- WINDOW_PARAMS: '<WINDOW_PARAMS>'
7
+ WINDOW_PARAMS: '<WINDOW_PARAMS>',
8
+ FONT_FACES: '<FONT_FACES>'
8
9
  };
9
10
  const htmlText = `
10
11
  <!DOCTYPE html>
@@ -21,9 +22,17 @@ const htmlText = `
21
22
  ${HTML_PLACEHOLDER.WINDOW_PARAMS}
22
23
  </script>
23
24
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
25
+
26
+ <style type="text/css">
27
+ ${HTML_PLACEHOLDER.FONT_FACES}
28
+
29
+ body {
30
+ margin: 0;
31
+ }
32
+ </style>
24
33
  </head>
25
34
 
26
- <body style="margin: 0;">
35
+ <body>
27
36
  ${HTML_PLACEHOLDER.BODY}
28
37
 
29
38
  <script>
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","DISPATCH_RENDERING_EVENT","LISTENERS","POST_MESSAGE_TO_SDK","POST_PAGE_HEIGHT","DISPATCH_REQUEST_CARD_ACTION","DISPATCH_OPEN_ACTIONS_MENU","DISPATCH_REQUEST_ACCOUNT_ACTION","DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT","HTML_PLACEHOLDER","SCRIPT_UNIT","BODY","SCRIPT_FROM_NATIVE","WINDOW_PARAMS","htmlText","OS","isPageLoaded","onLoad","unitRequestDownload","requestRendering","requestOpenLink","requestCloseFlow","cardActivated","cardStatusChange","unitRequestExternalSdk","unitAccountChanged","unitActivityFiltersChanged"],"sources":["html.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport { DISPATCH_RENDERING_EVENT, LISTENERS, POST_MESSAGE_TO_SDK, POST_PAGE_HEIGHT, DISPATCH_REQUEST_CARD_ACTION, DISPATCH_OPEN_ACTIONS_MENU, DISPATCH_REQUEST_ACCOUNT_ACTION, DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT } from '../scripts/html/bodyScript';\n\nexport const HTML_PLACEHOLDER = {\n SCRIPT_UNIT: '<SCRIPT_UNIT>',\n BODY: '<BODY_HTML_CODE>',\n SCRIPT_FROM_NATIVE: '<SCRIPT_FROM_NATIVE>',\n WINDOW_PARAMS: '<WINDOW_PARAMS>'\n};\n\nconst htmlText = `\n <!DOCTYPE html>\n <html lang=\"en\">\n\n <head lang=\"en\">\n <title>Unit Web SDK Demo</title>\n <script>\n window.UnitMobileSDK = true\n window.UnitMobileSDKConfig = {\n os: \"${Platform.OS}\",\n walletName: \"${Platform.OS === 'ios' ? 'Apple' : 'Google'}\",\n }\n ${HTML_PLACEHOLDER.WINDOW_PARAMS}\n </script>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=0\">\n </head>\n\n <body style=\"margin: 0;\">\n ${HTML_PLACEHOLDER.BODY}\n\n <script>\n ${POST_MESSAGE_TO_SDK}\n\n ${POST_PAGE_HEIGHT}\n\n ${LISTENERS.isPageLoaded}\n\n ${LISTENERS.onLoad}\n\n ${LISTENERS.unitRequestDownload}\n\n ${LISTENERS.requestRendering}\n\n ${LISTENERS.requestOpenLink}\n\n ${LISTENERS.requestCloseFlow}\n\n ${LISTENERS.cardActivated}\n\n ${LISTENERS.cardStatusChange}\n\n ${LISTENERS.unitRequestExternalSdk}\n\n ${LISTENERS.unitAccountChanged}\n\n ${LISTENERS.unitActivityFiltersChanged}\n\n ${DISPATCH_RENDERING_EVENT}\n\n ${DISPATCH_OPEN_ACTIONS_MENU}\n\n ${DISPATCH_REQUEST_CARD_ACTION}\n\n ${DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT}\n\n ${DISPATCH_REQUEST_ACCOUNT_ACTION}\n\n ${HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE}\n </script>\n </body>\n </html>\n`;\n\nexport default htmlText;\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,wBAAwB,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,gBAAgB,EAAEC,4BAA4B,EAAEC,0BAA0B,EAAEC,+BAA+B,EAAEC,sCAAsC,QAAQ,4BAA4B;AAE1P,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,WAAW,EAAE,eAAe;EAC5BC,IAAI,EAAE,kBAAkB;EACxBC,kBAAkB,EAAE,sBAAsB;EAC1CC,aAAa,EAAE;AACjB,CAAC;AAED,MAAMC,QAAQ,GAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAad,QAAQ,CAACe,EAAG;AACzB,qBAAqBf,QAAQ,CAACe,EAAE,KAAK,KAAK,GAAG,OAAO,GAAG,QAAS;AAChE;AACA,MAAMN,gBAAgB,CAACI,aAAc;AACrC;AACA;AACA;AACA;AACA;AACA,MAAMJ,gBAAgB,CAACE,IAAK;AAC5B;AACA;AACA,QAAQR,mBAAoB;AAC5B;AACA,QAAQC,gBAAiB;AACzB;AACA,QAAQF,SAAS,CAACc,YAAa;AAC/B;AACA,QAAQd,SAAS,CAACe,MAAO;AACzB;AACA,QAAQf,SAAS,CAACgB,mBAAoB;AACtC;AACA,QAAQhB,SAAS,CAACiB,gBAAiB;AACnC;AACA,QAAQjB,SAAS,CAACkB,eAAgB;AAClC;AACA,QAAQlB,SAAS,CAACmB,gBAAiB;AACnC;AACA,QAAQnB,SAAS,CAACoB,aAAc;AAChC;AACA,QAAQpB,SAAS,CAACqB,gBAAiB;AACnC;AACA,QAAQrB,SAAS,CAACsB,sBAAuB;AACzC;AACA,QAAQtB,SAAS,CAACuB,kBAAmB;AACrC;AACA,QAAQvB,SAAS,CAACwB,0BAA2B;AAC7C;AACA,QAAQzB,wBAAyB;AACjC;AACA,QAAQK,0BAA2B;AACnC;AACA,QAAQD,4BAA6B;AACrC;AACA,QAAQG,sCAAuC;AAC/C;AACA,QAAQD,+BAAgC;AACxC;AACA,QAAQE,gBAAgB,CAACG,kBAAmB;AAC5C;AACA;AACA;AACA,CAAC;AAED,eAAeE,QAAQ"}
1
+ {"version":3,"names":["Platform","DISPATCH_RENDERING_EVENT","LISTENERS","POST_MESSAGE_TO_SDK","POST_PAGE_HEIGHT","DISPATCH_REQUEST_CARD_ACTION","DISPATCH_OPEN_ACTIONS_MENU","DISPATCH_REQUEST_ACCOUNT_ACTION","DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT","HTML_PLACEHOLDER","SCRIPT_UNIT","BODY","SCRIPT_FROM_NATIVE","WINDOW_PARAMS","FONT_FACES","htmlText","OS","isPageLoaded","onLoad","unitRequestDownload","requestRendering","requestOpenLink","requestCloseFlow","cardActivated","cardStatusChange","unitRequestExternalSdk","unitAccountChanged","unitActivityFiltersChanged"],"sources":["html.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport { DISPATCH_RENDERING_EVENT, LISTENERS, POST_MESSAGE_TO_SDK, POST_PAGE_HEIGHT, DISPATCH_REQUEST_CARD_ACTION, DISPATCH_OPEN_ACTIONS_MENU, DISPATCH_REQUEST_ACCOUNT_ACTION, DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT } from '../scripts/html/bodyScript';\n\nexport const HTML_PLACEHOLDER = {\n SCRIPT_UNIT: '<SCRIPT_UNIT>',\n BODY: '<BODY_HTML_CODE>',\n SCRIPT_FROM_NATIVE: '<SCRIPT_FROM_NATIVE>',\n WINDOW_PARAMS: '<WINDOW_PARAMS>',\n FONT_FACES: '<FONT_FACES>'\n};\n\nconst htmlText = `\n <!DOCTYPE html>\n <html lang=\"en\">\n\n <head lang=\"en\">\n <title>Unit Web SDK Demo</title>\n <script>\n window.UnitMobileSDK = true\n window.UnitMobileSDKConfig = {\n os: \"${Platform.OS}\",\n walletName: \"${Platform.OS === 'ios' ? 'Apple' : 'Google'}\",\n }\n ${HTML_PLACEHOLDER.WINDOW_PARAMS}\n </script>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=0\">\n\n <style type=\"text/css\">\n ${HTML_PLACEHOLDER.FONT_FACES}\n\n body {\n margin: 0;\n }\n </style>\n </head>\n\n <body>\n ${HTML_PLACEHOLDER.BODY}\n\n <script>\n ${POST_MESSAGE_TO_SDK}\n\n ${POST_PAGE_HEIGHT}\n\n ${LISTENERS.isPageLoaded}\n\n ${LISTENERS.onLoad}\n\n ${LISTENERS.unitRequestDownload}\n\n ${LISTENERS.requestRendering}\n\n ${LISTENERS.requestOpenLink}\n\n ${LISTENERS.requestCloseFlow}\n\n ${LISTENERS.cardActivated}\n\n ${LISTENERS.cardStatusChange}\n\n ${LISTENERS.unitRequestExternalSdk}\n\n ${LISTENERS.unitAccountChanged}\n\n ${LISTENERS.unitActivityFiltersChanged}\n\n ${DISPATCH_RENDERING_EVENT}\n\n ${DISPATCH_OPEN_ACTIONS_MENU}\n\n ${DISPATCH_REQUEST_CARD_ACTION}\n\n ${DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT}\n\n ${DISPATCH_REQUEST_ACCOUNT_ACTION}\n\n ${HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE}\n </script>\n </body>\n </html>\n`;\n\nexport default htmlText;\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,wBAAwB,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,gBAAgB,EAAEC,4BAA4B,EAAEC,0BAA0B,EAAEC,+BAA+B,EAAEC,sCAAsC,QAAQ,4B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AeG,QAAQ"}
@@ -0,0 +1,2 @@
1
+ import type { UNFonts } from '../../types/shared/fonts.types';
2
+ export declare const getFontFacesString: (fonts?: UNFonts) => string;
@@ -0,0 +1 @@
1
+ export declare const getFontName: (fontFamily: string, fontWeight: number | string) => string;
@@ -0,0 +1,23 @@
1
+ export type UNFonts = {
2
+ [fontFamily: string]: UNFontData[];
3
+ };
4
+ export type UNFontData = {
5
+ fontWeight: FontWeight;
6
+ sources: UNFontSource[];
7
+ };
8
+ export type UNFontSource = {
9
+ fileName: string;
10
+ assetDirRelativePath: string;
11
+ format?: string;
12
+ };
13
+ export declare enum FontWeight {
14
+ Thin = 100,
15
+ ExtraLight = 200,
16
+ Light = 300,
17
+ Regular = 400,
18
+ Medium = 500,
19
+ SemiBold = 600,
20
+ Bold = 700,
21
+ ExtraBold = 800,
22
+ Black = 900
23
+ }
@@ -5,3 +5,5 @@ export * from './achCredit.types';
5
5
  export * from './payments.types';
6
6
  export * from './account.types';
7
7
  export * from './checkDeposit.types';
8
+ export * from './activity.types';
9
+ export * from './fonts.types';
@@ -1,5 +1,6 @@
1
1
  import type { NativeModules } from 'react-native';
2
2
  import { UnitUiManager } from './unitUiManager/unitUiManager';
3
+ import type { UNFonts } from '../types/shared/fonts.types';
3
4
  export declare enum UNEnvironment {
4
5
  sandbox = "sandbox",
5
6
  production = "production"
@@ -13,16 +14,18 @@ export declare class UnitSDK {
13
14
  protected static customerToken?: string;
14
15
  protected static theme?: string;
15
16
  protected static language?: string;
17
+ protected static fonts?: UNFonts;
16
18
  protected static signedNonce?: string;
17
19
  protected static pushProvisionModule?: typeof NativeModules;
18
20
  static ui: UnitUiManager;
19
- static init: (env: UNEnvironment, theme?: string, language?: string) => Promise<void>;
21
+ static init: (env: UNEnvironment, theme?: string, language?: string, fonts?: UNFonts) => Promise<void>;
20
22
  static setPushProvisioningModule: (pushProvisionModule: typeof NativeModules) => void;
21
23
  static getPushProvisionModule: () => import("react-native").NativeModulesStatic | undefined;
22
24
  static setSignedNonce: (signedNonce: string) => void;
23
25
  static getEnv: () => UNEnvironment | undefined;
24
26
  static getTheme: () => string | undefined;
25
27
  static getLanguage: () => string | undefined;
28
+ static getFonts: () => UNFonts | undefined;
26
29
  static getSignedNonce: () => string | undefined;
27
30
  static setCustomerToken: (customerToken: string) => void;
28
31
  static getCustomerToken: () => string | undefined;
@@ -3,6 +3,7 @@ export declare const HTML_PLACEHOLDER: {
3
3
  BODY: string;
4
4
  SCRIPT_FROM_NATIVE: string;
5
5
  WINDOW_PARAMS: string;
6
+ FONT_FACES: string;
6
7
  };
7
8
  declare const htmlText: string;
8
9
  export default htmlText;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unit-components",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "description": "Unit React Native components",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -26,7 +26,6 @@
26
26
  "typescript": "tsc --noEmit",
27
27
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
28
28
  "prepare": "bob build",
29
- "release": "release-it",
30
29
  "example": "yarn --cwd example",
31
30
  "bootstrap": "yarn example && yarn && yarn example pods"
32
31
  },
@@ -65,7 +64,6 @@
65
64
  "react-native": "0.68.2",
66
65
  "react-native-builder-bob": "^0.18.3",
67
66
  "react-native-webview": "11.23.1",
68
- "release-it": "^15.0.0",
69
67
  "typescript": "^4.5.2"
70
68
  },
71
69
  "resolutions": {
@@ -94,23 +92,6 @@
94
92
  "@commitlint/config-conventional"
95
93
  ]
96
94
  },
97
- "release-it": {
98
- "git": {
99
- "commitMessage": "chore: release ${version}",
100
- "tagName": "v${version}"
101
- },
102
- "npm": {
103
- "publish": true
104
- },
105
- "github": {
106
- "release": true
107
- },
108
- "plugins": {
109
- "@release-it/conventional-changelog": {
110
- "preset": "angular"
111
- }
112
- }
113
- },
114
95
  "eslintConfig": {
115
96
  "root": true,
116
97
  "parser": "@babel/eslint-parser",
@@ -205,7 +205,8 @@ export const UNBottomSheetComponent = () => {
205
205
  injectHtmlFullScreenHeight(webRef.current, fullScreenHeight);
206
206
  setHeight(fullScreenHeight);
207
207
  } else {
208
- setHeight((message.details as HeightEvent).height);
208
+ const height = (message.details as HeightEvent).height;
209
+ setHeight(height < fullScreenHeight ? height : fullScreenHeight);
209
210
  }
210
211
  }
211
212
  };
@@ -133,7 +133,7 @@ export const UNCardComponent = React.forwardRef<CardRef, UNCardComponentProps>(f
133
133
  }, [props.pushProvisioningModule]);
134
134
 
135
135
  return (
136
- <View style={{ height, width: '100%' }}>
136
+ <View style={{ height, width: '100%', minWidth: 235 }}>
137
137
  <WebComponent
138
138
  ref={webRef}
139
139
  type={WebComponentType.card}
@@ -20,7 +20,7 @@ export const useCardWallet = (cardId: string) => {
20
20
  return encryptedPayload;
21
21
  };
22
22
 
23
- const getCardWalletData = async () => {
23
+ const getCardWalletData = async () => {
24
24
  const currentProvisioningModule = UnitSDK.getPushProvisionModule();
25
25
  if (!currentProvisioningModule) return;
26
26
  try {
@@ -46,7 +46,7 @@ export const useCardWallet = (cardId: string) => {
46
46
 
47
47
  };
48
48
 
49
- const parseWalletsResponse = (walletsResponse: string): UNWallet | null => {
49
+ const parseWalletsResponse = (walletsResponse: string): UNWallet | null => {
50
50
  try {
51
51
  const parsedWalletsResponse = JSON.parse(walletsResponse);
52
52
  const wallets = parsedWalletsResponse.wallets;
@@ -0,0 +1,56 @@
1
+ import { Platform } from 'react-native';
2
+ import type { FontWeight, UNFonts, UNFontSource, UNFontData } from '../../types/shared/fonts.types';
3
+
4
+ const getUrl = (source: UNFontSource): string => {
5
+ if (Platform.OS == 'ios') {
6
+ return `url('${source.fileName}')`;
7
+ }
8
+
9
+ // Handle '/' of dir Relative path
10
+ let relativeDirPath = source.assetDirRelativePath;
11
+ if (source.assetDirRelativePath[-1] !== '/') {
12
+ relativeDirPath = `${source.assetDirRelativePath}/`;
13
+ }
14
+ if (source.assetDirRelativePath[0] !== '/') {
15
+ relativeDirPath = `/${source.assetDirRelativePath}`;
16
+ }
17
+
18
+ return `url('file:///android_asset${relativeDirPath}${source.fileName}')`;
19
+ };
20
+ const getFontFace = (fontFamily: string, fontWeight: FontWeight, sources: UNFontSource[]): string => {
21
+ const numOfSources = sources.length;
22
+
23
+ const sourcesString = sources
24
+ .map((source, index) => {
25
+ const suffix = index === numOfSources - 1 ? ';' : ',';
26
+ const url = getUrl(source);
27
+ const format = source?.format ? `format('${source.format}')` : '';
28
+ return `${url} ${format}${suffix}`;
29
+ })
30
+ .join('\n');
31
+
32
+ return `
33
+ @font-face {
34
+ font-family: '${fontFamily}';
35
+ src: ${sourcesString}
36
+ font-weight: ${fontWeight.valueOf()};
37
+ }
38
+ `;
39
+ };
40
+
41
+ export const getFontFacesString = (fonts?: UNFonts): string => {
42
+ if (!fonts) return '';
43
+
44
+ const fontFaces: string[] = [];
45
+
46
+ // Iterate over all the fonts and their variants
47
+ // create font-face for each variant
48
+ Object.entries(fonts).forEach(([familyName, familyFonts]) => {
49
+ familyFonts.forEach((fontData: UNFontData) => {
50
+ fontFaces.push(getFontFace(familyName, fontData.fontWeight, fontData.sources));
51
+ });
52
+ });
53
+
54
+ // Combine all the font faces into a single string
55
+ return fontFaces.join('\n');
56
+ };
@@ -0,0 +1,70 @@
1
+ import { FontWeight, UNFontData } from '../types/shared';
2
+ import { UnitSDK } from '../unitSdkManager/UnitSdkManager';
3
+
4
+ const getFontWeightName = (familyFonts: UNFontData[], fontWeight?: number | string) => {
5
+ /**
6
+ * Given family variants and the required weight
7
+ * Return the closet font that defined by the client.
8
+ */
9
+ if (!fontWeight || fontWeight === 'normal') return 'Regular';
10
+
11
+ if (fontWeight === 'bold') return 'Bold';
12
+
13
+ const fontWeightNumber = Number(fontWeight);
14
+
15
+ // Select the closet variant
16
+ let selectedFontWeight = FontWeight.Regular.valueOf();
17
+ let minDistance = 1000;
18
+
19
+ familyFonts.forEach((fontData: UNFontData) => {
20
+ const currDistance = Math.abs(fontData.fontWeight - fontWeightNumber);
21
+ if (currDistance < minDistance) {
22
+ minDistance = currDistance;
23
+ selectedFontWeight = fontData.fontWeight.valueOf();
24
+ }
25
+ });
26
+
27
+ // FontWeight to String
28
+ switch (selectedFontWeight) {
29
+ case FontWeight.Thin:
30
+ return 'Thin';
31
+ case FontWeight.ExtraLight:
32
+ return 'ExtraLight';
33
+ case FontWeight.Light:
34
+ return 'Light';
35
+ case FontWeight.Regular:
36
+ return 'Regular';
37
+ case FontWeight.Medium:
38
+ return 'Medium';
39
+ case FontWeight.SemiBold:
40
+ return 'SemiBold';
41
+ case FontWeight.Bold:
42
+ return 'Bold';
43
+ case FontWeight.ExtraBold:
44
+ return 'ExtraBold';
45
+ case FontWeight.Black:
46
+ return 'Black';
47
+ default:
48
+ return 'Regular';
49
+ }
50
+ };
51
+
52
+ export const getFontName = (fontFamily: string, fontWeight: number | string): string => {
53
+ /*
54
+ * Get the font family name and the font weight name from the THEME object.
55
+ * Then, return a possible font.
56
+ */
57
+
58
+ const fontsInApp = UnitSDK.getFonts();
59
+ if (!fontsInApp) {
60
+ throw new Error('Fonts are not found in the app');
61
+ }
62
+
63
+ const familyFonts = fontsInApp[fontFamily];
64
+ if (!familyFonts) {
65
+ throw new Error(`Font family ${fontFamily} not found in the app's fonts`);
66
+ }
67
+
68
+ const fontWeightName = getFontWeightName(familyFonts, fontWeight);
69
+ return `${fontFamily}-${fontWeightName}`;
70
+ };
@@ -0,0 +1,28 @@
1
+ export type UNFonts = {
2
+ [fontFamily: string]: UNFontData[];
3
+ }
4
+
5
+ export type UNFontData = {
6
+ // Using 'field' instead of 'key' to account for potential variants unrelated to font weight.
7
+ fontWeight: FontWeight;
8
+ sources: UNFontSource[];
9
+ }
10
+
11
+ export type UNFontSource = {
12
+ // using the fileName for iOS and relative path for Android
13
+ fileName: string;
14
+ assetDirRelativePath: string;
15
+ format?: string;
16
+ }
17
+
18
+ export enum FontWeight {
19
+ Thin = 100,
20
+ ExtraLight = 200,
21
+ Light = 300,
22
+ Regular = 400,
23
+ Medium = 500,
24
+ SemiBold = 600,
25
+ Bold = 700,
26
+ ExtraBold = 800,
27
+ Black = 900
28
+ }
@@ -5,3 +5,5 @@ export * from './achCredit.types';
5
5
  export * from './payments.types';
6
6
  export * from './account.types';
7
7
  export * from './checkDeposit.types';
8
+ export * from './activity.types';
9
+ export * from './fonts.types';
@@ -3,6 +3,7 @@ import EventBus from '../helpers/EventBus';
3
3
  import { SDKMessage } from '../messages/nativeMessages/sdkMessage';
4
4
  import { fetchUnitScript } from './UnitSdk.api';
5
5
  import { UnitUiManager } from './unitUiManager/unitUiManager';
6
+ import type { UNFonts } from '../types/shared/fonts.types';
6
7
 
7
8
  export enum UNEnvironment {
8
9
  sandbox = 'sandbox',
@@ -20,17 +21,20 @@ export class UnitSDK {
20
21
  protected static customerToken?: string;
21
22
  protected static theme?: string;
22
23
  protected static language?: string;
24
+ protected static fonts?: UNFonts;
23
25
 
24
26
  protected static signedNonce?: string;
25
27
  protected static pushProvisionModule?: typeof NativeModules;
26
28
 
27
29
  public static ui: UnitUiManager;
28
30
 
29
- public static init = async (env: UNEnvironment, theme?: string, language?: string) => {
31
+ public static init = async (env: UNEnvironment, theme?: string, language?: string, fonts?: UNFonts) => {
30
32
  try {
31
33
  this.env = env;
32
34
  this.theme = theme;
33
35
  this.language = language;
36
+ this.fonts = fonts;
37
+
34
38
  this.ui = new UnitUiManager();
35
39
  await fetchUnitScript();
36
40
  EventBus.Instance.event(SDKMessage.IS_SDK_INITIALIZED, {});
@@ -63,6 +67,10 @@ export class UnitSDK {
63
67
  return this.language;
64
68
  };
65
69
 
70
+ public static getFonts = () => {
71
+ return this.fonts;
72
+ };
73
+
66
74
  public static getSignedNonce = () => {
67
75
  return this.signedNonce;
68
76
  };
@@ -13,6 +13,7 @@ import type { WebViewMessage } from '../messages/webMessages';
13
13
  import { SDKMessage, SdkScriptFetched } from '../messages/nativeMessages/sdkMessage';
14
14
  import { handleRequestDownload } from './WebComponent.utils';
15
15
  import type { PresentationMode, WebComponentType } from '../types/internal/webComponent.types';
16
+ import { getFontFacesString } from '../scripts/html/fontFaces';
16
17
 
17
18
  const { UNAppInfo } = NativeModules;
18
19
 
@@ -79,7 +80,11 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
79
80
  const languageParam = componentCurrentLanguage ? ` language="${componentCurrentLanguage}"` : '';
80
81
 
81
82
  const componentParams = (props.params || '') + themeParam + languageParam;
83
+
84
+ const fontFaces = getFontFacesString(UnitSDK.getFonts());
85
+
82
86
  let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));
87
+ newHtml = newHtml.replace(HTML_PLACEHOLDER.FONT_FACES, fontFaces);
83
88
  newHtml = newHtml.replace(HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');
84
89
  newHtml = newHtml.replace(HTML_PLACEHOLDER.WINDOW_PARAMS, props.windowParams || '');
85
90
  setSourceHtml(newHtml);
@@ -130,7 +135,7 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
130
135
  overScrollMode="never"
131
136
  injectedJavaScript={unitScript}
132
137
  style={{ width: '100%', flex: 1, opacity: 0.99, backgroundColor: 'transparent' }}
133
- source={{ html: sourceHtml, baseUrl: `https://${baseName}` }}
138
+ source={{ html: sourceHtml, baseUrl: Platform.OS === 'android' ? `https://${baseName}` : ''}}
134
139
  onMessage={onMessage}
135
140
  androidHardwareAccelerationDisabled
136
141
  />
@@ -5,7 +5,8 @@ export const HTML_PLACEHOLDER = {
5
5
  SCRIPT_UNIT: '<SCRIPT_UNIT>',
6
6
  BODY: '<BODY_HTML_CODE>',
7
7
  SCRIPT_FROM_NATIVE: '<SCRIPT_FROM_NATIVE>',
8
- WINDOW_PARAMS: '<WINDOW_PARAMS>'
8
+ WINDOW_PARAMS: '<WINDOW_PARAMS>',
9
+ FONT_FACES: '<FONT_FACES>'
9
10
  };
10
11
 
11
12
  const htmlText = `
@@ -23,9 +24,17 @@ const htmlText = `
23
24
  ${HTML_PLACEHOLDER.WINDOW_PARAMS}
24
25
  </script>
25
26
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
27
+
28
+ <style type="text/css">
29
+ ${HTML_PLACEHOLDER.FONT_FACES}
30
+
31
+ body {
32
+ margin: 0;
33
+ }
34
+ </style>
26
35
  </head>
27
36
 
28
- <body style="margin: 0;">
37
+ <body>
29
38
  ${HTML_PLACEHOLDER.BODY}
30
39
 
31
40
  <script>