@learncard/helpers 1.3.9 → 1.3.10
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/helpers.cjs.development.cjs +1983 -1827
- package/dist/helpers.cjs.development.cjs.map +3 -3
- package/dist/helpers.cjs.production.min.cjs +25 -25
- package/dist/helpers.cjs.production.min.cjs.map +4 -4
- package/dist/helpers.d.cts +2 -0
- package/dist/helpers.d.ts +2 -0
- package/dist/helpers.esm.js +132 -2
- package/dist/helpers.esm.js.map +3 -3
- package/package.json +2 -2
- package/src/did.ts +12 -0
- package/src/index.ts +1 -0
package/dist/helpers.d.cts
CHANGED
|
@@ -943,6 +943,8 @@ export declare const projectEnvelopeToDisplayVc: (envelope: StoredCredentialEnve
|
|
|
943
943
|
* `read.get` result without branching themselves).
|
|
944
944
|
*/
|
|
945
945
|
export declare const resolveStorageReadResult: (value: VC | StoredCredentialEnvelope | undefined) => VC | StoredCredentialEnvelope | undefined;
|
|
946
|
+
/** Generates a did:web for a user given the app domain and profile ID. */
|
|
947
|
+
export declare const getDidWeb: (domain: string, profileId: string) => string;
|
|
946
948
|
/**
|
|
947
949
|
* Determines whether or not a string is a valid hexadecimal string
|
|
948
950
|
*
|
package/dist/helpers.d.ts
CHANGED
|
@@ -943,6 +943,8 @@ export declare const projectEnvelopeToDisplayVc: (envelope: StoredCredentialEnve
|
|
|
943
943
|
* `read.get` result without branching themselves).
|
|
944
944
|
*/
|
|
945
945
|
export declare const resolveStorageReadResult: (value: VC | StoredCredentialEnvelope | undefined) => VC | StoredCredentialEnvelope | undefined;
|
|
946
|
+
/** Generates a did:web for a user given the app domain and profile ID. */
|
|
947
|
+
export declare const getDidWeb: (domain: string, profileId: string) => string;
|
|
946
948
|
/**
|
|
947
949
|
* Determines whether or not a string is a valid hexadecimal string
|
|
948
950
|
*
|
package/dist/helpers.esm.js
CHANGED
|
@@ -153,6 +153,7 @@ var require_types_cjs_development = __commonJS({
|
|
|
153
153
|
DeleteFrameworkInputValidator: /* @__PURE__ */ __name(() => DeleteFrameworkInputValidator, "DeleteFrameworkInputValidator"),
|
|
154
154
|
DeleteSkillInputValidator: /* @__PURE__ */ __name(() => DeleteSkillInputValidator, "DeleteSkillInputValidator"),
|
|
155
155
|
DidDocumentValidator: /* @__PURE__ */ __name(() => DidDocumentValidator, "DidDocumentValidator"),
|
|
156
|
+
EMPTY_IN_APP_MESSAGES_FLAG: /* @__PURE__ */ __name(() => EMPTY_IN_APP_MESSAGES_FLAG, "EMPTY_IN_APP_MESSAGES_FLAG"),
|
|
156
157
|
EncryptedCredentialRecordValidator: /* @__PURE__ */ __name(() => EncryptedCredentialRecordValidator, "EncryptedCredentialRecordValidator"),
|
|
157
158
|
EncryptedRecordValidator: /* @__PURE__ */ __name(() => EncryptedRecordValidator, "EncryptedRecordValidator"),
|
|
158
159
|
EndorsementCredentialValidator: /* @__PURE__ */ __name(() => EndorsementCredentialValidator, "EndorsementCredentialValidator"),
|
|
@@ -311,7 +312,28 @@ var require_types_cjs_development = __commonJS({
|
|
|
311
312
|
VerificationMethodValidator: /* @__PURE__ */ __name(() => VerificationMethodValidator, "VerificationMethodValidator"),
|
|
312
313
|
VerificationStatusEnum: /* @__PURE__ */ __name(() => VerificationStatusEnum, "VerificationStatusEnum"),
|
|
313
314
|
VerificationStatusValidator: /* @__PURE__ */ __name(() => VerificationStatusValidator, "VerificationStatusValidator"),
|
|
314
|
-
|
|
315
|
+
appStoreActionValidator: /* @__PURE__ */ __name(() => appStoreActionValidator, "appStoreActionValidator"),
|
|
316
|
+
capgoUpdateActionValidator: /* @__PURE__ */ __name(() => capgoUpdateActionValidator, "capgoUpdateActionValidator"),
|
|
317
|
+
dismissActionValidator: /* @__PURE__ */ __name(() => dismissActionValidator, "dismissActionValidator"),
|
|
318
|
+
externalLinkActionValidator: /* @__PURE__ */ __name(() => externalLinkActionValidator, "externalLinkActionValidator"),
|
|
319
|
+
inAppMessageActionStyleValidator: /* @__PURE__ */ __name(() => inAppMessageActionStyleValidator, "inAppMessageActionStyleValidator"),
|
|
320
|
+
inAppMessageActionTargetValidator: /* @__PURE__ */ __name(() => inAppMessageActionTargetValidator, "inAppMessageActionTargetValidator"),
|
|
321
|
+
inAppMessageActionValidator: /* @__PURE__ */ __name(() => inAppMessageActionValidator, "inAppMessageActionValidator"),
|
|
322
|
+
inAppMessageFrequencyValidator: /* @__PURE__ */ __name(() => inAppMessageFrequencyValidator, "inAppMessageFrequencyValidator"),
|
|
323
|
+
inAppMessageMediaValidator: /* @__PURE__ */ __name(() => inAppMessageMediaValidator, "inAppMessageMediaValidator"),
|
|
324
|
+
inAppMessagePlatformValidator: /* @__PURE__ */ __name(() => inAppMessagePlatformValidator, "inAppMessagePlatformValidator"),
|
|
325
|
+
inAppMessagePredicateValidator: /* @__PURE__ */ __name(() => inAppMessagePredicateValidator, "inAppMessagePredicateValidator"),
|
|
326
|
+
inAppMessagePresentationValidator: /* @__PURE__ */ __name(() => inAppMessagePresentationValidator, "inAppMessagePresentationValidator"),
|
|
327
|
+
inAppMessageValidator: /* @__PURE__ */ __name(() => inAppMessageValidator, "inAppMessageValidator"),
|
|
328
|
+
inAppMessageVersionOpValidator: /* @__PURE__ */ __name(() => inAppMessageVersionOpValidator, "inAppMessageVersionOpValidator"),
|
|
329
|
+
inAppMessageVersionSourceValidator: /* @__PURE__ */ __name(() => inAppMessageVersionSourceValidator, "inAppMessageVersionSourceValidator"),
|
|
330
|
+
inAppMessagesFlagValidator: /* @__PURE__ */ __name(() => inAppMessagesFlagValidator, "inAppMessagesFlagValidator"),
|
|
331
|
+
internalLinkActionValidator: /* @__PURE__ */ __name(() => internalLinkActionValidator, "internalLinkActionValidator"),
|
|
332
|
+
isStoredCredentialEnvelope: /* @__PURE__ */ __name(() => isStoredCredentialEnvelope2, "isStoredCredentialEnvelope"),
|
|
333
|
+
parseInAppMessagesFlag: /* @__PURE__ */ __name(() => parseInAppMessagesFlag, "parseInAppMessagesFlag"),
|
|
334
|
+
platformPredicateValidator: /* @__PURE__ */ __name(() => platformPredicateValidator, "platformPredicateValidator"),
|
|
335
|
+
rolePredicateValidator: /* @__PURE__ */ __name(() => rolePredicateValidator, "rolePredicateValidator"),
|
|
336
|
+
versionPredicateValidator: /* @__PURE__ */ __name(() => versionPredicateValidator, "versionPredicateValidator")
|
|
315
337
|
});
|
|
316
338
|
module.exports = __toCommonJS(index_exports);
|
|
317
339
|
var external_exports = {};
|
|
@@ -16184,6 +16206,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16184
16206
|
role: external_exports.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
|
|
16185
16207
|
dob: external_exports.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".'),
|
|
16186
16208
|
country: external_exports.string().optional().describe("Country for the profile."),
|
|
16209
|
+
locale: external_exports.string().optional().describe(
|
|
16210
|
+
"BCP-47 language tag (e.g. 'es', 'fr', 'ar') \u2014 the user's preferred language for server-sent notifications and emails."
|
|
16211
|
+
),
|
|
16187
16212
|
approved: external_exports.boolean().optional().describe("Approval status for the profile.")
|
|
16188
16213
|
});
|
|
16189
16214
|
var LCNPublicProfileValidator = LCNProfileValidator.pick({
|
|
@@ -16729,7 +16754,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16729
16754
|
"GUARDIAN_APPROVAL_PENDING",
|
|
16730
16755
|
"GUARDIAN_APPROVED",
|
|
16731
16756
|
"GUARDIAN_REJECTED",
|
|
16732
|
-
"APP_NOTIFICATION"
|
|
16757
|
+
"APP_NOTIFICATION",
|
|
16758
|
+
"CREDENTIAL_REVOKED",
|
|
16759
|
+
"CREDENTIAL_SUSPENDED",
|
|
16760
|
+
"CREDENTIAL_UNSUSPENDED"
|
|
16733
16761
|
]);
|
|
16734
16762
|
var LCNNotificationMessageValidator = external_exports.object({
|
|
16735
16763
|
title: external_exports.string().optional(),
|
|
@@ -17526,6 +17554,97 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17526
17554
|
statusPurposes: external_exports.array(BitstringStatusPurposeValidator).optional(),
|
|
17527
17555
|
listSize: external_exports.number().int().positive().optional()
|
|
17528
17556
|
}).default({});
|
|
17557
|
+
var inAppMessagePlatformValidator = external_exports.enum(["ios", "android", "web"]);
|
|
17558
|
+
var inAppMessageVersionSourceValidator = external_exports.enum(["native", "web", "capgo"]);
|
|
17559
|
+
var inAppMessageVersionOpValidator = external_exports.enum(["lt", "lte", "eq", "gte", "gt"]);
|
|
17560
|
+
var platformPredicateValidator = external_exports.object({ platform: external_exports.array(inAppMessagePlatformValidator).nonempty() }).strict();
|
|
17561
|
+
var rolePredicateValidator = external_exports.object({ role: external_exports.array(external_exports.string()).nonempty() }).strict();
|
|
17562
|
+
var versionPredicateValidator = external_exports.object({
|
|
17563
|
+
version: external_exports.object({
|
|
17564
|
+
source: inAppMessageVersionSourceValidator,
|
|
17565
|
+
op: inAppMessageVersionOpValidator,
|
|
17566
|
+
value: external_exports.string()
|
|
17567
|
+
}).strict()
|
|
17568
|
+
}).strict();
|
|
17569
|
+
var inAppMessagePredicateValidator = external_exports.lazy(
|
|
17570
|
+
() => external_exports.union([
|
|
17571
|
+
platformPredicateValidator,
|
|
17572
|
+
rolePredicateValidator,
|
|
17573
|
+
versionPredicateValidator,
|
|
17574
|
+
external_exports.object({ all: external_exports.array(inAppMessagePredicateValidator) }).strict(),
|
|
17575
|
+
external_exports.object({ any: external_exports.array(inAppMessagePredicateValidator) }).strict(),
|
|
17576
|
+
external_exports.object({ not: inAppMessagePredicateValidator }).strict()
|
|
17577
|
+
])
|
|
17578
|
+
);
|
|
17579
|
+
var inAppMessageActionStyleValidator = external_exports.enum(["primary", "secondary", "positive", "dismiss"]).default("secondary");
|
|
17580
|
+
var internalLinkActionValidator = external_exports.object({ type: external_exports.literal("internalLink"), path: external_exports.string() }).passthrough();
|
|
17581
|
+
var externalLinkActionValidator = external_exports.object({ type: external_exports.literal("externalLink"), url: external_exports.string() }).passthrough();
|
|
17582
|
+
var appStoreActionValidator = external_exports.object({
|
|
17583
|
+
type: external_exports.literal("appStore"),
|
|
17584
|
+
iosUrl: external_exports.string().optional(),
|
|
17585
|
+
androidUrl: external_exports.string().optional(),
|
|
17586
|
+
webUrl: external_exports.string().optional()
|
|
17587
|
+
}).passthrough();
|
|
17588
|
+
var capgoUpdateActionValidator = external_exports.object({ type: external_exports.literal("capgoUpdate") }).passthrough();
|
|
17589
|
+
var dismissActionValidator = external_exports.object({ type: external_exports.literal("dismiss") }).passthrough();
|
|
17590
|
+
var inAppMessageActionTargetValidator = external_exports.union([
|
|
17591
|
+
internalLinkActionValidator,
|
|
17592
|
+
externalLinkActionValidator,
|
|
17593
|
+
appStoreActionValidator,
|
|
17594
|
+
capgoUpdateActionValidator,
|
|
17595
|
+
dismissActionValidator
|
|
17596
|
+
]);
|
|
17597
|
+
var inAppMessageActionValidator = external_exports.object({
|
|
17598
|
+
label: external_exports.string(),
|
|
17599
|
+
style: inAppMessageActionStyleValidator,
|
|
17600
|
+
action: inAppMessageActionTargetValidator,
|
|
17601
|
+
/** When true, the message closes after this action runs (default true). */
|
|
17602
|
+
closeOnComplete: external_exports.boolean().default(true)
|
|
17603
|
+
}).passthrough();
|
|
17604
|
+
var inAppMessageMediaValidator = external_exports.object({
|
|
17605
|
+
type: external_exports.enum(["youtube", "image", "gif"]),
|
|
17606
|
+
url: external_exports.string(),
|
|
17607
|
+
/** Aspect ratio hint, e.g. "16:9" or "1:1". Defaults to 16:9. */
|
|
17608
|
+
aspect: external_exports.string().default("16:9"),
|
|
17609
|
+
/** Alt text for images/gifs (accessibility). */
|
|
17610
|
+
alt: external_exports.string().optional()
|
|
17611
|
+
}).passthrough();
|
|
17612
|
+
var inAppMessageFrequencyValidator = external_exports.union([
|
|
17613
|
+
external_exports.literal("once"),
|
|
17614
|
+
external_exports.literal("session"),
|
|
17615
|
+
external_exports.literal("always"),
|
|
17616
|
+
external_exports.object({ everyDays: external_exports.number().positive() }).strict()
|
|
17617
|
+
]).default("once");
|
|
17618
|
+
var inAppMessagePresentationValidator = external_exports.enum(["modal", "banner", "toast"]).default("modal");
|
|
17619
|
+
var inAppMessageValidator = external_exports.object({
|
|
17620
|
+
/** Stable identifier — used to persist dismissal / frequency state. */
|
|
17621
|
+
id: external_exports.string(),
|
|
17622
|
+
/** Higher priority wins when multiple messages match. Default 0. */
|
|
17623
|
+
priority: external_exports.number().default(0),
|
|
17624
|
+
/** When false, the message is required/blocking (no dismiss affordance). */
|
|
17625
|
+
dismissible: external_exports.boolean().default(true),
|
|
17626
|
+
frequency: inAppMessageFrequencyValidator,
|
|
17627
|
+
presentation: inAppMessagePresentationValidator,
|
|
17628
|
+
media: inAppMessageMediaValidator.optional(),
|
|
17629
|
+
/** Optional emoji hero glyph — rendered only when `media` is not set. */
|
|
17630
|
+
emoji: external_exports.string().optional(),
|
|
17631
|
+
title: external_exports.string(),
|
|
17632
|
+
body: external_exports.string().optional(),
|
|
17633
|
+
actions: external_exports.array(inAppMessageActionValidator).default([]),
|
|
17634
|
+
/** Targeting predicate tree. Omitted → matches everyone. */
|
|
17635
|
+
targeting: inAppMessagePredicateValidator.optional(),
|
|
17636
|
+
/** Allow disabling a message without removing it from the flag. */
|
|
17637
|
+
enabled: external_exports.boolean().default(true)
|
|
17638
|
+
}).passthrough();
|
|
17639
|
+
var inAppMessagesFlagValidator = external_exports.object({
|
|
17640
|
+
version: external_exports.number().default(1),
|
|
17641
|
+
messages: external_exports.array(inAppMessageValidator).default([])
|
|
17642
|
+
}).passthrough();
|
|
17643
|
+
var EMPTY_IN_APP_MESSAGES_FLAG = { version: 1, messages: [] };
|
|
17644
|
+
var parseInAppMessagesFlag = /* @__PURE__ */ __name2((raw) => {
|
|
17645
|
+
const result = inAppMessagesFlagValidator.safeParse(raw);
|
|
17646
|
+
return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
|
|
17647
|
+
}, "parseInAppMessagesFlag");
|
|
17529
17648
|
}
|
|
17530
17649
|
});
|
|
17531
17650
|
|
|
@@ -18353,6 +18472,16 @@ var inferW3cVersionFromContext = /* @__PURE__ */ __name((vc) => {
|
|
|
18353
18472
|
return isV2 ? "w3c-vc-2.0" : "w3c-vc-1.1";
|
|
18354
18473
|
}, "inferW3cVersionFromContext");
|
|
18355
18474
|
|
|
18475
|
+
// src/did.ts
|
|
18476
|
+
var getDidWeb = /* @__PURE__ */ __name((domain, profileId) => {
|
|
18477
|
+
let decodedDomain = domain;
|
|
18478
|
+
try {
|
|
18479
|
+
decodedDomain = decodeURIComponent(domain);
|
|
18480
|
+
} catch {
|
|
18481
|
+
}
|
|
18482
|
+
return `did:web:${encodeURIComponent(decodedDomain)}:users:${profileId}`;
|
|
18483
|
+
}, "getDidWeb");
|
|
18484
|
+
|
|
18356
18485
|
// src/index.ts
|
|
18357
18486
|
var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
|
18358
18487
|
var isEncrypted = /* @__PURE__ */ __name((item) => {
|
|
@@ -18433,6 +18562,7 @@ export {
|
|
|
18433
18562
|
getBitstringStatusListEntries,
|
|
18434
18563
|
getBitstringStatusListEntryForPurpose,
|
|
18435
18564
|
getCredentialStatusArray,
|
|
18565
|
+
getDidWeb,
|
|
18436
18566
|
getProvider,
|
|
18437
18567
|
getUrlsFromSrcSet,
|
|
18438
18568
|
immerArraySlice,
|