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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ActivityMessage","exports"],"sources":["activityMessage.ts"],"sourcesContent":["export enum ActivityMessage {\n UNIT_ACTIVITY_FILTERS_CHANGED = 'unitActivityFiltersChanged'\n}\n\nexport type ActivityFiltersChangedEvent = string\n\nexport type ActivityEvent =\n | ActivityFiltersChangedEvent\n"],"mappings":";;;;;;IAAYA,eAAe;AAAAC,OAAA,CAAAD,eAAA,GAAAA,eAAA;AAAA,WAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,KAAAC,OAAA,CAAAD,eAAA,GAAfA,eAAe"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CheckMessage = void 0;
|
|
7
|
+
let CheckMessage;
|
|
8
|
+
exports.CheckMessage = CheckMessage;
|
|
9
|
+
(function (CheckMessage) {
|
|
10
|
+
CheckMessage["CHECK_DEPOSIT_CREATED"] = "unitCheckDepositCreated";
|
|
11
|
+
CheckMessage["CHECK_DEPOSIT_RESTART_REQUEST"] = "unitCheckDepositRestartRequest";
|
|
12
|
+
})(CheckMessage || (exports.CheckMessage = CheckMessage = {}));
|
|
13
|
+
//# sourceMappingURL=checkMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CheckMessage","exports"],"sources":["checkMessage.ts"],"sourcesContent":["import type { UNCheckDepositData } from '../../sharedTypes/checkDeposit.types';\n\nexport enum CheckMessage {\n // check deposit\n CHECK_DEPOSIT_CREATED = 'unitCheckDepositCreated',\n CHECK_DEPOSIT_RESTART_REQUEST = 'unitCheckDepositRestartRequest'\n}\n\nexport type CheckDepositCreatedEvent = UNCheckDepositData\nexport type CheckDepositRestartRequestEvent = UNCheckDepositData\n\nexport type CheckEvent =\n| CheckDepositCreatedEvent\n| CheckDepositRestartRequestEvent\n"],"mappings":";;;;;;IAEYA,YAAY;AAAAC,OAAA,CAAAD,YAAA,GAAAA,YAAA;AAAA,WAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;AAAA,GAAZA,YAAY,KAAAC,OAAA,CAAAD,YAAA,GAAZA,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import type { ACHEvent } from './achCreditMessage';\nimport type { BookPaymentEvent } from './bookPaymentMessage';\n\nimport type { CardEvent, CardMessage } from './cardMessage';\nimport type { PageEvent, PageMessage } from './pageMessage';\nimport type { PaymentMessage } from './paymentsMessage';\nimport type { UnitEvent, UnitMessage } from './unitMessages';\nimport type { AccountEvent, AccountMessage } from './accountMessage';\n\nexport type WebViewMessageType =\n | PageMessage\n | CardMessage\n | UnitMessage\n | PaymentMessage\n | AccountMessage\n\ntype WebViewEvent =\n | PageEvent\n | UnitEvent\n | CardEvent\n | BookPaymentEvent\n | PaymentMessage\n | ACHEvent\n | AccountEvent\n\nexport interface WebViewMessage {\n type: WebViewMessageType,\n details?: WebViewEvent\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import type { ACHEvent } from './achCreditMessage';\nimport type { BookPaymentEvent } from './bookPaymentMessage';\n\nimport type { CardEvent, CardMessage } from './cardMessage';\nimport type { PageEvent, PageMessage } from './pageMessage';\nimport type { PaymentMessage } from './paymentsMessage';\nimport type { UnitEvent, UnitMessage } from './unitMessages';\nimport type { AccountEvent, AccountMessage } from './accountMessage';\nimport type { CheckEvent, CheckMessage } from './checkMessage';\nimport type { ActivityEvent, ActivityMessage } from './activityMessage';\n\nexport type WebViewMessageType =\n | PageMessage\n | CardMessage\n | UnitMessage\n | PaymentMessage\n | AccountMessage\n | CheckMessage\n | ActivityMessage\n\ntype WebViewEvent =\n | PageEvent\n | UnitEvent\n | CardEvent\n | BookPaymentEvent\n | PaymentMessage\n | ACHEvent\n | AccountEvent\n | CheckEvent\n | ActivityEvent\n\nexport interface WebViewMessage {\n type: WebViewMessageType,\n details?: WebViewEvent\n}\n"],"mappings":""}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.POST_PAGE_HEIGHT = exports.POST_MESSAGE_TO_SDK = exports.LISTENERS = exports.DISPATCH_REQUEST_REFRESH = exports.DISPATCH_REQUEST_CARD_ACTION = exports.DISPATCH_RENDERING_EVENT = exports.DISPATCH_PLAID_RESPONSE = exports.DISPATCH_OPEN_ACTIONS_MENU = void 0;
|
|
6
|
+
exports.POST_PAGE_HEIGHT = exports.POST_MESSAGE_TO_SDK = exports.LISTENERS = exports.DISPATCH_REQUEST_REFRESH = exports.DISPATCH_REQUEST_CARD_ACTION = exports.DISPATCH_REQUEST_ACCOUNT_ACTION = exports.DISPATCH_RENDERING_EVENT = exports.DISPATCH_PLAID_RESPONSE = exports.DISPATCH_OPEN_ACTIONS_MENU = exports.DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT = void 0;
|
|
7
7
|
var _paymentsMessage = require("../../messages/webMessages/paymentsMessage");
|
|
8
8
|
var _cardMessage = require("../../messages/webMessages/cardMessage");
|
|
9
9
|
var _pageMessage = require("../../messages/webMessages/pageMessage");
|
|
10
10
|
var _unitMessages = require("../../messages/webMessages/unitMessages");
|
|
11
11
|
var _accountMessage = require("../../messages/webMessages/accountMessage");
|
|
12
|
+
var _activityMessage = require("../../messages/webMessages/activityMessage");
|
|
12
13
|
const POST_MESSAGE_TO_SDK = `
|
|
13
14
|
const postMessageToSDK = (message) => {
|
|
14
15
|
if ('ReactNativeWebView' in window) {
|
|
@@ -107,6 +108,11 @@ const LISTENERS = {
|
|
|
107
108
|
console.log(e)
|
|
108
109
|
})
|
|
109
110
|
});
|
|
111
|
+
`,
|
|
112
|
+
unitActivityFiltersChanged: `
|
|
113
|
+
window.addEventListener("${_activityMessage.ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}", (e) => {
|
|
114
|
+
postMessageToSDK({ type: "${_activityMessage.ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}", details: e.detail })
|
|
115
|
+
});
|
|
110
116
|
`
|
|
111
117
|
};
|
|
112
118
|
exports.LISTENERS = LISTENERS;
|
|
@@ -124,6 +130,13 @@ const DISPATCH_REQUEST_REFRESH = `
|
|
|
124
130
|
}
|
|
125
131
|
`;
|
|
126
132
|
exports.DISPATCH_REQUEST_REFRESH = DISPATCH_REQUEST_REFRESH;
|
|
133
|
+
const DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT = `
|
|
134
|
+
const dispatchActivityFilterChangedEvent = (details) => {
|
|
135
|
+
const event = new CustomEvent("${_activityMessage.ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED}",{ detail: details });
|
|
136
|
+
window.dispatchEvent(event);
|
|
137
|
+
}
|
|
138
|
+
`;
|
|
139
|
+
exports.DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT = DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT;
|
|
127
140
|
const DISPATCH_PLAID_RESPONSE = `
|
|
128
141
|
const dispatchPlaidEvent = (details) => {
|
|
129
142
|
const event = new CustomEvent("${_unitMessages.UnitMessage.UNIT_PLAID_RESPONSE}",{ detail: details })
|
|
@@ -143,4 +156,10 @@ const DISPATCH_REQUEST_CARD_ACTION = `
|
|
|
143
156
|
}
|
|
144
157
|
`;
|
|
145
158
|
exports.DISPATCH_REQUEST_CARD_ACTION = DISPATCH_REQUEST_CARD_ACTION;
|
|
159
|
+
const DISPATCH_REQUEST_ACCOUNT_ACTION = `
|
|
160
|
+
const dispatchRequestAccountAction = (action) => {
|
|
161
|
+
document.querySelector("unit-elements-account").dispatchEvent(new CustomEvent("unitRequestAccountAction", {detail: {action: action}}))
|
|
162
|
+
}
|
|
163
|
+
`;
|
|
164
|
+
exports.DISPATCH_REQUEST_ACCOUNT_ACTION = DISPATCH_REQUEST_ACCOUNT_ACTION;
|
|
146
165
|
//# sourceMappingURL=bodyScript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_paymentsMessage","require","_cardMessage","_pageMessage","_unitMessages","_accountMessage","POST_MESSAGE_TO_SDK","exports","POST_PAGE_HEIGHT","PageMessage","PAGE_HEIGHT","LISTENERS","isPageLoaded","PAGE_LOADED","requestRendering","UnitMessage","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","CardMessage","CARD_ACTIVATED","cardStatusChange","CARD_STATUS_CHANGED","unitRequestExternalSdk","UNIT_REQUEST_EXTERNAL_SDK","unitPaymentCreated","PaymentMessage","PAYMENT_CREATED","unitAccountChanged","AccountMessage","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":["_paymentsMessage","require","_cardMessage","_pageMessage","_unitMessages","_accountMessage","_activityMessage","POST_MESSAGE_TO_SDK","exports","POST_PAGE_HEIGHT","PageMessage","PAGE_HEIGHT","LISTENERS","isPageLoaded","PAGE_LOADED","requestRendering","UnitMessage","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","CardMessage","CARD_ACTIVATED","cardStatusChange","CARD_STATUS_CHANGED","unitRequestExternalSdk","UNIT_REQUEST_EXTERNAL_SDK","unitPaymentCreated","PaymentMessage","PAYMENT_CREATED","unitAccountChanged","AccountMessage","UNIT_ACCOUNT_CHANGED","unitActivityFiltersChanged","ActivityMessage","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,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AAEO,MAAMM,mBAAmB,GAAI;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAACC,OAAA,CAAAD,mBAAA,GAAAA,mBAAA;AAEK,MAAME,gBAAgB,GAAI;AACjC;AACA;AACA;AACA,kCAAkCC,wBAAW,CAACC,WAAY;AAC1D;AACA;AACA,CAAC;AAACH,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAEK,MAAMG,SAAS,GAAG;EACvBC,YAAY,EAAG;AACjB;AACA,kCAAkCH,wBAAW,CAACI,WAAY;AAC1D;AACA,GAAG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BAAqB;AACnE;AACA;AACA,oCAAoCD,8BAAc,CAACC,oBAAqB;AACxE;AACA;AACA;AACA;AACA,GAAG;EACDC,0BAA0B,EAAG;AAC/B,+BAA+BC,gCAAe,CAACC,6BAA8B;AAC7E,kCAAkCD,gCAAe,CAACC,6BAA8B;AAChF;AACA;AACA,CAAC;AAACnC,OAAA,CAAAI,SAAA,GAAAA,SAAA;AAEK,MAAMgC,wBAAwB,GAAI;AACzC;AACA,qCAAqC5B,yBAAW,CAACC,sBAAuB;AACxE;AACA;AACA,CAAC;AAACT,OAAA,CAAAoC,wBAAA,GAAAA,wBAAA;AAEK,MAAMC,wBAAwB,GAAI;AACzC;AACA,qCAAqC7B,yBAAW,CAACG,oBAAqB;AACtE;AACA;AACA,CAAC;AAACX,OAAA,CAAAqC,wBAAA,GAAAA,wBAAA;AAEK,MAAMC,sCAAsC,GAAI;AACvD;AACA,uCAAuCJ,gCAAe,CAACC,6BAA8B;AACrF;AACA;AACA,CAAC;AAACnC,OAAA,CAAAsC,sCAAA,GAAAA,sCAAA;AAEK,MAAMC,uBAAuB,GAAI;AACxC;AACA,qCAAqC/B,yBAAW,CAACgC,mBAAoB;AACrE;AACA;AACA,CAAC;AAACxC,OAAA,CAAAuC,uBAAA,GAAAA,uBAAA;AAEK,MAAME,0BAA0B,GAAI;AAC3C;AACA;AACA;AACA,CAAC;AAACzC,OAAA,CAAAyC,0BAAA,GAAAA,0BAAA;AAEK,MAAMC,4BAA4B,GAAI;AAC7C;AACA;AACA;AACA,CAAC;AAAC1C,OAAA,CAAA0C,4BAAA,GAAAA,4BAAA;AAEK,MAAMC,+BAA+B,GAAI;AAChD;AACA;AACA;AACA,CAAC;AAAC3C,OAAA,CAAA2C,+BAAA,GAAAA,+BAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.UNFraudReason = exports.UNCloseReason = void 0;
|
|
6
|
+
exports.UNFraudReason = exports.UNCloseReason = exports.UNAccountMenuAction = void 0;
|
|
7
7
|
var UNAccountStatus;
|
|
8
8
|
(function (UNAccountStatus) {
|
|
9
9
|
UNAccountStatus["Open"] = "Open";
|
|
@@ -28,4 +28,11 @@ exports.UNFraudReason = UNFraudReason;
|
|
|
28
28
|
UNFraudReason["IdentityTheft"] = "IdentityTheft";
|
|
29
29
|
UNFraudReason["LinkedToFraudulentCustomer"] = "LinkedToFraudulentCustomer";
|
|
30
30
|
})(UNFraudReason || (exports.UNFraudReason = UNFraudReason = {}));
|
|
31
|
+
let UNAccountMenuAction;
|
|
32
|
+
exports.UNAccountMenuAction = UNAccountMenuAction;
|
|
33
|
+
(function (UNAccountMenuAction) {
|
|
34
|
+
UNAccountMenuAction["OpenAccountDetails"] = "OpenAccountDetails";
|
|
35
|
+
UNAccountMenuAction["OpenAccountStatements"] = "OpenAccountStatements";
|
|
36
|
+
UNAccountMenuAction["DownloadBankVerificationLetter"] = "DownloadBankVerificationLetter";
|
|
37
|
+
})(UNAccountMenuAction || (exports.UNAccountMenuAction = UNAccountMenuAction = {}));
|
|
31
38
|
//# sourceMappingURL=account.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["UNAccountStatus","UNCloseReason","exports","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","exports","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;AAAA,IAMRC,aAAa;AAAAC,OAAA,CAAAD,aAAA,GAAAA,aAAA;AAAA,WAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,KAAAC,OAAA,CAAAD,aAAA,GAAbA,aAAa;AAAA,IAKbE,aAAa;AAAAD,OAAA,CAAAC,aAAA,GAAAA,aAAA;AAAA,WAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,KAAAD,OAAA,CAAAC,aAAA,GAAbA,aAAa;AAAA,IAuGbC,mBAAmB;AAAAF,OAAA,CAAAE,mBAAA,GAAAA,mBAAA;AAAA,WAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;AAAA,GAAnBA,mBAAmB,KAAAF,OAAA,CAAAE,mBAAA,GAAnBA,mBAAmB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UNCheckDepositStatus = void 0;
|
|
7
|
+
let UNCheckDepositStatus;
|
|
8
|
+
exports.UNCheckDepositStatus = UNCheckDepositStatus;
|
|
9
|
+
(function (UNCheckDepositStatus) {
|
|
10
|
+
UNCheckDepositStatus["AwaitingImages"] = "AwaitingImages";
|
|
11
|
+
UNCheckDepositStatus["AwaitingFrontImage"] = "AwaitingFrontImage";
|
|
12
|
+
UNCheckDepositStatus["AwaitingBackImage"] = "AwaitingBackImage";
|
|
13
|
+
UNCheckDepositStatus["PendingReview"] = "PendingReview";
|
|
14
|
+
UNCheckDepositStatus["AwaitingCustomerConfirmation"] = "AwaitingCustomerConfirmation";
|
|
15
|
+
UNCheckDepositStatus["Pending"] = "Pending";
|
|
16
|
+
UNCheckDepositStatus["Rejected"] = "Rejected";
|
|
17
|
+
UNCheckDepositStatus["Clearing"] = "Clearing";
|
|
18
|
+
UNCheckDepositStatus["Sent"] = "Sent";
|
|
19
|
+
UNCheckDepositStatus["Canceled"] = "Canceled";
|
|
20
|
+
UNCheckDepositStatus["Returned"] = "Returned";
|
|
21
|
+
})(UNCheckDepositStatus || (exports.UNCheckDepositStatus = UNCheckDepositStatus = {}));
|
|
22
|
+
//# sourceMappingURL=checkDeposit.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["UNCheckDepositStatus","exports"],"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":";;;;;;IA6BYA,oBAAoB;AAAAC,OAAA,CAAAD,oBAAA,GAAAA,oBAAA;AAAA,WAApBA,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,KAAAC,OAAA,CAAAD,oBAAA,GAApBA,oBAAoB"}
|
|
@@ -69,4 +69,15 @@ Object.keys(_account).forEach(function (key) {
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
+
var _checkDeposit = require("./checkDeposit.types");
|
|
73
|
+
Object.keys(_checkDeposit).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _checkDeposit[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _checkDeposit[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
72
83
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bookPayment","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_card","_onLoadResponse","_achCredit","_payments","_account"],"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,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAA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A;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,UAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,SAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,SAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,SAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,SAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,QAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,QAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,QAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,QAAA,CAAAT,GAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["_bookPayment","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_card","_onLoadResponse","_achCredit","_payments","_account","_checkDeposit"],"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,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;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ports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.WebComponentType = exports.WebComponent = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
8
9
|
var _reactNativeWebview = require("react-native-webview");
|
|
9
10
|
var _EventBus = _interopRequireDefault(require("../helpers/EventBus"));
|
|
10
11
|
var _html = _interopRequireWildcard(require("./html"));
|
|
@@ -19,6 +20,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
22
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
UNAppInfo
|
|
26
|
+
} = _reactNative.NativeModules;
|
|
22
27
|
let WebComponentType;
|
|
23
28
|
exports.WebComponentType = WebComponentType;
|
|
24
29
|
(function (WebComponentType) {
|
|
@@ -27,6 +32,7 @@ exports.WebComponentType = WebComponentType;
|
|
|
27
32
|
WebComponentType["activity"] = "unit-elements-activity";
|
|
28
33
|
WebComponentType["slot"] = "unit-elements-sdk-slot";
|
|
29
34
|
WebComponentType["account"] = "unit-elements-account";
|
|
35
|
+
WebComponentType["checkDeposit"] = "unit-elements-check-deposit";
|
|
30
36
|
WebComponentType["achDebitPayment"] = "unit-elements-ach-debit-payment";
|
|
31
37
|
WebComponentType["achCreditPayment"] = "unit-elements-ach-credit-payment";
|
|
32
38
|
})(WebComponentType || (exports.WebComponentType = WebComponentType = {}));
|
|
@@ -34,6 +40,7 @@ const WebComponent = /*#__PURE__*/_react.default.forwardRef(function WebComponen
|
|
|
34
40
|
const [unitScript, setUnitScript] = (0, _react.useState)(_UnitSdk.globalUnitScript);
|
|
35
41
|
const [sourceHtml, setSourceHtml] = (0, _react.useState)(null);
|
|
36
42
|
const [componentCurrentTheme, setComponentCurrentTheme] = (0, _react.useState)(props.theme ?? _UnitSdkManager.UnitSDK.getTheme());
|
|
43
|
+
const [baseName, setBaseName] = (0, _react.useState)();
|
|
37
44
|
const width = props.width ?? '100%';
|
|
38
45
|
const updateUnitScript = data => {
|
|
39
46
|
setUnitScript(data.unitScript);
|
|
@@ -49,6 +56,24 @@ const WebComponent = /*#__PURE__*/_react.default.forwardRef(function WebComponen
|
|
|
49
56
|
busEventKey: _sdkMessage.SDKMessage.IS_SDK_INITIALIZED,
|
|
50
57
|
action: updateInitializedParams
|
|
51
58
|
});
|
|
59
|
+
(0, _react.useEffect)(() => {
|
|
60
|
+
const getAppName = async () => {
|
|
61
|
+
// For iOS, we extend the app name from the HTML to display a prettier access request message.
|
|
62
|
+
// On Android, there is no request message sent from HTML.
|
|
63
|
+
try {
|
|
64
|
+
if (_reactNative.Platform.OS == 'ios') {
|
|
65
|
+
const name = await UNAppInfo.getBundleName();
|
|
66
|
+
setBaseName(name.replace(/ /g, '-'));
|
|
67
|
+
} else {
|
|
68
|
+
// android
|
|
69
|
+
setBaseName('unit');
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error(error);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
getAppName();
|
|
76
|
+
}, []);
|
|
52
77
|
(0, _react.useEffect)(() => {
|
|
53
78
|
if (!unitScript) {
|
|
54
79
|
(0, _UnitSdk.fetchUnitScript)();
|
|
@@ -81,8 +106,14 @@ const WebComponent = /*#__PURE__*/_react.default.forwardRef(function WebComponen
|
|
|
81
106
|
}
|
|
82
107
|
return null;
|
|
83
108
|
};
|
|
109
|
+
if (!baseName) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
84
112
|
return /*#__PURE__*/_react.default.createElement(_reactNativeWebview.WebView, {
|
|
85
113
|
ref: webRef,
|
|
114
|
+
originWhitelist: ['*'],
|
|
115
|
+
mediaPlaybackRequiresUserAction: false,
|
|
116
|
+
allowsInlineMediaPlayback: true,
|
|
86
117
|
cacheEnabled: false,
|
|
87
118
|
scrollEnabled: props.isScrollable,
|
|
88
119
|
nestedScrollEnabled: props.nestedScrollEnabled,
|
|
@@ -95,7 +126,8 @@ const WebComponent = /*#__PURE__*/_react.default.forwardRef(function WebComponen
|
|
|
95
126
|
opacity: 0.99
|
|
96
127
|
},
|
|
97
128
|
source: {
|
|
98
|
-
html: sourceHtml
|
|
129
|
+
html: sourceHtml,
|
|
130
|
+
baseUrl: `https://${baseName}`
|
|
99
131
|
},
|
|
100
132
|
onMessage: onMessage,
|
|
101
133
|
androidHardwareAccelerationDisabled: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeWebview","_EventBus","_interopRequireDefault","_html","_unitMessages","_listenerToBus","_bodyHtml","_UnitSdk","_UnitSdkManager","_sdkMessage","_WebComponent","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","WebComponentType","exports","WebComponent","React","forwardRef","props","webRef","unitScript","setUnitScript","useState","globalUnitScript","sourceHtml","setSourceHtml","componentCurrentTheme","setComponentCurrentTheme","theme","UnitSDK","getTheme","width","updateUnitScript","data","updateInitializedParams","useListenerToBus","busEventKey","SDKMessage","IS_SCRIPT_FETCHED","action","IS_SDK_INITIALIZED","useEffect","fetchUnitScript","componentParams","params","newHtml","html","replace","HTML_PLACEHOLDER","BODY","getHtmlBody","type","valueOf","presentationMode","SCRIPT_FROM_NATIVE","script","onMessage","e","message","JSON","parse","nativeEvent","UnitMessage","UNIT_REQUEST_REFRESH","details","EventBus","Instance","event","UNIT_REQUEST_DOWNLOAD","handleRequestDownload","UNIT_REQUEST_CLOSE_FLOW","_onScroll","handleScroll","createElement","WebView","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":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AAEA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAA6D,SAAAG,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAjB,wBAAAa,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WA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BC,aAAa,EAAE3D,KAAK,CAAC4D,YAAa;IAClCC,mBAAmB,EAAE7D,KAAK,CAAC6D,mBAAoB;IAC/CC,QAAQ,EAAET,SAAU;IACpBU,cAAc,EAAC,OAAO;IACtBC,kBAAkB,EAAE9D,UAAW;IAC/B+D,KAAK,EAAE;MAAEpD,KAAK,EAAEA,KAAK;MAAEqD,IAAI,EAAE,CAAC;MAAEC,OAAO,EAAE;IAAI,CAAE;IAC/CC,MAAM,EAAE;MAAExC,IAAI,EAAEtB;IAAW,CAAE;IAC7BgC,SAAS,EAAEA,SAAU;IACrB+B,mCAAmC;EAAA,EACnC;AAEN,CAAC,CAAC;AAACzE,OAAA,CAAAC,YAAA,GAAAA,YAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeWebview","_EventBus","_interopRequireDefault","_html","_unitMessages","_listenerToBus","_bodyHtml","_UnitSdk","_UnitSdkManager","_sdkMessage","_WebComponent","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UNAppInfo","NativeModules","WebComponentType","exports","WebComponent","React","forwardRef","props","webRef","unitScript","setUnitScript","useState","globalUnitScript","sourceHtml","setSourceHtml","componentCurrentTheme","setComponentCurrentTheme","theme","UnitSDK","getTheme","baseName","setBaseName","width","updateUnitScript","data","updateInitializedParams","useListenerToBus","busEventKey","SDKMessage","IS_SCRIPT_FETCHED","action","IS_SDK_INITIALIZED","useEffect","getAppName","Platform","OS","name","getBundleName","replace","error","console","fetchUnitScript","componentParams","params","newHtml","html","HTML_PLACEHOLDER","BODY","getHtmlBody","type","valueOf","presentationMode","SCRIPT_FROM_NATIVE","script","onMessage","e","message","JSON","parse","nativeEvent","UnitMessage","UNIT_REQUEST_REFRESH","details","EventBus","Instance","event","UNIT_REQUEST_DOWNLOAD","handleRequestDownload","UNIT_REQUEST_CLOSE_FLOW","_onScroll","handleScroll","createElement","WebView","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":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAN,uBAAA,CAAAC,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,eAAA,GAAAV,OAAA;AAEA,IAAAW,WAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AAA6D,SAAAI,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,W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1C,IAAI,EAAEhC,UAAU;MAAE2E,OAAO,EAAG,WAAUpE,QAAS;IAAE,CAAE;IAC7DkC,SAAS,EAAEA,SAAU;IACrBmC,mCAAmC;EAAA,EACnC;AAEN,CAAC,CAAC;AAACtF,OAAA,CAAAC,YAAA,GAAAA,YAAA"}
|
|
@@ -26,7 +26,7 @@ const htmlText = `
|
|
|
26
26
|
}
|
|
27
27
|
</script>
|
|
28
28
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
|
|
29
|
-
</
|
|
29
|
+
</head>
|
|
30
30
|
|
|
31
31
|
<body style="margin: 0;">
|
|
32
32
|
${HTML_PLACEHOLDER.BODY}
|
|
@@ -56,15 +56,22 @@ const htmlText = `
|
|
|
56
56
|
|
|
57
57
|
${_bodyScript.LISTENERS.unitAccountChanged}
|
|
58
58
|
|
|
59
|
+
${_bodyScript.LISTENERS.unitActivityFiltersChanged}
|
|
60
|
+
|
|
59
61
|
${_bodyScript.DISPATCH_RENDERING_EVENT}
|
|
60
62
|
|
|
61
63
|
${_bodyScript.DISPATCH_OPEN_ACTIONS_MENU}
|
|
62
64
|
|
|
63
65
|
${_bodyScript.DISPATCH_REQUEST_CARD_ACTION}
|
|
64
66
|
|
|
67
|
+
${_bodyScript.DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT}
|
|
68
|
+
|
|
69
|
+
${_bodyScript.DISPATCH_REQUEST_ACCOUNT_ACTION}
|
|
70
|
+
|
|
65
71
|
${HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE}
|
|
66
72
|
</script>
|
|
67
73
|
</body>
|
|
74
|
+
</html>
|
|
68
75
|
`;
|
|
69
76
|
var _default = htmlText;
|
|
70
77
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_bodyScript","HTML_PLACEHOLDER","SCRIPT_UNIT","BODY","SCRIPT_FROM_NATIVE","exports","htmlText","Platform","OS","POST_MESSAGE_TO_SDK","POST_PAGE_HEIGHT","LISTENERS","isPageLoaded","onLoad","unitRequestDownload","requestRendering","requestOpenLink","requestCloseFlow","cardActivated","cardStatusChange","unitRequestExternalSdk","unitAccountChanged","DISPATCH_RENDERING_EVENT","DISPATCH_OPEN_ACTIONS_MENU","DISPATCH_REQUEST_CARD_ACTION","_default","default"],"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":["_reactNative","require","_bodyScript","HTML_PLACEHOLDER","SCRIPT_UNIT","BODY","SCRIPT_FROM_NATIVE","exports","htmlText","Platform","OS","POST_MESSAGE_TO_SDK","POST_PAGE_HEIGHT","LISTENERS","isPageLoaded","onLoad","unitRequestDownload","requestRendering","requestOpenLink","requestCloseFlow","cardActivated","cardStatusChange","unitRequestExternalSdk","unitAccountChanged","unitActivityFiltersChanged","DISPATCH_RENDERING_EVENT","DISPATCH_OPEN_ACTIONS_MENU","DISPATCH_REQUEST_CARD_ACTION","DISPATCH_ACTIVITY_FILTER_CHANGED_EVENT","DISPATCH_REQUEST_ACCOUNT_ACTION","_default","default"],"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>\n </body>\n </html>\n`;\n\nexport default htmlText;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,GAAG;EAC9BC,WAAW,EAAE,eAAe;EAC5BC,IAAI,EAAE,kBAAkB;EACxBC,kBAAkB,EAAE;AACtB,CAAC;AAACC,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA;AAEF,MAAMK,QAAQ,GAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAaC,qBAAQ,CAACC,EAAG;AACzB,qBAAqBD,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAG,OAAO,GAAG,QAAS;AAChE;AACA;AACA;AACA;AACA;AACA;AACA,MAAMP,gBAAgB,CAACE,IAAK;AAC5B;AACA;AACA,QAAQM,+BAAoB;AAC5B;AACA,QAAQC,4BAAiB;AACzB;AACA,QAAQC,qBAAS,CAACC,YAAa;AAC/B;AACA,QAAQD,qBAAS,CAACE,MAAO;AACzB;AACA,QAAQF,qBAAS,CAACG,mBAAoB;AACtC;AACA,QAAQH,qBAAS,CAACI,gBAAiB;AACnC;AACA,QAAQJ,qBAAS,CAACK,eAAgB;AAClC;AACA,QAAQL,qBAAS,CAACM,gBAAiB;AACnC;AACA,QAAQN,qBAAS,CAACO,aAAc;AAChC;AACA,QAAQP,qBAAS,CAACQ,gBAAiB;AACnC;AACA,QAAQR,qBAAS,CAACS,sBAAuB;AACzC;AACA,QAAQT,qBAAS,CAACU,kBAAmB;AACrC;AACA,QAAQV,qBAAS,CAACW,0BAA2B;AAC7C;AACA,QAAQC,oCAAyB;AACjC;AACA,QAAQC,sCAA2B;AACnC;AACA,QAAQC,wCAA6B;AACrC;AACA,QAAQC,kDAAuC;AAC/C;AACA,QAAQC,2CAAgC;AACxC;AACA,QAAQ1B,gBAAgB,CAACG,kBAAmB;AAC5C;AACA;AACA;AACA,CAAC;AAAC,IAAAwB,QAAA,GAEatB,QAAQ;AAAAD,OAAA,CAAAwB,OAAA,GAAAD,QAAA"}
|
|
@@ -4,7 +4,7 @@ import { PageMessage } from '../..//messages/webMessages/pageMessage';
|
|
|
4
4
|
import { UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
5
5
|
import EventBus from '../../helpers/EventBus';
|
|
6
6
|
import { WebComponent, WebComponentType } from '../../webComponent/WebComponent';
|
|
7
|
-
import { getAccountParams, getAccountScript, injectOpenActionsMenuScript, injectRefreshEventIfNeeded } from './UNAccountComponent.utils';
|
|
7
|
+
import { getAccountParams, getAccountScript, injectOpenActionsMenuScript, injectRefreshEventIfNeeded, injectRequestAccountActionScript } from './UNAccountComponent.utils';
|
|
8
8
|
import { PresentationMode } from '../../scripts/html/bodyHtml';
|
|
9
9
|
import { useListenerToBus } from '../../hooks/listenerToBus';
|
|
10
10
|
import { AccountMessage } from '../../messages/webMessages/accountMessage';
|
|
@@ -55,6 +55,9 @@ export const UNAccountComponent = /*#__PURE__*/React.forwardRef(function UNAccou
|
|
|
55
55
|
useImperativeHandle(accountRef, () => ({
|
|
56
56
|
openActionsMenu() {
|
|
57
57
|
injectOpenActionsMenuScript(webRef.current);
|
|
58
|
+
},
|
|
59
|
+
openAction(action) {
|
|
60
|
+
injectRequestAccountActionScript(webRef.current, action);
|
|
58
61
|
}
|
|
59
62
|
}));
|
|
60
63
|
const handleMessage = message => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useImperativeHandle","useRef","useState","Dimensions","View","PageMessage","UnitMessage","EventBus","WebComponent","WebComponentType","getAccountParams","getAccountScript","injectOpenActionsMenuScript","injectRefreshEventIfNeeded","PresentationMode","useListenerToBus","AccountMessage","RESPONSE_KEYS","AccountAction","UNAccountComponent","forwardRef","props","accountRef","height","setHeight","windowWidth","get","width","requestRefreshEvent","setRequestRefreshEvent","webRef","handleAccountChanged","account","onAccountChanged","requestRefresh","data","handleUnitOnLoad","response","onLoad","errors","console","error","busEventKey","UNIT_REQUEST_REFRESH","action","UNIT_ACCOUNT_CHANGED","current","openActionsMenu","handleMessage","message","type","UNIT_ON_LOAD","details","UNIT_REQUEST_RENDERING","event","componentName","componentResourceId","accountId","requestRenderingEvent","Instance","PAGE_HEIGHT","createElement","style","ref","presentationMode","Default","params","script","theme","onMessage","isScrollable"],"sources":["UNAccountComponent.tsx"],"sourcesContent":["import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { Dimensions, View } from 'react-native';\nimport type WebView from 'react-native-webview';\nimport { HeightEvent, PageMessage } from '../..//messages/webMessages/pageMessage';\nimport { RequestRefreshEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';\nimport EventBus from '../../helpers/EventBus';\nimport { WebComponent, WebComponentType } from '../../webComponent/WebComponent';\nimport type { WebViewMessage } from '../../messages/webMessages';\nimport { getAccountParams, getAccountScript, injectOpenActionsMenuScript, injectRefreshEventIfNeeded } from './UNAccountComponent.utils';\nimport { PresentationMode } from '../../scripts/html/bodyHtml';\nimport type { BottomSheetSlotData } from '../UNBottomSheetComponent/UNBottomSheetComponent';\nimport type { UNError, UNOnLoadResponse, UNOnLoadResponseData } from '../../sharedTypes';\nimport { useListenerToBus } from '../../hooks/listenerToBus';\nimport type { UNAccountData } from '../../sharedTypes/account.types';\nimport { AccountMessage } from '../../messages/webMessages/accountMessage';\nimport { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';\n\nexport interface UNAccountComponentProps {\n accountId?: string;\n customerToken: string;\n theme?: string;\n onLoad?: (response: UNOnLoadResponse<[UNAccountData]>) => void;\n onAccountChanged?: (account: UNAccountData) => void;\n}\n\nexport interface UNAccountRef {\n openActionsMenu: () => void;\n}\n\nexport enum AccountAction {\n List = 'account-list',\n Menu = 'account-menu'\n}\n\nexport const UNAccountComponent = React.forwardRef<UNAccountRef, UNAccountComponentProps>(function UNAccountComponent(props, accountRef) {\n const [height, setHeight] = useState(0);\n const windowWidth = Dimensions.get('window').width;\n\n const [requestRefreshEvent, setRequestRefreshEvent] = useState<RequestRefreshEvent | null>(null);\n\n const webRef = useRef<WebView>(null);\n\n const handleAccountChanged = (account: UNAccountData) => {\n props.onAccountChanged && props.onAccountChanged(account);\n };\n\n const requestRefresh = (data: RequestRefreshEvent) => {\n setRequestRefreshEvent(data);\n };\n\n const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {\n if (!props.onLoad) {\n return;\n }\n\n if (RESPONSE_KEYS.errors in response) {\n props.onLoad(response as UNError);\n return;\n }\n\n if (RESPONSE_KEYS.account in response) {\n // AccountsOnLoadResponse;\n props.onLoad(response[RESPONSE_KEYS.account] as UNOnLoadResponseData<[UNAccountData]>);\n return;\n }\n\n console.error('On Load Error: unexpected response type.');\n return;\n };\n\n useListenerToBus({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });\n useListenerToBus({ busEventKey: AccountMessage.UNIT_ACCOUNT_CHANGED, action: handleAccountChanged });\n\n useEffect(() => {\n injectRefreshEventIfNeeded(webRef.current, requestRefreshEvent);\n }, [requestRefreshEvent]);\n\n useImperativeHandle(accountRef, () => ({\n openActionsMenu() {\n injectOpenActionsMenuScript(webRef.current);\n }\n }));\n\n const handleMessage = (message: WebViewMessage) => {\n switch (message.type) {\n case UnitMessage.UNIT_ON_LOAD:\n handleUnitOnLoad(message.details as UnitOnLoadResponseEvent);\n break;\n case UnitMessage.UNIT_REQUEST_RENDERING: {\n const event: BottomSheetSlotData = {\n componentName: WebComponentType.account,\n componentResourceId: props.accountId,\n requestRenderingEvent: message.details as RequestRenderingEvent\n };\n EventBus.Instance.event(UnitMessage.UNIT_REQUEST_RENDERING, event);\n break;\n }\n case PageMessage.PAGE_HEIGHT:\n setHeight((message.details as HeightEvent).height);\n break;\n }\n };\n\n return (\n <View style={{ height }}>\n <WebComponent\n ref={webRef}\n type={WebComponentType.account}\n presentationMode={PresentationMode.Default}\n params={getAccountParams(props)}\n script={getAccountScript()}\n theme={props.theme}\n onMessage={message => handleMessage(message)}\n width={windowWidth}\n isScrollable={false}\n />\n </View>\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/E,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SAAsBC,WAAW,QAAQ,yCAAyC;AAClF,SAAqDC,WAAW,QAAQ,yCAAyC;AACjH,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,SAASC,YAAY,EAAEC,gBAAgB,QAAQ,iCAAiC;AAEhF,SAASC,gBAAgB,EAAEC,gBAAgB,EAAEC,2BAA2B,EAAEC,0BAA0B,QAAQ,4BAA4B;
|
|
1
|
+
{"version":3,"names":["React","useEffect","useImperativeHandle","useRef","useState","Dimensions","View","PageMessage","UnitMessage","EventBus","WebComponent","WebComponentType","getAccountParams","getAccountScript","injectOpenActionsMenuScript","injectRefreshEventIfNeeded","injectRequestAccountActionScript","PresentationMode","useListenerToBus","AccountMessage","RESPONSE_KEYS","AccountAction","UNAccountComponent","forwardRef","props","accountRef","height","setHeight","windowWidth","get","width","requestRefreshEvent","setRequestRefreshEvent","webRef","handleAccountChanged","account","onAccountChanged","requestRefresh","data","handleUnitOnLoad","response","onLoad","errors","console","error","busEventKey","UNIT_REQUEST_REFRESH","action","UNIT_ACCOUNT_CHANGED","current","openActionsMenu","openAction","handleMessage","message","type","UNIT_ON_LOAD","details","UNIT_REQUEST_RENDERING","event","componentName","componentResourceId","accountId","requestRenderingEvent","Instance","PAGE_HEIGHT","createElement","style","ref","presentationMode","Default","params","script","theme","onMessage","isScrollable"],"sources":["UNAccountComponent.tsx"],"sourcesContent":["import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { Dimensions, View } from 'react-native';\nimport type WebView from 'react-native-webview';\nimport { HeightEvent, PageMessage } from '../..//messages/webMessages/pageMessage';\nimport { RequestRefreshEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';\nimport EventBus from '../../helpers/EventBus';\nimport { WebComponent, WebComponentType } from '../../webComponent/WebComponent';\nimport type { WebViewMessage } from '../../messages/webMessages';\nimport { getAccountParams, getAccountScript, injectOpenActionsMenuScript, injectRefreshEventIfNeeded, injectRequestAccountActionScript } from './UNAccountComponent.utils';\nimport { PresentationMode } from '../../scripts/html/bodyHtml';\nimport type { BottomSheetSlotData } from '../UNBottomSheetComponent/UNBottomSheetComponent';\nimport type { UNError, UNOnLoadResponse, UNOnLoadResponseData } from '../../sharedTypes';\nimport { useListenerToBus } from '../../hooks/listenerToBus';\nimport type { UNAccountData } from '../../sharedTypes/account.types';\nimport { AccountMessage } from '../../messages/webMessages/accountMessage';\nimport { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';\nimport type { UNAccountMenuAction } from '../../sharedTypes';\n\nexport interface UNAccountComponentProps {\n // inputs\n accountId?: string;\n customerToken: string;\n\n // ui\n theme?: string;\n hideActionsMenuButton?: boolean;\n hideSelectionMenuButton?: boolean;\n\n // events\n onLoad?: (response: UNOnLoadResponse<[UNAccountData]>) => void;\n onAccountChanged?: (account: UNAccountData) => void;\n}\n\nexport interface UNAccountRef {\n openActionsMenu: () => void;\n openAction: (action: UNAccountMenuAction) => void;\n}\n\nexport enum AccountAction {\n List = 'account-list',\n Menu = 'account-menu'\n}\n\nexport const UNAccountComponent = React.forwardRef<UNAccountRef, UNAccountComponentProps>(function UNAccountComponent(props, accountRef) {\n const [height, setHeight] = useState(0);\n const windowWidth = Dimensions.get('window').width;\n\n const [requestRefreshEvent, setRequestRefreshEvent] = useState<RequestRefreshEvent | null>(null);\n\n const webRef = useRef<WebView>(null);\n\n const handleAccountChanged = (account: UNAccountData) => {\n props.onAccountChanged && props.onAccountChanged(account);\n };\n\n const requestRefresh = (data: RequestRefreshEvent) => {\n setRequestRefreshEvent(data);\n };\n\n const handleUnitOnLoad = (response: UnitOnLoadResponseEvent) => {\n if (!props.onLoad) {\n return;\n }\n\n if (RESPONSE_KEYS.errors in response) {\n props.onLoad(response as UNError);\n return;\n }\n\n if (RESPONSE_KEYS.account in response) {\n // AccountsOnLoadResponse;\n props.onLoad(response[RESPONSE_KEYS.account] as UNOnLoadResponseData<[UNAccountData]>);\n return;\n }\n\n console.error('On Load Error: unexpected response type.');\n return;\n };\n\n useListenerToBus({ busEventKey: UnitMessage.UNIT_REQUEST_REFRESH, action: requestRefresh });\n useListenerToBus({ busEventKey: AccountMessage.UNIT_ACCOUNT_CHANGED, action: handleAccountChanged });\n\n useEffect(() => {\n injectRefreshEventIfNeeded(webRef.current, requestRefreshEvent);\n }, [requestRefreshEvent]);\n\n useImperativeHandle(accountRef, () => ({\n openActionsMenu() {\n injectOpenActionsMenuScript(webRef.current);\n },\n openAction(action: UNAccountMenuAction) {\n injectRequestAccountActionScript(webRef.current, action);\n }\n }));\n\n const handleMessage = (message: WebViewMessage) => {\n switch (message.type) {\n case UnitMessage.UNIT_ON_LOAD:\n handleUnitOnLoad(message.details as UnitOnLoadResponseEvent);\n break;\n case UnitMessage.UNIT_REQUEST_RENDERING: {\n const event: BottomSheetSlotData = {\n componentName: WebComponentType.account,\n componentResourceId: props.accountId,\n requestRenderingEvent: message.details as RequestRenderingEvent\n };\n EventBus.Instance.event(UnitMessage.UNIT_REQUEST_RENDERING, event);\n break;\n }\n case PageMessage.PAGE_HEIGHT:\n setHeight((message.details as HeightEvent).height);\n break;\n }\n };\n\n return (\n <View style={{ height }}>\n <WebComponent\n ref={webRef}\n type={WebComponentType.account}\n presentationMode={PresentationMode.Default}\n params={getAccountParams(props)}\n script={getAccountScript()}\n theme={props.theme}\n onMessage={message => handleMessage(message)}\n width={windowWidth}\n isScrollable={false}\n />\n </View>\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/E,SAASC,UAAU,EAAEC,IAAI,Q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AAK,CAACqC,SAAS;YACpCC,qBAAqB,EAAET,OAAO,CAACG;UACjC,CAAC;UACD/C,QAAQ,CAACsD,QAAQ,CAACL,KAAK,CAAClD,WAAW,CAACiD,sBAAsB,EAAEC,KAAK,CAAC;UAClE;QACF;MACA,KAAKnD,WAAW,CAACyD,WAAW;QAC1BrC,SAAS,CAAE0B,OAAO,CAACG,OAAO,CAAiB9B,MAAM,CAAC;QAClD;IAAM;EAEZ,CAAC;EAED,oBACE1B,KAAA,CAAAiE,aAAA,CAAC3D,IAAI;IAAC4D,KAAK,EAAE;MAAExC;IAAO;EAAE,gBACtB1B,KAAA,CAAAiE,aAAA,CAACvD,YAAY;IACXyD,GAAG,EAAElC,MAAO;IACZqB,IAAI,EAAE3C,gBAAgB,CAACwB,OAAQ;IAC/BiC,gBAAgB,EAAEnD,gBAAgB,CAACoD,OAAQ;IAC3CC,MAAM,EAAE1D,gBAAgB,CAACY,KAAK,CAAE;IAChC+C,MAAM,EAAE1D,gBAAgB,EAAG;IAC3B2D,KAAK,EAAEhD,KAAK,CAACgD,KAAM;IACnBC,SAAS,EAAEpB,OAAO,IAAID,aAAa,CAACC,OAAO,CAAE;IAC7CvB,KAAK,EAAEF,WAAY;IACnB8C,YAAY,EAAE;EAAM,EACpB,CACG;AAEX,CAAC,CAAC"}
|
|
@@ -5,6 +5,8 @@ export const getAccountParams = props => {
|
|
|
5
5
|
return `
|
|
6
6
|
account-id="${props.accountId}"
|
|
7
7
|
customer-token="${props.customerToken}"
|
|
8
|
+
hide-actions-menu-button="${props.hideActionsMenuButton || false}"
|
|
9
|
+
hide-selection-menu-button="${props.hideSelectionMenuButton || false}"
|
|
8
10
|
`;
|
|
9
11
|
};
|
|
10
12
|
export const getAccountScript = () => {
|
|
@@ -18,6 +20,9 @@ export const getAccountScript = () => {
|
|
|
18
20
|
export const injectOpenActionsMenuScript = currentWeb => {
|
|
19
21
|
currentWeb === null || currentWeb === void 0 ? void 0 : currentWeb.injectJavaScript(`dispatchOpenActionsMenu('${WebComponentType.account}')`);
|
|
20
22
|
};
|
|
23
|
+
export const injectRequestAccountActionScript = (currentWeb, action) => {
|
|
24
|
+
currentWeb === null || currentWeb === void 0 ? void 0 : currentWeb.injectJavaScript(`dispatchRequestAccountAction('${action}')`);
|
|
25
|
+
};
|
|
21
26
|
export const injectRefreshEventIfNeeded = (currentWeb, requestRefreshEvent) => {
|
|
22
27
|
if (requestRefreshEvent && requestRefreshEvent.dependencies.includes(WebComponentType.account.valueOf())) {
|
|
23
28
|
currentWeb === null || currentWeb === void 0 ? void 0 : currentWeb.injectJavaScript(`dispatchRefreshEvent('${JSON.stringify(requestRefreshEvent)}')`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AccountAction","UnitMessage","WebComponentType","getAccountParams","props","accountId","customerToken","getAccountScript","UNIT_REQUEST_REFRESH","injectOpenActionsMenuScript","currentWeb","injectJavaScript","account","injectRefreshEventIfNeeded","requestRefreshEvent","dependencies","includes","valueOf","JSON","stringify","getAccountActionType","requestRendering","data","nativeComponent","List","Menu"],"sources":["UNAccountComponent.utils.ts"],"sourcesContent":["import { AccountAction, UNAccountComponentProps } from './UNAccountComponent';\nimport { RequestRefreshEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';\nimport type WebView from 'react-native-webview';\nimport { WebComponentType } from '../../webComponent/WebComponent';\n\nexport const getAccountParams = (props: UNAccountComponentProps) => {\n return `\n account-id=\"${props.accountId}\"\n customer-token=\"${props.customerToken}\"\n `;\n};\n\nexport const getAccountScript = () => {\n return `\n const dispatchRefreshEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_REQUEST_REFRESH}\",{ detail: JSON.parse(details) })\n window.dispatchEvent(event)\n }\n `;\n};\n\nexport const injectOpenActionsMenuScript = (currentWeb: WebView | null) => {\n currentWeb?.injectJavaScript(`dispatchOpenActionsMenu('${WebComponentType.account}')`);\n};\n\nexport const injectRefreshEventIfNeeded = (currentWeb: WebView | null, requestRefreshEvent: RequestRefreshEvent | null) => {\n if (requestRefreshEvent && requestRefreshEvent.dependencies.includes(WebComponentType.account.valueOf())) {\n currentWeb?.injectJavaScript(`dispatchRefreshEvent('${JSON.stringify(requestRefreshEvent)}')`);\n }\n};\n\nexport const getAccountActionType = (requestRendering: RequestRenderingEvent) => {\n return requestRendering.data.nativeComponent.includes(AccountAction.List) ? AccountAction.List : AccountAction.Menu;\n};\n"],"mappings":"AAAA,SAASA,aAAa,QAAiC,sBAAsB;AAC7E,SAAqDC,WAAW,QAAQ,yCAAyC;AAEjH,SAASC,gBAAgB,QAAQ,iCAAiC;
|
|
1
|
+
{"version":3,"names":["AccountAction","UnitMessage","WebComponentType","getAccountParams","props","accountId","customerToken","hideActionsMenuButton","hideSelectionMenuButton","getAccountScript","UNIT_REQUEST_REFRESH","injectOpenActionsMenuScript","currentWeb","injectJavaScript","account","injectRequestAccountActionScript","action","injectRefreshEventIfNeeded","requestRefreshEvent","dependencies","includes","valueOf","JSON","stringify","getAccountActionType","requestRendering","data","nativeComponent","List","Menu"],"sources":["UNAccountComponent.utils.ts"],"sourcesContent":["import { AccountAction, UNAccountComponentProps } from './UNAccountComponent';\nimport { RequestRefreshEvent, RequestRenderingEvent, UnitMessage } from '../../messages/webMessages/unitMessages';\nimport type WebView from 'react-native-webview';\nimport { WebComponentType } from '../../webComponent/WebComponent';\nimport type { UNAccountMenuAction } from 'src/sharedTypes';\n\nexport const getAccountParams = (props: UNAccountComponentProps) => {\n return `\n account-id=\"${props.accountId}\"\n customer-token=\"${props.customerToken}\"\n hide-actions-menu-button=\"${props.hideActionsMenuButton || false}\"\n hide-selection-menu-button=\"${props.hideSelectionMenuButton || false}\"\n `;\n};\n\nexport const getAccountScript = () => {\n return `\n const dispatchRefreshEvent = (details) => {\n const event = new CustomEvent(\"${UnitMessage.UNIT_REQUEST_REFRESH}\",{ detail: JSON.parse(details) })\n window.dispatchEvent(event)\n }\n `;\n};\n\nexport const injectOpenActionsMenuScript = (currentWeb: WebView | null) => {\n currentWeb?.injectJavaScript(`dispatchOpenActionsMenu('${WebComponentType.account}')`);\n};\n\nexport const injectRequestAccountActionScript = (currentWeb: WebView | null, action: UNAccountMenuAction) => {\n currentWeb?.injectJavaScript(`dispatchRequestAccountAction('${action}')`);\n};\n\nexport const injectRefreshEventIfNeeded = (currentWeb: WebView | null, requestRefreshEvent: RequestRefreshEvent | null) => {\n if (requestRefreshEvent && requestRefreshEvent.dependencies.includes(WebComponentType.account.valueOf())) {\n currentWeb?.injectJavaScript(`dispatchRefreshEvent('${JSON.stringify(requestRefreshEvent)}')`);\n }\n};\n\nexport const getAccountActionType = (requestRendering: RequestRenderingEvent) => {\n return requestRendering.data.nativeComponent.includes(AccountAction.List) ? AccountAction.List : AccountAction.Menu;\n};\n"],"mappings":"AAAA,SAASA,aAAa,QAAiC,sBAAsB;AAC7E,SAAqDC,WAAW,QAAQ,yCAAyC;AAEjH,SAASC,gBAAgB,QAAQ,iCAAiC;AAGlE,OAAO,MAAMC,gBAAgB,GAAIC,KAA8B,IAAK;EAClE,OAAQ;AACV,kBAAkBA,KAAK,CAACC,SAAU;AAClC,sBAAsBD,KAAK,CAACE,aAAc;AAC1C,gCAAgCF,KAAK,CAACG,qBAAqB,IAAI,KAAM;AACrE,kCAAkCH,KAAK,CAACI,uBAAuB,IAAI,KAAM;AACzE,GAAG;AACH,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpC,OAAQ;AACV;AACA,qCAAqCR,WAAW,CAACS,oBAAqB;AACtE;AACA;AACA,GAAG;AACH,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAIC,UAA0B,IAAK;EACzEA,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEC,gBAAgB,CAAE,4BAA2BX,gBAAgB,CAACY,OAAQ,IAAG,CAAC;AACxF,CAAC;AAED,OAAO,MAAMC,gCAAgC,GAAGA,CAACH,UAA0B,EAAEI,MAA2B,KAAK;EAC3GJ,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEC,gBAAgB,CAAE,iCAAgCG,MAAO,IAAG,CAAC;AAC3E,CAAC;AAED,OAAO,MAAMC,0BAA0B,GAAGA,CAACL,UAA0B,EAAEM,mBAA+C,KAAK;EACzH,IAAIA,mBAAmB,IAAIA,mBAAmB,CAACC,YAAY,CAACC,QAAQ,CAAClB,gBAAgB,CAACY,OAAO,CAACO,OAAO,EAAE,CAAC,EAAE;IACxGT,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEC,gBAAgB,CAAE,yBAAwBS,IAAI,CAACC,SAAS,CAACL,mBAAmB,CAAE,IAAG,CAAC;EAChG;AACF,CAAC;AAED,OAAO,MAAMM,oBAAoB,GAAIC,gBAAuC,IAAK;EAC/E,OAAOA,gBAAgB,CAACC,IAAI,CAACC,eAAe,CAACP,QAAQ,CAACpB,aAAa,CAAC4B,IAAI,CAAC,GAAG5B,aAAa,CAAC4B,IAAI,GAAG5B,aAAa,CAAC6B,IAAI;AACrH,CAAC"}
|
|
@@ -5,9 +5,10 @@ import { useListenerToBus } from '../../hooks/listenerToBus';
|
|
|
5
5
|
import { PageMessage } from '../../messages/webMessages/pageMessage';
|
|
6
6
|
import { PresentationMode } from '../../scripts/html/bodyHtml';
|
|
7
7
|
import { WebComponent, WebComponentType } from '../../webComponent/WebComponent';
|
|
8
|
-
import { getActivityParams, getActivityScript, injectRefreshEventIfNeeded } from './UNActivityComponent.utils';
|
|
8
|
+
import { getActivityParams, getActivityScript, injectFiltersChanged, injectRefreshEventIfNeeded } from './UNActivityComponent.utils';
|
|
9
9
|
import EventBus from '../../helpers/EventBus';
|
|
10
10
|
import { RESPONSE_KEYS } from '../../messages/webMessages/onLoadMessage';
|
|
11
|
+
import { ActivityMessage } from '../../messages/webMessages/activityMessage';
|
|
11
12
|
const DEFAULT_HEIGHT = Dimensions.get('window').height * 0.5;
|
|
12
13
|
export const UNActivityComponent = props => {
|
|
13
14
|
const webRef = useRef(null);
|
|
@@ -15,10 +16,17 @@ export const UNActivityComponent = props => {
|
|
|
15
16
|
const requestRefresh = data => {
|
|
16
17
|
injectRefreshEventIfNeeded(webRef.current, data);
|
|
17
18
|
};
|
|
19
|
+
const dispatchActivityFiltersChanged = query => {
|
|
20
|
+
injectFiltersChanged(webRef.current, query);
|
|
21
|
+
};
|
|
18
22
|
useListenerToBus({
|
|
19
23
|
busEventKey: UnitMessage.UNIT_REQUEST_REFRESH,
|
|
20
24
|
action: requestRefresh
|
|
21
25
|
});
|
|
26
|
+
useListenerToBus({
|
|
27
|
+
busEventKey: ActivityMessage.UNIT_ACTIVITY_FILTERS_CHANGED,
|
|
28
|
+
action: dispatchActivityFiltersChanged
|
|
29
|
+
});
|
|
22
30
|
const handleUnitOnLoad = response => {
|
|
23
31
|
if (!props.onLoad) {
|
|
24
32
|
return;
|