@nikthegeek/dreamsforlittles-shared 0.6.2 → 0.9.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.
Files changed (84) hide show
  1. package/dist/access.d.ts +352 -0
  2. package/dist/access.js +2 -1
  3. package/dist/access.js.map +1 -1
  4. package/dist/active-timer-reminders.d.ts +10 -0
  5. package/dist/active-timer-reminders.js +11 -0
  6. package/dist/active-timer-reminders.js.map +1 -0
  7. package/dist/admin.d.ts +1867 -0
  8. package/dist/admin.js +4 -0
  9. package/dist/admin.js.map +1 -1
  10. package/dist/analysis.d.ts +216 -8
  11. package/dist/api.d.ts +5 -5
  12. package/dist/app-feedback.d.ts +266 -0
  13. package/dist/app-feedback.js +6 -2
  14. package/dist/app-feedback.js.map +1 -1
  15. package/dist/branding.d.ts +80 -0
  16. package/dist/branding.js +234 -0
  17. package/dist/branding.js.map +1 -0
  18. package/dist/branding.test.js +101 -0
  19. package/dist/branding.test.js.map +1 -0
  20. package/dist/client-notices.d.ts +133 -133
  21. package/dist/coach-activity-notifications.d.ts +4 -3
  22. package/dist/coach-activity-notifications.js +33 -5
  23. package/dist/coach-activity-notifications.js.map +1 -1
  24. package/dist/coach-activity-notifications.test.d.ts +1 -0
  25. package/dist/coach-activity-notifications.test.js +57 -0
  26. package/dist/coach-activity-notifications.test.js.map +1 -0
  27. package/dist/coach.d.ts +4600 -686
  28. package/dist/coach.js +36 -2
  29. package/dist/coach.js.map +1 -1
  30. package/dist/enums.d.ts +1 -1
  31. package/dist/enums.js +4 -1
  32. package/dist/enums.js.map +1 -1
  33. package/dist/errors.d.ts +8 -4
  34. package/dist/errors.js +12 -0
  35. package/dist/errors.js.map +1 -1
  36. package/dist/family-invitations.d.ts +466 -14
  37. package/dist/family-profile-artifacts.d.ts +802 -58
  38. package/dist/family.d.ts +6425 -1442
  39. package/dist/family.js +214 -10
  40. package/dist/family.js.map +1 -1
  41. package/dist/family.test.d.ts +1 -0
  42. package/dist/family.test.js +207 -0
  43. package/dist/family.test.js.map +1 -0
  44. package/dist/files.d.ts +2 -2
  45. package/dist/getting-started-guides.d.ts +6 -6
  46. package/dist/index.d.ts +5 -1
  47. package/dist/index.js +5 -1
  48. package/dist/index.js.map +1 -1
  49. package/dist/invites.d.ts +98 -0
  50. package/dist/notification-banners.d.ts +76 -14
  51. package/dist/notification-banners.js +20 -2
  52. package/dist/notification-banners.js.map +1 -1
  53. package/dist/notification-banners.test.d.ts +1 -0
  54. package/dist/notification-banners.test.js +28 -0
  55. package/dist/notification-banners.test.js.map +1 -0
  56. package/dist/realtime.d.ts +4 -4
  57. package/dist/subscription-cancellation-feedback.d.ts +539 -0
  58. package/dist/subscription-cancellation-feedback.js +144 -0
  59. package/dist/subscription-cancellation-feedback.js.map +1 -0
  60. package/dist/subscription-cancellation-feedback.test.d.ts +1 -0
  61. package/dist/subscription-cancellation-feedback.test.js +27 -0
  62. package/dist/subscription-cancellation-feedback.test.js.map +1 -0
  63. package/dist/support-attachments.d.ts +320 -0
  64. package/dist/support-attachments.js +108 -0
  65. package/dist/support-attachments.js.map +1 -0
  66. package/dist/support-attachments.test.d.ts +1 -0
  67. package/dist/support-attachments.test.js +35 -0
  68. package/dist/support-attachments.test.js.map +1 -0
  69. package/dist/support-mutation-reconciliation.d.ts +74 -0
  70. package/dist/support-mutation-reconciliation.js +36 -0
  71. package/dist/support-mutation-reconciliation.js.map +1 -0
  72. package/dist/support-mutation-reconciliation.test.d.ts +1 -0
  73. package/dist/support-mutation-reconciliation.test.js +43 -0
  74. package/dist/support-mutation-reconciliation.test.js.map +1 -0
  75. package/dist/support-tickets.d.ts +424 -0
  76. package/dist/support-tickets.js +9 -3
  77. package/dist/support-tickets.js.map +1 -1
  78. package/package.json +1 -1
  79. package/dist/sleep-insights.d.ts +0 -7943
  80. package/dist/sleep-insights.js +0 -231
  81. package/dist/sleep-insights.js.map +0 -1
  82. package/dist/sleep-insights.test.js +0 -124
  83. package/dist/sleep-insights.test.js.map +0 -1
  84. /package/dist/{sleep-insights.test.d.ts → branding.test.d.ts} +0 -0
