react-native-unit-components 1.3.0 → 1.4.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.
- package/README.md +0 -375
- package/ios/Camera/Camera.swift +22 -0
- package/ios/Camera/CameraExportModule.m +7 -0
- package/ios/UNAppInfo/UNAppInfo.swift +19 -0
- package/ios/UNAppInfo/UNAppInfoExportModule.m +7 -0
- package/ios/UnitReactNativeComponentsViewManager.swift +7 -7
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js +3 -0
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js +7 -1
- package/lib/commonjs/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +8 -0
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +6 -1
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js +4 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -1
- package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js +97 -0
- package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -0
- package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js +45 -0
- package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js.map +1 -0
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/hooks/listenerToBus.js +4 -1
- package/lib/commonjs/hooks/listenerToBus.js.map +1 -1
- package/lib/commonjs/messages/webMessages/activityMessage.js +12 -0
- package/lib/commonjs/messages/webMessages/activityMessage.js.map +1 -0
- package/lib/commonjs/messages/webMessages/checkMessage.js +13 -0
- package/lib/commonjs/messages/webMessages/checkMessage.js.map +1 -0
- package/lib/commonjs/messages/webMessages/index.js.map +1 -1
- package/lib/commonjs/scripts/html/bodyScript.js +20 -1
- package/lib/commonjs/scripts/html/bodyScript.js.map +1 -1
- package/lib/commonjs/sharedTypes/account.types.js +8 -1
- package/lib/commonjs/sharedTypes/account.types.js.map +1 -1
- package/lib/commonjs/sharedTypes/checkDeposit.types.js +22 -0
- package/lib/commonjs/sharedTypes/checkDeposit.types.js.map +1 -0
- package/lib/commonjs/sharedTypes/index.js +11 -0
- package/lib/commonjs/sharedTypes/index.js.map +1 -1
- package/lib/commonjs/webComponent/WebComponent.js +33 -1
- package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
- package/lib/commonjs/webComponent/html.js +8 -1
- package/lib/commonjs/webComponent/html.js.map +1 -1
- package/lib/module/components/UNAccountComponent/UNAccountComponent.js +4 -1
- package/lib/module/components/UNAccountComponent/UNAccountComponent.js.map +1 -1
- package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js +5 -0
- package/lib/module/components/UNAccountComponent/UNAccountComponent.utils.js.map +1 -1
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js +9 -1
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -1
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +4 -0
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -1
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -1
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +4 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -1
- package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -1
- package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js +88 -0
- package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -0
- package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js +37 -0
- package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/hooks/listenerToBus.js +4 -1
- package/lib/module/hooks/listenerToBus.js.map +1 -1
- package/lib/module/messages/webMessages/activityMessage.js +5 -0
- package/lib/module/messages/webMessages/activityMessage.js.map +1 -0
- package/lib/module/messages/webMessages/checkMessage.js +6 -0
- package/lib/module/messages/webMessages/checkMessage.js.map +1 -0
- package/lib/module/messages/webMessages/index.js.map +1 -1
- package/lib/module/scripts/html/bodyScript.js +17 -0
- package/lib/module/scripts/html/bodyScript.js.map +1 -1
- package/lib/module/sharedTypes/account.types.js +6 -0
- package/lib/module/sharedTypes/account.types.js.map +1 -1
- package/lib/module/sharedTypes/checkDeposit.types.js +15 -0
- package/lib/module/sharedTypes/checkDeposit.types.js.map +1 -0
- package/lib/module/sharedTypes/index.js +1 -0
- package/lib/module/sharedTypes/index.js.map +1 -1
- package/lib/module/webComponent/WebComponent.js +32 -1
- package/lib/module/webComponent/WebComponent.js.map +1 -1
- package/lib/module/webComponent/html.js +9 -2
- package/lib/module/webComponent/html.js.map +1 -1
- package/lib/typescript/components/UNAccountComponent/UNAccountComponent.d.ts +4 -0
- package/lib/typescript/components/UNAccountComponent/UNAccountComponent.utils.d.ts +2 -0
- package/lib/typescript/components/UNActivityComponent/UNActivityComponent.d.ts +2 -1
- package/lib/typescript/components/UNActivityComponent/UNActivityComponent.utils.d.ts +1 -0
- package/lib/typescript/components/UNCheckDepositComponent/UNCheckDepositComponent.d.ts +12 -0
- package/lib/typescript/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.d.ts +3 -0
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/messages/webMessages/activityMessage.d.ts +5 -0
- package/lib/typescript/messages/webMessages/checkMessage.d.ts +8 -0
- package/lib/typescript/messages/webMessages/index.d.ts +4 -2
- package/lib/typescript/scripts/html/bodyScript.d.ts +3 -0
- package/lib/typescript/sharedTypes/account.types.d.ts +5 -0
- package/lib/typescript/sharedTypes/checkDeposit.types.d.ts +46 -0
- package/lib/typescript/sharedTypes/index.d.ts +1 -0
- package/lib/typescript/webComponent/WebComponent.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/UNAccountComponent/UNAccountComponent.tsx +13 -1
- package/src/components/UNAccountComponent/UNAccountComponent.utils.ts +7 -0
- package/src/components/UNActivityComponent/UNActivityComponent.tsx +14 -2
- package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +5 -0
- package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +1 -0
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +4 -0
- package/src/components/UNCardComponent/UNCardComponent.tsx +2 -0
- package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.tsx +112 -0
- package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.ts +40 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/listenerToBus.ts +4 -1
- package/src/messages/webMessages/activityMessage.ts +8 -0
- package/src/messages/webMessages/checkMessage.ts +14 -0
- package/src/messages/webMessages/index.ts +6 -0
- package/src/scripts/html/bodyScript.ts +20 -1
- package/src/sharedTypes/account.types.ts +13 -7
- package/src/sharedTypes/checkDeposit.types.ts +50 -0
- package/src/sharedTypes/index.ts +1 -0
- package/src/webComponent/WebComponent.tsx +33 -1
- package/src/webComponent/html.ts +9 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PaymentMessage","CardMessage","PageMessage","UnitMessage","AccountMessage","POST_MESSAGE_TO_SDK","POST_PAGE_HEIGHT","PAGE_HEIGHT","LISTENERS","isPageLoaded","PAGE_LOADED","requestRendering","UNIT_REQUEST_RENDERING","requestRefresh","UNIT_REQUEST_REFRESH","onLoad","UNIT_ON_LOAD","requestCloseFlow","UNIT_REQUEST_CLOSE_FLOW","requestOpenLink","UNIT_REQUEST_OPEN_LINK","unitRequestDownload","UNIT_REQUEST_DOWNLOAD","cardActivated","CARD_ACTIVATED","cardStatusChange","CARD_STATUS_CHANGED","unitRequestExternalSdk","UNIT_REQUEST_EXTERNAL_SDK","unitPaymentCreated","PAYMENT_CREATED","unitAccountChanged","UNIT_ACCOUNT_CHANGED","DISPATCH_RENDERING_EVENT","DISPATCH_REQUEST_REFRESH","DISPATCH_PLAID_RESPONSE","UNIT_PLAID_RESPONSE","DISPATCH_OPEN_ACTIONS_MENU","DISPATCH_REQUEST_CARD_ACTION"],"sources":["bodyScript.ts"],"sourcesContent":["import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';\nimport { CardMessage } from '../../messages/webMessages/cardMessage';\nimport { PageMessage } from '../../messages/webMessages/pageMessage';\nimport { UnitMessage } from '../../messages/webMessages/unitMessages';\nimport { AccountMessage } from '../../messages/webMessages/accountMessage';\n\nexport const POST_MESSAGE_TO_SDK = `\n const postMessageToSDK = (message) => {\n if ('ReactNativeWebView' in window) {\n const messageString = JSON.stringify(message)\n window['ReactNativeWebView'].postMessage(messageString)\n }\n }\n`;\n\nexport const POST_PAGE_HEIGHT = `\n const postHeight = () => {\n setTimeout(() => {\n const height = window.document.documentElement.getBoundingClientRect().height\n postMessageToSDK({ type: \"${PageMessage.PAGE_HEIGHT}\", details: { height } })\n })\n }\n`;\n\nexport const LISTENERS = {\n isPageLoaded: `\n window.addEventListener('DOMContentLoaded', e => {\n postMessageToSDK({ type: \"${PageMessage.PAGE_LOADED}\" })\n });\n `,\n requestRendering: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_RENDERING}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_RENDERING}\", details: { data: e.detail }})\n });\n `,\n requestRefresh: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_REFRESH}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_REFRESH}\", details: e.detail })\n });\n `,\n onLoad: `\n window.addEventListener(\"${UnitMessage.UNIT_ON_LOAD}\", (e) => {\n postHeight()\n postMessageToSDK({ type: \"${UnitMessage.UNIT_ON_LOAD}\", details: e.detail })\n });\n `,\n requestCloseFlow: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}\" })\n });\n `,\n requestOpenLink: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_OPEN_LINK}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_OPEN_LINK}\", details: e.detail })\n });\n `,\n unitRequestDownload: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_DOWNLOAD}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_DOWNLOAD}\", details: e.detail })\n });\n `,\n cardActivated: `\n window.addEventListener(\"${CardMessage.CARD_ACTIVATED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${CardMessage.CARD_ACTIVATED}\", details: { card: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n cardStatusChange: `\n window.addEventListener(\"${CardMessage.CARD_STATUS_CHANGED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${CardMessage.CARD_STATUS_CHANGED}\", details: { card: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n unitRequestExternalSdk: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}\", details: e.detail })\n });\n`,\n unitPaymentCreated
|
|
1
|
+
{"version":3,"names":["PaymentMessage","CardMessage","PageMessage","UnitMessage","AccountMessage","ActivityMessage","POST_MESSAGE_TO_SDK","POST_PAGE_HEIGHT","PAGE_HEIGHT","LISTENERS","isPageLoaded","PAGE_LOADED","requestRendering","UNIT_REQUEST_RENDERING","requestRefresh","UNIT_REQUEST_REFRESH","onLoad","UNIT_ON_LOAD","requestCloseFlow","UNIT_REQUEST_CLOSE_FLOW","requestOpenLink","UNIT_REQUEST_OPEN_LINK","unitRequestDownload","UNIT_REQUEST_DOWNLOAD","cardActivated","CARD_ACTIVATED","cardStatusChange","CARD_STATUS_CHANGED","unitRequestExternalSdk","UNIT_REQUEST_EXTERNAL_SDK","unitPaymentCreated","PAYMENT_CREATED","unitAccountChanged","UNIT_ACCOUNT_CHANGED","unitActivityFiltersChanged","UNIT_ACTIVITY_FILTERS_CHANGED","DISPATCH_RENDERING_EVENT","DISPATCH_REQUEST_REFRESH","DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT","DISPATCH_PLAID_RESPONSE","UNIT_PLAID_RESPONSE","DISPATCH_OPEN_ACTIONS_MENU","DISPATCH_REQUEST_CARD_ACTION","DISPATCH_REQUEST_ACCOUNT_ACTION"],"sources":["bodyScript.ts"],"sourcesContent":["import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';\nimport { CardMessage } from '../../messages/webMessages/cardMessage';\nimport { PageMessage } from '../../messages/webMessages/pageMessage';\nimport { UnitMessage } from '../../messages/webMessages/unitMessages';\nimport { AccountMessage } from '../../messages/webMessages/accountMessage';\nimport { ActivityMessage } from '../../messages/webMessages/activityMessage';\n\nexport const POST_MESSAGE_TO_SDK = `\n const postMessageToSDK = (message) => {\n if ('ReactNativeWebView' in window) {\n const messageString = JSON.stringify(message)\n window['ReactNativeWebView'].postMessage(messageString)\n }\n }\n`;\n\nexport const POST_PAGE_HEIGHT = `\n const postHeight = () => {\n setTimeout(() => {\n const height = window.document.documentElement.getBoundingClientRect().height\n postMessageToSDK({ type: \"${PageMessage.PAGE_HEIGHT}\", details: { height } })\n })\n }\n`;\n\nexport const LISTENERS = {\n isPageLoaded: `\n window.addEventListener('DOMContentLoaded', e => {\n postMessageToSDK({ type: \"${PageMessage.PAGE_LOADED}\" })\n });\n `,\n requestRendering: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_RENDERING}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_RENDERING}\", details: { data: e.detail }})\n });\n `,\n requestRefresh: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_REFRESH}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_REFRESH}\", details: e.detail })\n });\n `,\n onLoad: `\n window.addEventListener(\"${UnitMessage.UNIT_ON_LOAD}\", (e) => {\n postHeight()\n postMessageToSDK({ type: \"${UnitMessage.UNIT_ON_LOAD}\", details: e.detail })\n });\n `,\n requestCloseFlow: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}\" })\n });\n `,\n requestOpenLink: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_OPEN_LINK}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_OPEN_LINK}\", details: e.detail })\n });\n `,\n unitRequestDownload: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_DOWNLOAD}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_DOWNLOAD}\", details: e.detail })\n });\n `,\n cardActivated: `\n window.addEventListener(\"${CardMessage.CARD_ACTIVATED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${CardMessage.CARD_ACTIVATED}\", details: { card: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n cardStatusChange: `\n window.addEventListener(\"${CardMessage.CARD_STATUS_CHANGED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${CardMessage.CARD_STATUS_CHANGED}\", details: { card: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n unitRequestExternalSdk: `\n window.addEventListener(\"${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}\", (e) => {\n postMessageToSDK({ type: \"${UnitMessage.UNIT_REQUEST_EXTERNAL_SDK}\", details: e.detail })\n });\n`,\n unitPaymentCreated: `\n window.addEventListener(\"${PaymentMessage.PAYMENT_CREATED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${PaymentMessage.PAYMENT_CREATED}\", details: { data: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });`\n ,\n unitAccountChanged: `\n window.addEventListener(\"${AccountMessage.UNIT_ACCOUNT_CHANGED}\", (e) => {\n const response = e.detail\n response.then((data) => {\n postMessageToSDK({ type: \"${AccountMessage.UNIT_ACCOUNT_CHANGED}\", details: { account: data.data }})\n }).catch((e) => {\n console.log(e)\n })\n });\n `,\n unitActivityFiltersChanged: `\n window.addEventListener(\"${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}\", (e) => {\n postMessageToSDK({ type: \"${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}\", details: e.detail })\n });\n `\n};\n\nexport const DISPATCH_RENDERING_EVENT = `\n const dispatchRenderingEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_REQUEST_RENDERING}\",{ detail: JSON.parse(details) })\n window.dispatchEvent(event)\n }\n`;\n\nexport const DISPATCH_REQUEST_REFRESH = `\n const dispatchRefreshEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_REQUEST_REFRESH}\",{ detail: JSON.parse(details) })\n window.dispatchEvent(event)\n }\n`;\n\nexport const DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT = `\n const dispatchActivityFilterChangedEvent = (details) => {\n const event = new CustomEvent(\"${ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}\",{ detail: details });\n window.dispatchEvent(event);\n }\n`;\n\nexport const DISPATCH_PLAID_RESPONSE = `\n const dispatchPlaidEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_PLAID_RESPONSE}\",{ detail: details })\n window.dispatchEvent(event)\n }\n`;\n\nexport const DISPATCH_OPEN_ACTIONS_MENU = `\n const dispatchOpenActionsMenu = (componentName) => {\n document.querySelector(componentName).dispatchEvent(new CustomEvent(\"unitRequestOpenActionsMenu\"))\n }\n`;\n\nexport const DISPATCH_REQUEST_CARD_ACTION = `\n const dispatchRequestCardAction = (action) => {\n document.querySelector(\"unit-elements-card\").dispatchEvent(new CustomEvent(\"unitRequestCardAction\", {detail: {action: action}}))\n }\n`;\n\nexport const DISPATCH_REQUEST_ACCOUNT_ACTION = `\n const dispatchRequestAccountAction = (action) => {\n document.querySelector(\"unit-elements-account\").dispatchEvent(new CustomEvent(\"unitRequestAccountAction\", {detail: {action: action}}))\n }\n`;\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,4CAA4C;AAC3E,SAASC,WAAW,QAAQ,wCAAwC;AACpE,SAASC,WAAW,QAAQ,wCAAwC;AACpE,SAASC,WAAW,QAAQ,yCAAyC;AACrE,SAASC,cAAc,QAAQ,2CAA2C;AAC1E,SAASC,eAAe,QAAQ,4CAA4C;AAE5E,OAAO,MAAMC,mBAAmB,GAAI;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAI;AACjC;AACA;AACA;AACA,kCAAkCL,WAAW,CAACM,WAAY;AAC1D;AACA;AACA,CAAC;AAED,OAAO,MAAMC,SAAS,GAAG;EACvBC,YAAY,EAAG;AACjB;AACA,kCAAkCR,WAAW,CAACS,WAAY;AAC1D;AACA,GAAG;EACDC,gBAAgB,EAAG;AACrB,+BAA+BT,WAAW,CAACU,sBAAuB;AAClE,kCAAkCV,WAAW,CAACU,sBAAuB;AACrE;AACA,GAAG;EACDC,cAAc,EAAG;AACnB,+BAA+BX,WAAW,CAACY,oBAAqB;AAChE,kCAAkCZ,WAAW,CAACY,oBAAqB;AACnE;AACA,GAAG;EACDC,MAAM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,OAAO,MAAMC,wBAAwB,GAAI;AACzC;AACA,qCAAqCjC,WAAW,CAACU,sBAAuB;AACxE;AACA;AACA,CAAC;AAED,OAAO,MAAMwB,wBAAwB,GAAI;AACzC;AACA,qCAAqClC,WAAW,CAACY,oBAAqB;AACtE;AACA;AACA,CAAC;AAED,OAAO,MAAMuB,sCAAsC,GAAI;AACvD;AACA,uCAAuCjC,eAAe,CAAC8B,6BAA8B;AACrF;AACA;AACA,CAAC;AAED,OAAO,MAAMI,uBAAuB,GAAI;AACxC;AACA,qCAAqCpC,WAAW,CAACqC,mBAAoB;AACrE;AACA;AACA,CAAC;AAED,OAAO,MAAMC,0BAA0B,GAAI;AAC3C;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,4BAA4B,GAAI;AAC7C;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,+BAA+B,GAAI;AAChD;AACA;AACA;AACA,CAAC"}
|
|
@@ -20,4 +20,10 @@ export let UNFraudReason;
|
|
|
20
20
|
UNFraudReason["IdentityTheft"] = "IdentityTheft";
|
|
21
21
|
UNFraudReason["LinkedToFraudulentCustomer"] = "LinkedToFraudulentCustomer";
|
|
22
22
|
})(UNFraudReason || (UNFraudReason = {}));
|
|
23
|
+
export let UNAccountMenuAction;
|
|
24
|
+
(function (UNAccountMenuAction) {
|
|
25
|
+
UNAccountMenuAction["OpenAccountDetails"] = "OpenAccountDetails";
|
|
26
|
+
UNAccountMenuAction["OpenAccountStatements"] = "OpenAccountStatements";
|
|
27
|
+
UNAccountMenuAction["DownloadBankVerificationLetter"] = "DownloadBankVerificationLetter";
|
|
28
|
+
})(UNAccountMenuAction || (UNAccountMenuAction = {}));
|
|
23
29
|
//# sourceMappingURL=account.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["UNAccountStatus","UNCloseReason","UNFraudReason"],"sources":["account.types.ts"],"sourcesContent":["import type { UNRelationship, UNTags } from './types';\n\nexport type UNAccountData = UNDepositAccount | UNBatchAccount | UNCreditAccount\n\nexport type UNCounterpartyAccountData = {\n
|
|
1
|
+
{"version":3,"names":["UNAccountStatus","UNCloseReason","UNFraudReason","UNAccountMenuAction"],"sources":["account.types.ts"],"sourcesContent":["import type { UNRelationship, UNTags } from './types';\n\nexport type UNAccountData = UNDepositAccount | UNBatchAccount | UNCreditAccount\n\nexport type UNCounterpartyAccountData = {\n id: string\n attributes: {\n name: string\n tags?: { [key: string]: string }\n }\n}\n\nenum UNAccountStatus {\n Open = 'Open',\n Closed = 'Closed',\n Frozen = 'Frozen',\n}\n\nexport enum UNCloseReason {\n Fraud = 'Fraud',\n ByCustomer = 'ByCustomer',\n}\n\nexport enum UNFraudReason {\n ACHActivity = 'ACHActivity',\n CardActivity = 'CardActivity',\n CheckActivity = 'CheckActivity',\n ApplicationHistory = 'ApplicationHistory',\n AccountActivity = 'AccountActivity',\n ClientIdentified = 'ClientIdentified',\n IdentityTheft = 'IdentityTheft',\n LinkedToFraudulentCustomer = 'LinkedToFraudulentCustomer',\n}\n\nexport type UNDepositAccount = {\n id: string\n type: 'depositAccount'\n attributes: {\n createdAt: string\n updatedAt?: string\n name: string\n depositProduct: string\n routingNumber: string\n accountNumber: string\n maskedAccountNumber?: string\n secondaryAccountNumber?: {\n routingNumber: string\n accountNumber: string\n }\n balance: number\n hold: number\n reserve: number\n available: number\n overdraftLimit?: number\n currency: string\n tags: UNTags\n status: UNAccountStatus\n closeReason?: string\n fraudReason?: UNFraudReason\n closeReasonText?: string\n freezeReason?: string\n isOverdrawnWithinLimit?: boolean\n }\n relationships: {\n customer?: UNRelationship\n customers?: UNRelationship\n org: UNRelationship\n }\n // included?: Individual[]\n}\n\nexport type UNBatchAccount = {\n id: string\n type: 'batchAccount'\n attributes: {\n createdAt: Date\n updatedAt?: Date\n name: string\n depositProduct: string\n routingNumber: string\n accountNumber: string\n maskedAccountNumber?: string\n balance: number\n hold: number\n reserve: number\n available: number\n currency: string\n status: 'Open' | 'Closed'\n closeReason?: string\n fraudReason?: UNFraudReason\n closeReasonText?: string\n freezeReason?: string\n tags?: { [key: string]: string }\n }\n relationships: {\n org: UNRelationship\n }\n}\n\nexport type UNCreditAccount = {\n id: string\n type: 'creditAccount'\n attributes: {\n createdAt: Date\n updatedAt?: Date\n name: string\n creditTerms: string\n balance: number\n hold: number\n reserve: number\n available: number\n creditLimit: number\n currency: string\n tags: { [key: string]: string }\n status: UNAccountStatus\n closeReason?: UNCloseReason\n fraudReason?: UNFraudReason\n closeReasonText?: string\n freezeReason?: string\n }\n relationships: {\n customer: UNRelationship,\n org: UNRelationship\n }\n}\n\nexport enum UNAccountMenuAction {\n OpenAccountDetails = 'OpenAccountDetails',\n OpenAccountStatements = 'OpenAccountStatements',\n DownloadBankVerificationLetter = 'DownloadBankVerificationLetter',\n}\n"],"mappings":"IAYKA,eAAe;AAAA,WAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,KAAfA,eAAe;AAMpB,WAAYC,aAAa;AAGxB,WAHWA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,KAAbA,aAAa;AAKzB,WAAYC,aAAa;AASxB,WATWA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,KAAbA,aAAa;AAuGzB,WAAYC,mBAAmB;AAI9B,WAJWA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;AAAA,GAAnBA,mBAAmB,KAAnBA,mBAAmB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export let UNCheckDepositStatus;
|
|
2
|
+
(function (UNCheckDepositStatus) {
|
|
3
|
+
UNCheckDepositStatus["AwaitingImages"] = "AwaitingImages";
|
|
4
|
+
UNCheckDepositStatus["AwaitingFrontImage"] = "AwaitingFrontImage";
|
|
5
|
+
UNCheckDepositStatus["AwaitingBackImage"] = "AwaitingBackImage";
|
|
6
|
+
UNCheckDepositStatus["PendingReview"] = "PendingReview";
|
|
7
|
+
UNCheckDepositStatus["AwaitingCustomerConfirmation"] = "AwaitingCustomerConfirmation";
|
|
8
|
+
UNCheckDepositStatus["Pending"] = "Pending";
|
|
9
|
+
UNCheckDepositStatus["Rejected"] = "Rejected";
|
|
10
|
+
UNCheckDepositStatus["Clearing"] = "Clearing";
|
|
11
|
+
UNCheckDepositStatus["Sent"] = "Sent";
|
|
12
|
+
UNCheckDepositStatus["Canceled"] = "Canceled";
|
|
13
|
+
UNCheckDepositStatus["Returned"] = "Returned";
|
|
14
|
+
})(UNCheckDepositStatus || (UNCheckDepositStatus = {}));
|
|
15
|
+
//# sourceMappingURL=checkDeposit.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["UNCheckDepositStatus"],"sources":["checkDeposit.types.ts"],"sourcesContent":["import type { UNRelationship } from './types';\n\nexport type UNCheckDepositData = {\n\tid: string\n\ttype: string\n\tattributes: UNCheckDepositAttributes\n\trelationships: UNCheckDepositRelationships\n}\n\nexport type UNCheckDepositAttributes = {\n createdAt: Date\n status: keyof typeof UNCheckDepositStatus\n reason?: string\n description: string\n amount: Cents\n checkNumber?: string\n counterparty: UNCheckCounterparty\n settlementDate?: Date\n tags?: {[key: string]: string}\n}\n\nexport type UNCheckDepositRelationships = {\n account: UNRelationship\n customer?: UNRelationship\n customers?: UNRelationship\n org?: UNRelationship\n transaction?: UNRelationship\n}\n\nexport enum UNCheckDepositStatus {\n\tAwaitingImages = 'AwaitingImages',\n\tAwaitingFrontImage = 'AwaitingFrontImage',\n\tAwaitingBackImage = 'AwaitingBackImage',\n\tPendingReview = 'PendingReview',\n\tAwaitingCustomerConfirmation = 'AwaitingCustomerConfirmation',\n\tPending = 'Pending',\n\tRejected = 'Rejected',\n\tClearing = 'Clearing',\n\tSent = 'Sent',\n\tCanceled = 'Canceled',\n\tReturned = 'Returned',\n}\n\nexport type Cents = number\n\nexport type UNCheckCounterparty = {\n\tname: string\n\taccountNumber: string\n\troutingNumber: string\n}\n"],"mappings":"AA6BA,WAAYA,oBAAoB;AAY/B,WAZWA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;AAAA,GAApBA,oBAAoB,KAApBA,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './bookPayment.types';\nexport * from './card.types';\nexport * from './onLoadResponse.types';\nexport * from './achCredit.types';\nexport * from './payments.types';\nexport * from './account.types';\n"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,cAAc;AAC5B,cAAc,wBAAwB;AACtC,cAAc,mBAAmB;AACjC,cAAc,kBAAkB;AAChC,cAAc,iBAAiB"}
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './bookPayment.types';\nexport * from './card.types';\nexport * from './onLoadResponse.types';\nexport * from './achCredit.types';\nexport * from './payments.types';\nexport * from './account.types';\nexport * from './checkDeposit.types';\n"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,cAAc;AAC5B,cAAc,wBAAwB;AACtC,cAAc,mBAAmB;AACjC,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,sBAAsB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { NativeModules, Platform } from 'react-native';
|
|
3
4
|
import { WebView } from 'react-native-webview';
|
|
4
5
|
import EventBus from '../helpers/EventBus';
|
|
5
6
|
import html, { HTML_PLACEHOLDER } from './html';
|
|
@@ -10,6 +11,9 @@ import { fetchUnitScript, globalUnitScript } from '../unitSdkManager/UnitSdk.api
|
|
|
10
11
|
import { UnitSDK } from '../unitSdkManager/UnitSdkManager';
|
|
11
12
|
import { SDKMessage } from '../messages/nativeMessages/sdkMessage';
|
|
12
13
|
import { handleRequestDownload } from './WebComponent.utils';
|
|
14
|
+
const {
|
|
15
|
+
UNAppInfo
|
|
16
|
+
} = NativeModules;
|
|
13
17
|
export let WebComponentType;
|
|
14
18
|
(function (WebComponentType) {
|
|
15
19
|
WebComponentType["card"] = "unit-elements-card";
|
|
@@ -17,6 +21,7 @@ export let WebComponentType;
|
|
|
17
21
|
WebComponentType["activity"] = "unit-elements-activity";
|
|
18
22
|
WebComponentType["slot"] = "unit-elements-sdk-slot";
|
|
19
23
|
WebComponentType["account"] = "unit-elements-account";
|
|
24
|
+
WebComponentType["checkDeposit"] = "unit-elements-check-deposit";
|
|
20
25
|
WebComponentType["achDebitPayment"] = "unit-elements-ach-debit-payment";
|
|
21
26
|
WebComponentType["achCreditPayment"] = "unit-elements-ach-credit-payment";
|
|
22
27
|
})(WebComponentType || (WebComponentType = {}));
|
|
@@ -24,6 +29,7 @@ export const WebComponent = /*#__PURE__*/React.forwardRef(function WebComponent(
|
|
|
24
29
|
const [unitScript, setUnitScript] = useState(globalUnitScript);
|
|
25
30
|
const [sourceHtml, setSourceHtml] = useState(null);
|
|
26
31
|
const [componentCurrentTheme, setComponentCurrentTheme] = useState(props.theme ?? UnitSDK.getTheme());
|
|
32
|
+
const [baseName, setBaseName] = useState();
|
|
27
33
|
const width = props.width ?? '100%';
|
|
28
34
|
const updateUnitScript = data => {
|
|
29
35
|
setUnitScript(data.unitScript);
|
|
@@ -39,6 +45,24 @@ export const WebComponent = /*#__PURE__*/React.forwardRef(function WebComponent(
|
|
|
39
45
|
busEventKey: SDKMessage.IS_SDK_INITIALIZED,
|
|
40
46
|
action: updateInitializedParams
|
|
41
47
|
});
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
const getAppName = async () => {
|
|
50
|
+
// For iOS, we extend the app name from the HTML to display a prettier access request message.
|
|
51
|
+
// On Android, there is no request message sent from HTML.
|
|
52
|
+
try {
|
|
53
|
+
if (Platform.OS == 'ios') {
|
|
54
|
+
const name = await UNAppInfo.getBundleName();
|
|
55
|
+
setBaseName(name.replace(/ /g, '-'));
|
|
56
|
+
} else {
|
|
57
|
+
// android
|
|
58
|
+
setBaseName('unit');
|
|
59
|
+
}
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.error(error);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
getAppName();
|
|
65
|
+
}, []);
|
|
42
66
|
useEffect(() => {
|
|
43
67
|
if (!unitScript) {
|
|
44
68
|
fetchUnitScript();
|
|
@@ -71,8 +95,14 @@ export const WebComponent = /*#__PURE__*/React.forwardRef(function WebComponent(
|
|
|
71
95
|
}
|
|
72
96
|
return null;
|
|
73
97
|
};
|
|
98
|
+
if (!baseName) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
74
101
|
return /*#__PURE__*/React.createElement(WebView, {
|
|
75
102
|
ref: webRef,
|
|
103
|
+
originWhitelist: ['*'],
|
|
104
|
+
mediaPlaybackRequiresUserAction: false,
|
|
105
|
+
allowsInlineMediaPlayback: true,
|
|
76
106
|
cacheEnabled: false,
|
|
77
107
|
scrollEnabled: props.isScrollable,
|
|
78
108
|
nestedScrollEnabled: props.nestedScrollEnabled,
|
|
@@ -85,7 +115,8 @@ export const WebComponent = /*#__PURE__*/React.forwardRef(function WebComponent(
|
|
|
85
115
|
opacity: 0.99
|
|
86
116
|
},
|
|
87
117
|
source: {
|
|
88
|
-
html: sourceHtml
|
|
118
|
+
html: sourceHtml,
|
|
119
|
+
baseUrl: `https://${baseName}`
|
|
89
120
|
},
|
|
90
121
|
onMessage: onMessage,
|
|
91
122
|
androidHardwareAccelerationDisabled: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useState","WebView","EventBus","html","HTML_PLACEHOLDER","UnitMessage","useListenerToBus","getHtmlBody","fetchUnitScript","globalUnitScript","UnitSDK","SDKMessage","handleRequestDownload","WebComponentType","WebComponent","forwardRef","props","webRef","unitScript","setUnitScript","sourceHtml","setSourceHtml","componentCurrentTheme","setComponentCurrentTheme","theme","getTheme","width","updateUnitScript","data","updateInitializedParams","busEventKey","IS_SCRIPT_FETCHED","action","IS_SDK_INITIALIZED","componentParams","params","newHtml","replace","BODY","type","valueOf","presentationMode","SCRIPT_FROM_NATIVE","script","onMessage","e","message","JSON","parse","nativeEvent","UNIT_REQUEST_REFRESH","details","Instance","event","UNIT_REQUEST_DOWNLOAD","UNIT_REQUEST_CLOSE_FLOW","_onScroll","handleScroll","createElement","ref","cacheEnabled","scrollEnabled","isScrollable","nestedScrollEnabled","onScroll","overScrollMode","injectedJavaScript","style","flex","opacity","source","androidHardwareAccelerationDisabled"],"sources":["WebComponent.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useState } from 'react';\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, PresentationMode } 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';\n\nexport interface WebComponentProps {\n type: WebComponentType;\n presentationMode?: PresentationMode,\n params?: string;\n theme?: string;\n onMessage?: (message: WebViewMessage) => void;\n script?: string;\n isScrollable?: boolean,\n nestedScrollEnabled?: boolean,\n handleScroll?: (event: any) => void,\n width?: number;\n}\n\nexport enum WebComponentType {\n card = 'unit-elements-card',\n bookPayment = 'unit-elements-book-payment',\n activity = 'unit-elements-activity',\n slot = 'unit-elements-sdk-slot',\n account = 'unit-elements-account',\n achDebitPayment = 'unit-elements-ach-debit-payment',\n achCreditPayment = 'unit-elements-ach-credit-payment'\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 width = props.width ?? '100%';\n\n const updateUnitScript = (data: SdkScriptFetched) => {\n setUnitScript(data.unitScript);\n };\n\n const updateInitializedParams = () => {\n setComponentCurrentTheme(props.theme ?? UnitSDK.getTheme());\n };\n\n useListenerToBus({ busEventKey: SDKMessage.IS_SCRIPT_FETCHED, action: updateUnitScript });\n useListenerToBus({ busEventKey: SDKMessage.IS_SDK_INITIALIZED, action: updateInitializedParams });\n\n useEffect(() => {\n if (!unitScript) {\n fetchUnitScript();\n return;\n }\n\n const componentParams = (props.params || '') + (componentCurrentTheme ? ` theme=\"${componentCurrentTheme}\"` : '');\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 setSourceHtml(newHtml);\n }, [props.params, unitScript, props.presentationMode, componentCurrentTheme, props.script]);\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 return (\n <WebView\n ref={webRef}\n cacheEnabled={false}\n scrollEnabled={props.isScrollable}\n nestedScrollEnabled={props.nestedScrollEnabled}\n onScroll={_onScroll}\n overScrollMode=\"never\"\n injectedJavaScript={unitScript}\n style={{ width: width, flex: 1, opacity: 0.99}}\n source={{ html: sourceHtml }}\n onMessage={onMessage}\n androidHardwareAccelerationDisabled\n />\n );\n});\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,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,QAA0B,0BAA0B;AACxE,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,+BAA+B;AACjF,SAASC,OAAO,QAAQ,kCAAkC;AAE1D,SAASC,UAAU,QAA0B,uCAAuC;AACpF,SAASC,qBAAqB,QAAQ,sBAAsB;AAe5D,WAAYC,gBAAgB;AAQ3B,WARWA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;AAAA,GAAhBA,gBAAgB,KAAhBA,gBAAgB;AAU5B,OAAO,MAAMC,YAAY,gBAAGhB,KAAK,CAACiB,UAAU,CAA6B,SAASD,YAAYA,CAACE,KAAK,EAAEC,MAAM,EAAE;EAC5G,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC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AE/C,KAAK,CAAC+C,mBAAoB;IAC/CC,QAAQ,EAAER,SAAU;IACpBS,cAAc,EAAC,OAAO;IACtBC,kBAAkB,EAAEhD,UAAW;IAC/BiD,KAAK,EAAE;MAAEzC,KAAK,EAAEA,KAAK;MAAE0C,IAAI,EAAE,CAAC;MAAEC,OAAO,EAAE;IAAI,CAAE;IAC/CC,MAAM,EAAE;MAAEnE,IAAI,EAAEiB;IAAW,CAAE;IAC7BwB,SAAS,EAAEA,SAAU;IACrB2B,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","UNAppInfo","WebComponentType","WebComponent","forwardRef","props","webRef","unitScript","setUnitScript","sourceHtml","setSourceHtml","componentCurrentTheme","setComponentCurrentTheme","theme","getTheme","baseName","setBaseName","width","updateUnitScript","data","updateInitializedParams","busEventKey","IS_SCRIPT_FETCHED","action","IS_SDK_INITIALIZED","getAppName","OS","name","getBundleName","replace","error","console","componentParams","params","newHtml","BODY","type","valueOf","presentationMode","SCRIPT_FROM_NATIVE","script","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","flex","opacity","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, PresentationMode } 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';\n\nconst { UNAppInfo } = NativeModules;\n\nexport interface WebComponentProps {\n type: WebComponentType;\n presentationMode?: PresentationMode,\n params?: string;\n theme?: string;\n onMessage?: (message: WebViewMessage) => void;\n script?: string;\n isScrollable?: boolean,\n nestedScrollEnabled?: boolean,\n handleScroll?: (event: any) => void,\n width?: number;\n}\n\nexport enum WebComponentType {\n card = 'unit-elements-card',\n bookPayment = 'unit-elements-book-payment',\n activity = 'unit-elements-activity',\n slot = 'unit-elements-sdk-slot',\n account = 'unit-elements-account',\n checkDeposit = 'unit-elements-check-deposit',\n achDebitPayment = 'unit-elements-ach-debit-payment',\n achCreditPayment = 'unit-elements-ach-credit-payment'\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 [baseName, setBaseName] = useState<string>();\n const width = props.width ?? '100%';\n\n const updateUnitScript = (data: SdkScriptFetched) => {\n setUnitScript(data.unitScript);\n };\n\n const updateInitializedParams = () => {\n setComponentCurrentTheme(props.theme ?? UnitSDK.getTheme());\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 componentParams = (props.params || '') + (componentCurrentTheme ? ` theme=\"${componentCurrentTheme}\"` : '');\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 setSourceHtml(newHtml);\n }, [props.params, unitScript, props.presentationMode, componentCurrentTheme, props.script]);\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: width, flex: 1, opacity: 0.99}}\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,QAA0B,0BAA0B;AACxE,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,+BAA+B;AACjF,SAASC,OAAO,QAAQ,kCAAkC;AAE1D,SAASC,UAAU,QAA0B,uCAAuC;AACpF,SAASC,qBAAqB,QAAQ,sBAAsB;AAE5D,MAAM;EAAEC;AAAU,CAAC,GAAGd,aAAa;AAenC,WAAYe,gBAAgB;AAS3B,WATWA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;AAAA,GAAhBA,gBAAgB,KAAhBA,gBAAgB;AAW5B,OAAO,MAAMC,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,EAA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KAAK,CAACoC,SAAS,CAACE,OAAO,CAAC;IAAC;EAElD,CAAC;EAED,IAAI,CAAClC,UAAU,EAAE,OAAO,IAAI;EAE5B,MAAM4C,SAAS,GAAIH,KAAU,IAAK;IAChC,IAAI7C,KAAK,CAACiD,YAAY,EAAE;MACtBjD,KAAK,CAACiD,YAAY,CAACJ,KAAK,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb,CAAC;EAED,IAAI,CAACnC,QAAQ,EAAE;IACb,OAAO,IAAI;EACb;EAEA,oBACE/B,KAAA,CAAAuE,aAAA,CAAClE,OAAO;IACNmE,GAAG,EAAElD,MAAO;IACZmD,eAAe,EAAE,CAAC,GAAG,CAAE;IACvBC,+BAA+B,EAAE,KAAM;IACvCC,yBAAyB,EAAE,IAAK;IAChCC,YAAY,EAAE,KAAM;IACpBC,aAAa,EAAExD,KAAK,CAACyD,YAAa;IAClCC,mBAAmB,EAAE1D,KAAK,CAAC0D,mBAAoB;IAC/CC,QAAQ,EAAEX,SAAU;IACpBY,cAAc,EAAC,OAAO;IACtBC,kBAAkB,EAAE3D,UAAW;IAC/B4D,KAAK,EAAE;MAAElD,KAAK,EAAEA,KAAK;MAAEmD,IAAI,EAAE,CAAC;MAAEC,OAAO,EAAE;IAAI,CAAE;IAC/CC,MAAM,EAAE;MAAE/E,IAAI,EAAEkB,UAAU;MAAE8D,OAAO,EAAG,WAAUxD,QAAS;IAAE,CAAE;IAC7D0B,SAAS,EAAEA,SAAU;IACrB+B,mCAAmC;EAAA,EACnC;AAEN,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
-
import { DISPATCH_RENDERING_EVENT, LISTENERS, POST_MESSAGE_TO_SDK, POST_PAGE_HEIGHT, DISPATCH_REQUEST_CARD_ACTION, DISPATCH_OPEN_ACTIONS_MENU } from '../scripts/html/bodyScript';
|
|
2
|
+
import { 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';
|
|
3
3
|
export const HTML_PLACEHOLDER = {
|
|
4
4
|
SCRIPT_UNIT: '<SCRIPT_UNIT>',
|
|
5
5
|
BODY: '<BODY_HTML_CODE>',
|
|
@@ -19,7 +19,7 @@ const htmlText = `
|
|
|
19
19
|
}
|
|
20
20
|
</script>
|
|
21
21
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
|
|
22
|
-
</
|
|
22
|
+
</head>
|
|
23
23
|
|
|
24
24
|
<body style="margin: 0;">
|
|
25
25
|
${HTML_PLACEHOLDER.BODY}
|
|
@@ -49,15 +49,22 @@ const htmlText = `
|
|
|
49
49
|
|
|
50
50
|
${LISTENERS.unitAccountChanged}
|
|
51
51
|
|
|
52
|
+
${LISTENERS.unitActivityFiltersChanged}
|
|
53
|
+
|
|
52
54
|
${DISPATCH_RENDERING_EVENT}
|
|
53
55
|
|
|
54
56
|
${DISPATCH_OPEN_ACTIONS_MENU}
|
|
55
57
|
|
|
56
58
|
${DISPATCH_REQUEST_CARD_ACTION}
|
|
57
59
|
|
|
60
|
+
${DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT}
|
|
61
|
+
|
|
62
|
+
${DISPATCH_REQUEST_ACCOUNT_ACTION}
|
|
63
|
+
|
|
58
64
|
${HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE}
|
|
59
65
|
</script>
|
|
60
66
|
</body>
|
|
67
|
+
</html>
|
|
61
68
|
`;
|
|
62
69
|
export default htmlText;
|
|
63
70
|
//# sourceMappingURL=html.js.map
|
|
@@ -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","HTML_PLACEHOLDER","SCRIPT_UNIT","BODY","SCRIPT_FROM_NATIVE","htmlText","OS","isPageLoaded","onLoad","unitRequestDownload","requestRendering","requestOpenLink","requestCloseFlow","cardActivated","cardStatusChange","unitRequestExternalSdk","unitAccountChanged"],"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 } 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};\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 </script>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=0\">\n </
|
|
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","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};\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 </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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G,kBAAmB;AAC5C;AACA;AACA;AACA,CAAC;AAED,eAAeC,QAAQ"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { UNOnLoadResponse } from '../../sharedTypes';
|
|
3
3
|
import type { UNAccountData } from '../../sharedTypes/account.types';
|
|
4
|
+
import type { UNAccountMenuAction } from '../../sharedTypes';
|
|
4
5
|
export interface UNAccountComponentProps {
|
|
5
6
|
accountId?: string;
|
|
6
7
|
customerToken: string;
|
|
7
8
|
theme?: string;
|
|
9
|
+
hideActionsMenuButton?: boolean;
|
|
10
|
+
hideSelectionMenuButton?: boolean;
|
|
8
11
|
onLoad?: (response: UNOnLoadResponse<[UNAccountData]>) => void;
|
|
9
12
|
onAccountChanged?: (account: UNAccountData) => void;
|
|
10
13
|
}
|
|
11
14
|
export interface UNAccountRef {
|
|
12
15
|
openActionsMenu: () => void;
|
|
16
|
+
openAction: (action: UNAccountMenuAction) => void;
|
|
13
17
|
}
|
|
14
18
|
export declare enum AccountAction {
|
|
15
19
|
List = "account-list",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AccountAction, UNAccountComponentProps } from './UNAccountComponent';
|
|
2
2
|
import { RequestRefreshEvent, RequestRenderingEvent } from '../../messages/webMessages/unitMessages';
|
|
3
3
|
import type WebView from 'react-native-webview';
|
|
4
|
+
import type { UNAccountMenuAction } from 'src/sharedTypes';
|
|
4
5
|
export declare const getAccountParams: (props: UNAccountComponentProps) => string;
|
|
5
6
|
export declare const getAccountScript: () => string;
|
|
6
7
|
export declare const injectOpenActionsMenuScript: (currentWeb: WebView | null) => void;
|
|
8
|
+
export declare const injectRequestAccountActionScript: (currentWeb: WebView | null, action: UNAccountMenuAction) => void;
|
|
7
9
|
export declare const injectRefreshEventIfNeeded: (currentWeb: WebView | null, requestRefreshEvent: RequestRefreshEvent | null) => void;
|
|
8
10
|
export declare const getAccountActionType: (requestRendering: RequestRenderingEvent) => AccountAction;
|
|
@@ -3,8 +3,9 @@ import type { UNActivityOnLoadData } from '../../sharedTypes/activity.types';
|
|
|
3
3
|
export interface UNActivityComponentProps {
|
|
4
4
|
accountId: string;
|
|
5
5
|
customerToken: string;
|
|
6
|
+
queryFilter?: string;
|
|
6
7
|
theme?: string;
|
|
8
|
+
hideFilterButton?: boolean;
|
|
7
9
|
onLoad?: (response: UNOnLoadResponse<UNActivityOnLoadData>) => void;
|
|
8
|
-
queryFilter?: string;
|
|
9
10
|
}
|
|
10
11
|
export declare const UNActivityComponent: (props: UNActivityComponentProps) => JSX.Element;
|
|
@@ -4,3 +4,4 @@ import type { UNActivityComponentProps } from './UNActivityComponent';
|
|
|
4
4
|
export declare const getActivityParams: (props: UNActivityComponentProps) => string;
|
|
5
5
|
export declare const getActivityScript: () => string;
|
|
6
6
|
export declare const injectRefreshEventIfNeeded: (currentWeb: WebView | null, requestRefreshEvent: RequestRefreshEvent | null) => void;
|
|
7
|
+
export declare const injectFiltersChanged: (currentWeb: WebView | null, query: string) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UNCheckDepositData } from '../../sharedTypes/checkDeposit.types';
|
|
2
|
+
import type { UNAccountData, UNOnLoadResponse } from '../../sharedTypes';
|
|
3
|
+
export interface UNCheckDepositComponentProps {
|
|
4
|
+
accountId: string;
|
|
5
|
+
fee: number;
|
|
6
|
+
customerToken: string;
|
|
7
|
+
theme?: string;
|
|
8
|
+
onLoad?: (response: UNOnLoadResponse<UNAccountData>) => void;
|
|
9
|
+
onDepositCreated?: (checkData: UNCheckDepositData) => void;
|
|
10
|
+
onRestartRequest?: (checkData: UNCheckDepositData) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const UNCheckDepositComponent: (props: UNCheckDepositComponentProps) => JSX.Element;
|
|
@@ -3,5 +3,6 @@ export * from './UNBottomSheetComponent/UNBottomSheetComponent';
|
|
|
3
3
|
export * from './UNBookPaymentComponent/UNBookPaymentComponent';
|
|
4
4
|
export * from './UNActivityComponent/UNActivityComponent';
|
|
5
5
|
export * from './UNAccountComponent/UNAccountComponent';
|
|
6
|
+
export * from './UNCheckDepositComponent/UNCheckDepositComponent';
|
|
6
7
|
export * from './UNACHDebitComponent/UNACHDebitComponent';
|
|
7
8
|
export * from './UNACHCreditComponent/UNACHCreditComponent';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UNCheckDepositData } from '../../sharedTypes/checkDeposit.types';
|
|
2
|
+
export declare enum CheckMessage {
|
|
3
|
+
CHECK_DEPOSIT_CREATED = "unitCheckDepositCreated",
|
|
4
|
+
CHECK_DEPOSIT_RESTART_REQUEST = "unitCheckDepositRestartRequest"
|
|
5
|
+
}
|
|
6
|
+
export type CheckDepositCreatedEvent = UNCheckDepositData;
|
|
7
|
+
export type CheckDepositRestartRequestEvent = UNCheckDepositData;
|
|
8
|
+
export type CheckEvent = CheckDepositCreatedEvent | CheckDepositRestartRequestEvent;
|
|
@@ -5,8 +5,10 @@ import type { PageEvent, PageMessage } from './pageMessage';
|
|
|
5
5
|
import type { PaymentMessage } from './paymentsMessage';
|
|
6
6
|
import type { UnitEvent, UnitMessage } from './unitMessages';
|
|
7
7
|
import type { AccountEvent, AccountMessage } from './accountMessage';
|
|
8
|
-
|
|
9
|
-
type
|
|
8
|
+
import type { CheckEvent, CheckMessage } from './checkMessage';
|
|
9
|
+
import type { ActivityEvent, ActivityMessage } from './activityMessage';
|
|
10
|
+
export type WebViewMessageType = PageMessage | CardMessage | UnitMessage | PaymentMessage | AccountMessage | CheckMessage | ActivityMessage;
|
|
11
|
+
type WebViewEvent = PageEvent | UnitEvent | CardEvent | BookPaymentEvent | PaymentMessage | ACHEvent | AccountEvent | CheckEvent | ActivityEvent;
|
|
10
12
|
export interface WebViewMessage {
|
|
11
13
|
type: WebViewMessageType;
|
|
12
14
|
details?: WebViewEvent;
|
|
@@ -13,9 +13,12 @@ export declare const LISTENERS: {
|
|
|
13
13
|
unitRequestExternalSdk: string;
|
|
14
14
|
unitPaymentCreated: string;
|
|
15
15
|
unitAccountChanged: string;
|
|
16
|
+
unitActivityFiltersChanged: string;
|
|
16
17
|
};
|
|
17
18
|
export declare const DISPATCH_RENDERING_EVENT: string;
|
|
18
19
|
export declare const DISPATCH_REQUEST_REFRESH: string;
|
|
20
|
+
export declare const DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT: string;
|
|
19
21
|
export declare const DISPATCH_PLAID_RESPONSE: string;
|
|
20
22
|
export declare const DISPATCH_OPEN_ACTIONS_MENU = "\n const dispatchOpenActionsMenu = (componentName) => {\n document.querySelector(componentName).dispatchEvent(new CustomEvent(\"unitRequestOpenActionsMenu\"))\n }\n";
|
|
21
23
|
export declare const DISPATCH_REQUEST_CARD_ACTION = "\n const dispatchRequestCardAction = (action) => {\n document.querySelector(\"unit-elements-card\").dispatchEvent(new CustomEvent(\"unitRequestCardAction\", {detail: {action: action}}))\n }\n";
|
|
24
|
+
export declare const DISPATCH_REQUEST_ACCOUNT_ACTION = "\n const dispatchRequestAccountAction = (action) => {\n document.querySelector(\"unit-elements-account\").dispatchEvent(new CustomEvent(\"unitRequestAccountAction\", {detail: {action: action}}))\n }\n";
|
|
@@ -120,4 +120,9 @@ export type UNCreditAccount = {
|
|
|
120
120
|
org: UNRelationship;
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
|
+
export declare enum UNAccountMenuAction {
|
|
124
|
+
OpenAccountDetails = "OpenAccountDetails",
|
|
125
|
+
OpenAccountStatements = "OpenAccountStatements",
|
|
126
|
+
DownloadBankVerificationLetter = "DownloadBankVerificationLetter"
|
|
127
|
+
}
|
|
123
128
|
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { UNRelationship } from './types';
|
|
2
|
+
export type UNCheckDepositData = {
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
attributes: UNCheckDepositAttributes;
|
|
6
|
+
relationships: UNCheckDepositRelationships;
|
|
7
|
+
};
|
|
8
|
+
export type UNCheckDepositAttributes = {
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
status: keyof typeof UNCheckDepositStatus;
|
|
11
|
+
reason?: string;
|
|
12
|
+
description: string;
|
|
13
|
+
amount: Cents;
|
|
14
|
+
checkNumber?: string;
|
|
15
|
+
counterparty: UNCheckCounterparty;
|
|
16
|
+
settlementDate?: Date;
|
|
17
|
+
tags?: {
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type UNCheckDepositRelationships = {
|
|
22
|
+
account: UNRelationship;
|
|
23
|
+
customer?: UNRelationship;
|
|
24
|
+
customers?: UNRelationship;
|
|
25
|
+
org?: UNRelationship;
|
|
26
|
+
transaction?: UNRelationship;
|
|
27
|
+
};
|
|
28
|
+
export declare enum UNCheckDepositStatus {
|
|
29
|
+
AwaitingImages = "AwaitingImages",
|
|
30
|
+
AwaitingFrontImage = "AwaitingFrontImage",
|
|
31
|
+
AwaitingBackImage = "AwaitingBackImage",
|
|
32
|
+
PendingReview = "PendingReview",
|
|
33
|
+
AwaitingCustomerConfirmation = "AwaitingCustomerConfirmation",
|
|
34
|
+
Pending = "Pending",
|
|
35
|
+
Rejected = "Rejected",
|
|
36
|
+
Clearing = "Clearing",
|
|
37
|
+
Sent = "Sent",
|
|
38
|
+
Canceled = "Canceled",
|
|
39
|
+
Returned = "Returned"
|
|
40
|
+
}
|
|
41
|
+
export type Cents = number;
|
|
42
|
+
export type UNCheckCounterparty = {
|
|
43
|
+
name: string;
|
|
44
|
+
accountNumber: string;
|
|
45
|
+
routingNumber: string;
|
|
46
|
+
};
|
|
@@ -20,6 +20,7 @@ export declare enum WebComponentType {
|
|
|
20
20
|
activity = "unit-elements-activity",
|
|
21
21
|
slot = "unit-elements-sdk-slot",
|
|
22
22
|
account = "unit-elements-account",
|
|
23
|
+
checkDeposit = "unit-elements-check-deposit",
|
|
23
24
|
achDebitPayment = "unit-elements-ach-debit-payment",
|
|
24
25
|
achCreditPayment = "unit-elements-ach-credit-payment"
|
|
25
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unit-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Unit React Native components",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"react": "*",
|
|
76
76
|
"react-native": "*",
|
|
77
|
-
"react-native-
|
|
78
|
-
"react-native-
|
|
77
|
+
"react-native-plaid-link-sdk": "*",
|
|
78
|
+
"react-native-webview": "*"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"axios": "^1.3.3",
|
|
@@ -6,7 +6,7 @@ import { RequestRefreshEvent, RequestRenderingEvent, UnitMessage } from '../../m
|
|
|
6
6
|
import EventBus from '../../helpers/EventBus';
|
|
7
7
|
import { WebComponent, WebComponentType } from '../../webComponent/WebComponent';
|
|
8
8
|
import type { WebViewMessage } from '../../messages/webMessages';
|
|
9
|
-
import { getAccountParams, getAccountScript, injectOpenActionsMenuScript, injectRefreshEventIfNeeded } from './UNAccountComponent.utils';
|
|
9
|
+
import { getAccountParams, getAccountScript, injectOpenActionsMenuScript, injectRefreshEventIfNeeded, injectRequestAccountActionScript } from './UNAccountComponent.utils';
|
|
10
10
|
import { PresentationMode } from '../../scripts/html/bodyHtml';
|
|
11
11
|
import type { BottomSheetSlotData } from '../UNBottomSheetComponent/UNBottomSheetComponent';
|
|
12
12
|
import type { UNError, UNOnLoadResponse, UNOnLoadResponseData } from '../../sharedTypes';
|
|
@@ -14,17 +14,26 @@ import { useListenerToBus } from '../../hooks/listenerToBus';
|
|
|
14
14
|
import type { UNAccountData } from '../../sharedTypes/account.types';
|
|
15
15
|
import { AccountMessage } from '../../messages/webMessages/accountMessage';
|
|
16
16
|
import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
|
|
17
|
+
import type { UNAccountMenuAction } from '../../sharedTypes';
|
|
17
18
|
|
|
18
19
|
export interface UNAccountComponentProps {
|
|
20
|
+
// inputs
|
|
19
21
|
accountId?: string;
|
|
20
22
|
customerToken: string;
|
|
23
|
+
|
|
24
|
+
// ui
|
|
21
25
|
theme?: string;
|
|
26
|
+
hideActionsMenuButton?: boolean;
|
|
27
|
+
hideSelectionMenuButton?: boolean;
|
|
28
|
+
|
|
29
|
+
// events
|
|
22
30
|
onLoad?: (response: UNOnLoadResponse<[UNAccountData]>) => void;
|
|
23
31
|
onAccountChanged?: (account: UNAccountData) => void;
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
export interface UNAccountRef {
|
|
27
35
|
openActionsMenu: () => void;
|
|
36
|
+
openAction: (action: UNAccountMenuAction) => void;
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
export enum AccountAction {
|
|
@@ -78,6 +87,9 @@ export const UNAccountComponent = React.forwardRef<UNAccountRef, UNAccountCompon
|
|
|
78
87
|
useImperativeHandle(accountRef, () => ({
|
|
79
88
|
openActionsMenu() {
|
|
80
89
|
injectOpenActionsMenuScript(webRef.current);
|
|
90
|
+
},
|
|
91
|
+
openAction(action: UNAccountMenuAction) {
|
|
92
|
+
injectRequestAccountActionScript(webRef.current, action);
|
|
81
93
|
}
|
|
82
94
|
}));
|
|
83
95
|
|
|
@@ -2,11 +2,14 @@ import { AccountAction, UNAccountComponentProps } from './UNAccountComponent';
|
|
|
2
2
|
import { RequestRefreshEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
3
3
|
import type WebView from 'react-native-webview';
|
|
4
4
|
import { WebComponentType } from '../../webComponent/WebComponent';
|
|
5
|
+
import type { UNAccountMenuAction } from 'src/sharedTypes';
|
|
5
6
|
|
|
6
7
|
export const getAccountParams = (props: UNAccountComponentProps) => {
|
|
7
8
|
return `
|
|
8
9
|
account-id="${props.accountId}"
|
|
9
10
|
customer-token="${props.customerToken}"
|
|
11
|
+
hide-actions-menu-button="${props.hideActionsMenuButton || false}"
|
|
12
|
+
hide-selection-menu-button="${props.hideSelectionMenuButton || false}"
|
|
10
13
|
`;
|
|
11
14
|
};
|
|
12
15
|
|
|
@@ -23,6 +26,10 @@ export const injectOpenActionsMenuScript = (currentWeb: WebView | null) => {
|
|
|
23
26
|
currentWeb?.injectJavaScript(`dispatchOpenActionsMenu('${WebComponentType.account}')`);
|
|
24
27
|
};
|
|
25
28
|
|
|
29
|
+
export const injectRequestAccountActionScript = (currentWeb: WebView | null, action: UNAccountMenuAction) => {
|
|
30
|
+
currentWeb?.injectJavaScript(`dispatchRequestAccountAction('${action}')`);
|
|
31
|
+
};
|
|
32
|
+
|
|
26
33
|
export const injectRefreshEventIfNeeded = (currentWeb: WebView | null, requestRefreshEvent: RequestRefreshEvent | null) => {
|
|
27
34
|
if (requestRefreshEvent && requestRefreshEvent.dependencies.includes(WebComponentType.account.valueOf())) {
|
|
28
35
|
currentWeb?.injectJavaScript(`dispatchRefreshEvent('${JSON.stringify(requestRefreshEvent)}')`);
|