@nikthegeek/dreamsforlittles-shared 0.1.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/auth.d.ts ADDED
@@ -0,0 +1,212 @@
1
+ import { z } from "zod";
2
+ import { authMeResponseSchema } from "./access.js";
3
+ export declare const onboardFamilyRequestSchema: z.ZodObject<{
4
+ name: z.ZodString;
5
+ email: z.ZodOptional<z.ZodString>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ name: string;
8
+ email?: string | undefined;
9
+ }, {
10
+ name: string;
11
+ email?: string | undefined;
12
+ }>;
13
+ export declare const onboardCoachRequestSchema: z.ZodObject<{
14
+ name: z.ZodString;
15
+ displayName: z.ZodOptional<z.ZodString>;
16
+ email: z.ZodOptional<z.ZodString>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ name: string;
19
+ email?: string | undefined;
20
+ displayName?: string | undefined;
21
+ }, {
22
+ name: string;
23
+ email?: string | undefined;
24
+ displayName?: string | undefined;
25
+ }>;
26
+ export declare const updateProfileRequestSchema: z.ZodObject<{
27
+ name: z.ZodString;
28
+ }, "strip", z.ZodTypeAny, {
29
+ name: string;
30
+ }, {
31
+ name: string;
32
+ }>;
33
+ export declare const onboardingResponseSchema: z.ZodObject<{
34
+ session: z.ZodObject<{
35
+ auth: z.ZodObject<{
36
+ state: z.ZodLiteral<"authenticated">;
37
+ authUserId: z.ZodString;
38
+ authSessionId: z.ZodOptional<z.ZodString>;
39
+ email: z.ZodOptional<z.ZodString>;
40
+ }, "strip", z.ZodTypeAny, {
41
+ authUserId: string;
42
+ state: "authenticated";
43
+ email?: string | undefined;
44
+ authSessionId?: string | undefined;
45
+ }, {
46
+ authUserId: string;
47
+ state: "authenticated";
48
+ email?: string | undefined;
49
+ authSessionId?: string | undefined;
50
+ }>;
51
+ actorUser: z.ZodObject<{
52
+ id: z.ZodString;
53
+ authUserId: z.ZodString;
54
+ email: z.ZodString;
55
+ name: z.ZodString;
56
+ defaultRole: z.ZodEnum<["family", "coach", "superAdmin"]>;
57
+ roles: z.ZodObject<{
58
+ family: z.ZodBoolean;
59
+ coach: z.ZodBoolean;
60
+ superAdmin: z.ZodBoolean;
61
+ }, "strip", z.ZodTypeAny, {
62
+ family: boolean;
63
+ coach: boolean;
64
+ superAdmin: boolean;
65
+ }, {
66
+ family: boolean;
67
+ coach: boolean;
68
+ superAdmin: boolean;
69
+ }>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ id: string;
72
+ authUserId: string;
73
+ email: string;
74
+ name: string;
75
+ defaultRole: "family" | "coach" | "superAdmin";
76
+ roles: {
77
+ family: boolean;
78
+ coach: boolean;
79
+ superAdmin: boolean;
80
+ };
81
+ }, {
82
+ id: string;
83
+ authUserId: string;
84
+ email: string;
85
+ name: string;
86
+ defaultRole: "family" | "coach" | "superAdmin";
87
+ roles: {
88
+ family: boolean;
89
+ coach: boolean;
90
+ superAdmin: boolean;
91
+ };
92
+ }>;
93
+ actorRoles: z.ZodObject<{
94
+ family: z.ZodBoolean;
95
+ coach: z.ZodBoolean;
96
+ superAdmin: z.ZodBoolean;
97
+ }, "strip", z.ZodTypeAny, {
98
+ family: boolean;
99
+ coach: boolean;
100
+ superAdmin: boolean;
101
+ }, {
102
+ family: boolean;
103
+ coach: boolean;
104
+ superAdmin: boolean;
105
+ }>;
106
+ }, "strip", z.ZodTypeAny, {
107
+ auth: {
108
+ authUserId: string;
109
+ state: "authenticated";
110
+ email?: string | undefined;
111
+ authSessionId?: string | undefined;
112
+ };
113
+ actorUser: {
114
+ id: string;
115
+ authUserId: string;
116
+ email: string;
117
+ name: string;
118
+ defaultRole: "family" | "coach" | "superAdmin";
119
+ roles: {
120
+ family: boolean;
121
+ coach: boolean;
122
+ superAdmin: boolean;
123
+ };
124
+ };
125
+ actorRoles: {
126
+ family: boolean;
127
+ coach: boolean;
128
+ superAdmin: boolean;
129
+ };
130
+ }, {
131
+ auth: {
132
+ authUserId: string;
133
+ state: "authenticated";
134
+ email?: string | undefined;
135
+ authSessionId?: string | undefined;
136
+ };
137
+ actorUser: {
138
+ id: string;
139
+ authUserId: string;
140
+ email: string;
141
+ name: string;
142
+ defaultRole: "family" | "coach" | "superAdmin";
143
+ roles: {
144
+ family: boolean;
145
+ coach: boolean;
146
+ superAdmin: boolean;
147
+ };
148
+ };
149
+ actorRoles: {
150
+ family: boolean;
151
+ coach: boolean;
152
+ superAdmin: boolean;
153
+ };
154
+ }>;
155
+ }, "strip", z.ZodTypeAny, {
156
+ session: {
157
+ auth: {
158
+ authUserId: string;
159
+ state: "authenticated";
160
+ email?: string | undefined;
161
+ authSessionId?: string | undefined;
162
+ };
163
+ actorUser: {
164
+ id: string;
165
+ authUserId: string;
166
+ email: string;
167
+ name: string;
168
+ defaultRole: "family" | "coach" | "superAdmin";
169
+ roles: {
170
+ family: boolean;
171
+ coach: boolean;
172
+ superAdmin: boolean;
173
+ };
174
+ };
175
+ actorRoles: {
176
+ family: boolean;
177
+ coach: boolean;
178
+ superAdmin: boolean;
179
+ };
180
+ };
181
+ }, {
182
+ session: {
183
+ auth: {
184
+ authUserId: string;
185
+ state: "authenticated";
186
+ email?: string | undefined;
187
+ authSessionId?: string | undefined;
188
+ };
189
+ actorUser: {
190
+ id: string;
191
+ authUserId: string;
192
+ email: string;
193
+ name: string;
194
+ defaultRole: "family" | "coach" | "superAdmin";
195
+ roles: {
196
+ family: boolean;
197
+ coach: boolean;
198
+ superAdmin: boolean;
199
+ };
200
+ };
201
+ actorRoles: {
202
+ family: boolean;
203
+ coach: boolean;
204
+ superAdmin: boolean;
205
+ };
206
+ };
207
+ }>;
208
+ export { authMeResponseSchema };
209
+ export type OnboardFamilyRequest = z.infer<typeof onboardFamilyRequestSchema>;
210
+ export type OnboardCoachRequest = z.infer<typeof onboardCoachRequestSchema>;
211
+ export type UpdateProfileRequest = z.infer<typeof updateProfileRequestSchema>;
212
+ export type OnboardingResponse = z.infer<typeof onboardingResponseSchema>;
package/dist/auth.js ADDED
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ import { authMeResponseSchema, sessionContextSchema } from "./access.js";
3
+ export const onboardFamilyRequestSchema = z.object({
4
+ name: z.string().min(1),
5
+ email: z.string().email().optional()
6
+ });
7
+ export const onboardCoachRequestSchema = z.object({
8
+ name: z.string().min(1),
9
+ displayName: z.string().min(1).optional(),
10
+ email: z.string().email().optional()
11
+ });
12
+ export const updateProfileRequestSchema = z.object({
13
+ name: z.string().trim().min(1)
14
+ });
15
+ export const onboardingResponseSchema = z.object({
16
+ session: sessionContextSchema
17
+ });
18
+ export { authMeResponseSchema };
19
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC/B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,oBAAoB;CAC9B,CAAC,CAAC;AAEH,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ export declare const billingCadenceSchema: z.ZodEnum<["monthly", "yearly"]>;
3
+ export type BillingCadence = "monthly" | "yearly";
4
+ export type SubscriptionPlanAudience = "family" | "coach";
5
+ export type SubscriptionPlan = {
6
+ id: string;
7
+ audience: SubscriptionPlanAudience;
8
+ name: string;
9
+ cadence: BillingCadence;
10
+ priceGbpPence: number;
11
+ description: string;
12
+ includedActiveFamilies?: number;
13
+ extraFamilyPriceGbpPence?: number;
14
+ featured?: boolean;
15
+ };
16
+ export declare const familySubscriptionPlans: SubscriptionPlan[];
17
+ export declare const coachSubscriptionPlans: SubscriptionPlan[];
18
+ export declare const formatGbp: (priceGbpPence: number) => string;
@@ -0,0 +1,60 @@
1
+ import { z } from "zod";
2
+ export const billingCadenceSchema = z.enum(["monthly", "yearly"]);
3
+ export const familySubscriptionPlans = [
4
+ {
5
+ id: "family-monthly",
6
+ audience: "family",
7
+ name: "Monthly",
8
+ cadence: "monthly",
9
+ priceGbpPence: 500,
10
+ description: "Flexible premium access for one family."
11
+ },
12
+ {
13
+ id: "family-yearly",
14
+ audience: "family",
15
+ name: "Yearly",
16
+ cadence: "yearly",
17
+ priceGbpPence: 5000,
18
+ description: "Two months free compared with monthly billing.",
19
+ featured: true
20
+ }
21
+ ];
22
+ export const coachSubscriptionPlans = [
23
+ {
24
+ id: "coach-starter",
25
+ audience: "coach",
26
+ name: "Coach Starter",
27
+ cadence: "monthly",
28
+ priceGbpPence: 1700,
29
+ includedActiveFamilies: 10,
30
+ extraFamilyPriceGbpPence: 200,
31
+ description: "For independent coaches supporting an active starter client list."
32
+ },
33
+ {
34
+ id: "coach-growth",
35
+ audience: "coach",
36
+ name: "Coach Growth",
37
+ cadence: "monthly",
38
+ priceGbpPence: 3400,
39
+ includedActiveFamilies: 25,
40
+ extraFamilyPriceGbpPence: 150,
41
+ description: "For coaches with a larger recurring family caseload.",
42
+ featured: true
43
+ },
44
+ {
45
+ id: "coach-clinic",
46
+ audience: "coach",
47
+ name: "Clinic",
48
+ cadence: "monthly",
49
+ priceGbpPence: 7900,
50
+ includedActiveFamilies: 75,
51
+ extraFamilyPriceGbpPence: 100,
52
+ description: "For practices and teams; keep as contact-us until team billing is scoped."
53
+ }
54
+ ];
55
+ export const formatGbp = (priceGbpPence) => new Intl.NumberFormat("en-GB", {
56
+ style: "currency",
57
+ currency: "GBP",
58
+ maximumFractionDigits: priceGbpPence % 100 === 0 ? 0 : 2
59
+ }).format(priceGbpPence / 100);
60
+ //# sourceMappingURL=billing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.js","sourceRoot":"","sources":["../src/billing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAiBlE,MAAM,CAAC,MAAM,uBAAuB,GAAuB;IACzD;QACE,EAAE,EAAE,gBAAgB;QACpB,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,SAAS;QAClB,aAAa,EAAE,GAAG;QAClB,WAAW,EAAE,yCAAyC;KACvD;IACD;QACE,EAAE,EAAE,eAAe;QACnB,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,QAAQ;QACjB,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,gDAAgD;QAC7D,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAEF,MAAM,CAAC,MA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