@shware/workflow-ui 1.0.1 → 2.0.1
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/README.md +10 -8
- package/dist/cli.mjs +12 -11
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +3 -6
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs.map +1 -1
- package/dist/index.d.mts +4 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +50 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/app/email-preview.ts +26 -5
- package/src/app/integrations/theme/root-provider.tsx +24 -12
- package/src/app/locales/en-US/common.ts +5 -2
- package/src/app/locales/zh-CN/common.ts +5 -2
- package/src/app/routes/emails.tsx +2 -2
- package/src/app/routes/settings.tsx +4 -1
- package/src/app/routes/workflows.tsx +1 -1
- package/src/components/date-range.tsx +10 -2
- package/src/components/dropdown/index.tsx +10 -2
- package/src/components/email-defaults.tsx +15 -7
- package/src/components/flag.tsx +10 -7
- package/src/components/menu/index.tsx +10 -2
- package/src/components/modal/index.tsx +2 -1
- package/src/components/profile-drawer.tsx +29 -15
- package/src/components/slack-preview.tsx +33 -30
- package/src/components/templates-page.tsx +23 -10
- package/src/config.ts +3 -2
- package/src/server/project.ts +7 -13
- package/src/server.ts +4 -2
package/src/server/project.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfigCompileError,
|
|
3
|
-
type EmailAddress,
|
|
4
3
|
type JourneyConfig,
|
|
5
4
|
compileConfig,
|
|
6
|
-
formatEmailAddress,
|
|
7
5
|
isConfig,
|
|
8
6
|
isDiscordTemplate,
|
|
9
7
|
isEmailTemplate,
|
|
@@ -18,7 +16,7 @@ import type { ResolvedStudioConfig, StudioError } from '../config';
|
|
|
18
16
|
*
|
|
19
17
|
* workflow.config.ts default-exports `defineConfig({...})` from
|
|
20
18
|
* `@shware/workflow`, and the studio reads exactly that: its workflows,
|
|
21
|
-
* segments, actions, template registries, title and email
|
|
19
|
+
* segments, actions, template registries, title and what the email templates share. It is
|
|
22
20
|
* compiled with `compileConfig`, the same compile the Worker deploys, so the
|
|
23
21
|
* studio lists exactly what would ship.
|
|
24
22
|
*
|
|
@@ -139,17 +137,13 @@ function errorOf(error: unknown): StudioError {
|
|
|
139
137
|
};
|
|
140
138
|
}
|
|
141
139
|
|
|
142
|
-
function formatted(address: EmailAddress | undefined): string | undefined {
|
|
143
|
-
return address === undefined ? undefined : formatEmailAddress(address);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
140
|
function failed(error: unknown, title?: string): StudioSnapshot {
|
|
147
141
|
return {
|
|
148
142
|
payload: {
|
|
149
143
|
...(title !== undefined ? { title } : {}),
|
|
150
144
|
workflows: {},
|
|
151
145
|
segments: [],
|
|
152
|
-
|
|
146
|
+
email: {},
|
|
153
147
|
error: errorOf(error),
|
|
154
148
|
},
|
|
155
149
|
registries: { email: undefined, push: undefined, discord: undefined, slack: undefined },
|
|
@@ -188,13 +182,13 @@ export async function loadSnapshot(options: {
|
|
|
188
182
|
return failed(error);
|
|
189
183
|
}
|
|
190
184
|
|
|
191
|
-
const
|
|
192
|
-
const
|
|
185
|
+
const unsubscribeUrl = config.email?.unsubscribeUrl;
|
|
186
|
+
const quickClickMs = config.email?.tracking?.quickClickMs;
|
|
193
187
|
const shared = {
|
|
194
188
|
...(config.title !== undefined ? { title: config.title } : {}),
|
|
195
|
-
|
|
196
|
-
...(
|
|
197
|
-
...(
|
|
189
|
+
email: {
|
|
190
|
+
...(unsubscribeUrl !== undefined ? { unsubscribeUrl } : {}),
|
|
191
|
+
...(quickClickMs !== undefined ? { tracking: { quickClickMs } } : {}),
|
|
198
192
|
},
|
|
199
193
|
};
|
|
200
194
|
|
package/src/server.ts
CHANGED
|
@@ -476,8 +476,10 @@ export async function startStudio(options: StartOptions = {}): Promise<ViteDevSe
|
|
|
476
476
|
],
|
|
477
477
|
},
|
|
478
478
|
},
|
|
479
|
-
// The app and the user's project each have their own react; one copy only
|
|
480
|
-
|
|
479
|
+
// The app and the user's project each have their own react; one copy only. One
|
|
480
|
+
// @shware/workflow too: the preview's <EmailProvider> and the project's layout calling
|
|
481
|
+
// useEmailContext() must share the context object
|
|
482
|
+
resolve: { dedupe: ['react', 'react-dom', '@shware/workflow'] },
|
|
481
483
|
/*
|
|
482
484
|
* @react-email/render imports react-dom/server lazily, so the dep scan never
|
|
483
485
|
* sees it: the first email preview made Vite discover it, re-optimize and
|