@stacksjs/notifications 0.49.1 → 0.49.2
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/dist/index.cjs +58 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.mjs +37 -0
- package/package.json +11 -11
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const errorHandling = require('@stacksjs/error-handling');
|
|
4
|
+
const config = require('@stacksjs/config');
|
|
5
|
+
const email = require('@stacksjs/email');
|
|
6
|
+
const chat = require('@stacksjs/chat');
|
|
7
|
+
const sms = require('@stacksjs/sms');
|
|
8
|
+
|
|
9
|
+
function _interopNamespaceDefault(e) {
|
|
10
|
+
const n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
for (const k in e) {
|
|
13
|
+
n[k] = e[k];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
n.default = e;
|
|
17
|
+
return n;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const email__namespace = /*#__PURE__*/_interopNamespaceDefault(email);
|
|
21
|
+
const chat__namespace = /*#__PURE__*/_interopNamespaceDefault(chat);
|
|
22
|
+
const sms__namespace = /*#__PURE__*/_interopNamespaceDefault(sms);
|
|
23
|
+
|
|
24
|
+
const useChat = (driver = "slack") => {
|
|
25
|
+
return chat__namespace[driver];
|
|
26
|
+
};
|
|
27
|
+
const useEmail = (driver = "sendgrid") => {
|
|
28
|
+
return email__namespace[driver];
|
|
29
|
+
};
|
|
30
|
+
const useSMS = (driver = "twilio") => {
|
|
31
|
+
return sms__namespace[driver];
|
|
32
|
+
};
|
|
33
|
+
function useNotification(typeParam = "email", driverParam = "sendgrid") {
|
|
34
|
+
const type = typeParam || config.notification.type;
|
|
35
|
+
const driver = driverParam || config.notification.driver;
|
|
36
|
+
switch (type) {
|
|
37
|
+
case "email":
|
|
38
|
+
return useEmail(driver);
|
|
39
|
+
case "chat":
|
|
40
|
+
return useChat(driver);
|
|
41
|
+
case "sms":
|
|
42
|
+
return useSMS(driver);
|
|
43
|
+
default:
|
|
44
|
+
return errorHandling.err(`Type ${type} not supported`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function notification() {
|
|
48
|
+
return useNotification();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
exports.email = email__namespace;
|
|
52
|
+
exports.chat = chat__namespace;
|
|
53
|
+
exports.sms = sms__namespace;
|
|
54
|
+
exports.notification = notification;
|
|
55
|
+
exports.useChat = useChat;
|
|
56
|
+
exports.useEmail = useEmail;
|
|
57
|
+
exports.useNotification = useNotification;
|
|
58
|
+
exports.useSMS = useSMS;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as email from '@stacksjs/email';
|
|
2
|
+
export { email };
|
|
3
|
+
import * as chat from '@stacksjs/chat';
|
|
4
|
+
export { chat };
|
|
5
|
+
import * as sms from '@stacksjs/sms';
|
|
6
|
+
export { sms };
|
|
7
|
+
|
|
8
|
+
declare const useChat: (driver?: string) => typeof chat.slack | typeof chat.discord;
|
|
9
|
+
declare const useEmail: (driver?: string) => typeof email.sendgrid | typeof email.mailgun | typeof email.mailjet | typeof email.mandrill | typeof email.netcore | typeof email.nodemailer | typeof email.postmark | typeof email.ses | typeof email.emailjs;
|
|
10
|
+
declare const useSMS: (driver?: string) => typeof sms.twilio | typeof sms.plivo | typeof sms.nexmo | typeof sms.sms77 | typeof sms.sns | typeof sms.gupshup | typeof sms.telnyx | typeof sms.termii;
|
|
11
|
+
declare function useNotification(typeParam?: string, driverParam?: string): any;
|
|
12
|
+
declare function notification(): any;
|
|
13
|
+
|
|
14
|
+
export { notification, useChat, useEmail, useNotification, useSMS };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { err } from '@stacksjs/error-handling';
|
|
2
|
+
import { notification as notification$1 } from '@stacksjs/config';
|
|
3
|
+
import * as email from '@stacksjs/email';
|
|
4
|
+
export { email };
|
|
5
|
+
import * as chat from '@stacksjs/chat';
|
|
6
|
+
export { chat };
|
|
7
|
+
import * as sms from '@stacksjs/sms';
|
|
8
|
+
export { sms };
|
|
9
|
+
|
|
10
|
+
const useChat = (driver = "slack") => {
|
|
11
|
+
return chat[driver];
|
|
12
|
+
};
|
|
13
|
+
const useEmail = (driver = "sendgrid") => {
|
|
14
|
+
return email[driver];
|
|
15
|
+
};
|
|
16
|
+
const useSMS = (driver = "twilio") => {
|
|
17
|
+
return sms[driver];
|
|
18
|
+
};
|
|
19
|
+
function useNotification(typeParam = "email", driverParam = "sendgrid") {
|
|
20
|
+
const type = typeParam || notification$1.type;
|
|
21
|
+
const driver = driverParam || notification$1.driver;
|
|
22
|
+
switch (type) {
|
|
23
|
+
case "email":
|
|
24
|
+
return useEmail(driver);
|
|
25
|
+
case "chat":
|
|
26
|
+
return useChat(driver);
|
|
27
|
+
case "sms":
|
|
28
|
+
return useSMS(driver);
|
|
29
|
+
default:
|
|
30
|
+
return err(`Type ${type} not supported`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function notification() {
|
|
34
|
+
return useNotification();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { notification, useChat, useEmail, useNotification, useSMS };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/notifications",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.2",
|
|
5
5
|
"packageManager": "pnpm@7.25.0",
|
|
6
6
|
"description": "The Stacks notifications integration.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"pnpm": ">=7.25.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@maizzle/framework": "
|
|
49
|
+
"@maizzle/framework": "^4.3.1",
|
|
50
50
|
"@novu/discord": "^0.10.2",
|
|
51
51
|
"@novu/emailjs": "^0.10.2",
|
|
52
52
|
"@novu/gupshup": "^0.10.2",
|
|
@@ -68,20 +68,20 @@
|
|
|
68
68
|
"@novu/telnyx": "^0.10.2",
|
|
69
69
|
"@novu/termii": "^0.10.2",
|
|
70
70
|
"@novu/twilio": "^0.10.2",
|
|
71
|
-
"@stacksjs/chat": "0.49.
|
|
72
|
-
"@stacksjs/cli": "0.49.
|
|
73
|
-
"@stacksjs/config": "0.49.
|
|
74
|
-
"@stacksjs/email": "0.49.
|
|
75
|
-
"@stacksjs/error-handling": "0.49.
|
|
76
|
-
"@stacksjs/push": "0.49.
|
|
77
|
-
"@stacksjs/sms": "0.49.
|
|
78
|
-
"@stacksjs/types": "0.49.
|
|
71
|
+
"@stacksjs/chat": "0.49.2",
|
|
72
|
+
"@stacksjs/cli": "0.49.2",
|
|
73
|
+
"@stacksjs/config": "0.49.2",
|
|
74
|
+
"@stacksjs/email": "0.49.2",
|
|
75
|
+
"@stacksjs/error-handling": "0.49.2",
|
|
76
|
+
"@stacksjs/push": "0.49.2",
|
|
77
|
+
"@stacksjs/sms": "0.49.2",
|
|
78
|
+
"@stacksjs/types": "0.49.2"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"mkdist": "^1.1.0",
|
|
82
82
|
"typescript": "^4.9.4",
|
|
83
83
|
"unbuild": "^1.1.1",
|
|
84
|
-
"@stacksjs/testing": "0.49.
|
|
84
|
+
"@stacksjs/testing": "0.49.2"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build": "unbuild",
|