@cowliss/cli 0.5.0 → 0.7.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 +4 -5
- package/dist/guest/{driver-14FnzM-h.js → driver-C1bsCjZT.js} +7 -3
- package/dist/guest/driver.d.ts +1 -1
- package/dist/guest/driver.js +1 -1
- package/dist/guest/emails.d.ts +6 -0
- package/dist/guest/{index-BDj02EsQ.d.ts → index-3PMqJKmc.d.ts} +111 -16
- package/dist/guest/{journeys-C8j8Sqvl.js → journeys-Dpsp225V.js} +286 -87
- package/dist/guest/journeys.d.ts +52 -23
- package/dist/guest/journeys.js +1 -1
- package/dist/guest/wasi.js +1 -1
- package/dist/index.js +1504 -987
- package/examples/abandoned-checkout/journeys/abandoned-checkout.ts +9 -2
- package/examples/abandoned-checkout/scenarios/abandoned-checkout.timeout.json +1 -2
- package/examples/activity-decay/journeys/activity-decay.ts +13 -3
- package/examples/cross-app-pitch/journeys/cross-app-pitch.ts +10 -5
- package/examples/cross-app-pitch/scenarios/cross-app-pitch.json +1 -1
- package/examples/winback/journeys/winback.ts +10 -3
- package/examples/winback/scenarios/winback.json +1 -1
- package/package.json +1 -1
package/dist/guest/journeys.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { i as GuestEvent, n as Trigger, r as TriggerInput, t as Duration } from "./index-3PMqJKmc.js";
|
|
2
2
|
//#region src/guest/journeys.d.ts
|
|
3
3
|
/** The event a journey runs for, or the one a `waitForEvent` resolved with. */
|
|
4
4
|
type Event = GuestEvent;
|
|
5
5
|
/**
|
|
6
6
|
* A profile as the capability layer hands it back: the recipient of this
|
|
7
|
-
* execution (`api.profile.get()`) or another profile in the same org
|
|
8
|
-
*
|
|
7
|
+
* execution (`api.profile.get()`) or another profile in the same org
|
|
8
|
+
* (`api.profiles.get(id)`). A fresh read on every call.
|
|
9
9
|
*/
|
|
10
10
|
type Profile = {
|
|
11
11
|
/** The Cowliss-generated profile id (`usr_`). */
|
|
@@ -23,7 +23,7 @@ type EmailSendResult = {
|
|
|
23
23
|
status: string;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* A capability that failed host-side (an unknown
|
|
26
|
+
* A capability that failed host-side (an unknown webhook, invalid
|
|
27
27
|
* props, a profile that is not there). The failure is journaled, so a
|
|
28
28
|
* journey that catches it takes the same branch on every replay.
|
|
29
29
|
*/
|
|
@@ -68,11 +68,16 @@ type Api = {
|
|
|
68
68
|
template: Key;
|
|
69
69
|
props: TemplateProps<Key>;
|
|
70
70
|
/**
|
|
71
|
-
* Send this one mail from a different
|
|
72
|
-
*
|
|
73
|
-
*
|
|
71
|
+
* Send this one mail from a different address than the journey's own:
|
|
72
|
+
* `"billing@acme.com"` or `"Billing <billing@acme.com>"`. The domain
|
|
73
|
+
* must be one your organization has verified, or the send is skipped.
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
from?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Where a reply to this one mail goes, instead of the from-address.
|
|
78
|
+
* Any address: nothing is sent from it.
|
|
79
|
+
*/
|
|
80
|
+
replyTo?: string;
|
|
76
81
|
}): Promise<EmailSendResult>;
|
|
77
82
|
webhook(args: {
|
|
78
83
|
destination: string;
|
|
@@ -116,22 +121,41 @@ type Api = {
|
|
|
116
121
|
type JourneyConfig = {
|
|
117
122
|
trigger: Trigger;
|
|
118
123
|
/**
|
|
119
|
-
*
|
|
120
|
-
* project declares in `cow.json`. The key's shape is checked
|
|
121
|
-
* the org declares it is checked when the release is deployed.
|
|
124
|
+
* Why this journey contacts someone: `marketing`, `transactional`, or a
|
|
125
|
+
* purpose this project declares in `cow.json`. The key's shape is checked
|
|
126
|
+
* here; that the org declares it is checked when the release is deployed.
|
|
122
127
|
*/
|
|
123
128
|
purpose: string;
|
|
124
129
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
130
|
+
* How often one recipient may enter this journey. A marketing journey
|
|
131
|
+
* enrolls each recipient once, ever; give it a `cooldown` and it re-opens
|
|
132
|
+
* that long after their last completed run. A transactional journey
|
|
133
|
+
* enrolls on every trigger — three orders are three receipts — so it
|
|
134
|
+
* takes no cooldown and `cow build` refuses one.
|
|
135
|
+
*
|
|
136
|
+
* History counts: adding a cooldown to a journey that has been running
|
|
137
|
+
* for months measures from runs that already completed.
|
|
138
|
+
*/
|
|
139
|
+
enrollment?: {
|
|
140
|
+
cooldown: Duration;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* One plain sentence saying what this journey does for the person who
|
|
144
|
+
* gets it. Shown wherever the journey is read. Optional; at most 500
|
|
145
|
+
* characters.
|
|
146
|
+
*/
|
|
147
|
+
description?: string;
|
|
148
|
+
/**
|
|
149
|
+
* The address every `api.send.email` in this journey goes out as:
|
|
150
|
+
* `"billing@acme.com"` or `"Billing <billing@acme.com>"`. A single send
|
|
128
151
|
* can override it.
|
|
129
152
|
*
|
|
130
|
-
* Required,
|
|
131
|
-
*
|
|
132
|
-
*
|
|
153
|
+
* Required, on a domain your organization has verified: there is no
|
|
154
|
+
* address Cowliss lends you. Named here rather than in a settings page,
|
|
155
|
+
* so the address a journey sends from is readable in the journey's own
|
|
156
|
+
* source.
|
|
133
157
|
*/
|
|
134
|
-
|
|
158
|
+
from: string;
|
|
135
159
|
/** The author's labels; the dashboard's only grouping. Defaults to none. */
|
|
136
160
|
tags: string[];
|
|
137
161
|
};
|
|
@@ -141,13 +165,18 @@ type Journey = JourneyConfig & {
|
|
|
141
165
|
/**
|
|
142
166
|
* Author a journey. Throws at definition time on an invalid config.
|
|
143
167
|
*
|
|
144
|
-
* There is no environment gate here:
|
|
145
|
-
* and nowhere else (ADR 0011).
|
|
146
|
-
* a typecheck error in `cow build`, which is where the author can fix it.
|
|
168
|
+
* There is no environment gate here: an organization has one data space, and
|
|
169
|
+
* a journey runs wherever it is on and nowhere else (ADR 0011, ADR 0013).
|
|
147
170
|
*/
|
|
148
|
-
declare function defineJourney(input: Omit<JourneyConfig, "tags"> & {
|
|
171
|
+
declare function defineJourney(input: Omit<JourneyConfig, "tags" | "trigger"> & {
|
|
172
|
+
/**
|
|
173
|
+
* What starts it: `{ event }`, or `{ segment }` carrying the predicate
|
|
174
|
+
* list of the segment this journey enrolls from. Written form, so a
|
|
175
|
+
* predicate can leave `match` and `atLeast` out.
|
|
176
|
+
*/
|
|
177
|
+
trigger: TriggerInput;
|
|
149
178
|
tags?: string[];
|
|
150
179
|
run: (event: Event, api: Api) => Promise<void>;
|
|
151
180
|
}): Journey;
|
|
152
181
|
//#endregion
|
|
153
|
-
export { Api, CapabilityError, CowTemplates, type Duration, EmailSendResult, Event, Journey, JourneyConfig, Profile, type Trigger, defineJourney };
|
|
182
|
+
export { Api, CapabilityError, CowTemplates, type Duration, EmailSendResult, Event, Journey, JourneyConfig, Profile, type Trigger, type TriggerInput, defineJourney };
|
package/dist/guest/journeys.js
CHANGED
package/dist/guest/wasi.js
CHANGED