@learncard/types 5.17.5 → 5.18.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.
- package/dist/inAppMessages.d.ts +312 -0
- package/dist/inAppMessages.d.ts.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lcn.d.ts +34 -0
- package/dist/lcn.d.ts.map +1 -1
- package/dist/types.cjs.development.cjs +124 -2
- package/dist/types.cjs.development.cjs.map +3 -3
- package/dist/types.cjs.production.min.cjs +31 -31
- package/dist/types.cjs.production.min.cjs.map +4 -4
- package/dist/types.esm.js +125 -2
- package/dist/types.esm.js.map +4 -4
- package/package.json +1 -1
- package/src/inAppMessages.ts +216 -0
- package/src/index.ts +1 -0
- package/src/lcn.ts +10 -0
package/dist/types.esm.js
CHANGED
|
@@ -651,6 +651,9 @@ var LCNProfileValidator = z11.object({
|
|
|
651
651
|
role: z11.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
|
|
652
652
|
dob: z11.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".'),
|
|
653
653
|
country: z11.string().optional().describe("Country for the profile."),
|
|
654
|
+
locale: z11.string().optional().describe(
|
|
655
|
+
"BCP-47 language tag (e.g. 'es', 'fr', 'ar') \u2014 the user's preferred language for server-sent notifications and emails."
|
|
656
|
+
),
|
|
654
657
|
approved: z11.boolean().optional().describe("Approval status for the profile.")
|
|
655
658
|
});
|
|
656
659
|
var LCNPublicProfileValidator = LCNProfileValidator.pick({
|
|
@@ -802,6 +805,7 @@ var BoostValidator = z11.object({
|
|
|
802
805
|
name: z11.string().optional(),
|
|
803
806
|
type: z11.string().optional(),
|
|
804
807
|
category: z11.string().optional(),
|
|
808
|
+
created: z11.string().optional(),
|
|
805
809
|
status: LCNBoostStatus.optional(),
|
|
806
810
|
autoConnectRecipients: z11.boolean().optional(),
|
|
807
811
|
meta: z11.record(z11.string(), z11.any()).optional(),
|
|
@@ -1195,7 +1199,10 @@ var LCNNotificationTypeEnumValidator = z11.enum([
|
|
|
1195
1199
|
"GUARDIAN_APPROVAL_PENDING",
|
|
1196
1200
|
"GUARDIAN_APPROVED",
|
|
1197
1201
|
"GUARDIAN_REJECTED",
|
|
1198
|
-
"APP_NOTIFICATION"
|
|
1202
|
+
"APP_NOTIFICATION",
|
|
1203
|
+
"CREDENTIAL_REVOKED",
|
|
1204
|
+
"CREDENTIAL_SUSPENDED",
|
|
1205
|
+
"CREDENTIAL_UNSUSPENDED"
|
|
1199
1206
|
]);
|
|
1200
1207
|
var LCNNotificationMessageValidator = z11.object({
|
|
1201
1208
|
title: z11.string().optional(),
|
|
@@ -1994,6 +2001,100 @@ var AllocateCredentialStatusInputValidator = z12.object({
|
|
|
1994
2001
|
statusPurposes: z12.array(BitstringStatusPurposeValidator).optional(),
|
|
1995
2002
|
listSize: z12.number().int().positive().optional()
|
|
1996
2003
|
}).default({});
|
|
2004
|
+
|
|
2005
|
+
// src/inAppMessages.ts
|
|
2006
|
+
import { z as z13 } from "zod";
|
|
2007
|
+
var inAppMessagePlatformValidator = z13.enum(["ios", "android", "web"]);
|
|
2008
|
+
var inAppMessageVersionSourceValidator = z13.enum(["native", "web", "capgo"]);
|
|
2009
|
+
var inAppMessageVersionOpValidator = z13.enum(["lt", "lte", "eq", "gte", "gt"]);
|
|
2010
|
+
var platformPredicateValidator = z13.object({ platform: z13.array(inAppMessagePlatformValidator).nonempty() }).strict();
|
|
2011
|
+
var rolePredicateValidator = z13.object({ role: z13.array(z13.string()).nonempty() }).strict();
|
|
2012
|
+
var versionPredicateValidator = z13.object({
|
|
2013
|
+
version: z13.object({
|
|
2014
|
+
source: inAppMessageVersionSourceValidator,
|
|
2015
|
+
op: inAppMessageVersionOpValidator,
|
|
2016
|
+
value: z13.string()
|
|
2017
|
+
}).strict()
|
|
2018
|
+
}).strict();
|
|
2019
|
+
var inAppMessagePredicateValidator = z13.lazy(
|
|
2020
|
+
() => z13.union([
|
|
2021
|
+
platformPredicateValidator,
|
|
2022
|
+
rolePredicateValidator,
|
|
2023
|
+
versionPredicateValidator,
|
|
2024
|
+
z13.object({ all: z13.array(inAppMessagePredicateValidator) }).strict(),
|
|
2025
|
+
z13.object({ any: z13.array(inAppMessagePredicateValidator) }).strict(),
|
|
2026
|
+
z13.object({ not: inAppMessagePredicateValidator }).strict()
|
|
2027
|
+
])
|
|
2028
|
+
);
|
|
2029
|
+
var inAppMessageActionStyleValidator = z13.enum(["primary", "secondary", "positive", "dismiss"]).default("secondary");
|
|
2030
|
+
var internalLinkActionValidator = z13.object({ type: z13.literal("internalLink"), path: z13.string() }).passthrough();
|
|
2031
|
+
var externalLinkActionValidator = z13.object({ type: z13.literal("externalLink"), url: z13.string() }).passthrough();
|
|
2032
|
+
var appStoreActionValidator = z13.object({
|
|
2033
|
+
type: z13.literal("appStore"),
|
|
2034
|
+
iosUrl: z13.string().optional(),
|
|
2035
|
+
androidUrl: z13.string().optional(),
|
|
2036
|
+
webUrl: z13.string().optional()
|
|
2037
|
+
}).passthrough();
|
|
2038
|
+
var capgoUpdateActionValidator = z13.object({ type: z13.literal("capgoUpdate") }).passthrough();
|
|
2039
|
+
var dismissActionValidator = z13.object({ type: z13.literal("dismiss") }).passthrough();
|
|
2040
|
+
var inAppMessageActionTargetValidator = z13.union([
|
|
2041
|
+
internalLinkActionValidator,
|
|
2042
|
+
externalLinkActionValidator,
|
|
2043
|
+
appStoreActionValidator,
|
|
2044
|
+
capgoUpdateActionValidator,
|
|
2045
|
+
dismissActionValidator
|
|
2046
|
+
]);
|
|
2047
|
+
var inAppMessageActionValidator = z13.object({
|
|
2048
|
+
label: z13.string(),
|
|
2049
|
+
style: inAppMessageActionStyleValidator,
|
|
2050
|
+
action: inAppMessageActionTargetValidator,
|
|
2051
|
+
/** When true, the message closes after this action runs (default true). */
|
|
2052
|
+
closeOnComplete: z13.boolean().default(true)
|
|
2053
|
+
}).passthrough();
|
|
2054
|
+
var inAppMessageMediaValidator = z13.object({
|
|
2055
|
+
type: z13.enum(["youtube", "image", "gif"]),
|
|
2056
|
+
url: z13.string(),
|
|
2057
|
+
/** Aspect ratio hint, e.g. "16:9" or "1:1". Defaults to 16:9. */
|
|
2058
|
+
aspect: z13.string().default("16:9"),
|
|
2059
|
+
/** Alt text for images/gifs (accessibility). */
|
|
2060
|
+
alt: z13.string().optional()
|
|
2061
|
+
}).passthrough();
|
|
2062
|
+
var inAppMessageFrequencyValidator = z13.union([
|
|
2063
|
+
z13.literal("once"),
|
|
2064
|
+
z13.literal("session"),
|
|
2065
|
+
z13.literal("always"),
|
|
2066
|
+
z13.object({ everyDays: z13.number().positive() }).strict()
|
|
2067
|
+
]).default("once");
|
|
2068
|
+
var inAppMessagePresentationValidator = z13.enum(["modal", "banner", "toast"]).default("modal");
|
|
2069
|
+
var inAppMessageValidator = z13.object({
|
|
2070
|
+
/** Stable identifier — used to persist dismissal / frequency state. */
|
|
2071
|
+
id: z13.string(),
|
|
2072
|
+
/** Higher priority wins when multiple messages match. Default 0. */
|
|
2073
|
+
priority: z13.number().default(0),
|
|
2074
|
+
/** When false, the message is required/blocking (no dismiss affordance). */
|
|
2075
|
+
dismissible: z13.boolean().default(true),
|
|
2076
|
+
frequency: inAppMessageFrequencyValidator,
|
|
2077
|
+
presentation: inAppMessagePresentationValidator,
|
|
2078
|
+
media: inAppMessageMediaValidator.optional(),
|
|
2079
|
+
/** Optional emoji hero glyph — rendered only when `media` is not set. */
|
|
2080
|
+
emoji: z13.string().optional(),
|
|
2081
|
+
title: z13.string(),
|
|
2082
|
+
body: z13.string().optional(),
|
|
2083
|
+
actions: z13.array(inAppMessageActionValidator).default([]),
|
|
2084
|
+
/** Targeting predicate tree. Omitted → matches everyone. */
|
|
2085
|
+
targeting: inAppMessagePredicateValidator.optional(),
|
|
2086
|
+
/** Allow disabling a message without removing it from the flag. */
|
|
2087
|
+
enabled: z13.boolean().default(true)
|
|
2088
|
+
}).passthrough();
|
|
2089
|
+
var inAppMessagesFlagValidator = z13.object({
|
|
2090
|
+
version: z13.number().default(1),
|
|
2091
|
+
messages: z13.array(inAppMessageValidator).default([])
|
|
2092
|
+
}).passthrough();
|
|
2093
|
+
var EMPTY_IN_APP_MESSAGES_FLAG = { version: 1, messages: [] };
|
|
2094
|
+
var parseInAppMessagesFlag = /* @__PURE__ */ __name((raw) => {
|
|
2095
|
+
const result = inAppMessagesFlagValidator.safeParse(raw);
|
|
2096
|
+
return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
|
|
2097
|
+
}, "parseInAppMessagesFlag");
|
|
1997
2098
|
export {
|
|
1998
2099
|
AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
|
|
1999
2100
|
AchievementCredentialValidator,
|
|
@@ -2095,6 +2196,7 @@ export {
|
|
|
2095
2196
|
DeleteFrameworkInputValidator,
|
|
2096
2197
|
DeleteSkillInputValidator,
|
|
2097
2198
|
DidDocumentValidator,
|
|
2199
|
+
EMPTY_IN_APP_MESSAGES_FLAG,
|
|
2098
2200
|
EncryptedCredentialRecordValidator,
|
|
2099
2201
|
EncryptedRecordValidator,
|
|
2100
2202
|
EndorsementCredentialValidator,
|
|
@@ -2253,5 +2355,26 @@ export {
|
|
|
2253
2355
|
VerificationMethodValidator,
|
|
2254
2356
|
VerificationStatusEnum,
|
|
2255
2357
|
VerificationStatusValidator,
|
|
2256
|
-
|
|
2358
|
+
appStoreActionValidator,
|
|
2359
|
+
capgoUpdateActionValidator,
|
|
2360
|
+
dismissActionValidator,
|
|
2361
|
+
externalLinkActionValidator,
|
|
2362
|
+
inAppMessageActionStyleValidator,
|
|
2363
|
+
inAppMessageActionTargetValidator,
|
|
2364
|
+
inAppMessageActionValidator,
|
|
2365
|
+
inAppMessageFrequencyValidator,
|
|
2366
|
+
inAppMessageMediaValidator,
|
|
2367
|
+
inAppMessagePlatformValidator,
|
|
2368
|
+
inAppMessagePredicateValidator,
|
|
2369
|
+
inAppMessagePresentationValidator,
|
|
2370
|
+
inAppMessageValidator,
|
|
2371
|
+
inAppMessageVersionOpValidator,
|
|
2372
|
+
inAppMessageVersionSourceValidator,
|
|
2373
|
+
inAppMessagesFlagValidator,
|
|
2374
|
+
internalLinkActionValidator,
|
|
2375
|
+
isStoredCredentialEnvelope,
|
|
2376
|
+
parseInAppMessagesFlag,
|
|
2377
|
+
platformPredicateValidator,
|
|
2378
|
+
rolePredicateValidator,
|
|
2379
|
+
versionPredicateValidator
|
|
2257
2380
|
};
|