@securecall/client-component
Version:
SecureCall Core Web Component
1,257 lines (1,256 loc) • 49.9 kB
JavaScript
import { h, Host } from "@stencil/core";
import { RequestFieldGroup } from "../../classes/request_field_group";
import { DEFAULT_REQUEST_FIELDS } from "../../constants/request_fields";
import { CURRENT_STATE_T } from "../../types/current_state";
import { SecureCallClientAPI } from "@securecall/client-api";
import { ResponseFields } from "../../classes/response_fields";
import { DEFAULT_RESPONSE_FIELDS } from "../../constants/response_fields";
import { PENDING_CALL_SECURE_TIMEOUT, AUTHENTICATION_RETRIES, PENDING_PAYMENT_TIMEOUT } from "../../constants/constants";
import { Logger, setGlobalLogger } from "../../utils/logger";
import { mergeDeep } from "../../utils/utils";
import { CLIENT_COMP_VERSION } from "../../version";
export class SecurecallClient {
apiLocation = window.origin;
awaitActiveCall = false;
theme = 'light';
displayTransactionResult = true;
switchHint;
hideSecureButton = false;
customLogger;
currentState = CURRENT_STATE_T.NotAuthenticated;
errorMessage;
transactionToggle = false;
authenticationSuccess;
authenticationFailure;
configurationChanged;
callSecured;
callEnded;
transactionSubmitted;
transactionSubmitting;
transactionSuccess;
transactionFailure;
loggedOut;
// Telephony Events
telephonyHold;
telephonyRecover;
telephonyLegA;
telephonyLegB;
telephonyValidate;
_requestFields = new RequestFieldGroup(DEFAULT_REQUEST_FIELDS);
_responseFields = new ResponseFields(DEFAULT_RESPONSE_FIELDS);
client_api;
timeoutId;
instanceId = Math.floor(Math.random() * 100000000);
authenticationCount = 0;
secureData;
currentSession;
transactionElement = null;
log;
boundProcessAuthenticationEvent = this.processAuthenticationEvent.bind(this);
boundProcessStatusEvent = this.processStatusEvent.bind(this);
boundProcessConfigurationEvent = this.processConfigurationEvent.bind(this);
boundProcessTelephonyEvent = this.processTelephonyEvent.bind(this);
boundVisibilityEvent = this.processVisibilityEvent.bind(this);
createLogger() {
if (this.customLogger) {
console.debug('customLogger: ', this.customLogger);
// Check that customLogger implements all required methods
const requiredMethods = ['debug', 'info', 'warn', 'error'];
const missingMethods = requiredMethods.filter(method => typeof this.customLogger[method] !== 'function');
if (missingMethods.length === 0) {
console.debug('settingGlobalLogger: ', this.customLogger);
setGlobalLogger(this.customLogger);
}
}
console.debug('creating logger: ', this.customLogger);
this.log = new Logger('SecurecallClient', this.instanceId);
}
connectedCallback() {
this.createLogger();
this.log.debug(": connectedCallback");
document.addEventListener('visibilitychange', this.boundVisibilityEvent);
this.client_api = new SecureCallClientAPI(this.apiLocation, `ClientComponent(${CLIENT_COMP_VERSION}/${this.instanceId})`);
this.client_api.logger = this.log;
this.client_api.debug = true;
this.client_api.addEventListener('authentication', this.boundProcessAuthenticationEvent);
this.client_api.addEventListener('session', this.boundProcessStatusEvent);
this.client_api.addEventListener('configuration', this.boundProcessConfigurationEvent);
this.client_api.addEventListener('telephony', this.boundProcessTelephonyEvent);
// if (this.useCookie) {
// this.client_api.authenticate(this.username, this.password, this.useCookie);
// } else {
this.authenticationFailure.emit({ count: this.authenticationCount, message: 'initialising' });
// }
}
disconnectedCallback() {
this.log.debug(": disconnectedCallback");
document.removeEventListener('visibilitychange', this.boundVisibilityEvent);
this.client_api.removeEventListener('authentication', this.boundProcessAuthenticationEvent);
this.client_api.removeEventListener('session', this.boundProcessStatusEvent);
this.client_api.removeEventListener('configuration', this.boundProcessConfigurationEvent);
this.client_api.removeEventListener('telephony', this.boundProcessTelephonyEvent);
this.client_api.disconnect();
}
componentWillLoad() {
this.log.debug(": componentWillLoad");
}
processVisibilityEvent() {
this.log.debug(": processVisibilityEvent");
this.transactionToggle = !this.transactionToggle;
}
handleSecureFieldResetEvent(evt) {
this.log.debug('secureFieldResetEvent: resetting ', evt.detail);
this.client_api.reset([evt.detail])
.then(() => {
this.log.debug('secureFieldResetEvent: reset ');
})
.catch(e => {
this.log.debug('secureFieldResetEvent: FAILED: ', e);
});
}
handleSubmitTransactionEvent(evt) {
this.log.debug('submitTransactionEvent: ', evt.detail);
this.submitTransaction(evt.detail);
}
handleResponseButtonEvent(evt) {
this.log.debug('responseButtonEvent: ', evt.detail);
switch (evt.detail) {
case 'retryClearCVV':
this.triggerAnotherTransaction(false, ['cvv']);
break;
case 'retryClearSecure':
this.triggerAnotherTransaction(false, ['all']);
break;
case 'retryClearAll':
this.triggerAnotherTransaction(true, ['all']);
break;
default:
this.log.debug('responseButtonEvent: unknown action: ', evt.detail);
}
}
messageHandler(event) {
this.log.debug("messageHandler: popup return= ", event);
if (event.origin !== window.origin)
return;
this.log.debug("messageHandler: origin matches");
}
currentStateWatcher(newValue, oldValue) {
this.log.debug('currentStateWatcher', oldValue, ' => ', newValue);
if (newValue !== oldValue) {
this.cancelTimeout();
this.errorMessage = undefined;
}
}
watchAwaitActiveCall(newValue, oldValue) {
this.log.debug('awaitActiveCall: ', oldValue, ' => ', newValue);
}
watchCustomLogger(newValue, oldValue) {
this.log.debug('customLogger: ', oldValue, ' => ', newValue);
if (newValue !== oldValue) {
this.createLogger();
this.client_api.logger = this.log;
}
}
async version() {
return CLIENT_COMP_VERSION;
}
async triggerAnotherTransaction(resetTransactionDetails = true, resetCardFields = ['cvv']) {
this.log.debug('Method: triggerAnotherTransaction resetTransactionDetails=' + resetTransactionDetails + ' resetCardFields=' + JSON.stringify(resetCardFields));
if (this.currentState === CURRENT_STATE_T.Success || this.currentState === CURRENT_STATE_T.Failure) {
if (resetTransactionDetails) {
this._requestFields.clearNonSecureFields();
}
if (resetCardFields && resetCardFields.length > 0) {
await this.client_api.reset(resetCardFields).catch(() => { });
}
this.currentState = CURRENT_STATE_T.Secured;
}
else {
this.log.debug('Method: triggerAnotherTransaction Incompatible state: ', this.currentState);
throw new Error('Incompatible state: ' + this.currentState);
}
}
async submitAnotherTransaction(data) {
this.log.debug('submitAnotherTransaction: ');
if (this.currentState === CURRENT_STATE_T.Success || this.currentState === CURRENT_STATE_T.Failure) {
this.submitTransaction(data);
return true;
}
else {
this.log.debug('Method: submitAnotherTransaction Wrong state: ', this.currentState);
return false;
}
}
async authenticate(username, password, useCookie) {
this.log.debug('Method: authenticate');
try {
await this.client_api.authenticate(username, password, useCookie);
}
catch (e) {
this.log.debug('Method: authenticate failed with error: ', e);
throw e;
}
}
async logout() {
this.log.debug('Method: logout');
this.client_api.logout()
.then(() => {
this.log.debug('Method: logout success');
this.currentState = CURRENT_STATE_T.NotAuthenticated;
this.loggedOut.emit(true);
})
.catch((e) => {
this.log.debug('Method: logout failed with error: ' + e);
});
}
async secure() {
this.log.debug('Method: secure');
const body = (this.switchHint) ? { switch_hint: this.switchHint } : {};
await this.client_api.secure(body);
}
async release() {
this.log.debug('Method: release');
await this.client_api.release();
}
async updateTelephony(data) {
this.log.debug(': updateTelephony: ', data);
return this.client_api.telephony(data);
}
async updateRequestFields(updates) {
updates(this._requestFields);
this.generateConfigurationChangedEvent();
this.transactionToggle = !this.transactionToggle;
}
async updateSessionRequestFields(updates) {
updates(this._requestFields.session);
this.generateConfigurationChangedEvent();
this.transactionToggle = !this.transactionToggle;
}
async updateTransactionRequestFields(updates) {
updates(this._requestFields.transaction);
this.generateConfigurationChangedEvent();
this.transactionToggle = !this.transactionToggle;
}
async updateResponseFields(updates) {
updates(this._responseFields.defaults);
this.generateConfigurationChangedEvent();
this.transactionToggle = !this.transactionToggle;
}
processAuthenticationEvent(evt) {
if (evt.success) {
this.log.debug('Authentication Success message: ', evt);
this.currentState = CURRENT_STATE_T.Idle;
this.authenticationSuccess.emit();
}
else {
this.log.debug('Authentication Failure message: ', JSON.stringify(evt));
this.handleAuthenticationFailure(evt.reason, evt.code);
}
}
processConfigurationEvent(evt) {
this.log.debug(": processConfigurationEvent: ", evt);
const settings = evt.detail.settings;
if (typeof settings?.show_gateways !== 'undefined') {
this._requestFields.instance.gatewayName.hidden = !(settings.show_gateways === true);
}
if (evt.detail.gateways) {
this._requestFields.instance.gatewayName.possibleValues = { ...evt.detail.gateways };
}
if (settings?.request_fields) {
const { _transactionUpdate, _sessionUpdate, ...requestFieldsUpdate } = settings.request_fields;
Object.entries(requestFieldsUpdate).forEach(([key, value]) => {
if (!this._requestFields.fieldNames.includes(key)) {
// Add the field
this._requestFields.fieldNames.push(key);
}
let section = this._requestFields.instance;
if (_sessionUpdate) {
section = this._requestFields.session;
}
else if (_transactionUpdate) {
section = this._requestFields.transaction;
}
let f = section[key];
if (f) {
Object.entries(value).forEach(([k2, v2]) => {
f[k2] = v2;
});
}
});
}
if (settings?.response_fields) {
this._responseFields = new ResponseFields(mergeDeep(DEFAULT_RESPONSE_FIELDS, settings.response_fields));
}
this.generateConfigurationChangedEvent();
this.transactionToggle = !this.transactionToggle;
}
generateConfigurationChangedEvent() {
this.configurationChanged.emit({
requestFields: this._requestFields.calculatedFields(),
responseFields: this._responseFields.calculatedFields()
});
}
processStatusEvent(j) {
this.log.debug(": processStatusEvent: ", j);
switch (j.state) {
case 'securing':
if (this.currentState === CURRENT_STATE_T.Idle) {
this.currentState = CURRENT_STATE_T.Securing;
this.startTimeout(PENDING_CALL_SECURE_TIMEOUT, "Timeout: Securing Call");
}
else if (this.currentState === CURRENT_STATE_T.Securing) {
this.log.debug('>>>> getting duplicate state: ', this.currentState);
}
else {
this.log.error('>>>> ERROR: attempting to secure while in state: ', this.currentState);
}
break;
case 'collection':
if (j.call_data.state === 'secured') {
if (this.currentState === CURRENT_STATE_T.Securing || this.currentState === CURRENT_STATE_T.Idle) {
this.currentState = CURRENT_STATE_T.Secured;
this.callSecured.emit(true);
}
}
this.secureData = j.secure_data;
this.currentSession = j.session;
this._requestFields.processSecureData(j.secure_data);
this.transactionToggle = !this.transactionToggle;
break;
case 'transaction':
if (this.currentState !== CURRENT_STATE_T.Submitting && this.currentState !== CURRENT_STATE_T.Success && this.currentState !== CURRENT_STATE_T.Failure) {
this.currentState = CURRENT_STATE_T.Secured;
this.callSecured.emit(true);
}
switch (j.transaction_data.state) {
case 'submitting':
this.transactionSubmitting.emit({ ...j.transaction_data, secureData: j.secure_data, session: j.session });
this.currentState = CURRENT_STATE_T.Submitting;
break;
case 'success':
this.cancelTimeout();
this._responseFields.processResponse(j.transaction_data);
this.transactionSuccess.emit({ ...j.transaction_data, secureData: j.secure_data, session: j.session });
this.currentState = CURRENT_STATE_T.Success;
break;
case 'failure':
this.cancelTimeout();
this._responseFields.processResponse(j.transaction_data);
this.transactionFailure.emit({ ...j.transaction_data, secureData: j.secure_data, session: j.session });
this.currentState = CURRENT_STATE_T.Failure;
break;
default:
this.log.debug('>>>> processStatusEvent: unknown transaction state:', j.transaction_data.state);
break;
}
break;
case 'ended':
this.currentState = CURRENT_STATE_T.Idle;
this._requestFields.resetSession();
this._requestFields.resetTransaction();
this.currentSession = undefined;
this.secureData = undefined;
this.callSecured.emit(false);
if (j.call_data?.error) {
this.errorMessage = j.call_data.error;
this.callEnded.emit(j.call_data.error);
}
else {
this.callEnded.emit("call ended successfully");
}
break;
default:
this.log.debug('unknown state:' + j.state);
}
}
processTelephonyEvent(j) {
this.cancelTimeout();
this.log.debug(": processTelephonyEvent: ", j);
switch (j.command) {
case 'hold':
this.telephonyHold.emit({ session: j.session });
break;
case 'recover':
this.telephonyRecover.emit({ session: j.session });
break;
case 'leg_a':
this.telephonyLegA.emit({ session: j.session, dnis: j.dnis });
break;
case 'leg_b':
this.telephonyLegB.emit({ session: j.session, dnis: j.dnis });
break;
case 'validate':
this.telephonyValidate.emit({ session: j.session });
break;
default:
this.log.debug(": processTelephonyEvent: unknown telephony command: ", j.command);
}
}
handleAuthenticationFailure(status, code) {
this.log.debug(': intAuthenticationFailureHandler: Received the custom intAuthenticationFailure event: ', code, ':', status);
// Reset state
this.currentState = CURRENT_STATE_T.NotAuthenticated;
switch (code) {
case 0: // initial event, shouldn't show a message
break;
case 401:
this.errorMessage = "Unauthorised. Please attempt to log in again. Ensure that your browser is not in incognito mode";
break;
case 403:
this.errorMessage = "Configuration error. Please contact your administrator";
break;
default:
this.errorMessage = (code) ? code + ':' + status : status;
}
this.authenticationCount++;
if (this.authenticationCount > AUTHENTICATION_RETRIES) {
this.errorMessage = "Unable to connect to the server. Please contact your administrator";
}
else {
this.authenticationFailure.emit({ count: this.authenticationCount, message: this.errorMessage });
}
this.log.debug(': intAuthenticationFailureHandler: ', this.errorMessage);
}
submitTransaction(eventData) {
// reflect the values back into paymentDetails
this.log.debug("submitTransaction: eventData: " + JSON.stringify(eventData));
this.startTimeout(PENDING_PAYMENT_TIMEOUT, "Timeout: Processing Transaction");
this.currentState = CURRENT_STATE_T.Submitting;
this.client_api.submit(eventData)
.then(() => {
this.transactionSubmitted.emit(eventData);
})
.catch((error) => {
this.log.debug("submitTransaction: error: " + error.message + '(' + error.code + ')');
const data = {
state: 'failure',
request: eventData,
response: { error_message: error.message, error_code: error.code },
secureData: this.secureData,
session: this.currentSession
};
this.currentState = CURRENT_STATE_T.Failure;
this.transactionFailure.emit(data);
this.errorMessage = 'Submit Response: ' + error.message + ' (' + error.code + ')';
});
}
////////////////////////////
// Timeout Methods
////////////////////////////
startTimeout(milliseconds, message) {
this.timeoutId = window.setTimeout(() => {
this.log.debug('>>>> Firing timeout : currentState:', this.currentState, ' destinationState:');
this.errorMessage = message;
this.client_api.connect();
}, milliseconds);
this.log.debug('>>>> Starting timeout id:', this.timeoutId, ' currentState:', this.currentState);
}
cancelTimeout() {
if (this.timeoutId) {
this.log.debug('>>>> Canceling timeout id:', this.timeoutId, ' currentState:', this.currentState);
clearTimeout(this.timeoutId);
this.timeoutId = undefined;
}
}
////////////////////////////
// Render Methods
////////////////////////////
renderResponseFields(success) {
const fields = this._responseFields.asComponentChildren(success);
if (!this.displayTransactionResult)
return null;
return (h("form", { class: "response-form" }, h("div", { class: "response-result-container" }, h("p", null, success ? 'Transaction Accepted' : 'Transaction Declined')), h("div", { class: "response-field-container" }, fields.map((field) => {
const Tag = 'securecall-response-' + field.component;
return h(Tag, { id: field.name, "field-name": field.name, label: field.label, value: field.value });
}))));
}
currentStateRender() {
switch (this.currentState) {
case CURRENT_STATE_T.NotAuthenticated:
return null;
case CURRENT_STATE_T.Idle:
if (this.hideSecureButton)
return null;
else
return (h("div", { class: "secure-form" }, h("p", { class: "component-text" }, "\u00A0"), this.awaitActiveCall ? (h("button", { type: "button", class: "component-button", disabled: true }, "Awaiting Active Call")) : (h("button", { type: "button", class: "component-button", onClick: () => this.secure() }, "Press to Secure"))));
case CURRENT_STATE_T.Securing:
return (h("form", null, h("div", { class: "component-field-container" }, h("div", { class: "loading-spinner" }, h("div", { class: "spinner-circle" })))));
case CURRENT_STATE_T.Secured:
return (h("securecall-transaction", { id: "transaction", transactionToggle: this.transactionToggle, fieldData: this._requestFields, ref: (el) => this.transactionElement = el }));
case CURRENT_STATE_T.Submitting:
return (h("div", { class: "component-field-container" }, h("div", { class: "loading-spinner" }, h("div", { class: "spinner-circle" }))));
case CURRENT_STATE_T.Failure:
return this.renderResponseFields(false);
case CURRENT_STATE_T.Success:
return this.renderResponseFields(true);
default:
return (h("form", null, h("div", { class: "component-field-container" }, h("p", null, "\u00A0", this.currentState))));
}
}
;
renderErrorMessage() {
if (this.errorMessage) {
const message = this.errorMessage;
return (h("div", { class: "component-field-container" }, h("p", null, message)));
}
return null;
}
render() {
return this.currentState !== CURRENT_STATE_T.NotAuthenticated ? (h(Host, null, h("div", { class: `theme-${this.theme}` }, this.currentStateRender(), this.renderErrorMessage()))) : null;
}
static get is() { return "securecall-client"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["securecall-client.css"]
};
}
static get styleUrls() {
return {
"$": ["securecall-client.css"]
};
}
static get properties() {
return {
"apiLocation": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "api-location",
"defaultValue": "window.origin"
},
"awaitActiveCall": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "await-active-call",
"defaultValue": "false"
},
"theme": {
"type": "string",
"mutable": false,
"complexType": {
"original": "'dark' | 'light'",
"resolved": "\"dark\" | \"light\"",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "theme",
"defaultValue": "'light'"
},
"displayTransactionResult": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "display-transaction-result",
"defaultValue": "true"
},
"switchHint": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "switch-hint"
},
"hideSecureButton": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "hide-secure-button",
"defaultValue": "false"
},
"customLogger": {
"type": "unknown",
"mutable": false,
"complexType": {
"original": "object",
"resolved": "object",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false
}
};
}
static get states() {
return {
"currentState": {},
"errorMessage": {},
"transactionToggle": {}
};
}
static get events() {
return [{
"method": "authenticationSuccess",
"name": "authenticationSuccess",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
}
}, {
"method": "authenticationFailure",
"name": "authenticationFailure",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "IAuthenticationFailure",
"resolved": "IAuthenticationFailure",
"references": {
"IAuthenticationFailure": {
"location": "import",
"path": "../../interfaces/authentication",
"id": "src/interfaces/authentication.ts::IAuthenticationFailure"
}
}
}
}, {
"method": "configurationChanged",
"name": "configurationChanged",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "IConfigurationUpdate",
"resolved": "IConfigurationUpdate",
"references": {
"IConfigurationUpdate": {
"location": "import",
"path": "../../interfaces/configuration",
"id": "src/interfaces/configuration.ts::IConfigurationUpdate"
}
}
}
}, {
"method": "callSecured",
"name": "callSecured",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
}
}, {
"method": "callEnded",
"name": "callEnded",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
}
}, {
"method": "transactionSubmitted",
"name": "transactionSubmitted",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "ITransactionValues",
"resolved": "ITransactionValues",
"references": {
"ITransactionValues": {
"location": "import",
"path": "../../interfaces/transaction",
"id": "src/interfaces/transaction.ts::ITransactionValues"
}
}
}
}, {
"method": "transactionSubmitting",
"name": "transactionSubmitting",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "ITransactionData",
"resolved": "ITransactionData",
"references": {
"ITransactionData": {
"location": "import",
"path": "../../interfaces/transaction",
"id": "src/interfaces/transaction.ts::ITransactionData"
}
}
}
}, {
"method": "transactionSuccess",
"name": "transactionSuccess",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "ITransactionData",
"resolved": "ITransactionData",
"references": {
"ITransactionData": {
"location": "import",
"path": "../../interfaces/transaction",
"id": "src/interfaces/transaction.ts::ITransactionData"
}
}
}
}, {
"method": "transactionFailure",
"name": "transactionFailure",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "ITransactionData",
"resolved": "ITransactionData",
"references": {
"ITransactionData": {
"location": "import",
"path": "../../interfaces/transaction",
"id": "src/interfaces/transaction.ts::ITransactionData"
}
}
}
}, {
"method": "loggedOut",
"name": "loggedOut",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
}
}, {
"method": "telephonyHold",
"name": "telephonyHold",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "ITelephonyEventData",
"resolved": "ITelephonyEventData",
"references": {
"ITelephonyEventData": {
"location": "import",
"path": "../../interfaces/telephony",
"id": "src/interfaces/telephony.ts::ITelephonyEventData"
}
}
}
}, {
"method": "telephonyRecover",
"name": "telephonyRecover",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "ITelephonyEventData",
"resolved": "ITelephonyEventData",
"references": {
"ITelephonyEventData": {
"location": "import",
"path": "../../interfaces/telephony",
"id": "src/interfaces/telephony.ts::ITelephonyEventData"
}
}
}
}, {
"method": "telephonyLegA",
"name": "telephonyLegA",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "ITelephonyEventData",
"resolved": "ITelephonyEventData",
"references": {
"ITelephonyEventData": {
"location": "import",
"path": "../../interfaces/telephony",
"id": "src/interfaces/telephony.ts::ITelephonyEventData"
}
}
}
}, {
"method": "telephonyLegB",
"name": "telephonyLegB",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "ITelephonyEventData",
"resolved": "ITelephonyEventData",
"references": {
"ITelephonyEventData": {
"location": "import",
"path": "../../interfaces/telephony",
"id": "src/interfaces/telephony.ts::ITelephonyEventData"
}
}
}
}, {
"method": "telephonyValidate",
"name": "telephonyValidate",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "ITelephonyEventData",
"resolved": "ITelephonyEventData",
"references": {
"ITelephonyEventData": {
"location": "import",
"path": "../../interfaces/telephony",
"id": "src/interfaces/telephony.ts::ITelephonyEventData"
}
}
}
}];
}
static get methods() {
return {
"version": {
"complexType": {
"signature": "() => Promise<string>",
"parameters": [],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<string>"
},
"docs": {
"text": "",
"tags": []
}
},
"triggerAnotherTransaction": {
"complexType": {
"signature": "(resetTransactionDetails?: boolean, resetCardFields?: string[]) => Promise<void>",
"parameters": [{
"name": "resetTransactionDetails",
"type": "boolean",
"docs": ""
}, {
"name": "resetCardFields",
"type": "string[]",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"submitAnotherTransaction": {
"complexType": {
"signature": "(data: ITransactionValues) => Promise<boolean>",
"parameters": [{
"name": "data",
"type": "ITransactionValues",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
},
"ITransactionValues": {
"location": "import",
"path": "../../interfaces/transaction",
"id": "src/interfaces/transaction.ts::ITransactionValues"
}
},
"return": "Promise<boolean>"
},
"docs": {
"text": "",
"tags": []
}
},
"authenticate": {
"complexType": {
"signature": "(username?: string, password?: string, useCookie?: boolean) => Promise<void>",
"parameters": [{
"name": "username",
"type": "string",
"docs": ""
}, {
"name": "password",
"type": "string",
"docs": ""
}, {
"name": "useCookie",
"type": "boolean",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"logout": {
"complexType": {
"signature": "() => Promise<void>",
"parameters": [],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"secure": {
"complexType": {
"signature": "() => Promise<void>",
"parameters": [],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"release": {
"complexType": {
"signature": "() => Promise<void>",
"parameters": [],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"updateTelephony": {
"complexType": {
"signature": "(data: ITelephonyUpdate) => Promise<void>",
"parameters": [{
"name": "data",
"type": "ITelephonyUpdate",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
},
"ITelephonyUpdate": {
"location": "import",
"path": "../../interfaces/telephony",
"id": "src/interfaces/telephony.ts::ITelephonyUpdate"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"updateRequestFields": {
"complexType": {
"signature": "(updates: (arg0: any) => void) => Promise<void>",
"parameters": [{
"name": "updates",
"type": "(arg0: any) => void",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"updateSessionRequestFields": {
"complexType": {
"signature": "(updates: (arg0: any) => void) => Promise<void>",
"parameters": [{
"name": "updates",
"type": "(arg0: any) => void",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"updateTransactionRequestFields": {
"complexType": {
"signature": "(updates: (arg0: any) => void) => Promise<void>",
"parameters": [{
"name": "updates",
"type": "(arg0: any) => void",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"updateResponseFields": {
"complexType": {
"signature": "(updates: (arg0: any) => void) => Promise<void>",
"parameters": [{
"name": "updates",
"type": "(arg0: any) => void",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
}
};
}
static get watchers() {
return [{
"propName": "currentState",
"methodName": "currentStateWatcher"
}, {
"propName": "awaitActiveCall",
"methodName": "watchAwaitActiveCall"
}, {
"propName": "customLogger",
"methodName": "watchCustomLogger"
}];
}
static get listeners() {
return [{
"name": "secureFieldResetEvent",
"method": "handleSecureFieldResetEvent",
"target": undefined,
"capture": false,
"passive": false
}, {
"name": "submitTransactionEvent",
"method": "handleSubmitTransactionEvent",
"target": undefined,
"capture": false,
"passive": false
}, {
"name": "responseButtonEvent",
"method": "handleResponseButtonEvent",
"target": undefined,
"capture": false,
"passive": false
}, {
"name": "message",
"method": "messageHandler",
"target": undefined,
"capture": false,
"passive": false
}];
}
}
//# sourceMappingURL=securecall-client.js.map