@nikthegeek/dreamsforlittles-shared 0.1.0 → 0.1.2
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/access.d.ts +2450 -30
- package/dist/access.js +63 -4
- package/dist/access.js.map +1 -1
- package/dist/admin.d.ts +12635 -1041
- package/dist/admin.js +554 -4
- package/dist/admin.js.map +1 -1
- package/dist/allergy-ladders.d.ts +563 -80
- package/dist/allergy-ladders.js +40 -0
- package/dist/allergy-ladders.js.map +1 -1
- package/dist/analysis.d.ts +68 -46
- package/dist/analysis.js +10 -2
- package/dist/analysis.js.map +1 -1
- package/dist/api.d.ts +12 -5
- package/dist/api.js +12 -0
- package/dist/api.js.map +1 -1
- package/dist/app-feedback.d.ts +322 -0
- package/dist/app-feedback.js +58 -0
- package/dist/app-feedback.js.map +1 -0
- package/dist/auth.d.ts +684 -0
- package/dist/auth.js +45 -4
- package/dist/auth.js.map +1 -1
- package/dist/billing.d.ts +47 -2
- package/dist/billing.js +56 -29
- package/dist/billing.js.map +1 -1
- package/dist/client-notices.d.ts +6114 -0
- package/dist/client-notices.js +455 -0
- package/dist/client-notices.js.map +1 -0
- package/dist/coach.d.ts +20178 -206
- package/dist/coach.js +329 -18
- package/dist/coach.js.map +1 -1
- package/dist/communication-preferences.d.ts +61 -0
- package/dist/communication-preferences.js +30 -0
- package/dist/communication-preferences.js.map +1 -0
- package/dist/enums.d.ts +6 -2
- package/dist/enums.js +27 -1
- package/dist/enums.js.map +1 -1
- package/dist/errors.d.ts +9 -4
- package/dist/errors.js +9 -2
- package/dist/errors.js.map +1 -1
- package/dist/family-invitations.d.ts +2289 -0
- package/dist/family-invitations.js +77 -0
- package/dist/family-invitations.js.map +1 -0
- package/dist/family-profile-artifacts.d.ts +4433 -0
- package/dist/family-profile-artifacts.js +192 -0
- package/dist/family-profile-artifacts.js.map +1 -0
- package/dist/family.d.ts +7902 -294
- package/dist/family.js +170 -5
- package/dist/family.js.map +1 -1
- package/dist/files.d.ts +17 -14
- package/dist/files.js +5 -1
- package/dist/files.js.map +1 -1
- package/dist/getting-started-guides.d.ts +117 -0
- package/dist/getting-started-guides.js +25 -0
- package/dist/getting-started-guides.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/invites.d.ts +252 -0
- package/dist/invites.js +2 -0
- package/dist/invites.js.map +1 -1
- package/dist/mobile-web-releases.d.ts +389 -0
- package/dist/mobile-web-releases.js +71 -0
- package/dist/mobile-web-releases.js.map +1 -0
- package/dist/notification-banners.d.ts +694 -0
- package/dist/notification-banners.js +132 -0
- package/dist/notification-banners.js.map +1 -0
- package/dist/product-analytics.d.ts +5984 -0
- package/dist/product-analytics.js +791 -0
- package/dist/product-analytics.js.map +1 -0
- package/dist/push-devices.d.ts +175 -0
- package/dist/push-devices.js +56 -0
- package/dist/push-devices.js.map +1 -0
- package/dist/realtime.d.ts +604 -0
- package/dist/realtime.js +152 -0
- package/dist/realtime.js.map +1 -0
- package/dist/review-prompt.d.ts +192 -0
- package/dist/review-prompt.js +72 -0
- package/dist/review-prompt.js.map +1 -0
- package/dist/support-faqs.d.ts +103 -0
- package/dist/support-faqs.js +24 -0
- package/dist/support-faqs.js.map +1 -0
- package/dist/support-tickets.d.ts +605 -0
- package/dist/support-tickets.js +100 -0
- package/dist/support-tickets.js.map +1 -0
- package/package.json +6 -1
package/dist/realtime.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isoDateStringSchema } from "./api.js";
|
|
3
|
+
import { actorRolesSchema } from "./access.js";
|
|
4
|
+
import { userRoleSchema } from "./enums.js";
|
|
5
|
+
export const PLATFORM_REALTIME_SCHEMA_VERSION = 1;
|
|
6
|
+
export const PLATFORM_REALTIME_BROADCAST_EVENT = "platform_event";
|
|
7
|
+
export const PLATFORM_REALTIME_RESOURCE_CHANGED = "resource.changed";
|
|
8
|
+
export const PLATFORM_REALTIME_PRESENCE_TOPIC = "platform:presence:v1";
|
|
9
|
+
export const PLATFORM_REALTIME_PRESENCE_SCHEMA_VERSION = 1;
|
|
10
|
+
export const PLATFORM_REALTIME_PRESENCE_V2_TOPIC = "platform:presence:v2";
|
|
11
|
+
export const PLATFORM_REALTIME_PRESENCE_V2_SCHEMA_VERSION = 2;
|
|
12
|
+
export const platformRealtimeSurfaceSchema = z.enum([
|
|
13
|
+
"mobile-web",
|
|
14
|
+
"admin-web",
|
|
15
|
+
"owner-web"
|
|
16
|
+
]);
|
|
17
|
+
const opaquePresenceKeySchema = z
|
|
18
|
+
.string()
|
|
19
|
+
.min(32)
|
|
20
|
+
.max(128)
|
|
21
|
+
.regex(/^[A-Za-z0-9_-]+$/);
|
|
22
|
+
const opaquePresenceTokenSchema = z.string().min(64).max(1024);
|
|
23
|
+
export const platformRealtimePresenceCredentialSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
schemaVersion: z.literal(PLATFORM_REALTIME_PRESENCE_SCHEMA_VERSION),
|
|
26
|
+
presenceKey: opaquePresenceKeySchema,
|
|
27
|
+
presenceToken: opaquePresenceTokenSchema,
|
|
28
|
+
expiresAt: isoDateStringSchema
|
|
29
|
+
})
|
|
30
|
+
.strict();
|
|
31
|
+
export const platformRealtimePresenceCredentialResponseSchema = z
|
|
32
|
+
.object({
|
|
33
|
+
credential: platformRealtimePresenceCredentialSchema
|
|
34
|
+
})
|
|
35
|
+
.strict();
|
|
36
|
+
export const platformRealtimePresenceTrackPayloadSchema = z
|
|
37
|
+
.object({
|
|
38
|
+
schemaVersion: z.literal(PLATFORM_REALTIME_PRESENCE_SCHEMA_VERSION),
|
|
39
|
+
presenceToken: opaquePresenceTokenSchema,
|
|
40
|
+
surface: platformRealtimeSurfaceSchema
|
|
41
|
+
})
|
|
42
|
+
.strict();
|
|
43
|
+
export const platformRealtimePresenceResolveRequestSchema = z
|
|
44
|
+
.object({
|
|
45
|
+
presences: z
|
|
46
|
+
.array(z
|
|
47
|
+
.object({
|
|
48
|
+
presenceKey: opaquePresenceKeySchema,
|
|
49
|
+
presenceToken: opaquePresenceTokenSchema
|
|
50
|
+
})
|
|
51
|
+
.strict())
|
|
52
|
+
.max(500)
|
|
53
|
+
})
|
|
54
|
+
.strict();
|
|
55
|
+
export const platformRealtimePresenceUserSchema = z
|
|
56
|
+
.object({
|
|
57
|
+
presenceKey: opaquePresenceKeySchema,
|
|
58
|
+
user: z
|
|
59
|
+
.object({
|
|
60
|
+
id: z.string().min(1),
|
|
61
|
+
email: z.string().email(),
|
|
62
|
+
name: z.string().min(1),
|
|
63
|
+
defaultRole: userRoleSchema,
|
|
64
|
+
roles: actorRolesSchema
|
|
65
|
+
})
|
|
66
|
+
.strict()
|
|
67
|
+
})
|
|
68
|
+
.strict();
|
|
69
|
+
export const platformRealtimePresenceResolveResponseSchema = z
|
|
70
|
+
.object({
|
|
71
|
+
users: z.array(platformRealtimePresenceUserSchema)
|
|
72
|
+
})
|
|
73
|
+
.strict();
|
|
74
|
+
export const platformRealtimePresenceV2CredentialSchema = z
|
|
75
|
+
.object({
|
|
76
|
+
schemaVersion: z.literal(PLATFORM_REALTIME_PRESENCE_V2_SCHEMA_VERSION),
|
|
77
|
+
presenceKey: opaquePresenceKeySchema,
|
|
78
|
+
presenceToken: opaquePresenceTokenSchema,
|
|
79
|
+
expiresAt: isoDateStringSchema
|
|
80
|
+
})
|
|
81
|
+
.strict();
|
|
82
|
+
export const platformRealtimePresenceV2CredentialResponseSchema = z
|
|
83
|
+
.object({
|
|
84
|
+
credential: platformRealtimePresenceV2CredentialSchema
|
|
85
|
+
})
|
|
86
|
+
.strict();
|
|
87
|
+
export const platformRealtimePresenceV2TrackPayloadSchema = z
|
|
88
|
+
.object({
|
|
89
|
+
schemaVersion: z.literal(PLATFORM_REALTIME_PRESENCE_V2_SCHEMA_VERSION),
|
|
90
|
+
presenceToken: opaquePresenceTokenSchema,
|
|
91
|
+
surface: platformRealtimeSurfaceSchema
|
|
92
|
+
})
|
|
93
|
+
.strict();
|
|
94
|
+
export const platformRealtimePresenceV2ResolveRequestSchema = z
|
|
95
|
+
.object({
|
|
96
|
+
presences: z
|
|
97
|
+
.array(z
|
|
98
|
+
.object({
|
|
99
|
+
presenceKey: opaquePresenceKeySchema,
|
|
100
|
+
presenceToken: opaquePresenceTokenSchema
|
|
101
|
+
})
|
|
102
|
+
.strict())
|
|
103
|
+
.max(500)
|
|
104
|
+
})
|
|
105
|
+
.strict();
|
|
106
|
+
export const platformRealtimePresenceV2UserSchema = platformRealtimePresenceUserSchema;
|
|
107
|
+
export const platformRealtimePresenceV2ResolveResponseSchema = z
|
|
108
|
+
.object({
|
|
109
|
+
users: z.array(platformRealtimePresenceV2UserSchema)
|
|
110
|
+
})
|
|
111
|
+
.strict();
|
|
112
|
+
export const supabaseAuthUserIdSchema = z
|
|
113
|
+
.string()
|
|
114
|
+
.uuid()
|
|
115
|
+
.transform((value) => value.toLowerCase());
|
|
116
|
+
export const platformRealtimeEventTypeSchema = z.literal(PLATFORM_REALTIME_RESOURCE_CHANGED);
|
|
117
|
+
export const platformRealtimeResourceSchema = z
|
|
118
|
+
.object({
|
|
119
|
+
kind: z
|
|
120
|
+
.string()
|
|
121
|
+
.trim()
|
|
122
|
+
.min(1)
|
|
123
|
+
.max(64)
|
|
124
|
+
.regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/),
|
|
125
|
+
id: z
|
|
126
|
+
.string()
|
|
127
|
+
.trim()
|
|
128
|
+
.min(1)
|
|
129
|
+
.max(128)
|
|
130
|
+
.regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/)
|
|
131
|
+
.optional()
|
|
132
|
+
})
|
|
133
|
+
.strict();
|
|
134
|
+
/**
|
|
135
|
+
* A small invalidation hint. REST remains the source of truth, so realtime
|
|
136
|
+
* events deliberately cannot carry arbitrary records or metadata.
|
|
137
|
+
*/
|
|
138
|
+
export const platformRealtimeEventInputSchema = z
|
|
139
|
+
.object({
|
|
140
|
+
type: platformRealtimeEventTypeSchema,
|
|
141
|
+
resource: platformRealtimeResourceSchema
|
|
142
|
+
})
|
|
143
|
+
.strict();
|
|
144
|
+
export const platformRealtimeEventSchema = platformRealtimeEventInputSchema
|
|
145
|
+
.extend({
|
|
146
|
+
schemaVersion: z.literal(PLATFORM_REALTIME_SCHEMA_VERSION),
|
|
147
|
+
eventId: z.string().uuid(),
|
|
148
|
+
occurredAt: isoDateStringSchema
|
|
149
|
+
})
|
|
150
|
+
.strict();
|
|
151
|
+
export const platformRealtimeUserTopic = (authUserId) => `user:${supabaseAuthUserIdSchema.parse(authUserId)}:events`;
|
|
152
|
+
//# sourceMappingURL=realtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime.js","sourceRoot":"","sources":["../src/realtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAU,CAAC;AAC3D,MAAM,CAAC,MAAM,iCAAiC,GAAG,gBAAyB,CAAC;AAC3E,MAAM,CAAC,MAAM,kCAAkC,GAAG,kBAA2B,CAAC;AAC9E,MAAM,CAAC,MAAM,gCAAgC,GAAG,sBAA+B,CAAC;AAChF,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAU,CAAC;AACpE,MAAM,CAAC,MAAM,mCAAmC,GAAG,sBAA+B,CAAC;AACnF,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAU,CAAC;AAEvE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,IAAI,CAAC;IAClD,YAAY;IACZ,WAAW;IACX,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,CAAC;KAC9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,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC1B,UAAU,EAAE,mBAAmB;CAChC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,UAAkB,EAAU,EAAE,CACtE,QAAQ,wBAAwB,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const REQUIRED_REVIEW_ACTIVITY_DAYS = 7;
|
|
3
|
+
export declare const REVIEW_PROMPT_COOLDOWN_MONTHS = 6;
|
|
4
|
+
export declare const storeReviewPlatformSchema: z.ZodEnum<["ios", "android"]>;
|
|
5
|
+
export declare const reviewPromptStateSchema: z.ZodObject<{
|
|
6
|
+
trackedActivityDayKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
7
|
+
firstEligibleAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
lastRequestedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
lastRequestedAppVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
|
+
lastRequestedPlatform: z.ZodOptional<z.ZodNullable<z.ZodEnum<["ios", "android"]>>>;
|
|
11
|
+
nextAllowedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
trackedActivityDayKeys: string[];
|
|
14
|
+
firstEligibleAt?: string | null | undefined;
|
|
15
|
+
lastRequestedAt?: string | null | undefined;
|
|
16
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
17
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
18
|
+
nextAllowedAt?: string | null | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
trackedActivityDayKeys?: string[] | undefined;
|
|
21
|
+
firstEligibleAt?: string | null | undefined;
|
|
22
|
+
lastRequestedAt?: string | null | undefined;
|
|
23
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
24
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
25
|
+
nextAllowedAt?: string | null | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const reviewPromptResponseSchema: z.ZodObject<{
|
|
28
|
+
reviewPrompt: z.ZodObject<{
|
|
29
|
+
trackedActivityDayKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
30
|
+
firstEligibleAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
lastRequestedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
lastRequestedAppVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
lastRequestedPlatform: z.ZodOptional<z.ZodNullable<z.ZodEnum<["ios", "android"]>>>;
|
|
34
|
+
nextAllowedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
trackedActivityDayKeys: string[];
|
|
37
|
+
firstEligibleAt?: string | null | undefined;
|
|
38
|
+
lastRequestedAt?: string | null | undefined;
|
|
39
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
40
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
41
|
+
nextAllowedAt?: string | null | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
trackedActivityDayKeys?: string[] | undefined;
|
|
44
|
+
firstEligibleAt?: string | null | undefined;
|
|
45
|
+
lastRequestedAt?: string | null | undefined;
|
|
46
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
47
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
48
|
+
nextAllowedAt?: string | null | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
selectedBabyId: z.ZodNullable<z.ZodString>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
selectedBabyId: string | null;
|
|
53
|
+
reviewPrompt: {
|
|
54
|
+
trackedActivityDayKeys: string[];
|
|
55
|
+
firstEligibleAt?: string | null | undefined;
|
|
56
|
+
lastRequestedAt?: string | null | undefined;
|
|
57
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
58
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
59
|
+
nextAllowedAt?: string | null | undefined;
|
|
60
|
+
};
|
|
61
|
+
}, {
|
|
62
|
+
selectedBabyId: string | null;
|
|
63
|
+
reviewPrompt: {
|
|
64
|
+
trackedActivityDayKeys?: string[] | undefined;
|
|
65
|
+
firstEligibleAt?: string | null | undefined;
|
|
66
|
+
lastRequestedAt?: string | null | undefined;
|
|
67
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
68
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
69
|
+
nextAllowedAt?: string | null | undefined;
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
72
|
+
export declare const coachReviewPromptResponseSchema: z.ZodObject<{
|
|
73
|
+
reviewPrompt: z.ZodObject<{
|
|
74
|
+
trackedActivityDayKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
75
|
+
firstEligibleAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
lastRequestedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
lastRequestedAppVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
lastRequestedPlatform: z.ZodOptional<z.ZodNullable<z.ZodEnum<["ios", "android"]>>>;
|
|
79
|
+
nextAllowedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
trackedActivityDayKeys: string[];
|
|
82
|
+
firstEligibleAt?: string | null | undefined;
|
|
83
|
+
lastRequestedAt?: string | null | undefined;
|
|
84
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
85
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
86
|
+
nextAllowedAt?: string | null | undefined;
|
|
87
|
+
}, {
|
|
88
|
+
trackedActivityDayKeys?: string[] | undefined;
|
|
89
|
+
firstEligibleAt?: string | null | undefined;
|
|
90
|
+
lastRequestedAt?: string | null | undefined;
|
|
91
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
92
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
93
|
+
nextAllowedAt?: string | null | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
subscriptionEligible: z.ZodBoolean;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
reviewPrompt: {
|
|
98
|
+
trackedActivityDayKeys: string[];
|
|
99
|
+
firstEligibleAt?: string | null | undefined;
|
|
100
|
+
lastRequestedAt?: string | null | undefined;
|
|
101
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
102
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
103
|
+
nextAllowedAt?: string | null | undefined;
|
|
104
|
+
};
|
|
105
|
+
subscriptionEligible: boolean;
|
|
106
|
+
}, {
|
|
107
|
+
reviewPrompt: {
|
|
108
|
+
trackedActivityDayKeys?: string[] | undefined;
|
|
109
|
+
firstEligibleAt?: string | null | undefined;
|
|
110
|
+
lastRequestedAt?: string | null | undefined;
|
|
111
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
112
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
113
|
+
nextAllowedAt?: string | null | undefined;
|
|
114
|
+
};
|
|
115
|
+
subscriptionEligible: boolean;
|
|
116
|
+
}>;
|
|
117
|
+
export declare const reviewPromptAttemptRequestSchema: z.ZodObject<{
|
|
118
|
+
platform: z.ZodEnum<["ios", "android"]>;
|
|
119
|
+
appVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
120
|
+
requestedAt: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
platform: "ios" | "android";
|
|
123
|
+
appVersion?: string | null | undefined;
|
|
124
|
+
requestedAt?: string | undefined;
|
|
125
|
+
}, {
|
|
126
|
+
platform: "ios" | "android";
|
|
127
|
+
appVersion?: string | null | undefined;
|
|
128
|
+
requestedAt?: string | undefined;
|
|
129
|
+
}>;
|
|
130
|
+
export declare const coachReviewPromptAttemptRequestSchema: z.ZodObject<Omit<{
|
|
131
|
+
platform: z.ZodEnum<["ios", "android"]>;
|
|
132
|
+
appVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
133
|
+
requestedAt: z.ZodOptional<z.ZodString>;
|
|
134
|
+
}, "requestedAt">, "strict", z.ZodTypeAny, {
|
|
135
|
+
platform: "ios" | "android";
|
|
136
|
+
appVersion?: string | null | undefined;
|
|
137
|
+
}, {
|
|
138
|
+
platform: "ios" | "android";
|
|
139
|
+
appVersion?: string | null | undefined;
|
|
140
|
+
}>;
|
|
141
|
+
export declare const reviewPromptAttemptResponseSchema: z.ZodObject<{
|
|
142
|
+
reviewPrompt: z.ZodObject<{
|
|
143
|
+
trackedActivityDayKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
144
|
+
firstEligibleAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
145
|
+
lastRequestedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
146
|
+
lastRequestedAppVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
147
|
+
lastRequestedPlatform: z.ZodOptional<z.ZodNullable<z.ZodEnum<["ios", "android"]>>>;
|
|
148
|
+
nextAllowedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
trackedActivityDayKeys: string[];
|
|
151
|
+
firstEligibleAt?: string | null | undefined;
|
|
152
|
+
lastRequestedAt?: string | null | undefined;
|
|
153
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
154
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
155
|
+
nextAllowedAt?: string | null | undefined;
|
|
156
|
+
}, {
|
|
157
|
+
trackedActivityDayKeys?: string[] | undefined;
|
|
158
|
+
firstEligibleAt?: string | null | undefined;
|
|
159
|
+
lastRequestedAt?: string | null | undefined;
|
|
160
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
161
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
162
|
+
nextAllowedAt?: string | null | undefined;
|
|
163
|
+
}>;
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
reviewPrompt: {
|
|
166
|
+
trackedActivityDayKeys: string[];
|
|
167
|
+
firstEligibleAt?: string | null | undefined;
|
|
168
|
+
lastRequestedAt?: string | null | undefined;
|
|
169
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
170
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
171
|
+
nextAllowedAt?: string | null | undefined;
|
|
172
|
+
};
|
|
173
|
+
}, {
|
|
174
|
+
reviewPrompt: {
|
|
175
|
+
trackedActivityDayKeys?: string[] | undefined;
|
|
176
|
+
firstEligibleAt?: string | null | undefined;
|
|
177
|
+
lastRequestedAt?: string | null | undefined;
|
|
178
|
+
lastRequestedAppVersion?: string | null | undefined;
|
|
179
|
+
lastRequestedPlatform?: "ios" | "android" | null | undefined;
|
|
180
|
+
nextAllowedAt?: string | null | undefined;
|
|
181
|
+
};
|
|
182
|
+
}>;
|
|
183
|
+
export declare const normalizeReviewPromptState: (raw?: unknown) => ReviewPromptState;
|
|
184
|
+
export declare const buildReviewPromptDayKey: (date?: Date) => string;
|
|
185
|
+
export declare const addReviewPromptCooldown: (date: Date) => Date;
|
|
186
|
+
export type StoreReviewPlatform = z.infer<typeof storeReviewPlatformSchema>;
|
|
187
|
+
export type ReviewPromptState = z.infer<typeof reviewPromptStateSchema>;
|
|
188
|
+
export type ReviewPromptResponse = z.infer<typeof reviewPromptResponseSchema>;
|
|
189
|
+
export type CoachReviewPromptResponse = z.infer<typeof coachReviewPromptResponseSchema>;
|
|
190
|
+
export type ReviewPromptAttemptRequest = z.infer<typeof reviewPromptAttemptRequestSchema>;
|
|
191
|
+
export type CoachReviewPromptAttemptRequest = z.infer<typeof coachReviewPromptAttemptRequestSchema>;
|
|
192
|
+
export type ReviewPromptAttemptResponse = z.infer<typeof reviewPromptAttemptResponseSchema>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { idSchema, isoDateStringSchema, nullableIsoDateStringSchema } from "./api.js";
|
|
3
|
+
export const REQUIRED_REVIEW_ACTIVITY_DAYS = 7;
|
|
4
|
+
export const REVIEW_PROMPT_COOLDOWN_MONTHS = 6;
|
|
5
|
+
export const storeReviewPlatformSchema = z.enum(["ios", "android"]);
|
|
6
|
+
export const reviewPromptStateSchema = z.object({
|
|
7
|
+
trackedActivityDayKeys: z.array(z.string().min(1)).default([]),
|
|
8
|
+
firstEligibleAt: nullableIsoDateStringSchema.optional(),
|
|
9
|
+
lastRequestedAt: nullableIsoDateStringSchema.optional(),
|
|
10
|
+
lastRequestedAppVersion: z.string().nullable().optional(),
|
|
11
|
+
lastRequestedPlatform: storeReviewPlatformSchema.nullable().optional(),
|
|
12
|
+
nextAllowedAt: nullableIsoDateStringSchema.optional()
|
|
13
|
+
});
|
|
14
|
+
export const reviewPromptResponseSchema = z.object({
|
|
15
|
+
reviewPrompt: reviewPromptStateSchema,
|
|
16
|
+
selectedBabyId: idSchema.nullable()
|
|
17
|
+
});
|
|
18
|
+
export const coachReviewPromptResponseSchema = z.object({
|
|
19
|
+
reviewPrompt: reviewPromptStateSchema,
|
|
20
|
+
subscriptionEligible: z.boolean()
|
|
21
|
+
});
|
|
22
|
+
export const reviewPromptAttemptRequestSchema = z.object({
|
|
23
|
+
platform: storeReviewPlatformSchema,
|
|
24
|
+
appVersion: z.string().nullable().optional(),
|
|
25
|
+
requestedAt: isoDateStringSchema.optional()
|
|
26
|
+
});
|
|
27
|
+
export const coachReviewPromptAttemptRequestSchema = reviewPromptAttemptRequestSchema
|
|
28
|
+
.omit({ requestedAt: true })
|
|
29
|
+
.strict();
|
|
30
|
+
export const reviewPromptAttemptResponseSchema = z.object({
|
|
31
|
+
reviewPrompt: reviewPromptStateSchema
|
|
32
|
+
});
|
|
33
|
+
const cleanDayKeys = (value) => {
|
|
34
|
+
if (!Array.isArray(value))
|
|
35
|
+
return [];
|
|
36
|
+
return Array.from(new Set(value.filter((entry) => typeof entry === "string" && entry.length > 0)));
|
|
37
|
+
};
|
|
38
|
+
const normalizeNullableIso = (value) => {
|
|
39
|
+
if (value === null || value === undefined)
|
|
40
|
+
return null;
|
|
41
|
+
if (value instanceof Date)
|
|
42
|
+
return value.toISOString();
|
|
43
|
+
if (typeof value === "number" || typeof value === "string") {
|
|
44
|
+
const candidate = new Date(value);
|
|
45
|
+
return Number.isNaN(candidate.getTime()) ? null : candidate.toISOString();
|
|
46
|
+
}
|
|
47
|
+
if (typeof value?.toDate === "function") {
|
|
48
|
+
const candidate = value.toDate();
|
|
49
|
+
return Number.isNaN(candidate.getTime()) ? null : candidate.toISOString();
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
};
|
|
53
|
+
const normalizeStoreReviewPlatform = (value) => value === "ios" || value === "android" ? value : null;
|
|
54
|
+
export const normalizeReviewPromptState = (raw) => {
|
|
55
|
+
const input = raw && typeof raw === "object" ? raw : {};
|
|
56
|
+
return {
|
|
57
|
+
trackedActivityDayKeys: cleanDayKeys(input.trackedActivityDayKeys),
|
|
58
|
+
firstEligibleAt: normalizeNullableIso(input.firstEligibleAt),
|
|
59
|
+
lastRequestedAt: normalizeNullableIso(input.lastRequestedAt),
|
|
60
|
+
lastRequestedAppVersion: typeof input.lastRequestedAppVersion === "string" ? input.lastRequestedAppVersion : null,
|
|
61
|
+
lastRequestedPlatform: normalizeStoreReviewPlatform(input.lastRequestedPlatform),
|
|
62
|
+
nextAllowedAt: normalizeNullableIso(input.nextAllowedAt)
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const padDatePart = (value) => String(value).padStart(2, "0");
|
|
66
|
+
export const buildReviewPromptDayKey = (date = new Date()) => `${date.getFullYear()}-${padDatePart(date.getMonth() + 1)}-${padDatePart(date.getDate())}`;
|
|
67
|
+
export const addReviewPromptCooldown = (date) => {
|
|
68
|
+
const nextAllowedAt = new Date(date);
|
|
69
|
+
nextAllowedAt.setMonth(nextAllowedAt.getMonth() + REVIEW_PROMPT_COOLDOWN_MONTHS);
|
|
70
|
+
return nextAllowedAt;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=review-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-prompt.js","sourceRoot":"","sources":["../src/review-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAEtF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAC/C,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,sBAAsB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9D,eAAe,EAAE,2BAA2B,CAAC,QAAQ,EAAE;IACvD,eAAe,EAAE,2BAA2B,CAAC,QAAQ,EAAE;IACvD,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACzD,qBAAqB,EAAE,yBAAyB,CAAC,QAAQ,EAA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C;QAC5D,eAAe,EAAE,oBAAoB,CAAC,KAAK,CAAC,eAAe,CAAC;QAC5D,uBAAuB,EACrB,OAAO,KAAK,CAAC,uBAAuB,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI;QAC1F,qBAAqB,EAAE,4BAA4B,CAAC,KAAK,CAAC,qBAAqB,CAAC;QAChF,aAAa,EAAE,oBAAoB,CAAC,KAAK,CAAC,aAAa,CAAC;KACzD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAE9E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,EAAU,EAAE,CACnE,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;AAE7F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAU,EAAQ,EAAE;IAC1D,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,EAAE,GAAG,6BAA6B,CAAC,CAAC;IACjF,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const supportFaqAudienceSchema: z.ZodEnum<["family", "coach", "both"]>;
|
|
3
|
+
export declare const supportFaqQueryAudienceSchema: z.ZodEnum<["family", "coach"]>;
|
|
4
|
+
export declare const supportFaqsQuerySchema: z.ZodObject<{
|
|
5
|
+
audience: z.ZodOptional<z.ZodEnum<["family", "coach"]>>;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
audience?: "family" | "coach" | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
audience?: "family" | "coach" | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const supportFaqSchema: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
audience: z.ZodEnum<["family", "coach", "both"]>;
|
|
14
|
+
question: z.ZodString;
|
|
15
|
+
answer: z.ZodString;
|
|
16
|
+
tag: z.ZodString;
|
|
17
|
+
sortOrder: z.ZodNumber;
|
|
18
|
+
isPublished: z.ZodBoolean;
|
|
19
|
+
createdAt: z.ZodString;
|
|
20
|
+
updatedAt: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
id: string;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
sortOrder: number;
|
|
26
|
+
audience: "family" | "coach" | "both";
|
|
27
|
+
question: string;
|
|
28
|
+
answer: string;
|
|
29
|
+
tag: string;
|
|
30
|
+
isPublished: boolean;
|
|
31
|
+
}, {
|
|
32
|
+
id: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
sortOrder: number;
|
|
36
|
+
audience: "family" | "coach" | "both";
|
|
37
|
+
question: string;
|
|
38
|
+
answer: string;
|
|
39
|
+
tag: string;
|
|
40
|
+
isPublished: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const supportFaqsResponseSchema: z.ZodObject<{
|
|
43
|
+
faqs: z.ZodArray<z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
audience: z.ZodEnum<["family", "coach", "both"]>;
|
|
46
|
+
question: z.ZodString;
|
|
47
|
+
answer: z.ZodString;
|
|
48
|
+
tag: z.ZodString;
|
|
49
|
+
sortOrder: z.ZodNumber;
|
|
50
|
+
isPublished: z.ZodBoolean;
|
|
51
|
+
createdAt: z.ZodString;
|
|
52
|
+
updatedAt: z.ZodString;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
id: string;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
updatedAt: string;
|
|
57
|
+
sortOrder: number;
|
|
58
|
+
audience: "family" | "coach" | "both";
|
|
59
|
+
question: string;
|
|
60
|
+
answer: string;
|
|
61
|
+
tag: string;
|
|
62
|
+
isPublished: boolean;
|
|
63
|
+
}, {
|
|
64
|
+
id: string;
|
|
65
|
+
createdAt: string;
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
sortOrder: number;
|
|
68
|
+
audience: "family" | "coach" | "both";
|
|
69
|
+
question: string;
|
|
70
|
+
answer: string;
|
|
71
|
+
tag: string;
|
|
72
|
+
isPublished: boolean;
|
|
73
|
+
}>, "many">;
|
|
74
|
+
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
faqs: {
|
|
76
|
+
id: string;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
updatedAt: string;
|
|
79
|
+
sortOrder: number;
|
|
80
|
+
audience: "family" | "coach" | "both";
|
|
81
|
+
question: string;
|
|
82
|
+
answer: string;
|
|
83
|
+
tag: string;
|
|
84
|
+
isPublished: boolean;
|
|
85
|
+
}[];
|
|
86
|
+
}, {
|
|
87
|
+
faqs: {
|
|
88
|
+
id: string;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
updatedAt: string;
|
|
91
|
+
sortOrder: number;
|
|
92
|
+
audience: "family" | "coach" | "both";
|
|
93
|
+
question: string;
|
|
94
|
+
answer: string;
|
|
95
|
+
tag: string;
|
|
96
|
+
isPublished: boolean;
|
|
97
|
+
}[];
|
|
98
|
+
}>;
|
|
99
|
+
export type SupportFaqAudience = z.infer<typeof supportFaqAudienceSchema>;
|
|
100
|
+
export type SupportFaqQueryAudience = z.infer<typeof supportFaqQueryAudienceSchema>;
|
|
101
|
+
export type SupportFaqsQuery = z.infer<typeof supportFaqsQuerySchema>;
|
|
102
|
+
export type SupportFaq = z.infer<typeof supportFaqSchema>;
|
|
103
|
+
export type SupportFaqsResponse = z.infer<typeof supportFaqsResponseSchema>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { idSchema, isoDateStringSchema } from "./api.js";
|
|
3
|
+
export const supportFaqAudienceSchema = z.enum(["family", "coach", "both"]);
|
|
4
|
+
export const supportFaqQueryAudienceSchema = z.enum(["family", "coach"]);
|
|
5
|
+
export const supportFaqsQuerySchema = z
|
|
6
|
+
.object({
|
|
7
|
+
audience: supportFaqQueryAudienceSchema.optional()
|
|
8
|
+
})
|
|
9
|
+
.strict();
|
|
10
|
+
export const supportFaqSchema = z.object({
|
|
11
|
+
id: idSchema,
|
|
12
|
+
audience: supportFaqAudienceSchema,
|
|
13
|
+
question: z.string().min(1),
|
|
14
|
+
answer: z.string().min(1),
|
|
15
|
+
tag: z.string().min(1),
|
|
16
|
+
sortOrder: z.number().int().nonnegative(),
|
|
17
|
+
isPublished: z.boolean(),
|
|
18
|
+
createdAt: isoDateStringSchema,
|
|
19
|
+
updatedAt: isoDateStringSchema
|
|
20
|
+
});
|
|
21
|
+
export const supportFaqsResponseSchema = z.object({
|
|
22
|
+
faqs: z.array(supportFaqSchema)
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=support-faqs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support-faqs.js","sourceRoot":"","sources":["../src/support-faqs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAC5E,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAA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