@lwrjs/client-modules 0.13.0-alpha.2 → 0.13.0-alpha.21

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.
Files changed (25) hide show
  1. package/build/bundle/prod/lwr/lockerDefine/lockerDefine.js +1 -1
  2. package/build/bundle/prod/lwr/servicesESM/servicesESM.js +1 -1
  3. package/build/es/modules/lwr/declarativeShadow/declarativeShadow.d.ts +2 -0
  4. package/build/es/modules/lwr/declarativeShadow/declarativeShadow.js +27 -0
  5. package/build/es/modules/lwr/environment/environment.d.ts +6 -0
  6. package/build/es/modules/lwr/environment/environment.js +11 -0
  7. package/build/es/modules/lwr/init/init.d.ts +23 -0
  8. package/build/es/modules/lwr/init/init.js +118 -0
  9. package/build/es/modules/lwr/lockerSandbox/lockerSandbox.d.ts +2 -0
  10. package/build/es/modules/lwr/lockerSandbox/lockerSandbox.js +2 -0
  11. package/build/es/modules/lwr/metrics/metrics.d.ts +35 -0
  12. package/build/es/modules/lwr/metrics/metrics.js +39 -0
  13. package/build/es/modules/lwr/profiler/profiler.d.ts +28 -0
  14. package/build/es/modules/lwr/profiler/profiler.js +67 -0
  15. package/build/es/modules/lwr/serverDataCallback/serverDataCallback.d.ts +7 -0
  16. package/build/es/modules/lwr/serverDataCallback/serverDataCallback.js +11 -0
  17. package/build/modules/lwr/hmr/hmr.js +30 -26
  18. package/build/modules/lwr/init/init.js +0 -6
  19. package/build/modules/lwr/lockerDefine/lockerDefine.js +41 -13
  20. package/build/modules/lwr/lockerSandbox/lockerSandbox.js +41 -13
  21. package/build/modules/lwr/metrics/metrics.js +1 -1
  22. package/build/modules/lwr/serverDataCallback/serverDataCallback.js +16 -0
  23. package/build/modules/lwr/servicesESM/servicesESM.js +2 -4
  24. package/package.json +7 -6
  25. package/build/modules/lwr/hmr/util/swap.js +0 -12
@@ -1329,6 +1329,10 @@ const {
1329
1329
  function consoleWarn$LWS(...args$LWS) {
1330
1330
  ReflectApply$LWS$1(consoleWarnRef$LWS, consoleRef$LWS, args$LWS);
1331
1331
  }
1332
+ let gaterEnabledFeatures$LWS = [];
1333
+ function isGaterEnabledFeature$LWS(featureName$LWS) {
1334
+ return ReflectApply$LWS$1(ArrayProtoIncludes$LWS$1, gaterEnabledFeatures$LWS, [`com.salesforce.locker.${featureName$LWS}`]);
1335
+ }
1332
1336
  const trackedLiveTargets$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1());
