@learncard/types 5.18.1 → 5.18.3

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.3",
4
4
  "description": "Shared types for learn card",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -24,6 +24,7 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.json && shx cp ./dist/index.d.ts ./dist/index.d.cts",
27
+ "typecheck": "tsc --noEmit -p tsconfig.json",
27
28
  "start": "aqu watch"
28
29
  },
29
30
  "author": "Learning Economy Foundation (www.learningeconomy.io)",
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,
@@ -113,6 +154,10 @@ export type LCNAuthedProfile = z.infer<typeof LCNAuthedProfileValidator>;
113
154
 
114
155
  export const LCNConnectionProfileValidator = LCNAuthedProfileValidator.extend({
115
156
  email: LCNProfileValidator.shape.email,
157
+ connectedAt: z.iso
158
+ .datetime()
159
+ .optional()
160
+ .describe('When the viewer and this profile became connected.'),
116
161
  });
117
162
  export type LCNConnectionProfile = z.infer<typeof LCNConnectionProfileValidator>;
118
163
 
@@ -966,13 +1011,20 @@ export const LCNNotificationInboxValidator = z.object({
966
1011
 
967
1012
  export type LCNNotificationInbox = z.infer<typeof LCNNotificationInboxValidator>;
968
1013
 
1014
+ export const LCNNotificationMetadataValidator = z
1015
+ .object({
1016
+ connectionPrompt: LCNConnectionPromptMetadataValidator.optional(),
1017
+ })
1018
+ .catchall(z.unknown());
1019
+ export type LCNNotificationMetadata = z.infer<typeof LCNNotificationMetadataValidator>;
1020
+
969
1021
  export const LCNNotificationDataValidator = z
970
1022
  .object({
971
1023
  vcUris: z.array(z.string()).optional(),
972
1024
  vpUris: z.array(z.string()).optional(),
973
1025
  transaction: ConsentFlowTransactionValidator.optional(),
974
1026
  inbox: LCNNotificationInboxValidator.optional(),
975
- metadata: z.record(z.string(), z.unknown()).optional(),
1027
+ metadata: LCNNotificationMetadataValidator.optional(),
976
1028
  })
977
1029
  .loose();
978
1030
  export type LCNNotificationData = z.infer<typeof LCNNotificationDataValidator>;