@contentful/experiences-visual-editor-react 3.4.0 → 3.4.1-dev-20250901T1330-2519e19.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/index.js +81 -68
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +81 -68
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -44646,19 +44646,22 @@ const checkLocalStorageAvailability$1 = () => {
|
|
|
44646
44646
|
return false;
|
|
44647
44647
|
}
|
|
44648
44648
|
};
|
|
44649
|
+
const DEBUG_LEVELS_HIERARCHY$1 = ['error', 'warn', 'log', 'debug'];
|
|
44649
44650
|
let DebugLogger$1 = class DebugLogger {
|
|
44650
44651
|
constructor() {
|
|
44652
|
+
this.activeLevel = 'warn';
|
|
44651
44653
|
// Public methods for logging
|
|
44652
44654
|
this.error = this.logger('error');
|
|
44653
44655
|
this.warn = this.logger('warn');
|
|
44654
44656
|
this.log = this.logger('log');
|
|
44655
44657
|
this.debug = this.logger('debug');
|
|
44656
44658
|
if (!checkLocalStorageAvailability$1()) {
|
|
44657
|
-
this.enabled = false;
|
|
44658
44659
|
return;
|
|
44659
44660
|
}
|
|
44660
44661
|
// Default to checking localStorage for the debug mode on initialization if in browser
|
|
44661
|
-
|
|
44662
|
+
if (localStorage.getItem(CF_DEBUG_KEY$1) === 'true') {
|
|
44663
|
+
this.activeLevel = 'debug';
|
|
44664
|
+
}
|
|
44662
44665
|
}
|
|
44663
44666
|
static getInstance() {
|
|
44664
44667
|
if (this.instance === null) {
|
|
@@ -44666,15 +44669,15 @@ let DebugLogger$1 = class DebugLogger {
|
|
|
44666
44669
|
}
|
|
44667
44670
|
return this.instance;
|
|
44668
44671
|
}
|
|
44669
|
-
|
|
44670
|
-
return this.
|
|
44672
|
+
getActiveLevel() {
|
|
44673
|
+
return this.activeLevel;
|
|
44671
44674
|
}
|
|
44672
|
-
|
|
44673
|
-
this.
|
|
44674
|
-
if (
|
|
44675
|
+
setActiveLevel(level) {
|
|
44676
|
+
this.activeLevel = level;
|
|
44677
|
+
if (!checkLocalStorageAvailability$1()) {
|
|
44675
44678
|
return;
|
|
44676
44679
|
}
|
|
44677
|
-
if (
|
|
44680
|
+
if (this.activeLevel === 'debug' || this.activeLevel === 'log') {
|
|
44678
44681
|
localStorage.setItem(CF_DEBUG_KEY$1, 'true');
|
|
44679
44682
|
}
|
|
44680
44683
|
else {
|
|
@@ -44684,14 +44687,17 @@ let DebugLogger$1 = class DebugLogger {
|
|
|
44684
44687
|
// Log method for different levels (error, warn, log)
|
|
44685
44688
|
logger(level) {
|
|
44686
44689
|
return (...args) => {
|
|
44687
|
-
|
|
44688
|
-
|
|
44690
|
+
const levelPriority = DEBUG_LEVELS_HIERARCHY$1.indexOf(level);
|
|
44691
|
+
const activeLevelPriority = DEBUG_LEVELS_HIERARCHY$1.indexOf(this.activeLevel);
|
|
44692
|
+
const enabled = levelPriority <= activeLevelPriority;
|
|
44693
|
+
if (enabled) {
|
|
44694
|
+
console[level](...args);
|
|
44689
44695
|
}
|
|
44690
44696
|
};
|
|
44691
44697
|
}
|
|
44692
44698
|
};
|
|
44693
44699
|
DebugLogger$1.instance = null;
|
|
44694
|
-
DebugLogger$1.getInstance();
|
|
44700
|
+
const debug$1 = DebugLogger$1.getInstance();
|
|
44695
44701
|
|
|
44696
44702
|
const findOutermostCoordinates = (first, second) => {
|
|
44697
44703
|
return {
|
|
@@ -44762,14 +44768,14 @@ const isLinkToAsset = (variable) => {
|
|
|
44762
44768
|
variable.sys?.type === 'Link');
|
|
44763
44769
|
};
|
|
44764
44770
|
|
|
44765
|
-
|
|
44771
|
+
function isLink$1(maybeLink) {
|
|
44766
44772
|
if (maybeLink === null)
|
|
44767
44773
|
return false;
|
|
44768
44774
|
if (typeof maybeLink !== 'object')
|
|
44769
44775
|
return false;
|
|
44770
44776
|
const link = maybeLink;
|
|
44771
44777
|
return Boolean(link.sys?.id) && link.sys?.type === 'Link' && Boolean(link.sys?.linkType);
|
|
44772
|
-
}
|
|
44778
|
+
}
|
|
44773
44779
|
|
|
44774
44780
|
/**
|
|
44775
44781
|
* This module encapsulates format of the path to a deep reference.
|
|
@@ -44919,7 +44925,7 @@ const lastPathNamedSegmentEq = (path, expectedName) => {
|
|
|
44919
44925
|
// ['', 'key123', 'fields', 'featureImage', '~locale', 'fields', 'file', '~locale']
|
|
44920
44926
|
const segments = path.split('/');
|
|
44921
44927
|
if (segments.length < 2) {
|
|
44922
|
-
|
|
44928
|
+
debug$1.warn(`[experiences-core::pathSchema] Attempting to check whether last named segment of the path (${path}) equals to '${expectedName}', but the path doesn't have enough segments.`);
|
|
44923
44929
|
return false;
|
|
44924
44930
|
}
|
|
44925
44931
|
const secondLast = segments[segments.length - 2]; // skipping trailing '~locale'
|
|
@@ -45360,7 +45366,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
45360
45366
|
? variables[optionsVariableName].valuesByBreakpoint
|
|
45361
45367
|
: {});
|
|
45362
45368
|
if (!options) {
|
|
45363
|
-
|
|
45369
|
+
debug$1.error(`[experiences-core::transformMedia] Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);
|
|
45364
45370
|
return;
|
|
45365
45371
|
}
|
|
45366
45372
|
try {
|
|
@@ -45374,7 +45380,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
45374
45380
|
return value;
|
|
45375
45381
|
}
|
|
45376
45382
|
catch (error) {
|
|
45377
|
-
|
|
45383
|
+
debug$1.error('[experiences-core::transformMedia] Error transforming image asset', error);
|
|
45378
45384
|
}
|
|
45379
45385
|
return;
|
|
45380
45386
|
}
|
|
@@ -45385,7 +45391,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
45385
45391
|
? variables[optionsVariableName].valuesByBreakpoint
|
|
45386
45392
|
: {});
|
|
45387
45393
|
if (!options) {
|
|
45388
|
-
|
|
45394
|
+
debug$1.error(`[experiences-core::transformMedia] Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);
|
|
45389
45395
|
return;
|
|
45390
45396
|
}
|
|
45391
45397
|
try {
|
|
@@ -45402,7 +45408,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
45402
45408
|
return value;
|
|
45403
45409
|
}
|
|
45404
45410
|
catch (error) {
|
|
45405
|
-
|
|
45411
|
+
debug$1.error('[experiences-core::transformMedia] Error transforming image asset', error);
|
|
45406
45412
|
}
|
|
45407
45413
|
return;
|
|
45408
45414
|
}
|
|
@@ -45440,7 +45446,7 @@ function getResolvedEntryFromLink(entryOrAsset, path, entityStore) {
|
|
|
45440
45446
|
resolvedEntity = entityStore.getEntityFromLink(value);
|
|
45441
45447
|
}
|
|
45442
45448
|
else {
|
|
45443
|
-
|
|
45449
|
+
debug$1.warn(`[experiences-core::getResolvedEntryFromLink] When attempting to follow link in field '${fieldName}' of entity, the value is expected to be a link, but got: ${JSON.stringify(value)}`, { entity: entryOrAsset });
|
|
45444
45450
|
return;
|
|
45445
45451
|
}
|
|
45446
45452
|
// no need to make structuredClone(entityStore.getEntityFromLink(value)) because
|
|
@@ -45467,7 +45473,7 @@ function getArrayValue(entryOrAsset, path, entityStore) {
|
|
|
45467
45473
|
const fieldName = path.split('/').slice(2, -1);
|
|
45468
45474
|
const arrayValue = get$1(entryOrAsset, fieldName);
|
|
45469
45475
|
if (!isArray(arrayValue)) {
|
|
45470
|
-
|
|
45476
|
+
debug$1.warn(`[experiences-core::getArrayValue] A field '${fieldName}' of an entity was bound to an Array variable. Expected value of that field to be an array, but got: ${JSON.stringify(arrayValue)}`, { entity: entryOrAsset });
|
|
45471
45477
|
return;
|
|
45472
45478
|
}
|
|
45473
45479
|
const result = arrayValue
|
|
@@ -45487,7 +45493,7 @@ function getArrayValue(entryOrAsset, path, entityStore) {
|
|
|
45487
45493
|
return resolvedEntity;
|
|
45488
45494
|
}
|
|
45489
45495
|
else {
|
|
45490
|
-
|
|
45496
|
+
debug$1.warn(`[experiences-core::getArrayValue] Expected value to be a string or Link, but got: ${JSON.stringify(value)}`);
|
|
45491
45497
|
return undefined;
|
|
45492
45498
|
}
|
|
45493
45499
|
})
|
|
@@ -45666,7 +45672,7 @@ const sendMessage = (eventType, data) => {
|
|
|
45666
45672
|
if (typeof window === 'undefined') {
|
|
45667
45673
|
return;
|
|
45668
45674
|
}
|
|
45669
|
-
|
|
45675
|
+
debug$1.debug(`[experiences-sdk-react::sendMessage] Sending message [${eventType}]`, {
|
|
45670
45676
|
source: 'customer-app',
|
|
45671
45677
|
eventType,
|
|
45672
45678
|
payload: data,
|
|
@@ -45718,7 +45724,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
45718
45724
|
? this.entryMap.get(linkOrEntryOrAsset.sys.id)
|
|
45719
45725
|
: this.assetMap.get(linkOrEntryOrAsset.sys.id);
|
|
45720
45726
|
if (!resolvedEntity || resolvedEntity.sys.type !== linkOrEntryOrAsset.sys.linkType) {
|
|
45721
|
-
|
|
45727
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
45722
45728
|
return;
|
|
45723
45729
|
}
|
|
45724
45730
|
entity = resolvedEntity;
|
|
@@ -45728,7 +45734,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
45728
45734
|
entity = linkOrEntryOrAsset;
|
|
45729
45735
|
}
|
|
45730
45736
|
else {
|
|
45731
|
-
throw new Error(`Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
45737
|
+
throw new Error(`[experiences-core::EntityStoreBase] Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
45732
45738
|
}
|
|
45733
45739
|
return entity;
|
|
45734
45740
|
}
|
|
@@ -45742,7 +45748,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
45742
45748
|
const entity = this.getEntity(entityLink.sys.linkType, entityLink.sys.id);
|
|
45743
45749
|
if (!entity) {
|
|
45744
45750
|
// TODO: move to `debug` utils once it is extracted
|
|
45745
|
-
|
|
45751
|
+
debug$1.warn(`Unresolved entity reference: ${entityLink.sys.linkType} with ID ${entityLink.sys.id}`);
|
|
45746
45752
|
return;
|
|
45747
45753
|
}
|
|
45748
45754
|
return get$1(entity, path);
|
|
@@ -45752,7 +45758,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
45752
45758
|
? this.entryMap.get(link.sys.id)
|
|
45753
45759
|
: this.assetMap.get(link.sys.id);
|
|
45754
45760
|
if (!resolvedEntity || resolvedEntity.sys.type !== link.sys.linkType) {
|
|
45755
|
-
|
|
45761
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(link)}`);
|
|
45756
45762
|
return;
|
|
45757
45763
|
}
|
|
45758
45764
|
return resolvedEntity;
|
|
@@ -45760,7 +45766,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
45760
45766
|
getAssetById(assetId) {
|
|
45761
45767
|
const asset = this.assetMap.get(assetId);
|
|
45762
45768
|
if (!asset) {
|
|
45763
|
-
|
|
45769
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Asset with ID "${assetId}" is not found in the store`);
|
|
45764
45770
|
return;
|
|
45765
45771
|
}
|
|
45766
45772
|
return asset;
|
|
@@ -45768,7 +45774,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
45768
45774
|
getEntryById(entryId) {
|
|
45769
45775
|
const entry = this.entryMap.get(entryId);
|
|
45770
45776
|
if (!entry) {
|
|
45771
|
-
|
|
45777
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Entry with ID "${entryId}" is not found in the store`);
|
|
45772
45778
|
return;
|
|
45773
45779
|
}
|
|
45774
45780
|
return entry;
|
|
@@ -45807,7 +45813,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
45807
45813
|
const { resolved, missing } = this.getEntitiesFromMap('Asset', [id]);
|
|
45808
45814
|
if (missing.length) {
|
|
45809
45815
|
// TODO: move to `debug` utils once it is extracted
|
|
45810
|
-
|
|
45816
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Asset "${id}" is not in the store`);
|
|
45811
45817
|
return;
|
|
45812
45818
|
}
|
|
45813
45819
|
return resolved[0];
|
|
@@ -45823,7 +45829,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
45823
45829
|
const { resolved, missing } = this.getEntitiesFromMap('Entry', [id]);
|
|
45824
45830
|
if (missing.length) {
|
|
45825
45831
|
// TODO: move to `debug` utils once it is extracted
|
|
45826
|
-
|
|
45832
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Entry "${id}" is not in the store`);
|
|
45827
45833
|
return;
|
|
45828
45834
|
}
|
|
45829
45835
|
return resolved[0];
|
|
@@ -45899,8 +45905,9 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
45899
45905
|
// in case we can't follow till the end, we should signal that there was null-reference in the path
|
|
45900
45906
|
const { resolvedFieldset, isFullyResolved, reason } = resolveFieldset(unresolvedFieldset, headEntity);
|
|
45901
45907
|
if (!isFullyResolved) {
|
|
45902
|
-
reason
|
|
45903
|
-
|
|
45908
|
+
if (reason) {
|
|
45909
|
+
debug$1.log(`[experiences-core::EntityStoreBase] Deep path wasn't resolved till leaf node, falling back to undefined, because: ${reason}`);
|
|
45910
|
+
}
|
|
45904
45911
|
return;
|
|
45905
45912
|
}
|
|
45906
45913
|
const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];
|
|
@@ -45976,7 +45983,7 @@ class EditorEntityStore extends EntityStoreBase$1 {
|
|
|
45976
45983
|
unsubscribe();
|
|
45977
45984
|
}
|
|
45978
45985
|
else {
|
|
45979
|
-
|
|
45986
|
+
debug$1.warn('[experiences-core::EditorEntityStore] Unexpected entities received in REQUESTED_ENTITIES. Ignoring this response.');
|
|
45980
45987
|
}
|
|
45981
45988
|
});
|
|
45982
45989
|
const timeout = setTimeout(() => {
|
|
@@ -46007,7 +46014,7 @@ class EditorEntityStore extends EntityStoreBase$1 {
|
|
|
46007
46014
|
}
|
|
46008
46015
|
catch (err) {
|
|
46009
46016
|
// TODO: move to debug utils once it is extracted
|
|
46010
|
-
|
|
46017
|
+
debug$1.warn(`[experiences-core::EditorEntityStore] Failed to request asset ${id}`);
|
|
46011
46018
|
return undefined;
|
|
46012
46019
|
}
|
|
46013
46020
|
}
|
|
@@ -46020,7 +46027,7 @@ class EditorEntityStore extends EntityStoreBase$1 {
|
|
|
46020
46027
|
}
|
|
46021
46028
|
catch (err) {
|
|
46022
46029
|
// TODO: move to debug utils once it is extracted
|
|
46023
|
-
|
|
46030
|
+
debug$1.warn(`[experiences-core::EditorEntityStore] Failed to request entry ${id}`, err);
|
|
46024
46031
|
return undefined;
|
|
46025
46032
|
}
|
|
46026
46033
|
}
|
|
@@ -46040,7 +46047,7 @@ function transformAssetFileToUrl(fieldValue) {
|
|
|
46040
46047
|
const REQUEST_TIMEOUT = 10000;
|
|
46041
46048
|
class EditorModeEntityStore extends EditorEntityStore {
|
|
46042
46049
|
constructor({ entities, locale }) {
|
|
46043
|
-
|
|
46050
|
+
debug$1.debug(`[experiences-core::EditorModeEntityStore] Initializing editor entity store with ${entities.length} entities for locale ${locale}.`, { entities });
|
|
46044
46051
|
const subscribe = (method, cb) => {
|
|
46045
46052
|
const handleMessage = (event) => {
|
|
46046
46053
|
const data = JSON.parse(event.data);
|
|
@@ -46140,7 +46147,7 @@ const inMemoryEntitiesStore = create((set, get) => ({
|
|
|
46140
46147
|
|
|
46141
46148
|
function maybeResolveLink(maybeLink) {
|
|
46142
46149
|
if (!isLink$1(maybeLink)) {
|
|
46143
|
-
|
|
46150
|
+
debug$1.warn('[experiences-core::InMemoryEntitiesStore] maybeResolveLink function must receive Link shape. Provided argument does not match the Link shape: ', maybeLink);
|
|
46144
46151
|
return undefined;
|
|
46145
46152
|
}
|
|
46146
46153
|
return inMemoryEntitiesStore.getState().resolveEntity(maybeLink);
|
|
@@ -47277,7 +47284,7 @@ const useTreeStore = create((set, get) => ({
|
|
|
47277
47284
|
// The current and updated tree are the same, no tree update required.
|
|
47278
47285
|
// Special case: Breakpoints changed (e.g. empty experience gets reloaded or breakpoints updated)
|
|
47279
47286
|
if (!treeDiff.length && !didBreakpointsChange) {
|
|
47280
|
-
|
|
47287
|
+
debug$1.debug(`[experiences-visual-editor-react::useTreeStore]: During smart-diffing no diffs. Skipping tree update.`);
|
|
47281
47288
|
return;
|
|
47282
47289
|
}
|
|
47283
47290
|
set(produce((state) => {
|
|
@@ -49252,19 +49259,22 @@ const checkLocalStorageAvailability = () => {
|
|
|
49252
49259
|
return false;
|
|
49253
49260
|
}
|
|
49254
49261
|
};
|
|
49262
|
+
const DEBUG_LEVELS_HIERARCHY = ['error', 'warn', 'log', 'debug'];
|
|
49255
49263
|
class DebugLogger {
|
|
49256
49264
|
constructor() {
|
|
49265
|
+
this.activeLevel = 'warn';
|
|
49257
49266
|
// Public methods for logging
|
|
49258
49267
|
this.error = this.logger('error');
|
|
49259
49268
|
this.warn = this.logger('warn');
|
|
49260
49269
|
this.log = this.logger('log');
|
|
49261
49270
|
this.debug = this.logger('debug');
|
|
49262
49271
|
if (!checkLocalStorageAvailability()) {
|
|
49263
|
-
this.enabled = false;
|
|
49264
49272
|
return;
|
|
49265
49273
|
}
|
|
49266
49274
|
// Default to checking localStorage for the debug mode on initialization if in browser
|
|
49267
|
-
|
|
49275
|
+
if (localStorage.getItem(CF_DEBUG_KEY) === 'true') {
|
|
49276
|
+
this.activeLevel = 'debug';
|
|
49277
|
+
}
|
|
49268
49278
|
}
|
|
49269
49279
|
static getInstance() {
|
|
49270
49280
|
if (this.instance === null) {
|
|
@@ -49272,15 +49282,15 @@ class DebugLogger {
|
|
|
49272
49282
|
}
|
|
49273
49283
|
return this.instance;
|
|
49274
49284
|
}
|
|
49275
|
-
|
|
49276
|
-
return this.
|
|
49285
|
+
getActiveLevel() {
|
|
49286
|
+
return this.activeLevel;
|
|
49277
49287
|
}
|
|
49278
|
-
|
|
49279
|
-
this.
|
|
49280
|
-
if (
|
|
49288
|
+
setActiveLevel(level) {
|
|
49289
|
+
this.activeLevel = level;
|
|
49290
|
+
if (!checkLocalStorageAvailability()) {
|
|
49281
49291
|
return;
|
|
49282
49292
|
}
|
|
49283
|
-
if (
|
|
49293
|
+
if (this.activeLevel === 'debug' || this.activeLevel === 'log') {
|
|
49284
49294
|
localStorage.setItem(CF_DEBUG_KEY, 'true');
|
|
49285
49295
|
}
|
|
49286
49296
|
else {
|
|
@@ -49290,23 +49300,26 @@ class DebugLogger {
|
|
|
49290
49300
|
// Log method for different levels (error, warn, log)
|
|
49291
49301
|
logger(level) {
|
|
49292
49302
|
return (...args) => {
|
|
49293
|
-
|
|
49294
|
-
|
|
49303
|
+
const levelPriority = DEBUG_LEVELS_HIERARCHY.indexOf(level);
|
|
49304
|
+
const activeLevelPriority = DEBUG_LEVELS_HIERARCHY.indexOf(this.activeLevel);
|
|
49305
|
+
const enabled = levelPriority <= activeLevelPriority;
|
|
49306
|
+
if (enabled) {
|
|
49307
|
+
console[level](...args);
|
|
49295
49308
|
}
|
|
49296
49309
|
};
|
|
49297
49310
|
}
|
|
49298
49311
|
}
|
|
49299
49312
|
DebugLogger.instance = null;
|
|
49300
|
-
DebugLogger.getInstance();
|
|
49313
|
+
const debug = DebugLogger.getInstance();
|
|
49301
49314
|
|
|
49302
|
-
|
|
49315
|
+
function isLink(maybeLink) {
|
|
49303
49316
|
if (maybeLink === null)
|
|
49304
49317
|
return false;
|
|
49305
49318
|
if (typeof maybeLink !== 'object')
|
|
49306
49319
|
return false;
|
|
49307
49320
|
const link = maybeLink;
|
|
49308
49321
|
return Boolean(link.sys?.id) && link.sys?.type === 'Link' && Boolean(link.sys?.linkType);
|
|
49309
|
-
}
|
|
49322
|
+
}
|
|
49310
49323
|
const parseDataSourcePathIntoFieldset = (path) => {
|
|
49311
49324
|
const parsedPath = parseDeepPath(path);
|
|
49312
49325
|
if (null === parsedPath) {
|
|
@@ -49463,7 +49476,7 @@ class EntityStoreBase {
|
|
|
49463
49476
|
? this.entryMap.get(linkOrEntryOrAsset.sys.id)
|
|
49464
49477
|
: this.assetMap.get(linkOrEntryOrAsset.sys.id);
|
|
49465
49478
|
if (!resolvedEntity || resolvedEntity.sys.type !== linkOrEntryOrAsset.sys.linkType) {
|
|
49466
|
-
|
|
49479
|
+
debug.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
49467
49480
|
return;
|
|
49468
49481
|
}
|
|
49469
49482
|
entity = resolvedEntity;
|
|
@@ -49473,7 +49486,7 @@ class EntityStoreBase {
|
|
|
49473
49486
|
entity = linkOrEntryOrAsset;
|
|
49474
49487
|
}
|
|
49475
49488
|
else {
|
|
49476
|
-
throw new Error(`Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
49489
|
+
throw new Error(`[experiences-core::EntityStoreBase] Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
49477
49490
|
}
|
|
49478
49491
|
return entity;
|
|
49479
49492
|
}
|
|
@@ -49487,7 +49500,7 @@ class EntityStoreBase {
|
|
|
49487
49500
|
const entity = this.getEntity(entityLink.sys.linkType, entityLink.sys.id);
|
|
49488
49501
|
if (!entity) {
|
|
49489
49502
|
// TODO: move to `debug` utils once it is extracted
|
|
49490
|
-
|
|
49503
|
+
debug.warn(`Unresolved entity reference: ${entityLink.sys.linkType} with ID ${entityLink.sys.id}`);
|
|
49491
49504
|
return;
|
|
49492
49505
|
}
|
|
49493
49506
|
return get(entity, path);
|
|
@@ -49497,7 +49510,7 @@ class EntityStoreBase {
|
|
|
49497
49510
|
? this.entryMap.get(link.sys.id)
|
|
49498
49511
|
: this.assetMap.get(link.sys.id);
|
|
49499
49512
|
if (!resolvedEntity || resolvedEntity.sys.type !== link.sys.linkType) {
|
|
49500
|
-
|
|
49513
|
+
debug.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(link)}`);
|
|
49501
49514
|
return;
|
|
49502
49515
|
}
|
|
49503
49516
|
return resolvedEntity;
|
|
@@ -49505,7 +49518,7 @@ class EntityStoreBase {
|
|
|
49505
49518
|
getAssetById(assetId) {
|
|
49506
49519
|
const asset = this.assetMap.get(assetId);
|
|
49507
49520
|
if (!asset) {
|
|
49508
|
-
|
|
49521
|
+
debug.warn(`[experiences-core::EntityStoreBase] Asset with ID "${assetId}" is not found in the store`);
|
|
49509
49522
|
return;
|
|
49510
49523
|
}
|
|
49511
49524
|
return asset;
|
|
@@ -49513,7 +49526,7 @@ class EntityStoreBase {
|
|
|
49513
49526
|
getEntryById(entryId) {
|
|
49514
49527
|
const entry = this.entryMap.get(entryId);
|
|
49515
49528
|
if (!entry) {
|
|
49516
|
-
|
|
49529
|
+
debug.warn(`[experiences-core::EntityStoreBase] Entry with ID "${entryId}" is not found in the store`);
|
|
49517
49530
|
return;
|
|
49518
49531
|
}
|
|
49519
49532
|
return entry;
|
|
@@ -49552,7 +49565,7 @@ class EntityStoreBase {
|
|
|
49552
49565
|
const { resolved, missing } = this.getEntitiesFromMap('Asset', [id]);
|
|
49553
49566
|
if (missing.length) {
|
|
49554
49567
|
// TODO: move to `debug` utils once it is extracted
|
|
49555
|
-
|
|
49568
|
+
debug.warn(`[experiences-core::EntityStoreBase] Asset "${id}" is not in the store`);
|
|
49556
49569
|
return;
|
|
49557
49570
|
}
|
|
49558
49571
|
return resolved[0];
|
|
@@ -49568,7 +49581,7 @@ class EntityStoreBase {
|
|
|
49568
49581
|
const { resolved, missing } = this.getEntitiesFromMap('Entry', [id]);
|
|
49569
49582
|
if (missing.length) {
|
|
49570
49583
|
// TODO: move to `debug` utils once it is extracted
|
|
49571
|
-
|
|
49584
|
+
debug.warn(`[experiences-core::EntityStoreBase] Entry "${id}" is not in the store`);
|
|
49572
49585
|
return;
|
|
49573
49586
|
}
|
|
49574
49587
|
return resolved[0];
|
|
@@ -49644,8 +49657,9 @@ class EntityStoreBase {
|
|
|
49644
49657
|
// in case we can't follow till the end, we should signal that there was null-reference in the path
|
|
49645
49658
|
const { resolvedFieldset, isFullyResolved, reason } = resolveFieldset(unresolvedFieldset, headEntity);
|
|
49646
49659
|
if (!isFullyResolved) {
|
|
49647
|
-
reason
|
|
49648
|
-
|
|
49660
|
+
if (reason) {
|
|
49661
|
+
debug.log(`[experiences-core::EntityStoreBase] Deep path wasn't resolved till leaf node, falling back to undefined, because: ${reason}`);
|
|
49662
|
+
}
|
|
49649
49663
|
return;
|
|
49650
49664
|
}
|
|
49651
49665
|
const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];
|
|
@@ -49843,8 +49857,7 @@ function useEditorSubscriber(inMemoryEntitiesStore) {
|
|
|
49843
49857
|
}
|
|
49844
49858
|
}
|
|
49845
49859
|
catch (error) {
|
|
49846
|
-
|
|
49847
|
-
console.error(error);
|
|
49860
|
+
debug$1.error('[experiences-visual-editor-react::useEditorSubscriber] Failed fetching entities', { error });
|
|
49848
49861
|
throw error; // TODO: The original catch didn't let's rethrow; for the moment throw to see if we have any errors
|
|
49849
49862
|
}
|
|
49850
49863
|
finally {
|
|
@@ -49860,12 +49873,12 @@ function useEditorSubscriber(inMemoryEntitiesStore) {
|
|
|
49860
49873
|
reloadApp();
|
|
49861
49874
|
}
|
|
49862
49875
|
else {
|
|
49863
|
-
|
|
49876
|
+
debug$1.warn(`[experiences-visual-editor-react::onMessage] Ignoring alien incoming message from origin [${event.origin}], due to: [${reason}]`, event);
|
|
49864
49877
|
}
|
|
49865
49878
|
return;
|
|
49866
49879
|
}
|
|
49867
49880
|
const eventData = tryParseMessage(event);
|
|
49868
|
-
|
|
49881
|
+
debug$1.debug(`[experiences-visual-editor-react::onMessage] Received message [${eventData.eventType}]`, eventData);
|
|
49869
49882
|
if (eventData.eventType === PostMessageMethods$2.REQUESTED_ENTITIES) {
|
|
49870
49883
|
// Expected message: This message is handled in the EntityStore to store fetched entities
|
|
49871
49884
|
return;
|
|
@@ -49963,7 +49976,7 @@ function useEditorSubscriber(inMemoryEntitiesStore) {
|
|
|
49963
49976
|
const knownEvents = Object.values(INCOMING_EVENTS);
|
|
49964
49977
|
const isDeprecatedMessage = knownEvents.includes(eventData.eventType);
|
|
49965
49978
|
if (!isDeprecatedMessage) {
|
|
49966
|
-
|
|
49979
|
+
debug$1.error(`[experiences-visual-editor-react::onMessage] Logic error, unsupported eventType: [${eventData.eventType}]`);
|
|
49967
49980
|
}
|
|
49968
49981
|
}
|
|
49969
49982
|
}
|
|
@@ -50063,7 +50076,7 @@ const useComponentRegistration = (node) => {
|
|
|
50063
50076
|
});
|
|
50064
50077
|
}
|
|
50065
50078
|
if (!registration) {
|
|
50066
|
-
|
|
50079
|
+
debug$1.warn(`[experiences-visual-editor-react::useComponentRegistration] Component registration not found for component with id: "${node.data.blockId}". The registered component might have been removed from the code. To proceed, remove the component manually from the layers tab.`);
|
|
50067
50080
|
return undefined;
|
|
50068
50081
|
}
|
|
50069
50082
|
return registration;
|
|
@@ -50438,7 +50451,7 @@ function waitForImageToBeLoaded(imageNode) {
|
|
|
50438
50451
|
imageNode.removeEventListener('load', handleImageLoad);
|
|
50439
50452
|
imageNode.removeEventListener('error', handleImageLoad);
|
|
50440
50453
|
if (event.type === 'error') {
|
|
50441
|
-
|
|
50454
|
+
debug$1.warn('[experiences-visual-editor-react::canvasGeometry] Image failed to load:', imageNode);
|
|
50442
50455
|
reject();
|
|
50443
50456
|
}
|
|
50444
50457
|
else {
|