Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into greenkeeper/csv-parse-3.0.0
- Loading branch information
Showing
13 changed files
with
3,308 additions
and
19 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Bulk Invite members of a Team | ||
|
||
Use this script to get a list of uninvited users belonging to *myTeamName* and send email invites out. | ||
|
||
|
||
```sh | ||
node -r dotenv/config email-team-members *myTeamName* | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*eslint no-console: "off"*/ | ||
|
||
const Hub = require('../../src/api') | ||
|
||
const { | ||
DH_USERNAME, | ||
DH_PASSWORD, | ||
DH_TENANT | ||
} = process.env | ||
|
||
// Initiate the connection | ||
const hub = new Hub({ | ||
tenant: DH_TENANT, | ||
username: DH_USERNAME, | ||
password: DH_PASSWORD | ||
}) | ||
|
||
// Select a report | ||
const teamName = process.argv.slice(2) | ||
|
||
if (!teamName) { | ||
throw new Error('Team name is missing') | ||
} | ||
|
||
// Set master hub | ||
init(teamName).catch(e => console.log(e)) | ||
|
||
|
||
// Grab the assets | ||
async function init(teamName) { | ||
|
||
// Get members of a team | ||
const resp = await hub.api({ | ||
path: 'api/users', | ||
qs: { | ||
fields: ['id'], | ||
filter: { | ||
team: { | ||
name: teamName | ||
}, | ||
userDomains: { | ||
is_invited: false | ||
} | ||
}, | ||
limit: 10000 | ||
} | ||
}) | ||
|
||
console.log(`Found ${resp.data.length} uninvited members of the team`) | ||
|
||
// Send the invites | ||
await hub.api({ | ||
path: 'invites', | ||
method: 'POST', | ||
body: { | ||
ids: resp.data.map(item => item.id) | ||
} | ||
}) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
root: apps | ||
query: | ||
fields: | ||
- name | ||
- id | ||
- viewerUrl | ||
limit: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Email Templates | ||
|
||
This example shows how to configure an email template. | ||
|
||
```sh | ||
node -r dotenv/config ./settings/emailTemplates | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/*eslint no-console: "off"*/ | ||
|
||
const Hub = require('../../../src/api') | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
const env = process.env | ||
|
||
// Initiate the connection | ||
const hub = new Hub({ | ||
tenant: env.DH_TENANT, | ||
username: env.DH_USERNAME, | ||
password: env.DH_PASSWORD | ||
}) | ||
|
||
// Set the newUser template | ||
setEmailTemplate({ | ||
body: fs.readFileSync(path.join(__dirname, 'sampleTemplate.yml')).toString(), | ||
from: 'notification@5app.com', | ||
lang: 'en-GB', | ||
subject: 'Welcome New User', | ||
type: 'newUser' | ||
}).catch(e => console.log(e)) | ||
|
||
|
||
// Post the email template | ||
async function setEmailTemplate(body) { | ||
|
||
const resp = await hub.api({ | ||
path: 'api/emailTemplates', | ||
method: 'post', | ||
body | ||
}) | ||
|
||
console.log(resp) | ||
|
||
return resp | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
linkText: "Get Started" | ||
title: "Welcome to the {{domain.pageTitle}}" | ||
signature: "Thanks\nThe {{domain.pageTitle}} Team" | ||
footer: "{{#if content.issuer}}This email was sent to you by {{content.issuer}}<br />{{/if}} | ||
<a href=\"{{{domain.origin}}}\">{{domain.pageTitle}}</a>" | ||
--- | ||
|
||
## SAMPLE TEMPLATE | ||
|
||
Hi {{#if recipient.name}}{{recipient.name}}!{{/if}} | ||
|
||
Your company has created a new Digital Hub at {{domain.origin}} and you've been invited to join. | ||
|
||
{{#if content.link}} | ||
Please <a href="{{{content.link}}}">click here to confirm your email address</a> and get started. Once your account is confirmed, you can log in using your email address {{recipient.email}} | ||
{{else}} | ||
Please log into the {{domain.pageTitle}} with your email address {{recipient.email}} and your existing Learning Hub account password. | ||
{{/if}} | ||
|
||
Thanks! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Viewer | ||
|
||
Use this script to generate public external links to content. Please be warned that content shared via these links can be accessed by anyone. | ||
|
||
|
||
```sh | ||
node -r dotenv/config viewer | ||
``` | ||
|
||
Please note this is currently only available in JSON format | ||
|
||
The response contains the `viewerUrl` e.g. | ||
|
||
> "viewerUrl": [/viewer/25529/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjU1MjksImF1ZCI6Imh0dHBzOi8vYXVkdS5jb20saHR0cHM6Ly9hc2Rhc2QuY29tIiwiaWF0IjoxNTQ2NDc3ODMyfQ.3GD5QvZbodXGphEftoZRgLrKty8b3NrFVQdLj-JJ_qw](https://product.5app.com/viewer/25529/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjU1MjksImF1ZCI6Imh0dHBzOi8vYXVkdS5jb20saHR0cHM6Ly9hc2Rhc2QuY29tIiwiaWF0IjoxNTQ2NDc3ODMyfQ.3GD5QvZbodXGphEftoZRgLrKty8b3NrFVQdLj-JJ_qw) | ||
|
||
# Embedding in other websites | ||
|
||
The content disallows being [embeded into iframes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) by default. To override the default behaviour set the `aud` of the URI(s) for where this content should be embedded. | ||
|
||
To simplify this please just append the URI(s) to the end of shell line as above. | ||
|
||
|
||
```sh | ||
node -r dotenv/config viewer https://mywebsite.com http://mywebsite.org | ||
``` | ||
|
||
# Limitations | ||
|
||
Currently the asset viewer only has support for `web`, `Microsites` and `video` formats. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*eslint no-console: "off"*/ | ||
|
||
const Hub = require('../../src/api') | ||
|
||
const { | ||
DH_USERNAME, | ||
DH_PASSWORD, | ||
DH_TENANT | ||
} = process.env | ||
|
||
// Initiate the connection | ||
const hub = new Hub({ | ||
tenant: DH_TENANT, | ||
username: DH_USERNAME, | ||
password: DH_PASSWORD | ||
}) | ||
|
||
// Set the audience | ||
const aud = process.argv.slice(2).join(',') | ||
|
||
// console.log('Audience set to %s', aud) | ||
|
||
// Generate links | ||
getViewerUrls(aud).catch(e => console.log(e)) | ||
|
||
|
||
// Function to get the Viewer Links | ||
async function getViewerUrls(aud = '') { | ||
const resp = await hub.api({ | ||
path: 'api/commonAsset', | ||
qs: { | ||
fields: [ | ||
'id', | ||
'name', | ||
'viewerUrl' | ||
], | ||
filter: { | ||
type: ['upload', 'web', 'zip'] | ||
}, | ||
limit: 100, | ||
aud | ||
} | ||
}) | ||
|
||
console.log(resp) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters