@founderhq/journeys 0.3.67 → 0.4.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 +44 -6
- package/dist/_tsup-dts-rollup.d.cts +2294 -0
- package/dist/_tsup-dts-rollup.d.ts +2294 -0
- package/dist/index.cjs +502 -40
- package/dist/index.d.cts +140 -1446
- package/dist/index.d.ts +140 -1446
- package/dist/index.js +502 -40
- package/dist/styles.css +2 -2
- package/package.json +12 -9
package/README.md
CHANGED
|
@@ -22,12 +22,29 @@ pnpm add @founderhq/journeys
|
|
|
22
22
|
import { Journey } from "@founderhq/journeys";
|
|
23
23
|
import "@founderhq/journeys/styles.css";
|
|
24
24
|
|
|
25
|
-
export function Example({
|
|
26
|
-
|
|
25
|
+
export function Example({
|
|
26
|
+
config,
|
|
27
|
+
}: {
|
|
28
|
+
config: import("@founderhq/journeys").JourneyConfig;
|
|
29
|
+
}) {
|
|
30
|
+
return (
|
|
31
|
+
<Journey
|
|
32
|
+
apiKey="fhq_pk_..."
|
|
33
|
+
journeyId="journey_123"
|
|
34
|
+
config={config}
|
|
35
|
+
storageKey="example-journey"
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
27
38
|
}
|
|
28
39
|
```
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
`apiKey` and `journeyId` are always required. Passing `config` only supplies local render data; the package still validates access with FounderHQ before rendering. Omit `config` to fetch the published config from FounderHQ:
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<Journey apiKey="fhq_pk_..." journeyId="journey_123" />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The browser package is public client code, so access enforcement happens on FounderHQ's server APIs: config fetch, validation, and capture all require a valid scoped publishable key.
|
|
31
48
|
|
|
32
49
|
## Injecting Runtime Data (`initialAnswers`)
|
|
33
50
|
|
|
@@ -35,14 +52,19 @@ Pass `initialAnswers` to seed the answer state at first render. Useful when jour
|
|
|
35
52
|
|
|
36
53
|
```tsx
|
|
37
54
|
<Journey
|
|
38
|
-
apiKey="
|
|
55
|
+
apiKey="fhq_pk_..."
|
|
39
56
|
journeyId="abc-123"
|
|
40
57
|
initialAnswers={{
|
|
41
58
|
pricingPlans: [
|
|
42
59
|
{
|
|
43
60
|
id: "pro_monthly",
|
|
44
61
|
name: "Pro",
|
|
45
|
-
price: {
|
|
62
|
+
price: {
|
|
63
|
+
amount: 29,
|
|
64
|
+
currency: "USD",
|
|
65
|
+
period: "month",
|
|
66
|
+
trial: { days: 7 },
|
|
67
|
+
},
|
|
46
68
|
metadata: { stripePriceId: "price_xxx" },
|
|
47
69
|
},
|
|
48
70
|
],
|
|
@@ -69,7 +91,7 @@ Pass `initialOptions` to override option lists at render time without storing la
|
|
|
69
91
|
|
|
70
92
|
```tsx
|
|
71
93
|
<Journey
|
|
72
|
-
apiKey="
|
|
94
|
+
apiKey="fhq_pk_..."
|
|
73
95
|
journeyId="abc-123"
|
|
74
96
|
initialOptions={{
|
|
75
97
|
country: countries.map((country) => ({
|
|
@@ -147,6 +169,8 @@ Pass `onDiscountCodeApply` to validate and reprice in the consumer app:
|
|
|
147
169
|
|
|
148
170
|
```tsx
|
|
149
171
|
<Journey
|
|
172
|
+
apiKey="fhq_pk_..."
|
|
173
|
+
journeyId="abc-123"
|
|
150
174
|
config={config}
|
|
151
175
|
onDiscountCodeApply={async ({ code, plan }) => {
|
|
152
176
|
const result = await validateCoupon(code, plan?.id);
|
|
@@ -170,6 +194,20 @@ Pass `onDiscountCodeApply` to validate and reprice in the consumer app:
|
|
|
170
194
|
|
|
171
195
|
Set `pricing_plans.props.discountVariable` to let cards replace the visible non-strike price from `pricing.display`, `pricing.amount`, or `pricing.total`. Set `purchase.action.discountVariable` to include the full applied discount answer in `purchase_intent`. Journeys never calculates billing amounts or provider rules; those belong in the consumer callback and `metadata`.
|
|
172
196
|
|
|
197
|
+
## Capture Options
|
|
198
|
+
|
|
199
|
+
Capture is enabled by default after access validation succeeds. Pass `capture={false}` to opt out, or pass capture options to add custom context:
|
|
200
|
+
|
|
201
|
+
```tsx
|
|
202
|
+
<Journey
|
|
203
|
+
apiKey="fhq_pk_..."
|
|
204
|
+
journeyId="journey_123"
|
|
205
|
+
capture={{ context: { app: { name: "web" } } }}
|
|
206
|
+
/>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
`apiKey`, `journeyId`, and the FounderHQ API URL are inherited from the root props and are not repeated inside `capture`.
|
|
210
|
+
|
|
173
211
|
## Config Shape
|
|
174
212
|
|
|
175
213
|
A journey config is centered around:
|