1333
1337
  function isTargetLive$LWS(target$LWS, targetTraits$LWS = 0 /* TargetTraits.None */) {
1334
1338
  if (targetTraits$LWS & 1 /* TargetTraits.IsArray */ || targetTraits$LWS & 2 /* TargetTraits.IsArrayBufferView */ || targetTraits$LWS & 64 /* TargetTraits.Revoked */ || target$LWS === null || target$LWS === undefined || target$LWS === ObjectProto$LWS$1 || target$LWS === RegExpProto$LWS$1) {
@@ -1410,6 +1414,10 @@ function trackAsLiveTarget$LWS(target$LWS) {
1410
1414
  trackedLiveTargets$LWS.add(target$LWS);
1411
1415
  return target$LWS;
1412
1416
  }
1417
+ const lockerFeatures$LWS = {};
1418
+ function isLockerFeatureEnabled$LWS(featureName$LWS) {
1419
+ return lockerFeatures$LWS[featureName$LWS];
1420
+ }
1413
1421
  const NS_HEAD$LWS = `${LOCKER_SERVICE_KEY$LWS}-`;
1414
1422
  const NS_TAIL$LWS = '$';
1415
1423
  const STORAGE_NS_HEAD$LWS = `${LOCKER_SERVICE_KEY$LWS}[`;
@@ -1453,7 +1461,7 @@ const {
1453
1461
  } = PromiseCtor$LWS.prototype;
1454
1462
  const PromiseResolve$LWS = PromiseCtor$LWS.resolve.bind(PromiseCtor$LWS);
1455
1463
  const PromiseReject$LWS = PromiseCtor$LWS.reject.bind(PromiseCtor$LWS);
1456
- /*! version: 0.22.1 */
1464
+ /*! version: 0.22.3 */
1457
1465
 
1458
1466
  /*!
1459
1467
  * Copyright (C) 2019 salesforce.com, inc.
@@ -2112,7 +2120,7 @@ const {
2112
2120
  const XhrProtoResponseTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'responseText');
2113
2121
  const XhrProtoStatusGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'status');
2114
2122
  ObjectLookupOwnSetter$LWS(XhrProto$LWS, 'withCredentials');
2115
- /*! version: 0.22.1 */
2123
+ /*! version: 0.22.3 */
2116
2124
 
2117
2125
  /*!
2118
2126
  * Copyright (C) 2019 salesforce.com, inc.
@@ -2171,7 +2179,7 @@ function sanitizeURLForElement$LWS(url$LWS) {
2171
2179
  function sanitizeURLString$LWS(urlString$LWS) {
2172
2180
  return urlString$LWS === '' ? urlString$LWS : ReflectApply$LWS$1(StringProtoReplace$LWS, urlString$LWS, [newlinesAndTabsRegExp$LWS, '']);
2173
2181
  }
2174
- /*! version: 0.22.1 */
2182
+ /*! version: 0.22.3 */
2175
2183
 
2176
2184
  /*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */
2177
2185
 
@@ -3857,7 +3865,7 @@ try {
3857
3865
  // swallow
3858
3866
  }
3859
3867
  const trusted = createPolicy('trusted', policyOptions);
3860
- /*! version: 0.22.1 */
3868
+ /*! version: 0.22.3 */
3861
3869
 
3862
3870
  /*!
3863
3871
  * Copyright (C) 2019 salesforce.com, inc.
@@ -4116,7 +4124,7 @@ function blobSanitizer$LWS(sandboxKey$LWS) {
4116
4124
  }
4117
4125
  return getSanitizerForConfig$LWS(sandboxKey$LWS, 'STRING_BLOB_HTML');
4118
4126
  }
4119
- /*! version: 0.22.1 */
4127
+ /*! version: 0.22.3 */
4120
4128
 
4121
4129
  /*!
4122
4130
  * Copyright (C) 2023 salesforce.com, inc.
@@ -4314,7 +4322,7 @@ function encloseSrcSetter$LWS(targetElement$LWS) {
4314
4322
  ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, targetElement$LWS, [attributeNamespaceURI$LWS, attributeName$LWS, src$LWS]);
4315
4323
  };
4316
4324
  }
4317
- /*! version: 0.22.1 */
4325
+ /*! version: 0.22.3 */
4318
4326
 
4319
4327
  /*!
4320
4328
  * Copyright (C) 2019 salesforce.com, inc.
@@ -5055,6 +5063,7 @@ document$LWS = globalObject$LWS.document) {
5055
5063
  function setCustomElementsRegistry$LWS(document$LWS, key$LWS) {
5056
5064
  currentRegistry$LWS = getSandboxCustomElementRegistry$LWS(document$LWS, key$LWS);
5057
5065
  }
5066
+ const DataTransferBlockedProperties$LWS = ['mozCursor', 'mozSourceNode', 'mozUserCancelled'];
5058
5067
  const attributeDistortionFactoriesCache$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
5059
5068
  const sandboxAttributeDistortionRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
5060
5069
  function finalizeAttributeDistortions$LWS(record$LWS) {
@@ -9916,7 +9925,7 @@ const SVGElementBlockedProperties$LWS = ['nonce'];
9916
9925
  const UIEventBlockedProperties$LWS = ['rangeParent'];
9917
9926
  const WindowBlockedProperties$LWS = ['find', 'requestFileSystem', 'webkitRequestFileSystem'];
9918
9927
  const XSLTProcessorBlockedProperties$LWS = ['transformToDocument', 'transformToFragment'];
9919
- /*! version: 0.22.1 */
9928
+ /*! version: 0.22.3 */
9920
9929
 
9921
9930
  /*!
9922
9931
  * Copyright (C) 2019 salesforce.com, inc.
@@ -10024,6 +10033,7 @@ function getDistortionFactories$LWS(record$LWS) {
10024
10033
  addBlockedAttributeDistortionFactoryInitializers$LWS(HTMLIFrameElement$LWS, 'HTMLIFrameElement', HTMLIFrameElementBlockedAttributes$LWS, initializers$LWS);
10025
10034
  addBlockedAttributeDistortionFactoryInitializers$LWS(HTMLScriptElement$LWS, 'HTMLScriptElement', HTMLScriptElementBlockedAttributes$LWS, initializers$LWS);
10026
10035
  addBlockedAttributeDistortionFactoryInitializers$LWS(SVGElement$LWS, 'SVGElement', SVGElementBlockedAttributes$LWS, initializers$LWS);
10036
+ addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, DataTransfer.prototype, DataTransferBlockedProperties$LWS, initializers$LWS);
10027
10037
  addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, Document$LWS.prototype, DocumentBlockedProperties$LWS, initializers$LWS);
10028
10038
  addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, Element$LWS.prototype, ElementBlockedProperties$LWS, initializers$LWS);
10029
10039
  addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, Event$LWS.prototype, EventBlockedProperties$LWS, initializers$LWS);
@@ -15127,7 +15137,7 @@ function toSourceText$LWS(value$LWS, sourceType$LWS) {
15127
15137
  // tools from mistaking the regexp or the replacement string for an
15128
15138
  // actual source mapping URL.
15129
15139
  /\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
15130
- sourceText$LWS = `\n//# LWS Version = "0.22.1"\n${sourceText$LWS}`;
15140
+ sourceText$LWS = `\n//# LWS Version = "0.22.3"\n${sourceText$LWS}`;
15131
15141
  return sourceType$LWS === 1 /* SourceType.Module */ && indexOfPragma$LWS(sourceText$LWS, 'use strict') === -1 ?
15132
15142
  // Append "'use strict'" to the extracted function body so it is
15133
15143
  // evaluated in strict mode.
@@ -15317,7 +15327,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15317
15327
  ObjectAssign$LWS$1({}, DEFAULT_ENDOWMENTS_DESCRIPTOR_MAP$LWS, ObjectGetOwnPropertyDescriptors$LWS(endowments$LWS)) : DEFAULT_ENDOWMENTS_DESCRIPTOR_MAP$LWS,
15318
15328
  instrumentation: instrumentation$LWS,
15319
15329
  remapTypedArrays: remapTypedArrays$LWS,
15320
- keepAlive: IFRAME_KEEP_ALIVE_FLAG$LWS,
15330
+ keepAlive: !remapTypedArrays$LWS && isLockerFeatureEnabled$LWS('isLockerNextForOmnistudioEnabled') || IFRAME_KEEP_ALIVE_FLAG$LWS,
15321
15331
  liveTargetCallback: isTargetLive$LWS,
15322
15332
  signSourceCallback: sourceText$LWS => trusted.createScript(sourceText$LWS)
15323
15333
  });
