@wix/editor-react-components 1.2544.0 → 1.2546.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.
@@ -4,7 +4,6 @@ import React__default, { useRef, useCallback, useMemo, useEffect, useState, forw
4
4
  import { c as clsx } from "../chunks/clsx.js";
5
5
  import { useService } from "@wix/services-manager-react";
6
6
  import { E as EnvironmentDefinition } from "../chunks/index2.js";
7
- import { f as convertA11yKeysToHtmlFormat } from "../chunks/a11y.js";
8
7
  import { d as directionStyles } from "../chunks/direction.module.js";
9
8
  import Image3 from "../Image3/component.js";
10
9
  import { A as ARIA_LABELS, s as selectors, d as dataDefaults } from "../chunks/constants39.js";
@@ -3564,7 +3563,6 @@ const AudioPlayer = (props) => {
3564
3563
  id,
3565
3564
  className,
3566
3565
  direction,
3567
- a11y,
3568
3566
  audio,
3569
3567
  coverImage,
3570
3568
  displayMode,
@@ -3613,7 +3611,6 @@ const AudioPlayer = (props) => {
3613
3611
  {
3614
3612
  id,
3615
3613
  ...direction && { dir: direction },
3616
- ...a11y && convertA11yKeysToHtmlFormat(a11y),
3617
3614
  onMouseEnter: onMouseIn,
3618
3615
  onMouseLeave: onMouseOut,
3619
3616
  className: clsx(
@@ -238,6 +238,12 @@ const manifest = {
238
238
  ...manifestMediaProgress(),
239
239
  ...manifestMouseHover()
240
240
  },
241
+ displayFilters: {
242
+ data: {
243
+ // a11y is hidden because of ECL-17824. If you need to add a11y in the future, add another dataType.a11y under a different key
244
+ hide: ["a11y"]
245
+ }
246
+ },
241
247
  displayGroups: {
242
248
  coverArtGroup: {
243
249
  displayName: DisplayNames.elements.coverMedia,
@@ -1,4 +1,4 @@
1
- import { A11y, Audio, Direction, Image } from '@wix/editor-react-types';
1
+ import { Audio, Direction, Image } from '@wix/editor-react-types';
2
2
  import { Image3Props } from '../Image3/Image3.types';
3
3
  import { SdkFunctionMouseHoverProps } from '../../../utils/functions/sdkFunctionCallbackProps';
4
4
  export interface AudioPlayerElementProps {
@@ -28,7 +28,6 @@ export interface AudioPlayerProps extends SdkFunctionMouseHoverProps {
28
28
  id?: string;
29
29
  className?: string;
30
30
  direction?: Direction;
31
- a11y?: A11y;
32
31
  audio?: Audio;
33
32
  coverImage?: Image;
34
33
  displayMode?: Image3Props['displayMode'];
@@ -1,3 +1,4 @@
1
+ export declare const COMPONENT_TYPE = "wixEditorElements.Button";
1
2
  export declare const TestIds: {
2
3
  buttonContent: string;
3
4
  buttonLabel: string;
@@ -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: "wixEditorElements.Button",
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.2544.0",
3
+ "version": "1.2546.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -81,6 +81,8 @@
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
87
  "@wix/site-ui": "1.233.0",
86
88
  "@wix/video": "^1.106.0",
@@ -197,5 +199,5 @@
197
199
  "registry": "https://registry.npmjs.org/",
198
200
  "access": "public"
199
201
  },
200
- "falconPackageHash": "92cfb65ceb9ec95231cc0442b9152e0441e0f104b58070f96faf4a69"
202
+ "falconPackageHash": "6832479dbb355187b2c0df1c8c54e23813710645d19f71fbc0dd9b98"
201
203
  }