@cowliss/cli 0.7.0 → 0.8.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/dist/guest/{driver-C1bsCjZT.js → driver-BXuYP007.js} +1 -1
- package/dist/guest/driver.d.ts +1 -1
- package/dist/guest/driver.js +1 -1
- package/dist/guest/{index-3PMqJKmc.d.ts → index-EqBCZnpq.d.ts} +11 -12
- package/dist/guest/{journeys-Dpsp225V.js → journeys-F8Yk8s1P.js} +93 -45
- package/dist/guest/journeys.d.ts +13 -8
- package/dist/guest/journeys.js +1 -1
- package/dist/guest/wasi.js +1 -1
- package/dist/index.js +527 -349
- package/package.json +1 -1
- package/examples/cross-app-pitch/emails/cross-app-pitch.tsx +0 -77
- package/examples/cross-app-pitch/journeys/cross-app-pitch.ts +0 -39
- package/examples/cross-app-pitch/scenarios/cross-app-pitch.json +0 -17
package/package.json
CHANGED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { SendClass, Subject } from "@cowliss/cli/emails";
|
|
2
|
-
import {
|
|
3
|
-
Body,
|
|
4
|
-
Container,
|
|
5
|
-
Head,
|
|
6
|
-
Heading,
|
|
7
|
-
Html,
|
|
8
|
-
Preview,
|
|
9
|
-
Text,
|
|
10
|
-
} from "@react-email/components";
|
|
11
|
-
import type { CSSProperties, ReactElement } from "react";
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The cross-app-pitch example's one email: someone upgraded in one of your
|
|
16
|
-
* apps, and a day later the other app is worth a mention. The plan name is a
|
|
17
|
-
* prop rather than a hardcoded string, so the same email serves every tier
|
|
18
|
-
* you pitch.
|
|
19
|
-
*
|
|
20
|
-
* Inline styles only, because email clients strip Tailwind and external
|
|
21
|
-
* stylesheets alike. One-click unsubscribe rides in the RFC 8058 headers the
|
|
22
|
-
* send path attaches, not in the body.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
export const props = z.object({
|
|
26
|
-
plan: z.string(),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export const subject: Subject<typeof props> = (p) =>
|
|
30
|
-
`Your ${p.plan} plan works in our other app too`;
|
|
31
|
-
|
|
32
|
-
export const sendClass: SendClass = "marketing";
|
|
33
|
-
|
|
34
|
-
export const tags = ["demo", "cross-app"];
|
|
35
|
-
|
|
36
|
-
const body: CSSProperties = {
|
|
37
|
-
backgroundColor: "#f6f6f6",
|
|
38
|
-
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const container: CSSProperties = {
|
|
42
|
-
margin: "0 auto",
|
|
43
|
-
padding: "32px 24px",
|
|
44
|
-
maxWidth: "480px",
|
|
45
|
-
backgroundColor: "#ffffff",
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const heading: CSSProperties = {
|
|
49
|
-
fontSize: "20px",
|
|
50
|
-
fontWeight: 600,
|
|
51
|
-
color: "#111111",
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const text: CSSProperties = {
|
|
55
|
-
fontSize: "14px",
|
|
56
|
-
lineHeight: "22px",
|
|
57
|
-
color: "#333333",
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export default function CrossAppPitch(p: z.infer<typeof props>): ReactElement {
|
|
61
|
-
return (
|
|
62
|
-
<Html>
|
|
63
|
-
<Head />
|
|
64
|
-
<Preview>One upgrade, two apps</Preview>
|
|
65
|
-
<Body style={body}>
|
|
66
|
-
<Container style={container}>
|
|
67
|
-
<Heading style={heading}>One upgrade, two apps</Heading>
|
|
68
|
-
<Text style={text}>
|
|
69
|
-
Thanks for going {p.plan}. The same account already works in our
|
|
70
|
-
other app, so there is nothing to sign up for: open it and your plan
|
|
71
|
-
follows you.
|
|
72
|
-
</Text>
|
|
73
|
-
</Container>
|
|
74
|
-
</Body>
|
|
75
|
-
</Html>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { defineJourney } from "@cowliss/cli/journeys";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Cross-app pitch: `plan_upgraded` from one app (the trigger's `appId` field
|
|
5
|
-
* scopes a journey to one app of a multi-app org) starts the execution; after
|
|
6
|
-
* a durable day it re-reads the profile and pitches the other app only to
|
|
7
|
-
* users still on the free plan. This is the portfolio-operator pattern: one
|
|
8
|
-
* org's journeys reacting across its own apps.
|
|
9
|
-
*
|
|
10
|
-
* `marketing` and no `enrollment`: one pitch per person, however often they
|
|
11
|
-
* change plan. A pitch is worth making once.
|
|
12
|
-
*
|
|
13
|
-
* Example: add it with `cow add example cross-app-pitch`; rename the app id,
|
|
14
|
-
* the event, and the email to your own.
|
|
15
|
-
*/
|
|
16
|
-
export default defineJourney({
|
|
17
|
-
trigger: { event: "plan_upgraded", appId: "app_b" },
|
|
18
|
-
purpose: "marketing",
|
|
19
|
-
description:
|
|
20
|
-
"Tells someone who just upgraded about the other product they can use.",
|
|
21
|
-
// An address of its own rather than the shared one: a pitch for your other
|
|
22
|
-
// product reads better from a product address than from the one your
|
|
23
|
-
// receipts come from. Verify its domain under Settings, Domains first.
|
|
24
|
-
from: "Product News <product-news@example.com>",
|
|
25
|
-
tags: ["demo", "cross-app"],
|
|
26
|
-
run: async (_event, api) => {
|
|
27
|
-
await api.sleep("1d");
|
|
28
|
-
// A fresh read, not a snapshot taken at the trigger: the plan may well
|
|
29
|
-
// have changed during the wait, which is the whole point of waiting.
|
|
30
|
-
const me = await api.profile.get();
|
|
31
|
-
if (me.traits.plan !== "free") {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
await api.send.email({
|
|
35
|
-
template: "cross-app-pitch",
|
|
36
|
-
props: { plan: "pro" },
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user": {
|
|
3
|
-
"id": "usr_1",
|
|
4
|
-
"traits": { "email": "ada@example.com", "plan": "free" }
|
|
5
|
-
},
|
|
6
|
-
"events": [],
|
|
7
|
-
"expect": [
|
|
8
|
-
{
|
|
9
|
-
"activity": "sendEmail",
|
|
10
|
-
"input": {
|
|
11
|
-
"template": "cross-app-pitch",
|
|
12
|
-
"props": { "plan": "pro" },
|
|
13
|
-
"from": "Product News <product-news@example.com>"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
}
|