Using this widget you can add set pin to your website. It requires a Synctera widget vault token to initialize it with. The user will have 5 minutes to complete the pin submission.
<script src="https://widgets-sandbox.synctera.com/assets/set-pin/v1/loader.js"></script>
to your page.validity
event on the Controller Set Pin widget (the one with the id):setPinWidget.submit()
to submit the pin.It returns a promise, which resolves if the pin submission was successful, or rejects if it failed.Browser | Minimum tested version |
---|---|
Chrome | 29 (2013) |
Firefox | 27 (2014) |
Edge | 79 (2020), 15 (2017) |
Safari | 12 (2018) |
Opera | 20 (2014) |
IE | 11 (2013) |
Summary Fetch widget token from backend → Render widgets with token → Listen for “validity” event → User submits controller widget → Widget submits PIN to Synctera → And returns success or failure → Widget auto-destroysNote: It is recommended to also add ‘load’ and ‘error’ listeners for UI management (see Widget API below). The flow for using the widgets:
submit()
function on the controller widget.Name | Value | Default | Details | Example |
---|---|---|---|---|
token | widget token ID | - | RequiredIncompatible with: isConfirm | <set-pin token="[widget token from Synctera]" ...> |
isConfirm | true (Present)false (Omitted) | Omitted | RequiredIncompatible with: token | <set-pin token="[widget token from Synctera]" ...>``<set-pin isConfirm></set-pin> |
class | class name (string) | Omitted | OptionalIf present, it will activate custom styling | <set-pin ... class="customStyles" ...> |
Name | Called when… | Why? | addEventListener | on |
---|---|---|---|---|
load | The widgets have are fully loaded | For best user experience, show the widgets only when this event is triggered | setPinEl.addEventListener('load', () => ...); | setPinEl.onLoad = () => ... |
validity | The widgets are now (in)valid | Only allow submit() to be called when validTo get the status, check the “isValid” property | setPinEl.addEventListener('validity', () => {``␠ buttonEl.disabled = !setPinEl.isValid;``}); | setPinEl.onValidity = (e, isValid) => {``␠ buttonEl.disabled = !isValid;``}; |
error | The widgets failed to load | Non-recoverable error statesTo get the error, check the “error” property | setPinEl.addEventListener('error', () => {``␠ console.log(setPinEl.error);``}); | setPinEl.onError = () => {``␠ console.log(setPinEl.error);``}; |
success | The widget submitted successfully | Know when the widget is done and the pin was savedAlternatively: The “submit()” method returns a promise resolving when done | setPinEl.addEventListener('success', () => ...); | setPinEl.onSuccess = () => ... |
failure | The widget submitted unsuccessfully | Know if the pin was not saved and the user will need to try againAlternatively: The “submit()” method returns a promise rejecting on failure**To get the failure, check the “error” property | setPinEl.addEventListener('failure', () => {``␠ console.log(setPinEl.error);``}); | setPinEl.onFailure = (e, errorDetails) => ... |
Name | Value / Parameters | Default / Returns | Details | Example |
---|---|---|---|---|
isValid | truefalse | false | true if both fields are valid and form is ready to submit | setPinEl.isValid |
error | { errorType:’…’, error: *} | undefined | Error details if an error or failure occurs | setPinEl.error |
submit() | No parameters | Returns: Promise | Submits the PIN to Sycntera’s serversAlternatively: The widget fires “success” and “failure” events | setPinEl.submit()``␠ .then(// success)``␠ .catch(// error) |
SummaryBy default, without custom styling, the widgets use the browser’s inbuilt styling for the Set Pin input text fields (note that the widget iframe is 4px bigger than the input field inside to allow for any browser outline effects). You may want to style the widget to match your webapp design or to add things like placeholders. This can be done entirely through css styling. When a
- Add a class name to
set-pin
tags to activate Custom Styling:<set-pin class='customStyles' ...
- Style as desired (i.e. border), but Font Styles are special
- For pseudo-selectors, e.g.
:hover
,:focus
, etc - use pseudo-attributes instead: Example:.customStyles[_hover] { border: 1px solid #616161; }
- Font styles are auto-forwarded, but only certain values are allowed (see below)
- Optional: You can use
.customStyles[_required]
to show the widgets once they have loaded
class
attribute is added to the widget, the 4px spacing is removed, the input box styling is stripped and the background is made transparent such that any elements placed behind the widget will be visible (i.e. a placeholder element). The text input is set to always take up 100% of the height and width of the iframe, and likewise for the iframe in the widget tag.
Input text field pseudo selectors such as :hover
, :focus
and :blank
are indirectly supported through css-like attributes instead of actual pseudo selectors. As the user hovers, focuses and types in the field, attributes will be added/removed on the set-pin
tag automatically. Supported “pseudo attributes” are inspired from: https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes#input_pseudo-classes
Where customStyles
is the class name added to widget tags, e.g. <set-pin class='customStyles'...
:
Supported selector | Input field equivalent | Description |
---|---|---|
.customStyles[_required] | input:required | True as soon as the widget has rendered(Useful to know when the widget is ready to be shown) |
.customStyles[_hover] | input:hover | True when the field is hovered over by the mouse |
.customStyles[_focus] | input:focus | True when the field is focused |
.customStyles[_active] | input:active | True when the mouse or touch is pressing down on the field |
.customStyles[_blank] | input:blank | True when there is no text in the field |
.customStyles[_invalid] | input:invalid | True when the text in the field is not yet valid |
.customStyles[_valid] | input:valid | True when the text in the field is now valid. For confirm, also only if matching controller |
.customStyles[_user-invalid] | input:user-invalid | Like :invalid, but only after the user first interacted with the field |
.customStyles[_user-valid] | input:user-valid | Like :valid, but only after the user first interacted with the field |
.customStyles[_out-of-range] | input:out-of-range | True when the text in the field is less than four numbers |
.customStyles[_in-range] | input:in-range | True when the text in the field is now four numbers |
invalid
and valid
are dependent upon the value matching the controller widget’s value. However, out-of-range
and in-range
are not.
See Font Styles for information on acceptable font style values.
src=“https://widgets-sandbox.synctera.com/assets/set-pin/v1/loader.js”
Font css property name | Allowed values |
---|---|
color | rgb(<R>, <G>, <B>) or rgba(<R>, <G>, <B>, <Alpha>) |
font-family | One of: courier: Courier New, Courier, Lucida Console, Lucida Sans Typewriter, monospace arial: Arial, Helvetica, sans-serif georgia: Georgia, Times New Roman, Times, serif helvetica: Helvetica, Arial, sans-serif lucida: Lucida Console, Lucida Sans Typewriter, Courier New, Courier, monospace times: Times New Roman, Times, Georgia, serif tahoma: Tahoma, Verdana, sans-serif verdana: Verdana, Tahoma, sans-serif |
font-size | <N>px |
font-weight | <N>00 (a number, not ‘bold’ etc) |
line-height | <N>px |
letter-spacing | <N>px |
font-family
property, we look for a keyword in the first font in the comma seperated list of fonts you supply. If there’s a match, we use the font-family strings in the above table and not the font-family specified (for security). The above list of fonts are designed to ensure maximum coverage across different operating systems for similar style fonts. Custom fonts are not supported at this time.