propro-utils 1.3.40 → 1.3.42

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.
@@ -0,0 +1,150 @@
1
+ import {
2
+ Body,
3
+ Container,
4
+ Head,
5
+ Heading,
6
+ Html,
7
+ Img,
8
+ Link,
9
+ Preview,
10
+ Text,
11
+ } from "@react-email/components";
12
+ import * as React from "react";
13
+
14
+ interface NotionMagicLinkEmailProps {
15
+ loginCode?: string;
16
+ }
17
+
18
+ const baseUrl = process.env.VERCEL_URL
19
+ ? `https://${process.env.VERCEL_URL}`
20
+ : "";
21
+
22
+ export const NotionMagicLinkEmail = ({
23
+ loginCode,
24
+ }: NotionMagicLinkEmailProps) => (
25
+ <Html>
26
+ <Head />
27
+ <Preview>Log in with this magic link</Preview>
28
+ <Body style={main}>
29
+ <Container style={container}>
30
+ <Heading style={h1}>Login</Heading>
31
+ <Link
32
+ href="https://notion.so"
33
+ target="_blank"
34
+ style={{
35
+ ...link,
36
+ display: "block",
37
+ marginBottom: "16px",
38
+ }}
39
+ >
40
+ Click here to log in with this magic link
41
+ </Link>
42
+ <Text style={{ ...text, marginBottom: "14px" }}>
43
+ Or, copy and paste this temporary login code:
44
+ </Text>
45
+ <code style={code}>{loginCode}</code>
46
+ <Text
47
+ style={{
48
+ ...text,
49
+ color: "#ababab",
50
+ marginTop: "14px",
51
+ marginBottom: "16px",
52
+ }}
53
+ >
54
+ If you didn&apos;t try to login, you can safely ignore this email.
55
+ </Text>
56
+ <Text
57
+ style={{
58
+ ...text,
59
+ color: "#ababab",
60
+ marginTop: "12px",
61
+ marginBottom: "38px",
62
+ }}
63
+ >
64
+ Hint: You can set a permanent password in Settings & members → My
65
+ account.
66
+ </Text>
67
+ <Img
68
+ src={`${baseUrl}/static/notion-logo.png`}
69
+ width="32"
70
+ height="32"
71
+ alt="Notion's Logo"
72
+ />
73
+ <Text style={footer}>
74
+ <Link
75
+ href="https://notion.so"
76
+ target="_blank"
77
+ style={{ ...link, color: "#898989" }}
78
+ >
79
+ Notion.so
80
+ </Link>
81
+ , the all-in-one-workspace
82
+ <br />
83
+ for your notes, tasks, wikis, and databases.
84
+ </Text>
85
+ </Container>
86
+ </Body>
87
+ </Html>
88
+ );
89
+
90
+ NotionMagicLinkEmail.PreviewProps = {
91
+ loginCode: "sparo-ndigo-amurt-secan",
92
+ } as NotionMagicLinkEmailProps;
93
+
94
+ export default NotionMagicLinkEmail;
95
+
96
+ const main = {
97
+ backgroundColor: "#ffffff",
98
+ };
99
+
100
+ const container = {
101
+ paddingLeft: "12px",
102
+ paddingRight: "12px",
103
+ margin: "0 auto",
104
+ };
105
+
106
+ const h1 = {
107
+ color: "#333",
108
+ fontFamily:
109
+ "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
110
+ fontSize: "24px",
111
+ fontWeight: "bold",
112
+ margin: "40px 0",
113
+ padding: "0",
114
+ };
115
+
116
+ const link = {
117
+ color: "#2754C5",
118
+ fontFamily:
119
+ "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
120
+ fontSize: "14px",
121
+ textDecoration: "underline",
122
+ };
123
+
124
+ const text = {
125
+ color: "#333",
126
+ fontFamily:
127
+ "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
128
+ fontSize: "14px",
129
+ margin: "24px 0",
130
+ };
131
+
132
+ const footer = {
133
+ color: "#898989",
134
+ fontFamily:
135
+ "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
136
+ fontSize: "12px",
137
+ lineHeight: "22px",
138
+ marginTop: "12px",
139
+ marginBottom: "24px",
140
+ };
141
+
142
+ const code = {
143
+ display: "inline-block",
144
+ padding: "16px 4.5%",
145
+ width: "90.5%",
146
+ backgroundColor: "#f4f4f4",
147
+ borderRadius: "5px",
148
+ border: "1px solid #eee",
149
+ color: "#333",
150
+ };
@@ -0,0 +1,158 @@
1
+ import {
2
+ Body,
3
+ Container,
4
+ Head,
5
+ Heading,
6
+ Html,
7
+ Img,
8
+ Link,
9
+ Section,
10
+ Text,
11
+ } from "@react-email/components";
12
+ import * as React from "react";
13
+
14
+ interface PlaidVerifyIdentityEmailProps {
15
+ validationCode?: string;
16
+ }
17
+
18
+ const baseUrl = process.env.VERCEL_URL
19
+ ? `https://${process.env.VERCEL_URL}`
20
+ : "";
21
+
22
+ export const PlaidVerifyIdentityEmail = ({
23
+ validationCode,
24
+ }: PlaidVerifyIdentityEmailProps) => (
25
+ <Html>
26
+ <Head />
27
+ <Body style={main}>
28
+ <Container style={container}>
29
+ <Img
30
+ src={`${baseUrl}/static/plaid-logo.png`}
31
+ width="212"
32
+ height="88"
33
+ alt="Plaid"
34
+ style={logo}
35
+ />
36
+ <Text style={tertiary}>Verify Your Identity</Text>
37
+ <Heading style={secondary}>
38
+ Enter the following code to finish linking Venmo.
39
+ </Heading>
40
+ <Section style={codeContainer}>
41
+ <Text style={code}>{validationCode}</Text>
42
+ </Section>
43
+ <Text style={paragraph}>Not expecting this email?</Text>
44
+ <Text style={paragraph}>
45
+ Contact{" "}
46
+ <Link href="mailto:login@plaid.com" style={link}>
47
+ login@plaid.com
48
+ </Link>{" "}
49
+ if you did not request this code.
50
+ </Text>
51
+ </Container>
52
+ <Text style={footer}>Securely powered by Plaid.</Text>
53
+ </Body>
54
+ </Html>
55
+ );
56
+
57
+ PlaidVerifyIdentityEmail.PreviewProps = {
58
+ validationCode: "144833",
59
+ } as PlaidVerifyIdentityEmailProps;
60
+
61
+ export default PlaidVerifyIdentityEmail;
62
+
63
+ const main = {
64
+ backgroundColor: "#ffffff",
65
+ fontFamily: "HelveticaNeue,Helvetica,Arial,sans-serif",
66
+ };
67
+
68
+ const container = {
69
+ backgroundColor: "#ffffff",
70
+ border: "1px solid #eee",
71
+ borderRadius: "5px",
72
+ boxShadow: "0 5px 10px rgba(20,50,70,.2)",
73
+ marginTop: "20px",
74
+ maxWidth: "360px",
75
+ margin: "0 auto",
76
+ padding: "68px 0 130px",
77
+ };
78
+
79
+ const logo = {
80
+ margin: "0 auto",
81
+ };
82
+
83
+ const tertiary = {
84
+ color: "#0a85ea",
85
+ fontSize: "11px",
86
+ fontWeight: 700,
87
+ fontFamily: "HelveticaNeue,Helvetica,Arial,sans-serif",
88
+ height: "16px",
89
+ letterSpacing: "0",
90
+ lineHeight: "16px",
91
+ margin: "16px 8px 8px 8px",
92
+ textTransform: "uppercase" as const,
93
+ textAlign: "center" as const,
94
+ };
95
+
96
+ const secondary = {
97
+ color: "#000",
98
+ display: "inline-block",
99
+ fontFamily: "HelveticaNeue-Medium,Helvetica,Arial,sans-serif",
100
+ fontSize: "20px",
101
+ fontWeight: 500,
102
+ lineHeight: "24px",
103
+ marginBottom: "0",
104
+ marginTop: "0",
105
+ textAlign: "center" as const,
106
+ };
107
+
108
+ const codeContainer = {
109
+ background: "rgba(0,0,0,.05)",
110
+ borderRadius: "4px",
111
+ margin: "16px auto 14px",
112
+ verticalAlign: "middle",
113
+ width: "280px",
114
+ };
115
+
116
+ const code = {
117
+ color: "#000",
118
+ display: "inline-block",
119
+ fontFamily: "HelveticaNeue-Bold",
120
+ fontSize: "32px",
121
+ fontWeight: 700,
122
+ letterSpacing: "6px",
123
+ lineHeight: "40px",
124
+ paddingBottom: "8px",
125
+ paddingTop: "8px",
126
+ margin: "0 auto",
127
+ width: "100%",
128
+ textAlign: "center" as const,
129
+ };
130
+
131
+ const paragraph = {
132
+ color: "#444",
133
+ fontSize: "15px",
134
+ fontFamily: "HelveticaNeue,Helvetica,Arial,sans-serif",
135
+ letterSpacing: "0",
136
+ lineHeight: "23px",
137
+ padding: "0 40px",
138
+ margin: "0",
139
+ textAlign: "center" as const,
140
+ };
141
+
142
+ const link = {
143
+ color: "#444",
144
+ textDecoration: "underline",
145
+ };
146
+
147
+ const footer = {
148
+ color: "#000",
149
+ fontSize: "12px",
150
+ fontWeight: 800,
151
+ letterSpacing: "0",
152
+ lineHeight: "23px",
153
+ margin: "0",
154
+ marginTop: "20px",
155
+ fontFamily: "HelveticaNeue,Helvetica,Arial,sans-serif",
156
+ textAlign: "center" as const,
157
+ textTransform: "uppercase" as const,
158
+ };
@@ -0,0 +1,152 @@
1
+ import {
2
+ Body,
3
+ Button,
4
+ Container,
5
+ Head,
6
+ Hr,
7
+ Html,
8
+ Img,
9
+ Link,
10
+ Preview,
11
+ Section,
12
+ Text,
13
+ } from "@react-email/components";
14
+ import * as React from "react";
15
+
16
+ const baseUrl = process.env.VERCEL_URL
17
+ ? `https://${process.env.VERCEL_URL}`
18
+ : "";
19
+
20
+ export const StripeWelcomeEmail = () => (
21
+ <Html>
22
+ <Head />
23
+ <Preview>You're now ready to make live transactions with Stripe!</Preview>
24
+ <Body style={main}>
25
+ <Container style={container}>
26
+ <Section style={box}>
27
+ <Img
28
+ src={`${baseUrl}/static/stripe-logo.png`}
29
+ width="49"
30
+ height="21"
31
+ alt="Stripe"
32
+ />
33
+ <Hr style={hr} />
34
+ <Text style={paragraph}>
35
+ Thanks for submitting your account information. You're now ready to
36
+ make live transactions with Stripe!
37
+ </Text>
38
+ <Text style={paragraph}>
39
+ You can view your payments and a variety of other information about
40
+ your account right from your dashboard.
41
+ </Text>
42
+ <Button style={button} href="https://dashboard.stripe.com/login">
43
+ View your Stripe Dashboard
44
+ </Button>
45
+ <Hr style={hr} />
46
+ <Text style={paragraph}>
47
+ If you haven't finished your integration, you might find our{" "}
48
+ <Link style={anchor} href="https://stripe.com/docs">
49
+ docs
50
+ </Link>{" "}
51
+ handy.
52
+ </Text>
53
+ <Text style={paragraph}>
54
+ Once you're ready to start accepting payments, you'll just need to
55
+ use your live{" "}
56
+ <Link
57
+ style={anchor}
58
+ href="https://dashboard.stripe.com/login?redirect=%2Fapikeys"
59
+ >
60
+ API keys
61
+ </Link>{" "}
62
+ instead of your test API keys. Your account can simultaneously be
63
+ used for both test and live requests, so you can continue testing
64
+ while accepting live payments. Check out our{" "}
65
+ <Link style={anchor} href="https://stripe.com/docs/dashboard">
66
+ tutorial about account basics
67
+ </Link>
68
+ .
69
+ </Text>
70
+ <Text style={paragraph}>
71
+ Finally, we've put together a{" "}
72
+ <Link
73
+ style={anchor}
74
+ href="https://stripe.com/docs/checklist/website"
75
+ >
76
+ quick checklist
77
+ </Link>{" "}
78
+ to ensure your website conforms to card network standards.
79
+ </Text>
80
+ <Text style={paragraph}>
81
+ We'll be here to help you with any step along the way. You can find
82
+ answers to most questions and get in touch with us on our{" "}
83
+ <Link style={anchor} href="https://support.stripe.com/">
84
+ support site
85
+ </Link>
86
+ .
87
+ </Text>
88
+ <Text style={paragraph}>— The Stripe team</Text>
89
+ <Hr style={hr} />
90
+ <Text style={footer}>
91
+ Stripe, 354 Oyster Point Blvd, South San Francisco, CA 94080
92
+ </Text>
93
+ </Section>
94
+ </Container>
95
+ </Body>
96
+ </Html>
97
+ );
98
+
99
+ export default StripeWelcomeEmail;
100
+
101
+ const main = {
102
+ backgroundColor: "#f6f9fc",
103
+ fontFamily:
104
+ '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Ubuntu,sans-serif',
105
+ };
106
+
107
+ const container = {
108
+ backgroundColor: "#ffffff",
109
+ margin: "0 auto",
110
+ padding: "20px 0 48px",
111
+ marginBottom: "64px",
112
+ };
113
+
114
+ const box = {
115
+ padding: "0 48px",
116
+ };
117
+
118
+ const hr = {
119
+ borderColor: "#e6ebf1",
120
+ margin: "20px 0",
121
+ };
122
+
123
+ const paragraph = {
124
+ color: "#525f7f",
125
+
126
+ fontSize: "16px",
127
+ lineHeight: "24px",
128
+ textAlign: "left" as const,
129
+ };
130
+
131
+ const anchor = {
132
+ color: "#556cd6",
133
+ };
134
+
135
+ const button = {
136
+ backgroundColor: "#656ee8",
137
+ borderRadius: "5px",
138
+ color: "#fff",
139
+ fontSize: "16px",
140
+ fontWeight: "bold",
141
+ textDecoration: "none",
142
+ textAlign: "center" as const,
143
+ display: "block",
144
+ width: "100%",
145
+ padding: "10px",
146
+ };
147
+
148
+ const footer = {
149
+ color: "#8898aa",
150
+ fontSize: "12px",
151
+ lineHeight: "16px",
152
+ };
@@ -0,0 +1,154 @@
1
+ import {
2
+ Body,
3
+ Button,
4
+ Container,
5
+ Column,
6
+ Head,
7
+ Heading,
8
+ Hr,
9
+ Html,
10
+ Img,
11
+ Link,
12
+ Preview,
13
+ Row,
14
+ Section,
15
+ Text,
16
+ } from "@react-email/components";
17
+ import { Tailwind } from "@react-email/tailwind";
18
+ import * as React from "react";
19
+
20
+ interface VercelInviteUserEmailProps {
21
+ username?: string;
22
+ userImage?: string;
23
+ invitedByUsername?: string;
24
+ invitedByEmail?: string;
25
+ teamName?: string;
26
+ teamImage?: string;
27
+ inviteLink?: string;
28
+ inviteFromIp?: string;
29
+ inviteFromLocation?: string;
30
+ }
31
+
32
+ const baseUrl = process.env.VERCEL_URL
33
+ ? `https://${process.env.VERCEL_URL}`
34
+ : "";
35
+
36
+ export const VercelInviteUserEmail = ({
37
+ username,
38
+ userImage,
39
+ invitedByUsername,
40
+ invitedByEmail,
41
+ teamName,
42
+ teamImage,
43
+ inviteLink,
44
+ inviteFromIp,
45
+ inviteFromLocation,
46
+ }: VercelInviteUserEmailProps) => {
47
+ const previewText = `Join ${invitedByUsername} on Vercel`;
48
+
49
+ return (
50
+ <Html>
51
+ <Head />
52
+ <Preview>{previewText}</Preview>
53
+ <Tailwind>
54
+ <Body className="bg-white my-auto mx-auto font-sans px-2">
55
+ <Container className="border border-solid border-[#eaeaea] rounded my-[40px] mx-auto p-[20px] max-w-[465px]">
56
+ <Section className="mt-[32px]">
57
+ <Img
58
+ src={`${baseUrl}/static/vercel-logo.png`}
59
+ width="40"
60
+ height="37"
61
+ alt="Vercel"
62
+ className="my-0 mx-auto"
63
+ />
64
+ </Section>
65
+ <Heading className="text-black text-[24px] font-normal text-center p-0 my-[30px] mx-0">
66
+ Join <strong>{teamName}</strong> on <strong>Vercel</strong>
67
+ </Heading>
68
+ <Text className="text-black text-[14px] leading-[24px]">
69
+ Hello {username},
70
+ </Text>
71
+ <Text className="text-black text-[14px] leading-[24px]">
72
+ <strong>{invitedByUsername}</strong> (
73
+ <Link
74
+ href={`mailto:${invitedByEmail}`}
75
+ className="text-blue-600 no-underline"
76
+ >
77
+ {invitedByEmail}
78
+ </Link>
79
+ ) has invited you to the <strong>{teamName}</strong> team on{" "}
80
+ <strong>Vercel</strong>.
81
+ </Text>
82
+ <Section>
83
+ <Row>
84
+ <Column align="right">
85
+ <Img
86
+ className="rounded-full"
87
+ src={userImage}
88
+ width="64"
89
+ height="64"
90
+ />
91
+ </Column>
92
+ <Column align="center">
93
+ <Img
94
+ src={`${baseUrl}/static/vercel-arrow.png`}
95
+ width="12"
96
+ height="9"
97
+ alt="invited you to"
98
+ />
99
+ </Column>
100
+ <Column align="left">
101
+ <Img
102
+ className="rounded-full"
103
+ src={teamImage}
104
+ width="64"
105
+ height="64"
106
+ />
107
+ </Column>
108
+ </Row>
109
+ </Section>
110
+ <Section className="text-center mt-[32px] mb-[32px]">
111
+ <Button
112
+ className="bg-[#000000] rounded text-white text-[12px] font-semibold no-underline text-center px-5 py-3"
113
+ href={inviteLink}
114
+ >
115
+ Join the team
116
+ </Button>
117
+ </Section>
118
+ <Text className="text-black text-[14px] leading-[24px]">
119
+ or copy and paste this URL into your browser:{" "}
120
+ <Link href={inviteLink} className="text-blue-600 no-underline">
121
+ {inviteLink}
122
+ </Link>
123
+ </Text>
124
+ <Hr className="border border-solid border-[#eaeaea] my-[26px] mx-0 w-full" />
125
+ <Text className="text-[#666666] text-[12px] leading-[24px]">
126
+ This invitation was intended for{" "}
127
+ <span className="text-black">{username}</span>. This invite was
128
+ sent from <span className="text-black">{inviteFromIp}</span>{" "}
129
+ located in{" "}
130
+ <span className="text-black">{inviteFromLocation}</span>. If you
131
+ were not expecting this invitation, you can ignore this email. If
132
+ you are concerned about your account's safety, please reply to
133
+ this email to get in touch with us.
134
+ </Text>
135
+ </Container>
136
+ </Body>
137
+ </Tailwind>
138
+ </Html>
139
+ );
140
+ };
141
+
142
+ VercelInviteUserEmail.PreviewProps = {
143
+ username: "alanturing",
144
+ userImage: `${baseUrl}/static/vercel-user.png`,
145
+ invitedByUsername: "Alan",
146
+ invitedByEmail: "alan.turing@example.com",
147
+ teamName: "Enigma",
148
+ teamImage: `${baseUrl}/static/vercel-team.png`,
149
+ inviteLink: "https://vercel.com/teams/invite/foo",
150
+ inviteFromIp: "204.13.186.218",
151
+ inviteFromLocation: "São Paulo, Brazil",
152
+ } as VercelInviteUserEmailProps;
153
+
154
+ export default VercelInviteUserEmail;
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "emails",
3
+ "version": "0.0.18",
4
+ "private": true,
5
+ "workspaces": [
6
+ ".react-email"
7
+ ],
8
+ "scripts": {
9
+ "build": "email build",
10
+ "dev": "email dev",
11
+ "export": "email export"
12
+ },
13
+ "dependencies": {
14
+ "@react-email/components": "0.0.14",
15
+ "react-email": "2.0.0"
16
+ }
17
+ }
@@ -0,0 +1,27 @@
1
+ # React Email Starter
2
+
3
+ A live preview right in your browser so you don't need to keep sending real emails during development.
4
+
5
+ ## Getting Started
6
+
7
+ First, install the dependencies:
8
+
9
+ ```sh
10
+ npm install
11
+ # or
12
+ yarn
13
+ ```
14
+
15
+ Then, run the development server:
16
+
17
+ ```sh
18
+ npm run dev
19
+ # or
20
+ yarn dev
21
+ ```
22
+
23
+ Open [localhost:3000](http://localhost:3000) with your browser to see the result.
24
+
25
+ ## License
26
+
27
+ MIT License
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.3.40",
3
+ "version": "1.3.42",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
- "type": "module",
7
6
  "scripts": {
8
7
  "test": "echo \"Error: no test specified\" && exit 1",
9
8
  "email": "email dev ",
@@ -16,7 +15,12 @@
16
15
  "keywords": [
17
16
  "auth",
18
17
  "middleware",
19
- "propro-auth"
18
+ "propro-auth",
19
+ "hubhub",
20
+ "propro",
21
+ "propro-productions",
22
+ "mapmap",
23
+ "propro-utils"
20
24
  ],
21
25
  "author": "ProPro",
22
26
  "license": "ISC",
@@ -8,7 +8,7 @@ const {post} = require("axios");
8
8
  /**
9
9
  * Middleware for handling authentication and authorization.
10
10
  *
11
- * @param {object} [options={}] - The options for configuring the authentication middleware.
11
+ * @param {object} [options={}] - The options for configuring the auth entication middleware.
12
12
  * @param {string} [options.secret="RESTFULAPIs"] - The secret key used for authentication.
13
13
  * @param {string} [options.authUrl=process.env.AUTH_URL] - The authentication URL.
14
14
  * @param {string} [options.clientId=process.env.CLIENT_ID] - The client ID.
@@ -45,7 +45,9 @@ function proproAuthMiddleware(options = {}, userSchema) {
45
45
  }
46
46
 
47
47
  if (req.path === "/api/refreshToken") {
48
+ console.log("refresh token");
48
49
  const refreshToken = req.cookies["x-refresh-token"];
50
+ console.log("refreshToken", refreshToken);
49
51
  if (!refreshToken) {
50
52
  const authClientUrl = `${clientUrl}/signin`;
51
53
  const redirectUrl = `${authClientUrl}?response_type=code&appName=${appName}&client_id=${clientId}&redirect_uri=${encodeURIComponent(
@@ -62,6 +64,10 @@ function proproAuthMiddleware(options = {}, userSchema) {
62
64
  }
63
65
  });
64
66
 
67
+ console.log("accountData", accountData);
68
+ console.log("access", access);
69
+ console.log("refresh", refresh);
70
+
65
71
 
66
72
  const currentDateTime = new Date();
67
73