@appfunnel-dev/sdk 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/README.md +2 -80
- package/dist/elements/index.cjs +49 -4
- package/dist/elements/index.cjs.map +1 -1
- package/dist/elements/index.d.cts +19 -1
- package/dist/elements/index.d.ts +19 -1
- package/dist/elements/index.js +49 -5
- package/dist/elements/index.js.map +1 -1
- package/dist/index.cjs +727 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +729 -40
- package/dist/index.js.map +1 -1
- package/dist/{internal-C7seLJBr.d.cts → internal-C9MOEdND.d.cts} +11 -12
- package/dist/{internal-C7seLJBr.d.ts → internal-C9MOEdND.d.ts} +11 -12
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,84 +8,6 @@ Headless SDK for building AppFunnel pages with React. Write funnel pages as Reac
|
|
|
8
8
|
npm install @appfunnel-dev/sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Documentation
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
// appfunnel.config.ts
|
|
17
|
-
import { defineConfig } from '@appfunnel-dev/sdk'
|
|
18
|
-
|
|
19
|
-
export default defineConfig({
|
|
20
|
-
projectId: 'clxxx...',
|
|
21
|
-
name: 'My Onboarding Funnel',
|
|
22
|
-
pages: {
|
|
23
|
-
index: { name: 'Landing', type: 'default' },
|
|
24
|
-
quiz: { name: 'Quiz', type: 'default' },
|
|
25
|
-
checkout: { name: 'Checkout', type: 'checkout' },
|
|
26
|
-
success: { name: 'Success', type: 'finish' },
|
|
27
|
-
},
|
|
28
|
-
routes: {
|
|
29
|
-
index: [{ to: 'quiz' }],
|
|
30
|
-
quiz: [
|
|
31
|
-
{ to: 'checkout', when: { variable: 'plan', equals: 'premium' } },
|
|
32
|
-
{ to: 'success' },
|
|
33
|
-
],
|
|
34
|
-
checkout: [{ to: 'success' }],
|
|
35
|
-
},
|
|
36
|
-
variables: {
|
|
37
|
-
email: { type: 'string' },
|
|
38
|
-
plan: { type: 'string', default: 'free' },
|
|
39
|
-
},
|
|
40
|
-
products: {
|
|
41
|
-
items: [
|
|
42
|
-
{ id: 'monthly', name: 'Monthly Plan', storePriceId: 'clyyy...' },
|
|
43
|
-
{ id: 'yearly', name: 'Yearly Plan', storePriceId: 'clzzz...' },
|
|
44
|
-
],
|
|
45
|
-
defaultId: 'yearly',
|
|
46
|
-
},
|
|
47
|
-
})
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 2. Write pages
|
|
51
|
-
|
|
52
|
-
```tsx
|
|
53
|
-
// pages/index.tsx
|
|
54
|
-
import { useVariable, useNavigation } from '@appfunnel-dev/sdk'
|
|
55
|
-
|
|
56
|
-
export default function Landing() {
|
|
57
|
-
const [email, setEmail] = useVariable<string>('email')
|
|
58
|
-
const { goToNextPage } = useNavigation()
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<div>
|
|
62
|
-
<h1>Start your journey</h1>
|
|
63
|
-
<input
|
|
64
|
-
type="email"
|
|
65
|
-
value={email}
|
|
66
|
-
onChange={e => setEmail(e.target.value)}
|
|
67
|
-
/>
|
|
68
|
-
<button onClick={goToNextPage}>Continue</button>
|
|
69
|
-
</div>
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Hooks
|
|
75
|
-
|
|
76
|
-
| Hook | Description |
|
|
77
|
-
|------|-------------|
|
|
78
|
-
| `useVariable(id)` | Read/write a single variable with typed actions |
|
|
79
|
-
| `useVariables()` | Read all variables (read-only) |
|
|
80
|
-
| `useNavigation()` | Page navigation, progress, history |
|
|
81
|
-
| `useProducts()` | Product list, selection |
|
|
82
|
-
| `useTracking()` | Event tracking, user identification |
|
|
83
|
-
| `usePayment()` | Payment state (card details, loading, errors) |
|
|
84
|
-
| `useFunnel()` | Convenience — combines all hooks above |
|
|
85
|
-
|
|
86
|
-
## Components
|
|
87
|
-
|
|
88
|
-
| Component | Description |
|
|
89
|
-
|-----------|-------------|
|
|
90
|
-
| `<PaymentForm>` | Stripe Elements wrapper for card collection & payment |
|
|
91
|
-
| `<PaddleCheckout>` | Paddle checkout (overlay or inline) |
|
|
13
|
+
Full documentation, guides, and API reference available at **[appfunnel.net/docs](https://appfunnel.net/docs)**.
|
package/dist/elements/index.cjs
CHANGED
|
@@ -11417,8 +11417,8 @@ var Dialog2 = React27.forwardRef(function Dialog3({
|
|
|
11417
11417
|
overlayColor = "rgba(0, 0, 0, 0.5)",
|
|
11418
11418
|
backgroundColor = "#ffffff",
|
|
11419
11419
|
borderRadius = 16,
|
|
11420
|
-
maxWidth =
|
|
11421
|
-
padding =
|
|
11420
|
+
maxWidth = 600,
|
|
11421
|
+
padding = 16,
|
|
11422
11422
|
style,
|
|
11423
11423
|
className
|
|
11424
11424
|
}, ref) {
|
|
@@ -11505,8 +11505,7 @@ var Dialog2 = React27.forwardRef(function Dialog3({
|
|
|
11505
11505
|
display: "flex",
|
|
11506
11506
|
flexDirection: "row",
|
|
11507
11507
|
alignItems: "center",
|
|
11508
|
-
justifyContent: "space-between"
|
|
11509
|
-
padding: "16px 16px"
|
|
11508
|
+
justifyContent: "space-between"
|
|
11510
11509
|
},
|
|
11511
11510
|
children: [
|
|
11512
11511
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -12156,11 +12155,57 @@ function MultiSelect({
|
|
|
12156
12155
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => handleToggle(key), style: { cursor: "pointer" }, children: renderItem({ item, index, active }) }, key);
|
|
12157
12156
|
}) });
|
|
12158
12157
|
}
|
|
12158
|
+
var SIZE = {
|
|
12159
|
+
xs: { size: 20, border: 2 },
|
|
12160
|
+
sm: { size: 30, border: 3 },
|
|
12161
|
+
md: { size: 40, border: 3 },
|
|
12162
|
+
lg: { size: 50, border: 4 },
|
|
12163
|
+
xl: { size: 60, border: 4 }
|
|
12164
|
+
};
|
|
12165
|
+
function Loading({
|
|
12166
|
+
color: color2,
|
|
12167
|
+
size = "md",
|
|
12168
|
+
customSize,
|
|
12169
|
+
borderWidth,
|
|
12170
|
+
speed = 800,
|
|
12171
|
+
className,
|
|
12172
|
+
style
|
|
12173
|
+
}) {
|
|
12174
|
+
const preset = SIZE[size];
|
|
12175
|
+
const finalSize = customSize ?? preset.size;
|
|
12176
|
+
const finalBorder = borderWidth ?? preset.border;
|
|
12177
|
+
const borderColor = color2 ? `color-mix(in srgb, ${color2} 30%, transparent)` : "color-mix(in srgb, currentColor 30%, transparent)";
|
|
12178
|
+
const topColor = color2 ?? "currentColor";
|
|
12179
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12180
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
12181
|
+
@keyframes appfunnel-loading-spin {
|
|
12182
|
+
to { transform: rotate(360deg); }
|
|
12183
|
+
}
|
|
12184
|
+
` }),
|
|
12185
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12186
|
+
"div",
|
|
12187
|
+
{
|
|
12188
|
+
className,
|
|
12189
|
+
style: {
|
|
12190
|
+
display: "inline-block",
|
|
12191
|
+
width: finalSize,
|
|
12192
|
+
height: finalSize,
|
|
12193
|
+
border: `${finalBorder}px solid ${borderColor}`,
|
|
12194
|
+
borderRadius: "50%",
|
|
12195
|
+
borderTopColor: topColor,
|
|
12196
|
+
animation: `appfunnel-loading-spin ${speed}ms linear infinite`,
|
|
12197
|
+
...style
|
|
12198
|
+
}
|
|
12199
|
+
}
|
|
12200
|
+
)
|
|
12201
|
+
] });
|
|
12202
|
+
}
|
|
12159
12203
|
|
|
12160
12204
|
exports.Carousel = Carousel;
|
|
12161
12205
|
exports.CountUp = CountUp;
|
|
12162
12206
|
exports.Dialog = Dialog2;
|
|
12163
12207
|
exports.Drawer = Drawer;
|
|
12208
|
+
exports.Loading = Loading;
|
|
12164
12209
|
exports.Marquee = Marquee;
|
|
12165
12210
|
exports.MultiSelect = MultiSelect;
|
|
12166
12211
|
exports.ProgressBar = ProgressBar;
|