@wix/editor-react-components 1.2543.0 → 1.2545.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as ACTIONS, E as ELEMENTS, N as NativeStateType, C as CSS_PROPERTIES, I as INTERACTIONS, D as DATA, L as LAYOUT, A as Archetype } from "../chunks/chunk-6KMOHX3X.js";
|
|
2
|
-
import { D as DesignStates, b as DisplayNames } from "../chunks/constants21.js";
|
|
2
|
+
import { D as DesignStates, b as DisplayNames, C as COMPONENT_TYPE } from "../chunks/constants21.js";
|
|
3
3
|
import { m as manifestFocusable, c as manifestMouseHover, d as manifestClickable } from "../chunks/manifestSdkMixins.js";
|
|
4
4
|
import { w as withSpec } from "../chunks/manifest.js";
|
|
5
5
|
import { I as IS_SUPPORT_DESIGN_STATE_SPEC } from "../chunks/specs.js";
|
|
@@ -9,7 +9,7 @@ const displayConfig = {
|
|
|
9
9
|
const basePresetName = "baseButton";
|
|
10
10
|
const manifest = {
|
|
11
11
|
id: "4190f51c-3836-49f6-8114-96219c165b29",
|
|
12
|
-
type:
|
|
12
|
+
type: COMPONENT_TYPE,
|
|
13
13
|
description: "Guide visitors through your site and drive important actions using customizable button elements.",
|
|
14
14
|
installation: {
|
|
15
15
|
presets: {
|
|
@@ -330,7 +330,12 @@ const manifest = {
|
|
|
330
330
|
componentUrl: "./site/components/Button/component.tsx",
|
|
331
331
|
moduleSpecifier: "@wix/editor-react-components/Button",
|
|
332
332
|
dependencies: {
|
|
333
|
-
componentDependencies: ["@wix/editor-react-components/AnimatedIcon"]
|
|
333
|
+
componentDependencies: ["@wix/editor-react-components/AnimatedIcon"],
|
|
334
|
+
serviceDependencies: [
|
|
335
|
+
"@wix/site-service-business-logger",
|
|
336
|
+
"@wix/site-service-configuration",
|
|
337
|
+
"@wix/viewer-service-environment"
|
|
338
|
+
]
|
|
334
339
|
}
|
|
335
340
|
},
|
|
336
341
|
editor: {
|
|
@@ -7,9 +7,13 @@ import { a as getDataAttributes, g as getQaDataAttributes } from "./dataUtils.js
|
|
|
7
7
|
import { f as formatClassNames } from "./classNames.js";
|
|
8
8
|
import { I as IconAnimationTriggers } from "./Button.types.js";
|
|
9
9
|
import AnimatedIconWithReducedMotion from "../AnimatedIcon/component.js";
|
|
10
|
-
import { T as TRANSITION_DURATION, S as SEMANTIC_CLASS_NAMES, a as TestIds } from "./constants21.js";
|
|
10
|
+
import { T as TRANSITION_DURATION, S as SEMANTIC_CLASS_NAMES, a as TestIds, C as COMPONENT_TYPE } from "./constants21.js";
|
|
11
11
|
import { d as activateByEnterButton, a as activateBySpaceOrEnterButton, r as removeAriaPrefix, g as getAccessibilityAttributesSpread } from "./a11y.js";
|
|
12
12
|
import { i as isValidLink } from "./Link.js";
|
|
13
|
+
import { d as defineStaticService } from "./staticService.js";
|
|
14
|
+
import { d as defineService } from "./index8.js";
|
|
15
|
+
import { E as EnvironmentDefinition } from "./index2.js";
|
|
16
|
+
import { useService } from "@wix/services-manager-react";
|
|
13
17
|
const root = "root__IB9QF";
|
|
14
18
|
const active = "active__lpoVO";
|
|
15
19
|
const label = "label__EtLji";
|
|
@@ -198,6 +202,74 @@ function useButtonA11y({
|
|
|
198
202
|
);
|
|
199
203
|
return a11yAttr;
|
|
200
204
|
}
|
|
205
|
+
const BusinessLoggerDefinition = defineStaticService("@wix/site-service-business-logger");
|
|
206
|
+
const ConfigurationDefinition = defineService("@wix/site-service-configuration");
|
|
207
|
+
const CLICK_ANALYTICS_SRC = 76;
|
|
208
|
+
const CLICK_ANALYTICS_EVID = 1113;
|
|
209
|
+
const CLICK_ANALYTICS_ENDPOINT = "pa";
|
|
210
|
+
const ClickAnalyticsGroups = {
|
|
211
|
+
Button: "Button"
|
|
212
|
+
};
|
|
213
|
+
const buildClickAnalyticsEvent = ({
|
|
214
|
+
link: link2,
|
|
215
|
+
details,
|
|
216
|
+
elementId,
|
|
217
|
+
elementType,
|
|
218
|
+
elementGroup,
|
|
219
|
+
elementTitle,
|
|
220
|
+
language
|
|
221
|
+
}) => ({
|
|
222
|
+
src: CLICK_ANALYTICS_SRC,
|
|
223
|
+
evid: CLICK_ANALYTICS_EVID,
|
|
224
|
+
bl: navigator.language,
|
|
225
|
+
url: window.location.href,
|
|
226
|
+
element_id: elementId,
|
|
227
|
+
elementType,
|
|
228
|
+
elementGroup,
|
|
229
|
+
elementTitle,
|
|
230
|
+
language,
|
|
231
|
+
value: link2 == null ? void 0 : link2.href,
|
|
232
|
+
details: details ? JSON.stringify(details) : void 0
|
|
233
|
+
});
|
|
234
|
+
const useClickAnalyticsReporter = (params) => {
|
|
235
|
+
var _a;
|
|
236
|
+
const businessLogger = useService(
|
|
237
|
+
BusinessLoggerDefinition
|
|
238
|
+
);
|
|
239
|
+
const environment = useService(EnvironmentDefinition);
|
|
240
|
+
const configuration = useService(
|
|
241
|
+
ConfigurationDefinition
|
|
242
|
+
);
|
|
243
|
+
const isPreview = (_a = environment == null ? void 0 : environment.getPreviewMode) == null ? void 0 : _a.call(environment);
|
|
244
|
+
const reportBi = businessLogger == null ? void 0 : businessLogger.reportBi;
|
|
245
|
+
const language = params.language ?? (environment == null ? void 0 : environment.language);
|
|
246
|
+
const trackClicksAnalytics = configuration == null ? void 0 : configuration.trackClicksAnalytics;
|
|
247
|
+
const isEnabled = !isPreview && trackClicksAnalytics && typeof reportBi === "function";
|
|
248
|
+
const paramsRef = useRef(params);
|
|
249
|
+
paramsRef.current = params;
|
|
250
|
+
return useMemo(() => {
|
|
251
|
+
if (!isEnabled) {
|
|
252
|
+
return void 0;
|
|
253
|
+
}
|
|
254
|
+
return (event) => {
|
|
255
|
+
const { elementId, ...restParams } = paramsRef.current;
|
|
256
|
+
try {
|
|
257
|
+
void Promise.resolve(
|
|
258
|
+
reportBi(
|
|
259
|
+
buildClickAnalyticsEvent({
|
|
260
|
+
...restParams,
|
|
261
|
+
language,
|
|
262
|
+
elementId: elementId || event.currentTarget.id
|
|
263
|
+
}),
|
|
264
|
+
{ endpoint: CLICK_ANALYTICS_ENDPOINT }
|
|
265
|
+
)
|
|
266
|
+
).catch(() => {
|
|
267
|
+
});
|
|
268
|
+
} catch {
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
}, [isEnabled, reportBi, language]);
|
|
272
|
+
};
|
|
201
273
|
const Button = (props) => {
|
|
202
274
|
var _a;
|
|
203
275
|
const {
|
|
@@ -263,12 +335,20 @@ const Button = (props) => {
|
|
|
263
335
|
(_a = elementProps == null ? void 0 : elementProps.label) == null ? void 0 : _a.className
|
|
264
336
|
);
|
|
265
337
|
const linkClassName = styles.link;
|
|
338
|
+
const reportClickAnalytics = useClickAnalyticsReporter({
|
|
339
|
+
link: link2,
|
|
340
|
+
elementId: id,
|
|
341
|
+
elementType: COMPONENT_TYPE,
|
|
342
|
+
elementGroup: ClickAnalyticsGroups.Button,
|
|
343
|
+
elementTitle: label2,
|
|
344
|
+
details: { isDisabled }
|
|
345
|
+
});
|
|
266
346
|
const { isLink, eventHandlers } = useButtonEventHandlers({
|
|
267
347
|
isDisabled,
|
|
268
348
|
link: link2,
|
|
269
349
|
propsOnClick,
|
|
270
350
|
preventLinkNavigation,
|
|
271
|
-
reportBiOnClick,
|
|
351
|
+
reportBiOnClick: reportBiOnClick ?? reportClickAnalytics,
|
|
272
352
|
onMouseEnter,
|
|
273
353
|
onMouseLeave,
|
|
274
354
|
onIconAnimationClick,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const COMPONENT_TYPE = "wixEditorElements.Button";
|
|
1
2
|
const TestIds = {
|
|
2
3
|
buttonContent: "buttonContent",
|
|
3
4
|
buttonLabel: "stylablebutton-label"
|
|
@@ -51,6 +52,7 @@ const DisplayNames = {
|
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
export {
|
|
55
|
+
COMPONENT_TYPE as C,
|
|
54
56
|
DesignStates as D,
|
|
55
57
|
SEMANTIC_CLASS_NAMES as S,
|
|
56
58
|
TRANSITION_DURATION as T,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/editor-react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2545.0",
|
|
4
4
|
"description": "React components for the Wix Editor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -81,8 +81,10 @@
|
|
|
81
81
|
"@wix/design-system-illustrations": "^2.28.5",
|
|
82
82
|
"@wix/sdk": "^1.21.15",
|
|
83
83
|
"@wix/services-manager-react": "^0.1.27",
|
|
84
|
+
"@wix/site-service-business-logger": "^1.0.0",
|
|
85
|
+
"@wix/site-service-configuration": "^1.0.1",
|
|
84
86
|
"@wix/site-service-rendering-context": "^1.0.1",
|
|
85
|
-
"@wix/site-ui": "1.
|
|
87
|
+
"@wix/site-ui": "1.233.0",
|
|
86
88
|
"@wix/video": "^1.106.0",
|
|
87
89
|
"@wix/viewer-service-consent-policy": "^1.0.101",
|
|
88
90
|
"@wix/web-bi-logger": "^2.1.29",
|
|
@@ -197,5 +199,5 @@
|
|
|
197
199
|
"registry": "https://registry.npmjs.org/",
|
|
198
200
|
"access": "public"
|
|
199
201
|
},
|
|
200
|
-
"falconPackageHash": "
|
|
202
|
+
"falconPackageHash": "8e1e8d1a81f78bba8682d8c59d3e9f9c9a49c9c4f3879b2d850347d8"
|
|
201
203
|
}
|