UNPKG

react-native-unit-components

Version:

Unit React Native components

45 lines 2.12 kB
import { DISPATCH_COUNTERPARTY_DELETED, DISPATCH_PLAID_RESPONSE, LISTENERS } from '../../scripts/html/bodyScript'; export const getACHCreditParams = props => { const plaidAccountFiltersParam = props.plaidAccountFilters ? `plaid-account-filters="${props.plaidAccountFilters.join()}"` : ''; const plaidLinkCustomizationNameParam = props.plaidLinkCustomizationName ? `plaid-link-customization-name="${props.plaidLinkCustomizationName}"` : ''; const accountIdParam = props.accountId ? `account-id="${props.accountId}"` : ''; return ` ${accountIdParam} with-plaid="${props.withPlaid ?? false}" is-auto-focus="${props.isAutoFocus ?? false}" style="height: 100%" same-day="${props.sameDay ?? false}" show-same-day-selection="${props.showSameDaySelection ?? false}" ${plaidAccountFiltersParam} ${plaidLinkCustomizationNameParam} initial-stage-back-button="${props.initialStageBackButton ?? false}" final-stage-done-button="${props.finalStageDoneButton ?? false}" allow-counterparty-delete="${props.allowCounterpartyDelete ?? false}" show-account-type-selector="${props.showAccountTypeSelector ?? false}" `; }; export const getACHCreditScript = appPackageName => { return ` ${LISTENERS.unitPlaidTokenCreated} ${appPackageName && `window.UnitMobileSDKConfig.androidPackageName='${appPackageName}'`} ${LISTENERS.unitPaymentCreated} ${LISTENERS.unitPaymentInitialStageBackButtonClicked} ${LISTENERS.unitPaymentFinalStageDoneButtonClicked} ${DISPATCH_PLAID_RESPONSE} ${DISPATCH_COUNTERPARTY_DELETED} ${LISTENERS.requestRefresh} `; }; export const injectUnitPlaidResponse = (currentWeb, success) => { const successObj = { data: { publicToken: success.publicToken, metadata: success.metadata } }; currentWeb?.injectJavaScript(`dispatchPlaidEvent(${JSON.stringify(successObj)})`); }; export const injectRequestCounterpartyDeletedScript = (currentWeb, counterparty) => { currentWeb?.injectJavaScript(`dispatchCounterpartyDeletedEvent('${counterparty}')`); }; //# sourceMappingURL=UNACHCreditComponent.utils.js.map