@appfunnel-dev/sdk 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/dist/chunk-EVUYCLVY.cjs +1326 -0
- package/dist/chunk-EVUYCLVY.cjs.map +1 -0
- package/dist/chunk-H3KHXZSI.js +1321 -0
- package/dist/chunk-H3KHXZSI.js.map +1 -0
- package/dist/chunk-P4SLDMWY.js +104 -0
- package/dist/chunk-P4SLDMWY.js.map +1 -0
- package/dist/chunk-XP44I2MU.cjs +108 -0
- package/dist/chunk-XP44I2MU.cjs.map +1 -0
- package/dist/elements/index.cjs +12172 -0
- package/dist/elements/index.cjs.map +1 -0
- package/dist/elements/index.d.cts +602 -0
- package/dist/elements/index.d.ts +602 -0
- package/dist/elements/index.js +12137 -0
- package/dist/elements/index.js.map +1 -0
- package/dist/index.cjs +590 -371
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +132 -14
- package/dist/index.d.ts +132 -14
- package/dist/index.js +555 -355
- package/dist/index.js.map +1 -1
- package/dist/internal-C7seLJBr.d.cts +516 -0
- package/dist/internal-C7seLJBr.d.ts +516 -0
- package/dist/internal.cjs +5 -1196
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +2 -204
- package/dist/internal.d.ts +2 -204
- package/dist/internal.js +1 -1199
- package/dist/internal.js.map +1 -1
- package/package.json +17 -2
- package/dist/types-ChorYUCl.d.cts +0 -255
- package/dist/types-ChorYUCl.d.ts +0 -255
package/dist/types-ChorYUCl.d.ts
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
type VariableType = 'string' | 'number' | 'boolean' | 'stringArray';
|
|
2
|
-
type VariableValue = string | number | boolean | string[] | null | undefined;
|
|
3
|
-
interface AppFunnelConfig {
|
|
4
|
-
projectId: string;
|
|
5
|
-
name: string;
|
|
6
|
-
/** Page key to start on. Defaults to first entry in `pages`. */
|
|
7
|
-
initialPage?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Response variables — user answers to quiz/survey questions.
|
|
10
|
-
* Stored internally as `answers.<key>`.
|
|
11
|
-
*
|
|
12
|
-
* ```ts
|
|
13
|
-
* responses: {
|
|
14
|
-
* goal: { type: 'string', default: '' },
|
|
15
|
-
* age_range: { type: 'string' },
|
|
16
|
-
* interests: { type: 'stringArray', default: [] },
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
responses?: Record<string, VariableConfig>;
|
|
21
|
-
/**
|
|
22
|
-
* Query param variables — captured from the URL at runtime.
|
|
23
|
-
* Stored internally as `query.<key>`.
|
|
24
|
-
* Listed here so the CLI build can emit them for analytics/database.
|
|
25
|
-
*
|
|
26
|
-
* ```ts
|
|
27
|
-
* queryParams: {
|
|
28
|
-
* utm_source: { type: 'string' },
|
|
29
|
-
* utm_medium: { type: 'string' },
|
|
30
|
-
* ref: { type: 'string' },
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
queryParams?: Record<string, VariableConfig>;
|
|
35
|
-
/**
|
|
36
|
-
* Data variables — arbitrary runtime state (not user answers or query params).
|
|
37
|
-
* Stored internally as `data.<key>`.
|
|
38
|
-
*
|
|
39
|
-
* ```ts
|
|
40
|
-
* data: {
|
|
41
|
-
* selectedPlanTier: { type: 'string', default: 'free' },
|
|
42
|
-
* hasSeenOnboarding: { type: 'boolean', default: false },
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
data?: Record<string, VariableConfig>;
|
|
47
|
-
/** Default locale for translations. Defaults to 'en'. */
|
|
48
|
-
defaultLocale?: string;
|
|
49
|
-
products?: ProductsConfig;
|
|
50
|
-
settings?: FunnelSettings;
|
|
51
|
-
/**
|
|
52
|
-
* Integration configs (Meta Pixel, GTM, Clarity, etc.).
|
|
53
|
-
* Loaded from the API at runtime — the CLI build injects these
|
|
54
|
-
* from the project's dashboard settings.
|
|
55
|
-
*/
|
|
56
|
-
integrations?: Record<string, Record<string, unknown>>;
|
|
57
|
-
/**
|
|
58
|
-
* Pages and routes can be defined here OR via `definePage()` in each page file.
|
|
59
|
-
* When using `definePage()`, the CLI build collects page definitions from the
|
|
60
|
-
* filesystem and merges them into the final config. These fields are populated
|
|
61
|
-
* by the build step — you don't need to set them manually.
|
|
62
|
-
*/
|
|
63
|
-
pages?: Record<string, PageConfig>;
|
|
64
|
-
routes?: Record<string, RouteConfig[]>;
|
|
65
|
-
}
|
|
66
|
-
type PageType = 'default' | 'checkout' | 'finish' | 'auth' | 'paywall' | 'upsell';
|
|
67
|
-
interface PageConfig {
|
|
68
|
-
name: string;
|
|
69
|
-
type: PageType;
|
|
70
|
-
/** URL slug for this page. Used for deep links, browser history, and reload persistence.
|
|
71
|
-
* Defaults to the page key (filename) if not specified. */
|
|
72
|
-
slug?: string;
|
|
73
|
-
}
|
|
74
|
-
interface RouteConfig {
|
|
75
|
-
to: string;
|
|
76
|
-
when?: ConditionConfig | ConditionGroupConfig;
|
|
77
|
-
}
|
|
78
|
-
interface PageDefinition {
|
|
79
|
-
/** Display name shown in analytics and dashboard */
|
|
80
|
-
name: string;
|
|
81
|
-
/** Page type — determines behavior (e.g. checkout pages trigger payment flow) */
|
|
82
|
-
type?: PageType;
|
|
83
|
-
/** URL slug for this page. Defaults to the page key (filename) if not specified.
|
|
84
|
-
* Used for deep links, browser history (pushState), and reload persistence. */
|
|
85
|
-
slug?: string;
|
|
86
|
-
/** Routes from this page. Evaluated in order; first match wins. */
|
|
87
|
-
routes?: RouteConfig[];
|
|
88
|
-
}
|
|
89
|
-
interface ConditionConfig {
|
|
90
|
-
variable: string;
|
|
91
|
-
equals?: VariableValue;
|
|
92
|
-
notEquals?: VariableValue;
|
|
93
|
-
contains?: string;
|
|
94
|
-
greaterThan?: number;
|
|
95
|
-
lessThan?: number;
|
|
96
|
-
exists?: boolean;
|
|
97
|
-
isEmpty?: boolean;
|
|
98
|
-
includes?: string;
|
|
99
|
-
}
|
|
100
|
-
interface ConditionGroupConfig {
|
|
101
|
-
operator: 'AND' | 'OR';
|
|
102
|
-
rules: (ConditionConfig | ConditionGroupConfig)[];
|
|
103
|
-
}
|
|
104
|
-
interface VariableConfig {
|
|
105
|
-
type: VariableType;
|
|
106
|
-
default?: VariableValue;
|
|
107
|
-
persist?: boolean;
|
|
108
|
-
}
|
|
109
|
-
interface ProductsConfig {
|
|
110
|
-
items: ProductConfig[];
|
|
111
|
-
defaultId?: string;
|
|
112
|
-
}
|
|
113
|
-
interface ProductConfig {
|
|
114
|
-
id: string;
|
|
115
|
-
name: string;
|
|
116
|
-
storePriceId: string;
|
|
117
|
-
}
|
|
118
|
-
interface FunnelSettings {
|
|
119
|
-
/** API base URL override (defaults to AppFunnel production API) */
|
|
120
|
-
apiBaseUrl?: string;
|
|
121
|
-
}
|
|
122
|
-
interface RuntimeProduct {
|
|
123
|
-
id: string;
|
|
124
|
-
name: string;
|
|
125
|
-
price: string;
|
|
126
|
-
rawPrice: number;
|
|
127
|
-
monthlyPrice: string;
|
|
128
|
-
dailyPrice: string;
|
|
129
|
-
weeklyPrice: string;
|
|
130
|
-
yearlyPrice: string;
|
|
131
|
-
period: string;
|
|
132
|
-
periodly: string;
|
|
133
|
-
currencyCode: string;
|
|
134
|
-
hasTrial: boolean;
|
|
135
|
-
trialDays: number;
|
|
136
|
-
trialPrice: string;
|
|
137
|
-
paidTrial: boolean;
|
|
138
|
-
trialRawPrice: number;
|
|
139
|
-
trialDailyPrice: string;
|
|
140
|
-
trialCurrencyCode: string;
|
|
141
|
-
trialStorePriceId: string;
|
|
142
|
-
storePriceId: string;
|
|
143
|
-
stripePriceId: string;
|
|
144
|
-
stripeProductId: string;
|
|
145
|
-
paddlePriceId: string;
|
|
146
|
-
paddleProductId: string;
|
|
147
|
-
displayName: string;
|
|
148
|
-
periodDays: number;
|
|
149
|
-
periodMonths: number;
|
|
150
|
-
periodWeeks: number;
|
|
151
|
-
}
|
|
152
|
-
interface PageState {
|
|
153
|
-
key: string;
|
|
154
|
-
name: string;
|
|
155
|
-
type: string;
|
|
156
|
-
slug: string;
|
|
157
|
-
index: number;
|
|
158
|
-
}
|
|
159
|
-
interface Progress {
|
|
160
|
-
current: number;
|
|
161
|
-
total: number;
|
|
162
|
-
percentage: number;
|
|
163
|
-
}
|
|
164
|
-
/** Enriched price data from API (matches getFunnelByIdentifier response) */
|
|
165
|
-
interface EnrichedPriceData {
|
|
166
|
-
amount: number;
|
|
167
|
-
currency: string;
|
|
168
|
-
interval: string | null;
|
|
169
|
-
intervalCount: number | null;
|
|
170
|
-
stripePriceId?: string;
|
|
171
|
-
stripeProductId?: string;
|
|
172
|
-
paddlePriceId?: string;
|
|
173
|
-
paddleProductId?: string;
|
|
174
|
-
displayName?: string;
|
|
175
|
-
priceName?: string;
|
|
176
|
-
name?: string;
|
|
177
|
-
}
|
|
178
|
-
/** Hook return types */
|
|
179
|
-
interface TranslationState {
|
|
180
|
-
/** Translate a key, with optional interpolation: t('welcome', { name: 'John' }) */
|
|
181
|
-
t: (key: string, params?: Record<string, string | number>) => string;
|
|
182
|
-
/** Current locale code */
|
|
183
|
-
locale: string;
|
|
184
|
-
/** Switch locale at runtime */
|
|
185
|
-
setLocale: (locale: string) => void;
|
|
186
|
-
/** List of locales that have translations loaded */
|
|
187
|
-
availableLocales: string[];
|
|
188
|
-
}
|
|
189
|
-
interface LocaleState {
|
|
190
|
-
/** Full locale string, e.g. 'en-US' */
|
|
191
|
-
locale: string;
|
|
192
|
-
/** Language code, e.g. 'en' */
|
|
193
|
-
language: string;
|
|
194
|
-
/** Region code, e.g. 'US' */
|
|
195
|
-
region: string;
|
|
196
|
-
/** All preferred languages from navigator.languages */
|
|
197
|
-
languages: string[];
|
|
198
|
-
/** IANA timezone, e.g. 'America/New_York' */
|
|
199
|
-
timeZone: string;
|
|
200
|
-
/** Whether the locale uses 24-hour clock */
|
|
201
|
-
is24Hour: boolean;
|
|
202
|
-
}
|
|
203
|
-
interface UserState {
|
|
204
|
-
email: string;
|
|
205
|
-
name: string;
|
|
206
|
-
stripeCustomerId: string;
|
|
207
|
-
paddleCustomerId: string;
|
|
208
|
-
/** Set email and auto-fire identify event */
|
|
209
|
-
setEmail: (email: string) => void;
|
|
210
|
-
setName: (name: string) => void;
|
|
211
|
-
}
|
|
212
|
-
interface NavigationState {
|
|
213
|
-
goToNextPage: () => void;
|
|
214
|
-
goBack: () => void;
|
|
215
|
-
goToPage: (pageKey: string) => void;
|
|
216
|
-
currentPage: PageState | null;
|
|
217
|
-
pageHistory: string[];
|
|
218
|
-
progress: Progress;
|
|
219
|
-
}
|
|
220
|
-
interface ProductsState {
|
|
221
|
-
products: RuntimeProduct[];
|
|
222
|
-
selected: RuntimeProduct | null;
|
|
223
|
-
select: (productId: string) => void;
|
|
224
|
-
}
|
|
225
|
-
interface TrackingState {
|
|
226
|
-
track: (eventName: string, data?: Record<string, unknown>) => void;
|
|
227
|
-
identify: (email: string) => void;
|
|
228
|
-
}
|
|
229
|
-
interface PaymentState {
|
|
230
|
-
customerId: string | null;
|
|
231
|
-
isAuthorized: boolean;
|
|
232
|
-
loading: boolean;
|
|
233
|
-
error: string | null;
|
|
234
|
-
cardDetails: {
|
|
235
|
-
last4: string;
|
|
236
|
-
brand: string;
|
|
237
|
-
expMonth: number;
|
|
238
|
-
expYear: number;
|
|
239
|
-
} | null;
|
|
240
|
-
}
|
|
241
|
-
interface FunnelState {
|
|
242
|
-
funnelId: string;
|
|
243
|
-
campaignId: string;
|
|
244
|
-
sessionId: string | null;
|
|
245
|
-
variables: Record<string, VariableValue>;
|
|
246
|
-
user: UserState;
|
|
247
|
-
responses: Record<string, VariableValue>;
|
|
248
|
-
queryParams: Record<string, string>;
|
|
249
|
-
navigation: NavigationState;
|
|
250
|
-
products: ProductsState;
|
|
251
|
-
tracking: TrackingState;
|
|
252
|
-
payment: PaymentState;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export type { AppFunnelConfig as A, ConditionConfig as C, EnrichedPriceData as E, FunnelState as F, LocaleState as L, NavigationState as N, PageDefinition as P, RouteConfig as R, TranslationState as T, UserState as U, VariableValue as V, ProductsState as a, TrackingState as b, PaymentState as c, ConditionGroupConfig as d, FunnelSettings as e, PageConfig as f, PageState as g, PageType as h, ProductConfig as i, ProductsConfig as j, Progress as k, RuntimeProduct as l, VariableConfig as m, VariableType as n };
|