@@ -15777,9 +15787,27 @@ function wrapPlatformResourceLoader$LWS(dep$LWS, key$LWS) {
15777
15787
  return secureDep$LWS;
15778
15788
  }
15779
15789
  secureDep$LWS = {
15780
- loadScript: (thisArg$LWS, url$LWS) => createRootWindowSandboxRecord$LWS({
15781
- key: key$LWS
15782
- }).helpers.loadScript(thisArg$LWS, url$LWS),
15790
+ loadScript: (thisArg$LWS, url$LWS, config$LWS) => {
15791
+ const sandbox$LWS = createRootWindowSandboxRecord$LWS({
15792
+ key: key$LWS
15793
+ });
15794
+ if (isGaterEnabledFeature$LWS('enableTrustedMode') && config$LWS != null && config$LWS.trustedMode) {
15795
+ const trustedGlobals$LWS = config$LWS.trustedGlobals;
15796
+ if ((trustedGlobals$LWS == null ? void 0 : trustedGlobals$LWS.length) > 0) {
15797
+ return dep$LWS.loadScript(thisArg$LWS, url$LWS).then(() => {
15798
+ const installGlobals$LWS = sandbox$LWS.virtualEnvironmentEvaluator(`(list) => list.forEach(([key, get, set]) => Object.defineProperty(window, key, { get, set, configurable: true, enumerable: true }));`);
15799
+ const globals$LWS = trustedGlobals$LWS.map(globalName$LWS => [globalName$LWS, function get$LWS() {
15800
+ return window[globalName$LWS];
15801
+ }, function set$LWS(value$LWS) {
15802
+ window[globalName$LWS] = value$LWS;
15803
+ }]);
15804
+ installGlobals$LWS(globals$LWS);
15805
+ });
15806
+ }
15807
+ return dep$LWS.loadScript(thisArg$LWS, url$LWS);
15808
+ }
15809
+ return sandbox$LWS.helpers.loadScript(thisArg$LWS, url$LWS);
15810
+ },
15783
15811
  loadStyle: (thisArg$LWS, url$LWS) => createRootWindowSandboxRecord$LWS({
15784
15812
  key: key$LWS
15785
15813
  }).helpers.loadStyle(thisArg$LWS, url$LWS)
@@ -15787,7 +15815,7 @@ function wrapPlatformResourceLoader$LWS(dep$LWS, key$LWS) {
15787
15815
  depRegistry$LWS.set(dep$LWS, secureDep$LWS);
15788
15816
  return secureDep$LWS;
15789
15817
  }
15790
- /*! version: 0.22.1 */
15818
+ /*! version: 0.22.3 */
15791
15819
 
15792
15820
  const loaderDefine = globalThis.LWR.define;
15793
15821
 
@@ -1329,6 +1329,10 @@ const {
1329
1329
  function consoleWarn$LWS(...args$LWS) {
1330
1330
  ReflectApply$LWS$1(consoleWarnRef$LWS, consoleRef$LWS, args$LWS);
1331
1331
  }
1332
+ let gaterEnabledFeatures$LWS = [];
1333
+ function isGaterEnabledFeature$LWS(featureName$LWS) {
1334
+ return ReflectApply$LWS$1(ArrayProtoIncludes$LWS$1, gaterEnabledFeatures$LWS, [`com.salesforce.locker.${featureName$LWS}`]);
1335
+ }
1332
1336
  const trackedLiveTargets$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1());
1333
1337
  function isTargetLive$LWS(target$LWS, targetTraits$LWS = 0 /* TargetTraits.None */) {
1334
1338
  if (targetTraits$LWS & 1 /* TargetTraits.IsArray */ || targetTraits$LWS & 2 /* TargetTraits.IsArrayBufferView */ || targetTraits$LWS & 64 /* TargetTraits.Revoked */ || target$LWS === null || target$LWS === undefined || target$LWS === ObjectProto$LWS$1 || target$LWS === RegExpProto$LWS$1) {
@@ -1410,6 +1414,10 @@ function trackAsLiveTarget$LWS(target$LWS) {
1410
1414
  trackedLiveTargets$LWS.add(target$LWS);
1411
1415
  return target$LWS;
1412
1416
  }
1417
+ const lockerFeatures$LWS = {};
1418
+ function isLockerFeatureEnabled$LWS(featureName$LWS) {
1419
+ return lockerFeatures$LWS[featureName$LWS];
1420
+ }
1413
1421
  const NS_HEAD$LWS = `${LOCKER_SERVICE_KEY$LWS}-`;
1414
1422
  const NS_TAIL$LWS = '$';
1415
1423
  const STORAGE_NS_HEAD$LWS = `${LOCKER_SERVICE_KEY$LWS}[`;
@@ -1453,7 +1461,7 @@ const {
1453
1461
  } = PromiseCtor$LWS.prototype;
1454
1462
  const PromiseResolve$LWS = PromiseCtor$LWS.resolve.bind(PromiseCtor$LWS);
1455
1463
  const PromiseReject$LWS = PromiseCtor$LWS.reject.bind(PromiseCtor$LWS);
1456
- /*! version: 0.22.1 */
1464
+ /*! version: 0.22.3 */
1457
1465
 
1458
1466
  /*!
1459
1467
  * Copyright (C) 2019 salesforce.com, inc.
@@ -2112,7 +2120,7 @@ const {
2112
2120
  const XhrProtoResponseTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'responseText');
2113
2121
  const XhrProtoStatusGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'status');
2114
2122
  ObjectLookupOwnSetter$LWS(XhrProto$LWS, 'withCredentials');
2115
- /*! version: 0.22.1 */
2123
+ /*! version: 0.22.3 */
2116
2124
 
2117
2125
  /*!
2118
2126
  * Copyright (C) 2019 salesforce.com, inc.
@@ -2171,7 +2179,7 @@ function sanitizeURLForElement$LWS(url$LWS) {
2171
2179
  function sanitizeURLString$LWS(urlString$LWS) {
2172
2180
  return urlString$LWS === '' ? urlString$LWS : ReflectApply$LWS$1(StringProtoReplace$LWS, urlString$LWS, [newlinesAndTabsRegExp$LWS, '']);
2173
2181
  }
2174
- /*! version: 0.22.1 */
2182
+ /*! version: 0.22.3 */
2175
2183
 
2176
2184
  /*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */
2177
2185
 
@@ -3857,7 +3865,7 @@ try {
3857
3865
  // swallow
3858
3866
  }
3859
3867
  const trusted = createPolicy('trusted', policyOptions);
3860
- /*! version: 0.22.1 */
3868
+ /*! version: 0.22.3 */
3861
3869
 
3862
3870
  /*!
3863
3871
  * Copyright (C) 2019 salesforce.com, inc.
@@ -4116,7 +4124,7 @@ function blobSanitizer$LWS(sandboxKey$LWS) {
4116
4124
  }
4117
4125
  return getSanitizerForConfig$LWS(sandboxKey$LWS, 'STRING_BLOB_HTML');
4118
4126
  }
4119
- /*! version: 0.22.1 */
4127
+ /*! version: 0.22.3 */
4120
4128
 
4121
4129
  /*!
4122
4130
  * Copyright (C) 2023 salesforce.com, inc.
@@ -4314,7 +4322,7 @@ function encloseSrcSetter$LWS(targetElement$LWS) {
4314
4322
  ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, targetElement$LWS, [attributeNamespaceURI$LWS, attributeName$LWS, src$LWS]);
4315
4323
  };
4316
4324
  }
4317
- /*! version: 0.22.1 */
4325
+ /*! version: 0.22.3 */
4318
4326
 
4319
4327
  /*!
4320
4328
  * Copyright (C) 2019 salesforce.com, inc.
@@ -5055,6 +5063,7 @@ document$LWS = globalObject$LWS.document) {
5055
5063
  function setCustomElementsRegistry$LWS(document$LWS, key$LWS) {
5056
5064
  currentRegistry$LWS = getSandboxCustomElementRegistry$LWS(document$LWS, key$LWS);
5057
5065
  }
5066
+ const DataTransferBlockedProperties$LWS = ['mozCursor', 'mozSourceNode', 'mozUserCancelled'];
5058
5067
  const attributeDistortionFactoriesCache$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
5059
5068
  const sandboxAttributeDistortionRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
5060
5069
  function finalizeAttributeDistortions$LWS(record$LWS) {
@@ -9916,7 +9925,7 @@ const SVGElementBlockedProperties$LWS = ['nonce'];
9916
9925
  const UIEventBlockedProperties$LWS = ['rangeParent'];
9917
9926
  const WindowBlockedProperties$LWS = ['find', 'requestFileSystem', 'webkitRequestFileSystem'];
9918
9927
  const XSLTProcessorBlockedProperties$LWS = ['transformToDocument', 'transformToFragment'];
9919
- /*! version: 0.22.1 */
9928
+ /*! version: 0.22.3 */
9920
9929
 
9921
9930
  /*!
9922
9931
  * Copyright (C) 2019 salesforce.com, inc.
@@ -10026,6 +10035,7 @@ function getDistortionFactories$LWS(record$LWS) {
10026
10035
  addBlockedAttributeDistortionFactoryInitializers$LWS(HTMLIFrameElement$LWS, 'HTMLIFrameElement', HTMLIFrameElementBlockedAttributes$LWS, initializers$LWS);
10027
10036
  addBlockedAttributeDistortionFactoryInitializers$LWS(HTMLScriptElement$LWS, 'HTMLScriptElement', HTMLScriptElementBlockedAttributes$LWS, initializers$LWS);
10028
10037
  addBlockedAttributeDistortionFactoryInitializers$LWS(SVGElement$LWS, 'SVGElement', SVGElementBlockedAttributes$LWS, initializers$LWS);
10038
+ addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, DataTransfer.prototype, DataTransferBlockedProperties$LWS, initializers$LWS);
10029
10039
  addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, Document$LWS.prototype, DocumentBlockedProperties$LWS, initializers$LWS);
10030
10040
  addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, Element$LWS.prototype, ElementBlockedProperties$LWS, initializers$LWS);
10031
10041
  addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, Event$LWS.prototype, EventBlockedProperties$LWS, initializers$LWS);
@@ -15129,7 +15139,7 @@ function toSourceText$LWS(value$LWS, sourceType$LWS) {
15129
15139
  // tools from mistaking the regexp or the replacement string for an
15130
15140
  // actual source mapping URL.
15131
15141
  /\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
15132
- sourceText$LWS = `\n//# LWS Version = "0.22.1"\n${sourceText$LWS}`;
15142
+ sourceText$LWS = `\n//# LWS Version = "0.22.3"\n${sourceText$LWS}`;
15133
15143
  return sourceType$LWS === 1 /* SourceType.Module */ && indexOfPragma$LWS(sourceText$LWS, 'use strict') === -1 ?
15134
15144
  // Append "'use strict'" to the extracted function body so it is
15135
15145
  // evaluated in strict mode.
@@ -15319,7 +15329,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15319
15329
  ObjectAssign$LWS$1({}, DEFAULT_ENDOWMENTS_DESCRIPTOR_MAP$LWS, ObjectGetOwnPropertyDescriptors$LWS(endowments$LWS)) : DEFAULT_ENDOWMENTS_DESCRIPTOR_MAP$LWS,
15320
15330
  instrumentation: instrumentation$LWS,
15321
15331
  remapTypedArrays: remapTypedArrays$LWS,
15322
- keepAlive: IFRAME_KEEP_ALIVE_FLAG$LWS,
15332
+ keepAlive: !remapTypedArrays$LWS && isLockerFeatureEnabled$LWS('isLockerNextForOmnistudioEnabled') || IFRAME_KEEP_ALIVE_FLAG$LWS,
15323
15333
  liveTargetCallback: isTargetLive$LWS,
15324
15334
  signSourceCallback: sourceText$LWS => trusted.createScript(sourceText$LWS)
15325
15335
  });
@@ -15809,9 +15819,27 @@ function wrapPlatformResourceLoader$LWS(dep$LWS, key$LWS) {
15809
15819
  return secureDep$LWS;
15810
15820
  }
15811
15821
  secureDep$LWS = {
15812
- loadScript: (thisArg$LWS, url$LWS) => createRootWindowSandboxRecord$LWS({
15813
- key: key$LWS
15814
- }).helpers.loadScript(thisArg$LWS, url$LWS),
15822
+ loadScript: (thisArg$LWS, url$LWS, config$LWS) => {
15823
+ const sandbox$LWS = createRootWindowSandboxRecord$LWS({
15824
+ key: key$LWS
15825
+ });
15826
+ if (isGaterEnabledFeature$LWS('enableTrustedMode') && config$LWS != null && config$LWS.trustedMode) {
15827
+ const trustedGlobals$LWS = config$LWS.trustedGlobals;
15828
+ if ((trustedGlobals$LWS == null ? void 0 : trustedGlobals$LWS.length) > 0) {
15829
+ return dep$LWS.loadScript(thisArg$LWS, url$LWS).then(() => {
15830
+ const installGlobals$LWS = sandbox$LWS.virtualEnvironmentEvaluator(`(list) => list.forEach(([key, get, set]) => Object.defineProperty(window, key, { get, set, configurable: true, enumerable: true }));`);
15831
+ const globals$LWS = trustedGlobals$LWS.map(globalName$LWS => [globalName$LWS, function get$LWS() {
15832
+ return window[globalName$LWS];
15833
+ }, function set$LWS(value$LWS) {
15834
+ window[globalName$LWS] = value$LWS;
15835
+ }]);
15836
+ installGlobals$LWS(globals$LWS);
15837
+ });
15838
+ }
15839
+ return dep$LWS.loadScript(thisArg$LWS, url$LWS);
15840
+ }
15841
+ return sandbox$LWS.helpers.loadScript(thisArg$LWS, url$LWS);
15842
+ },
15815
15843
  loadStyle: (thisArg$LWS, url$LWS) => createRootWindowSandboxRecord$LWS({
15816
15844
  key: key$LWS
15817
15845
  }).helpers.loadStyle(thisArg$LWS, url$LWS)
@@ -15819,7 +15847,7 @@ function wrapPlatformResourceLoader$LWS(dep$LWS, key$LWS) {
15819
15847
  depRegistry$LWS.set(dep$LWS, secureDep$LWS);
15820
15848
  return secureDep$LWS;
15821
15849
  }
15822
- /*! version: 0.22.1 */
15850
+ /*! version: 0.22.3 */
15823
15851
 
15824
15852
  export { $LWS, CORE_SANDBOX_KEY$LWS as CORE_SANDBOX_KEY, createRootWindowSandboxRecord$LWS as createRootWindowSandboxRecord, evaluateFunction$LWS as evaluateFunction, evaluateInCoreSandbox$LWS as evaluateInCoreSandbox, evaluateInSandbox$LWS as evaluateInSandbox, trusted, wrapDependency$LWS as wrapDependency };
15825
15853
  //# sourceMappingURL=lockerSandbox.js.map
@@ -16,7 +16,7 @@ export const INIT_MODULE_COUNT = `${INIT_MODULE}.count`;
16
16
  export const LOADER_PREFIX = 'lwr.loader.';
17
17
  export const MODULE_DEFINE = `${LOADER_PREFIX}module.define`;
18
18
  export const MODULE_DEFINE_COUNT = `${MODULE_DEFINE}.count`;
19
- export const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}moduleRegistry.dynamicLoad`;
19
+ export const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}module.dynamicLoad`;
20
20
  export const MODULE_DYNAMIC_LOAD_COUNT = `${MODULE_DYNAMIC_LOAD}.count`;
21
21
  export const MODULE_FETCH = `${LOADER_PREFIX}module.fetch`;
22
22
  export const MODULE_FETCH_COUNT = `${MODULE_FETCH}.count`;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Client-side module implementation of the serverDataCallback bootstrap service.
3
+ */
4
+
5
+ const serverDataCallbacks = [];
6
+ export function registerServerDataCallbacks(hook) {
7
+ serverDataCallbacks.push(hook);
8
+ }
9
+ export function evaluateServerDataCallbacks(serverData = {}) {
10
+ // now that we have server data, run the server data hooks
11
+ for (const serverDataCallback of serverDataCallbacks) {
12
+ serverDataCallback({
13
+ serverData
14
+ });
15
+ }
16
+ }
@@ -1,5 +1,6 @@
1
1
  import { registerHandleStaleModuleHook } from './handleStaleModuleESM';
2
2
  import { getClientBootstrapConfig } from 'lwr/preInit';
3
+ import { registerServerDataCallbacks } from 'lwr/serverDataCallback';
3
4
  const noop = () => {
4
5
  console.warn('API is not supported in ESM format');
5
6
  };
@@ -17,13 +18,10 @@ function getAppMetadata() {
17
18
  rootComponents
18
19
  };
19
20
  }
