react-native-unit-components 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/android/src/main/java/com/unitreactnativecomponents/nativeModules/appInfo/UNAppInfoModule.kt +6 -0
  2. package/ios/NativeModules/UNAppInfo/UNAppInfoExportModule.m +1 -0
  3. package/ios/NativeModules/UNAppInfo/UNAppInfoModule.swift +17 -0
  4. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +5 -5
  5. package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  6. package/lib/commonjs/components/UNMultiFactorAuthenticationComponent/UNMultiFactorAuthenticationComponent.js +1 -1
  7. package/lib/commonjs/components/UNMultiFactorAuthenticationComponent/UNMultiFactorAuthenticationComponent.js.map +1 -1
  8. package/lib/commonjs/nativeModulesHelpers/UNFontFileHelper/UNFontFileHelper.js +30 -0
  9. package/lib/commonjs/nativeModulesHelpers/UNFontFileHelper/UNFontFileHelper.js.map +1 -0
  10. package/lib/commonjs/scripts/html/bodyScript.js +15 -6
  11. package/lib/commonjs/scripts/html/bodyScript.js.map +1 -1
  12. package/lib/commonjs/scripts/html/fontFaces.js +23 -5
  13. package/lib/commonjs/scripts/html/fontFaces.js.map +1 -1
  14. package/lib/commonjs/types/internal/unitStore.types.js +2 -1
  15. package/lib/commonjs/types/internal/unitStore.types.js.map +1 -1
  16. package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdk.constants.js +1 -1
  17. package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdkManager.js +8 -2
  18. package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdkManager.js.map +1 -1
  19. package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdkManager.utils.internal.js +2 -2
  20. package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdkManager.utils.internal.js.map +1 -1
  21. package/lib/commonjs/utils/AppInfo.js.map +1 -1
  22. package/lib/commonjs/webComponent/WebComponent.js +8 -6
  23. package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
  24. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +5 -5
  25. package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -1
  26. package/lib/module/components/UNMultiFactorAuthenticationComponent/UNMultiFactorAuthenticationComponent.js +1 -1
  27. package/lib/module/components/UNMultiFactorAuthenticationComponent/UNMultiFactorAuthenticationComponent.js.map +1 -1
  28. package/lib/module/nativeModulesHelpers/UNFontFileHelper/UNFontFileHelper.js +22 -0
  29. package/lib/module/nativeModulesHelpers/UNFontFileHelper/UNFontFileHelper.js.map +1 -0
  30. package/lib/module/scripts/html/bodyScript.js +15 -6
  31. package/lib/module/scripts/html/bodyScript.js.map +1 -1
  32. package/lib/module/scripts/html/fontFaces.js +23 -5
  33. package/lib/module/scripts/html/fontFaces.js.map +1 -1
  34. package/lib/module/types/internal/unitStore.types.js +2 -1
  35. package/lib/module/types/internal/unitStore.types.js.map +1 -1
  36. package/lib/module/unitComponentsSdkManager/UnitComponentsSdk.constants.js +1 -1
  37. package/lib/module/unitComponentsSdkManager/UnitComponentsSdkManager.js +8 -2
  38. package/lib/module/unitComponentsSdkManager/UnitComponentsSdkManager.js.map +1 -1
  39. package/lib/module/unitComponentsSdkManager/UnitComponentsSdkManager.utils.internal.js +2 -2
  40. package/lib/module/unitComponentsSdkManager/UnitComponentsSdkManager.utils.internal.js.map +1 -1
  41. package/lib/module/utils/AppInfo.js.map +1 -1
  42. package/lib/module/webComponent/WebComponent.js +8 -6
  43. package/lib/module/webComponent/WebComponent.js.map +1 -1
  44. package/lib/typescript/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts.map +1 -1
  45. package/lib/typescript/src/messages/webMessages/unitComponentsMessages.d.ts +2 -1
  46. package/lib/typescript/src/messages/webMessages/unitComponentsMessages.d.ts.map +1 -1
  47. package/lib/typescript/src/nativeModulesHelpers/UNFontFileHelper/UNFontFileHelper.d.ts +3 -0
  48. package/lib/typescript/src/nativeModulesHelpers/UNFontFileHelper/UNFontFileHelper.d.ts.map +1 -0
  49. package/lib/typescript/src/scripts/html/bodyScript.d.ts.map +1 -1
  50. package/lib/typescript/src/scripts/html/fontFaces.d.ts +1 -1
  51. package/lib/typescript/src/scripts/html/fontFaces.d.ts.map +1 -1
  52. package/lib/typescript/src/types/internal/unitStore.types.d.ts +2 -1
  53. package/lib/typescript/src/types/internal/unitStore.types.d.ts.map +1 -1
  54. package/lib/typescript/src/unitComponentsSdkManager/UnitComponentsSdkManager.d.ts +1 -0
  55. package/lib/typescript/src/unitComponentsSdkManager/UnitComponentsSdkManager.d.ts.map +1 -1
  56. package/lib/typescript/src/utils/AppInfo.d.ts +1 -0
  57. package/lib/typescript/src/utils/AppInfo.d.ts.map +1 -1
  58. package/lib/typescript/src/webComponent/WebComponent.d.ts.map +1 -1
  59. package/package.json +1 -1
  60. package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +5 -6
  61. package/src/components/UNMultiFactorAuthenticationComponent/UNMultiFactorAuthenticationComponent.tsx +1 -1
  62. package/src/messages/webMessages/unitComponentsMessages.ts +2 -1
  63. package/src/nativeModulesHelpers/UNFontFileHelper/UNFontFileHelper.ts +24 -0
  64. package/src/scripts/html/bodyScript.ts +15 -6
  65. package/src/scripts/html/fontFaces.ts +20 -5
  66. package/src/types/internal/unitStore.types.ts +2 -1
  67. package/src/unitComponentsSdkManager/UnitComponentsSdk.constants.ts +1 -1
  68. package/src/unitComponentsSdkManager/UnitComponentsSdkManager.ts +8 -2
  69. package/src/unitComponentsSdkManager/UnitComponentsSdkManager.utils.internal.ts +2 -2
  70. package/src/utils/AppInfo.ts +1 -0
  71. package/src/webComponent/WebComponent.tsx +8 -6
