@gravito/satellite-membership 0.1.7 → 0.1.8
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/CHANGELOG.md +12 -0
- package/package.json +4 -2
- package/src/manifest.json +4 -10
- package/tests/{email-integration.test.ts → email-integration.integration.test.ts} +5 -5
- package/tsconfig.json +12 -24
- package/views/emails/level_changed.html +0 -35
- package/views/emails/reset_password.html +0 -34
- package/views/emails/welcome.html +0 -31
- /package/tests/{integration.test.ts → integration.integration.test.ts} +0 -0
- /package/tests/{update-settings.test.ts → update-settings.integration.test.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @gravito/satellite-membership
|
|
2
2
|
|
|
3
|
+
## 0.1.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @gravito/core@1.6.1
|
|
9
|
+
- @gravito/cosmos@3.2.1
|
|
10
|
+
- @gravito/enterprise@1.0.4
|
|
11
|
+
- @gravito/sentinel@4.0.1
|
|
12
|
+
- @gravito/signal@3.0.4
|
|
13
|
+
- @gravito/stasis@3.1.1
|
|
14
|
+
|
|
3
15
|
## 0.1.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravito/satellite-membership",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsup src/index.ts --format esm --dts --clean --external @gravito/atlas --external @gravito/cosmos --external @gravito/enterprise --external @gravito/sentinel --external @gravito/signal --external @gravito/stasis --external @simplewebauthn/server --external @gravito/core",
|
|
10
10
|
"test": "bun test",
|
|
11
|
-
"typecheck": "bun tsc -p tsconfig.json --noEmit --skipLibCheck"
|
|
11
|
+
"typecheck": "bun tsc -p tsconfig.json --noEmit --skipLibCheck",
|
|
12
|
+
"test:unit": "bun test",
|
|
13
|
+
"test:integration": "bun test"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|
|
14
16
|
"@gravito/atlas": "workspace:*",
|
package/src/manifest.json
CHANGED
|
@@ -3,13 +3,7 @@
|
|
|
3
3
|
"id": "membership",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"description": "A Gravito Satellite",
|
|
6
|
-
"capabilities": [
|
|
7
|
-
|
|
8
|
-
]
|
|
9
|
-
|
|
10
|
-
"cache"
|
|
11
|
-
],
|
|
12
|
-
"hooks": [
|
|
13
|
-
"membership:created"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
6
|
+
"capabilities": ["create-membership"],
|
|
7
|
+
"requirements": ["cache"],
|
|
8
|
+
"hooks": ["membership:created"]
|
|
9
|
+
}
|
|
@@ -98,7 +98,7 @@ describe('Membership Email Integration', () => {
|
|
|
98
98
|
passwordPlain: 'password',
|
|
99
99
|
})
|
|
100
100
|
|
|
101
|
-
const messages = mailbox.list()
|
|
101
|
+
const messages = await mailbox.list()
|
|
102
102
|
expect(messages.length).toBe(1)
|
|
103
103
|
expect(messages[0].envelope.subject).toBe('membership.emails.welcome_subject')
|
|
104
104
|
// 驗證是否包含 CSS 樣式標籤 (代表模板已渲染)
|
|
@@ -117,7 +117,7 @@ describe('Membership Email Integration', () => {
|
|
|
117
117
|
)
|
|
118
118
|
})
|
|
119
119
|
|
|
120
|
-
mailbox.clear()
|
|
120
|
+
await mailbox.clear()
|
|
121
121
|
|
|
122
122
|
// 2. 模擬觸發 Hook
|
|
123
123
|
await mockCore.hooks.doAction('membership:send-reset-password', {
|
|
@@ -125,7 +125,7 @@ describe('Membership Email Integration', () => {
|
|
|
125
125
|
token: 'secret-token',
|
|
126
126
|
})
|
|
127
127
|
|
|
128
|
-
const messages = mailbox.list()
|
|
128
|
+
const messages = await mailbox.list()
|
|
129
129
|
expect(messages.length).toBe(1)
|
|
130
130
|
expect(messages[0].envelope.subject).toBe('membership.emails.reset_password_subject')
|
|
131
131
|
expect(messages[0].html).toContain('secret-token')
|
|
@@ -143,7 +143,7 @@ describe('Membership Email Integration', () => {
|
|
|
143
143
|
)
|
|
144
144
|
})
|
|
145
145
|
|
|
146
|
-
mailbox.clear()
|
|
146
|
+
await mailbox.clear()
|
|
147
147
|
|
|
148
148
|
await mockCore.hooks.doAction('membership:level-changed', {
|
|
149
149
|
email: 'vip@example.com',
|
|
@@ -151,7 +151,7 @@ describe('Membership Email Integration', () => {
|
|
|
151
151
|
newLevel: 'Gold',
|
|
152
152
|
})
|
|
153
153
|
|
|
154
|
-
const messages = mailbox.list()
|
|
154
|
+
const messages = await mailbox.list()
|
|
155
155
|
expect(messages.length).toBe(1)
|
|
156
156
|
expect(messages[0].envelope.subject).toBe('membership.emails.level_changed_subject')
|
|
157
157
|
expect(messages[0].html).toContain('Silver')
|
package/tsconfig.json
CHANGED
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
],
|
|
10
|
-
"@gravito/*": [
|
|
11
|
-
"../../packages/*/src/index.ts"
|
|
12
|
-
]
|
|
13
|
-
},
|
|
14
|
-
"types": [
|
|
15
|
-
"bun-types"
|
|
16
|
-
]
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@gravito/core": ["../../packages/core/src/index.ts"],
|
|
8
|
+
"@gravito/*": ["../../packages/*/src/index.ts"]
|
|
17
9
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"dist",
|
|
24
|
-
"**/*.test.ts"
|
|
25
|
-
]
|
|
26
|
-
}
|
|
10
|
+
"types": ["bun-types"]
|
|
11
|
+
},
|
|
12
|
+
"include": ["src/**/*"],
|
|
13
|
+
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
|
14
|
+
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="zh-TW">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<style>
|
|
7
|
-
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; line-height: 1.6; color: #1a1a1a; margin: 0; padding: 0; background-color: #f9fafb; }
|
|
8
|
-
.container { max-width: 600px; margin: 40px auto; padding: 32px; background: #ffffff; border-radius: 12px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); border-top: 8px solid {{ branding.color }}; }
|
|
9
|
-
.logo { font-size: 24px; font-weight: 800; color: {{ branding.color }}; margin-bottom: 24px; text-align: center; }
|
|
10
|
-
.badge { display: inline-block; padding: 4px 12px; background: #fef3c7; color: #92400e; border-radius: 9999px; font-size: 14px; font-weight: 600; margin-bottom: 16px; }
|
|
11
|
-
h1 { font-size: 24px; font-weight: 700; color: #111827; margin-bottom: 16px; text-align: center; }
|
|
12
|
-
p { margin-bottom: 24px; color: #4b5563; text-align: center; }
|
|
13
|
-
.level-up { font-size: 32px; margin: 24px 0; text-align: center; }
|
|
14
|
-
.footer { margin-top: 32px; font-size: 14px; color: #9ca3af; text-align: center; }
|
|
15
|
-
</style>
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
<div class="container">
|
|
19
|
-
<div class="logo">{{ branding.name }}</div>
|
|
20
|
-
<div style="text-align: center;"><span class="badge">{{ lang.badge_text }}</span></div>
|
|
21
|
-
<h1>{{ lang.title }}</h1>
|
|
22
|
-
<p>{{ lang.body }}</p>
|
|
23
|
-
|
|
24
|
-
<div class="level-up">
|
|
25
|
-
<span style="color: #9ca3af; text-decoration: line-through; font-size: 20px;">{{ oldLevel }}</span>
|
|
26
|
-
<span style="margin: 0 16px;">→</span>
|
|
27
|
-
<span style="color: {{ branding.color }}; font-weight: 800;">{{ newLevel }}</span>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<div class="footer">
|
|
31
|
-
© {{ currentYear }} {{ branding.name }}. All rights reserved.
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</body>
|
|
35
|
-
</html>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="zh-TW">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<style>
|
|
7
|
-
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; line-height: 1.6; color: #1a1a1a; margin: 0; padding: 0; background-color: #f9fafb; }
|
|
8
|
-
.container { max-width: 600px; margin: 40px auto; padding: 32px; background: #ffffff; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
|
|
9
|
-
.logo { font-size: 24px; font-weight: 800; color: {{ branding.color }}; margin-bottom: 24px; text-align: center; }
|
|
10
|
-
h1 { font-size: 24px; font-weight: 700; color: #111827; margin-bottom: 16px; text-align: center; }
|
|
11
|
-
p { margin-bottom: 24px; color: #4b5563; text-align: center; }
|
|
12
|
-
.btn { display: block; width: fit-content; margin: 0 auto; padding: 12px 24px; background-color: {{ branding.color }}; color: #ffffff !important; text-decoration: none; border-radius: 8px; font-weight: 600; transition: background-color 0.2s; }
|
|
13
|
-
.footer { margin-top: 32px; font-size: 14px; color: #9ca3af; text-align: center; }
|
|
14
|
-
.warning { font-size: 12px; color: #9ca3af; margin-top: 24px; text-align: center; }
|
|
15
|
-
</style>
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
<div class="container">
|
|
19
|
-
<div class="logo">{{ branding.name }}</div>
|
|
20
|
-
<h1>{{ lang.reset_password_title }}</h1>
|
|
21
|
-
<p>{{ lang.reset_password_body }}</p>
|
|
22
|
-
|
|
23
|
-
<a href="{{ resetUrl }}" class="btn">
|
|
24
|
-
{{ lang.reset_password_button }}
|
|
25
|
-
</a>
|
|
26
|
-
|
|
27
|
-
<p class="warning">{{ lang.reset_password_warning }}</p>
|
|
28
|
-
|
|
29
|
-
<div class="footer">
|
|
30
|
-
© {{ currentYear }} {{ branding.name }}. All rights reserved.
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
</body>
|
|
34
|
-
</html>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="zh-TW">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<style>
|
|
7
|
-
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; line-height: 1.6; color: #1a1a1a; margin: 0; padding: 0; background-color: #f9fafb; }
|
|
8
|
-
.container { max-width: 600px; margin: 40px auto; padding: 32px; background: #ffffff; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
|
|
9
|
-
.logo { font-size: 24px; font-weight: 800; color: {{ branding.color }}; margin-bottom: 24px; text-align: center; }
|
|
10
|
-
h1 { font-size: 24px; font-weight: 700; color: #111827; margin-bottom: 16px; text-align: center; }
|
|
11
|
-
p { margin-bottom: 24px; color: #4b5563; text-align: center; }
|
|
12
|
-
.btn { display: block; width: fit-content; margin: 0 auto; padding: 12px 24px; background-color: {{ branding.color }}; color: #ffffff !important; text-decoration: none; border-radius: 8px; font-weight: 600; transition: background-color 0.2s; }
|
|
13
|
-
.footer { margin-top: 32px; font-size: 14px; color: #9ca3af; text-align: center; }
|
|
14
|
-
</style>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<div class="container">
|
|
18
|
-
<div class="logo">{{ branding.name }}</div>
|
|
19
|
-
<h1>{{ lang.welcome_title }}</h1>
|
|
20
|
-
<p>{{ lang.welcome_body }}</p>
|
|
21
|
-
|
|
22
|
-
<a href="{{ verificationUrl }}" class="btn">
|
|
23
|
-
{{ lang.verify_button }}
|
|
24
|
-
</a>
|
|
25
|
-
|
|
26
|
-
<div class="footer">
|
|
27
|
-
© {{ currentYear }} {{ branding.name }}. All rights reserved.
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</body>
|
|
31
|
-
</html>
|
|
File without changes
|
|
File without changes
|