@contentful/experiences-visual-editor-react 3.4.0-dev-20250825T1512-8bcc4b9.0 → 3.4.1-dev-20250828T1024-c2a782a.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/index.js
CHANGED
|
@@ -1182,19 +1182,22 @@ const checkLocalStorageAvailability$1 = () => {
|
|
|
1182
1182
|
return false;
|
|
1183
1183
|
}
|
|
1184
1184
|
};
|
|
1185
|
+
const DEBUG_LEVELS_HIERARCHY$1 = ['error', 'warn', 'log', 'debug'];
|
|
1185
1186
|
let DebugLogger$1 = class DebugLogger {
|
|
1186
1187
|
constructor() {
|
|
1188
|
+
this.activeLevel = 'warn';
|
|
1187
1189
|
// Public methods for logging
|
|
1188
1190
|
this.error = this.logger('error');
|
|
1189
1191
|
this.warn = this.logger('warn');
|
|
1190
1192
|
this.log = this.logger('log');
|
|
1191
1193
|
this.debug = this.logger('debug');
|
|
1192
1194
|
if (!checkLocalStorageAvailability$1()) {
|
|
1193
|
-
this.enabled = false;
|
|
1194
1195
|
return;
|
|
1195
1196
|
}
|
|
1196
1197
|
// Default to checking localStorage for the debug mode on initialization if in browser
|
|
1197
|
-
|
|
1198
|
+
if (localStorage.getItem(CF_DEBUG_KEY$1) === 'true') {
|
|
1199
|
+
this.activeLevel = 'debug';
|
|
1200
|
+
}
|
|
1198
1201
|
}
|
|
1199
1202
|
static getInstance() {
|
|
1200
1203
|
if (this.instance === null) {
|
|
@@ -1202,15 +1205,15 @@ let DebugLogger$1 = class DebugLogger {
|
|
|
1202
1205
|
}
|
|
1203
1206
|
return this.instance;
|
|
1204
1207
|
}
|
|
1205
|
-
|
|
1206
|
-
return this.
|
|
1208
|
+
getActiveLevel() {
|
|
1209
|
+
return this.activeLevel;
|
|
1207
1210
|
}
|
|
1208
|
-
|
|
1209
|
-
this.
|
|
1210
|
-
if (
|
|
1211
|
+
setActiveLevel(level) {
|
|
1212
|
+
this.activeLevel = level;
|
|
1213
|
+
if (!checkLocalStorageAvailability$1()) {
|
|
1211
1214
|
return;
|
|
1212
1215
|
}
|
|
1213
|
-
if (
|
|
1216
|
+
if (this.activeLevel === 'debug' || this.activeLevel === 'log') {
|
|
1214
1217
|
localStorage.setItem(CF_DEBUG_KEY$1, 'true');
|
|
1215
1218
|
}
|
|
1216
1219
|
else {
|
|
@@ -1220,14 +1223,17 @@ let DebugLogger$1 = class DebugLogger {
|
|
|
1220
1223
|
// Log method for different levels (error, warn, log)
|
|
1221
1224
|
logger(level) {
|
|
1222
1225
|
return (...args) => {
|
|
1223
|
-
|
|
1224
|
-
|
|
1226
|
+
const levelPriority = DEBUG_LEVELS_HIERARCHY$1.indexOf(level);
|
|
1227
|
+
const activeLevelPriority = DEBUG_LEVELS_HIERARCHY$1.indexOf(this.activeLevel);
|
|
1228
|
+
const enabled = levelPriority <= activeLevelPriority;
|
|
1229
|
+
if (enabled) {
|
|
1230
|
+
console[level](...args);
|
|
1225
1231
|
}
|
|
1226
1232
|
};
|
|
1227
1233
|
}
|
|
1228
1234
|
};
|
|
1229
1235
|
DebugLogger$1.instance = null;
|
|
1230
|
-
DebugLogger$1.getInstance();
|
|
1236
|
+
const debug$1 = DebugLogger$1.getInstance();
|
|
1231
1237
|
|
|
1232
1238
|
const findOutermostCoordinates = (first, second) => {
|
|
1233
1239
|
return {
|
|
@@ -1298,14 +1304,14 @@ const isLinkToAsset = (variable) => {
|
|
|
1298
1304
|
variable.sys?.type === 'Link');
|
|
1299
1305
|
};
|
|
1300
1306
|
|
|
1301
|
-
|
|
1307
|
+
function isLink$1(maybeLink) {
|
|
1302
1308
|
if (maybeLink === null)
|
|
1303
1309
|
return false;
|
|
1304
1310
|
if (typeof maybeLink !== 'object')
|
|
1305
1311
|
return false;
|
|
1306
1312
|
const link = maybeLink;
|
|
1307
1313
|
return Boolean(link.sys?.id) && link.sys?.type === 'Link' && Boolean(link.sys?.linkType);
|
|
1308
|
-
}
|
|
1314
|
+
}
|
|
1309
1315
|
|
|
1310
1316
|
/**
|
|
1311
1317
|
* This module encapsulates format of the path to a deep reference.
|
|
@@ -1455,7 +1461,7 @@ const lastPathNamedSegmentEq = (path, expectedName) => {
|
|
|
1455
1461
|
// ['', 'key123', 'fields', 'featureImage', '~locale', 'fields', 'file', '~locale']
|
|
1456
1462
|
const segments = path.split('/');
|
|
1457
1463
|
if (segments.length < 2) {
|
|
1458
|
-
|
|
1464
|
+
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.`);
|
|
1459
1465
|
return false;
|
|
1460
1466
|
}
|
|
1461
1467
|
const secondLast = segments[segments.length - 2]; // skipping trailing '~locale'
|
|
@@ -1896,7 +1902,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
1896
1902
|
? variables[optionsVariableName].valuesByBreakpoint
|
|
1897
1903
|
: {});
|
|
1898
1904
|
if (!options) {
|
|
1899
|
-
|
|
1905
|
+
debug$1.error(`[experiences-core::transformMedia] Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);
|
|
1900
1906
|
return;
|
|
1901
1907
|
}
|
|
1902
1908
|
try {
|
|
@@ -1910,7 +1916,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
1910
1916
|
return value;
|
|
1911
1917
|
}
|
|
1912
1918
|
catch (error) {
|
|
1913
|
-
|
|
1919
|
+
debug$1.error('[experiences-core::transformMedia] Error transforming image asset', error);
|
|
1914
1920
|
}
|
|
1915
1921
|
return;
|
|
1916
1922
|
}
|
|
@@ -1921,7 +1927,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
1921
1927
|
? variables[optionsVariableName].valuesByBreakpoint
|
|
1922
1928
|
: {});
|
|
1923
1929
|
if (!options) {
|
|
1924
|
-
|
|
1930
|
+
debug$1.error(`[experiences-core::transformMedia] Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);
|
|
1925
1931
|
return;
|
|
1926
1932
|
}
|
|
1927
1933
|
try {
|
|
@@ -1938,7 +1944,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
1938
1944
|
return value;
|
|
1939
1945
|
}
|
|
1940
1946
|
catch (error) {
|
|
1941
|
-
|
|
1947
|
+
debug$1.error('[experiences-core::transformMedia] Error transforming image asset', error);
|
|
1942
1948
|
}
|
|
1943
1949
|
return;
|
|
1944
1950
|
}
|
|
@@ -1976,7 +1982,7 @@ function getResolvedEntryFromLink(entryOrAsset, path, entityStore) {
|
|
|
1976
1982
|
resolvedEntity = entityStore.getEntityFromLink(value);
|
|
1977
1983
|
}
|
|
1978
1984
|
else {
|
|
1979
|
-
|
|
1985
|
+
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 });
|
|
1980
1986
|
return;
|
|
1981
1987
|
}
|
|
1982
1988
|
// no need to make structuredClone(entityStore.getEntityFromLink(value)) because
|
|
@@ -2003,7 +2009,7 @@ function getArrayValue(entryOrAsset, path, entityStore) {
|
|
|
2003
2009
|
const fieldName = path.split('/').slice(2, -1);
|
|
2004
2010
|
const arrayValue = get$1(entryOrAsset, fieldName);
|
|
2005
2011
|
if (!isArray(arrayValue)) {
|
|
2006
|
-
|
|
2012
|
+
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 });
|
|
2007
2013
|
return;
|
|
2008
2014
|
}
|
|
2009
2015
|
const result = arrayValue
|
|
@@ -2023,7 +2029,7 @@ function getArrayValue(entryOrAsset, path, entityStore) {
|
|
|
2023
2029
|
return resolvedEntity;
|
|
2024
2030
|
}
|
|
2025
2031
|
else {
|
|
2026
|
-
|
|
2032
|
+
debug$1.warn(`[experiences-core::getArrayValue] Expected value to be a string or Link, but got: ${JSON.stringify(value)}`);
|
|
2027
2033
|
return undefined;
|
|
2028
2034
|
}
|
|
2029
2035
|
})
|
|
@@ -2202,7 +2208,7 @@ const sendMessage = (eventType, data) => {
|
|
|
2202
2208
|
if (typeof window === 'undefined') {
|
|
2203
2209
|
return;
|
|
2204
2210
|
}
|
|
2205
|
-
|
|
2211
|
+
debug$1.debug(`[experiences-sdk-react::sendMessage] Sending message [${eventType}]`, {
|
|
2206
2212
|
source: 'customer-app',
|
|
2207
2213
|
eventType,
|
|
2208
2214
|
payload: data,
|
|
@@ -2254,7 +2260,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
2254
2260
|
? this.entryMap.get(linkOrEntryOrAsset.sys.id)
|
|
2255
2261
|
: this.assetMap.get(linkOrEntryOrAsset.sys.id);
|
|
2256
2262
|
if (!resolvedEntity || resolvedEntity.sys.type !== linkOrEntryOrAsset.sys.linkType) {
|
|
2257
|
-
|
|
2263
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
2258
2264
|
return;
|
|
2259
2265
|
}
|
|
2260
2266
|
entity = resolvedEntity;
|
|
@@ -2264,7 +2270,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
2264
2270
|
entity = linkOrEntryOrAsset;
|
|
2265
2271
|
}
|
|
2266
2272
|
else {
|
|
2267
|
-
throw new Error(`Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
2273
|
+
throw new Error(`[experiences-core::EntityStoreBase] Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
2268
2274
|
}
|
|
2269
2275
|
return entity;
|
|
2270
2276
|
}
|
|
@@ -2278,7 +2284,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
2278
2284
|
const entity = this.getEntity(entityLink.sys.linkType, entityLink.sys.id);
|
|
2279
2285
|
if (!entity) {
|
|
2280
2286
|
// TODO: move to `debug` utils once it is extracted
|
|
2281
|
-
|
|
2287
|
+
debug$1.warn(`Unresolved entity reference: ${entityLink.sys.linkType} with ID ${entityLink.sys.id}`);
|
|
2282
2288
|
return;
|
|
2283
2289
|
}
|
|
2284
2290
|
return get$1(entity, path);
|
|
@@ -2288,7 +2294,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
2288
2294
|
? this.entryMap.get(link.sys.id)
|
|
2289
2295
|
: this.assetMap.get(link.sys.id);
|
|
2290
2296
|
if (!resolvedEntity || resolvedEntity.sys.type !== link.sys.linkType) {
|
|
2291
|
-
|
|
2297
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(link)}`);
|
|
2292
2298
|
return;
|
|
2293
2299
|
}
|
|
2294
2300
|
return resolvedEntity;
|
|
@@ -2296,7 +2302,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
2296
2302
|
getAssetById(assetId) {
|
|
2297
2303
|
const asset = this.assetMap.get(assetId);
|
|
2298
2304
|
if (!asset) {
|
|
2299
|
-
|
|
2305
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Asset with ID "${assetId}" is not found in the store`);
|
|
2300
2306
|
return;
|
|
2301
2307
|
}
|
|
2302
2308
|
return asset;
|
|
@@ -2304,7 +2310,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
2304
2310
|
getEntryById(entryId) {
|
|
2305
2311
|
const entry = this.entryMap.get(entryId);
|
|
2306
2312
|
if (!entry) {
|
|
2307
|
-
|
|
2313
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Entry with ID "${entryId}" is not found in the store`);
|
|
2308
2314
|
return;
|
|
2309
2315
|
}
|
|
2310
2316
|
return entry;
|
|
@@ -2343,7 +2349,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
2343
2349
|
const { resolved, missing } = this.getEntitiesFromMap('Asset', [id]);
|
|
2344
2350
|
if (missing.length) {
|
|
2345
2351
|
// TODO: move to `debug` utils once it is extracted
|
|
2346
|
-
|
|
2352
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Asset "${id}" is not in the store`);
|
|
2347
2353
|
return;
|
|
2348
2354
|
}
|
|
2349
2355
|
return resolved[0];
|
|
@@ -2359,7 +2365,7 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
2359
2365
|
const { resolved, missing } = this.getEntitiesFromMap('Entry', [id]);
|
|
2360
2366
|
if (missing.length) {
|
|
2361
2367
|
// TODO: move to `debug` utils once it is extracted
|
|
2362
|
-
|
|
2368
|
+
debug$1.warn(`[experiences-core::EntityStoreBase] Entry "${id}" is not in the store`);
|
|
2363
2369
|
return;
|
|
2364
2370
|
}
|
|
2365
2371
|
return resolved[0];
|
|
@@ -2435,8 +2441,9 @@ let EntityStoreBase$1 = class EntityStoreBase {
|
|
|
2435
2441
|
// in case we can't follow till the end, we should signal that there was null-reference in the path
|
|
2436
2442
|
const { resolvedFieldset, isFullyResolved, reason } = resolveFieldset(unresolvedFieldset, headEntity);
|
|
2437
2443
|
if (!isFullyResolved) {
|
|
2438
|
-
reason
|
|
2439
|
-
|
|
2444
|
+
if (reason) {
|
|
2445
|
+
debug$1.log(`[experiences-core::EntityStoreBase] Deep path wasn't resolved till leaf node, falling back to undefined, because: ${reason}`);
|
|
2446
|
+
}
|
|
2440
2447
|
return;
|
|
2441
2448
|
}
|
|
2442
2449
|
const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];
|
|
@@ -2512,7 +2519,7 @@ class EditorEntityStore extends EntityStoreBase$1 {
|
|
|
2512
2519
|
unsubscribe();
|
|
2513
2520
|
}
|
|
2514
2521
|
else {
|
|
2515
|
-
|
|
2522
|
+
debug$1.warn('[experiences-core::EditorEntityStore] Unexpected entities received in REQUESTED_ENTITIES. Ignoring this response.');
|
|
2516
2523
|
}
|
|
2517
2524
|
});
|
|
2518
2525
|
const timeout = setTimeout(() => {
|
|
@@ -2543,7 +2550,7 @@ class EditorEntityStore extends EntityStoreBase$1 {
|
|
|
2543
2550
|
}
|
|
2544
2551
|
catch (err) {
|
|
2545
2552
|
// TODO: move to debug utils once it is extracted
|
|
2546
|
-
|
|
2553
|
+
debug$1.warn(`[experiences-core::EditorEntityStore] Failed to request asset ${id}`);
|
|
2547
2554
|
return undefined;
|
|
2548
2555
|
}
|
|
2549
2556
|
}
|
|
@@ -2556,7 +2563,7 @@ class EditorEntityStore extends EntityStoreBase$1 {
|
|
|
2556
2563
|
}
|
|
2557
2564
|
catch (err) {
|
|
2558
2565
|
// TODO: move to debug utils once it is extracted
|
|
2559
|
-
|
|
2566
|
+
debug$1.warn(`[experiences-core::EditorEntityStore] Failed to request entry ${id}`, err);
|
|
2560
2567
|
return undefined;
|
|
2561
2568
|
}
|
|
2562
2569
|
}
|
|
@@ -2576,7 +2583,7 @@ function transformAssetFileToUrl(fieldValue) {
|
|
|
2576
2583
|
const REQUEST_TIMEOUT = 10000;
|
|
2577
2584
|
class EditorModeEntityStore extends EditorEntityStore {
|
|
2578
2585
|
constructor({ entities, locale }) {
|
|
2579
|
-
|
|
2586
|
+
debug$1.debug(`[experiences-core::EditorModeEntityStore] Initializing editor entity store with ${entities.length} entities for locale ${locale}.`, { entities });
|
|
2580
2587
|
const subscribe = (method, cb) => {
|
|
2581
2588
|
const handleMessage = (event) => {
|
|
2582
2589
|
const data = JSON.parse(event.data);
|
|
@@ -2676,7 +2683,7 @@ const inMemoryEntitiesStore = create((set, get) => ({
|
|
|
2676
2683
|
|
|
2677
2684
|
function maybeResolveLink(maybeLink) {
|
|
2678
2685
|
if (!isLink$1(maybeLink)) {
|
|
2679
|
-
|
|
2686
|
+
debug$1.warn('[experiences-core::InMemoryEntitiesStore] maybeResolveLink function must receive Link shape. Provided argument does not match the Link shape: ', maybeLink);
|
|
2680
2687
|
return undefined;
|
|
2681
2688
|
}
|
|
2682
2689
|
return inMemoryEntitiesStore.getState().resolveEntity(maybeLink);
|
|
@@ -3107,7 +3114,7 @@ const useTreeStore = create((set, get) => ({
|
|
|
3107
3114
|
// The current and updated tree are the same, no tree update required.
|
|
3108
3115
|
// Special case: Breakpoints changed (e.g. empty experience gets reloaded or breakpoints updated)
|
|
3109
3116
|
if (!treeDiff.length && !didBreakpointsChange) {
|
|
3110
|
-
|
|
3117
|
+
debug$1.debug(`[experiences-visual-editor-react::useTreeStore]: During smart-diffing no diffs. Skipping tree update.`);
|
|
3111
3118
|
return;
|
|
3112
3119
|
}
|
|
3113
3120
|
set(produce((state) => {
|
|
@@ -3856,19 +3863,22 @@ const checkLocalStorageAvailability = () => {
|
|
|
3856
3863
|
return false;
|
|
3857
3864
|
}
|
|
3858
3865
|
};
|
|
3866
|
+
const DEBUG_LEVELS_HIERARCHY = ['error', 'warn', 'log', 'debug'];
|
|
3859
3867
|
class DebugLogger {
|
|
3860
3868
|
constructor() {
|
|
3869
|
+
this.activeLevel = 'warn';
|
|
3861
3870
|
// Public methods for logging
|
|
3862
3871
|
this.error = this.logger('error');
|
|
3863
3872
|
this.warn = this.logger('warn');
|
|
3864
3873
|
this.log = this.logger('log');
|
|
3865
3874
|
this.debug = this.logger('debug');
|
|
3866
3875
|
if (!checkLocalStorageAvailability()) {
|
|
3867
|
-
this.enabled = false;
|
|
3868
3876
|
return;
|
|
3869
3877
|
}
|
|
3870
3878
|
// Default to checking localStorage for the debug mode on initialization if in browser
|
|
3871
|
-
|
|
3879
|
+
if (localStorage.getItem(CF_DEBUG_KEY) === 'true') {
|
|
3880
|
+
this.activeLevel = 'debug';
|
|
3881
|
+
}
|
|
3872
3882
|
}
|
|
3873
3883
|
static getInstance() {
|
|
3874
3884
|
if (this.instance === null) {
|
|
@@ -3876,15 +3886,15 @@ class DebugLogger {
|
|
|
3876
3886
|
}
|
|
3877
3887
|
return this.instance;
|
|
3878
3888
|
}
|
|
3879
|
-
|
|
3880
|
-
return this.
|
|
3889
|
+
getActiveLevel() {
|
|
3890
|
+
return this.activeLevel;
|
|
3881
3891
|
}
|
|
3882
|
-
|
|
3883
|
-
this.
|
|
3884
|
-
if (
|
|
3892
|
+
setActiveLevel(level) {
|
|
3893
|
+
this.activeLevel = level;
|
|
3894
|
+
if (!checkLocalStorageAvailability()) {
|
|
3885
3895
|
return;
|
|
3886
3896
|
}
|
|
3887
|
-
if (
|
|
3897
|
+
if (this.activeLevel === 'debug' || this.activeLevel === 'log') {
|
|
3888
3898
|
localStorage.setItem(CF_DEBUG_KEY, 'true');
|
|
3889
3899
|
}
|
|
3890
3900
|
else {
|
|
@@ -3894,23 +3904,26 @@ class DebugLogger {
|
|
|
3894
3904
|
// Log method for different levels (error, warn, log)
|
|
3895
3905
|
logger(level) {
|
|
3896
3906
|
return (...args) => {
|
|
3897
|
-
|
|
3898
|
-
|
|
3907
|
+
const levelPriority = DEBUG_LEVELS_HIERARCHY.indexOf(level);
|
|
3908
|
+
const activeLevelPriority = DEBUG_LEVELS_HIERARCHY.indexOf(this.activeLevel);
|
|
3909
|
+
const enabled = levelPriority <= activeLevelPriority;
|
|
3910
|
+
if (enabled) {
|
|
3911
|
+
console[level](...args);
|
|
3899
3912
|
}
|
|
3900
3913
|
};
|
|
3901
3914
|
}
|
|
3902
3915
|
}
|
|
3903
3916
|
DebugLogger.instance = null;
|
|
3904
|
-
DebugLogger.getInstance();
|
|
3917
|
+
const debug = DebugLogger.getInstance();
|
|
3905
3918
|
|
|
3906
|
-
|
|
3919
|
+
function isLink(maybeLink) {
|
|
3907
3920
|
if (maybeLink === null)
|
|
3908
3921
|
return false;
|
|
3909
3922
|
if (typeof maybeLink !== 'object')
|
|
3910
3923
|
return false;
|
|
3911
3924
|
const link = maybeLink;
|
|
3912
3925
|
return Boolean(link.sys?.id) && link.sys?.type === 'Link' && Boolean(link.sys?.linkType);
|
|
3913
|
-
}
|
|
3926
|
+
}
|
|
3914
3927
|
const parseDataSourcePathIntoFieldset = (path) => {
|
|
3915
3928
|
const parsedPath = parseDeepPath(path);
|
|
3916
3929
|
if (null === parsedPath) {
|
|
@@ -4067,7 +4080,7 @@ class EntityStoreBase {
|
|
|
4067
4080
|
? this.entryMap.get(linkOrEntryOrAsset.sys.id)
|
|
4068
4081
|
: this.assetMap.get(linkOrEntryOrAsset.sys.id);
|
|
4069
4082
|
if (!resolvedEntity || resolvedEntity.sys.type !== linkOrEntryOrAsset.sys.linkType) {
|
|
4070
|
-
|
|
4083
|
+
debug.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
4071
4084
|
return;
|
|
4072
4085
|
}
|
|
4073
4086
|
entity = resolvedEntity;
|
|
@@ -4077,7 +4090,7 @@ class EntityStoreBase {
|
|
|
4077
4090
|
entity = linkOrEntryOrAsset;
|
|
4078
4091
|
}
|
|
4079
4092
|
else {
|
|
4080
|
-
throw new Error(`Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
4093
|
+
throw new Error(`[experiences-core::EntityStoreBase] Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
4081
4094
|
}
|
|
4082
4095
|
return entity;
|
|
4083
4096
|
}
|
|
@@ -4091,7 +4104,7 @@ class EntityStoreBase {
|
|
|
4091
4104
|
const entity = this.getEntity(entityLink.sys.linkType, entityLink.sys.id);
|
|
4092
4105
|
if (!entity) {
|
|
4093
4106
|
// TODO: move to `debug` utils once it is extracted
|
|
4094
|
-
|
|
4107
|
+
debug.warn(`Unresolved entity reference: ${entityLink.sys.linkType} with ID ${entityLink.sys.id}`);
|
|
4095
4108
|
return;
|
|
4096
4109
|
}
|
|
4097
4110
|
return get(entity, path);
|
|
@@ -4101,7 +4114,7 @@ class EntityStoreBase {
|
|
|
4101
4114
|
? this.entryMap.get(link.sys.id)
|
|
4102
4115
|
: this.assetMap.get(link.sys.id);
|
|
4103
4116
|
if (!resolvedEntity || resolvedEntity.sys.type !== link.sys.linkType) {
|
|
4104
|
-
|
|
4117
|
+
debug.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(link)}`);
|
|
4105
4118
|
return;
|
|
4106
4119
|
}
|
|
4107
4120
|
return resolvedEntity;
|
|
@@ -4109,7 +4122,7 @@ class EntityStoreBase {
|
|
|
4109
4122
|
getAssetById(assetId) {
|
|
4110
4123
|
const asset = this.assetMap.get(assetId);
|
|
4111
4124
|
if (!asset) {
|
|
4112
|
-
|
|
4125
|
+
debug.warn(`[experiences-core::EntityStoreBase] Asset with ID "${assetId}" is not found in the store`);
|
|
4113
4126
|
return;
|
|
4114
4127
|
}
|
|
4115
4128
|
return asset;
|
|
@@ -4117,7 +4130,7 @@ class EntityStoreBase {
|
|
|
4117
4130
|
getEntryById(entryId) {
|
|
4118
4131
|
const entry = this.entryMap.get(entryId);
|
|
4119
4132
|
if (!entry) {
|
|
4120
|
-
|
|
4133
|
+
debug.warn(`[experiences-core::EntityStoreBase] Entry with ID "${entryId}" is not found in the store`);
|
|
4121
4134
|
return;
|
|
4122
4135
|
}
|
|
4123
4136
|
return entry;
|
|
@@ -4156,7 +4169,7 @@ class EntityStoreBase {
|
|
|
4156
4169
|
const { resolved, missing } = this.getEntitiesFromMap('Asset', [id]);
|
|
4157
4170
|
if (missing.length) {
|
|
4158
4171
|
// TODO: move to `debug` utils once it is extracted
|
|
4159
|
-
|
|
4172
|
+
debug.warn(`[experiences-core::EntityStoreBase] Asset "${id}" is not in the store`);
|
|
4160
4173
|
return;
|
|
4161
4174
|
}
|
|
4162
4175
|
return resolved[0];
|
|
@@ -4172,7 +4185,7 @@ class EntityStoreBase {
|
|
|
4172
4185
|
const { resolved, missing } = this.getEntitiesFromMap('Entry', [id]);
|
|
4173
4186
|
if (missing.length) {
|
|
4174
4187
|
// TODO: move to `debug` utils once it is extracted
|
|
4175
|
-
|
|
4188
|
+
debug.warn(`[experiences-core::EntityStoreBase] Entry "${id}" is not in the store`);
|
|
4176
4189
|
return;
|
|
4177
4190
|
}
|
|
4178
4191
|
return resolved[0];
|
|
@@ -4248,8 +4261,9 @@ class EntityStoreBase {
|
|
|
4248
4261
|
// in case we can't follow till the end, we should signal that there was null-reference in the path
|
|
4249
4262
|
const { resolvedFieldset, isFullyResolved, reason } = resolveFieldset(unresolvedFieldset, headEntity);
|
|
4250
4263
|
if (!isFullyResolved) {
|
|
4251
|
-
reason
|
|
4252
|
-
|
|
4264
|
+
if (reason) {
|
|
4265
|
+
debug.log(`[experiences-core::EntityStoreBase] Deep path wasn't resolved till leaf node, falling back to undefined, because: ${reason}`);
|
|
4266
|
+
}
|
|
4253
4267
|
return;
|
|
4254
4268
|
}
|
|
4255
4269
|
const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];
|
|
@@ -4447,8 +4461,7 @@ function useEditorSubscriber(inMemoryEntitiesStore) {
|
|
|
4447
4461
|
}
|
|
4448
4462
|
}
|
|
4449
4463
|
catch (error) {
|
|
4450
|
-
|
|
4451
|
-
console.error(error);
|
|
4464
|
+
debug$1.error('[experiences-visual-editor-react::useEditorSubscriber] Failed fetching entities', { error });
|
|
4452
4465
|
throw error; // TODO: The original catch didn't let's rethrow; for the moment throw to see if we have any errors
|
|
4453
4466
|
}
|
|
4454
4467
|
finally {
|
|
@@ -4464,12 +4477,12 @@ function useEditorSubscriber(inMemoryEntitiesStore) {
|
|
|
4464
4477
|
reloadApp();
|
|
4465
4478
|
}
|
|
4466
4479
|
else {
|
|
4467
|
-
|
|
4480
|
+
debug$1.warn(`[experiences-visual-editor-react::onMessage] Ignoring alien incoming message from origin [${event.origin}], due to: [${reason}]`, event);
|
|
4468
4481
|
}
|
|
4469
4482
|
return;
|
|
4470
4483
|
}
|
|
4471
4484
|
const eventData = tryParseMessage(event);
|
|
4472
|
-
|
|
4485
|
+
debug$1.debug(`[experiences-visual-editor-react::onMessage] Received message [${eventData.eventType}]`, eventData);
|
|
4473
4486
|
if (eventData.eventType === PostMessageMethods$2.REQUESTED_ENTITIES) {
|
|
4474
4487
|
// Expected message: This message is handled in the EntityStore to store fetched entities
|
|
4475
4488
|
return;
|
|
@@ -4567,7 +4580,7 @@ function useEditorSubscriber(inMemoryEntitiesStore) {
|
|
|
4567
4580
|
const knownEvents = Object.values(INCOMING_EVENTS);
|
|
4568
4581
|
const isDeprecatedMessage = knownEvents.includes(eventData.eventType);
|
|
4569
4582
|
if (!isDeprecatedMessage) {
|
|
4570
|
-
|
|
4583
|
+
debug$1.error(`[experiences-visual-editor-react::onMessage] Logic error, unsupported eventType: [${eventData.eventType}]`);
|
|
4571
4584
|
}
|
|
4572
4585
|
}
|
|
4573
4586
|
}
|
|
@@ -4667,7 +4680,7 @@ const useComponentRegistration = (node) => {
|
|
|
4667
4680
|
});
|
|
4668
4681
|
}
|
|
4669
4682
|
if (!registration) {
|
|
4670
|
-
|
|
4683
|
+
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.`);
|
|
4671
4684
|
return undefined;
|
|
4672
4685
|
}
|
|
4673
4686
|
return registration;
|
|
@@ -5042,7 +5055,7 @@ function waitForImageToBeLoaded(imageNode) {
|
|
|
5042
5055
|
imageNode.removeEventListener('load', handleImageLoad);
|
|
5043
5056
|
imageNode.removeEventListener('error', handleImageLoad);
|
|
5044
5057
|
if (event.type === 'error') {
|
|
5045
|
-
|
|
5058
|
+
debug$1.warn('[experiences-visual-editor-react::canvasGeometry] Image failed to load:', imageNode);
|
|
5046
5059
|
reject();
|
|
5047
5060
|
}
|
|
5048
5061
|
else {
|