20
- function getServerData() {
21
- return getClientBootstrapConfig().serverData;
22
- }
23
21
  export const services = {
24
22
  // addLoaderPlugin is only supported in AMD
25
23
  addLoaderPlugin: noop,
26
24
  handleStaleModule: registerHandleStaleModuleHook,
27
25
  appMetadata: getAppMetadata(),
28
- serverData: getServerData() || {}
26
+ addServerDataCallback: registerServerDataCallbacks
29
27
  };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.13.0-alpha.2",
7
+ "version": "0.13.0-alpha.21",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -33,11 +33,11 @@
33
33
  "build:platform": "node scripts/strip-for-core.js"
34
34
  },
35
35
  "dependencies": {
36
- "@locker/sandbox": "0.22.1",
37
- "@lwrjs/shared-utils": "0.13.0-alpha.2"
36
+ "@locker/sandbox": "0.22.3",
37
+ "@lwrjs/shared-utils": "0.13.0-alpha.21"
38
38
  },
39
39
  "devDependencies": {
40
- "@lwrjs/types": "0.13.0-alpha.2",
40
+ "@lwrjs/types": "0.13.0-alpha.21",
41
41
  "@rollup/plugin-node-resolve": "^15.2.3",
42
42
  "@rollup/plugin-sucrase": "^5.0.2",
43
43
  "@rollup/plugin-terser": "^0.4.4",
@@ -60,7 +60,8 @@
60
60
  "lwr/lockerDefine",
61
61
  "lwr/lockerSandbox",
62
62
  "lwr/metrics",
63
- "lwr/profiler"
63
+ "lwr/profiler",
64
+ "lwr/serverDataCallback"
64
65
  ]
65
66
  },
66
67
  "engines": {
@@ -69,5 +70,5 @@
69
70
  "volta": {
70
71
  "extends": "../../../package.json"
71
72
  },
72
- "gitHead": "3ae1051ef1eb282f9c1fb54f6aab44ab5ba48480"
73
+ "gitHead": "d272dcd07881fa469ee73bd28d2f30f99957e122"
73
74
  }
@@ -1,12 +0,0 @@
1
- import { swapTemplate, swapStyle, swapComponent } from 'lwc';
2
-
3
- export function updateStaleModule({ oldModule, newModule, specifier }) {
4
- if (specifier.endsWith('html') && newModule.default) {
5
- console.log(`Swapping html template for module "${specifier}"`);
6
- swapTemplate(oldModule.default, newModule.default);
7
- } else if (specifier.endsWith('css') && newModule.default) {
8
- swapStyle(oldModule.default[0], newModule.default[0]);
9
- } else {
10
- swapComponent(oldModule.default, newModule.default);
11
- }
12
- }