Skip to content

Commit

Permalink
Merge branch 'main' into enh/global-doc-verification
Browse files Browse the repository at this point in the history
  • Loading branch information
tamssokari authored and mldangelo committed Oct 2, 2023
2 parents 7268399 + 53291c5 commit d23eeae
Show file tree
Hide file tree
Showing 47 changed files with 6,996 additions and 13,914 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: lint
on:
push:
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run lint:html
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/share-preview-url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ on:
jobs:
comment-on-pr:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: get dest dir
id: get_dest_dir
run: echo "DEST_DIR=inline/preview-$GITHUB_HEAD_REF" >> "$GITHUB_OUTPUT"
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout code, and install dependencies
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
build: npm ci
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- name: run tests
uses: cypress-io/github-action@v5
uses: cypress-io/github-action@v6
with:
build: npm run build
build:dist: npm run build:dist
start: npm start
wait-on: 'http://localhost:8000'
- name: upload test failure artifacts
uses: actions/upload-artifact@v3
if: failure()
Expand Down
70 changes: 69 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,72 @@
# hosted-web-integration

[![Cypress Tests](https://github.com/smileidentity/hosted-web-integration/actions/workflows/main.yml/badge.svg)](https://github.com/smileidentity/hosted-web-integration/actions/workflows/main.yml)

Self Hosted Integration for Smile Identity on the Web
## Overview

This repository provides a self-hosted integration for Smile ID on the Web. It encompasses a comprehensive set of utilities for KYC processes, biometric verification, and more. Public documentation [here](https://docs.usesmileid.com/integration-options/web-mobile-web/web-integration).

## Prerequisites

- Ensure you have [Node.js](https://nodejs.org/) installed.
- Install [nvm (Node Version Manager)](https://github.com/nvm-sh/nvm) for managing Node.js versions.

## Setup

1. Clone the repository:

```bash
git clone https://github.com/smileidentity/hosted-web-integration.git
cd hosted-web-integration
```

2. Switch to the appropriate Node version using `nvm`:

```bash
nvm install
nvm use
```

3. Install project dependencies:

```bash
npm install
```

## Running the Project

1. Build the project:

```bash
npm run build
```

2. Start the local server:

```bash
npm start
```

3. Access the application on `http://localhost:8000`.

### Configuration

- `.git-blame-ignore-revs`: File used to ignore certain commits in `git blame`.
- `.gitignore`: Specifies files to ignore in git. These include [./dist](./dist) and [./build](./build).
- `.nvmrc`: Node Version Manager configuration file.
- `.nycrc`: [NYC](https://github.com/istanbuljs/nyc) configuration file.

## Testing

Run Cypress tests using:

```bash
npm test
```

NOTE: the `npm start` command must be running in a separate terminal window.

### Cypress Configuration & Pages

- `cypress.config.js`: Main Cypress configuration file.
- `cypress/pages/`: Contains all the utility pages.
86 changes: 42 additions & 44 deletions cypress/pages/authentication.html
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
<!doctype html>
<html lang='en'>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1' />
<style>
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}

body {
max-width: 100%;
min-height: 100%;
}
</style>
</head>
body {
max-width: 100%;
min-height: 100%;
}
</style>
</head>

<body>
<script
src='js/script.min.js'>
</script>
<body>
<script src="js/script.min.js"></script>

<script>
SmileIdentity({
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXJ0bmVyX3BhcmFtcyI6eyJ1c2VyX2lkIjoid2ViLXRva2VuLXRlc3QtdXNlci0xMDEiLCJqb2JfaWQiOiJ3ZWItdG9rZW4tam9iLTIzMDEiLCJqb2JfdHlwZSI6Mn0sImNhbGxiYWNrX3VybCI6Imh0dHBzOi8vd2ViaG9vay5zaXRlLzFhYWE3YTdiLWFjY2ItNDBhYy04NjQzLWZkOGE4NzAzZTliZSIsImlhdCI6MTY0ODIzODM2NCwiZXhwIjoxNjQ5ODg2NTk1fQ.PXqtgX3m6XTbHfDkxz0Yc-Z1EoblkrOeq1UFQqM9ix4',
product: 'authentication',
callback_url: 'https://webhook.site/1aaa7a7b-accb-40ac-8643-fd8a8703e9be',
environment: 'sandbox',
consent_required: {
'NG': ['BVN']
},
partner_details: {
name: 'Test Org',
logo_url: 'https://portal.smileidentity.com/favicon.ico',
partner_id: '212',
policy_url: 'https://smileidentity.com/privacy-policy',
theme_color: '#000',
},
onSuccess: () => {
},
onClose: () => {
},
});
</script>
</body>
<script>
SmileIdentity({
token:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXJ0bmVyX3BhcmFtcyI6eyJ1c2VyX2lkIjoid2ViLXRva2VuLXRlc3QtdXNlci0xMDEiLCJqb2JfaWQiOiJ3ZWItdG9rZW4tam9iLTIzMDEiLCJqb2JfdHlwZSI6Mn0sImNhbGxiYWNrX3VybCI6Imh0dHBzOi8vd2ViaG9vay5zaXRlLzFhYWE3YTdiLWFjY2ItNDBhYy04NjQzLWZkOGE4NzAzZTliZSIsImlhdCI6MTY0ODIzODM2NCwiZXhwIjoxNjQ5ODg2NTk1fQ.PXqtgX3m6XTbHfDkxz0Yc-Z1EoblkrOeq1UFQqM9ix4",
product: "authentication",
callback_url:
"https://webhook.site/1aaa7a7b-accb-40ac-8643-fd8a8703e9be",
environment: "sandbox",
consent_required: {
NG: ["BVN"],
},
partner_details: {
name: "Test Org",
logo_url: "https://portal.smileidentity.com/favicon.ico",
partner_id: "212",
policy_url: "https://smileidentity.com/privacy-policy",
theme_color: "#000",
},
onSuccess: () => {},
onClose: () => {},
});
</script>
</body>
</html>
101 changes: 50 additions & 51 deletions cypress/pages/basic_kyc.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,56 @@
<!doctype html>
<html lang='en'>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1' />
<style>
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}

body {
max-width: 100%;
min-height: 100%;
}
</style>
</head>
body {
max-width: 100%;
min-height: 100%;
}
</style>
</head>

<body>
<script
src='js/script.min.js'>
</script>
<body>
<script src="js/script.min.js"></script>

<script>
function displayError (error) {
const errorDiv = document.createElement('div')
errorDiv.setAttribute('class', 'validation-message');
errorDiv.textContent = error;
document.body.appendChild(errorDiv);
}
<script>
function displayError(error) {
const errorDiv = document.createElement("div");
errorDiv.setAttribute("class", "validation-message");
errorDiv.textContent = error;
document.body.appendChild(errorDiv);
}

SmileIdentity({
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXJ0bmVyX3BhcmFtcyI6eyJ1c2VyX2lkIjoid2ViLXRva2VuLXRlc3QtdXNlci0wMDEiLCJqb2JfaWQiOiJ3ZWItdG9rZW4tam9iLTEyMyIsImpvYl90eXBlIjo1fSwiY2FsbGJhY2tfdXJsIjoiaHR0cHM6Ly93ZWJob29rLnNpdGUvMWFhYTdhN2ItYWNjYi00MGFjLTg2NDMtZmQ4YTg3MDNlOWJlIiwiaWF0IjoxNjQ2OTQxNTQ5LCJleHAiOjE2NDg1ODg0ODN9.D83B4jSgQGJfSnQ5xALKea48okutLpbTcqojJTk4iGI',
product: 'basic_kyc',
callback_url: 'https://webhook.site/1aaa7a7b-accb-40ac-8643-fd8a8703e9be',
environment: 'sandbox',
partner_details: {
name: 'Test Org',
logo_url: 'https://portal.smileidentity.com/favicon.ico',
partner_id: '212',
policy_url: 'https://smileidentity.com/privacy-policy',
theme_color: '#000',
},
onSuccess: () => {
},
onClose: () => {
displayError('User triggered this close action');
},
onError: (data) => {
displayError(JSON.stringify(data, null, 2));
},
});
</script>
</body>
SmileIdentity({
token:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXJ0bmVyX3BhcmFtcyI6eyJ1c2VyX2lkIjoid2ViLXRva2VuLXRlc3QtdXNlci0wMDEiLCJqb2JfaWQiOiJ3ZWItdG9rZW4tam9iLTEyMyIsImpvYl90eXBlIjo1fSwiY2FsbGJhY2tfdXJsIjoiaHR0cHM6Ly93ZWJob29rLnNpdGUvMWFhYTdhN2ItYWNjYi00MGFjLTg2NDMtZmQ4YTg3MDNlOWJlIiwiaWF0IjoxNjQ2OTQxNTQ5LCJleHAiOjE2NDg1ODg0ODN9.D83B4jSgQGJfSnQ5xALKea48okutLpbTcqojJTk4iGI",
product: "basic_kyc",
callback_url:
"https://webhook.site/1aaa7a7b-accb-40ac-8643-fd8a8703e9be",
environment: "sandbox",
partner_details: {
name: "Test Org",
logo_url: "https://portal.smileidentity.com/favicon.ico",
partner_id: "212",
policy_url: "https://smileidentity.com/privacy-policy",
theme_color: "#000",
},
onSuccess: () => {},
onClose: () => {
displayError("User triggered this close action");
},
onError: (data) => {
displayError(JSON.stringify(data, null, 2));
},
});
</script>
</body>
</html>
Loading

0 comments on commit d23eeae

Please sign in to comment.