@cowliss/cli 0.3.0 → 0.5.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/README.md +16 -9
- package/dist/guest/{driver-M6LQVMr2.js → driver-14FnzM-h.js} +18 -15
- package/dist/guest/driver.d.ts +1 -1
- package/dist/guest/driver.js +1 -1
- package/dist/guest/emails.d.ts +18 -1
- package/dist/guest/{index-heC1gFE_.d.ts → index-BDj02EsQ.d.ts} +12 -15
- package/dist/guest/{journeys-BcbIxxI-.js → journeys-C8j8Sqvl.js} +216 -116
- package/dist/guest/journeys.d.ts +42 -16
- package/dist/guest/journeys.js +1 -1
- package/dist/guest/wasi.js +1 -1
- package/dist/index.js +2185 -1544
- package/examples/abandoned-checkout/journeys/abandoned-checkout.ts +2 -1
- package/examples/abandoned-checkout/scenarios/abandoned-checkout.timeout.json +2 -1
- package/examples/activity-decay/journeys/activity-decay.ts +1 -0
- package/examples/cross-app-pitch/journeys/cross-app-pitch.ts +5 -1
- package/examples/cross-app-pitch/scenarios/cross-app-pitch.json +2 -1
- package/examples/winback/journeys/winback.ts +2 -1
- package/examples/winback/scenarios/winback.json +4 -1
- package/package.json +3 -1
- package/dist/guest/constants-OZrYz4I2.d.ts +0 -42
|
@@ -12,6 +12,7 @@ import { defineJourney } from "@cowliss/cli/journeys";
|
|
|
12
12
|
export default defineJourney({
|
|
13
13
|
trigger: { event: "checkout_started" },
|
|
14
14
|
purpose: "emailMarketing",
|
|
15
|
+
senderIdentity: "cowliss-default",
|
|
15
16
|
tags: ["demo", "checkout"],
|
|
16
17
|
run: async (event, api) => {
|
|
17
18
|
const purchased = await api.waitForEvent("purchase_completed", {
|
|
@@ -25,7 +26,7 @@ export default defineJourney({
|
|
|
25
26
|
// it; the email drops its button when the prop is missing.
|
|
26
27
|
const checkoutUrl = event.properties.checkoutUrl;
|
|
27
28
|
const me = await api.profile.get();
|
|
28
|
-
await api.email
|
|
29
|
+
await api.send.email({
|
|
29
30
|
template: "abandoned-checkout",
|
|
30
31
|
props: {
|
|
31
32
|
checkoutUrl: typeof checkoutUrl === "string" ? checkoutUrl : undefined,
|
|
@@ -21,6 +21,7 @@ import { defineJourney } from "@cowliss/cli/journeys";
|
|
|
21
21
|
export default defineJourney({
|
|
22
22
|
trigger: { event: "*" },
|
|
23
23
|
purpose: "emailMarketing",
|
|
24
|
+
senderIdentity: "cowliss-default",
|
|
24
25
|
tags: ["demo", "retention"],
|
|
25
26
|
run: async (_event, api) => {
|
|
26
27
|
await api.traits.set("active_30d", true);
|
|
@@ -13,6 +13,10 @@ import { defineJourney } from "@cowliss/cli/journeys";
|
|
|
13
13
|
export default defineJourney({
|
|
14
14
|
trigger: { event: "plan_upgraded", appId: "app_b" },
|
|
15
15
|
purpose: "emailMarketing",
|
|
16
|
+
// A named identity rather than the default: a pitch for your other product
|
|
17
|
+
// reads better from a product address than from the one your receipts come
|
|
18
|
+
// from. Create it under Settings, Domains, sender identities.
|
|
19
|
+
senderIdentity: "product-news",
|
|
16
20
|
tags: ["demo", "cross-app"],
|
|
17
21
|
run: async (_event, api) => {
|
|
18
22
|
await api.sleep("1d");
|
|
@@ -22,7 +26,7 @@ export default defineJourney({
|
|
|
22
26
|
if (me.traits.plan !== "free") {
|
|
23
27
|
return;
|
|
24
28
|
}
|
|
25
|
-
await api.email
|
|
29
|
+
await api.send.email({
|
|
26
30
|
template: "cross-app-pitch",
|
|
27
31
|
props: { plan: "pro" },
|
|
28
32
|
});
|
|
@@ -12,6 +12,7 @@ import { defineJourney } from "@cowliss/cli/journeys";
|
|
|
12
12
|
export default defineJourney({
|
|
13
13
|
trigger: { event: "purchase_completed" },
|
|
14
14
|
purpose: "emailMarketing",
|
|
15
|
+
senderIdentity: "cowliss-default",
|
|
15
16
|
tags: ["demo", "retention"],
|
|
16
17
|
run: async (_event, api) => {
|
|
17
18
|
await api.traits.set("purchased_recently", true);
|
|
@@ -20,7 +21,7 @@ export default defineJourney({
|
|
|
20
21
|
}
|
|
21
22
|
await api.traits.unset("purchased_recently");
|
|
22
23
|
const me = await api.profile.get();
|
|
23
|
-
await api.email
|
|
24
|
+
await api.send.email({
|
|
24
25
|
template: "winback",
|
|
25
26
|
props: {
|
|
26
27
|
firstName:
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"input": { "key": "purchased_recently", "value": true }
|
|
14
14
|
},
|
|
15
15
|
{ "activity": "unsetTrait", "input": { "key": "purchased_recently" } },
|
|
16
|
-
{
|
|
16
|
+
{
|
|
17
|
+
"activity": "sendEmail",
|
|
18
|
+
"input": { "template": "winback", "senderIdentity": "cowliss-default" }
|
|
19
|
+
}
|
|
17
20
|
]
|
|
18
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowliss/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cow": "./dist/index.js"
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"./package.json": "./package.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@babel/parser": "^7.29.8",
|
|
33
34
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
34
35
|
"commander": "^14.0.1",
|
|
35
36
|
"esbuild": "^0.28.2",
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
"zod": "^4.4.3"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
41
|
+
"@babel/types": "^7.29.8",
|
|
40
42
|
"@cowliss/api-client": "0.0.0",
|
|
41
43
|
"@cowliss/shared": "0.0.0",
|
|
42
44
|
"@react-email/components": "^1.0.12",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
//#region ../../packages/shared/src/constants.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* The two fixed environments every org has (spec: Environments). An app
|
|
4
|
-
* belongs to one, so the environment of every write is the app's;
|
|
5
|
-
* profiles, identifiers, events, memberships, journey instances,
|
|
6
|
-
* deliveries, violations, quarantine, the address ledger, and idempotency
|
|
7
|
-
* keys are per environment, while the catalog, sending domains, the
|
|
8
|
-
* suppression mirror, billing, and journey code are shared. A third
|
|
9
|
-
* environment is a one-line change here plus the mirrored db enum.
|
|
10
|
-
*/
|
|
11
|
-
declare const ENVIRONMENTS: readonly ["development", "production"];
|
|
12
|
-
type Environment = (typeof ENVIRONMENTS)[number];
|
|
13
|
-
/**
|
|
14
|
-
* Fixed consent purposes for the prototype. Consent is a per-purpose map on
|
|
15
|
-
* the profile, checked at send-step execution time.
|
|
16
|
-
*
|
|
17
|
-
* The two names describe what the recipient agreed to, not the pipe it
|
|
18
|
-
* arrives on: "emails I did not ask for individually" and "my data leaving
|
|
19
|
-
* for somewhere else". Naming them after the channel (`email`, `webhook`)
|
|
20
|
-
* said nothing a recipient could consent to, and transactional mail already
|
|
21
|
-
* bypasses the email purpose, so it was only ever marketing consent.
|
|
22
|
-
*/
|
|
23
|
-
declare const CONSENT_PURPOSES: readonly ["emailMarketing", "dataProcessing"];
|
|
24
|
-
type ConsentPurpose = (typeof CONSENT_PURPOSES)[number];
|
|
25
|
-
/**
|
|
26
|
-
* The two classes of send, declared on the template rather than passed per
|
|
27
|
-
* call so the class cannot drift between two sends of the same message.
|
|
28
|
-
*
|
|
29
|
-
* Marketing is everything a journey sends on the org's behalf: it carries
|
|
30
|
-
* the RFC 8058 unsubscribe headers and runs the full gate list.
|
|
31
|
-
* Transactional is the developer's own operational mail (a receipt, an
|
|
32
|
-
* export-is-ready notice): it carries neither header and skips consent and
|
|
33
|
-
* the per-user frequency cap, because an unsubscribe link on an invoice is
|
|
34
|
-
* wrong and a receipt must not silently vanish for anyone who once left a
|
|
35
|
-
* newsletter. Suppression, the quota, the sending pause, and the from-domain
|
|
36
|
-
* check still apply to both: those bound cost and protect the shared SES
|
|
37
|
-
* account, and none of them are about what the recipient asked for.
|
|
38
|
-
*/
|
|
39
|
-
declare const SEND_CLASSES: readonly ["marketing", "transactional"];
|
|
40
|
-
type SendClass = (typeof SEND_CLASSES)[number];
|
|
41
|
-
//#endregion
|
|
42
|
-
export { Environment as n, SendClass as r, ConsentPurpose as t };
|