@wandzai/utils 1.0.75 → 1.0.77
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/package.json +1 -1
- package/src/bee-free.d.ts +2 -2
- package/src/bee-free.js +70 -40
- package/src/bee-free.js.map +1 -1
- package/src/wandz.d.ts +2 -1
- package/src/wandz.js +3 -4
- package/src/wandz.js.map +1 -1
package/package.json
CHANGED
package/src/bee-free.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InteractionViewModes } from '@wandzai/wandz-interfaces';
|
|
2
|
-
export declare const extractAllTextFromEntityJson: (json: any, device?: InteractionViewModes | null) =>
|
|
1
|
+
import { InteractionViewModes, IPopupElement } from '@wandzai/wandz-interfaces';
|
|
2
|
+
export declare const extractAllTextFromEntityJson: (json: any, device?: InteractionViewModes | null) => IPopupElement[];
|
|
3
3
|
export declare const STUDIO_SETTINGS_WIDTH_PATH: {
|
|
4
4
|
desktop: string;
|
|
5
5
|
mobile: string;
|
package/src/bee-free.js
CHANGED
|
@@ -5,7 +5,8 @@ const lodash_1 = require("lodash");
|
|
|
5
5
|
const html_entities_1 = require("html-entities");
|
|
6
6
|
const wandz_interfaces_1 = require("@wandzai/wandz-interfaces");
|
|
7
7
|
const extractAllTextFromEntityJson = (json, device = null) => {
|
|
8
|
-
const
|
|
8
|
+
const elements = [];
|
|
9
|
+
let index = 0;
|
|
9
10
|
const stripHtml = (html) => (0, html_entities_1.decode)(html
|
|
10
11
|
.replace(/<style[^>]*>.*?<\/style>/gis, '')
|
|
11
12
|
.replace(/<script[^>]*>.*?<\/script>/gis, '')
|
|
@@ -23,73 +24,102 @@ const extractAllTextFromEntityJson = (json, device = null) => {
|
|
|
23
24
|
return !hideMobile;
|
|
24
25
|
return true;
|
|
25
26
|
};
|
|
26
|
-
const
|
|
27
|
+
const mergeStyles = (...styles) => Object.assign({}, ...styles);
|
|
28
|
+
const pushElement = (text, flags, style, rowIndex, columnIndex, moduleIndex, verticalRatio) => {
|
|
29
|
+
if (!text)
|
|
30
|
+
return;
|
|
31
|
+
elements.push({
|
|
32
|
+
id: `${rowIndex}-${columnIndex}-${moduleIndex}-${index}`,
|
|
33
|
+
text: text.trim(),
|
|
34
|
+
index: index++,
|
|
35
|
+
signals: {
|
|
36
|
+
content: flags,
|
|
37
|
+
typography: {
|
|
38
|
+
fontSizePx: style?.fontSize ? Number(String(style.fontSize).replace('px', '')) : undefined,
|
|
39
|
+
fontWeight: style?.fontWeight ? Number(style.fontWeight) : undefined,
|
|
40
|
+
isItalic: style?.fontStyle === 'italic',
|
|
41
|
+
isUppercase: style?.textTransform === 'uppercase',
|
|
42
|
+
isUnderlined: style?.textDecoration === 'underline',
|
|
43
|
+
},
|
|
44
|
+
color: {
|
|
45
|
+
textColor: style?.color,
|
|
46
|
+
backgroundColor: style?.backgroundColor,
|
|
47
|
+
},
|
|
48
|
+
layout: {
|
|
49
|
+
rowIndex,
|
|
50
|
+
columnIndex,
|
|
51
|
+
moduleIndex,
|
|
52
|
+
verticalRatio,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const extractTextFromModule = (module, rowIndex, columnIndex, moduleIndex, totalRows) => {
|
|
27
58
|
const d = module.descriptor;
|
|
28
|
-
if (!d)
|
|
59
|
+
if (!d || !isVisibleForDevice(d.computedStyle))
|
|
29
60
|
return;
|
|
61
|
+
const verticalRatio = rowIndex / Math.max(totalRows - 1, 1);
|
|
62
|
+
const baseStyle = mergeStyles(d.computedStyle, d.style, d.mobileStyle);
|
|
30
63
|
if (typeof d.paragraph?.html === 'string') {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
64
|
+
const text = stripHtml(d.paragraph.html);
|
|
65
|
+
const style = mergeStyles(baseStyle, d.paragraph?.style, d.paragraph?.computedStyle);
|
|
66
|
+
pushElement(text, { isParagraph: true }, style, rowIndex, columnIndex, moduleIndex, verticalRatio);
|
|
34
67
|
}
|
|
35
68
|
if (typeof d.button?.label === 'string') {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
if (typeof d.heading?.text === 'string') {
|
|
41
|
-
const t = stripHtml(d.heading.text);
|
|
42
|
-
if (t)
|
|
43
|
-
values.push(t);
|
|
69
|
+
const text = stripHtml(d.button.label);
|
|
70
|
+
const style = mergeStyles(baseStyle, d.button?.style, d.button?.computedStyle);
|
|
71
|
+
pushElement(text, { isButton: true }, style, rowIndex, columnIndex, moduleIndex, verticalRatio);
|
|
44
72
|
}
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
73
|
+
if (typeof d.heading?.text === 'string' || typeof d.heading?.html === 'string') {
|
|
74
|
+
const text = stripHtml(d.heading?.text ?? d.heading?.html);
|
|
75
|
+
const style = mergeStyles(baseStyle, d.heading?.style, d.heading?.computedStyle);
|
|
76
|
+
pushElement(text, { isHeading: true }, style, rowIndex, columnIndex, moduleIndex, verticalRatio);
|
|
49
77
|
}
|
|
50
78
|
if (Array.isArray(d.list?.items)) {
|
|
51
79
|
for (const item of d.list.items) {
|
|
52
80
|
if (typeof item?.text === 'string') {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
81
|
+
const text = stripHtml(item.text);
|
|
82
|
+
const style = mergeStyles(baseStyle, d.list?.style, d.list?.computedStyle);
|
|
83
|
+
pushElement(text, { isListItem: true }, style, rowIndex, columnIndex, moduleIndex, verticalRatio);
|
|
56
84
|
}
|
|
57
85
|
}
|
|
58
86
|
}
|
|
59
87
|
if (typeof d.html?.html === 'string') {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
88
|
+
const text = stripHtml(d.html.html);
|
|
89
|
+
const style = mergeStyles(baseStyle, d.html?.style, d.html?.computedStyle);
|
|
90
|
+
pushElement(text, { isRawHtml: true }, style, rowIndex, columnIndex, moduleIndex, verticalRatio);
|
|
63
91
|
}
|
|
64
92
|
if (typeof d.image?.alt === 'string') {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
93
|
+
const text = stripHtml(d.image.alt);
|
|
94
|
+
const style = mergeStyles(baseStyle, d.image?.style, d.image?.computedStyle);
|
|
95
|
+
pushElement(text, { isImageAlt: true }, style, rowIndex, columnIndex, moduleIndex, verticalRatio);
|
|
68
96
|
}
|
|
69
97
|
if (d.table?.content?.rows) {
|
|
70
98
|
for (const row of d.table.content.rows) {
|
|
71
99
|
for (const cell of row.cells ?? []) {
|
|
72
100
|
if (typeof cell.html === 'string') {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
101
|
+
const text = stripHtml(cell.html);
|
|
102
|
+
const style = mergeStyles(baseStyle, d.table?.style, d.table?.computedStyle);
|
|
103
|
+
pushElement(text, { isTableCell: true }, style, rowIndex, columnIndex, moduleIndex, verticalRatio);
|
|
76
104
|
}
|
|
77
105
|
}
|
|
78
106
|
}
|
|
79
107
|
}
|
|
80
108
|
};
|
|
81
|
-
|
|
109
|
+
const rows = json.page?.rows ?? [];
|
|
110
|
+
rows.forEach((row, rowIndex) => {
|
|
82
111
|
if (!isVisibleForDevice(row.content?.computedStyle))
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
112
|
+
return;
|
|
113
|
+
const totalRows = rows.length;
|
|
114
|
+
row.columns?.forEach((column, columnIndex) => {
|
|
115
|
+
column.modules?.forEach((module, moduleIndex) => {
|
|
86
116
|
if (!isVisibleForDevice(module.descriptor?.computedStyle))
|
|
87
|
-
|
|
88
|
-
extractTextFromModule(module);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return
|
|
117
|
+
return;
|
|
118
|
+
extractTextFromModule(module, rowIndex, columnIndex, moduleIndex, totalRows);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
return elements;
|
|
93
123
|
};
|
|
94
124
|
exports.extractAllTextFromEntityJson = extractAllTextFromEntityJson;
|
|
95
125
|
exports.STUDIO_SETTINGS_WIDTH_PATH = {
|
package/src/bee-free.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bee-free.js","sourceRoot":"","sources":["../../../../libs/utils/src/bee-free.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAC7B,iDAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"bee-free.js","sourceRoot":"","sources":["../../../../libs/utils/src/bee-free.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAC7B,iDAAuC;AACvC,gEAImC;AAE5B,MAAM,4BAA4B,GAAG,CAC1C,IAAS,EACT,SAAsC,IAAI,EACzB,EAAE;IACnB,MAAM,QAAQ,GAAoB,EAAE,CAAC;IACrC,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,MAAM,SAAS,GAAG,CAAC,IAAY,EAAU,EAAE,CACzC,IAAA,sBAAM,EACJ,IAAI;SACD,OAAO,CAAC,6BAA6B,EAAE,EAAE,CAAC;SAC1C,OAAO,CAAC,+BAA+B,EAAE,EAAE,CAAC;SAC5C,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CACV,CAAC;IAEJ,MAAM,kBAAkB,GAAG,CAAC,KAAU,EAAW,EAAE;QACjD,MAAM,WAAW,GAAG,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;QACzD,MAAM,UAAU,GAAG,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;QAEvD,IAAI,MAAM,IAAI,IAAI;YAAE,OAAO,CAAC,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;QACxD,IAAI,MAAM,KAAK,uCAAoB,CAAC,OAAO;YAAE,OAAO,CAAC,WAAW,CAAC;QACjE,IAAI,MAAM,KAAK,uCAAoB,CAAC,MAAM;YAAE,OAAO,CAAC,UAAU,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,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AAC,CAAC;IACjE,OAAO,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,0CAAuB,CAAC,IAAI,CAAC;AAC9F,CAAC,CAAC;AAHW,QAAA,yBAAyB,6BAGpC"}
|
package/src/wandz.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdaptiveSearchReplaceLabels, AiFeatureDistributionType, IAdaptiveSearch, IAffinityBasedCustomAiFeatureConfig, IAiFeaturesBasicConfig, IAudience, IClientCustomAffinity, ICustomAiFeature, ICustomAudience, IEntityCommonDetails, IEventBasedCustomAiFeatureConfig, IInteraction, IPredictionModel, IStorageBasedCustomAiFeatureConfig, IWandzAiFeaturesConfig, WandzAllEntities } from '@wandzai/wandz-interfaces';
|
|
1
|
+
import { AdaptiveSearchReplaceLabels, AiFeatureDistributionType, IAdaptiveSearch, IAffinityBasedCustomAiFeatureConfig, IAiFeaturesBasicConfig, IAudience, IClientCustomAffinity, ICustomAiFeature, ICustomAudience, IEntityCommonDetails, IEventBasedCustomAiFeatureConfig, IInteraction, IPredictionModel, IStorageBasedCustomAiFeatureConfig, IWandzAiFeaturesConfig, Variants, WandzActivations, WandzAllEntities } from '@wandzai/wandz-interfaces';
|
|
2
2
|
export declare const entityTechNameBuilder: (entityName: string) => string;
|
|
3
3
|
export declare function isStorageBasedCustomAiFeature(feature: ICustomAiFeature): feature is IStorageBasedCustomAiFeatureConfig;
|
|
4
4
|
export declare function isAffinityBasedCustomAiFeature(feature: ICustomAiFeature): feature is IAffinityBasedCustomAiFeatureConfig;
|
|
@@ -19,3 +19,4 @@ export declare const getEntityType: (entity: IEntityCommonDetails) => WandzAllEn
|
|
|
19
19
|
export declare const getEntityDisplayName: (entity: IEntityCommonDetails) => string;
|
|
20
20
|
export declare const getAdaptiveSearchDataByField: (search: IAdaptiveSearch, label: AdaptiveSearchReplaceLabels) => any;
|
|
21
21
|
export declare const entityKeyBuilder: (clientTag: string, domain: string, userName: string, identifier: string | number) => string;
|
|
22
|
+
export declare const comparedCampaignAliasBuilder: (type: WandzActivations, which: Variants) => string;
|
package/src/wandz.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.entityKeyBuilder = exports.getAdaptiveSearchDataByField = exports.getEntityDisplayName = exports.getEntityType = exports.getEntityID = exports.isInHouseAiFeature = exports.isCustomAiFeature = exports.isCustomAudience = exports.isCustomEntity = exports.isModel = exports.isAudience = exports.isAiFeature = exports.getCustomAiFeatureType = exports.entityTechNameBuilder = void 0;
|
|
3
|
+
exports.comparedCampaignAliasBuilder = exports.entityKeyBuilder = exports.getAdaptiveSearchDataByField = exports.getEntityDisplayName = exports.getEntityType = exports.getEntityID = exports.isInHouseAiFeature = exports.isCustomAiFeature = exports.isCustomAudience = exports.isCustomEntity = exports.isModel = exports.isAudience = exports.isAiFeature = exports.getCustomAiFeatureType = exports.entityTechNameBuilder = void 0;
|
|
4
4
|
exports.isStorageBasedCustomAiFeature = isStorageBasedCustomAiFeature;
|
|
5
5
|
exports.isAffinityBasedCustomAiFeature = isAffinityBasedCustomAiFeature;
|
|
6
6
|
exports.isEventBasedCustomAiFeature = isEventBasedCustomAiFeature;
|
|
@@ -52,15 +52,12 @@ exports.isModel = isModel;
|
|
|
52
52
|
function isEvent(entity) {
|
|
53
53
|
return (0, exports.isAiFeature)(entity) && entity.entitySubType === wandz_interfaces_1.WandzEntities.EVENT;
|
|
54
54
|
}
|
|
55
|
-
;
|
|
56
55
|
function isCustomAffinity(entity) {
|
|
57
56
|
return entity.entityType === wandz_interfaces_1.AffinityTypes.CUSTOM;
|
|
58
57
|
}
|
|
59
|
-
;
|
|
60
58
|
function isInteraction(entity) {
|
|
61
59
|
return entity.entityType === wandz_interfaces_1.WandzEntities.INTERACTION;
|
|
62
60
|
}
|
|
63
|
-
;
|
|
64
61
|
const isCustomEntity = (entity) => {
|
|
65
62
|
return entity.isCustom;
|
|
66
63
|
};
|
|
@@ -119,4 +116,6 @@ const entityKeyBuilder = (clientTag, domain, userName, identifier) => {
|
|
|
119
116
|
return `${clientTag}_${domain}_${userName}_${identifier}`;
|
|
120
117
|
};
|
|
121
118
|
exports.entityKeyBuilder = entityKeyBuilder;
|
|
119
|
+
const comparedCampaignAliasBuilder = (type, which) => `${wandz_interfaces_1.ENTITIES_DISPLAY_NAME[type]} ${which}`;
|
|
120
|
+
exports.comparedCampaignAliasBuilder = comparedCampaignAliasBuilder;
|
|
122
121
|
//# sourceMappingURL=wandz.js.map
|
package/src/wandz.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wandz.js","sourceRoot":"","sources":["../../../../libs/utils/src/wandz.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"wandz.js","sourceRoot":"","sources":["../../../../libs/utils/src/wandz.ts"],"names":[],"mappings":";;;AAuCA,sEAIC;AAED,wEAIC;AAED,kEAEC;AAqBD,0BAEC;AACD,4CAEC;AAED,sCAEC;AAnFD,gEAsBmC;AAG5B,MAAM,qBAAqB,GAAG,CAAC,UAAkB,EAAE,EAAE;IAK1D,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,UAAU;SACd,WAAW,EAAE;SACb,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC,CAAC;AAZW,QAAA,qBAAqB,yBAYhC;AAEF,SAAgB,6BAA6B,CAC3C,OAAyB;IAEzB,OAAQ,OAA8C,CAAC,YAAY,IAAI,IAAI,CAAC;AAC9E,CAAC;AAED,SAAgB,8BAA8B,CAC5C,OAAyB;IAEzB,OAAO,OAAO,CAAC,aAAa,KAAK,gCAAa,CAAC,QAAQ,CAAC;AAC1D,CAAC;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