react-native-unit-components
Version:
Unit React Native components
51 lines (50 loc) • 1.88 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getCheckDepositScript = exports.getCheckDepositParams = void 0;
var _checkMessage = require("../../messages/webMessages/checkMessage");
var _bodyScript = require("../../scripts/html/bodyScript");
const getCheckDepositParams = props => {
const feeParam = props.fee ? `fee="${props.fee}"` : '';
return `
account-id="${props.accountId}"
${feeParam}
customer-token="${props.customerToken}"
initial-stage-back-button="${props.initialStageBackButton ?? false}"
final-stage-done-button="${props.finalStageDoneButton ?? false}"
`;
};
exports.getCheckDepositParams = getCheckDepositParams;
const CHECK_DEPOSIT_LISTENERS = {
paymentCreated: `
window.addEventListener("${_checkMessage.CheckMessage.CHECK_DEPOSIT_CREATED}", (e) => {
const response = e.detail
response.then((data) => {
postMessageToSDK({ type: "${_checkMessage.CheckMessage.CHECK_DEPOSIT_CREATED}", details: data.data })
}).catch((e) => {
console.log(e)
})
});
`,
restartRequest: `
window.addEventListener("${_checkMessage.CheckMessage.CHECK_DEPOSIT_RESTART_REQUEST}", (e) => {
const response = e.detail
response.then((data) => {
postMessageToSDK({ type: "${_checkMessage.CheckMessage.CHECK_DEPOSIT_RESTART_REQUEST}", details: data.data })
}).catch((e) => {
console.log(e)
})
});
`
};
const getCheckDepositScript = () => {
return `
${CHECK_DEPOSIT_LISTENERS.paymentCreated}
${_bodyScript.LISTENERS.unitPaymentInitialStageBackButtonClicked}
${_bodyScript.LISTENERS.unitPaymentFinalStageDoneButtonClicked}
${CHECK_DEPOSIT_LISTENERS.restartRequest}
`;
};
exports.getCheckDepositScript = getCheckDepositScript;
//# sourceMappingURL=UNCheckDepositComponent.utils.js.map