@patch-adams/core 1.5.13 → 1.5.15

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/index.cjs CHANGED
@@ -50,7 +50,9 @@ var LrsBridgeConfigSchema = zod.z.object({
50
50
  /** Document GUID for xAPI statement aggregation - baked into package at wrap time */
51
51
  documentGuid: zod.z.string().optional(),
52
52
  /** Version GUID for xAPI statement aggregation - unique per export */
53
- versionGuid: zod.z.string().optional()
53
+ versionGuid: zod.z.string().optional(),
54
+ /** Original SCORM package filename - baked in at wrap time for LRS searchability */
55
+ packageName: zod.z.string().optional()
54
56
  });
55
57
  var BlockingAssetConfigSchema = zod.z.object({
56
58
  /** Filename for the asset */
@@ -399,7 +401,8 @@ var DEFAULT_LRS_OPTIONS = {
399
401
  lrsAuth: "",
400
402
  lrsProxyEndpoint: "",
401
403
  documentGuid: "",
402
- versionGuid: ""
404
+ versionGuid: "",
405
+ packageName: ""
403
406
  };
404
407
  function generateLrsBridgeCode(options) {
405
408
  if (!options.enabled) {
@@ -415,6 +418,7 @@ function generateLrsBridgeCode(options) {
415
418
  const lrsProxyEndpoint = options.lrsProxyEndpoint || "";
416
419
  const documentGuid = options.documentGuid || "";
417
420
  const versionGuid = options.versionGuid || "";
421
+ const packageName = options.packageName || "";
418
422
  return `
419
423
  // ==========================================================================
420
424
  // PATCH-ADAMS LRS BRIDGE v2.2.0
@@ -447,6 +451,7 @@ function generateLrsBridgeCode(options) {
447
451
  var LRS_PROXY_ENDPOINT = '${lrsProxyEndpoint}';
448
452
  var DOCUMENT_GUID = '${documentGuid}';
449
453
  var VERSION_GUID = '${versionGuid}';
454
+ var PACKAGE_NAME = '${packageName}';
450
455
 
451
456
  // Bravais LRS endpoint pattern: https://lrs-{tenant}.bravais.com/XAPI/statements
452
457
  // Example: core-acme.bravais.com -> lrs-acme.bravais.com
@@ -2130,7 +2135,9 @@ function generateLrsBridgeCode(options) {
2130
2135
  sharedLinkName: null,
2131
2136
  // Tenant info
2132
2137
  homepage: COURSE_HOMEPAGE || window.location.origin,
2133
- tenantHomepage: null // https://{tenant}.bravais.com format
2138
+ tenantHomepage: null, // https://{tenant}.bravais.com format
2139
+ // Package info
2140
+ packageName: null // Original SCORM zip filename
2134
2141
  };
2135
2142
 
2136
2143
  // 0. Use baked-in GUIDs from PA-Patcher config (highest priority - set at wrap time)
@@ -2143,6 +2150,10 @@ function generateLrsBridgeCode(options) {
2143
2150
  info.versionGuid = VERSION_GUID;
2144
2151
  log('Version GUID from baked-in config:', VERSION_GUID);
2145
2152
  }
2153
+ if (PACKAGE_NAME) {
2154
+ info.packageName = PACKAGE_NAME;
2155
+ log('Package name from baked-in config:', PACKAGE_NAME);
2156
+ }
2146
2157
 
2147
2158
  // 1. Extract shared link token and document ID from URL
2148
2159
  info.sharedLinkToken = extractSharedLinkToken();
@@ -2534,12 +2545,19 @@ function generateLrsBridgeCode(options) {
2534
2545
  warn('Missing version GUID - statement may fail Bravais aggregation (document_version_id will be null)');
2535
2546
  }
2536
2547
 
2548
+ // Use packageName (Bravais document name) as the object name when available,
2549
+ // so statements match the searchable document name in Bravais Analytics.
2550
+ // Strip .zip extension to match Bravais convention. Fall back to Rise course title.
2551
+ var objectName = LRS.courseInfo.packageName
2552
+ ? LRS.courseInfo.packageName.replace(/.zip$/i, '')
2553
+ : decodeEntities(LRS.courseInfo.title);
2554
+
2537
2555
  var obj = {
2538
2556
  objectType: 'Activity',
2539
2557
  id: LRS.courseInfo.id,
2540
2558
  definition: {
2541
2559
  type: 'http://xyleme.com/bravais/activities/document',
2542
- name: { 'en-US': decodeEntities(LRS.courseInfo.title) }
2560
+ name: { 'en-US': objectName }
2543
2561
  }
2544
2562
  };
2545
2563
 
@@ -2573,6 +2591,11 @@ function generateLrsBridgeCode(options) {
2573
2591
  // Resource type
2574
2592
  obj.definition.extensions['resourceType'] = LRS.courseInfo.resourceType || 'Course';
2575
2593
 
2594
+ // Package name (original SCORM zip filename)
2595
+ if (LRS.courseInfo.packageName) {
2596
+ obj.definition.extensions['packageName'] = LRS.courseInfo.packageName;
2597
+ }
2598
+
2576
2599
  return obj;
2577
2600
  }
2578
2601
 
@@ -5038,7 +5061,8 @@ function buildJsBeforeOptions(config, metadata) {
5038
5061
  lrsProxyEndpoint: lrsBridgeConfig.lrsProxyEndpoint,
5039
5062
  employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint,
5040
5063
  documentGuid: lrsBridgeConfig.documentGuid,
5041
- versionGuid: lrsBridgeConfig.versionGuid
5064
+ versionGuid: lrsBridgeConfig.versionGuid,
5065
+ packageName: lrsBridgeConfig.packageName
5042
5066
  };
5043
5067
  return {
5044
5068
  remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,
@@ -6728,6 +6752,11 @@ var Patcher = class {
6728
6752
  if (effectiveSkin) {
6729
6753
  console.log(`[Patcher] Skin: ${effectiveSkin}`);
6730
6754
  }
6755
+ if (options.packageName) {
6756
+ this.config.lrsBridge = this.config.lrsBridge ?? {};
6757
+ this.config.lrsBridge.packageName = options.packageName;
6758
+ console.log(`[Patcher] Package name: ${options.packageName}`);
6759
+ }
6731
6760
  const htmlInjector = this.getHtmlInjector(toolInfo.tool);
6732
6761
  htmlInjector.setMetadata(metadata);
6733
6762
  let fetchedFallbacks = {};