TheM Reference
Constructor
The ampliFi SDK framework is best described as part of the "M" in the MVC (Model-View-Controller) approach to application architecture. Hence, all of the submodules of the ampliFi SDK framework are accessible as properties of one root TheM class (pronounced as 'The M'). When creating a new instance of ClassTheM, the libraries and configuration should be set like below. For a detailed guide on how to start working with TheM class, see the Getting Started section of this documentation.
Example
TheM = new ClassTheM({
config: {
AFiInstanceId: 'qwe',
modulesFolder: '',
webworkerFolder: '../TheM/',
baseLibURL: '../demo/lib/',
backEndURL: 'http://amplifi:4000/',
user: {
DEFAULT_HOMECOUNTRY: 'US'
},
onboarding: {
PRESEGMENTS_ALLOWED: {
'demo_uoiuqwehflkipahgoqq': 'GenericClient'
}
}
}
});
Properties
Property table for TheM
Property | Description | Required | Schema |
---|---|---|---|
AFiInstanceId | Gets (returns) the unique AFiInstanceId that was set when the ClassTheM instance was created. | Yes | { "title": "TheM.AFiInstanceId", "type": "string", "description": "Gets (returns) the unique AFiInstanceId that was set when the ClassTheM instance was created.", "$comment": "enumerable, getter", "examples": [ "qwe" ], "nullable": false } |
libs | Gets (returns) TheM.libs. | No | libs object |
config | Gets (returns) TheM.config. | Yes | config object |
eventHistory | Gets (returns) the history of all executed TheM events (a log of all TheM event notifications). | No | { "title": "TheM.eventHistory", "type": "Set", "description": "Gets (returns) the history of all executed TheM events (a log of all TheM event notifications).", "$comment": "getter", "examples": [ "new Set(['TheM ready','TheM.common ready'])" ], "default": {} } |
isBrowser | Gets (returns) true if the current environment is a browser environment and false if it is a node.js environment. | No | { "title": "TheM.isBrowser", "type": "boolean", "description": "Gets (returns) true if the current environment is a browser environment and false if it is a node.js environment.", "$comment": "getter", "examples": [ true, false ], "default": false } |
isLocalSavingAllowed | Gets (returns) or sets whether saving locally is allowed. If set to false, TheM will not save anything locally. | No | { "title": "TheM.isLocalSavingAllowed", "type": "boolean", "description": "Gets (returns) or sets whether saving locally is allowed. If set to false, TheM will not save anything locally.", "$comment": "getter, setter", "examples": [ true, false ], "default": true } |
loading | Gets (returns) the number of calls (to the server) currently in progress. | No | { "title": "TheM.loading", "type": "number", "description": "Gets (returns) the number of calls (to the server) currently in progress.", "$comment": "configurable, getter", "examples": [ 0 ], "default": 0 } |
loadingwhat | Gets (returns) or sets an array of strings describing requests currently in progress. | No | { "title": "TheM.loadingwhat", "type": "array", "description": "Gets (returns) or sets an array of strings describing requests currently in progress.", "$comment": "configurable, getter, setter", "examples": [ [ "SomeRequest" ] ], "default": [] } |
subscribers | Gets (returns) an array of current event functions. See addSubscribers method. | No | { "title": "TheM.subscribers", "type": "array", "description": "Gets (returns) an array of current event functions. See addSubscribers method.", "$comment": "getter", "examples": [ [ { "name": "printPayload", "fn": "(payload: object) => { console.log(payload) }" } ] ], "default": [] } |
Property table for config object
Property | Description | Required | Schema |
---|---|---|---|
AFiInstanceId | Gets (returns) the unique AFiInstanceId that was set when the ClassTheM instance was created. | Yes | { "title": "TheM.config.AFiInstanceId", "type": "string", "description": "Gets (returns) the unique AFiInstanceId that was set when the ClassTheM instance was created.", "examples": [ "qwe" ], "nullable": false } |
backEndURL | Gets (returns) the back-end URL that was set in TheM.config when the ClassTheM instance was created. | Yes | { "title": "TheM.config.backEndURL", "type": "string", "description": "Gets (returns) the back-end URL that was set in TheM.config when the ClassTheM instance was created.", "examples": [ "http://amplifi:4000/" ], "nullable": false } |
baseLibURL | Gets (returns) the base library URL that was set in TheM.config when the ClassTheM instance was created. | No | { "title": "TheM.config.baseLibURL", "type": "string", "description": "Gets (returns) the base library URL that was set in TheM.config when the ClassTheM instance was created.", "examples": [ "../demo/lib/" ], "default": "./lib/" } |
defaultCurrency | Gets (returns) the 3 character default currency code that was set in TheM.config when the ClassTheM instance was created. | No | { "title": "TheM.config.defaultCurrency", "type": "string", "description": "Gets (returns) the 3 character default currency code that was set in TheM.config when the ClassTheM instance was created.", "examples": [ "USD" ], "default": "USD" } |
fdrs | Gets (returns) an object containing fdrs configurations for TheM, such as DEFAULT_FDRS, if defined. | No | { "title": "TheM.config.fdrs", "type": "object", "description": "Gets (returns) an object containing fdrs configurations for TheM, such as DEFAULT_FDRS, if defined.", "examples": [ { "DEFAULT_FDRS": {} } ], "nullable": true, "required": [] } |
fxrates | Gets (returns) an object containing fxrates configurations for TheM, such as baseCurrency. | No | { "title": "TheM.config.fxrates", "type": "object", "description": "Gets (returns) an object containing fxrates configurations for TheM, such as baseCurrency.", "examples": [ { "baseCurrency": "USD" } ], "nullable": true, "required": [] } |
geolocation | Gets (returns) an object containing geolocation configurations for TheM, such as DISTANCE_TO_POI_UPDATE_M - the distance in meters between POI updates. | No | { "title": "TheM.config.geolocation", "type": "object", "description": "Gets (returns) an object containing geolocation configurations for TheM, such as DISTANCE_TO_POI_UPDATE_M - the distance in meters between POI updates.", "examples": [ { "TTL_GEOLOCATION_EXPIRE_MS": 2592000000, "TTL_GEOLOCATION_RETRY_MS": 60000, "DISTANCE_TO_POI_UPDATE_M": 1000, "GPS_POLLING_TIMEOUT_MS": 5000 } ], "nullable": true, "required": [] } |
isBrowser | Gets (returns) whether the current environment was set as a browser (true) or not (false) when the ClassTheM instance was created. | No | { "title": "TheM.config.isBrowser", "type": "boolean", "description": "Gets (returns) whether the current environment was set as a browser (true) or not (false) when the ClassTheM instance was created.", "examples": [ true, false, null ], "default": null, "nullable": true } |
isDetectBrowser | Gets (returns) isDetectBrowser value that was set in TheM.config when the ClassTheM instance was created. | No | { "title": "TheM.config.isDetectBrowser", "type": "boolean", "description": "Gets (returns) isDetectBrowser value that was set in TheM.config when the ClassTheM instance was created.", "examples": [ true, false ], "default": false } |
LOCAL_STORAGE_TAG_PREFIX | Gets (returns) the tag prefix for local storage that was set in TheM.config when the ClassTheM instance was created. | No | { "title": "TheM.config.LOCAL_STORAGE_TAG_PREFIX", "type": "string", "description": "Gets (returns) the tag prefix for local storage that was set in TheM.config when the ClassTheM instance was created.", "examples": [ "test_" ], "default": "test_" } |
modulesFolder | Gets (returns) modules folder that was set in TheM.config when the ClassTheM instance was created. | No | { "title": "TheM.config.modulesFolder", "type": "string", "description": "Gets (returns) modules folder that was set in TheM.config when the ClassTheM instance was created.", "examples": [ "" ], "default": "" } |
modulesFolderOnboarding | Gets (returns) modules onboarding folder that was set in TheM.config when the ClassTheM instance was created, if any. | No | { "title": "TheM.config.modulesFolderOnboarding", "type": "string", "description": "Gets (returns) modules onboarding folder that was set in TheM.config when the ClassTheM instance was created, if any.", "examples": [ "../" ], "nullable": true } |
onboarding | Gets (returns) an object containing the onboarding configurations, such as allowed presegments. | No | { "title": "TheM.config.onboarding", "type": "object", "description": "Gets (returns) an object containing the onboarding configurations, such as allowed presegments.", "examples": [ { "PRESEGMENTS_ALLOWED": { "demo_uoiuqwehflkipahgoqq": "GenericClient" } } ], "nullable": true, "required": [] } |
pois | Gets (returns) an object containing pois configurations for TheM, such as TTL_GENERIC_POI (the time in milliseconds a generic point of interest should be saved). | No | { "title": "TheM.config.pois", "type": "object", "description": "Gets (returns) an object containing pois configurations for TheM, such as TTL_GENERIC_POI (the time in milliseconds a generic point of interest should be saved).", "examples": [ { "TTL_GENERIC_POI": 2592000000 } ], "nullable": true, "required": [] } |
preSegent | Gets (returns) a presegment string that was set in TheM.config when the ClassTheM instance was created. | No | { "title": "TheM.config.preSegent", "type": "string", "description": "Gets (returns) a presegment string that was set in TheM.config when the ClassTheM instance was created.", "examples": [ "demo_uoiuqwehflkipahgoqq" ] } |
restrictions | Gets (returns) an object containing restrictions configurations for TheM, if any. | No | { "title": "TheM.config.restrictions", "type": "object", "description": "Gets (returns) an object containing restrictions configurations for TheM, if any.", "examples": [ {} ], "nullable": true, "required": [] } |
socketURL | Gets (returns) the socket URL that was set in TheM.config when the ClassTheM instance was created. | Yes | { "title": "TheM.config.socketURL", "type": "string", "description": "Gets (returns) the socket URL that was set in TheM.config when the ClassTheM instance was created.", "examples": [ "http://amplifi:4000/" ], "nullable": false } |
supportData | Gets (returns) an object containing a support contact email address that was set in TheM.config when the ClassTheM instance was created. | No | { "title": "TheM.config.supportData", "type": "object", "description": "Gets (returns) an object containing a support contact email address that was set in TheM.config when the ClassTheM instance was created.", "examples": [ { "email": "alibek@paygears.com" } ], "nullable": true, "required": [] } |
user | Gets (returns) an object containing user configurations for TheM, such as the DEFAULT_HOMECOUNTRY property. | No | { "title": "TheM.config.user", "type": "object", "description": "Gets (returns) an object containing user configurations for TheM, such as the DEFAULT_HOMECOUNTRY property.", "examples": [ { "DEFAULT_HOMECOUNTRY": "US" } ], "nullable": true, "required": [] } |
version | Gets (returns) current version of the amplifi SDK | No | { "title": "TheM.config.version", "type": "string", "description": "Gets (returns) current version of the amplifi SDK", "examples": [ "2.0.1" ], "default": "2.0.1" } |
webworkerFolder | Gets (returns) webworkerFolder that was set in TheM.config when the ClassTheM instance was created. | No | { "title": "TheM.config.webworkerFolder", "type": "string", "description": "Gets (returns) webworkerFolder that was set in TheM.config when the ClassTheM instance was created.", "examples": [ "../TheM/" ], "nullable": true } |
Property table for libs object
Property | Description | Required | Schema |
---|---|---|---|
LZString | LZString library | No | { "title": "TheM.libs.LZString", "type": "class", "description": "LZString library", "nullable": true } |
moment | moment library | No | { "title": "TheM.libs.moment", "type": "class", "description": "moment library", "nullable": true } |
axios | axios library | No | { "title": "TheM.libs.axios", "type": "class", "description": "axios library", "nullable": true } |
io | io library | No | { "title": "TheM.libs.io", "type": "class", "description": "io library", "nullable": true } |
CryptoJS | CryptoJS library | No | { "title": "TheM.libs.CryptoJS", "type": "class", "description": "CryptoJS library", "nullable": true } |
Methods
Method Name | Parameter Descriptions | Description | Example |
---|---|---|---|
addSubscribers | [ |
Pushes the given event function onto the subscribers array. Returns void. | TheM.addSubscribers({); |
callSubscribers | [ |
Calls the event functions in the subscribers array and passes givenEventName and payload as arguments to the subscriber function. Returns void. | TheM.callSubscribers("printPayload",{); |
doInit | [ |
Initializes the given modules. The modules that may be required during this session are passed as a case sensitive space-delimited string. Returns void. | TheM.doInit("common user accounts cards statics beneficiaries fundstransfer genericRequests externalAccounts fdrs statics ious cheques restrictions remittance fxrates"); |
newEvent | [ |
For browser environments, this dispatches a new CustomEvent with the givenEventName and payload. It will also call TheM.callSubscribers(givenEventName, payload). For node.js environments, this emits the givenEventName and payload. All callback functions that have been registered to listen for this event will be called. Returns void. | TheM.newEvent("printPayload",{); |
on | [ |
Registers a listener to the given event name(s) (returns true). Parameters: givenEventName is a string or string[], givenFunction is a callback function to call when the event occurs, and givenFlag is a boolean (if true, the event will be dispatched before affecting the DOM). Returns true. | TheM.on("printPayload",(payload: any) => { console.log('on'); console.log('${payload} was printed'); },true); |
once | [ |
Registers a listener to the given event name(s) to be called only once (returns true). Parameters: givenEventName is a string or string[], givenFunction is a callback function to call when the event occurs, and checkInHistory is a boolean (if true, the function will called, even if the event name is already found in the event history). Returns true. | TheM.once("printPayload",(payload: any) => { console.log('once'); console.log('${payload} was printed'); },true); |
refresh | [ |
This is an overridable function which can be used as part of a rendering process if needed. Calls TheM.newEvent(givenEventName, payload) and then returns true. | TheM.refresh("printPayload",{); |
removeSubscriber | [ |
Removes the given event subscriber, identified by name, from the subscriber array. Returns void | TheM.removeSubscriber("printPayload"); |
Submodules
Submodule Name | Link |
---|---|
TheM.accounts | Accounts Guide |
TheM.attachments | Attachments Guide |
TheM.beneficiaries | Beneficiaries Guide |
TheM.billers | Coming Soon |
TheM.bills | Coming Soon |
TheM.cards | Cards Guide |
TheM.cheques | Cheques Guide |
TheM.common | Coming Soon |
TheM.companies | Companies Guide |
TheM.externalAccounts | ExternalAccounts Guide |
TheM.family | Coming Soon |
TheM.fdrs | FDRs Guide |
TheM.fundsTransfer | fundsTransfer Guide |
TheM.fxrates | FXRates Guide |
TheM.genericRequests | Coming Soon |
TheM.intsite | Coming Soon |
TheM.intUser | Coming Soon |
TheM.invites | Coming Soon |
TheM.ious | IOUs Guide |
TheM.messages | Messages Guide |
TheM.onboarding | Onboarding Guide |
TheM.payees | Payees Guide |
TheM.pois | Coming Soon |
TheM.remittance | Remittances Guide |
TheM.restrictions | Restrictions Guide |
TheM.statics | Coming Soon |
TheM.supportTickets | Coming Soon |
TheM.user | User Guide |