@fytkit/sdk 0.3.0 → 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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +99 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ All notable changes to `@fytkit/sdk` are documented in this file.
|
|
|
4
4
|
Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/).
|
|
5
5
|
Versioning: [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.4.0](https://github.com/cbarlow1993/fytkit-web/compare/@fytkit/sdk@0.3.0...@fytkit/sdk@0.4.0) (2026-06-13)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **monetization:** per-plan member entitlements + public checkout via API/SDK ([#111](https://github.com/cbarlow1993/fytkit-web/issues/111)) ([47f828f](https://github.com/cbarlow1993/fytkit-web/commit/47f828f10e27f34731bae1c4087c5a31aca4a0d8))
|
|
13
|
+
|
|
7
14
|
## [0.3.0](https://github.com/cbarlow1993/fytkit-web/compare/@fytkit/sdk@0.2.2...@fytkit/sdk@0.3.0) (2026-06-03)
|
|
8
15
|
|
|
9
16
|
|
package/dist/index.d.ts
CHANGED
|
@@ -18,12 +18,15 @@ import { ZodObject } from 'zod';
|
|
|
18
18
|
import { ZodOptional } from 'zod';
|
|
19
19
|
import { ZodReadonly } from 'zod';
|
|
20
20
|
import { ZodString } from 'zod';
|
|
21
|
+
import { ZodUnion } from 'zod';
|
|
21
22
|
|
|
22
23
|
declare interface ApiKeyContext {
|
|
23
24
|
readonly trainerId: string;
|
|
24
25
|
readonly clientId?: string;
|
|
25
26
|
readonly hasActiveSubscription: boolean;
|
|
27
|
+
readonly clientEntitlements: ClientEntitlements;
|
|
26
28
|
readonly authMode: "session" | "api-key" | "dev-app";
|
|
29
|
+
readonly appAllowedOrigins?: readonly string[];
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
/** Auth-state events emitted on `onAuthStateChange`. */
|
|
@@ -47,6 +50,19 @@ export declare type AuthState = {
|
|
|
47
50
|
readonly type: "signed_out_due_to_token_reuse";
|
|
48
51
|
};
|
|
49
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Member-facing plan features. Each code maps 1:1 onto a premium content
|
|
55
|
+
* domain gated by the public API (`src/server/public-api/content-gating.ts`).
|
|
56
|
+
* A trainer toggles these per pricing tier; a member's active subscription
|
|
57
|
+
* grants the codes attached to the tier they bought.
|
|
58
|
+
*
|
|
59
|
+
* Distinct from `catalogue.ts`, which is the *trainer*-side entitlement
|
|
60
|
+
* catalogue driven by the trainer's fytkit subscription.
|
|
61
|
+
*/
|
|
62
|
+
declare type ClientEntitlementCode = "premium_workouts" | "premium_programs" | "premium_nutrition" | "premium_recipes" | "premium_articles";
|
|
63
|
+
|
|
64
|
+
declare type ClientEntitlements = readonly ClientEntitlementCode[] | "all";
|
|
65
|
+
|
|
50
66
|
export declare function createFytkitClient(options: FytkitClientOptions): FytkitClient;
|
|
51
67
|
|
|
52
68
|
/**
|
|
@@ -154,7 +170,9 @@ declare const publicRouter: {
|
|
|
154
170
|
appId: string;
|
|
155
171
|
clientId: string | undefined;
|
|
156
172
|
hasActiveSubscription: boolean;
|
|
173
|
+
clientEntitlements: ClientEntitlements;
|
|
157
174
|
authMode: "dev-app";
|
|
175
|
+
appAllowedOrigins: string[];
|
|
158
176
|
}>, ZodObject< {
|
|
159
177
|
email: ZodString;
|
|
160
178
|
password: ZodString;
|
|
@@ -184,7 +202,9 @@ declare const publicRouter: {
|
|
|
184
202
|
appId: string;
|
|
185
203
|
clientId: string | undefined;
|
|
186
204
|
hasActiveSubscription: boolean;
|
|
205
|
+
clientEntitlements: ClientEntitlements;
|
|
187
206
|
authMode: "dev-app";
|
|
207
|
+
appAllowedOrigins: string[];
|
|
188
208
|
}>, ZodObject< {
|
|
189
209
|
email: ZodString;
|
|
190
210
|
password: ZodString;
|
|
@@ -222,7 +242,9 @@ declare const publicRouter: {
|
|
|
222
242
|
appId: string;
|
|
223
243
|
clientId: string | undefined;
|
|
224
244
|
hasActiveSubscription: boolean;
|
|
245
|
+
clientEntitlements: ClientEntitlements;
|
|
225
246
|
authMode: "dev-app";
|
|
247
|
+
appAllowedOrigins: string[];
|
|
226
248
|
}>, ZodObject< {
|
|
227
249
|
token: ZodString;
|
|
228
250
|
}, $strip>, ZodObject< {
|
|
@@ -243,7 +265,9 @@ declare const publicRouter: {
|
|
|
243
265
|
appId: string;
|
|
244
266
|
clientId: string | undefined;
|
|
245
267
|
hasActiveSubscription: boolean;
|
|
268
|
+
clientEntitlements: ClientEntitlements;
|
|
246
269
|
authMode: "dev-app";
|
|
270
|
+
appAllowedOrigins: string[];
|
|
247
271
|
}>, ZodObject< {
|
|
248
272
|
token: ZodString;
|
|
249
273
|
}, $strip>, ZodObject< {
|
|
@@ -271,7 +295,9 @@ declare const publicRouter: {
|
|
|
271
295
|
appId: string;
|
|
272
296
|
clientId: string | undefined;
|
|
273
297
|
hasActiveSubscription: boolean;
|
|
298
|
+
clientEntitlements: ClientEntitlements;
|
|
274
299
|
authMode: "dev-app";
|
|
300
|
+
appAllowedOrigins: string[];
|
|
275
301
|
}>, ZodObject< {
|
|
276
302
|
email: ZodString;
|
|
277
303
|
}, $strip>, ZodObject< {
|
|
@@ -292,7 +318,9 @@ declare const publicRouter: {
|
|
|
292
318
|
appId: string;
|
|
293
319
|
clientId: string | undefined;
|
|
294
320
|
hasActiveSubscription: boolean;
|
|
321
|
+
clientEntitlements: ClientEntitlements;
|
|
295
322
|
authMode: "dev-app";
|
|
323
|
+
appAllowedOrigins: string[];
|
|
296
324
|
}>, ZodObject< {
|
|
297
325
|
token: ZodString;
|
|
298
326
|
password: ZodString;
|
|
@@ -314,7 +342,9 @@ declare const publicRouter: {
|
|
|
314
342
|
appId: string;
|
|
315
343
|
clientId: string | undefined;
|
|
316
344
|
hasActiveSubscription: boolean;
|
|
345
|
+
clientEntitlements: ClientEntitlements;
|
|
317
346
|
authMode: "dev-app";
|
|
347
|
+
appAllowedOrigins: string[];
|
|
318
348
|
}>, ZodObject< {
|
|
319
349
|
token: ZodString;
|
|
320
350
|
}, $strip>, ZodObject< {
|
|
@@ -335,7 +365,9 @@ declare const publicRouter: {
|
|
|
335
365
|
appId: string;
|
|
336
366
|
clientId: string | undefined;
|
|
337
367
|
hasActiveSubscription: boolean;
|
|
368
|
+
clientEntitlements: ClientEntitlements;
|
|
338
369
|
authMode: "dev-app";
|
|
370
|
+
appAllowedOrigins: string[];
|
|
339
371
|
}>, ZodObject< {
|
|
340
372
|
password: ZodString;
|
|
341
373
|
}, $strip>, ZodObject< {
|
|
@@ -357,7 +389,9 @@ declare const publicRouter: {
|
|
|
357
389
|
appId: string;
|
|
358
390
|
clientId: string | undefined;
|
|
359
391
|
hasActiveSubscription: boolean;
|
|
392
|
+
clientEntitlements: ClientEntitlements;
|
|
360
393
|
authMode: "dev-app";
|
|
394
|
+
appAllowedOrigins: string[];
|
|
361
395
|
}>, ZodObject< {
|
|
362
396
|
code: ZodString;
|
|
363
397
|
}, $strip>, ZodObject< {
|
|
@@ -379,7 +413,9 @@ declare const publicRouter: {
|
|
|
379
413
|
appId: string;
|
|
380
414
|
clientId: string | undefined;
|
|
381
415
|
hasActiveSubscription: boolean;
|
|
416
|
+
clientEntitlements: ClientEntitlements;
|
|
382
417
|
authMode: "dev-app";
|
|
418
|
+
appAllowedOrigins: string[];
|
|
383
419
|
}>, ZodObject< {
|
|
384
420
|
password: ZodString;
|
|
385
421
|
}, $strip>, ZodObject< {
|
|
@@ -400,7 +436,9 @@ declare const publicRouter: {
|
|
|
400
436
|
appId: string;
|
|
401
437
|
clientId: string | undefined;
|
|
402
438
|
hasActiveSubscription: boolean;
|
|
439
|
+
clientEntitlements: ClientEntitlements;
|
|
403
440
|
authMode: "dev-app";
|
|
441
|
+
appAllowedOrigins: string[];
|
|
404
442
|
}>, ZodObject< {
|
|
405
443
|
password: ZodString;
|
|
406
444
|
}, $strip>, ZodObject< {
|
|
@@ -421,7 +459,9 @@ declare const publicRouter: {
|
|
|
421
459
|
appId: string;
|
|
422
460
|
clientId: string | undefined;
|
|
423
461
|
hasActiveSubscription: boolean;
|
|
462
|
+
clientEntitlements: ClientEntitlements;
|
|
424
463
|
authMode: "dev-app";
|
|
464
|
+
appAllowedOrigins: string[];
|
|
425
465
|
}>, ZodObject< {
|
|
426
466
|
token: ZodString;
|
|
427
467
|
code: ZodString;
|
|
@@ -450,7 +490,9 @@ declare const publicRouter: {
|
|
|
450
490
|
appId: string;
|
|
451
491
|
clientId: string | undefined;
|
|
452
492
|
hasActiveSubscription: boolean;
|
|
493
|
+
clientEntitlements: ClientEntitlements;
|
|
453
494
|
authMode: "dev-app";
|
|
495
|
+
appAllowedOrigins: string[];
|
|
454
496
|
}>, ZodObject< {
|
|
455
497
|
token: ZodString;
|
|
456
498
|
code: ZodString;
|
|
@@ -479,7 +521,9 @@ declare const publicRouter: {
|
|
|
479
521
|
appId: string;
|
|
480
522
|
clientId: string | undefined;
|
|
481
523
|
hasActiveSubscription: boolean;
|
|
524
|
+
clientEntitlements: ClientEntitlements;
|
|
482
525
|
authMode: "dev-app";
|
|
526
|
+
appAllowedOrigins: string[];
|
|
483
527
|
}>, ZodObject< {
|
|
484
528
|
token: ZodString;
|
|
485
529
|
}, $strip>, ZodObject< {
|
|
@@ -500,7 +544,9 @@ declare const publicRouter: {
|
|
|
500
544
|
appId: string;
|
|
501
545
|
clientId: string | undefined;
|
|
502
546
|
hasActiveSubscription: boolean;
|
|
547
|
+
clientEntitlements: ClientEntitlements;
|
|
503
548
|
authMode: "dev-app";
|
|
549
|
+
appAllowedOrigins: string[];
|
|
504
550
|
}>, ZodObject< {
|
|
505
551
|
token: ZodString;
|
|
506
552
|
code: ZodString;
|
|
@@ -529,7 +575,9 @@ declare const publicRouter: {
|
|
|
529
575
|
appId: string;
|
|
530
576
|
clientId: string | undefined;
|
|
531
577
|
hasActiveSubscription: boolean;
|
|
578
|
+
clientEntitlements: ClientEntitlements;
|
|
532
579
|
authMode: "dev-app";
|
|
580
|
+
appAllowedOrigins: string[];
|
|
533
581
|
}>, ZodOptional<ZodObject< {}, $strip>>, ZodObject< {
|
|
534
582
|
data: ZodObject< {
|
|
535
583
|
twoFactorEnabled: ZodBoolean;
|
|
@@ -1960,11 +2008,22 @@ declare const publicRouter: {
|
|
|
1960
2008
|
data: ZodObject< {
|
|
1961
2009
|
currency: ZodString;
|
|
1962
2010
|
plans: ZodArray<ZodObject< {
|
|
2011
|
+
id: ZodString;
|
|
1963
2012
|
name: ZodString;
|
|
1964
2013
|
monthlyPriceCents: ZodNumber;
|
|
1965
2014
|
description: ZodString;
|
|
1966
2015
|
sortOrder: ZodNumber;
|
|
1967
2016
|
hasStripe: ZodBoolean;
|
|
2017
|
+
entitlements: ZodArray<ZodObject< {
|
|
2018
|
+
code: ZodEnum< {
|
|
2019
|
+
premium_workouts: "premium_workouts";
|
|
2020
|
+
premium_programs: "premium_programs";
|
|
2021
|
+
premium_nutrition: "premium_nutrition";
|
|
2022
|
+
premium_recipes: "premium_recipes";
|
|
2023
|
+
premium_articles: "premium_articles";
|
|
2024
|
+
}>;
|
|
2025
|
+
label: ZodString;
|
|
2026
|
+
}, $strip>>;
|
|
1968
2027
|
}, $strip>>;
|
|
1969
2028
|
}, $strip>;
|
|
1970
2029
|
}, $strip>, Record<never, never>, Record<never, never>>;
|
|
@@ -1985,6 +2044,8 @@ declare const publicRouter: {
|
|
|
1985
2044
|
premium: "premium";
|
|
1986
2045
|
basic: "basic";
|
|
1987
2046
|
}>;
|
|
2047
|
+
planId: ZodNullable<ZodString>;
|
|
2048
|
+
planName: ZodNullable<ZodString>;
|
|
1988
2049
|
status: ZodEnum< {
|
|
1989
2050
|
active: "active";
|
|
1990
2051
|
cancelled: "cancelled";
|
|
@@ -1993,6 +2054,44 @@ declare const publicRouter: {
|
|
|
1993
2054
|
startedAt: ZodNullable<ZodDate>;
|
|
1994
2055
|
expiresAt: ZodNullable<ZodDate>;
|
|
1995
2056
|
}, $strip>>;
|
|
2057
|
+
entitlements: ZodUnion<readonly [ZodLiteral<"all">, ZodArray<ZodEnum< {
|
|
2058
|
+
premium_workouts: "premium_workouts";
|
|
2059
|
+
premium_programs: "premium_programs";
|
|
2060
|
+
premium_nutrition: "premium_nutrition";
|
|
2061
|
+
premium_recipes: "premium_recipes";
|
|
2062
|
+
premium_articles: "premium_articles";
|
|
2063
|
+
}>>]>;
|
|
2064
|
+
}, $strip>;
|
|
2065
|
+
}, $strip>, Record<never, never>, Record<never, never>>;
|
|
2066
|
+
createCheckout: DecoratedProcedure<MergedInitialContext< {
|
|
2067
|
+
headers: Headers;
|
|
2068
|
+
} & Record<never, never>, {
|
|
2069
|
+
headers: Headers;
|
|
2070
|
+
} & Record<never, never>, {
|
|
2071
|
+
headers: Headers;
|
|
2072
|
+
}>, MergedCurrentContext< {
|
|
2073
|
+
headers: Headers;
|
|
2074
|
+
}, ApiKeyContext>, ZodObject< {
|
|
2075
|
+
planId: ZodString;
|
|
2076
|
+
returnUrl: ZodOptional<ZodString>;
|
|
2077
|
+
}, $strip>, ZodObject< {
|
|
2078
|
+
data: ZodObject< {
|
|
2079
|
+
url: ZodString;
|
|
2080
|
+
}, $strip>;
|
|
2081
|
+
}, $strip>, Record<never, never>, Record<never, never>>;
|
|
2082
|
+
createPortal: DecoratedProcedure<MergedInitialContext< {
|
|
2083
|
+
headers: Headers;
|
|
2084
|
+
} & Record<never, never>, {
|
|
2085
|
+
headers: Headers;
|
|
2086
|
+
} & Record<never, never>, {
|
|
2087
|
+
headers: Headers;
|
|
2088
|
+
}>, MergedCurrentContext< {
|
|
2089
|
+
headers: Headers;
|
|
2090
|
+
}, ApiKeyContext>, ZodObject< {
|
|
2091
|
+
returnUrl: ZodOptional<ZodString>;
|
|
2092
|
+
}, $strip>, ZodObject< {
|
|
2093
|
+
data: ZodObject< {
|
|
2094
|
+
url: ZodString;
|
|
1996
2095
|
}, $strip>;
|
|
1997
2096
|
}, $strip>, Record<never, never>, Record<never, never>>;
|
|
1998
2097
|
};
|