@learncard/types 5.17.6 → 5.18.1

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/types.esm.js CHANGED
@@ -84,7 +84,7 @@ var ProfileValidator = z.string().or(
84
84
  }).catchall(z.any())
85
85
  );
86
86
  var CredentialSubjectValidator = z.object({ id: z.string().optional() }).catchall(z.any());
87
- var CredentialStatusValidator = z.object({ type: z.string(), id: z.string() }).catchall(z.any());
87
+ var CredentialStatusValidator = z.object({ type: z.string(), id: z.string().optional() }).catchall(z.any());
88
88
  var CredentialSchemaValidator = z.object({ id: z.string(), type: z.string() }).catchall(z.any());
89
89
  var RefreshServiceValidator = z.object({ id: z.string().optional(), type: z.string() }).catchall(z.any());
90
90
  var TermsOfUseValidator = z.object({ type: z.string(), id: z.string().optional() }).catchall(z.any());
@@ -505,8 +505,17 @@ var StatusCheckEntryValidator = z7.object({
505
505
  statusListIndex: z7.string().optional()
506
506
  });
507
507
  var VerificationCheckValidator = z7.object({
508
+ /**
509
+ * Checks that completed successfully. This does not imply that warnings can be ignored.
510
+ */
508
511
  checks: z7.string().array(),
512
+ /**
513
+ * Security-relevant conditions that did not prevent the requested cryptographic checks from
514
+ * completing. In particular, a non-DID issuer warning means the signature is valid but the
515
+ * named URL issuer's authorization of that signing key was not established.
516
+ */
509
517
  warnings: z7.string().array(),
518
+ /** Verification failures that prevented one or more requested checks from succeeding. */
510
519
  errors: z7.string().array(),
511
520
  /**
512
521
  * Per-entry results for the `credentialStatus` check, populated
@@ -651,6 +660,9 @@ var LCNProfileValidator = z11.object({
651
660
  role: z11.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
652
661
  dob: z11.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".'),
653
662
  country: z11.string().optional().describe("Country for the profile."),
663
+ locale: z11.string().optional().describe(
664
+ "BCP-47 language tag (e.g. 'es', 'fr', 'ar') \u2014 the user's preferred language for server-sent notifications and emails."
665
+ ),
654
666
  approved: z11.boolean().optional().describe("Approval status for the profile.")
655
667
  });
656
668
  var LCNPublicProfileValidator = LCNProfileValidator.pick({
@@ -1196,7 +1208,10 @@ var LCNNotificationTypeEnumValidator = z11.enum([
1196
1208
  "GUARDIAN_APPROVAL_PENDING",
1197
1209
  "GUARDIAN_APPROVED",
1198
1210
  "GUARDIAN_REJECTED",
1199
- "APP_NOTIFICATION"
1211
+ "APP_NOTIFICATION",
1212
+ "CREDENTIAL_REVOKED",
1213
+ "CREDENTIAL_SUSPENDED",
1214
+ "CREDENTIAL_UNSUSPENDED"
1200
1215
  ]);
1201
1216
  var LCNNotificationMessageValidator = z11.object({
1202
1217
  title: z11.string().optional(),
@@ -1979,7 +1994,7 @@ var BitstringStatusListEntryValidator = z12.object({
1979
1994
  id: z12.string().optional(),
1980
1995
  type: z12.literal("BitstringStatusListEntry"),
1981
1996
  statusPurpose: BitstringStatusPurposeValidator,
1982
- statusListIndex: z12.string(),
1997
+ statusListIndex: z12.string().or(z12.number().int().nonnegative()),
1983
1998
  statusListCredential: z12.string()
1984
1999
  });
1985
2000
  var AllocatedBitstringStatusListEntryValidator = BitstringStatusListEntryValidator.extend({
@@ -1995,6 +2010,100 @@ var AllocateCredentialStatusInputValidator = z12.object({
1995
2010
  statusPurposes: z12.array(BitstringStatusPurposeValidator).optional(),
1996
2011
  listSize: z12.number().int().positive().optional()
1997
2012
  }).default({});
2013
+
2014
+ // src/inAppMessages.ts
2015
+ import { z as z13 } from "zod";
2016
+ var inAppMessagePlatformValidator = z13.enum(["ios", "android", "web"]);
2017
+ var inAppMessageVersionSourceValidator = z13.enum(["native", "web", "capgo"]);
2018
+ var inAppMessageVersionOpValidator = z13.enum(["lt", "lte", "eq", "gte", "gt"]);
2019
+ var platformPredicateValidator = z13.object({ platform: z13.array(inAppMessagePlatformValidator).nonempty() }).strict();
2020
+ var rolePredicateValidator = z13.object({ role: z13.array(z13.string()).nonempty() }).strict();
2021
+ var versionPredicateValidator = z13.object({
2022
+ version: z13.object({
2023
+ source: inAppMessageVersionSourceValidator,
2024
+ op: inAppMessageVersionOpValidator,
2025
+ value: z13.string()
2026
+ }).strict()
2027
+ }).strict();
2028
+ var inAppMessagePredicateValidator = z13.lazy(
2029
+ () => z13.union([
2030
+ platformPredicateValidator,
2031
+ rolePredicateValidator,
2032
+ versionPredicateValidator,
2033
+ z13.object({ all: z13.array(inAppMessagePredicateValidator) }).strict(),
2034
+ z13.object({ any: z13.array(inAppMessagePredicateValidator) }).strict(),
2035
+ z13.object({ not: inAppMessagePredicateValidator }).strict()
2036
+ ])
2037
+ );
2038
+ var inAppMessageActionStyleValidator = z13.enum(["primary", "secondary", "positive", "dismiss"]).default("secondary");
2039
+ var internalLinkActionValidator = z13.object({ type: z13.literal("internalLink"), path: z13.string() }).passthrough();
2040
+ var externalLinkActionValidator = z13.object({ type: z13.literal("externalLink"), url: z13.string() }).passthrough();
2041
+ var appStoreActionValidator = z13.object({
2042
+ type: z13.literal("appStore"),
2043
+ iosUrl: z13.string().optional(),
2044
+ androidUrl: z13.string().optional(),
2045
+ webUrl: z13.string().optional()
2046
+ }).passthrough();
2047
+ var capgoUpdateActionValidator = z13.object({ type: z13.literal("capgoUpdate") }).passthrough();
2048
+ var dismissActionValidator = z13.object({ type: z13.literal("dismiss") }).passthrough();
2049
+ var inAppMessageActionTargetValidator = z13.union([
2050
+ internalLinkActionValidator,
2051
+ externalLinkActionValidator,
2052
+ appStoreActionValidator,
2053
+ capgoUpdateActionValidator,
2054
+ dismissActionValidator
2055
+ ]);
2056
+ var inAppMessageActionValidator = z13.object({
2057
+ label: z13.string(),
2058
+ style: inAppMessageActionStyleValidator,
2059
+ action: inAppMessageActionTargetValidator,
2060
+ /** When true, the message closes after this action runs (default true). */
2061
+ closeOnComplete: z13.boolean().default(true)
2062
+ }).passthrough();
2063
+ var inAppMessageMediaValidator = z13.object({
2064
+ type: z13.enum(["youtube", "image", "gif"]),
2065
+ url: z13.string(),
2066
+ /** Aspect ratio hint, e.g. "16:9" or "1:1". Defaults to 16:9. */
2067
+ aspect: z13.string().default("16:9"),
2068
+ /** Alt text for images/gifs (accessibility). */
2069
+ alt: z13.string().optional()
2070
+ }).passthrough();
2071
+ var inAppMessageFrequencyValidator = z13.union([
2072
+ z13.literal("once"),
2073
+ z13.literal("session"),
2074
+ z13.literal("always"),
2075
+ z13.object({ everyDays: z13.number().positive() }).strict()
2076
+ ]).default("once");
2077
+ var inAppMessagePresentationValidator = z13.enum(["modal", "banner", "toast"]).default("modal");
2078
+ var inAppMessageValidator = z13.object({
2079
+ /** Stable identifier — used to persist dismissal / frequency state. */
2080
+ id: z13.string(),
2081
+ /** Higher priority wins when multiple messages match. Default 0. */
2082
+ priority: z13.number().default(0),
2083
+ /** When false, the message is required/blocking (no dismiss affordance). */
2084
+ dismissible: z13.boolean().default(true),
2085
+ frequency: inAppMessageFrequencyValidator,
2086
+ presentation: inAppMessagePresentationValidator,
2087
+ media: inAppMessageMediaValidator.optional(),
2088
+ /** Optional emoji hero glyph — rendered only when `media` is not set. */
2089
+ emoji: z13.string().optional(),
2090
+ title: z13.string(),
2091
+ body: z13.string().optional(),
2092
+ actions: z13.array(inAppMessageActionValidator).default([]),
2093
+ /** Targeting predicate tree. Omitted → matches everyone. */
2094
+ targeting: inAppMessagePredicateValidator.optional(),
2095
+ /** Allow disabling a message without removing it from the flag. */
2096
+ enabled: z13.boolean().default(true)
2097
+ }).passthrough();
2098
+ var inAppMessagesFlagValidator = z13.object({
2099
+ version: z13.number().default(1),
2100
+ messages: z13.array(inAppMessageValidator).default([])
2101
+ }).passthrough();
2102
+ var EMPTY_IN_APP_MESSAGES_FLAG = { version: 1, messages: [] };
2103
+ var parseInAppMessagesFlag = /* @__PURE__ */ __name((raw) => {
2104
+ const result = inAppMessagesFlagValidator.safeParse(raw);
2105
+ return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
2106
+ }, "parseInAppMessagesFlag");
1998
2107
  export {
1999
2108
  AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
2000
2109
  AchievementCredentialValidator,
@@ -2096,6 +2205,7 @@ export {
2096
2205
  DeleteFrameworkInputValidator,
2097
2206
  DeleteSkillInputValidator,
2098
2207
  DidDocumentValidator,
2208
+ EMPTY_IN_APP_MESSAGES_FLAG,
2099
2209
  EncryptedCredentialRecordValidator,
2100
2210
  EncryptedRecordValidator,
2101
2211
  EndorsementCredentialValidator,
@@ -2254,5 +2364,26 @@ export {
2254
2364
  VerificationMethodValidator,
2255
2365
  VerificationStatusEnum,
2256
2366
  VerificationStatusValidator,
2257
- isStoredCredentialEnvelope
2367
+ appStoreActionValidator,
2368
+ capgoUpdateActionValidator,
2369
+ dismissActionValidator,
2370
+ externalLinkActionValidator,
2371
+ inAppMessageActionStyleValidator,
2372
+ inAppMessageActionTargetValidator,
2373
+ inAppMessageActionValidator,
2374
+ inAppMessageFrequencyValidator,
2375
+ inAppMessageMediaValidator,
2376
+ inAppMessagePlatformValidator,
2377
+ inAppMessagePredicateValidator,
2378
+ inAppMessagePresentationValidator,
2379
+ inAppMessageValidator,
2380
+ inAppMessageVersionOpValidator,
2381
+ inAppMessageVersionSourceValidator,
2382
+ inAppMessagesFlagValidator,
2383
+ internalLinkActionValidator,
2384
+ isStoredCredentialEnvelope,
2385
+ parseInAppMessagesFlag,
2386
+ platformPredicateValidator,
2387
+ rolePredicateValidator,
2388
+ versionPredicateValidator
2258
2389
  };