Skip to content

Commit

Permalink
feat(sample-app): add example
Browse files Browse the repository at this point in the history
  • Loading branch information
mt-rory committed Dec 9, 2020
1 parent 1a55579 commit 89edfcf
Show file tree
Hide file tree
Showing 9 changed files with 4,687 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ You can validate a token or get guest or resource server information related to
<h6>Usage:</h6>

```javascript
const tokenInfo = await mtLinkSdk.tokenInfo(token, options);
const tokenInfo = await mtLinkSdk.tokenInfo(token);
tokenInfo.iat // token creation timestamp,
tokenInfo.exp // token expiration timestamp,
tokenInfo.sub // guest uid or null,
Expand Down
15 changes: 15 additions & 0 deletions sample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Moneytree JS SDK Example

An example of the Moneytree JS SDK.

## Install

---

`yarn install`

## Usage

---

`yarn start`
24 changes: 24 additions & 0 deletions sample/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "mt-link-javascript-sdk-sample",
"version": "2.0.0",
"author": "Moneytree",
"description": "An example of the Moneytree Web SDK.",
"license": "MIT",
"main": "./src/index.ts",
"scripts": {
"start": "webpack serve"
},
"dependencies": {
"@moneytree/mt-link-javascript-sdk": "file:../"
},
"devDependencies": {
"html-webpack-plugin": "^4.5.0",
"url-safe-base64": "^1.1.1",
"webpack": "^5.1.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0"
},
"engines": {
"node": ">=12"
}
}
46 changes: 46 additions & 0 deletions sample/src/elements.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export default {
commonOptionsElms: {
email: document.getElementById('common-options-email') as HTMLInputElement,
backTo: document.getElementById('common-options-backTo') as HTMLInputElement,
authAction: document.getElementById('common-options-authAction') as HTMLSelectElement,
showAuthToggle: document.getElementById('common-options-showAuthToggle') as HTMLInputElement,
showRememberMe: document.getElementById('common-options-showRememberMe') as HTMLInputElement,
isNewTab: document.getElementById('common-options-isNewTab') as HTMLInputElement,
},
authorizeOptionsElms: {
scopes: document.getElementById('authorize-options-scopes') as HTMLSelectElement,
},
onboardOptionsElms: {
email: document.getElementById('onboard-options-email') as HTMLSelectElement,
scopes: document.getElementById('onboard-options-scopes') as HTMLSelectElement,
country: document.getElementById('onboard-options-country') as HTMLSelectElement,
},
openServiceOptionsElms: {
serviceId: document.getElementById('open-service-options-serviceId') as HTMLSelectElement,
view: document.getElementById('open-service-options-view') as HTMLSelectElement,
type: document.getElementById('open-service-options-type') as HTMLSelectElement,
group: document.getElementById('open-service-options-group') as HTMLSelectElement,
search: document.getElementById('open-service-options-search') as HTMLInputElement,
entityKey: document.getElementById('open-service-options-entityKey') as HTMLInputElement,
credentialId: document.getElementById('open-service-options-credentialId') as HTMLInputElement,
},
initializeBtn: document.getElementById('initialize-btn') as HTMLButtonElement,
authorizeBtn: document.getElementById('authorize-btn') as HTMLButtonElement,
logoutBtn: document.getElementById('logout-btn') as HTMLButtonElement,
openServiceBtn: document.getElementById('open-service-btn') as HTMLButtonElement,
tokenInfoBtn: document.getElementById('token-info-btn') as HTMLButtonElement,
sendMagicLinkBtn: document.getElementById('send-magic-link') as HTMLButtonElement,
doOnboardBtn: document.getElementById('do-onboard') as HTMLButtonElement,
tokenElm: document.getElementById('token') as HTMLInputElement,
magicLinkToElm: document.getElementById('magicLinkTo') as HTMLSelectElement,
magicLinkEmailElm: document.getElementById('magicLink-email') as HTMLSelectElement,
tokenInfoLabel: document.getElementById('token-info-text') as HTMLInputElement,
accessTokenLabel: document.getElementById('access-token-text') as HTMLParagraphElement,
authorizationSection: document.getElementById('authorization-section') as HTMLDivElement,
onBoardSection: document.getElementById('onboard-section') as HTMLDivElement,
magicLinkSection: document.getElementById('magic-link-section') as HTMLDivElement,
openServiceSection: document.getElementById('open-service-section') as HTMLDivElement,
logoutSection: document.getElementById('logout-section') as HTMLDivElement,
tokenInfoSection: document.getElementById('token-info-section') as HTMLDivElement,
vaultOptions: document.getElementById('vault-options') as HTMLDivElement,
};

0 comments on commit 89edfcf

Please sign in to comment.