@@ -1 +1 @@
1
- {"version":3,"file":"unitStore.types.d.ts","sourceRoot":"","sources":["../../../../../src/types/internal/unitStore.types.ts"],"names":[],"mappings":"AAEA,oBAAY,YAAY;IACtB,iBAAiB,sBAAsB;IACvC,iBAAiB,8BAA8B;CAChD"}
1
+ {"version":3,"file":"unitStore.types.d.ts","sourceRoot":"","sources":["../../../../../src/types/internal/unitStore.types.ts"],"names":[],"mappings":"AAEA,oBAAY,YAAY;IACtB,iBAAiB,sBAAsB;IACvC,yBAAyB,8BAA8B;IACvD,gCAAgC,sBAAsB;CACvD"}
@@ -15,6 +15,7 @@ export declare class UnitComponentsSDK {
15
15
  protected static signedNonce?: string;
16
16
  protected static pushProvisionModule?: typeof NativeModules;
17
17
  protected static sdkVersion: string;
18
+ static iosFontBase64Map: Record<string, string>;
18
19
  static init: (env: UNComponentsEnvironment, theme?: string, language?: string, fonts?: UNFonts, webVersioningStrategy?: UNComponentsWebVersioningStrategy, securitySettings?: UNComponentsSecuritySettings) => Promise<void>;
19
20
  static isInitialized: () => boolean;
20
21
  static setPushProvisioningModule: (pushProvisionModule?: typeof NativeModules) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"UnitComponentsSdkManager.d.ts","sourceRoot":"","sources":["../../../../src/unitComponentsSdkManager/UnitComponentsSdkManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAY,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAGzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6DAA6D,CAAC;AAE3G,OAAO,EAAE,4BAA4B,EAA0C,MAAM,kCAAkC,CAAC;AAGxH,qBAAa,iBAAiB;IAC5B,OAAc,EAAE,EAAE,uBAAuB,CAAC;IAC1C,OAAc,OAAO,EAAE,4BAA4B,CAAC;IAEpD,SAAS,CAAC,MAAM,C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,OAAc,aAAa,aAIzB;CAEH"}
@@ -4,6 +4,7 @@ interface Spec extends TurboModule {
4
4
  getVersion(): string;
5
5
  getBuildNumber(): string;
6
6
  getAppIdentifier(): string;
7
+ readFontFileAsBase64(fileName: string): string;
7
8
  }
8
9
  declare const _default: Spec;
9
10
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"AppInfo.d.ts","sourceRoot":"","sources":["../../../../src/utils/AppInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAuB,MAAM,cAAc,CAAC;AAEhE,UAAU,IAAK,SAAQ,WAAW;IAChC,UAAU,IAAI,MAAM,CAAA;IACpB,UAAU,IAAI,MAAM,CAAA;IACpB,cAAc,IAAI,MAAM,CAAA;IACxB,gBAAgB,IAAI,MAAM,CAAA;CAC3B;;AAED,wBAAyE"}
1
+ {"version":3,"file":"AppInfo.d.ts","sourceRoot":"","sources":["../../../../src/utils/AppInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAuB,MAAM,cAAc,CAAC;AAEhE,UAAU,IAAK,SAAQ,WAAW;IAChC,UAAU,IAAI,MAAM,CAAA;IACpB,UAAU,IAAI,MAAM,CAAA;IACpB,cAAc,IAAI,MAAM,CAAA;IACxB,gBAAgB,IAAI,MAAM,CAAA;IAC1B,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAC/C;;AAED,wBAAyE"}
@@ -1 +1 @@
1
- {"version":3,"file":"WebComponent.d.ts","sourceRoot":"","sources":["../../../../src/webComponent/WebComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAGhF,OAAO,EAAE,OAAO,EAAuB,MAAM,sBAAsB,CAAC;AAapE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAU1F,MAAM,WAAW,iBAAiB;IAChC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AE,GAAG,KAAK,IAAI,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,uFAqLvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unit-components",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "Unit React Native components",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -270,15 +270,14 @@ export const getNativeComponentDataFromEvent = (event: BottomSheetSlotData) => {
270
270
  let nativePlace = BottomSheetNativePlaceType.modal;
271
271
  const requestRenderingEventData = event.requestRenderingEvent.data;
272
272
 
273
- const customerToken = extractValueFromRequestRenderingEvent(event.requestRenderingEvent, 'customer-token');
274
- if (!customerToken) {
275
- console.error('customerToken is missing in getNativeComponentDataFromEvent');
276
- return null;
277
- }
278
-
279
273
  switch (requestRenderingEventData.nativeComponentName) {
280
274
  case WebComponentType.cardAction:
281
275
  if (requestRenderingEventData.nativeComponent?.includes('action=AddToWallet')) {
276
+ const customerToken = extractValueFromRequestRenderingEvent(event.requestRenderingEvent, 'customer-token');
277
+ if (!customerToken) {
278
+ console.error('customerToken is missing for AddToWallet');
279
+ return null;
280
+ }
282
281
  nativePlace = BottomSheetNativePlaceType.overFullScreen;
283
282
  componentData = getAddToWalletComponentDataFromEvent(event, customerToken);
284
283
  }
@@ -59,7 +59,7 @@ const UNMultiFactorAuthenticationComponent = (props: UNMultiFactorAuthentication
59
59
  props.onVerificationTokenCreated && props.onVerificationTokenCreated(message.details as UNCustomerTokenVerification);
60
60
  break;
61
61
  case UnitComponentsMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED: {
62
- const data = JSON.parse((message.details as MultiFactorAuthenticationFinishedEvent).unitVerifiedCustomerTokenString);
62
+ const data = JSON.parse((message.details as MultiFactorAuthenticationFinishedEvent).tokenString);
63
63
  props.onAuthenticationFinished && props.onAuthenticationFinished(data as UNMultiFactorAuthenticationFinished);
64
64
  break;
65
65
  }
@@ -41,7 +41,8 @@ export interface RequestRefreshEvent {
41
41
  }
42
42
 
43
43
  export interface MultiFactorAuthenticationFinishedEvent {
44
- unitVerifiedCustomerTokenString: string;
44
+ tokenString: string;
45
+ tokenStoreKey: 'unitVerifiedCustomerToken' | 'unitVerifiedToken';
45
46
  parentInstanceId?: string;
46
47
  eventToContinue?: string;
47
48
  }
@@ -0,0 +1,24 @@
1
+ import type { UNFonts } from '../../types/shared/fonts.types';
2
+ import AppInfo from '../../utils/AppInfo';
3
+
4
+ export const loadIosFontBase64 = async (fonts: UNFonts): Promise<Record<string, string>> => {
5
+ const fileNames = new Set<string>();
6
+ Object.values(fonts).forEach((familyFonts) => {
7
+ familyFonts.forEach((fontData) => {
8
+ fontData.sources.forEach((source) => {
9
+ fileNames.add(source.fileName);
10
+ });
11
+ });
12
+ });
13
+
14
+ const map: Record<string, string> = {};
15
+ for (const fileName of fileNames) {
16
+ try {
17
+ const base64 = await AppInfo.readFontFileAsBase64(fileName);
18
+ map[fileName] = base64;
19
+ } catch (e) {
20
+ console.warn(`Failed to read font file: ${fileName}`, e);
21
+ }
22
+ }
23
+ return map;
24
+ };
@@ -8,6 +8,7 @@ import { PlaidMessage } from '../../messages/webMessages/plaidMessages';
8
8
  import { PayeeManagementMessage } from '../../messages/webMessages/payeeManagementMessage';
9
9
  import { MultipleCardsMessage } from '../../messages/webMessages/multipleCardsMessage';
10
10
  import { WebComponentType } from '../../types/internal/webComponent.types';
11
+ import { UserDataKeys } from '../../types/internal/unitStore.types';
11
12
 
12
13
  export const POST_MESSAGE_TO_SDK = `
13
14
  const postMessageToSDK = (message) => {
@@ -169,15 +170,23 @@ export const LISTENERS = {
169
170
  unitMultiFactorAuthFinished: `
170
171
  window.addEventListener("${UnitComponentsMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED}", async (e) => {
171
172
  const response = await e.detail.response;
172
- const unitVerifiedCustomerToken = {
173
- token: response.data.attributes.token,
174
- expiration: new Date().getTime() + response.data.attributes.expiresIn * 1000,
173
+ const attrs = response.data.attributes;
174
+
175
+ // Determine token type and appropriate storage key
176
+ const isApplicationFormToken = !!attrs.applicationFormVerifiedToken;
177
+ const token = isApplicationFormToken ? attrs.applicationFormVerifiedToken : attrs.token;
178
+ const storeKey = isApplicationFormToken ? "${UserDataKeys.unitApplicationFormVerifiedToken}" : "${UserDataKeys.unitVerifiedCustomerToken}";
179
+
180
+ const tokenData = {
181
+ token: token,
182
+ expiration: attrs.expiresIn ? new Date().getTime() + attrs.expiresIn * 1000 : null,
175
183
  };
176
- const unitVerifiedCustomerTokenString = JSON.stringify(unitVerifiedCustomerToken);
177
- window.UnitStore["unitVerifiedCustomerToken"] = unitVerifiedCustomerTokenString;
184
+ const unitVerifiedCustomerTokenString = JSON.stringify(tokenData);
185
+ window.UnitStore[storeKey] = unitVerifiedCustomerTokenString;
178
186
 
179
187
  const data = {
180
- unitVerifiedCustomerTokenString,
188
+ tokenString: unitVerifiedCustomerTokenString,
189
+ tokenStoreKey: storeKey,
181
190
  parentInstanceId: e.detail.parentInstanceId,
182
191
  eventToContinue: e.detail.eventToContinue
183
192
  }
@@ -1,8 +1,23 @@
1
1
  import { Platform } from 'react-native';
2
2
  import type { FontWeight, UNFonts, UNFontSource, UNFontData } from '../../types/shared/fonts.types';
3
3
 
4
- const getUrl = (source: UNFontSource): string => {
4
+ const getMimeType = (fileName: string): string => {
5
+ const ext = fileName.split('.').pop()?.toLowerCase();
6
+ switch (ext) {
7
+ case 'woff': return 'font/woff';
8
+ case 'woff2': return 'font/woff2';
9
+ case 'otf': return 'font/otf';
10
+ default: return 'font/ttf';
11
+ }
12
+ };
13
+
14
+ const getUrl = (source: UNFontSource, iosFontBase64Map?: Record<string, string>): string => {
5
15
  if (Platform.OS == 'ios') {
16
+ const base64 = iosFontBase64Map?.[source.fileName];
17
+ if (base64) {
18
+ const mime = getMimeType(source.fileName);
19
+ return `url('data:${mime};base64,${base64}')`;
20
+ }
6
21
  return `url('${source.fileName}')`;
7
22
  }
8
23
 
@@ -17,13 +32,13 @@ const getUrl = (source: UNFontSource): string => {
17
32
 
18
33
  return `url('file:///android_asset${relativeDirPath}${source.fileName}')`;
19
34
  };
20
- const getFontFace = (fontFamily: string, fontWeight: FontWeight, sources: UNFontSource[]): string => {
35
+ const getFontFace = (fontFamily: string, fontWeight: FontWeight, sources: UNFontSource[], iosFontBase64Map?: Record<string, string>): string => {
21
36
  const numOfSources = sources.length;
22
37
 
23
38
  const sourcesString = sources
24
39
  .map((source, index) => {
25
40
  const suffix = index === numOfSources - 1 ? ';' : ',';
26
- const url = getUrl(source);
41
+ const url = getUrl(source, iosFontBase64Map);
27
42
  const format = source?.format ? `format('${source.format}')` : '';
28
43
  return `${url} ${format}${suffix}`;
29
44
  })
@@ -38,7 +53,7 @@ const getFontFace = (fontFamily: string, fontWeight: FontWeight, sources: UNFont
38
53
  `;
39
54
  };
40
55
 
41
- export const getFontFacesString = (fonts?: UNFonts): string => {
56
+ export const getFontFacesString = (fonts?: UNFonts, iosFontBase64Map?: Record<string, string>): string => {
42
57
  if (!fonts) return '';
43
58
 
44
59
  const fontFaces: string[] = [];
@@ -47,7 +62,7 @@ export const getFontFacesString = (fonts?: UNFonts): string => {
47
62
  // create font-face for each variant
48
63
  Object.entries(fonts).forEach(([familyName, familyFonts]) => {
49
64
  familyFonts.forEach((fontData: UNFontData) => {
50
- fontFaces.push(getFontFace(familyName, fontData.fontWeight, fontData.sources));
65
+ fontFaces.push(getFontFace(familyName, fontData.fontWeight, fontData.sources, iosFontBase64Map));
51
66
  });
52
67
  });
53
68
 
@@ -2,5 +2,6 @@
2
2
 
3
3
  export enum UserDataKeys {
4
4
  unitCustomerToken = 'unitCustomerToken',
5
- unitVerifiedToken = 'unitVerifiedCustomerToken'
5
+ unitVerifiedCustomerToken = 'unitVerifiedCustomerToken',
6
+ unitApplicationFormVerifiedToken = 'unitVerifiedToken'
6
7
  }
@@ -4,7 +4,7 @@ import { UNComponentsSecuritySettings, UNComponentsSnapshotProtectionStrategy }
4
4
  const WEB_SDK_RECOMMENDED_STRATEGY: UNComponentsWebVersioningStrategy = {
5
5
  type: UNVersioningStrategyType.upToNextMinor,
6
6
  major: 3,
7
- minor: 3,
7
+ minor: 6,
8
8
  };
9
9
 
10
10
  const DEFAULT_SECURITY_SETTINGS: UNComponentsSecuritySettings = {
@@ -14,6 +14,7 @@ import { UnitComponentsHelpersManager } from './unitComponentsHelpersManager/Uni
14
14
  import UNSecurityManagerHelper from '../nativeModulesHelpers/UNSecurityHelper';
15
15
  import { UNComponentsSecuritySettings, UNComponentsSnapshotProtectionStrategy } from '../types/shared/securitySettings';
16
16
  import UNSnapshotProtectionHelper from '../nativeModulesHelpers/UNSanpshotProtectionHelper/UNSnapshotProtectionHelper';
17
+ import { loadIosFontBase64 } from '../nativeModulesHelpers/UNFontFileHelper/UNFontFileHelper';
17
18
 
18
19
  export class UnitComponentsSDK {
19
20
  public static ui: UnitComponentsUiManager;
@@ -25,7 +26,8 @@ export class UnitComponentsSDK {
25
26
  protected static fonts?: UNFonts;
26
27
  protected static signedNonce?: string;
27
28
  protected static pushProvisionModule?: typeof NativeModules;
28
- protected static sdkVersion = '3.0.1';
29
+ protected static sdkVersion = '3.1.0';
30
+ static iosFontBase64Map: Record<string, string> = {};
29
31
 
30
32
  public static init = async (
31
33
  env: UNComponentsEnvironment,
@@ -47,6 +49,9 @@ export class UnitComponentsSDK {
47
49
  this.env = env;
48
50
  this.securitySettings = securitySettings;
49
51
  this.fonts = fonts;
52
+ if (Platform.OS === 'ios' && fonts) {
53
+ this.iosFontBase64Map = await loadIosFontBase64(fonts);
54
+ }
50
55
  store.dispatch(setTheme(theme));
51
56
  store.dispatch(setLanguage(language));
52
57
  warnClientIfNeeded(this.webVersioningStrategy);
@@ -112,7 +117,8 @@ export class UnitComponentsSDK {
112
117
 
113
118
  public static cleanUserData = () => {
114
119
  UNStoreManagerHelper.cleanValue(UserDataKeys.unitCustomerToken);
115
- UNStoreManagerHelper.cleanValue(UserDataKeys.unitVerifiedToken);
120
+ UNStoreManagerHelper.cleanValue(UserDataKeys.unitVerifiedCustomerToken);
121
+ UNStoreManagerHelper.cleanValue(UserDataKeys.unitApplicationFormVerifiedToken);
116
122
  };
117
123
 
118
124
  }
@@ -7,10 +7,10 @@ export const getUnitScriptUrl = (env: UNComponentsEnvironment, webVersioningStra
7
7
 
8
8
  switch (env) {
9
9
  case UNComponentsEnvironment.sandbox:
10
- return `https://ui.s.unit.sh/release/${webSdkVersionString}/components.js`;
10
+ return `https://ui.s.unit.sh/release/${webSdkVersionString}/components-extended.js`;
11
11
 
12
12
  case UNComponentsEnvironment.production:
13
- return `https://ui.unit.co/release/${webSdkVersionString}/components.js`;
13
+ return `https://ui.unit.co/release/${webSdkVersionString}/components-extended.js`;
14
14
 
15
15
  case UNComponentsEnvironment.mock:
16
16
  return 'https://unit-white-label-ui.netlify.app/assets/components-mock.js';
@@ -5,6 +5,7 @@ interface Spec extends TurboModule {
5
5
  getVersion(): string
6
6
  getBuildNumber(): string
7
7
  getAppIdentifier(): string
8
+ readFontFileAsBase64(fileName: string): string
8
9
  }
9
10
 
10
11
  export default TurboModuleRegistry.getEnforcing<Spec>('UNAppInfoModule');
@@ -100,16 +100,18 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
100
100
 
101
101
  const componentParams = customerTokenParam + (props.params || '') + themeParam + languageParam;
102
102
 
103
- const fontFaces = getFontFacesString(UnitComponentsSDK.getFonts());
103
+ const fontFaces = getFontFacesString(UnitComponentsSDK.getFonts(), UnitComponentsSDK.iosFontBase64Map);
104
104
 
105
105
  const windowInfoParams = `window.UnitMobileSDKConfig['info'] = ${JSON.stringify(infoParams)};`;
106
106
  const plaidRedirectUriParam = (Platform.OS == 'ios' && UnitComponentsSDK.helpers.redirectUri) ? `window.UnitMobileSDKConfig['plaidRedirectUri'] = '${UnitComponentsSDK.helpers.redirectUri}/plaid';` : '';
107
107
  const unitSessionIdParam = `window.UnitSessionStore.unitSessionId = '${UnitComponentsSDK.helpers.unitSessionId}';`;
108
108
 
109
- const unitVerifiedCustomerToken = await UNStoreManagerHelper.getValue(UserDataKeys.unitVerifiedToken);
110
- const windowVerifiedCustomerToken = unitVerifiedCustomerToken ? `window.UnitStore['unitVerifiedCustomerToken'] = '${unitVerifiedCustomerToken}';` : '';
109
+ const unitVerifiedCustomerToken = await UNStoreManagerHelper.getValue(UserDataKeys.unitVerifiedCustomerToken);
110
+ const unitAppFormVerifiedToken = await UNStoreManagerHelper.getValue(UserDataKeys.unitApplicationFormVerifiedToken);
111
+ const windowVerifiedCustomerToken = unitVerifiedCustomerToken ? `window.UnitStore['${UserDataKeys.unitVerifiedCustomerToken}'] = '${unitVerifiedCustomerToken}';` : '';
112
+ const windowAppFormVerifiedToken = unitAppFormVerifiedToken ? `window.UnitStore['${UserDataKeys.unitApplicationFormVerifiedToken}'] = '${unitAppFormVerifiedToken}';` : '';
111
113
 
112
- const windowParams = `${windowInfoParams} ${unitSessionIdParam} ${plaidRedirectUriParam} ${windowVerifiedCustomerToken} ${props.windowParams || ''}`;
114
+ const windowParams = `${windowInfoParams} ${unitSessionIdParam} ${plaidRedirectUriParam} ${windowVerifiedCustomerToken} ${windowAppFormVerifiedToken} ${props.windowParams || ''}`;
113
115
 
114
116
  let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), componentParams, props.presentationMode));
115
117
  newHtml = newHtml.replace(HTML_PLACEHOLDER.FONT_FACES, fontFaces);
@@ -124,7 +126,7 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
124
126
 
125
127
  // Listen and update the live webComponents
126
128
  const handleMultiFactorAuthFinished = (data: MultiFactorAuthenticationFinishedEvent) => {
127
- setItemInWindowUnitStore(webRef.current, UserDataKeys.unitVerifiedToken, data.unitVerifiedCustomerTokenString);
129
+ setItemInWindowUnitStore(webRef.current, data.tokenStoreKey as UserDataKeys, data.tokenString);
128
130
  injectEventToContinue(webRef.current, {
129
131
  parentInstanceId: data.parentInstanceId,
130
132
  eventToContinue: data.eventToContinue
@@ -158,7 +160,7 @@ export const WebComponent = React.forwardRef<WebView, WebComponentProps>(functio
158
160
  case UnitComponentsMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED:
159
161
  if (message.details) {
160
162
  const data = message.details as MultiFactorAuthenticationFinishedEvent;
161
- UNStoreManagerHelper.saveValue(UserDataKeys.unitVerifiedToken, data.unitVerifiedCustomerTokenString);
163
+ UNStoreManagerHelper.saveValue(data.tokenStoreKey as UserDataKeys, data.tokenString);
162
164
  // update existing components - namely, the other webComponents will update their window as well as this webComponent
163
165
  eventBus.emit(
164
166
  UnitComponentsMessage.UNIT_MULTI_FACTOR_AUTH_FINISHED,