@learncard/types 5.18.1 → 5.18.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/types",
3
- "version": "5.18.1",
3
+ "version": "5.18.2",
4
4
  "description": "Shared types for learn card",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
package/src/lcn.ts CHANGED
@@ -102,6 +102,47 @@ export const LCNPublicProfileValidator = LCNProfileValidator.pick({
102
102
  });
103
103
  export type LCNPublicProfile = z.infer<typeof LCNPublicProfileValidator>;
104
104
 
105
+ export const LCNConnectionPromptStatusValidator = z.enum(['PENDING', 'SKIPPED', 'CONNECTED']);
106
+ export type LCNConnectionPromptStatus = z.infer<typeof LCNConnectionPromptStatusValidator>;
107
+
108
+ export const LCNConnectionPromptSurfaceValidator = z.enum(['POST_CLAIM', 'NOTIFICATION']);
109
+ export type LCNConnectionPromptSurface = z.infer<typeof LCNConnectionPromptSurfaceValidator>;
110
+
111
+ export const LCNConnectionPromptActionStatusValidator = z.enum([
112
+ 'PENDING',
113
+ 'SKIPPED',
114
+ 'CONNECTED',
115
+ 'STALE',
116
+ ]);
117
+ export type LCNConnectionPromptActionStatus = z.infer<
118
+ typeof LCNConnectionPromptActionStatusValidator
119
+ >;
120
+
121
+ export const LCNConnectionPromptValidator = z.object({
122
+ promptId: z.string().uuid(),
123
+ status: LCNConnectionPromptStatusValidator,
124
+ surface: LCNConnectionPromptSurfaceValidator,
125
+ triggerId: z.string(),
126
+ triggeredAt: z.iso.datetime(),
127
+ updatedAt: z.iso.datetime(),
128
+ counterpart: LCNPublicProfileValidator,
129
+ });
130
+ export type LCNConnectionPrompt = z.infer<typeof LCNConnectionPromptValidator>;
131
+
132
+ export const LCNConnectionPromptActionResultValidator = z.object({
133
+ promptId: z.string().uuid(),
134
+ status: LCNConnectionPromptActionStatusValidator,
135
+ });
136
+ export type LCNConnectionPromptActionResult = z.infer<
137
+ typeof LCNConnectionPromptActionResultValidator
138
+ >;
139
+
140
+ export const LCNConnectionPromptMetadataValidator = z.object({
141
+ promptId: z.string().uuid(),
142
+ counterpartProfileId: z.string(),
143
+ });
144
+ export type LCNConnectionPromptMetadata = z.infer<typeof LCNConnectionPromptMetadataValidator>;
145
+
105
146
  export const LCNAuthedProfileValidator = LCNPublicProfileValidator.extend({
106
147
  bio: LCNProfileValidator.shape.bio,
107
148
  websiteLink: LCNProfileValidator.shape.websiteLink,
@@ -966,13 +1007,20 @@ export const LCNNotificationInboxValidator = z.object({
966
1007
 
967
1008
  export type LCNNotificationInbox = z.infer<typeof LCNNotificationInboxValidator>;
968
1009
 
1010
+ export const LCNNotificationMetadataValidator = z
1011
+ .object({
1012
+ connectionPrompt: LCNConnectionPromptMetadataValidator.optional(),
1013
+ })
1014
+ .catchall(z.unknown());
1015
+ export type LCNNotificationMetadata = z.infer<typeof LCNNotificationMetadataValidator>;
1016
+
969
1017
  export const LCNNotificationDataValidator = z
970
1018
  .object({
971
1019
  vcUris: z.array(z.string()).optional(),
972
1020
  vpUris: z.array(z.string()).optional(),
973
1021
  transaction: ConsentFlowTransactionValidator.optional(),
974
1022
  inbox: LCNNotificationInboxValidator.optional(),
975
- metadata: z.record(z.string(), z.unknown()).optional(),
1023
+ metadata: LCNNotificationMetadataValidator.optional(),
976
1024
  })
977
1025
  .loose();
978
1026
  export type LCNNotificationData = z.infer<typeof LCNNotificationDataValidator>;