miragedev-sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +393 -0
- package/dist/auth/biometric.cjs +85 -0
- package/dist/auth/biometric.d.cts +7 -0
- package/dist/auth/biometric.d.ts +7 -0
- package/dist/auth/biometric.js +81 -0
- package/dist/auth/client.cjs +44 -0
- package/dist/auth/client.d.cts +12 -0
- package/dist/auth/client.d.ts +12 -0
- package/dist/auth/client.js +40 -0
- package/dist/auth/index.cjs +17 -0
- package/dist/auth/index.d.cts +6 -0
- package/dist/auth/index.d.ts +6 -0
- package/dist/auth/index.js +4 -0
- package/dist/auth/middleware.cjs +37 -0
- package/dist/auth/middleware.d.cts +10 -0
- package/dist/auth/middleware.d.ts +10 -0
- package/dist/auth/middleware.js +35 -0
- package/dist/auth-BC8JI28z.d.cts +22 -0
- package/dist/auth-BC8JI28z.d.ts +22 -0
- package/dist/billing/client.cjs +43 -0
- package/dist/billing/client.d.cts +11 -0
- package/dist/billing/client.d.ts +11 -0
- package/dist/billing/client.js +40 -0
- package/dist/billing/index.cjs +139 -0
- package/dist/billing/index.d.cts +12 -0
- package/dist/billing/index.d.ts +12 -0
- package/dist/billing/index.js +130 -0
- package/dist/billing/mobile.cjs +81 -0
- package/dist/billing/mobile.d.cts +17 -0
- package/dist/billing/mobile.d.ts +17 -0
- package/dist/billing/mobile.js +74 -0
- package/dist/billing/webhook.cjs +84 -0
- package/dist/billing/webhook.d.cts +19 -0
- package/dist/billing/webhook.d.ts +19 -0
- package/dist/billing/webhook.js +78 -0
- package/dist/billing-Bv2V7KWF.d.cts +23 -0
- package/dist/billing-Bv2V7KWF.d.ts +23 -0
- package/dist/chunk-5YXI4Q2K.js +13813 -0
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/chunk-BW4BLEIM.cjs +18 -0
- package/dist/chunk-DZDDLA4G.js +271 -0
- package/dist/chunk-E5YC2MHX.cjs +13816 -0
- package/dist/chunk-JUTTFY3W.js +16 -0
- package/dist/chunk-M26EDKMY.cjs +280 -0
- package/dist/chunk-M3DPIKWT.js +23 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/chunk-PHTUPKEM.cjs +26 -0
- package/dist/cli/commands/init.cjs +11 -0
- package/dist/cli/commands/init.d.cts +3 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/init.js +2 -0
- package/dist/cli/index.cjs +11 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +9 -0
- package/dist/email/index.cjs +526 -0
- package/dist/email/index.d.cts +6 -0
- package/dist/email/index.d.ts +6 -0
- package/dist/email/index.js +523 -0
- package/dist/email-DZN1-bHa.d.cts +19 -0
- package/dist/email-DZN1-bHa.d.ts +19 -0
- package/dist/index.cjs +27 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +21 -0
- package/dist/mobile/index.cjs +101 -0
- package/dist/mobile/index.d.cts +15 -0
- package/dist/mobile/index.d.ts +15 -0
- package/dist/mobile/index.js +96 -0
- package/dist/pwa/index.cjs +80 -0
- package/dist/pwa/index.d.cts +51 -0
- package/dist/pwa/index.d.ts +51 -0
- package/dist/pwa/index.js +76 -0
- package/package.json +140 -0
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
import { getConfig } from '../chunk-5YXI4Q2K.js';
|
|
2
|
+
import { MirageDevError } from '../chunk-JUTTFY3W.js';
|
|
3
|
+
import '../chunk-MLKGABMK.js';
|
|
4
|
+
import { render, Html, Head, Preview, Body, Container, Heading, Text, Section, Button } from '@react-email/components';
|
|
5
|
+
import { Resend } from 'resend';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var ResendProvider = class {
|
|
9
|
+
resend;
|
|
10
|
+
from;
|
|
11
|
+
constructor(apiKey, from) {
|
|
12
|
+
this.resend = new Resend(apiKey);
|
|
13
|
+
this.from = from;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Sends an email using Resend
|
|
17
|
+
*/
|
|
18
|
+
async sendEmail(options) {
|
|
19
|
+
try {
|
|
20
|
+
await this.resend.emails.send({
|
|
21
|
+
from: this.from,
|
|
22
|
+
to: options.to,
|
|
23
|
+
subject: options.subject,
|
|
24
|
+
html: options.html,
|
|
25
|
+
text: options.text
|
|
26
|
+
});
|
|
27
|
+
} catch (error) {
|
|
28
|
+
throw new MirageDevError(
|
|
29
|
+
"EMAIL_SEND_FAILED",
|
|
30
|
+
`Failed to send email: ${error.message}`,
|
|
31
|
+
error
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var WelcomeEmail = ({
|
|
37
|
+
userName = "there",
|
|
38
|
+
actionUrl = "#"
|
|
39
|
+
}) => /* @__PURE__ */ jsxs(Html, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Head, {}),
|
|
41
|
+
/* @__PURE__ */ jsx(Preview, { children: "Welcome to our platform!" }),
|
|
42
|
+
/* @__PURE__ */ jsx(Body, { style: main, children: /* @__PURE__ */ jsxs(Container, { style: container, children: [
|
|
43
|
+
/* @__PURE__ */ jsxs(Heading, { style: h1, children: [
|
|
44
|
+
"Welcome ",
|
|
45
|
+
userName,
|
|
46
|
+
"! \u{1F44B}"
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ jsx(Text, { style: text, children: "We're excited to have you on board. Let's get started with your journey." }),
|
|
49
|
+
/* @__PURE__ */ jsx(Section, { style: buttonContainer, children: /* @__PURE__ */ jsx(Button, { style: button, href: actionUrl, children: "Get Started" }) }),
|
|
50
|
+
/* @__PURE__ */ jsx(Text, { style: footer, children: "If you have any questions, feel free to reach out to our support team." })
|
|
51
|
+
] }) })
|
|
52
|
+
] });
|
|
53
|
+
var welcome_default = WelcomeEmail;
|
|
54
|
+
var main = {
|
|
55
|
+
backgroundColor: "#f6f9fc",
|
|
56
|
+
fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Ubuntu,sans-serif'
|
|
57
|
+
};
|
|
58
|
+
var container = {
|
|
59
|
+
backgroundColor: "#ffffff",
|
|
60
|
+
margin: "0 auto",
|
|
61
|
+
padding: "20px 0 48px",
|
|
62
|
+
marginBottom: "64px",
|
|
63
|
+
maxWidth: "600px"
|
|
64
|
+
};
|
|
65
|
+
var h1 = {
|
|
66
|
+
color: "#333",
|
|
67
|
+
fontSize: "24px",
|
|
68
|
+
fontWeight: "bold",
|
|
69
|
+
margin: "40px 0",
|
|
70
|
+
padding: "0 24px"
|
|
71
|
+
};
|
|
72
|
+
var text = {
|
|
73
|
+
color: "#333",
|
|
74
|
+
fontSize: "16px",
|
|
75
|
+
lineHeight: "26px",
|
|
76
|
+
padding: "0 24px"
|
|
77
|
+
};
|
|
78
|
+
var buttonContainer = {
|
|
79
|
+
padding: "24px"
|
|
80
|
+
};
|
|
81
|
+
var button = {
|
|
82
|
+
backgroundColor: "#5469d4",
|
|
83
|
+
borderRadius: "4px",
|
|
84
|
+
color: "#fff",
|
|
85
|
+
fontSize: "16px",
|
|
86
|
+
fontWeight: "bold",
|
|
87
|
+
textDecoration: "none",
|
|
88
|
+
textAlign: "center",
|
|
89
|
+
display: "block",
|
|
90
|
+
padding: "12px 20px"
|
|
91
|
+
};
|
|
92
|
+
var footer = {
|
|
93
|
+
color: "#8898aa",
|
|
94
|
+
fontSize: "14px",
|
|
95
|
+
lineHeight: "24px",
|
|
96
|
+
padding: "0 24px"
|
|
97
|
+
};
|
|
98
|
+
var ResetPasswordEmail = ({
|
|
99
|
+
userName = "there",
|
|
100
|
+
resetUrl = "#"
|
|
101
|
+
}) => /* @__PURE__ */ jsxs(Html, { children: [
|
|
102
|
+
/* @__PURE__ */ jsx(Head, {}),
|
|
103
|
+
/* @__PURE__ */ jsx(Preview, { children: "Reset your password" }),
|
|
104
|
+
/* @__PURE__ */ jsx(Body, { style: main2, children: /* @__PURE__ */ jsxs(Container, { style: container2, children: [
|
|
105
|
+
/* @__PURE__ */ jsx(Heading, { style: h12, children: "Reset Your Password" }),
|
|
106
|
+
/* @__PURE__ */ jsxs(Text, { style: text2, children: [
|
|
107
|
+
"Hi ",
|
|
108
|
+
userName,
|
|
109
|
+
","
|
|
110
|
+
] }),
|
|
111
|
+
/* @__PURE__ */ jsx(Text, { style: text2, children: "We received a request to reset your password. Click the button below to choose a new password." }),
|
|
112
|
+
/* @__PURE__ */ jsx(Section, { style: buttonContainer2, children: /* @__PURE__ */ jsx(Button, { style: button2, href: resetUrl, children: "Reset Password" }) }),
|
|
113
|
+
/* @__PURE__ */ jsx(Text, { style: text2, children: "This link will expire in 1 hour for security reasons." }),
|
|
114
|
+
/* @__PURE__ */ jsx(Text, { style: footer2, children: "If you didn't request a password reset, you can safely ignore this email." })
|
|
115
|
+
] }) })
|
|
116
|
+
] });
|
|
117
|
+
var reset_password_default = ResetPasswordEmail;
|
|
118
|
+
var main2 = {
|
|
119
|
+
backgroundColor: "#f6f9fc",
|
|
120
|
+
fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Ubuntu,sans-serif'
|
|
121
|
+
};
|
|
122
|
+
var container2 = {
|
|
123
|
+
backgroundColor: "#ffffff",
|
|
124
|
+
margin: "0 auto",
|
|
125
|
+
padding: "20px 0 48px",
|
|
126
|
+
marginBottom: "64px",
|
|
127
|
+
maxWidth: "600px"
|
|
128
|
+
};
|
|
129
|
+
var h12 = {
|
|
130
|
+
color: "#333",
|
|
131
|
+
fontSize: "24px",
|
|
132
|
+
fontWeight: "bold",
|
|
133
|
+
margin: "40px 0",
|
|
134
|
+
padding: "0 24px"
|
|
135
|
+
};
|
|
136
|
+
var text2 = {
|
|
137
|
+
color: "#333",
|
|
138
|
+
fontSize: "16px",
|
|
139
|
+
lineHeight: "26px",
|
|
140
|
+
padding: "0 24px",
|
|
141
|
+
marginBottom: "16px"
|
|
142
|
+
};
|
|
143
|
+
var buttonContainer2 = {
|
|
144
|
+
padding: "24px"
|
|
145
|
+
};
|
|
146
|
+
var button2 = {
|
|
147
|
+
backgroundColor: "#5469d4",
|
|
148
|
+
borderRadius: "4px",
|
|
149
|
+
color: "#fff",
|
|
150
|
+
fontSize: "16px",
|
|
151
|
+
fontWeight: "bold",
|
|
152
|
+
textDecoration: "none",
|
|
153
|
+
textAlign: "center",
|
|
154
|
+
display: "block",
|
|
155
|
+
padding: "12px 20px"
|
|
156
|
+
};
|
|
157
|
+
var footer2 = {
|
|
158
|
+
color: "#8898aa",
|
|
159
|
+
fontSize: "14px",
|
|
160
|
+
lineHeight: "24px",
|
|
161
|
+
padding: "0 24px",
|
|
162
|
+
marginTop: "24px"
|
|
163
|
+
};
|
|
164
|
+
var SubscriptionCreatedEmail = ({
|
|
165
|
+
userName = "there",
|
|
166
|
+
planName = "Pro",
|
|
167
|
+
amount = "$10",
|
|
168
|
+
dashboardUrl = "#"
|
|
169
|
+
}) => /* @__PURE__ */ jsxs(Html, { children: [
|
|
170
|
+
/* @__PURE__ */ jsx(Head, {}),
|
|
171
|
+
/* @__PURE__ */ jsx(Preview, { children: "Your subscription is active!" }),
|
|
172
|
+
/* @__PURE__ */ jsx(Body, { style: main3, children: /* @__PURE__ */ jsxs(Container, { style: container3, children: [
|
|
173
|
+
/* @__PURE__ */ jsx(Heading, { style: h13, children: "\u{1F389} Subscription Active!" }),
|
|
174
|
+
/* @__PURE__ */ jsxs(Text, { style: text3, children: [
|
|
175
|
+
"Hi ",
|
|
176
|
+
userName,
|
|
177
|
+
","
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ jsxs(Text, { style: text3, children: [
|
|
180
|
+
"Thank you for subscribing to our ",
|
|
181
|
+
/* @__PURE__ */ jsx("strong", { children: planName }),
|
|
182
|
+
" plan!"
|
|
183
|
+
] }),
|
|
184
|
+
/* @__PURE__ */ jsxs(Section, { style: infoBox, children: [
|
|
185
|
+
/* @__PURE__ */ jsxs(Text, { style: infoText, children: [
|
|
186
|
+
/* @__PURE__ */ jsx("strong", { children: "Plan:" }),
|
|
187
|
+
" ",
|
|
188
|
+
planName
|
|
189
|
+
] }),
|
|
190
|
+
/* @__PURE__ */ jsxs(Text, { style: infoText, children: [
|
|
191
|
+
/* @__PURE__ */ jsx("strong", { children: "Amount:" }),
|
|
192
|
+
" ",
|
|
193
|
+
amount,
|
|
194
|
+
"/month"
|
|
195
|
+
] })
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ jsx(Text, { style: text3, children: "Your subscription is now active and you have access to all premium features." }),
|
|
198
|
+
/* @__PURE__ */ jsx(Section, { style: buttonContainer3, children: /* @__PURE__ */ jsx(Button, { style: button3, href: dashboardUrl, children: "Go to Dashboard" }) }),
|
|
199
|
+
/* @__PURE__ */ jsx(Text, { style: footer3, children: "You can manage your subscription anytime from your account settings." })
|
|
200
|
+
] }) })
|
|
201
|
+
] });
|
|
202
|
+
var subscription_created_default = SubscriptionCreatedEmail;
|
|
203
|
+
var main3 = {
|
|
204
|
+
backgroundColor: "#f6f9fc",
|
|
205
|
+
fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Ubuntu,sans-serif'
|
|
206
|
+
};
|
|
207
|
+
var container3 = {
|
|
208
|
+
backgroundColor: "#ffffff",
|
|
209
|
+
margin: "0 auto",
|
|
210
|
+
padding: "20px 0 48px",
|
|
211
|
+
marginBottom: "64px",
|
|
212
|
+
maxWidth: "600px"
|
|
213
|
+
};
|
|
214
|
+
var h13 = {
|
|
215
|
+
color: "#333",
|
|
216
|
+
fontSize: "24px",
|
|
217
|
+
fontWeight: "bold",
|
|
218
|
+
margin: "40px 0",
|
|
219
|
+
padding: "0 24px"
|
|
220
|
+
};
|
|
221
|
+
var text3 = {
|
|
222
|
+
color: "#333",
|
|
223
|
+
fontSize: "16px",
|
|
224
|
+
lineHeight: "26px",
|
|
225
|
+
padding: "0 24px",
|
|
226
|
+
marginBottom: "16px"
|
|
227
|
+
};
|
|
228
|
+
var infoBox = {
|
|
229
|
+
backgroundColor: "#f6f9fc",
|
|
230
|
+
borderRadius: "4px",
|
|
231
|
+
padding: "16px 24px",
|
|
232
|
+
margin: "24px 24px"
|
|
233
|
+
};
|
|
234
|
+
var infoText = {
|
|
235
|
+
color: "#333",
|
|
236
|
+
fontSize: "14px",
|
|
237
|
+
lineHeight: "24px",
|
|
238
|
+
margin: "4px 0"
|
|
239
|
+
};
|
|
240
|
+
var buttonContainer3 = {
|
|
241
|
+
padding: "24px"
|
|
242
|
+
};
|
|
243
|
+
var button3 = {
|
|
244
|
+
backgroundColor: "#5469d4",
|
|
245
|
+
borderRadius: "4px",
|
|
246
|
+
color: "#fff",
|
|
247
|
+
fontSize: "16px",
|
|
248
|
+
fontWeight: "bold",
|
|
249
|
+
textDecoration: "none",
|
|
250
|
+
textAlign: "center",
|
|
251
|
+
display: "block",
|
|
252
|
+
padding: "12px 20px"
|
|
253
|
+
};
|
|
254
|
+
var footer3 = {
|
|
255
|
+
color: "#8898aa",
|
|
256
|
+
fontSize: "14px",
|
|
257
|
+
lineHeight: "24px",
|
|
258
|
+
padding: "0 24px"
|
|
259
|
+
};
|
|
260
|
+
var SubscriptionCanceledEmail = ({
|
|
261
|
+
userName = "there",
|
|
262
|
+
planName = "Pro",
|
|
263
|
+
endDate = "end of this billing period",
|
|
264
|
+
feedbackUrl = "#"
|
|
265
|
+
}) => /* @__PURE__ */ jsxs(Html, { children: [
|
|
266
|
+
/* @__PURE__ */ jsx(Head, {}),
|
|
267
|
+
/* @__PURE__ */ jsx(Preview, { children: "Your subscription has been canceled" }),
|
|
268
|
+
/* @__PURE__ */ jsx(Body, { style: main4, children: /* @__PURE__ */ jsxs(Container, { style: container4, children: [
|
|
269
|
+
/* @__PURE__ */ jsx(Heading, { style: h14, children: "Subscription Canceled" }),
|
|
270
|
+
/* @__PURE__ */ jsxs(Text, { style: text4, children: [
|
|
271
|
+
"Hi ",
|
|
272
|
+
userName,
|
|
273
|
+
","
|
|
274
|
+
] }),
|
|
275
|
+
/* @__PURE__ */ jsxs(Text, { style: text4, children: [
|
|
276
|
+
"We're sorry to see you go. Your ",
|
|
277
|
+
/* @__PURE__ */ jsx("strong", { children: planName }),
|
|
278
|
+
" subscription has been canceled."
|
|
279
|
+
] }),
|
|
280
|
+
/* @__PURE__ */ jsx(Section, { style: infoBox2, children: /* @__PURE__ */ jsxs(Text, { style: infoText2, children: [
|
|
281
|
+
"You'll continue to have access to premium features until ",
|
|
282
|
+
/* @__PURE__ */ jsx("strong", { children: endDate }),
|
|
283
|
+
"."
|
|
284
|
+
] }) }),
|
|
285
|
+
/* @__PURE__ */ jsx(Text, { style: text4, children: "We'd love to hear your feedback about why you canceled. Your input helps us improve." }),
|
|
286
|
+
/* @__PURE__ */ jsx(Section, { style: buttonContainer4, children: /* @__PURE__ */ jsx(Button, { style: button4, href: feedbackUrl, children: "Share Feedback" }) }),
|
|
287
|
+
/* @__PURE__ */ jsx(Text, { style: footer4, children: "Changed your mind? You can reactivate your subscription anytime from your account settings." })
|
|
288
|
+
] }) })
|
|
289
|
+
] });
|
|
290
|
+
var subscription_canceled_default = SubscriptionCanceledEmail;
|
|
291
|
+
var main4 = {
|
|
292
|
+
backgroundColor: "#f6f9fc",
|
|
293
|
+
fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Ubuntu,sans-serif'
|
|
294
|
+
};
|
|
295
|
+
var container4 = {
|
|
296
|
+
backgroundColor: "#ffffff",
|
|
297
|
+
margin: "0 auto",
|
|
298
|
+
padding: "20px 0 48px",
|
|
299
|
+
marginBottom: "64px",
|
|
300
|
+
maxWidth: "600px"
|
|
301
|
+
};
|
|
302
|
+
var h14 = {
|
|
303
|
+
color: "#333",
|
|
304
|
+
fontSize: "24px",
|
|
305
|
+
fontWeight: "bold",
|
|
306
|
+
margin: "40px 0",
|
|
307
|
+
padding: "0 24px"
|
|
308
|
+
};
|
|
309
|
+
var text4 = {
|
|
310
|
+
color: "#333",
|
|
311
|
+
fontSize: "16px",
|
|
312
|
+
lineHeight: "26px",
|
|
313
|
+
padding: "0 24px",
|
|
314
|
+
marginBottom: "16px"
|
|
315
|
+
};
|
|
316
|
+
var infoBox2 = {
|
|
317
|
+
backgroundColor: "#fff4e6",
|
|
318
|
+
borderRadius: "4px",
|
|
319
|
+
padding: "16px 24px",
|
|
320
|
+
margin: "24px 24px",
|
|
321
|
+
borderLeft: "4px solid #ff9800"
|
|
322
|
+
};
|
|
323
|
+
var infoText2 = {
|
|
324
|
+
color: "#333",
|
|
325
|
+
fontSize: "14px",
|
|
326
|
+
lineHeight: "24px",
|
|
327
|
+
margin: "0"
|
|
328
|
+
};
|
|
329
|
+
var buttonContainer4 = {
|
|
330
|
+
padding: "24px"
|
|
331
|
+
};
|
|
332
|
+
var button4 = {
|
|
333
|
+
backgroundColor: "#5469d4",
|
|
334
|
+
borderRadius: "4px",
|
|
335
|
+
color: "#fff",
|
|
336
|
+
fontSize: "16px",
|
|
337
|
+
fontWeight: "bold",
|
|
338
|
+
textDecoration: "none",
|
|
339
|
+
textAlign: "center",
|
|
340
|
+
display: "block",
|
|
341
|
+
padding: "12px 20px"
|
|
342
|
+
};
|
|
343
|
+
var footer4 = {
|
|
344
|
+
color: "#8898aa",
|
|
345
|
+
fontSize: "14px",
|
|
346
|
+
lineHeight: "24px",
|
|
347
|
+
padding: "0 24px"
|
|
348
|
+
};
|
|
349
|
+
var InvoiceEmail = ({
|
|
350
|
+
userName = "there",
|
|
351
|
+
invoiceNumber = "#INV-0001",
|
|
352
|
+
amount = "$10.00",
|
|
353
|
+
date = (/* @__PURE__ */ new Date()).toLocaleDateString(),
|
|
354
|
+
downloadUrl = "#"
|
|
355
|
+
}) => /* @__PURE__ */ jsxs(Html, { children: [
|
|
356
|
+
/* @__PURE__ */ jsx(Head, {}),
|
|
357
|
+
/* @__PURE__ */ jsx(Preview, { children: "Your invoice is ready" }),
|
|
358
|
+
/* @__PURE__ */ jsx(Body, { style: main5, children: /* @__PURE__ */ jsxs(Container, { style: container5, children: [
|
|
359
|
+
/* @__PURE__ */ jsxs(Heading, { style: h15, children: [
|
|
360
|
+
"Invoice ",
|
|
361
|
+
invoiceNumber
|
|
362
|
+
] }),
|
|
363
|
+
/* @__PURE__ */ jsxs(Text, { style: text5, children: [
|
|
364
|
+
"Hi ",
|
|
365
|
+
userName,
|
|
366
|
+
","
|
|
367
|
+
] }),
|
|
368
|
+
/* @__PURE__ */ jsx(Text, { style: text5, children: "Thank you for your payment. Your invoice is now available." }),
|
|
369
|
+
/* @__PURE__ */ jsxs(Section, { style: infoBox3, children: [
|
|
370
|
+
/* @__PURE__ */ jsxs(Text, { style: infoText3, children: [
|
|
371
|
+
/* @__PURE__ */ jsx("strong", { children: "Invoice:" }),
|
|
372
|
+
" ",
|
|
373
|
+
invoiceNumber
|
|
374
|
+
] }),
|
|
375
|
+
/* @__PURE__ */ jsxs(Text, { style: infoText3, children: [
|
|
376
|
+
/* @__PURE__ */ jsx("strong", { children: "Date:" }),
|
|
377
|
+
" ",
|
|
378
|
+
date
|
|
379
|
+
] }),
|
|
380
|
+
/* @__PURE__ */ jsxs(Text, { style: infoText3, children: [
|
|
381
|
+
/* @__PURE__ */ jsx("strong", { children: "Amount:" }),
|
|
382
|
+
" ",
|
|
383
|
+
amount
|
|
384
|
+
] }),
|
|
385
|
+
/* @__PURE__ */ jsxs(Text, { style: infoText3, children: [
|
|
386
|
+
/* @__PURE__ */ jsx("strong", { children: "Status:" }),
|
|
387
|
+
" Paid"
|
|
388
|
+
] })
|
|
389
|
+
] }),
|
|
390
|
+
/* @__PURE__ */ jsx(Section, { style: buttonContainer5, children: /* @__PURE__ */ jsx(Button, { style: button5, href: downloadUrl, children: "Download Invoice" }) }),
|
|
391
|
+
/* @__PURE__ */ jsx(Text, { style: footer5, children: "Keep this email for your records. If you have any questions about this invoice, please contact our support team." })
|
|
392
|
+
] }) })
|
|
393
|
+
] });
|
|
394
|
+
var invoice_default = InvoiceEmail;
|
|
395
|
+
var main5 = {
|
|
396
|
+
backgroundColor: "#f6f9fc",
|
|
397
|
+
fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Ubuntu,sans-serif'
|
|
398
|
+
};
|
|
399
|
+
var container5 = {
|
|
400
|
+
backgroundColor: "#ffffff",
|
|
401
|
+
margin: "0 auto",
|
|
402
|
+
padding: "20px 0 48px",
|
|
403
|
+
marginBottom: "64px",
|
|
404
|
+
maxWidth: "600px"
|
|
405
|
+
};
|
|
406
|
+
var h15 = {
|
|
407
|
+
color: "#333",
|
|
408
|
+
fontSize: "24px",
|
|
409
|
+
fontWeight: "bold",
|
|
410
|
+
margin: "40px 0",
|
|
411
|
+
padding: "0 24px"
|
|
412
|
+
};
|
|
413
|
+
var text5 = {
|
|
414
|
+
color: "#333",
|
|
415
|
+
fontSize: "16px",
|
|
416
|
+
lineHeight: "26px",
|
|
417
|
+
padding: "0 24px",
|
|
418
|
+
marginBottom: "16px"
|
|
419
|
+
};
|
|
420
|
+
var infoBox3 = {
|
|
421
|
+
backgroundColor: "#f6f9fc",
|
|
422
|
+
borderRadius: "4px",
|
|
423
|
+
padding: "16px 24px",
|
|
424
|
+
margin: "24px 24px"
|
|
425
|
+
};
|
|
426
|
+
var infoText3 = {
|
|
427
|
+
color: "#333",
|
|
428
|
+
fontSize: "14px",
|
|
429
|
+
lineHeight: "24px",
|
|
430
|
+
margin: "4px 0"
|
|
431
|
+
};
|
|
432
|
+
var buttonContainer5 = {
|
|
433
|
+
padding: "24px"
|
|
434
|
+
};
|
|
435
|
+
var button5 = {
|
|
436
|
+
backgroundColor: "#5469d4",
|
|
437
|
+
borderRadius: "4px",
|
|
438
|
+
color: "#fff",
|
|
439
|
+
fontSize: "16px",
|
|
440
|
+
fontWeight: "bold",
|
|
441
|
+
textDecoration: "none",
|
|
442
|
+
textAlign: "center",
|
|
443
|
+
display: "block",
|
|
444
|
+
padding: "12px 20px"
|
|
445
|
+
};
|
|
446
|
+
var footer5 = {
|
|
447
|
+
color: "#8898aa",
|
|
448
|
+
fontSize: "14px",
|
|
449
|
+
lineHeight: "24px",
|
|
450
|
+
padding: "0 24px"
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
// src/email/index.ts
|
|
454
|
+
function getEmailProvider() {
|
|
455
|
+
const config = getConfig();
|
|
456
|
+
if (config.email.provider === "resend") {
|
|
457
|
+
return new ResendProvider(config.email.apiKey, config.email.from);
|
|
458
|
+
}
|
|
459
|
+
throw new Error(`Unsupported email provider: ${config.email.provider}`);
|
|
460
|
+
}
|
|
461
|
+
async function sendEmail(options) {
|
|
462
|
+
const provider = getEmailProvider();
|
|
463
|
+
return provider.sendEmail(options);
|
|
464
|
+
}
|
|
465
|
+
async function sendTemplateEmail(options) {
|
|
466
|
+
let component;
|
|
467
|
+
let subject;
|
|
468
|
+
switch (options.template) {
|
|
469
|
+
case "welcome":
|
|
470
|
+
component = welcome_default({
|
|
471
|
+
userName: options.data.userName,
|
|
472
|
+
actionUrl: options.data.actionUrl
|
|
473
|
+
});
|
|
474
|
+
subject = "Welcome!";
|
|
475
|
+
break;
|
|
476
|
+
case "reset-password":
|
|
477
|
+
component = reset_password_default({
|
|
478
|
+
userName: options.data.userName,
|
|
479
|
+
resetUrl: options.data.resetUrl
|
|
480
|
+
});
|
|
481
|
+
subject = "Reset Your Password";
|
|
482
|
+
break;
|
|
483
|
+
case "subscription-created":
|
|
484
|
+
component = subscription_created_default({
|
|
485
|
+
userName: options.data.userName,
|
|
486
|
+
planName: options.data.planName,
|
|
487
|
+
amount: options.data.amount,
|
|
488
|
+
dashboardUrl: options.data.dashboardUrl
|
|
489
|
+
});
|
|
490
|
+
subject = "Your Subscription is Active!";
|
|
491
|
+
break;
|
|
492
|
+
case "subscription-canceled":
|
|
493
|
+
component = subscription_canceled_default({
|
|
494
|
+
userName: options.data.userName,
|
|
495
|
+
planName: options.data.planName,
|
|
496
|
+
endDate: options.data.endDate,
|
|
497
|
+
feedbackUrl: options.data.feedbackUrl
|
|
498
|
+
});
|
|
499
|
+
subject = "Subscription Canceled";
|
|
500
|
+
break;
|
|
501
|
+
case "invoice":
|
|
502
|
+
component = invoice_default({
|
|
503
|
+
userName: options.data.userName,
|
|
504
|
+
invoiceNumber: options.data.invoiceNumber,
|
|
505
|
+
amount: options.data.amount,
|
|
506
|
+
date: options.data.date,
|
|
507
|
+
downloadUrl: options.data.downloadUrl
|
|
508
|
+
});
|
|
509
|
+
subject = `Invoice ${options.data.invoiceNumber || ""}`;
|
|
510
|
+
break;
|
|
511
|
+
default:
|
|
512
|
+
throw new Error(`Unknown template: ${options.template}`);
|
|
513
|
+
}
|
|
514
|
+
const html = await render(component);
|
|
515
|
+
const provider = getEmailProvider();
|
|
516
|
+
return provider.sendEmail({
|
|
517
|
+
to: options.to,
|
|
518
|
+
subject,
|
|
519
|
+
html
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export { sendEmail, sendTemplateEmail };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type EmailProvider = 'resend' | 'sendgrid' | 'postmark' | 'smtp';
|
|
2
|
+
type EmailConfig = {
|
|
3
|
+
provider: EmailProvider;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
from: string;
|
|
6
|
+
};
|
|
7
|
+
type EmailOptions = {
|
|
8
|
+
to: string | string[];
|
|
9
|
+
subject: string;
|
|
10
|
+
html: string;
|
|
11
|
+
text?: string;
|
|
12
|
+
};
|
|
13
|
+
type TemplateEmailOptions = {
|
|
14
|
+
to: string | string[];
|
|
15
|
+
template: 'welcome' | 'reset-password' | 'subscription-created' | 'subscription-canceled' | 'invoice';
|
|
16
|
+
data: Record<string, any>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type { EmailOptions as E, TemplateEmailOptions as T, EmailConfig as a, EmailProvider as b };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type EmailProvider = 'resend' | 'sendgrid' | 'postmark' | 'smtp';
|
|
2
|
+
type EmailConfig = {
|
|
3
|
+
provider: EmailProvider;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
from: string;
|
|
6
|
+
};
|
|
7
|
+
type EmailOptions = {
|
|
8
|
+
to: string | string[];
|
|
9
|
+
subject: string;
|
|
10
|
+
html: string;
|
|
11
|
+
text?: string;
|
|
12
|
+
};
|
|
13
|
+
type TemplateEmailOptions = {
|
|
14
|
+
to: string | string[];
|
|
15
|
+
template: 'welcome' | 'reset-password' | 'subscription-created' | 'subscription-canceled' | 'invoice';
|
|
16
|
+
data: Record<string, any>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type { EmailOptions as E, TemplateEmailOptions as T, EmailConfig as a, EmailProvider as b };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkE5YC2MHX_cjs = require('./chunk-E5YC2MHX.cjs');
|
|
4
|
+
var chunkBW4BLEIM_cjs = require('./chunk-BW4BLEIM.cjs');
|
|
5
|
+
require('./chunk-75ZPJI57.cjs');
|
|
6
|
+
|
|
7
|
+
// src/init.ts
|
|
8
|
+
function initMirageDev(config) {
|
|
9
|
+
const configWithDefaults = {
|
|
10
|
+
...config,
|
|
11
|
+
auth: {
|
|
12
|
+
...config.auth,
|
|
13
|
+
session: {
|
|
14
|
+
strategy: config.auth.session?.strategy || "jwt",
|
|
15
|
+
maxAge: config.auth.session?.maxAge || 30 * 24 * 60 * 60
|
|
16
|
+
// 30 days default
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
chunkE5YC2MHX_cjs.setConfig(configWithDefaults);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
Object.defineProperty(exports, "MirageDevError", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkBW4BLEIM_cjs.MirageDevError; }
|
|
26
|
+
});
|
|
27
|
+
exports.initMirageDev = initMirageDev;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { A as AuthConfig } from './auth-BC8JI28z.cjs';
|
|
2
|
+
export { a as AuthProvider, S as Session, b as SessionStrategy, U as User } from './auth-BC8JI28z.cjs';
|
|
3
|
+
import { B as BillingConfig } from './billing-Bv2V7KWF.cjs';
|
|
4
|
+
export { b as BillingProvider, C as CheckoutOptions, S as Subscription, a as SubscriptionStatus } from './billing-Bv2V7KWF.cjs';
|
|
5
|
+
import { a as EmailConfig } from './email-DZN1-bHa.cjs';
|
|
6
|
+
export { E as EmailOptions, b as EmailProvider, T as TemplateEmailOptions } from './email-DZN1-bHa.cjs';
|
|
7
|
+
|
|
8
|
+
type MirageDevConfig = {
|
|
9
|
+
auth: AuthConfig;
|
|
10
|
+
billing: BillingConfig;
|
|
11
|
+
email: EmailConfig;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare function initMirageDev(config: MirageDevConfig): void;
|
|
15
|
+
|
|
16
|
+
type ErrorCode = 'AUTH_REQUIRED' | 'AUTH_INVALID_CREDENTIALS' | 'AUTH_SESSION_EXPIRED' | 'BILLING_STRIPE_ERROR' | 'BILLING_SUBSCRIPTION_NOT_FOUND' | 'EMAIL_SEND_FAILED' | 'EMAIL_INVALID_ADDRESS' | 'CONFIG_INVALID' | 'CONFIG_MISSING_REQUIRED';
|
|
17
|
+
declare class MirageDevError extends Error {
|
|
18
|
+
readonly code: ErrorCode;
|
|
19
|
+
readonly details?: unknown;
|
|
20
|
+
constructor(code: ErrorCode, message: string, details?: unknown);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { AuthConfig, BillingConfig, EmailConfig, type ErrorCode, type MirageDevConfig, MirageDevError, initMirageDev };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { A as AuthConfig } from './auth-BC8JI28z.js';
|
|
2
|
+
export { a as AuthProvider, S as Session, b as SessionStrategy, U as User } from './auth-BC8JI28z.js';
|
|
3
|
+
import { B as BillingConfig } from './billing-Bv2V7KWF.js';
|
|
4
|
+
export { b as BillingProvider, C as CheckoutOptions, S as Subscription, a as SubscriptionStatus } from './billing-Bv2V7KWF.js';
|
|
5
|
+
import { a as EmailConfig } from './email-DZN1-bHa.js';
|
|
6
|
+
export { E as EmailOptions, b as EmailProvider, T as TemplateEmailOptions } from './email-DZN1-bHa.js';
|
|
7
|
+
|
|
8
|
+
type MirageDevConfig = {
|
|
9
|
+
auth: AuthConfig;
|
|
10
|
+
billing: BillingConfig;
|
|
11
|
+
email: EmailConfig;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare function initMirageDev(config: MirageDevConfig): void;
|
|
15
|
+
|
|
16
|
+
type ErrorCode = 'AUTH_REQUIRED' | 'AUTH_INVALID_CREDENTIALS' | 'AUTH_SESSION_EXPIRED' | 'BILLING_STRIPE_ERROR' | 'BILLING_SUBSCRIPTION_NOT_FOUND' | 'EMAIL_SEND_FAILED' | 'EMAIL_INVALID_ADDRESS' | 'CONFIG_INVALID' | 'CONFIG_MISSING_REQUIRED';
|
|
17
|
+
declare class MirageDevError extends Error {
|
|
18
|
+
readonly code: ErrorCode;
|
|
19
|
+
readonly details?: unknown;
|
|
20
|
+
constructor(code: ErrorCode, message: string, details?: unknown);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { AuthConfig, BillingConfig, EmailConfig, type ErrorCode, type MirageDevConfig, MirageDevError, initMirageDev };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { setConfig } from './chunk-5YXI4Q2K.js';
|
|
2
|
+
export { MirageDevError } from './chunk-JUTTFY3W.js';
|
|
3
|
+
import './chunk-MLKGABMK.js';
|
|
4
|
+
|
|
5
|
+
// src/init.ts
|
|
6
|
+
function initMirageDev(config) {
|
|
7
|
+
const configWithDefaults = {
|
|
8
|
+
...config,
|
|
9
|
+
auth: {
|
|
10
|
+
...config.auth,
|
|
11
|
+
session: {
|
|
12
|
+
strategy: config.auth.session?.strategy || "jwt",
|
|
13
|
+
maxAge: config.auth.session?.maxAge || 30 * 24 * 60 * 60
|
|
14
|
+
// 30 days default
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
setConfig(configWithDefaults);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { initMirageDev };
|