Methods
renderTemplate(markerElement, doNotStart) → {SmsStatus|Array.<SmsStatus>}
- Description:
- Renders automatically updated SMS Status display markup at the specified marker element.
The markerElement must have the following attributes:
* data-sms-status-id: The secure identifier of the SMS to display.
The markerElement may have the following attributes:
* data-sms-status-culture: The output culture (en, en-US, ru, ru-RU and so on).
* data-sms-status-template: The template name base. Default to 'plate'.
The name of the templates to use are determined by appending '_main', '_sending', '_loading'
and '_error' to the base name. Template names may be defined individually using
data-sms-status-template-main, data-sms-status-template-sending,
data-sms-status-template-loading and data-sms-status-template-error attributes.
* data-sms-status-settings-*. Defined the settings object. Settings object fields are defined
by attribute name with '.' replaced with '-'.
- Renders automatically updated SMS Status display markup at the specified marker element.
- Source:
Example
<div data-sms-status-id="123456789012345678901234567890123456"
data-sms-status-culture="en-US"
data-sms-status-settings-reportBlock-sendingsList-displayMinCount="2" />
<!--
Will create the following SmsStatus object:
var id = '123456789012345678901234567890123456';
var culture = 'en-US';
var settings = {
reportBlock: {
sendingsList: {
displayMinCount: '2'
}
}
}
var status = new SmsStatus(id, culture, settings);
-->
If markerElement is a string and jQuery is defined then jQuery will be used to find the
node or nodes to replace. If jQuery is not defined then document.querySelectorAll will be used
instead.
Parameters:
Name | Type | Description |
---|---|---|
markerElement |
HTMLElement | Array.<HTMLElement> | NodeList | jQuery | string | The DOM node, nodes or selector string matching nodes to replace with template markup. |
doNotStart |
boolean | If set to true, prevents startPolling method from being called after initialization. Setting this parameter to true allows to apply additional customization of the poller object. |
Returns:
If markerElement is a single node, the SmsStatus object polling and handling resend
requests for the message specified in the marker element. If markerElement is a collection of
nodes or a selector (including selectors matching a single node), an array of the
SmsStatus objects.
requests for the message specified in the marker element. If markerElement is a collection of
nodes or a selector (including selectors matching a single node), an array of the
SmsStatus objects.
renderTemplate(markerElement, optionsopt) → {SmsStatus|Array.<SmsStatus>}
- Description:
- Renders automatically updated SMS Status display markup at the specified marker element.
SMS secure identifier must be passed either via options parameter or via
data-sms-status-id attribute on the markerElement.
The markerElement may have the following attributes:
* data-sms-status-id: The secure identifier of the SMS to display.
* data-sms-status-culture: The output culture (en, en-US, ru, ru-RU and so on).
* data-sms-status-template: The template name base. Default to 'plate'.
The name of the templates to use are determined by appending '_main', '_sending', '_loading'
and '_error' to the base name. Template names may be defined individually using
data-sms-status-template-main, data-sms-status-template-sending,
data-sms-status-template-loading and data-sms-status-template-error attributes.
* data-sms-status-settings-*. Defined the settings object. Settings object fields are defined
by attribute name with '.' replaced with '-'.
- Renders automatically updated SMS Status display markup at the specified marker element.
- Source:
Example
<div data-sms-status-id="123456789012345678901234567890123456"
data-sms-status-culture="en-US"
data-sms-status-settings-reportBlock-sendingsList-displayMinCount="2" />
<!--
Will create the following SmsStatus object:
var id = '123456789012345678901234567890123456';
var culture = 'en-US';
var settings = {
reportBlock: {
sendingsList: {
displayMinCount: '2'
}
}
}
var status = new SmsStatus(id, culture, settings);
-->
If markerElement is a string and jQuery is defined then jQuery will be used to find the
node or nodes to replace. If jQuery is not defined then document.querySelectorAll will be used
instead.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
markerElement |
HTMLElement | Array.<HTMLElement> | NodeList | jQuery | string | The DOM node, nodes or selector string matching nodes to replace with template markup. | ||
options |
Object |
<optional> |
{}
|
Optional template parameters. |
options.doNotStart |
boolean |
<optional> |
false
|
If set to true, prevents startPolling method from being called after initialization. Setting this parameter to true allows to apply additional customization of the poller object. |
options.id |
String |
<optional> |
SMS secure identifier. | |
options.culture |
String |
<optional> |
The output culture (en, en-US, ru, ru-RU and so on). | |
options.settings |
SmsStatus~Settings |
<optional> |
{}
|
Optional SMS poller settings. |
Returns:
If markerElement is a single node, the SmsStatus object polling and handling resend
requests for the message specified in the marker element. If markerElement is a collection of
nodes or a selector (including selectors matching a single node), an array of the
SmsStatus objects.
requests for the message specified in the marker element. If markerElement is a collection of
nodes or a selector (including selectors matching a single node), an array of the
SmsStatus objects.
Type Definitions
LoadingEventSettings
- Description:
- Represents loading indicator display configuration for a loading event.
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
showIndicator |
boolean |
<optional> |
true
|
A flag indicating whether the loading indicator should be displayed. |
minVisibleTime |
number |
<optional> |
1000
|
The minimum amount of time in milliseconds the loading indicator should be visible. |
showDelay |
number |
<optional> |
0
|
The amount of time in milliseconds after the event occurs before the loading indicator should be displayed. |
Represents loading indicator display configuration for a loading event.
Type:
- Object
Settings
- Description:
- Represents SmsStatus object setting.
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
showIndicator |
boolean |
<optional> |
true
|
A flag indicating whether the loading indicator should be displayed. |
dtf |
String |
<optional> |
Date and time values format. | |
pollTimeout |
Number |
<optional> |
5000
|
SMS status update frequency in milliseconds. |
pollUrlBase |
String |
<optional> |
'https://sms.webmoney.ru/SmsStatus/Sms/'||'https://sms.web.money/SmsStatus/Sms/'
|
The base part of SMS status poll URL. |
resendUrlBase |
String |
<optional> |
'https://sms.webmoney.ru/SmsStatus/Resend/'||'https://sms.web.money/SmsStatus/Resend/'
|
The base part of SMS resend URL. |
timezone |
String |
<optional> |
The desired timezone. If not specified, resolves to the current timezone of the user. If current timezone can not be resolved in the current browser, defaults to 'MSK'. |
|
setButtonHandlers |
Boolean |
<optional> |
true
|
Boolean flag indicating if the button click handlers should be set. |
untilResendableCountdown |
Boolean |
<optional> |
true
|
Boolean flag indicating if SmsStatus~SmsReport.UntilResendable and related strings should be updated automatically between receiving updates from the server. Note that the countdown availability depends on browser support. |
loadingIndicator |
String |
<optional> |
'#sms-loading-indicator'
|
Selector matching SMS loading indicator. |
loadingEvents |
Object.<string, SmsStatus~LoadingEventSettings> |
<optional> |
{'poll': {showDelay: 1000}, '': {showIndicator: true, minVisibleTime: 1000, showDelay: 0}}
|
An object specifying loading indicator parameters for various loading events. Use empty key to specify the default parameters. |
errorBlock |
Object |
<optional> |
{}
|
The parameters of the block containing the error messages. |
reportBlock.root |
String |
<optional> |
'#sms-error'
|
Selector matching SMS status errors root element. |
errorBlock.reportError |
String |
<optional> |
'#sms-error-report'
|
Selector matching element displaying error message if server response does not contain SMS status report. This can happen if SMS with the specified ID does not exist or was sent long time ago. |
reportBlock |
Object |
<optional> |
{}
|
The parameters of the block containing the message status report. |
reportBlock.root |
String |
<optional> |
'#sms-report'
|
Selector matching SMS status report root element. |
reportBlock.created |
String |
<optional> |
'#sms-report-created'
|
Selector matching element displaying date and time the SMS was created. |
reportBlock.updated |
String |
<optional> |
'#sms-report-updated'
|
Selector matching element displaying date and time of the latest SMS status update. |
reportBlock.retries |
String |
<optional> |
'#sms-report-retries'
|
Selector matching element displaying the number of attempts to send the SMS. |
reportBlock.validity |
String |
<optional> |
'#sms-report-validity'
|
Selector matching element displaying the message validity period (time before attempts to deliver the SMS are abandoned). |
reportBlock.validUntil |
String |
<optional> |
'#sms-report-valid-until','
|
Selector matching element displaying the date and time message validity expires (date and time when further attempts to deliver the SMS are abandoned). |
reportBlock.lastTransportType |
String |
<optional> |
'#sms-report-last-transport-type'
|
Selector matching element displaying the message transport last used to send the message. |
reportBlock.status |
String |
<optional> |
'#sms-report-status'
|
Selector matching element displaying current SMS status. |
reportBlock.refresh |
String |
<optional> |
'#sms-report-refresh'
|
Selector matching element used as a button to refresh message status immediately. |
reportBlock.instruction |
String |
<optional> |
'#sms-report-instruction'
|
Selector matching container element of detailed description of current SMS status and short instruction on how to resolve delivery problems (e.g. turn on the cell phone). This element is used to hide instruction block if the instruction is not present in SMS status report. |
reportBlock.instructionText |
String |
<optional> |
'#sms-report-instruction-text'
|
Selector matching element displaying detailed description of current SMS status and short instruction on how to resolve delivery problems (e.g. turn on the cell phone). This element should be a child element of the element matching reportBlock.instruction selector. |
reportBlock.supportLinks |
String |
<optional> |
'#sms-report-support-links'
|
Selector matching a block containing links to notify WebMoney if the message was not delivered. |
reportBlock.untilResendable |
String |
<optional> |
'#sms-report-until-resendable'
|
Selector matching a container element for the amount of time remaining until the message can be resent on a user request. This element is used to hide the block if the information on the reaming time until the message can be resent on a user request is not present in SMS status report. |
reportBlock.untilResendableText |
String |
<optional> |
'#sms-report-until-resendable-text'
|
Selector matching a element displaying the amount of time remaining until the message can be resent on a user request. This element should be a child element of the element matching reportBlock.untilResendable selector. |
reportBlock.untilResendableVersion |
Number |
<optional> |
2
|
The version of the string representation of SmsStatus~SmsReport.UntilResendableSeconds to use. Set to 1 to use SmsStatus~SmsReport.UntilResendableStr or set to 2 to use SmsStatus~SmsReport.UntilResendableStrV2. If value is not set or is not recognized, version 2 will be used. |
reportBlock.sendingsList |
Object |
<optional> |
{}
|
The parameters of the block displaying attempts to send the SMS. |
reportBlock.sendingsList.root |
String |
<optional> |
'#sms-report-attempts'
|
Selector matching container element for elements displaying attempts. |
reportBlock.sendingsList.itemTemplate |
String |
<optional> |
'#sms-report-attempt-template'
|
Selector matching element serving as a template for elements displaying sending attempts. |
reportBlock.sendingsList.doNotClear |
String |
<optional> |
'.sms-report-attempts-do-not-clear'
|
Selector matching child elements of the sending attempts container element that must not be removed when the attempts list is cleared. |
reportBlock.sendingsList.attemptNumber |
String |
<optional> |
'#sms-report-attempt-number'
|
Selector matching element within the template displaying attempt number. |
reportBlock.sendingsList.created |
String |
<optional> |
'#sms-report-attempt-created'
|
Selector matching element within the template displaying the date and time attempt was made. |
reportBlock.sendingsList.updated |
String |
<optional> |
'#sms-report-attempt-updated'
|
Selector matching element within the template displaying the date and time the attempt status was last updated. |
reportBlock.sendingsList.status |
String |
<optional> |
'#sms-report-attempt-status'
|
Selector matching element within the template displaying the attempt status. |
reportBlock.sendingsList.transportType |
String |
<optional> |
'#sms-report-attempt-transport-type'
|
Selector matching element within the template displaying delivery transport type used in the attempt. |
reportBlock.sendingsList.update |
function |
<optional> |
Deprecated since version 1.3.0. Override sendingsUpdate method instead. Function processing all sending attempts reports. If undefined, clears sendings using reportBlock.sendingsList.clear and adds the reports by one using reportBlock.sendingsList.addItem. |
|
reportBlock.sendingsList.addItem |
function |
<optional> |
Deprecated since version 1.3.0. Override sendingsAddItem method instead. Function adding a sending attempt report. The template is used if this parameter is undefined. |
|
reportBlock.sendingsList.clear |
function |
<optional> |
Deprecated since version 1.3.0. Override sendingsClear method instead. Function clearing all elements displaying sending attempt reports. If undefined, clears all children of the element matching reportBlock.sendingsList.root except any elements matching reportBlock.sendingsList.itemTemplate and reportBlock.sendingsList.doNotClear. |
|
reportBlock.sendingsList.displayMinCount |
Number |
<optional> |
2
|
The minimum number of displayed sending attempts or a negative number to turn off sending attempts details display. |
resendBlock |
Object |
<optional> |
{}
|
The parameters of the block providing button to resend the SMS. |
resendBlock.root |
String |
<optional> |
'#sms-resend'
|
Selector matching SMS resend block root element. |
resendBlock.button |
String |
<optional> |
'#sms-resend-button'
|
Selector matching SMS resend button. |
resendBlock.status |
String |
<optional> |
'#sms-resend-status'
|
Selector matching SMS resend attempt status. |
Represents SmsStatus object setting.
Type:
- Object
SmsReport
- Description:
- Represents a report on an outgoing message.
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
Created |
Date | The date and time the message was created. | |
CreatedStr |
string | The string representation of the Created property. | |
StatusUpdated |
Date | The date and time the message status was last updated. | |
StatusUpdatedStr |
string | The string representation of the StatusUpdated property. | |
SendingRetries |
number | The number of sending retries. | |
ValidityPeriodMinutes |
number | The amount of time in minutes since the message was created before the message will be discarded if not delivered to the destination. |
|
ValidityPeriodStr |
string | The string representation of the ValidityPeriodMinutes property. | |
ValidUntil |
Date | The date and time when the message will be (or was) discarded if not delivered to the destination. |
|
ValidUntilStr |
string | The string representation of the ValidUntil property. | |
LastTransportTypeStr |
string | The name of the message transport last used to send the message. | |
LastTransportType |
number | The identifier of the message transport last used to send the message. | |
Status |
string | The name of the current message status. | |
StatusId |
number | The identifier of current message status. | |
StatusDetails |
string |
<optional> |
The detailed description of current message status. |
StatusInstruction |
string |
<optional> |
The user instruction describing the reasons of current message status delivery failure and possibly instruction on how to fix it. |
Resendable |
boolean | true if the message is resendable; otherwise, false. | |
UntilResendableSeconds |
number |
<optional> |
The time in seconds until the message can be resent by a user request or null if the message can not be resent or the time when the message becomes resendable is currently unknown. |
UntilResendableStr |
string |
<optional> |
The string representation of the UntilResendableStr property. |
UntilResendableStrV2 |
string |
<optional> |
The string representation of the UntilResendableStr property according to CLDR. |
IsFinalState |
boolean |
<optional> |
true if the message report can change on further queries; otherwise, false. |
SendingAtempts |
Array.<SmsStatus~SmsSendingReport> |
<optional> |
The reports on attempts to send the message. |
Represents a report on an outgoing message.
Type:
- Object
SmsReportQueryResult
- Description:
- Represents the result of getting current SMS status.
- Source:
Properties:
Name | Type | Description |
---|---|---|
SecureId |
string | The secure ID of the message. |
Locale |
string | The locale of the response. |
UserData |
string | An arbitrary string associated with the request by the request sender. |
Report |
SmsStatus~SmsReport | The user report on an outgoing SMS. |
Represents the result of getting current SMS status.
Type:
- Object
SmsResendCommandResult
- Description:
- Represents the response to a command to resend a message.
- Source:
Properties:
Name | Type | Description |
---|---|---|
SecureId |
string | The secure ID of the message. |
Locale |
string | The locale of the response. |
UserData |
string | An arbitrary string associated with the request by the request sender. |
Status |
string | The resending status code. |
Represents the response to a command to resend a message.
Type:
- Object
SmsSendingReport
- Description:
- Represents a report on a message sending attempt.
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
AttemptNumber |
number |
<optional> |
The number of sending attempt. |
Created |
Date | The date and time the sending attempt was made. | |
CreatedStr |
string | The string representation of the Created property. | |
Updated |
Date | The date and time the sending attempt status was last updated. | |
UpdatedStr |
string | The string representation of the Updated property. | |
Status |
string | The sending attempt status. | |
StatusId |
number | The sending attempt status identifier. | |
TransportTypeStr |
string | The name of the delivery transport type used in this attempt. | |
TransportType |
number | The identifier of the delivery transport type used in this attempt. |
Represents a report on a message sending attempt.
Type:
- Object