@contentful/experiences-core 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/entity/InMemoryEntitiesPublicApi.d.ts +10 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +61 -47
- package/dist/index.js.map +1 -1
- package/dist/utils/debugLogger.d.ts +10 -4
- package/dist/utils/isLink.d.ts +3 -1
- package/package.json +3 -3
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { UnresolvedLink, Entry, Asset } from 'contentful';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a link to its corresponding entry or asset if available.
|
|
5
|
+
*
|
|
6
|
+
* @note When using this function please ensure to explicitly handle `undefined` values in
|
|
7
|
+
* your component to protect against scenarios where the property was not yet bound to an
|
|
8
|
+
* entity inside the editor UI. The SDK will set the property to `undefined` in those cases.
|
|
9
|
+
* You can use the SDK helper functions `isLink`, `isLinkToEntry`, `isLinkToAsset`, or
|
|
10
|
+
* `isArrayOfLinks` for this purpose.
|
|
11
|
+
*/
|
|
3
12
|
declare function maybeResolveLink(maybeLink: UnresolvedLink<'Entry'>): Entry | undefined;
|
|
4
13
|
declare function maybeResolveLink(maybeLink: UnresolvedLink<'Asset'>): Asset | undefined;
|
|
5
14
|
declare function maybeResolveLink(maybeLink: UnresolvedLink<'Asset' | 'Entry'>): Asset | Entry | undefined;
|
|
6
|
-
declare function maybeResolveLink(maybeLink: unknown): Entry | Asset | undefined;
|
|
15
|
+
declare function maybeResolveLink(maybeLink: NonNullable<unknown>): Entry | Asset | undefined;
|
|
7
16
|
declare function maybeResolveByAssetId(assetId: string): Asset | undefined;
|
|
8
17
|
declare function maybeResolveByEntryId(entryId: string): Entry | undefined;
|
|
9
18
|
declare function hasEntry(entryId: string): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isPatternComponent, isStructureWithRelativeHeight } from './utils/components.js';
|
|
2
2
|
export { BREAKPOINTS_STRATEGY_DESKTOP_FIRST, BREAKPOINTS_STRATEGY_MOBILE_FIRST, BreakpointsStrategy, MEDIA_QUERY_REGEXP, detectBreakpointsStrategy, getActiveBreakpointIndex, getFallbackBreakpointIndex, getValueForBreakpoint, isValidBreakpointValue, mediaQueryMatcher, mergeDesignValuesByBreakpoint } from './utils/breakpoints.js';
|
|
3
|
-
export { DebugLogger, debug, disableDebug, enableDebug } from './utils/debugLogger.js';
|
|
3
|
+
export { DebugLogger, debug, disableDebug, enableDebug, setDebugLevel } from './utils/debugLogger.js';
|
|
4
4
|
export { findOutermostCoordinates, getElementCoordinates, isElementHidden } from './utils/domValues.js';
|
|
5
5
|
export { isLinkToAsset } from './utils/isLinkToAsset.js';
|
|
6
6
|
export { isLinkToEntry } from './utils/isLinkToEntry.js';
|
package/dist/index.js
CHANGED
|
@@ -1576,19 +1576,22 @@ const checkLocalStorageAvailability = () => {
|
|
|
1576
1576
|
return false;
|
|
1577
1577
|
}
|
|
1578
1578
|
};
|
|
1579
|
+
const DEBUG_LEVELS_HIERARCHY = ['error', 'warn', 'log', 'debug'];
|
|
1579
1580
|
class DebugLogger {
|
|
1580
1581
|
constructor() {
|
|
1582
|
+
this.activeLevel = 'warn';
|
|
1581
1583
|
// Public methods for logging
|
|
1582
1584
|
this.error = this.logger('error');
|
|
1583
1585
|
this.warn = this.logger('warn');
|
|
1584
1586
|
this.log = this.logger('log');
|
|
1585
1587
|
this.debug = this.logger('debug');
|
|
1586
1588
|
if (!checkLocalStorageAvailability()) {
|
|
1587
|
-
this.enabled = false;
|
|
1588
1589
|
return;
|
|
1589
1590
|
}
|
|
1590
1591
|
// Default to checking localStorage for the debug mode on initialization if in browser
|
|
1591
|
-
|
|
1592
|
+
if (localStorage.getItem(CF_DEBUG_KEY) === 'true') {
|
|
1593
|
+
this.activeLevel = 'debug';
|
|
1594
|
+
}
|
|
1592
1595
|
}
|
|
1593
1596
|
static getInstance() {
|
|
1594
1597
|
if (this.instance === null) {
|
|
@@ -1596,15 +1599,15 @@ class DebugLogger {
|
|
|
1596
1599
|
}
|
|
1597
1600
|
return this.instance;
|
|
1598
1601
|
}
|
|
1599
|
-
|
|
1600
|
-
return this.
|
|
1602
|
+
getActiveLevel() {
|
|
1603
|
+
return this.activeLevel;
|
|
1601
1604
|
}
|
|
1602
|
-
|
|
1603
|
-
this.
|
|
1604
|
-
if (
|
|
1605
|
+
setActiveLevel(level) {
|
|
1606
|
+
this.activeLevel = level;
|
|
1607
|
+
if (!checkLocalStorageAvailability()) {
|
|
1605
1608
|
return;
|
|
1606
1609
|
}
|
|
1607
|
-
if (
|
|
1610
|
+
if (this.activeLevel === 'debug' || this.activeLevel === 'log') {
|
|
1608
1611
|
localStorage.setItem(CF_DEBUG_KEY, 'true');
|
|
1609
1612
|
}
|
|
1610
1613
|
else {
|
|
@@ -1614,22 +1617,32 @@ class DebugLogger {
|
|
|
1614
1617
|
// Log method for different levels (error, warn, log)
|
|
1615
1618
|
logger(level) {
|
|
1616
1619
|
return (...args) => {
|
|
1617
|
-
|
|
1618
|
-
|
|
1620
|
+
const levelPriority = DEBUG_LEVELS_HIERARCHY.indexOf(level);
|
|
1621
|
+
const activeLevelPriority = DEBUG_LEVELS_HIERARCHY.indexOf(this.activeLevel);
|
|
1622
|
+
const enabled = levelPriority <= activeLevelPriority;
|
|
1623
|
+
if (enabled) {
|
|
1624
|
+
console[level](...args);
|
|
1619
1625
|
}
|
|
1620
1626
|
};
|
|
1621
1627
|
}
|
|
1622
1628
|
}
|
|
1623
1629
|
DebugLogger.instance = null;
|
|
1624
1630
|
const debug = DebugLogger.getInstance();
|
|
1631
|
+
/** Set the logging level to `debug` */
|
|
1625
1632
|
const enableDebug = () => {
|
|
1626
|
-
debug.
|
|
1633
|
+
debug.setActiveLevel('debug');
|
|
1627
1634
|
console.log('Debug mode enabled');
|
|
1628
1635
|
};
|
|
1636
|
+
/** Set the debug level to `warn` */
|
|
1629
1637
|
const disableDebug = () => {
|
|
1630
|
-
debug.
|
|
1638
|
+
debug.setActiveLevel('warn');
|
|
1631
1639
|
console.log('Debug mode disabled');
|
|
1632
1640
|
};
|
|
1641
|
+
/** Set the debug level to the provided level */
|
|
1642
|
+
const setDebugLevel = (level) => {
|
|
1643
|
+
debug.setActiveLevel(level);
|
|
1644
|
+
console.log(`Debug mode set to ${level}`);
|
|
1645
|
+
};
|
|
1633
1646
|
|
|
1634
1647
|
const findOutermostCoordinates = (first, second) => {
|
|
1635
1648
|
return {
|
|
@@ -1720,14 +1733,14 @@ const isLinkToEntry = (variable) => {
|
|
|
1720
1733
|
variable.sys?.type === 'Link');
|
|
1721
1734
|
};
|
|
1722
1735
|
|
|
1723
|
-
|
|
1736
|
+
function isLink(maybeLink) {
|
|
1724
1737
|
if (maybeLink === null)
|
|
1725
1738
|
return false;
|
|
1726
1739
|
if (typeof maybeLink !== 'object')
|
|
1727
1740
|
return false;
|
|
1728
1741
|
const link = maybeLink;
|
|
1729
1742
|
return Boolean(link.sys?.id) && link.sys?.type === 'Link' && Boolean(link.sys?.linkType);
|
|
1730
|
-
}
|
|
1743
|
+
}
|
|
1731
1744
|
|
|
1732
1745
|
/**
|
|
1733
1746
|
* Localizes the provided entry or asset to match the regular format of CDA/CPA entities.
|
|
@@ -1913,7 +1926,7 @@ const lastPathNamedSegmentEq = (path, expectedName) => {
|
|
|
1913
1926
|
// ['', 'key123', 'fields', 'featureImage', '~locale', 'fields', 'file', '~locale']
|
|
1914
1927
|
const segments = path.split('/');
|
|
1915
1928
|
if (segments.length < 2) {
|
|
1916
|
-
|
|
1929
|
+
debug.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.`);
|
|
1917
1930
|
return false;
|
|
1918
1931
|
}
|
|
1919
1932
|
const secondLast = segments[segments.length - 2]; // skipping trailing '~locale'
|
|
@@ -2600,7 +2613,7 @@ const transformMedia$1 = (boundAsset, width, options) => {
|
|
|
2600
2613
|
return getOptimizedBackgroundImageAsset(asset.fields.file, width, options.quality, options.format);
|
|
2601
2614
|
}
|
|
2602
2615
|
catch (error) {
|
|
2603
|
-
|
|
2616
|
+
debug.error('[experiences-core::ssrStyles] Error transforming image asset', error);
|
|
2604
2617
|
}
|
|
2605
2618
|
return boundAsset.fields.file?.url;
|
|
2606
2619
|
};
|
|
@@ -2755,7 +2768,7 @@ const indexByBreakpoint = ({ variables, breakpointIds, getBoundEntityById, unbou
|
|
|
2755
2768
|
componentVariablesOverwrites,
|
|
2756
2769
|
});
|
|
2757
2770
|
if (!options) {
|
|
2758
|
-
|
|
2771
|
+
debug.error('[experiences-core::ssrStyles] Error transforming image asset: Required variable [cfBackgroundImageOptions] missing from component definition');
|
|
2759
2772
|
continue;
|
|
2760
2773
|
}
|
|
2761
2774
|
const imageUrl = resolveBackgroundImageBinding({
|
|
@@ -2985,7 +2998,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
2985
2998
|
? variables[optionsVariableName].valuesByBreakpoint
|
|
2986
2999
|
: {});
|
|
2987
3000
|
if (!options) {
|
|
2988
|
-
|
|
3001
|
+
debug.error(`[experiences-core::transformMedia] Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);
|
|
2989
3002
|
return;
|
|
2990
3003
|
}
|
|
2991
3004
|
try {
|
|
@@ -2999,7 +3012,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
2999
3012
|
return value;
|
|
3000
3013
|
}
|
|
3001
3014
|
catch (error) {
|
|
3002
|
-
|
|
3015
|
+
debug.error('[experiences-core::transformMedia] Error transforming image asset', error);
|
|
3003
3016
|
}
|
|
3004
3017
|
return;
|
|
3005
3018
|
}
|
|
@@ -3010,7 +3023,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
3010
3023
|
? variables[optionsVariableName].valuesByBreakpoint
|
|
3011
3024
|
: {});
|
|
3012
3025
|
if (!options) {
|
|
3013
|
-
|
|
3026
|
+
debug.error(`[experiences-core::transformMedia] Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);
|
|
3014
3027
|
return;
|
|
3015
3028
|
}
|
|
3016
3029
|
try {
|
|
@@ -3027,7 +3040,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
3027
3040
|
return value;
|
|
3028
3041
|
}
|
|
3029
3042
|
catch (error) {
|
|
3030
|
-
|
|
3043
|
+
debug.error('[experiences-core::transformMedia] Error transforming image asset', error);
|
|
3031
3044
|
}
|
|
3032
3045
|
return;
|
|
3033
3046
|
}
|
|
@@ -3086,7 +3099,7 @@ function getResolvedEntryFromLink(entryOrAsset, path, entityStore) {
|
|
|
3086
3099
|
resolvedEntity = entityStore.getEntityFromLink(value);
|
|
3087
3100
|
}
|
|
3088
3101
|
else {
|
|
3089
|
-
|
|
3102
|
+
debug.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 });
|
|
3090
3103
|
return;
|
|
3091
3104
|
}
|
|
3092
3105
|
// no need to make structuredClone(entityStore.getEntityFromLink(value)) because
|
|
@@ -3113,7 +3126,7 @@ function getArrayValue(entryOrAsset, path, entityStore) {
|
|
|
3113
3126
|
const fieldName = path.split('/').slice(2, -1);
|
|
3114
3127
|
const arrayValue = get(entryOrAsset, fieldName);
|
|
3115
3128
|
if (!isArray(arrayValue)) {
|
|
3116
|
-
|
|
3129
|
+
debug.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 });
|
|
3117
3130
|
return;
|
|
3118
3131
|
}
|
|
3119
3132
|
const result = arrayValue
|
|
@@ -3133,7 +3146,7 @@ function getArrayValue(entryOrAsset, path, entityStore) {
|
|
|
3133
3146
|
return resolvedEntity;
|
|
3134
3147
|
}
|
|
3135
3148
|
else {
|
|
3136
|
-
|
|
3149
|
+
debug.warn(`[experiences-core::getArrayValue] Expected value to be a string or Link, but got: ${JSON.stringify(value)}`);
|
|
3137
3150
|
return undefined;
|
|
3138
3151
|
}
|
|
3139
3152
|
})
|
|
@@ -3439,7 +3452,7 @@ const extractLeafLinksReferencedFromExperience = (experience) => {
|
|
|
3439
3452
|
}
|
|
3440
3453
|
}
|
|
3441
3454
|
else {
|
|
3442
|
-
|
|
3455
|
+
debug.warn(`[experiences-core::experienceSchema] Unexpected reference type found in entry "${entry.sys.id}": ${JSON.stringify(ref)}`);
|
|
3443
3456
|
}
|
|
3444
3457
|
}
|
|
3445
3458
|
}
|
|
@@ -3478,7 +3491,7 @@ const sendMessage = (eventType, data) => {
|
|
|
3478
3491
|
if (typeof window === 'undefined') {
|
|
3479
3492
|
return;
|
|
3480
3493
|
}
|
|
3481
|
-
|
|
3494
|
+
debug.debug(`[experiences-sdk-react::sendMessage] Sending message [${eventType}]`, {
|
|
3482
3495
|
source: 'customer-app',
|
|
3483
3496
|
eventType,
|
|
3484
3497
|
payload: data,
|
|
@@ -3530,7 +3543,7 @@ class EntityStoreBase {
|
|
|
3530
3543
|
? this.entryMap.get(linkOrEntryOrAsset.sys.id)
|
|
3531
3544
|
: this.assetMap.get(linkOrEntryOrAsset.sys.id);
|
|
3532
3545
|
if (!resolvedEntity || resolvedEntity.sys.type !== linkOrEntryOrAsset.sys.linkType) {
|
|
3533
|
-
|
|
3546
|
+
debug.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
3534
3547
|
return;
|
|
3535
3548
|
}
|
|
3536
3549
|
entity = resolvedEntity;
|
|
@@ -3540,7 +3553,7 @@ class EntityStoreBase {
|
|
|
3540
3553
|
entity = linkOrEntryOrAsset;
|
|
3541
3554
|
}
|
|
3542
3555
|
else {
|
|
3543
|
-
throw new Error(`Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
3556
|
+
throw new Error(`[experiences-core::EntityStoreBase] Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
3544
3557
|
}
|
|
3545
3558
|
return entity;
|
|
3546
3559
|
}
|
|
@@ -3554,7 +3567,7 @@ class EntityStoreBase {
|
|
|
3554
3567
|
const entity = this.getEntity(entityLink.sys.linkType, entityLink.sys.id);
|
|
3555
3568
|
if (!entity) {
|
|
3556
3569
|
// TODO: move to `debug` utils once it is extracted
|
|
3557
|
-
|
|
3570
|
+
debug.warn(`Unresolved entity reference: ${entityLink.sys.linkType} with ID ${entityLink.sys.id}`);
|
|
3558
3571
|
return;
|
|
3559
3572
|
}
|
|
3560
3573
|
return get(entity, path);
|
|
@@ -3564,7 +3577,7 @@ class EntityStoreBase {
|
|
|
3564
3577
|
? this.entryMap.get(link.sys.id)
|
|
3565
3578
|
: this.assetMap.get(link.sys.id);
|
|
3566
3579
|
if (!resolvedEntity || resolvedEntity.sys.type !== link.sys.linkType) {
|
|
3567
|
-
|
|
3580
|
+
debug.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(link)}`);
|
|
3568
3581
|
return;
|
|
3569
3582
|
}
|
|
3570
3583
|
return resolvedEntity;
|
|
@@ -3572,7 +3585,7 @@ class EntityStoreBase {
|
|
|
3572
3585
|
getAssetById(assetId) {
|
|
3573
3586
|
const asset = this.assetMap.get(assetId);
|
|
3574
3587
|
if (!asset) {
|
|
3575
|
-
|
|
3588
|
+
debug.warn(`[experiences-core::EntityStoreBase] Asset with ID "${assetId}" is not found in the store`);
|
|
3576
3589
|
return;
|
|
3577
3590
|
}
|
|
3578
3591
|
return asset;
|
|
@@ -3580,7 +3593,7 @@ class EntityStoreBase {
|
|
|
3580
3593
|
getEntryById(entryId) {
|
|
3581
3594
|
const entry = this.entryMap.get(entryId);
|
|
3582
3595
|
if (!entry) {
|
|
3583
|
-
|
|
3596
|
+
debug.warn(`[experiences-core::EntityStoreBase] Entry with ID "${entryId}" is not found in the store`);
|
|
3584
3597
|
return;
|
|
3585
3598
|
}
|
|
3586
3599
|
return entry;
|
|
@@ -3619,7 +3632,7 @@ class EntityStoreBase {
|
|
|
3619
3632
|
const { resolved, missing } = this.getEntitiesFromMap('Asset', [id]);
|
|
3620
3633
|
if (missing.length) {
|
|
3621
3634
|
// TODO: move to `debug` utils once it is extracted
|
|
3622
|
-
|
|
3635
|
+
debug.warn(`[experiences-core::EntityStoreBase] Asset "${id}" is not in the store`);
|
|
3623
3636
|
return;
|
|
3624
3637
|
}
|
|
3625
3638
|
return resolved[0];
|
|
@@ -3635,7 +3648,7 @@ class EntityStoreBase {
|
|
|
3635
3648
|
const { resolved, missing } = this.getEntitiesFromMap('Entry', [id]);
|
|
3636
3649
|
if (missing.length) {
|
|
3637
3650
|
// TODO: move to `debug` utils once it is extracted
|
|
3638
|
-
|
|
3651
|
+
debug.warn(`[experiences-core::EntityStoreBase] Entry "${id}" is not in the store`);
|
|
3639
3652
|
return;
|
|
3640
3653
|
}
|
|
3641
3654
|
return resolved[0];
|
|
@@ -3711,8 +3724,9 @@ class EntityStoreBase {
|
|
|
3711
3724
|
// in case we can't follow till the end, we should signal that there was null-reference in the path
|
|
3712
3725
|
const { resolvedFieldset, isFullyResolved, reason } = resolveFieldset(unresolvedFieldset, headEntity);
|
|
3713
3726
|
if (!isFullyResolved) {
|
|
3714
|
-
reason
|
|
3715
|
-
|
|
3727
|
+
if (reason) {
|
|
3728
|
+
debug.log(`[experiences-core::EntityStoreBase] Deep path wasn't resolved till leaf node, falling back to undefined, because: ${reason}`);
|
|
3729
|
+
}
|
|
3716
3730
|
return;
|
|
3717
3731
|
}
|
|
3718
3732
|
const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];
|
|
@@ -3788,7 +3802,7 @@ class EditorEntityStore extends EntityStoreBase {
|
|
|
3788
3802
|
unsubscribe();
|
|
3789
3803
|
}
|
|
3790
3804
|
else {
|
|
3791
|
-
|
|
3805
|
+
debug.warn('[experiences-core::EditorEntityStore] Unexpected entities received in REQUESTED_ENTITIES. Ignoring this response.');
|
|
3792
3806
|
}
|
|
3793
3807
|
});
|
|
3794
3808
|
const timeout = setTimeout(() => {
|
|
@@ -3819,7 +3833,7 @@ class EditorEntityStore extends EntityStoreBase {
|
|
|
3819
3833
|
}
|
|
3820
3834
|
catch (err) {
|
|
3821
3835
|
// TODO: move to debug utils once it is extracted
|
|
3822
|
-
|
|
3836
|
+
debug.warn(`[experiences-core::EditorEntityStore] Failed to request asset ${id}`);
|
|
3823
3837
|
return undefined;
|
|
3824
3838
|
}
|
|
3825
3839
|
}
|
|
@@ -3832,7 +3846,7 @@ class EditorEntityStore extends EntityStoreBase {
|
|
|
3832
3846
|
}
|
|
3833
3847
|
catch (err) {
|
|
3834
3848
|
// TODO: move to debug utils once it is extracted
|
|
3835
|
-
|
|
3849
|
+
debug.warn(`[experiences-core::EditorEntityStore] Failed to request entry ${id}`, err);
|
|
3836
3850
|
return undefined;
|
|
3837
3851
|
}
|
|
3838
3852
|
}
|
|
@@ -3852,7 +3866,7 @@ function transformAssetFileToUrl(fieldValue) {
|
|
|
3852
3866
|
const REQUEST_TIMEOUT = 10000;
|
|
3853
3867
|
class EditorModeEntityStore extends EditorEntityStore {
|
|
3854
3868
|
constructor({ entities, locale }) {
|
|
3855
|
-
|
|
3869
|
+
debug.debug(`[experiences-core::EditorModeEntityStore] Initializing editor entity store with ${entities.length} entities for locale ${locale}.`, { entities });
|
|
3856
3870
|
const subscribe = (method, cb) => {
|
|
3857
3871
|
const handleMessage = (event) => {
|
|
3858
3872
|
const data = JSON.parse(event.data);
|
|
@@ -4145,7 +4159,7 @@ const inMemoryEntitiesStore = create((set, get) => ({
|
|
|
4145
4159
|
|
|
4146
4160
|
function maybeResolveLink(maybeLink) {
|
|
4147
4161
|
if (!isLink(maybeLink)) {
|
|
4148
|
-
|
|
4162
|
+
debug.warn('[experiences-core::InMemoryEntitiesStore] maybeResolveLink function must receive Link shape. Provided argument does not match the Link shape: ', maybeLink);
|
|
4149
4163
|
return undefined;
|
|
4150
4164
|
}
|
|
4151
4165
|
return inMemoryEntitiesStore.getState().resolveEntity(maybeLink);
|
|
@@ -4364,26 +4378,26 @@ function gatherAutoFetchedReferentsFromIncludes(deepReferences, entriesResponse)
|
|
|
4364
4378
|
for (const reference of deepReferences) {
|
|
4365
4379
|
const headEntry = entriesResponse.items.find((entry) => entry.sys.id === reference.headEntityId);
|
|
4366
4380
|
if (!headEntry) {
|
|
4367
|
-
|
|
4381
|
+
debug.debug(`[experiences-sdk-core::fetchers] When resolving deep-references could not find headEntry with id '${reference.entityId}'`);
|
|
4368
4382
|
continue;
|
|
4369
4383
|
}
|
|
4370
4384
|
const linkToReferent = headEntry.fields[reference.field];
|
|
4371
4385
|
if (undefined === linkToReferent) {
|
|
4372
|
-
|
|
4386
|
+
debug.debug(`[experiences-sdk-core::fetchers] Empty reference in headEntity. Probably reference is simply not set.`);
|
|
4373
4387
|
continue;
|
|
4374
4388
|
}
|
|
4375
4389
|
if (!isLink(linkToReferent)) {
|
|
4376
|
-
|
|
4390
|
+
debug.debug(`[experiences-sdk-core::fetchers] Non-link value in headEntity. Probably broken path '${reference.originalPath}'`);
|
|
4377
4391
|
continue;
|
|
4378
4392
|
}
|
|
4379
4393
|
const linkType = linkToReferent.sys.linkType;
|
|
4380
4394
|
if (!['Entry', 'Asset'].includes(linkType)) {
|
|
4381
|
-
|
|
4395
|
+
debug.debug(`[experiences-sdk-core::fetchers] Unhandled linkType :${JSON.stringify(linkToReferent)}`);
|
|
4382
4396
|
continue;
|
|
4383
4397
|
}
|
|
4384
4398
|
const referentEntity = entriesResponse.includes?.[linkType]?.find((entity) => entity.sys.id === linkToReferent.sys.id);
|
|
4385
4399
|
if (!referentEntity) {
|
|
4386
|
-
|
|
4400
|
+
debug.debug(`[experiences-sdk-core::fetchers] L2-referent ${linkType} was not found within .includes (${JSON.stringify({
|
|
4387
4401
|
linkToReferent,
|
|
4388
4402
|
})})`);
|
|
4389
4403
|
continue;
|
|
@@ -4830,5 +4844,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
|
|
|
4830
4844
|
}
|
|
4831
4845
|
}
|
|
4832
4846
|
|
|
4833
|
-
export { BREAKPOINTS_STRATEGY_DESKTOP_FIRST, BREAKPOINTS_STRATEGY_MOBILE_FIRST, DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, defineSdkOptions, designTokensRegistry, detachExperienceStyles, detectBreakpointsStrategy, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, extractLeafLinksReferencedFromExperience, extractReferencesFromEntries, extractReferencesFromEntriesAsIds, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getPrebindingPathBySourceEntry, getSdkOptions, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, inMemoryEntities, inMemoryEntitiesStore, indexByBreakpoint, isArrayOfLinks, isAsset, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isDeepPrebinding, isElementHidden, isEntry, isExperienceEntry, isLink, isLinkToAsset, isLinkToEntry, isPatternComponent, isPatternEntry, isPreboundProp, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, mergeDesignValuesByBreakpoint, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, referencesOf, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sdkOptionsRegistry, sectionBuiltInStyles, sendMessage, singleColumnBuiltInStyles, splitDirectAndSlotChildren, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, transformVisibility, treeMap, treeVisit, tryParseMessage, uniqueById, useInMemoryEntities, validateExperienceBuilderConfig };
|
|
4847
|
+
export { BREAKPOINTS_STRATEGY_DESKTOP_FIRST, BREAKPOINTS_STRATEGY_MOBILE_FIRST, DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, defineSdkOptions, designTokensRegistry, detachExperienceStyles, detectBreakpointsStrategy, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, extractLeafLinksReferencedFromExperience, extractReferencesFromEntries, extractReferencesFromEntriesAsIds, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getPrebindingPathBySourceEntry, getSdkOptions, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, inMemoryEntities, inMemoryEntitiesStore, indexByBreakpoint, isArrayOfLinks, isAsset, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isDeepPrebinding, isElementHidden, isEntry, isExperienceEntry, isLink, isLinkToAsset, isLinkToEntry, isPatternComponent, isPatternEntry, isPreboundProp, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, mergeDesignValuesByBreakpoint, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, referencesOf, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sdkOptionsRegistry, sectionBuiltInStyles, sendMessage, setDebugLevel, singleColumnBuiltInStyles, splitDirectAndSlotChildren, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, transformVisibility, treeMap, treeVisit, tryParseMessage, uniqueById, useInMemoryEntities, validateExperienceBuilderConfig };
|
|
4834
4848
|
//# sourceMappingURL=index.js.map
|