@@ -0,0 +1,144 @@
1
+ import { z } from "zod";
2
+ import { idSchema, isoDateStringSchema, nullableIsoDateStringSchema } from "./api.js";
3
+ import { appFeedbackStatusSchema } from "./app-feedback.js";
4
+ export const SUBSCRIPTION_CANCELLATION_FEEDBACK_REASONS = [
5
+ { key: "technicalReliability", label: "Technical or reliability problems" },
6
+ { key: "missingFeatures", label: "Missing features" },
7
+ { key: "difficultToUse", label: "Difficult to set up or use" },
8
+ { key: "priceValue", label: "Price or value" },
9
+ { key: "clientsNotUsing", label: "Clients were not using it" },
10
+ { key: "noLongerNeeded", label: "Did not use it enough or no longer needed it" },
11
+ { key: "switchedProduct", label: "Switched to another product" },
12
+ { key: "other", label: "Other" }
13
+ ];
14
+ export const SUBSCRIPTION_CANCELLATION_TECHNICAL_AREAS = [
15
+ { key: "startupLogin", label: "Startup or login" },
16
+ { key: "sleepTracking", label: "Sleep tracking" },
17
+ { key: "activityTracking", label: "Other activity tracking" },
18
+ { key: "clientInvitations", label: "Client invitations" },
19
+ { key: "dashboard", label: "Dashboard" },
20
+ { key: "notifications", label: "Notifications" },
21
+ { key: "billing", label: "Billing or subscription" },
22
+ { key: "other", label: "Other" }
23
+ ];
24
+ export const MAX_SUBSCRIPTION_CANCELLATION_FEEDBACK_DETAILS_LENGTH = 2_000;
25
+ export const subscriptionCancellationFeedbackReasonSchema = z.enum([
26
+ "technicalReliability",
27
+ "missingFeatures",
28
+ "difficultToUse",
29
+ "priceValue",
30
+ "clientsNotUsing",
31
+ "noLongerNeeded",
32
+ "switchedProduct",
33
+ "other"
34
+ ]);
35
+ export const subscriptionCancellationTechnicalAreaSchema = z.enum([
36
+ "startupLogin",
37
+ "sleepTracking",
38
+ "activityTracking",
39
+ "clientInvitations",
40
+ "dashboard",
41
+ "notifications",
42
+ "billing",
43
+ "other"
44
+ ]);
45
+ const uniqueArray = (values) => new Set(values).size === values.length;
46
+ export const subscriptionCancellationFeedbackSubmitRequestSchema = z
47
+ .object({
48
+ reasons: z
49
+ .array(subscriptionCancellationFeedbackReasonSchema)
50
+ .min(1)
51
+ .max(SUBSCRIPTION_CANCELLATION_FEEDBACK_REASONS.length)
52
+ .refine(uniqueArray, "Choose each reason only once."),
53
+ technicalAreas: z
54
+ .array(subscriptionCancellationTechnicalAreaSchema)
55
+ .max(SUBSCRIPTION_CANCELLATION_TECHNICAL_AREAS.length)
56
+ .refine(uniqueArray, "Choose each technical area only once.")
57
+ .default([]),
58
+ rating: z.number().int().min(1).max(5).nullable().optional(),
59
+ details: z
60
+ .string()
61
+ .trim()
62
+ .max(MAX_SUBSCRIPTION_CANCELLATION_FEEDBACK_DETAILS_LENGTH)
63
+ .nullable()
64
+ .optional(),
65
+ contactAllowed: z.boolean()
66
+ })
67
+ .strict()
68
+ .superRefine((value, context) => {
69
+ if (value.technicalAreas.length > 0 &&
70
+ !value.reasons.includes("technicalReliability")) {
71
+ context.addIssue({
72
+ code: z.ZodIssueCode.custom,
73
+ path: ["technicalAreas"],
74
+ message: "Technical areas require the technical or reliability reason."
75
+ });
76
+ }
77
+ });
78
+ export const subscriptionCancellationFeedbackPublicContextSchema = z.object({
79
+ status: z.enum(["available", "submitted", "unavailable"]),
80
+ firstName: z.string().min(1).optional(),
81
+ organizationName: z.string().min(1).optional(),
82
+ cancellationEffectiveAt: nullableIsoDateStringSchema.optional(),
83
+ expiresAt: isoDateStringSchema.optional()
84
+ });
85
+ export const subscriptionCancellationFeedbackSubmitResponseSchema = z.object({
86
+ status: z.literal("submitted")
87
+ });
88
+ export const subscriptionCancellationFeedbackDeliveryStatusSchema = z.enum([
89
+ "scheduled",
90
+ "sending",
91
+ "sent",
92
+ "failed",
93
+ "submitted",
94
+ "canceled",
95
+ "expired"
96
+ ]);
97
+ export const subscriptionCancellationFeedbackSchema = z.object({
98
+ id: idSchema,
99
+ subscriptionId: idSchema,
100
+ coachUserId: idSchema,
101
+ organizationId: idSchema,
102
+ recipientEmail: z.string().email(),
103
+ recipientName: z.string().min(1),
104
+ organizationName: z.string().min(1),
105
+ cancellationEffectiveAt: isoDateStringSchema,
106
+ deliveryStatus: subscriptionCancellationFeedbackDeliveryStatusSchema,
107
+ reviewStatus: appFeedbackStatusSchema,
108
+ reasons: z.array(subscriptionCancellationFeedbackReasonSchema),
109
+ technicalAreas: z.array(subscriptionCancellationTechnicalAreaSchema),
110
+ rating: z.number().int().min(1).max(5).nullable(),
111
+ details: z.string().nullable(),
112
+ contactAllowed: z.boolean().nullable(),
113
+ attemptCount: z.number().int().nonnegative(),
114
+ lastError: z.string().nullable(),
115
+ sendAfter: isoDateStringSchema,
116
+ expiresAt: isoDateStringSchema,
117
+ sentAt: nullableIsoDateStringSchema,
118
+ submittedAt: nullableIsoDateStringSchema,
119
+ canceledAt: nullableIsoDateStringSchema,
120
+ reviewedAt: nullableIsoDateStringSchema,
121
+ resolvedAt: nullableIsoDateStringSchema,
122
+ archivedAt: nullableIsoDateStringSchema,
123
+ adminNotes: z.string().nullable(),
124
+ createdAt: isoDateStringSchema,
125
+ updatedAt: isoDateStringSchema
126
+ });
127
+ export const adminSubscriptionCancellationFeedbackResponseSchema = z.object({
128
+ feedback: z.array(subscriptionCancellationFeedbackSchema)
129
+ });
130
+ export const adminSubscriptionCancellationFeedbackRequestCreateSchema = z
131
+ .object({ email: z.string().trim().email() })
132
+ .strict();
133
+ export const adminSubscriptionCancellationFeedbackRequestCreateResponseSchema = z.object({
134
+ feedback: subscriptionCancellationFeedbackSchema,
135
+ created: z.boolean()
136
+ });
137
+ export const adminSubscriptionCancellationFeedbackUpdateSchema = z
138
+ .object({
139
+ status: appFeedbackStatusSchema.optional(),
140
+ adminNotes: z.string().trim().max(2_000).nullable().optional()
141
+ })
142
+ .strict()
143
+ .refine((value) => value.status !== undefined || value.adminNotes !== undefined, "Provide a status or notes update.");
144
+ //# sourceMappingURL=subscription-cancellation-feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription-cancellation-fe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2B;IACvC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,SAAS,EAAE,mBAAmB;IAC9B,SAAS,EAAE,mBAAmB;CAC/B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mDAAmD,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1E,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,sCAAsC,CAAC;CAC1D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wDAAwD,GAAG,CAAC;KACtE,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;KAC5C,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,gEAAgE,GAAG,CAAC,CAAC,MAAM,CAAC;IACvF,QAAQ,EAAE,sCAAsC;IAChD,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iDAAiD,GAAG,CAAC;KAC/D,MAAM,CAAC;IACN,MAAM,EAAE,uBAAuB,CAAC,QAAQ,EAAE;IAC1C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC/D,CAAC;KACD,MAAM,EAAE;KACR,MAAM,CACL,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EACvE,mCAAmC,CACpC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { subscriptionCancellationFeedbackSubmitRequestSchema } from "./subscription-cancellation-feedback.js";
3
+ describe("subscriptionCancellationFeedbackSubmitRequestSchema", () => {
4
+ it("accepts structured cancellation feedback without requiring free text", () => {
5
+ expect(subscriptionCancellationFeedbackSubmitRequestSchema.parse({
6
+ reasons: ["technicalReliability", "missingFeatures"],
7
+ technicalAreas: ["startupLogin", "sleepTracking"],
8
+ rating: 2,
9
+ contactAllowed: true
10
+ })).toMatchObject({
11
+ reasons: ["technicalReliability", "missingFeatures"],
12
+ technicalAreas: ["startupLogin", "sleepTracking"]
13
+ });
14
+ });
15
+ it("rejects duplicate reasons and unrelated technical details", () => {
16
+ expect(() => subscriptionCancellationFeedbackSubmitRequestSchema.parse({
17
+ reasons: ["missingFeatures", "missingFeatures"],
18
+ contactAllowed: false
19
+ })).toThrow();
20
+ expect(() => subscriptionCancellationFeedbackSubmitRequestSchema.parse({
21
+ reasons: ["priceValue"],
22
+ technicalAreas: ["startupLogin"],
23
+ contactAllowed: false
24
+ })).toThrow();
25
+ });
26
+ });
27
+ //# sourceMappingURL=subscription-cancellation-feedback.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription-cancellation-feedback.test.js","sourceRoot":"","sources":["../src/subscription-cancellation-feedback.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,mDAAmD,EACpD,MAAM,yCAAyC,CAAC;AAEjD,QAAQ,CAAC,qDAAqD,EAAE,GAAG,EAAE;IACnE,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC9E,MAAM,CAAC,mDAAmD,CAAC,KAAK,CAAC;YAC/D,OAAO,EAAE,CAAC,sBAAsB,EAAE,iBAAiB,CAAC;YACpD,cAAc,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;YACjD,MAAM,EAAE,CAAC;YACT,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC,CAAC,aAAa,CAAC;YAChB,OAAO,EAAE,CAAC,sBAAsB,EAAE,iBAAiB,CAAC;YACpD,cAAc,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;SAClD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,CAAC,GAAG,EAAE,CAAC,mDAAmD,CAAC,KAAK,CAAC;YACrE,OAAO,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;YAC/C,cAAc,EAAE,KAAK;SACtB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAEd,MAAM,CAAC,GAAG,EAAE,CAAC,mDAAmD,CAAC,KAAK,CAAC;YACrE,OAAO,EAAE,CAAC,YAAY,CAAC;YACvB,cAAc,EAAE,CAAC,cAAc,CAAC;YAChC,cAAc,EAAE,KAAK;SACtB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,320 @@
1
+ import { z } from "zod";
2
+ export declare const SUPPORT_ATTACHMENT_BUCKET: "support-attachments";
3
+ export declare const SUPPORT_ATTACHMENT_UPLOAD_TOKEN_SECONDS: number;
4
+ export declare const SUPPORT_ATTACHMENT_DOWNLOAD_URL_SECONDS: number;
5
+ export declare const SUPPORT_ATTACHMENT_RESUMABLE_UPLOAD_SECONDS: number;
6
+ export declare const SUPPORT_ATTACHMENT_UPLOAD_SETTLE_SECONDS: number;
7
+ export declare const SUPPORT_ATTACHMENT_READY_GRACE_SECONDS: number;
8
+ export declare const SUPPORT_ATTACHMENT_TOMBSTONE_RETENTION_SECONDS: number;
9
+ export declare const MAX_SUPPORT_ATTACHMENT_IMAGES = 3;
10
+ export declare const MAX_SUPPORT_ATTACHMENT_VIDEOS = 1;
11
+ export declare const MAX_SUPPORT_ATTACHMENTS = 4;
12
+ export declare const MAX_SUPPORT_ATTACHMENT_IMAGE_BYTES: number;
13
+ export declare const MAX_SUPPORT_ATTACHMENT_VIDEO_BYTES: number;
14
+ export declare const MAX_SUPPORT_ATTACHMENT_TOTAL_BYTES: number;
15
+ export declare const MAX_SUPPORT_ATTACHMENT_VIDEO_DURATION_MS = 30000;
16
+ export declare const SUPPORT_ATTACHMENT_IMAGE_CONTENT_TYPES: readonly ["image/jpeg", "image/png", "image/webp"];
17
+ export declare const SUPPORT_ATTACHMENT_VIDEO_CONTENT_TYPES: readonly ["video/mp4", "video/quicktime"];
18
+ export declare const supportAttachmentPurposeSchema: z.ZodEnum<["app_feedback", "support_ticket_message"]>;
19
+ export declare const supportAttachmentMediaKindSchema: z.ZodEnum<["image", "video"]>;
20
+ export declare const supportAttachmentStatusSchema: z.ZodEnum<["pending", "finalizing", "ready", "attached", "rejected", "deleting", "deleted"]>;
21
+ export declare const supportAttachmentContentTypeSchema: z.ZodEnum<["image/jpeg", "image/png", "image/webp", "video/mp4", "video/quicktime"]>;
22
+ export declare const supportAttachmentIdsSchema: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
23
+ export declare const supportAttachmentReservationRequestSchema: z.ZodEffects<z.ZodObject<{
24
+ clientRequestId: z.ZodString;
25
+ purpose: z.ZodEnum<["app_feedback", "support_ticket_message"]>;
26
+ fileName: z.ZodString;
27
+ contentType: z.ZodEnum<["image/jpeg", "image/png", "image/webp", "video/mp4", "video/quicktime"]>;
28
+ sizeBytes: z.ZodNumber;
29
+ }, "strict", z.ZodTypeAny, {
30
+ purpose: "app_feedback" | "support_ticket_message";
31
+ clientRequestId: string;
32
+ fileName: string;
33
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
34
+ sizeBytes: number;
35
+ }, {
36
+ purpose: "app_feedback" | "support_ticket_message";
37
+ clientRequestId: string;
38
+ fileName: string;
39
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
40
+ sizeBytes: number;
41
+ }>, {
42
+ purpose: "app_feedback" | "support_ticket_message";
43
+ clientRequestId: string;
44
+ fileName: string;
45
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
46
+ sizeBytes: number;
47
+ }, {
48
+ purpose: "app_feedback" | "support_ticket_message";
49
+ clientRequestId: string;
50
+ fileName: string;
51
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
52
+ sizeBytes: number;
53
+ }>;
54
+ export declare const supportAttachmentSchema: z.ZodObject<{
55
+ id: z.ZodString;
56
+ purpose: z.ZodEnum<["app_feedback", "support_ticket_message"]>;
57
+ mediaKind: z.ZodEnum<["image", "video"]>;
58
+ status: z.ZodEnum<["pending", "finalizing", "ready", "attached", "rejected", "deleting", "deleted"]>;
59
+ fileName: z.ZodString;
60
+ contentType: z.ZodEnum<["image/jpeg", "image/png", "image/webp", "video/mp4", "video/quicktime"]>;
61
+ sizeBytes: z.ZodNumber;
62
+ durationMs: z.ZodNullable<z.ZodNumber>;
63
+ width: z.ZodNullable<z.ZodNumber>;
64
+ height: z.ZodNullable<z.ZodNumber>;
65
+ createdAt: z.ZodString;
66
+ updatedAt: z.ZodString;
67
+ }, "strip", z.ZodTypeAny, {
68
+ status: "pending" | "finalizing" | "ready" | "attached" | "rejected" | "deleting" | "deleted";
69
+ id: string;
70
+ createdAt: string;
71
+ updatedAt: string;
72
+ purpose: "app_feedback" | "support_ticket_message";
73
+ mediaKind: "image" | "video";
74
+ fileName: string;
75
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
76
+ sizeBytes: number;
77
+ durationMs: number | null;
78
+ width: number | null;
79
+ height: number | null;
80
+ }, {
81
+ status: "pending" | "finalizing" | "ready" | "attached" | "rejected" | "deleting" | "deleted";
82
+ id: string;
83
+ createdAt: string;
84
+ updatedAt: string;
85
+ purpose: "app_feedback" | "support_ticket_message";
86
+ mediaKind: "image" | "video";
87
+ fileName: string;
88
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
89
+ sizeBytes: number;
90
+ durationMs: number | null;
91
+ width: number | null;
92
+ height: number | null;
93
+ }>;
94
+ export declare const supportAttachmentUploadSchema: z.ZodObject<{
95
+ bucket: z.ZodLiteral<"support-attachments">;
96
+ path: z.ZodString;
97
+ token: z.ZodString;
98
+ expiresAt: z.ZodString;
99
+ mode: z.ZodEnum<["standard", "tus"]>;
100
+ tusEndpoint: z.ZodNullable<z.ZodString>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ path: string;
103
+ expiresAt: string;
104
+ mode: "standard" | "tus";
105
+ token: string;
106
+ bucket: "support-attachments";
107
+ tusEndpoint: string | null;
108
+ }, {
109
+ path: string;
110
+ expiresAt: string;
111
+ mode: "standard" | "tus";
112
+ token: string;
113
+ bucket: "support-attachments";
114
+ tusEndpoint: string | null;
115
+ }>;
116
+ export declare const supportAttachmentReservationResponseSchema: z.ZodObject<{
117
+ attachment: z.ZodObject<{
118
+ id: z.ZodString;
119
+ purpose: z.ZodEnum<["app_feedback", "support_ticket_message"]>;
120
+ mediaKind: z.ZodEnum<["image", "video"]>;
121
+ status: z.ZodEnum<["pending", "finalizing", "ready", "attached", "rejected", "deleting", "deleted"]>;
122
+ fileName: z.ZodString;
123
+ contentType: z.ZodEnum<["image/jpeg", "image/png", "image/webp", "video/mp4", "video/quicktime"]>;
124
+ sizeBytes: z.ZodNumber;
125
+ durationMs: z.ZodNullable<z.ZodNumber>;
126
+ width: z.ZodNullable<z.ZodNumber>;
127
+ height: z.ZodNullable<z.ZodNumber>;
128
+ createdAt: z.ZodString;
129
+ updatedAt: z.ZodString;
130
+ }, "strip", z.ZodTypeAny, {
131
+ status: "pending" | "finalizing" | "ready" | "attached" | "rejected" | "deleting" | "deleted";
132
+ id: string;
133
+ createdAt: string;
134
+ updatedAt: string;
135
+ purpose: "app_feedback" | "support_ticket_message";
136
+ mediaKind: "image" | "video";
137
+ fileName: string;
138
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
139
+ sizeBytes: number;
140
+ durationMs: number | null;
141
+ width: number | null;
142
+ height: number | null;
143
+ }, {
144
+ status: "pending" | "finalizing" | "ready" | "attached" | "rejected" | "deleting" | "deleted";
145
+ id: string;
146
+ createdAt: string;
147
+ updatedAt: string;
148
+ purpose: "app_feedback" | "support_ticket_message";
149
+ mediaKind: "image" | "video";
150
+ fileName: string;
151
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
152
+ sizeBytes: number;
153
+ durationMs: number | null;
154
+ width: number | null;
155
+ height: number | null;
156
+ }>;
157
+ upload: z.ZodNullable<z.ZodObject<{
158
+ bucket: z.ZodLiteral<"support-attachments">;
159
+ path: z.ZodString;
160
+ token: z.ZodString;
161
+ expiresAt: z.ZodString;
162
+ mode: z.ZodEnum<["standard", "tus"]>;
163
+ tusEndpoint: z.ZodNullable<z.ZodString>;
164
+ }, "strip", z.ZodTypeAny, {
165
+ path: string;
166
+ expiresAt: string;
167
+ mode: "standard" | "tus";
168
+ token: string;
169
+ bucket: "support-attachments";
170
+ tusEndpoint: string | null;
171
+ }, {
172
+ path: string;
173
+ expiresAt: string;
174
+ mode: "standard" | "tus";
175
+ token: string;
176
+ bucket: "support-attachments";
177
+ tusEndpoint: string | null;
178
+ }>>;
179
+ }, "strip", z.ZodTypeAny, {
180
+ upload: {
181
+ path: string;
182
+ expiresAt: string;
183
+ mode: "standard" | "tus";
184
+ token: string;
185
+ bucket: "support-attachments";
186
+ tusEndpoint: string | null;
187
+ } | null;
188
+ attachment: {
189
+ status: "pending" | "finalizing" | "ready" | "attached" | "rejected" | "deleting" | "deleted";
190
+ id: string;
191
+ createdAt: string;
192
+ updatedAt: string;
193
+ purpose: "app_feedback" | "support_ticket_message";
194
+ mediaKind: "image" | "video";
195
+ fileName: string;
196
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
197
+ sizeBytes: number;
198
+ durationMs: number | null;
199
+ width: number | null;
200
+ height: number | null;
201
+ };
202
+ }, {
203
+ upload: {
204
+ path: string;
205
+ expiresAt: string;
206
+ mode: "standard" | "tus";
207
+ token: string;
208
+ bucket: "support-attachments";
209
+ tusEndpoint: string | null;
210
+ } | null;
211
+ attachment: {
212
+ status: "pending" | "finalizing" | "ready" | "attached" | "rejected" | "deleting" | "deleted";
213
+ id: string;
214
+ createdAt: string;
215
+ updatedAt: string;
216
+ purpose: "app_feedback" | "support_ticket_message";
217
+ mediaKind: "image" | "video";
218
+ fileName: string;
219
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
220
+ sizeBytes: number;
221
+ durationMs: number | null;
222
+ width: number | null;
223
+ height: number | null;
224
+ };
225
+ }>;
226
+ export declare const supportAttachmentResponseSchema: z.ZodObject<{
227
+ attachment: z.ZodObject<{
228
+ id: z.ZodString;
229
+ purpose: z.ZodEnum<["app_feedback", "support_ticket_message"]>;
230
+ mediaKind: z.ZodEnum<["image", "video"]>;
231
+ status: z.ZodEnum<["pending", "finalizing", "ready", "attached", "rejected", "deleting", "deleted"]>;
232
+ fileName: z.ZodString;
233
+ contentType: z.ZodEnum<["image/jpeg", "image/png", "image/webp", "video/mp4", "video/quicktime"]>;
234
+ sizeBytes: z.ZodNumber;
235
+ durationMs: z.ZodNullable<z.ZodNumber>;
236
+ width: z.ZodNullable<z.ZodNumber>;
237
+ height: z.ZodNullable<z.ZodNumber>;
238
+ createdAt: z.ZodString;
239
+ updatedAt: z.ZodString;
240
+ }, "strip", z.ZodTypeAny, {
241
+ status: "pending" | "finalizing" | "ready" | "attached" | "rejected" | "deleting" | "deleted";
242
+ id: string;
243
+ createdAt: string;
244
+ updatedAt: string;
245
+ purpose: "app_feedback" | "support_ticket_message";
246
+ mediaKind: "image" | "video";
247
+ fileName: string;
248
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
249
+ sizeBytes: number;
250
+ durationMs: number | null;
251
+ width: number | null;
252
+ height: number | null;
253
+ }, {
254
+ status: "pending" | "finalizing" | "ready" | "attached" | "rejected" | "deleting" | "deleted";
255
+ id: string;
256
+ createdAt: string;
257
+ updatedAt: string;
258
+ purpose: "app_feedback" | "support_ticket_message";
259
+ mediaKind: "image" | "video";
260
+ fileName: string;
261
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
262
+ sizeBytes: number;
263
+ durationMs: number | null;
264
+ width: number | null;
265
+ height: number | null;
266
+ }>;
267
+ }, "strip", z.ZodTypeAny, {
268
+ attachment: {
269
+ status: "pending" | "finalizing" | "ready" | "attached" | "rejected" | "deleting" | "deleted";
270
+ id: string;
271
+ createdAt: string;
272
+ updatedAt: string;
273
+ purpose: "app_feedback" | "support_ticket_message";
274
+ mediaKind: "image" | "video";
275
+ fileName: string;
276
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
277
+ sizeBytes: number;
278
+ durationMs: number | null;
279
+ width: number | null;
280
+ height: number | null;
281
+ };
282
+ }, {
283
+ attachment: {
284
+ status: "pending" | "finalizing" | "ready" | "attached" | "rejected" | "deleting" | "deleted";
285
+ id: string;
286
+ createdAt: string;
287
+ updatedAt: string;
288
+ purpose: "app_feedback" | "support_ticket_message";
289
+ mediaKind: "image" | "video";
290
+ fileName: string;
291
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "video/mp4" | "video/quicktime";
292
+ sizeBytes: number;
293
+ durationMs: number | null;
294
+ width: number | null;
295
+ height: number | null;
296
+ };
297
+ }>;
298
+ export declare const supportAttachmentDownloadResponseSchema: z.ZodObject<{
299
+ attachmentId: z.ZodString;
300
+ url: z.ZodString;
301
+ expiresAt: z.ZodString;
302
+ }, "strip", z.ZodTypeAny, {
303
+ expiresAt: string;
304
+ url: string;
305
+ attachmentId: string;
306
+ }, {
307
+ expiresAt: string;
308
+ url: string;
309
+ attachmentId: string;
310
+ }>;
311
+ export type SupportAttachmentPurpose = z.infer<typeof supportAttachmentPurposeSchema>;
312
+ export type SupportAttachmentMediaKind = z.infer<typeof supportAttachmentMediaKindSchema>;
313
+ export type SupportAttachmentStatus = z.infer<typeof supportAttachmentStatusSchema>;
314
+ export type SupportAttachmentContentType = z.infer<typeof supportAttachmentContentTypeSchema>;
315
+ export type SupportAttachmentReservationRequest = z.infer<typeof supportAttachmentReservationRequestSchema>;
316
+ export type SupportAttachment = z.infer<typeof supportAttachmentSchema>;
317
+ export type SupportAttachmentUpload = z.infer<typeof supportAttachmentUploadSchema>;
318
+ export type SupportAttachmentReservationResponse = z.infer<typeof supportAttachmentReservationResponseSchema>;
319
+ export type SupportAttachmentResponse = z.infer<typeof supportAttachmentResponseSchema>;
320
+ export type SupportAttachmentDownloadResponse = z.infer<typeof supportAttachmentDownloadResponseSchema>;
@@ -0,0 +1,108 @@
1
+ import { z } from "zod";
2
+ import { idSchema, isoDateStringSchema } from "./api.js";
3
+ export const SUPPORT_ATTACHMENT_BUCKET = "support-attachments";
4
+ export const SUPPORT_ATTACHMENT_UPLOAD_TOKEN_SECONDS = 2 * 60 * 60;
5
+ export const SUPPORT_ATTACHMENT_DOWNLOAD_URL_SECONDS = 5 * 60;
6
+ // A resumable upload URL created while the signed grant is valid can itself remain
7
+ // usable for 24 hours. Cleanup waits that full lifetime plus a settling buffer.
8
+ export const SUPPORT_ATTACHMENT_RESUMABLE_UPLOAD_SECONDS = 24 * 60 * 60;
9
+ export const SUPPORT_ATTACHMENT_UPLOAD_SETTLE_SECONDS = 15 * 60;
10
+ export const SUPPORT_ATTACHMENT_READY_GRACE_SECONDS = 24 * 60 * 60;
11
+ export const SUPPORT_ATTACHMENT_TOMBSTONE_RETENTION_SECONDS = 7 * 24 * 60 * 60;
12
+ export const MAX_SUPPORT_ATTACHMENT_IMAGES = 3;
13
+ export const MAX_SUPPORT_ATTACHMENT_VIDEOS = 1;
14
+ export const MAX_SUPPORT_ATTACHMENTS = 4;
15
+ export const MAX_SUPPORT_ATTACHMENT_IMAGE_BYTES = 5 * 1024 * 1024;
16
+ export const MAX_SUPPORT_ATTACHMENT_VIDEO_BYTES = 25 * 1024 * 1024;
17
+ export const MAX_SUPPORT_ATTACHMENT_TOTAL_BYTES = 30 * 1024 * 1024;
18
+ export const MAX_SUPPORT_ATTACHMENT_VIDEO_DURATION_MS = 30_000;
19
+ export const SUPPORT_ATTACHMENT_IMAGE_CONTENT_TYPES = [
20
+ "image/jpeg",
21
+ "image/png",
22
+ "image/webp"
23
+ ];
24
+ export const SUPPORT_ATTACHMENT_VIDEO_CONTENT_TYPES = [
25
+ "video/mp4",
26
+ "video/quicktime"
27
+ ];
28
+ export const supportAttachmentPurposeSchema = z.enum([
29
+ "app_feedback",
30
+ "support_ticket_message"
31
+ ]);
32
+ export const supportAttachmentMediaKindSchema = z.enum(["image", "video"]);
33
+ export const supportAttachmentStatusSchema = z.enum([
34
+ "pending",
35
+ "finalizing",
36
+ "ready",
37
+ "attached",
38
+ "rejected",
39
+ "deleting",
40
+ "deleted"
41
+ ]);
42
+ export const supportAttachmentContentTypeSchema = z.enum([
43
+ ...SUPPORT_ATTACHMENT_IMAGE_CONTENT_TYPES,
44
+ ...SUPPORT_ATTACHMENT_VIDEO_CONTENT_TYPES
45
+ ]);
46
+ export const supportAttachmentIdsSchema = z
47
+ .array(idSchema)
48
+ .max(MAX_SUPPORT_ATTACHMENTS)
49
+ .refine((ids) => new Set(ids).size === ids.length, "Attachment IDs must be unique.");
50
+ export const supportAttachmentReservationRequestSchema = z
51
+ .object({
52
+ clientRequestId: z.string().uuid(),
53
+ purpose: supportAttachmentPurposeSchema,
54
+ fileName: z.string().trim().min(1).max(240),
55
+ contentType: supportAttachmentContentTypeSchema,
56
+ sizeBytes: z.number().int().positive().max(MAX_SUPPORT_ATTACHMENT_VIDEO_BYTES)
57
+ })
58
+ .strict()
59
+ .superRefine((value, context) => {
60
+ const image = SUPPORT_ATTACHMENT_IMAGE_CONTENT_TYPES.includes(value.contentType);
61
+ const limit = image
62
+ ? MAX_SUPPORT_ATTACHMENT_IMAGE_BYTES
63
+ : MAX_SUPPORT_ATTACHMENT_VIDEO_BYTES;
64
+ if (value.sizeBytes > limit) {
65
+ context.addIssue({
66
+ code: z.ZodIssueCode.too_big,
67
+ type: "number",
68
+ maximum: limit,
69
+ inclusive: true,
70
+ message: `Attachment exceeds the ${limit}-byte limit.`
71
+ });
72
+ }
73
+ });
74
+ export const supportAttachmentSchema = z.object({
75
+ id: idSchema,
76
+ purpose: supportAttachmentPurposeSchema,
77
+ mediaKind: supportAttachmentMediaKindSchema,
78
+ status: supportAttachmentStatusSchema,
79
+ fileName: z.string().min(1),
80
+ contentType: supportAttachmentContentTypeSchema,
81
+ sizeBytes: z.number().int().positive(),
82
+ durationMs: z.number().int().nonnegative().nullable(),
83
+ width: z.number().int().positive().nullable(),
84
+ height: z.number().int().positive().nullable(),
85
+ createdAt: isoDateStringSchema,
86
+ updatedAt: isoDateStringSchema
87
+ });
88
+ export const supportAttachmentUploadSchema = z.object({
89
+ bucket: z.literal(SUPPORT_ATTACHMENT_BUCKET),
90
+ path: z.string().min(1),
91
+ token: z.string().min(1),
92
+ expiresAt: isoDateStringSchema,
93
+ mode: z.enum(["standard", "tus"]),
94
+ tusEndpoint: z.string().url().nullable()
95
+ });
96
+ export const supportAttachmentReservationResponseSchema = z.object({
97
+ attachment: supportAttachmentSchema,
98
+ upload: supportAttachmentUploadSchema.nullable()
99
+ });
100
+ export const supportAttachmentResponseSchema = z.object({
101
+ attachment: supportAttachmentSchema
102
+ });
103
+ export const supportAttachmentDownloadResponseSchema = z.object({
104
+ attachmentId: idSchema,
105
+ url: z.string().url(),
106
+ expiresAt: isoDateStringSchema
107
+ });
108
+ //# sourceMappingURL=support-attachments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-attachments.js","sourceRoot":"","sources":["../src/support-attachments.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,yBAAyB,GAAG,qBAA8B,CAAC;AACxE,MAAM,CAAC,MAA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