nitro-web 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +9 -0
- package/.eslintrc.json +86 -0
- package/_example/.env-example +16 -0
- package/_example/client/config.ts +5 -0
- package/_example/client/css/index.css +35 -0
- package/_example/client/fonts/Roboto-Bold.ttf +0 -0
- package/_example/client/fonts/Roboto-BoldItalic.ttf +0 -0
- package/_example/client/fonts/Roboto-Italic.ttf +0 -0
- package/_example/client/fonts/Roboto-Medium.ttf +0 -0
- package/_example/client/fonts/Roboto-MediumItalic.ttf +0 -0
- package/_example/client/fonts/Roboto-Regular.ttf +0 -0
- package/_example/client/fonts/inter-v13-latin-300.woff2 +0 -0
- package/_example/client/fonts/inter-v13-latin-500.woff2 +0 -0
- package/_example/client/fonts/inter-v13-latin-600.woff2 +0 -0
- package/_example/client/fonts/inter-v13-latin-700.woff2 +0 -0
- package/_example/client/fonts/inter-v13-latin-800.woff2 +0 -0
- package/_example/client/fonts/inter-v13-latin-900.woff2 +0 -0
- package/_example/client/fonts/inter-v13-latin-regular.woff2 +0 -0
- package/_example/client/imgs/android-chrome-512x512.png +0 -0
- package/_example/client/imgs/favicon.png +0 -0
- package/_example/client/imgs/icons/calendar.svg +3 -0
- package/_example/client/imgs/icons/email.svg +6 -0
- package/_example/client/imgs/icons/eye-open.svg +4 -0
- package/_example/client/imgs/icons/eye.svg +5 -0
- package/_example/client/imgs/icons/filter.svg +7 -0
- package/_example/client/imgs/icons/left-circle.svg +3 -0
- package/_example/client/imgs/icons/left.svg +3 -0
- package/_example/client/imgs/icons/line-options.svg +5 -0
- package/_example/client/imgs/icons/line.svg +3 -0
- package/_example/client/imgs/icons/person.svg +7 -0
- package/_example/client/imgs/icons/plus-circle.svg +5 -0
- package/_example/client/imgs/icons/plus.svg +5 -0
- package/_example/client/imgs/icons/right-circle.svg +3 -0
- package/_example/client/imgs/icons/right.svg +3 -0
- package/_example/client/imgs/icons/search.svg +3 -0
- package/_example/client/imgs/icons/shield.svg +6 -0
- package/_example/client/imgs/icons/tick-circle-solid.svg +8 -0
- package/_example/client/imgs/icons/tick-circle.svg +6 -0
- package/_example/client/imgs/icons/tick.svg +5 -0
- package/_example/client/imgs/icons/up2-small.svg +4 -0
- package/_example/client/imgs/icons/up2.svg +4 -0
- package/_example/client/imgs/icons/updown.svg +6 -0
- package/_example/client/imgs/icons/v-big-dark.svg +3 -0
- package/_example/client/imgs/icons/v-dark.svg +3 -0
- package/_example/client/imgs/icons/v.svg +3 -0
- package/_example/client/imgs/icons/v2-active.svg +6 -0
- package/_example/client/imgs/icons/x1.svg +4 -0
- package/_example/client/imgs/logo/logo-white.svg +20 -0
- package/_example/client/imgs/logo/logo.svg +20 -0
- package/_example/client/imgs/no-image.jpg +0 -0
- package/_example/client/imgs/user.jpg +0 -0
- package/_example/client/index.html +12 -0
- package/_example/client/index.ts +47 -0
- package/_example/components/auth.api.js +1 -0
- package/_example/components/index.tsx +225 -0
- package/_example/components/partials/layouts.tsx +5 -0
- package/_example/components/settings.api.js +1 -0
- package/_example/server/config.js +120 -0
- package/_example/server/email/welcome.html +27 -0
- package/_example/server/index.js +32 -0
- package/_example/tailwind.config.js +84 -0
- package/_example/tsconfig.json +32 -0
- package/_example/types.d.ts +7 -0
- package/_example/webpack.config.js +4 -0
- package/client/app.js +300 -0
- package/client/css/components.css +84 -0
- package/client/css/fonts.css +67 -0
- package/client/imgs/icons/calendar.svg +3 -0
- package/client/imgs/icons/email.svg +6 -0
- package/client/imgs/icons/eye-open.svg +4 -0
- package/client/imgs/icons/eye.svg +5 -0
- package/client/imgs/icons/filter.svg +7 -0
- package/client/imgs/icons/left-circle.svg +3 -0
- package/client/imgs/icons/left.svg +3 -0
- package/client/imgs/icons/line-options.svg +5 -0
- package/client/imgs/icons/line.svg +3 -0
- package/client/imgs/icons/person.svg +7 -0
- package/client/imgs/icons/plus-circle.svg +5 -0
- package/client/imgs/icons/plus.svg +5 -0
- package/client/imgs/icons/right-circle.svg +3 -0
- package/client/imgs/icons/right.svg +3 -0
- package/client/imgs/icons/search.svg +3 -0
- package/client/imgs/icons/shield.svg +6 -0
- package/client/imgs/icons/tick-circle-solid.svg +8 -0
- package/client/imgs/icons/tick-circle.svg +6 -0
- package/client/imgs/icons/tick.svg +5 -0
- package/client/imgs/icons/up2-small.svg +4 -0
- package/client/imgs/icons/up2.svg +4 -0
- package/client/imgs/icons/updown.svg +6 -0
- package/client/imgs/icons/v-big-dark.svg +3 -0
- package/client/imgs/icons/v-dark.svg +3 -0
- package/client/imgs/icons/v.svg +3 -0
- package/client/imgs/icons/v2-active.svg +6 -0
- package/client/imgs/icons/x1.svg +4 -0
- package/client.js +42 -0
- package/components/auth/auth.api.js +419 -0
- package/components/auth/reset.jsx +88 -0
- package/components/auth/signin.jsx +74 -0
- package/components/auth/signup.jsx +62 -0
- package/components/billing/stripe.api.js +267 -0
- package/components/partials/element/accordion.jsx +82 -0
- package/components/partials/element/avatar.jsx +28 -0
- package/components/partials/element/button.jsx +66 -0
- package/components/partials/element/dropdown.jsx +185 -0
- package/components/partials/element/initials.jsx +56 -0
- package/components/partials/element/message.jsx +124 -0
- package/components/partials/element/modal.jsx +229 -0
- package/components/partials/element/sidebar.jsx +166 -0
- package/components/partials/element/tooltip.jsx +146 -0
- package/components/partials/element/topbar.jsx +25 -0
- package/components/partials/form/checkbox.jsx +74 -0
- package/components/partials/form/drop-handler.jsx +62 -0
- package/components/partials/form/drop.jsx +125 -0
- package/components/partials/form/form-error.jsx +21 -0
- package/components/partials/form/input-color.jsx +77 -0
- package/components/partials/form/input-currency.jsx +133 -0
- package/components/partials/form/input-date.jsx +223 -0
- package/components/partials/form/input.jsx +131 -0
- package/components/partials/form/location.jsx +212 -0
- package/components/partials/form/select.jsx +369 -0
- package/components/partials/form/toggle.jsx +46 -0
- package/components/partials/is-first-render.js +15 -0
- package/components/partials/layout/layout1.jsx +32 -0
- package/components/partials/layout/layout2.jsx +47 -0
- package/components/partials/not-found.jsx +7 -0
- package/components/partials/styleguide.jsx +252 -0
- package/components/settings/settings-account.jsx +143 -0
- package/components/settings/settings-business.jsx +121 -0
- package/components/settings/settings-team--member.jsx +108 -0
- package/components/settings/settings-team.jsx +76 -0
- package/components/settings/settings.api.js +54 -0
- package/package.json +175 -0
- package/readme.md +43 -0
- package/server/email/index.js +192 -0
- package/server/email/partials/email.css +153 -0
- package/server/email/partials/layout1.swig +92 -0
- package/server/email/partials/line.swig +8 -0
- package/server/email/partials/vert-10.swig +8 -0
- package/server/email/partials/vert-15.swig +8 -0
- package/server/email/partials/vert-20.swig +8 -0
- package/server/email/partials/vert-25.swig +8 -0
- package/server/email/partials/vert-30.swig +8 -0
- package/server/email/partials/vert-35.swig +8 -0
- package/server/email/partials/vert-50.swig +8 -0
- package/server/email/reset-password.html +21 -0
- package/server/email/welcome.html +21 -0
- package/server/models/company.js +76 -0
- package/server/models/user.js +45 -0
- package/server/router.js +355 -0
- package/server.js +20 -0
- package/util.js +1145 -0
- package/webpack.config.js +302 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<link href='http://fonts.googleapis.com/css?family=Open+Sans:600,400,300' rel='stylesheet' type='text/css'>
|
|
4
|
+
<!-- Nunjunks global defined in webpack.config -->
|
|
5
|
+
<link href='partials/email.css' rel='stylesheet' type='text/css'>
|
|
6
|
+
</head>
|
|
7
|
+
|
|
8
|
+
<body class="email-body">
|
|
9
|
+
|
|
10
|
+
<!-- Email body, bgcolor was F9FBFD -->
|
|
11
|
+
<table width="100%" align="center" bgcolor="#ffffff" cellpadding="0" cellspacing="0" border="0">
|
|
12
|
+
<tbody>
|
|
13
|
+
<tr>
|
|
14
|
+
<td align="center" valign="top" width="100%">
|
|
15
|
+
|
|
16
|
+
<!-- Center container -->
|
|
17
|
+
<table class="table-scale" width="610px" align="center" cellpadding="0" cellspacing="0" border="0">
|
|
18
|
+
<tbody>
|
|
19
|
+
<tr>
|
|
20
|
+
<td>
|
|
21
|
+
|
|
22
|
+
<!-- Header -->
|
|
23
|
+
{% include "./vert-35.swig" %}
|
|
24
|
+
<table class="table-header" width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
25
|
+
<tbody>
|
|
26
|
+
<tr>
|
|
27
|
+
<td width="100%">
|
|
28
|
+
{% include "./vert-25.swig" %}
|
|
29
|
+
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
30
|
+
<tbody>
|
|
31
|
+
<tr>
|
|
32
|
+
<td width="180px" align="left">
|
|
33
|
+
<a href="%recipient.domain%" target="_blank">
|
|
34
|
+
<img src="%recipient.domain%/assets/imgs/logo/logo-white.svg" width="auto" height="22" border="0">
|
|
35
|
+
</a>
|
|
36
|
+
</td>
|
|
37
|
+
<td align="right">
|
|
38
|
+
</td>
|
|
39
|
+
</tr>
|
|
40
|
+
</tbody>
|
|
41
|
+
</table>
|
|
42
|
+
{% include "./vert-25.swig" %}
|
|
43
|
+
</td>
|
|
44
|
+
</tr>
|
|
45
|
+
</tbody>
|
|
46
|
+
</table>
|
|
47
|
+
|
|
48
|
+
<!-- body -->
|
|
49
|
+
<table class="table-body" width="100%" bgcolor="#ffffff" cellpadding="0" cellspacing="0" border="0">
|
|
50
|
+
<tbody>
|
|
51
|
+
<tr>
|
|
52
|
+
<td width="100%" align="left">
|
|
53
|
+
{% include "./vert-50.swig" %}
|
|
54
|
+
|
|
55
|
+
<!-- content -->
|
|
56
|
+
<table class='table-content' cellpadding="0" cellspacing="0" border="0">
|
|
57
|
+
<tbody>
|
|
58
|
+
<tr>
|
|
59
|
+
<td style="padding-left:50px; padding-right:50px;" align="center" class="content">
|
|
60
|
+
{% block content %}{% endblock %}
|
|
61
|
+
</td>
|
|
62
|
+
</tr>
|
|
63
|
+
</tbody>
|
|
64
|
+
</table>
|
|
65
|
+
<!-- content -->
|
|
66
|
+
|
|
67
|
+
{% include "./vert-50.swig" %}
|
|
68
|
+
{% include "./vert-10.swig" %}
|
|
69
|
+
{% include "./vert-10.swig" %}
|
|
70
|
+
</td>
|
|
71
|
+
</tr>
|
|
72
|
+
</tbody>
|
|
73
|
+
</table>
|
|
74
|
+
<!-- body -->
|
|
75
|
+
|
|
76
|
+
<!-- footer -->
|
|
77
|
+
{% include "./vert-30.swig" %}
|
|
78
|
+
|
|
79
|
+
</td>
|
|
80
|
+
</tr>
|
|
81
|
+
</tbody>
|
|
82
|
+
</table>
|
|
83
|
+
<!-- Center container -->
|
|
84
|
+
|
|
85
|
+
</td>
|
|
86
|
+
</tr>
|
|
87
|
+
</tbody>
|
|
88
|
+
</table>
|
|
89
|
+
<!-- Email body -->
|
|
90
|
+
|
|
91
|
+
</body>
|
|
92
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{% extends "partials/layout1.swig" %}
|
|
2
|
+
{% block content %}
|
|
3
|
+
|
|
4
|
+
[[ subject = Reset your Password ]]
|
|
5
|
+
<b>%recipient.greet%</b>,<br/>
|
|
6
|
+
<br/>
|
|
7
|
+
Looks like you're having trouble signing into your account. If you need to reset your password, simply click the button below:<br/>
|
|
8
|
+
<br/>
|
|
9
|
+
If you didn't request this, feel free to disregard this email.<br/>
|
|
10
|
+
<br/>
|
|
11
|
+
<span mc:edit="button">
|
|
12
|
+
<a class="button" href="%recipient.domain%/reset/%recipient.token%" target="_blank">
|
|
13
|
+
Reset Your Password
|
|
14
|
+
</a>
|
|
15
|
+
</span><br/>
|
|
16
|
+
<br/>
|
|
17
|
+
Thanks,<br/>
|
|
18
|
+
<b>The Nitro Team</b>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
{% endblock %}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{% extends "partials/layout1.swig" %}
|
|
2
|
+
{% block content %}
|
|
3
|
+
|
|
4
|
+
[[ subject = Welcome to Nitro ]]
|
|
5
|
+
<b>%recipient.greet%</b>,<br/>
|
|
6
|
+
<br/>
|
|
7
|
+
Thanks for trying out Nitro! <br/>
|
|
8
|
+
<br/>
|
|
9
|
+
If you have any feature requests, feedback or questions, please don't hesitate to reach out to us at <a href="mailto:%recipient.replyToEmail%">%recipient.replyToEmail%</a>.<br/>
|
|
10
|
+
<br/>
|
|
11
|
+
<br/>
|
|
12
|
+
<span mc:edit="button">
|
|
13
|
+
<a class="button" href="%recipient.domain%/signin?email=%recipient.email%" target="_blank">
|
|
14
|
+
Account Sign In
|
|
15
|
+
</a>
|
|
16
|
+
</span><br/>
|
|
17
|
+
<br/>
|
|
18
|
+
Thanks,<br/>
|
|
19
|
+
<b>The Nitro Team</b>
|
|
20
|
+
|
|
21
|
+
{% endblock %}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { addressSchema, fullName } from '../../util.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
|
|
5
|
+
fields: {
|
|
6
|
+
business: {
|
|
7
|
+
address: addressSchema(),
|
|
8
|
+
country: { type: 'string', default: 'nz', required: true },
|
|
9
|
+
currency: { type: 'string', default: 'nzd', required: true },
|
|
10
|
+
name: { type: 'string', required: true, index: 'text' },
|
|
11
|
+
number: { type: 'string' },
|
|
12
|
+
phone: { type: 'string' },
|
|
13
|
+
website: { type: 'string', isURL: true },
|
|
14
|
+
},
|
|
15
|
+
status: { type: 'string', default: 'active', enum: ['active', 'unpaid', 'deleted'] },
|
|
16
|
+
users: [{
|
|
17
|
+
_id: { model: 'user' },
|
|
18
|
+
role: { type: 'string', enum: ['owner', 'manager', 'accountant'] },
|
|
19
|
+
status: { type: 'string', required: true, enum: ['invited', 'active', 'deleted'] },
|
|
20
|
+
inviteEmail: { type: 'string' },
|
|
21
|
+
inviteToken: { type: 'string' },
|
|
22
|
+
}],
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
findBL: ['users.inviteToken'],
|
|
26
|
+
updateBL: ['status', 'users'],
|
|
27
|
+
|
|
28
|
+
afterFind: [
|
|
29
|
+
async function (data) {
|
|
30
|
+
if (!data) return
|
|
31
|
+
// Merge expanded users into users
|
|
32
|
+
if (data.usersExpanded) {
|
|
33
|
+
for (let i=data.users.length; i--;) {
|
|
34
|
+
const user = data.users[i]
|
|
35
|
+
const userExpanded = data.usersExpanded.find(o => String(o._id) == String(user._id))
|
|
36
|
+
// console.log(userExpanded)
|
|
37
|
+
if (user.inviteEmail) user.email = user.inviteEmail
|
|
38
|
+
if (userExpanded) Object.assign(user, { ...userExpanded, name: fullName(userExpanded) })
|
|
39
|
+
}
|
|
40
|
+
delete data.usersExpanded
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
|
|
45
|
+
methods: {
|
|
46
|
+
publicData: function(models) {
|
|
47
|
+
return models
|
|
48
|
+
},
|
|
49
|
+
loginPopulate: function() {
|
|
50
|
+
// return the company with expanded company.users
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
as: 'usersExpanded',
|
|
54
|
+
from: 'user',
|
|
55
|
+
let: { users: '$users' }, // company.users
|
|
56
|
+
pipeline: [
|
|
57
|
+
{
|
|
58
|
+
$match: {
|
|
59
|
+
$expr: { $in: ['$_id', '$$users._id'] },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
$project: {
|
|
64
|
+
'createdAt': 1,
|
|
65
|
+
'email': 1,
|
|
66
|
+
'firstName': 1,
|
|
67
|
+
'lastName': 1,
|
|
68
|
+
'avatar': 1,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ucFirst, fullName } from '../../util.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
|
|
5
|
+
fields: {
|
|
6
|
+
avatar: { type: 'image' },
|
|
7
|
+
company: { model: 'company', required: true },
|
|
8
|
+
email: { type: 'email', required: true, index: 'unique' },
|
|
9
|
+
firstName: { type: 'string', required: true },
|
|
10
|
+
lastName: { type: 'string' },
|
|
11
|
+
password: { type: 'string', minLength: 6, required: true },
|
|
12
|
+
resetToken: { type: 'string' },
|
|
13
|
+
status: { type: 'string', default: 'active', enum: ['active', 'deleted', 'inactive'] },
|
|
14
|
+
stripeCustomer: { type: 'any' },
|
|
15
|
+
stripeSubscription: { type: 'any' },
|
|
16
|
+
stripeIntents: { type: 'any' },
|
|
17
|
+
type: { type: 'string', default: 'user', enum: ['user', 'admin'] },
|
|
18
|
+
usedFreeTrial: { type: 'boolean', default: false },
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
findBL: ['password', 'resetToken'],
|
|
22
|
+
updateBL: ['company', 'password', 'resetToken', 'status', 'stripeSubscription', 'type', 'usedFreeTrial'],
|
|
23
|
+
|
|
24
|
+
beforeValidate: [
|
|
25
|
+
async function (data) {
|
|
26
|
+
if (data.email) data.email = data.email.trim().toLowerCase()
|
|
27
|
+
if (data.firstName) data.firstName = ucFirst(data.firstName)
|
|
28
|
+
if (data.lastName) data.lastName = ucFirst(data.lastName)
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
|
|
32
|
+
afterFind: [
|
|
33
|
+
async function (data) {
|
|
34
|
+
if (!data) return
|
|
35
|
+
data.name = fullName(data)
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
methods: {
|
|
40
|
+
loginPopulate: function() {
|
|
41
|
+
return []
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
}
|