@stacksjs/notifications 0.58.47 → 0.58.49

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/notifications",
3
3
  "type": "module",
4
- "version": "0.58.47",
4
+ "version": "0.58.49",
5
5
  "description": "The Stacks notifications integration.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -46,7 +46,8 @@
46
46
  ],
47
47
  "files": [
48
48
  "README.md",
49
- "dist"
49
+ "dist",
50
+ "src"
50
51
  ],
51
52
  "scripts": {
52
53
  "build": "bun --bun build.ts",
@@ -54,14 +55,14 @@
54
55
  "prepublishOnly": "bun --bun run build"
55
56
  },
56
57
  "peerDependencies": {
57
- "@stacksjs/chat": "workspace:*",
58
- "@stacksjs/cli": "workspace:*",
59
- "@stacksjs/config": "workspace:*",
60
- "@stacksjs/email": "workspace:*",
61
- "@stacksjs/error-handling": "workspace:*",
62
- "@stacksjs/push": "workspace:*",
63
- "@stacksjs/sms": "workspace:*",
64
- "@stacksjs/types": "workspace:*"
58
+ "@stacksjs/chat": "latest",
59
+ "@stacksjs/cli": "latest",
60
+ "@stacksjs/config": "latest",
61
+ "@stacksjs/email": "latest",
62
+ "@stacksjs/error-handling": "latest",
63
+ "@stacksjs/push": "latest",
64
+ "@stacksjs/sms": "latest",
65
+ "@stacksjs/types": "latest"
65
66
  },
66
67
  "dependencies": {
67
68
  "@maizzle/framework": "^4.7.4",
@@ -98,6 +99,6 @@
98
99
  "@novu/twilio": "^0.22.0"
99
100
  },
100
101
  "devDependencies": {
101
- "@stacksjs/development": "workspace:*"
102
+ "@stacksjs/development": "latest"
102
103
  }
103
104
  }
@@ -0,0 +1 @@
1
+ export * as chat from '@stacksjs/chat'
@@ -0,0 +1 @@
1
+ export * as email from '@stacksjs/email'
@@ -0,0 +1,4 @@
1
+ export * from './chat'
2
+ export * from './email'
3
+ export * from './push'
4
+ export * from './sms'
@@ -0,0 +1 @@
1
+ export * as push from '@stacksjs/push'
@@ -0,0 +1 @@
1
+ export * as sms from '@stacksjs/sms'
package/src/index.ts ADDED
@@ -0,0 +1,51 @@
1
+ import process from 'node:process'
2
+ import { err } from '@stacksjs/error-handling'
3
+ import { notification as config } from '@stacksjs/config'
4
+ import { log } from '@stacksjs/cli'
5
+ import { ExitCode } from '@stacksjs/types'
6
+ import { chat, email, sms } from './drivers'
7
+
8
+ function useChat(driver = 'slack') {
9
+ return chat[driver as keyof typeof chat]
10
+ }
11
+
12
+ function useEmail(driver = 'mailtrap') {
13
+ return email[driver as keyof typeof email]
14
+ }
15
+
16
+ function useSMS(driver = 'twilio') {
17
+ return sms[driver as keyof typeof sms]
18
+ }
19
+
20
+ function useNotification(typeParam = 'email', driverParam = 'mailtrap') {
21
+ if (!config.default) {
22
+ log.error('No default notification type set in config/notification.ts')
23
+ return process.exit(ExitCode.InvalidArgument)
24
+ }
25
+
26
+ const type = typeParam || config.default
27
+ const driver = driverParam || config.default
28
+
29
+ switch (type) {
30
+ case 'email':
31
+ return useEmail(driver)
32
+ case 'chat':
33
+ return useChat(driver)
34
+ case 'sms':
35
+ return useSMS(driver)
36
+ default:
37
+ return err(`Type ${type} not supported`)
38
+ }
39
+ }
40
+
41
+ function notification() {
42
+ return useNotification()
43
+ }
44
+
45
+ export {
46
+ useEmail,
47
+ useChat,
48
+ useSMS,
49
+ useNotification,
50
+ notification,
51
+ }
@@ -0,0 +1,39 @@
1
+ // import notification from '~/config/notification'
2
+
3
+ // const email = notification.email
4
+
5
+ export default {
6
+ // ...email.build,
7
+ theme: {
8
+ screens: {
9
+ sm: '480px',
10
+ md: '768px',
11
+ lg: '976px',
12
+ xl: '1440px',
13
+ },
14
+ colors: {
15
+ 'blue': '#1fb6ff',
16
+ 'purple': '#7e5bef',
17
+ 'pink': '#ff49db',
18
+ 'orange': '#ff7849',
19
+ 'green': '#13ce66',
20
+ 'yellow': '#ffc82c',
21
+ 'gray-dark': '#273444',
22
+ 'gray': '#8492a6',
23
+ 'gray-light': '#d3dce6',
24
+ },
25
+ fontFamily: {
26
+ sans: ['Graphik', 'sans-serif'],
27
+ serif: ['Merriweather', 'serif'],
28
+ },
29
+ extend: {
30
+ spacing: {
31
+ 128: '32rem',
32
+ 144: '36rem',
33
+ },
34
+ borderRadius: {
35
+ '4xl': '2rem',
36
+ },
37
+ },
38
+ },
39
+ }
@@ -0,0 +1,5 @@
1
+ // import notification from '~/config/notification'
2
+
3
+ export default {
4
+ purgeCSS: {},
5
+ }
@@ -0,0 +1,8 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ </head>
5
+ <body>
6
+ Testing...
7
+ <block name="template"></block>
8
+ </body>