@cloudscape-design/components 3.0.765 → 3.0.766

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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/drawer/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAUtC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAsB1E,eAAO,MAAM,MAAM,2FAwGlB,CAAC;AA6CF,eAAO,MAAM,iBAAiB,4GAS3B,sBAAsB,gBAyFxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/drawer/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAWtC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAsB1E,eAAO,MAAM,MAAM,2FAwGlB,CAAC;AAoDF,eAAO,MAAM,iBAAiB,4GAS3B,sBAAsB,gBAyFxB,CAAC"}
@@ -4,6 +4,7 @@ import React, { useRef } from 'react';
4
4
  import clsx from 'clsx';
5
5
  import { useContainerQuery } from '@cloudscape-design/component-toolkit';
6
6
  import { useDensityMode } from '@cloudscape-design/component-toolkit/internal';
7
+ import { getVisualContextClassname } from '../../internal/components/visual-context';
7
8
  import { CloseButton, ToggleButton, togglesConfig } from '../toggles';
8
9
  import { TOOLS_DRAWER_ID } from '../utils/use-drawers';
9
10
  import { splitItems } from './drawers-helpers';
@@ -67,7 +68,7 @@ export const Drawer = React.forwardRef(({ id, contentClassName, toggleClassName,
67
68
  } }),
68
69
  children))));
69
70
  });
70
- const DrawerTrigger = React.forwardRef(({ testUtilsClassName, ariaLabel, ariaExpanded, ariaControls, badge, itemId, isActive, trigger, onClick, }, ref) => (React.createElement("div", { className: clsx(styles['drawer-trigger'], isActive && styles['drawer-trigger-active']), onClick: onClick },
71
+ const DrawerTrigger = React.forwardRef(({ testUtilsClassName, ariaLabel, ariaExpanded, ariaControls, badge, itemId, isActive, trigger, onClick, }, ref) => (React.createElement("div", { className: clsx(styles['drawer-trigger'], isActive && styles['drawer-trigger-active'], isActive && getVisualContextClassname('app-layout-tools-drawer-trigger')), onClick: onClick },
71
72
  React.createElement(ToggleButton, { ref: ref, className: testUtilsClassName, iconName: trigger.iconName, iconSvg: trigger.iconSvg, ariaLabel: ariaLabel, ariaExpanded: ariaExpanded, ariaControls: ariaControls, badge: badge, testId: itemId && `awsui-app-layout-trigger-${itemId}` }))));
72
73
  export const DrawerTriggersBar = ({ isMobile, topOffset, bottomOffset, activeDrawerId, ariaLabels, drawers, drawerRefs, onDrawerChange, }) => {
73
74
  const containerRef = React.useRef(null);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app-layout/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAG/E,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,0FAA0F;AAC1F,qFAAqF;AACrF,uFAAuF;AACvF,4EAA4E;AAC5E,wFAAwF;AACxF,0FAA0F;AAC1F,0FAA0F;AAC1F,wBAAwB;A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,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC/E,SAAS,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,aAAa,EACzC,YAAY,EAAE,cAAc,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAC9D,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,IAAI,CAAC,EAAE,EACf,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC,EAAE,EACpC,OAAO,EACL,OAAO,CAAC,MAAM,KAAK,CAAC;4BAClB,CAAC,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;4BACnE,CAAC,CAAC,SAAS,GAEf,CACH,CAAC;gBACJ,CAAC,CAAC;gBACD,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,CAC3B,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC;oBACtC,oBAAC,YAAY,IACX,SAAS,EACP,oBAAoB,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,wBAAwB,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,eAAe,EAE3F,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,GACtD,CACE,CACP,CACG,CACA,CACT,CACG,CACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport { AppLayoutProps } from '../interfaces';\nimport { CloseButton, ToggleButton, togglesConfig } from '../toggles';\nimport { TOOLS_DRAWER_ID } from '../utils/use-drawers';\nimport { splitItems } from './drawers-helpers';\nimport { DesktopDrawerProps, DrawerTriggersBarProps } from './interfaces';\nimport OverflowMenu from './overflow-menu';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\n// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several\n// known bugs in NVDA that cause focus changes within a container to sometimes not be\n// announced. As a result, we use one region for the open button and one region for the\n// actual drawer content, always hiding the other one when it's not visible.\n// An alternative solution to follow a more classic implementation here to only have one\n// button that triggers the opening/closing of the drawer also did not work due to another\n// series of bugs in NVDA (together with Firefox) which prevent the changed expanded state\n// from being announced.\n// Even with this workaround in place, the announcement of the close button when opening a\n// panel in NVDA is not working correctly. The suspected root cause is one of the bugs below\n// as well.\n// Relevant tickets:\n// * https://github.com/nvaccess/nvda/issues/6606\n// * https://github.com/nvaccess/nvda/issues/5825\n// * https://github.com/nvaccess/nvda/issues/5247\n// * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)\nexport const Drawer = React.forwardRef(\n (\n {\n id,\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n children,\n hideOpenButton,\n isOpen,\n isHidden,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n resizeHandle,\n }: DesktopDrawerProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n const { TagName, iconName } = togglesConfig[type];\n const { mainLabel, closeLabel, openLabel } = ariaLabels;\n const drawerContentWidthOpen = isMobile ? undefined : width;\n const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <ToggleButton\n ref={toggleRefs.toggle}\n className={toggleClassName}\n iconName={iconName}\n ariaLabel={openLabel}\n onClick={() => onToggle(true)}\n ariaExpanded={isOpen ? undefined : false}\n />\n </TagName>\n );\n\n return (\n <div\n ref={ref}\n className={clsx(styles.drawer, {\n [styles.hide]: isHidden,\n [styles['drawer-closed']]: !isOpen,\n [testutilStyles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n })}\n style={{ width: drawerContentWidth }}\n onBlur={\n onLoseFocus\n ? e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n onLoseFocus(e);\n }\n }\n : undefined\n }\n onClick={event => {\n if (onClick) {\n onClick(event);\n }\n if (!isOpen) {\n // to prevent calling onToggle from the drawer when it's called from the toggle button\n if (\n openButtonWrapperRef.current === event.target ||\n !openButtonWrapperRef.current?.contains(event.target as Node)\n ) {\n onToggle(true);\n }\n }\n }}\n >\n <div\n id={id}\n style={{ width: drawerContentWidth, top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['drawer-content-clickable'], contentClassName)}\n >\n {!isMobile && !hideOpenButton && regularOpenButton}\n <TagName\n className={clsx(resizeHandle && styles['drawer-resize-content'])}\n aria-label={mainLabel}\n aria-hidden={!isOpen}\n >\n {!isMobile && isOpen && <div className={styles['resize-handle-wrapper']}>{resizeHandle}</div>}\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={closeLabel}\n onClick={() => {\n onToggle(false);\n }}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n }\n);\n\ninterface DrawerTriggerProps {\n testUtilsClassName?: string;\n ariaLabel: string | undefined;\n ariaExpanded: boolean;\n ariaControls?: string;\n badge: boolean | undefined;\n itemId?: string;\n isActive: boolean;\n trigger: AppLayoutProps.Drawer['trigger'];\n onClick: (() => void) | undefined;\n}\n\nconst DrawerTrigger = React.forwardRef(\n (\n {\n testUtilsClassName,\n ariaLabel,\n ariaExpanded,\n ariaControls,\n badge,\n itemId,\n isActive,\n trigger,\n onClick,\n }: DrawerTriggerProps,\n ref: React.Ref<{ focus: () => void }>\n ) => (\n <div className={clsx(styles['drawer-trigger'], isActive && styles['drawer-trigger-active'])} onClick={onClick}>\n <ToggleButton\n ref={ref}\n className={testUtilsClassName}\n iconName={trigger.iconName}\n iconSvg={trigger.iconSvg}\n ariaLabel={ariaLabel}\n ariaExpanded={ariaExpanded}\n ariaControls={ariaControls}\n badge={badge}\n testId={itemId && `awsui-app-layout-trigger-${itemId}`}\n />\n </div>\n )\n);\n\nexport const DrawerTriggersBar = ({\n isMobile,\n topOffset,\n bottomOffset,\n activeDrawerId,\n ariaLabels,\n drawers,\n drawerRefs,\n onDrawerChange,\n}: DrawerTriggersBarProps) => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const previousActiveDrawerId = useRef(activeDrawerId);\n const [containerHeight, triggersContainerRef] = useContainerQuery(rect => rect.contentBoxHeight);\n const isCompactMode = useDensityMode(containerRef) === 'compact';\n\n if (activeDrawerId) {\n previousActiveDrawerId.current = activeDrawerId;\n }\n\n const getIndexOfOverflowItem = () => {\n if (containerHeight) {\n const ITEM_HEIGHT = isCompactMode ? 34 : 38;\n const overflowSpot = containerHeight / 1.5;\n\n const index = Math.floor(overflowSpot / ITEM_HEIGHT);\n\n return index;\n }\n return 0;\n };\n\n const { visibleItems, overflowItems } = splitItems(drawers, getIndexOfOverflowItem(), activeDrawerId);\n const overflowMenuHasBadge = !!overflowItems.find(item => item.badge);\n\n return (\n <div\n className={clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {\n [styles['drawer-mobile']]: isMobile,\n [styles.hide]: drawers.length === 1 && !!activeDrawerId,\n })}\n ref={containerRef}\n >\n <div\n ref={triggersContainerRef}\n style={{ top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], {\n [styles['drawer-content-clickable']]: drawers.length === 1,\n })}\n onClick={\n drawers.length === 1\n ? () => onDrawerChange(drawers[0].id !== activeDrawerId ? drawers[0].id : null)\n : undefined\n }\n >\n {!isMobile && (\n <aside aria-label={ariaLabels?.drawers} role=\"region\">\n <div className={styles['drawer-triggers-wrapper']} role=\"toolbar\" aria-orientation=\"vertical\">\n {visibleItems.map((item, index) => {\n return (\n <DrawerTrigger\n key={index}\n testUtilsClassName={clsx(\n testutilStyles['drawers-trigger'],\n item.id === TOOLS_DRAWER_ID && testutilStyles['tools-toggle']\n )}\n ariaExpanded={activeDrawerId === item.id}\n ref={item.id === previousActiveDrawerId.current ? drawerRefs.toggle : undefined}\n ariaLabel={item.ariaLabels?.triggerButton}\n ariaControls={activeDrawerId === item.id ? item.id : undefined}\n trigger={item.trigger}\n badge={item.badge}\n itemId={item.id}\n isActive={activeDrawerId === item.id}\n onClick={\n drawers.length !== 1\n ? () => onDrawerChange(item.id !== activeDrawerId ? item.id : null)\n : undefined\n }\n />\n );\n })}\n {overflowItems.length > 0 && (\n <div className={styles['drawer-trigger']}>\n <OverflowMenu\n ariaLabel={\n overflowMenuHasBadge ? ariaLabels?.drawersOverflowWithBadge : ariaLabels?.drawersOverflow\n }\n items={overflowItems}\n onItemClick={({ detail }) => onDrawerChange(detail.id)}\n />\n </div>\n )}\n </div>\n </aside>\n )}\n </div>\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app-layout/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,YAAY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UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,wBAAwB,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,eAAe,EAE3F,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,GACtD,CACE,CACP,CACG,CACA,CACT,CACG,CACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getVisualContextClassname } from '../../internal/components/visual-context';\nimport { AppLayoutProps } from '../interfaces';\nimport { CloseButton, ToggleButton, togglesConfig } from '../toggles';\nimport { TOOLS_DRAWER_ID } from '../utils/use-drawers';\nimport { splitItems } from './drawers-helpers';\nimport { DesktopDrawerProps, DrawerTriggersBarProps } from './interfaces';\nimport OverflowMenu from './overflow-menu';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\n// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several\n// known bugs in NVDA that cause focus changes within a container to sometimes not be\n// announced. As a result, we use one region for the open button and one region for the\n// actual drawer content, always hiding the other one when it's not visible.\n// An alternative solution to follow a more classic implementation here to only have one\n// button that triggers the opening/closing of the drawer also did not work due to another\n// series of bugs in NVDA (together with Firefox) which prevent the changed expanded state\n// from being announced.\n// Even with this workaround in place, the announcement of the close button when opening a\n// panel in NVDA is not working correctly. The suspected root cause is one of the bugs below\n// as well.\n// Relevant tickets:\n// * https://github.com/nvaccess/nvda/issues/6606\n// * https://github.com/nvaccess/nvda/issues/5825\n// * https://github.com/nvaccess/nvda/issues/5247\n// * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)\nexport const Drawer = React.forwardRef(\n (\n {\n id,\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n children,\n hideOpenButton,\n isOpen,\n isHidden,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n resizeHandle,\n }: DesktopDrawerProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n const { TagName, iconName } = togglesConfig[type];\n const { mainLabel, closeLabel, openLabel } = ariaLabels;\n const drawerContentWidthOpen = isMobile ? undefined : width;\n const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <ToggleButton\n ref={toggleRefs.toggle}\n className={toggleClassName}\n iconName={iconName}\n ariaLabel={openLabel}\n onClick={() => onToggle(true)}\n ariaExpanded={isOpen ? undefined : false}\n />\n </TagName>\n );\n\n return (\n <div\n ref={ref}\n className={clsx(styles.drawer, {\n [styles.hide]: isHidden,\n [styles['drawer-closed']]: !isOpen,\n [testutilStyles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n })}\n style={{ width: drawerContentWidth }}\n onBlur={\n onLoseFocus\n ? e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n onLoseFocus(e);\n }\n }\n : undefined\n }\n onClick={event => {\n if (onClick) {\n onClick(event);\n }\n if (!isOpen) {\n // to prevent calling onToggle from the drawer when it's called from the toggle button\n if (\n openButtonWrapperRef.current === event.target ||\n !openButtonWrapperRef.current?.contains(event.target as Node)\n ) {\n onToggle(true);\n }\n }\n }}\n >\n <div\n id={id}\n style={{ width: drawerContentWidth, top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['drawer-content-clickable'], contentClassName)}\n >\n {!isMobile && !hideOpenButton && regularOpenButton}\n <TagName\n className={clsx(resizeHandle && styles['drawer-resize-content'])}\n aria-label={mainLabel}\n aria-hidden={!isOpen}\n >\n {!isMobile && isOpen && <div className={styles['resize-handle-wrapper']}>{resizeHandle}</div>}\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={closeLabel}\n onClick={() => {\n onToggle(false);\n }}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n }\n);\n\ninterface DrawerTriggerProps {\n testUtilsClassName?: string;\n ariaLabel: string | undefined;\n ariaExpanded: boolean;\n ariaControls?: string;\n badge: boolean | undefined;\n itemId?: string;\n isActive: boolean;\n trigger: AppLayoutProps.Drawer['trigger'];\n onClick: (() => void) | undefined;\n}\n\nconst DrawerTrigger = React.forwardRef(\n (\n {\n testUtilsClassName,\n ariaLabel,\n ariaExpanded,\n ariaControls,\n badge,\n itemId,\n isActive,\n trigger,\n onClick,\n }: DrawerTriggerProps,\n ref: React.Ref<{ focus: () => void }>\n ) => (\n <div\n className={clsx(\n styles['drawer-trigger'],\n isActive && styles['drawer-trigger-active'],\n isActive && getVisualContextClassname('app-layout-tools-drawer-trigger')\n )}\n onClick={onClick}\n >\n <ToggleButton\n ref={ref}\n className={testUtilsClassName}\n iconName={trigger.iconName}\n iconSvg={trigger.iconSvg}\n ariaLabel={ariaLabel}\n ariaExpanded={ariaExpanded}\n ariaControls={ariaControls}\n badge={badge}\n testId={itemId && `awsui-app-layout-trigger-${itemId}`}\n />\n </div>\n )\n);\n\nexport const DrawerTriggersBar = ({\n isMobile,\n topOffset,\n bottomOffset,\n activeDrawerId,\n ariaLabels,\n drawers,\n drawerRefs,\n onDrawerChange,\n}: DrawerTriggersBarProps) => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const previousActiveDrawerId = useRef(activeDrawerId);\n const [containerHeight, triggersContainerRef] = useContainerQuery(rect => rect.contentBoxHeight);\n const isCompactMode = useDensityMode(containerRef) === 'compact';\n\n if (activeDrawerId) {\n previousActiveDrawerId.current = activeDrawerId;\n }\n\n const getIndexOfOverflowItem = () => {\n if (containerHeight) {\n const ITEM_HEIGHT = isCompactMode ? 34 : 38;\n const overflowSpot = containerHeight / 1.5;\n\n const index = Math.floor(overflowSpot / ITEM_HEIGHT);\n\n return index;\n }\n return 0;\n };\n\n const { visibleItems, overflowItems } = splitItems(drawers, getIndexOfOverflowItem(), activeDrawerId);\n const overflowMenuHasBadge = !!overflowItems.find(item => item.badge);\n\n return (\n <div\n className={clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {\n [styles['drawer-mobile']]: isMobile,\n [styles.hide]: drawers.length === 1 && !!activeDrawerId,\n })}\n ref={containerRef}\n >\n <div\n ref={triggersContainerRef}\n style={{ top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], {\n [styles['drawer-content-clickable']]: drawers.length === 1,\n })}\n onClick={\n drawers.length === 1\n ? () => onDrawerChange(drawers[0].id !== activeDrawerId ? drawers[0].id : null)\n : undefined\n }\n >\n {!isMobile && (\n <aside aria-label={ariaLabels?.drawers} role=\"region\">\n <div className={styles['drawer-triggers-wrapper']} role=\"toolbar\" aria-orientation=\"vertical\">\n {visibleItems.map((item, index) => {\n return (\n <DrawerTrigger\n key={index}\n testUtilsClassName={clsx(\n testutilStyles['drawers-trigger'],\n item.id === TOOLS_DRAWER_ID && testutilStyles['tools-toggle']\n )}\n ariaExpanded={activeDrawerId === item.id}\n ref={item.id === previousActiveDrawerId.current ? drawerRefs.toggle : undefined}\n ariaLabel={item.ariaLabels?.triggerButton}\n ariaControls={activeDrawerId === item.id ? item.id : undefined}\n trigger={item.trigger}\n badge={item.badge}\n itemId={item.id}\n isActive={activeDrawerId === item.id}\n onClick={\n drawers.length !== 1\n ? () => onDrawerChange(item.id !== activeDrawerId ? item.id : null)\n : undefined\n }\n />\n );\n })}\n {overflowItems.length > 0 && (\n <div className={styles['drawer-trigger']}>\n <OverflowMenu\n ariaLabel={\n overflowMenuHasBadge ? ariaLabels?.drawersOverflowWithBadge : ariaLabels?.drawersOverflow\n }\n items={overflowItems}\n onItemClick={({ detail }) => onDrawerChange(detail.id)}\n />\n </div>\n )}\n </div>\n </aside>\n )}\n </div>\n </div>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"analytics-funnel.d.ts","sourceRoot":"","sources":["../../../../../src/internal/analytics/components/analytics-funnel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAOvE,OAAO,EAKL,sBAAsB,EAEtB,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EAElB,MAAM,eAAe,CAAC;AAUvB,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACxC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,mBAAmB,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IAC7D,gBAAgB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IACvD,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAC3D,cAAc,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC/C,kBAAkB,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACvD,kBAAkB,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,eAAe,UAAW,oBAAoB,gBAa1D,CAAC;AACF,eAAO,MAAM,kCAAkC,kCAAkC,CAAC;AAsMlF,UAAU,wBAAwB;IAChC,cAAc,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IACzD,gBAAgB,CAAC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
  import { nodeBelongs } from '../../utils/node-belongs';
10
10
  import { FunnelContext, FunnelStepContext, FunnelSubStepContext, } from '../context/analytics-context';
11
11
  import { useFunnel, useFunnelStep } from '../hooks/use-funnel';
12
- import { FunnelMetrics } from '../index';
12
+ import { FunnelMetrics, PerformanceMetrics } from '../index';
13
13
  import { DATA_ATTR_FUNNEL_STEP, getFunnelNameSelector, getNameFromSelector, getSubStepAllSelector, getSubStepNameSelector, getSubStepSelector, } from '../selectors';
14
14
  export const FUNNEL_VERSION = '1.4';
15
15
  export const AnalyticsFunnel = (props) => {
@@ -38,8 +38,12 @@ const dispatchCreateEditFlowDoneEvent = () => {
38
38
  const onFunnelCancelled = ({ funnelInteractionId, funnelIdentifier, }) => {
39
39
  FunnelMetrics.funnelCancelled({ funnelInteractionId, funnelIdentifier });
40
40
  };
41
- const onFunnelComplete = ({ funnelInteractionId, funnelIdentifier, }) => {
42
- FunnelMetrics.funnelComplete({ funnelInteractionId, funnelIdentifier });
41
+ const onFunnelComplete = (taskCompletionDataProps) => {
42
+ FunnelMetrics.funnelComplete({
43
+ funnelInteractionId: taskCompletionDataProps.taskInteractionId,
44
+ funnelIdentifier: taskCompletionDataProps.taskIdentifier,
45
+ });
46
+ PerformanceMetrics.taskCompletionData(taskCompletionDataProps);
43
47
  dispatchCreateEditFlowDoneEvent();
44
48
  };
45
49
  function evaluateSelectors(selectors, defaultSelector) {
@@ -62,6 +66,7 @@ const InnerAnalyticsFunnel = (_a) => {
62
66
  const loadingButtonCount = useRef(0);
63
67
  const wizardCount = useRef(0);
64
68
  const latestFocusCleanupFunction = useRef(undefined);
69
+ const formSubmitStartTime = useRef(0);
65
70
  // This useEffect hook is run once on component mount to initiate the funnel analytics.
66
71
  // It first calls the 'funnelStart' method from FunnelMetrics, providing all necessary details
67
72
  // about the funnel, and receives a unique interaction id.
@@ -120,7 +125,14 @@ const InnerAnalyticsFunnel = (_a) => {
120
125
  }
121
126
  if (funnelState.current === 'validating') {
122
127
  // Finish the validation phase early.
123
- onFunnelComplete({ funnelInteractionId, funnelIdentifier: props.funnelIdentifier });
128
+ const taskCompletionDataProps = {
129
+ taskIdentifier: props.funnelIdentifier,
130
+ taskType: props.funnelType,
131
+ timeToRespondAfterFormSubmit: performance.now() - formSubmitStartTime.current,
132
+ taskInteractionId: funnelInteractionId,
133
+ taskFlowType: props.funnelFlowType,
134
+ };
135
+ onFunnelComplete(taskCompletionDataProps);
124
136
  funnelState.current = 'complete';
125
137
  }
126
138
  if (funnelState.current === 'complete') {
@@ -135,6 +147,7 @@ const InnerAnalyticsFunnel = (_a) => {
135
147
  /* eslint-enable react-hooks/exhaustive-deps */
136
148
  const funnelSubmit = () => {
137
149
  funnelState.current = 'validating';
150
+ formSubmitStartTime.current = performance.now();
138
151
  /*
139
152
  When the user attempts to submit the form, we wait for 50 milliseconds before checking
140
153
  if any form validation errors are present. This value was chosen to give enough time
@@ -158,7 +171,14 @@ const InnerAnalyticsFunnel = (_a) => {
158
171
  /*
159
172
  If no validation errors are rendered, we treat the funnel as complete.
160
173
  */
161
- onFunnelComplete({ funnelInteractionId });
174
+ const taskCompletionDataProps = {
175
+ taskIdentifier: props.funnelIdentifier,
176
+ taskType: props.funnelType,
177
+ timeToRespondAfterFormSubmit: performance.now() - formSubmitStartTime.current,
178
+ taskInteractionId: funnelInteractionId,
179
+ taskFlowType: props.funnelFlowType,
180
+ };
181
+ onFunnelComplete(taskCompletionDataProps);
162
182
  funnelState.current = 'complete';
163
183
  }
164
184
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"analytics-funnel.js","sourceRoot":"","sources":["../../../../../src/internal/analytics/components/analytics-funnel.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,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esContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useEffect, useRef, useState } from 'react';\n\nimport { PACKAGE_VERSION } from '../../environment';\nimport { useDebounceCallback } from '../../hooks/use-debounce-callback';\nimport { useUniqueId } from '../../hooks/use-unique-id';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\nimport { nodeBelongs } from '../../utils/node-belongs';\nimport {\n FunnelContext,\n FunnelContextValue,\n FunnelState,\n FunnelStepContext,\n FunnelStepContextValue,\n FunnelSubStepContext,\n FunnelSubStepContextValue,\n} from '../context/analytics-context';\nimport { useFunnel, useFunnelStep } from '../hooks/use-funnel';\nimport { FunnelMetrics } from '../index';\nimport {\n AnalyticsMetadata,\n FunnelStartProps,\n FunnelStepProps,\n StepConfiguration,\n SubStepConfiguration,\n} from '../interfaces';\nimport {\n DATA_ATTR_FUNNEL_STEP,\n getFunnelNameSelector,\n getNameFromSelector,\n getSubStepAllSelector,\n getSubStepNameSelector,\n getSubStepSelector,\n} from '../selectors';\n\nexport const FUNNEL_VERSION = '1.4';\n\ninterface AnalyticsFunnelProps {\n children?: React.ReactNode;\n stepConfiguration?: StepConfiguration[];\n funnelNameSelectors?: string[];\n funnelType: FunnelStartProps['funnelType'];\n optionalStepNumbers: FunnelStartProps['optionalStepNumbers'];\n totalFunnelSteps: FunnelStartProps['totalFunnelSteps'];\n funnelIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n funnelFlowType?: AnalyticsMetadata['flowType'];\n funnelErrorContext?: AnalyticsMetadata['errorContext'];\n funnelResourceType?: AnalyticsMetadata['resourceType'];\n}\n\nexport const AnalyticsFunnel = (props: AnalyticsFunnelProps) => {\n const { isInFunnel } = useFunnel();\n /*\n If the current funnel component is a Form (i.e. single-page funnel), it should\n defer its funnel-handling to a parent Form element, if present.\n Wizards (i.e. multi-page funnels) always take highest precedence for handling funnels,\n and do not defer to any other element.\n */\n if (isInFunnel && props.funnelType === 'single-page') {\n return <>{props.children}</>;\n }\n\n return <InnerAnalyticsFunnel {...props} />;\n};\nexport const CREATION_EDIT_FLOW_DONE_EVENT_NAME = 'awsui-creation-edit-flow-done';\nconst dispatchCreateEditFlowDoneEvent = () => {\n try {\n window.top?.document.dispatchEvent(new Event(CREATION_EDIT_FLOW_DONE_EVENT_NAME));\n } catch {\n // probably because of cross-origin error, then do not dispatch the event\n }\n};\n\nconst onFunnelCancelled = ({\n funnelInteractionId,\n funnelIdentifier,\n}: {\n funnelInteractionId: string;\n funnelIdentifier?: string;\n}) => {\n FunnelMetrics.funnelCancelled({ funnelInteractionId, funnelIdentifier });\n};\n\nconst onFunnelComplete = ({\n funnelInteractionId,\n funnelIdentifier,\n}: {\n funnelInteractionId: string;\n funnelIdentifier?: string;\n}) => {\n FunnelMetrics.funnelComplete({ funnelInteractionId, funnelIdentifier });\n dispatchCreateEditFlowDoneEvent();\n};\n\nfunction evaluateSelectors(selectors: string[], defaultSelector: string) {\n for (const selector of selectors) {\n const element = document.querySelector(selector);\n if (element) {\n return selector;\n }\n }\n\n return defaultSelector;\n}\n\nconst InnerAnalyticsFunnel = ({ children, stepConfiguration, ...props }: AnalyticsFunnelProps) => {\n const [funnelInteractionId, setFunnelInteractionId] = useState<string>('');\n const [submissionAttempt, setSubmissionAttempt] = useState(0);\n const isVisualRefresh = useVisualRefresh();\n const funnelState = useRef<FunnelState>('default');\n const funnelNameSelector = useRef<string>(getFunnelNameSelector());\n const errorCount = useRef<number>(0);\n const loadingButtonCount = useRef<number>(0);\n const wizardCount = useRef<number>(0);\n const latestFocusCleanupFunction = useRef<undefined | (() => void)>(undefined);\n\n // This useEffect hook is run once on component mount to initiate the funnel analytics.\n // It first calls the 'funnelStart' method from FunnelMetrics, providing all necessary details\n // about the funnel, and receives a unique interaction id.\n // This unique interaction id is then stored in the state for further use.\n //\n // On component unmount, it checks whether the funnel was successfully completed.\n // Based on this, it either calls 'funnelComplete' or 'funnelCancelled' method from FunnelMetrics.\n //\n // The eslint-disable is required as we deliberately want this effect to run only once on mount and unmount,\n // hence we do not provide any dependencies.\n useEffect(() => {\n /*\n We run this effect with a delay, in order to detect whether this funnel contains a Wizard.\n If it does contain a Wizard, that Wizard should take precedence for handling the funnel, and\n this current funnel component should do nothing.\n */\n let funnelInteractionId: string;\n const handle = setTimeout(() => {\n funnelNameSelector.current = evaluateSelectors(props.funnelNameSelectors || [], getFunnelNameSelector());\n\n if (props.funnelType === 'single-page' && wizardCount.current > 0) {\n return;\n }\n\n // Reset the state, in case the component was re-mounted.\n funnelState.current = 'default';\n\n const singleStepFlowStepConfiguration = [\n {\n number: 1,\n isOptional: false,\n name: getNameFromSelector(funnelNameSelector.current) ?? '',\n stepIdentifier: props.funnelIdentifier,\n },\n ];\n\n funnelInteractionId = FunnelMetrics.funnelStart({\n funnelIdentifier: props.funnelIdentifier,\n flowType: props.funnelFlowType,\n funnelNameSelector: funnelNameSelector.current,\n optionalStepNumbers: props.optionalStepNumbers,\n funnelType: props.funnelType,\n totalFunnelSteps: props.totalFunnelSteps,\n componentVersion: PACKAGE_VERSION,\n componentTheme: isVisualRefresh ? 'vr' : 'classic',\n funnelVersion: FUNNEL_VERSION,\n stepConfiguration: stepConfiguration ?? singleStepFlowStepConfiguration,\n });\n\n setFunnelInteractionId(funnelInteractionId);\n }, 1);\n\n /*\n A funnel counts as \"successful\" if it is unmounted after being \"complete\".\n */\n /* eslint-disable react-hooks/exhaustive-deps */\n return () => {\n clearTimeout(handle);\n if (props.funnelType === 'single-page' && wizardCount.current > 0) {\n return;\n }\n\n if (funnelState.current === 'validating') {\n // Finish the validation phase early.\n onFunnelComplete({ funnelInteractionId, funnelIdentifier: props.funnelIdentifier });\n funnelState.current = 'complete';\n }\n\n if (funnelState.current === 'complete') {\n FunnelMetrics.funnelSuccessful({ funnelInteractionId, funnelIdentifier: props.funnelIdentifier });\n } else {\n onFunnelCancelled({ funnelInteractionId, funnelIdentifier: props.funnelIdentifier });\n funnelState.current = 'cancelled';\n }\n };\n }, []);\n /* eslint-enable react-hooks/exhaustive-deps */\n\n const funnelSubmit = () => {\n funnelState.current = 'validating';\n\n /*\n When the user attempts to submit the form, we wait for 50 milliseconds before checking\n if any form validation errors are present. This value was chosen to give enough time\n for validation and rerendering to occur, but be low enough that the user will not\n be able to take further action in the meantime.\n */\n const VALIDATION_WAIT_DELAY = 50;\n /*\n Loading is expected to take longer than validation, so we can keep the pressure on the CPU low.\n */\n const LOADING_WAIT_DELAY = 100;\n\n const checkForCompleteness = () => {\n if (funnelState.current === 'complete') {\n return;\n }\n\n if (loadingButtonCount.current > 0) {\n setTimeout(checkForCompleteness, LOADING_WAIT_DELAY);\n return;\n }\n\n if (errorCount.current === 0) {\n /*\n If no validation errors are rendered, we treat the funnel as complete.\n */\n onFunnelComplete({ funnelInteractionId });\n funnelState.current = 'complete';\n } else {\n funnelState.current = 'default';\n }\n };\n\n setTimeout(checkForCompleteness, VALIDATION_WAIT_DELAY);\n };\n\n const funnelNextOrSubmitAttempt = () => setSubmissionAttempt(i => i + 1);\n\n const funnelCancel = () => {};\n\n const funnelContextValue: FunnelContextValue = {\n funnelInteractionId,\n funnelIdentifier: props.funnelIdentifier,\n funnelFlowType: props.funnelFlowType,\n funnelErrorContext: props.funnelErrorContext,\n setFunnelInteractionId,\n funnelType: props.funnelType,\n optionalStepNumbers: props.optionalStepNumbers,\n totalFunnelSteps: props.totalFunnelSteps,\n funnelNameSelector: funnelNameSelector.current,\n funnelSubmit,\n funnelCancel,\n submissionAttempt,\n funnelNextOrSubmitAttempt,\n funnelState,\n errorCount,\n loadingButtonCount,\n latestFocusCleanupFunction,\n isInFunnel: true,\n wizardCount,\n };\n\n return <FunnelContext.Provider value={funnelContextValue}>{children}</FunnelContext.Provider>;\n};\n\ninterface AnalyticsFunnelStepProps {\n stepIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n stepErrorContext?: AnalyticsMetadata['errorContext'];\n children?: React.ReactNode | ((props: FunnelStepContextValue) => React.ReactNode);\n stepNameSelector?: FunnelStepProps['stepNameSelector'];\n stepNumber: FunnelStepProps['stepNumber'];\n}\n\nexport const AnalyticsFunnelStep = (props: AnalyticsFunnelStepProps) => {\n /*\n This wrapper is used to apply a `key` property to the actual (inner) AnalyticsFunnelStep\n element. This allows us to keep the state and effects separate per step.\n */\n return <InnerAnalyticsFunnelStep {...props} key={props.stepNumber} />;\n};\n\nfunction getSubStepConfiguration(): SubStepConfiguration[] {\n const subSteps = Array.from(document.querySelectorAll<HTMLElement>(getSubStepAllSelector()));\n\n const subStepConfiguration = subSteps.map((substep, index) => {\n const subStepIdentifier = (substep as any)?.__awsuiMetadata__?.analytics?.instanceIdentifier;\n\n const name = substep.querySelector<HTMLElement>(getSubStepNameSelector())?.innerText?.trim() ?? '';\n\n return {\n name,\n number: index + 1,\n subStepIdentifier,\n };\n });\n return subStepConfiguration;\n}\n\nfunction useStepChangeListener(stepNumber: number, handler: (stepConfiguration: SubStepConfiguration[]) => void) {\n const subStepConfiguration = useRef(new Map<number, SubStepConfiguration[] | undefined>());\n /*\n Chosen so that it's hopefully shorter than a user interaction, but gives enough time for the\n amount of containers to stabilise.\n */\n const SUBSTEP_CHANGE_DEBOUNCE = 50;\n\n const listenForSubStepChanges = useRef(false);\n useEffect(() => {\n // We prevent emitting the event on the first render.\n const handle = setTimeout(() => (listenForSubStepChanges.current = true), SUBSTEP_CHANGE_DEBOUNCE);\n\n return () => {\n clearTimeout(handle);\n listenForSubStepChanges.current = false;\n };\n }, []);\n\n useEffect(() => {\n const handle = setTimeout(\n () => subStepConfiguration.current.set(stepNumber, getSubStepConfiguration()),\n SUBSTEP_CHANGE_DEBOUNCE\n );\n return () => {\n clearTimeout(handle);\n };\n }, [stepNumber]);\n\n /* We debounce this handler, so that multiple containers can change at once without causing \n too many events. */\n const stepChangeCallback = useDebounceCallback(() => {\n // We don't want to emit the event after the component has been unmounted.\n if (!listenForSubStepChanges.current) {\n return;\n }\n\n subStepConfiguration.current.set(stepNumber, getSubStepConfiguration());\n handler(subStepConfiguration.current.get(stepNumber)!);\n }, SUBSTEP_CHANGE_DEBOUNCE);\n\n return { onStepChange: stepChangeCallback, subStepConfiguration };\n}\n\nconst InnerAnalyticsFunnelStep = ({\n children,\n stepNumber,\n stepIdentifier,\n stepErrorContext,\n ...rest\n}: AnalyticsFunnelStepProps) => {\n const { funnelInteractionId, funnelIdentifier, funnelNameSelector, funnelState, funnelType } = useFunnel();\n const parentStep = useFunnelStep();\n const parentStepExists = parentStep.isInStep;\n const parentStepFunnelInteractionId = parentStep.funnelInteractionId;\n\n const funnelStepProps = { [DATA_ATTR_FUNNEL_STEP]: stepNumber };\n\n const subStepCount = useRef<number>(0);\n\n const stepNameSelector = rest.stepNameSelector || funnelNameSelector;\n const { onStepChange, subStepConfiguration } = useStepChangeListener(stepNumber, subStepConfiguration => {\n if (!funnelInteractionId) {\n return;\n }\n\n FunnelMetrics.funnelStepChange({\n stepIdentifier,\n funnelIdentifier,\n funnelInteractionId,\n stepNumber,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n totalSubSteps: subStepCount.current,\n subStepConfiguration,\n });\n });\n\n // This useEffect hook is used to track the start and completion of interaction with the step.\n // On mount, if there is a valid funnel interaction id, it calls the 'funnelStepStart' method from FunnelMetrics\n // to record the beginning of the interaction with the current step.\n // On unmount, it does a similar thing but this time calling 'funnelStepComplete' to record the completion of the interaction.\n useEffect(() => {\n if (!funnelInteractionId) {\n // This step is not inside an active funnel.\n return;\n }\n if (parentStepExists && parentStepFunnelInteractionId) {\n /*\n This step is inside another step, which already reports events as\n part of an active funnel (i.e. that step is not a parent of a Wizard).\n Thus, this current step does not need to report any events.\n */\n return;\n }\n\n const stepName = getNameFromSelector(stepNameSelector);\n\n if (funnelState.current === 'default') {\n FunnelMetrics.funnelStepStart({\n stepIdentifier,\n funnelIdentifier,\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n totalSubSteps: subStepCount.current,\n subStepConfiguration: getSubStepConfiguration(),\n });\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n if (funnelState.current !== 'cancelled') {\n FunnelMetrics.funnelStepComplete({\n funnelIdentifier,\n funnelInteractionId,\n stepIdentifier,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n totalSubSteps: subStepCount.current,\n });\n }\n };\n }, [\n stepIdentifier,\n funnelIdentifier,\n funnelInteractionId,\n stepNumber,\n stepNameSelector,\n funnelState,\n parentStepExists,\n funnelType,\n parentStepFunnelInteractionId,\n ]);\n\n const contextValue: FunnelStepContextValue = {\n stepIdentifier,\n stepNumber,\n stepNameSelector,\n funnelStepProps,\n subStepCount,\n isInStep: true,\n funnelInteractionId,\n onStepChange,\n subStepConfiguration,\n stepErrorContext,\n };\n\n /*\n If this step is inside another step which already reports events as part of an active\n funnel (i.e. that step is not a parent of a Wizard), the current step becomes invisible\n in the hierarchy by passing the context of its parent through.\n */\n const effectiveContextValue = parentStepExists && parentStepFunnelInteractionId ? parentStep : contextValue;\n\n return (\n <FunnelStepContext.Provider value={effectiveContextValue}>\n {typeof children === 'function' ? children(effectiveContextValue) : children}\n </FunnelStepContext.Provider>\n );\n};\ninterface AnalyticsFunnelSubStepProps {\n subStepIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n subStepErrorContext?: AnalyticsMetadata['errorContext'];\n children?: React.ReactNode | ((props: FunnelSubStepContextValue) => React.ReactNode);\n}\n\nexport const AnalyticsFunnelSubStep = ({\n children,\n subStepIdentifier,\n subStepErrorContext,\n}: AnalyticsFunnelSubStepProps) => {\n const subStepId = useUniqueId('substep');\n const subStepSelector = getSubStepSelector(subStepId);\n const subStepNameSelector = getSubStepNameSelector(subStepId);\n const subStepRef = useRef<HTMLDivElement | null>(null);\n const { subStepCount, onStepChange } = useFunnelStep();\n const mousePressed = useRef<boolean>(false);\n const isFocusedSubStep = useRef<boolean>(false);\n const focusCleanupFunction = useRef<undefined | (() => void)>(undefined);\n const { funnelState, funnelInteractionId } = useFunnel();\n const { stepNumber, stepNameSelector } = useFunnelStep();\n\n const newContext: FunnelSubStepContextValue = {\n subStepIdentifier,\n subStepErrorContext,\n subStepSelector,\n subStepNameSelector,\n subStepId,\n subStepRef,\n mousePressed,\n isFocusedSubStep,\n focusCleanupFunction,\n isNestedSubStep: false,\n };\n\n const inheritedContext = { ...useContext(FunnelSubStepContext), isNestedSubStep: true };\n\n const isNested = Boolean(inheritedContext.subStepId);\n\n useEffect(() => {\n if (!isNested) {\n subStepCount.current++;\n onStepChange();\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n subStepCount.current--;\n onStepChange();\n };\n }\n }, [isNested, subStepCount, onStepChange]);\n\n const context = isNested ? inheritedContext : newContext;\n\n useEffect(() => {\n if (isNested || !subStepRef.current) {\n return;\n }\n\n const onMouseDown = () => (mousePressed.current = true);\n\n const onMouseUp = async () => {\n mousePressed.current = false;\n\n if (!isFocusedSubStep.current) {\n return;\n }\n\n /*\n Some mouse events result in an element being focused. However,\n this happens only _after_ the onMouseUp event. We yield the\n event loop here, so that `document.activeElement` has the\n correct new value. \n */\n await new Promise(r => setTimeout(r, 1));\n\n if (!subStepRef.current || !document.activeElement || !nodeBelongs(subStepRef.current, document.activeElement)) {\n isFocusedSubStep.current = false;\n\n /*\n Run this substep's own focus cleanup function if another substep\n hasn't already done it for us.\n */\n focusCleanupFunction.current?.();\n }\n };\n window.addEventListener('mousedown', onMouseDown);\n window.addEventListener('mouseup', onMouseUp);\n return () => {\n window.removeEventListener('mousedown', onMouseDown);\n window.removeEventListener('mouseup', onMouseUp);\n };\n }, [\n funnelInteractionId,\n funnelState,\n stepNameSelector,\n stepNumber,\n subStepNameSelector,\n subStepSelector,\n focusCleanupFunction,\n isNested,\n subStepRef,\n ]);\n\n return (\n <FunnelSubStepContext.Provider value={context}>\n {typeof children === 'function' ? children(context) : children}\n </FunnelSubStepContext.Provider>\n );\n};\n"]}
1
+ {"version":3,"file":"analytics-funnel.js","sourceRoot":"","sources":["../../../../../src/internal/analytics/components/analytics-funnel.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EACL,aAAa,EAGb,iBAAiB,EAEjB,oBAAoB,GAErB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAS7D,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AAepC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC7D,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,CAAC;IACnC;;;;;MAKE;IACF,IAAI,UAAU,IAAI,KAAK,CAAC,UAAU,KAAK,aAAa,EAAE;QACpD,OAAO,0CAAG,KAAK,CAAC,QAAQ,CAAI,CAAC;KAC9B;IAED,OAAO,oBAAC,oBAAoB,oBAAK,KAAK,EAAI,CAAC;AAC7C,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,kCAAkC,GAAG,+BAA+B,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AU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAEzC,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,EAAE;gBAC9G,gBAAgB,CAAC,OAAO,GAAG,KAAK,CAAC;gBAEjC;;;mBAGG;gBACH,MAAA,oBAAoB,CAAC,OAAO,oEAAI,CAAC;aAClC;QACH,CAAC,CAAA,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAClD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACrD,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC,EAAE;QACD,mBAAmB;QACnB,WAAW;QACX,gBAAgB;QAChB,UAAU;QACV,mBAAmB;QACnB,eAAe;QACf,oBAAoB;QACpB,QAAQ;QACR,UAAU;KACX,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAC1C,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAChC,CACjC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useEffect, useRef, useState } from 'react';\n\nimport { PACKAGE_VERSION } from '../../environment';\nimport { useDebounceCallback } from '../../hooks/use-debounce-callback';\nimport { useUniqueId } from '../../hooks/use-unique-id';\nimport { useVisualRefresh } from '../../hooks/use-visual-mode';\nimport { nodeBelongs } from '../../utils/node-belongs';\nimport {\n FunnelContext,\n FunnelContextValue,\n FunnelState,\n FunnelStepContext,\n FunnelStepContextValue,\n FunnelSubStepContext,\n FunnelSubStepContextValue,\n} from '../context/analytics-context';\nimport { useFunnel, useFunnelStep } from '../hooks/use-funnel';\nimport { FunnelMetrics, PerformanceMetrics } from '../index';\nimport {\n AnalyticsMetadata,\n FunnelStartProps,\n FunnelStepProps,\n StepConfiguration,\n SubStepConfiguration,\n TaskCompletionDataProps,\n} from '../interfaces';\nimport {\n DATA_ATTR_FUNNEL_STEP,\n getFunnelNameSelector,\n getNameFromSelector,\n getSubStepAllSelector,\n getSubStepNameSelector,\n getSubStepSelector,\n} from '../selectors';\n\nexport const FUNNEL_VERSION = '1.4';\n\ninterface AnalyticsFunnelProps {\n children?: React.ReactNode;\n stepConfiguration?: StepConfiguration[];\n funnelNameSelectors?: string[];\n funnelType: FunnelStartProps['funnelType'];\n optionalStepNumbers: FunnelStartProps['optionalStepNumbers'];\n totalFunnelSteps: FunnelStartProps['totalFunnelSteps'];\n funnelIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n funnelFlowType?: AnalyticsMetadata['flowType'];\n funnelErrorContext?: AnalyticsMetadata['errorContext'];\n funnelResourceType?: AnalyticsMetadata['resourceType'];\n}\n\nexport const AnalyticsFunnel = (props: AnalyticsFunnelProps) => {\n const { isInFunnel } = useFunnel();\n /*\n If the current funnel component is a Form (i.e. single-page funnel), it should\n defer its funnel-handling to a parent Form element, if present.\n Wizards (i.e. multi-page funnels) always take highest precedence for handling funnels,\n and do not defer to any other element.\n */\n if (isInFunnel && props.funnelType === 'single-page') {\n return <>{props.children}</>;\n }\n\n return <InnerAnalyticsFunnel {...props} />;\n};\nexport const CREATION_EDIT_FLOW_DONE_EVENT_NAME = 'awsui-creation-edit-flow-done';\nconst dispatchCreateEditFlowDoneEvent = () => {\n try {\n window.top?.document.dispatchEvent(new Event(CREATION_EDIT_FLOW_DONE_EVENT_NAME));\n } catch {\n // probably because of cross-origin error, then do not dispatch the event\n }\n};\n\nconst onFunnelCancelled = ({\n funnelInteractionId,\n funnelIdentifier,\n}: {\n funnelInteractionId: string;\n funnelIdentifier?: string;\n}) => {\n FunnelMetrics.funnelCancelled({ funnelInteractionId, funnelIdentifier });\n};\n\nconst onFunnelComplete = (taskCompletionDataProps: TaskCompletionDataProps) => {\n FunnelMetrics.funnelComplete({\n funnelInteractionId: taskCompletionDataProps.taskInteractionId,\n funnelIdentifier: taskCompletionDataProps.taskIdentifier,\n });\n PerformanceMetrics.taskCompletionData(taskCompletionDataProps);\n dispatchCreateEditFlowDoneEvent();\n};\n\nfunction evaluateSelectors(selectors: string[], defaultSelector: string) {\n for (const selector of selectors) {\n const element = document.querySelector(selector);\n if (element) {\n return selector;\n }\n }\n\n return defaultSelector;\n}\n\nconst InnerAnalyticsFunnel = ({ children, stepConfiguration, ...props }: AnalyticsFunnelProps) => {\n const [funnelInteractionId, setFunnelInteractionId] = useState<string>('');\n const [submissionAttempt, setSubmissionAttempt] = useState(0);\n const isVisualRefresh = useVisualRefresh();\n const funnelState = useRef<FunnelState>('default');\n const funnelNameSelector = useRef<string>(getFunnelNameSelector());\n const errorCount = useRef<number>(0);\n const loadingButtonCount = useRef<number>(0);\n const wizardCount = useRef<number>(0);\n const latestFocusCleanupFunction = useRef<undefined | (() => void)>(undefined);\n const formSubmitStartTime = useRef<number>(0);\n // This useEffect hook is run once on component mount to initiate the funnel analytics.\n // It first calls the 'funnelStart' method from FunnelMetrics, providing all necessary details\n // about the funnel, and receives a unique interaction id.\n // This unique interaction id is then stored in the state for further use.\n //\n // On component unmount, it checks whether the funnel was successfully completed.\n // Based on this, it either calls 'funnelComplete' or 'funnelCancelled' method from FunnelMetrics.\n //\n // The eslint-disable is required as we deliberately want this effect to run only once on mount and unmount,\n // hence we do not provide any dependencies.\n useEffect(() => {\n /*\n We run this effect with a delay, in order to detect whether this funnel contains a Wizard.\n If it does contain a Wizard, that Wizard should take precedence for handling the funnel, and\n this current funnel component should do nothing.\n */\n let funnelInteractionId: string;\n const handle = setTimeout(() => {\n funnelNameSelector.current = evaluateSelectors(props.funnelNameSelectors || [], getFunnelNameSelector());\n if (props.funnelType === 'single-page' && wizardCount.current > 0) {\n return;\n }\n\n // Reset the state, in case the component was re-mounted.\n funnelState.current = 'default';\n\n const singleStepFlowStepConfiguration = [\n {\n number: 1,\n isOptional: false,\n name: getNameFromSelector(funnelNameSelector.current) ?? '',\n stepIdentifier: props.funnelIdentifier,\n },\n ];\n\n funnelInteractionId = FunnelMetrics.funnelStart({\n funnelIdentifier: props.funnelIdentifier,\n flowType: props.funnelFlowType,\n funnelNameSelector: funnelNameSelector.current,\n optionalStepNumbers: props.optionalStepNumbers,\n funnelType: props.funnelType,\n totalFunnelSteps: props.totalFunnelSteps,\n componentVersion: PACKAGE_VERSION,\n componentTheme: isVisualRefresh ? 'vr' : 'classic',\n funnelVersion: FUNNEL_VERSION,\n stepConfiguration: stepConfiguration ?? singleStepFlowStepConfiguration,\n });\n\n setFunnelInteractionId(funnelInteractionId);\n }, 1);\n\n /*\n A funnel counts as \"successful\" if it is unmounted after being \"complete\".\n */\n /* eslint-disable react-hooks/exhaustive-deps */\n return () => {\n clearTimeout(handle);\n if (props.funnelType === 'single-page' && wizardCount.current > 0) {\n return;\n }\n if (funnelState.current === 'validating') {\n // Finish the validation phase early.\n const taskCompletionDataProps: TaskCompletionDataProps = {\n taskIdentifier: props.funnelIdentifier,\n taskType: props.funnelType,\n timeToRespondAfterFormSubmit: performance.now() - formSubmitStartTime.current,\n taskInteractionId: funnelInteractionId,\n taskFlowType: props.funnelFlowType,\n };\n onFunnelComplete(taskCompletionDataProps);\n funnelState.current = 'complete';\n }\n\n if (funnelState.current === 'complete') {\n FunnelMetrics.funnelSuccessful({ funnelInteractionId, funnelIdentifier: props.funnelIdentifier });\n } else {\n onFunnelCancelled({ funnelInteractionId, funnelIdentifier: props.funnelIdentifier });\n funnelState.current = 'cancelled';\n }\n };\n }, []);\n /* eslint-enable react-hooks/exhaustive-deps */\n\n const funnelSubmit = () => {\n funnelState.current = 'validating';\n formSubmitStartTime.current = performance.now();\n /*\n When the user attempts to submit the form, we wait for 50 milliseconds before checking\n if any form validation errors are present. This value was chosen to give enough time\n for validation and rerendering to occur, but be low enough that the user will not\n be able to take further action in the meantime.\n */\n const VALIDATION_WAIT_DELAY = 50;\n /*\n Loading is expected to take longer than validation, so we can keep the pressure on the CPU low.\n */\n const LOADING_WAIT_DELAY = 100;\n\n const checkForCompleteness = () => {\n if (funnelState.current === 'complete') {\n return;\n }\n\n if (loadingButtonCount.current > 0) {\n setTimeout(checkForCompleteness, LOADING_WAIT_DELAY);\n return;\n }\n\n if (errorCount.current === 0) {\n /*\n If no validation errors are rendered, we treat the funnel as complete.\n */\n const taskCompletionDataProps: TaskCompletionDataProps = {\n taskIdentifier: props.funnelIdentifier,\n taskType: props.funnelType,\n timeToRespondAfterFormSubmit: performance.now() - formSubmitStartTime.current,\n taskInteractionId: funnelInteractionId,\n taskFlowType: props.funnelFlowType,\n };\n onFunnelComplete(taskCompletionDataProps);\n funnelState.current = 'complete';\n } else {\n funnelState.current = 'default';\n }\n };\n setTimeout(checkForCompleteness, VALIDATION_WAIT_DELAY);\n };\n\n const funnelNextOrSubmitAttempt = () => setSubmissionAttempt(i => i + 1);\n\n const funnelCancel = () => {};\n\n const funnelContextValue: FunnelContextValue = {\n funnelInteractionId,\n funnelIdentifier: props.funnelIdentifier,\n funnelFlowType: props.funnelFlowType,\n funnelErrorContext: props.funnelErrorContext,\n setFunnelInteractionId,\n funnelType: props.funnelType,\n optionalStepNumbers: props.optionalStepNumbers,\n totalFunnelSteps: props.totalFunnelSteps,\n funnelNameSelector: funnelNameSelector.current,\n funnelSubmit,\n funnelCancel,\n submissionAttempt,\n funnelNextOrSubmitAttempt,\n funnelState,\n errorCount,\n loadingButtonCount,\n latestFocusCleanupFunction,\n isInFunnel: true,\n wizardCount,\n };\n\n return <FunnelContext.Provider value={funnelContextValue}>{children}</FunnelContext.Provider>;\n};\n\ninterface AnalyticsFunnelStepProps {\n stepIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n stepErrorContext?: AnalyticsMetadata['errorContext'];\n children?: React.ReactNode | ((props: FunnelStepContextValue) => React.ReactNode);\n stepNameSelector?: FunnelStepProps['stepNameSelector'];\n stepNumber: FunnelStepProps['stepNumber'];\n}\n\nexport const AnalyticsFunnelStep = (props: AnalyticsFunnelStepProps) => {\n /*\n This wrapper is used to apply a `key` property to the actual (inner) AnalyticsFunnelStep\n element. This allows us to keep the state and effects separate per step.\n */\n return <InnerAnalyticsFunnelStep {...props} key={props.stepNumber} />;\n};\n\nfunction getSubStepConfiguration(): SubStepConfiguration[] {\n const subSteps = Array.from(document.querySelectorAll<HTMLElement>(getSubStepAllSelector()));\n\n const subStepConfiguration = subSteps.map((substep, index) => {\n const subStepIdentifier = (substep as any)?.__awsuiMetadata__?.analytics?.instanceIdentifier;\n\n const name = substep.querySelector<HTMLElement>(getSubStepNameSelector())?.innerText?.trim() ?? '';\n\n return {\n name,\n number: index + 1,\n subStepIdentifier,\n };\n });\n return subStepConfiguration;\n}\n\nfunction useStepChangeListener(stepNumber: number, handler: (stepConfiguration: SubStepConfiguration[]) => void) {\n const subStepConfiguration = useRef(new Map<number, SubStepConfiguration[] | undefined>());\n /*\n Chosen so that it's hopefully shorter than a user interaction, but gives enough time for the\n amount of containers to stabilise.\n */\n const SUBSTEP_CHANGE_DEBOUNCE = 50;\n\n const listenForSubStepChanges = useRef(false);\n useEffect(() => {\n // We prevent emitting the event on the first render.\n const handle = setTimeout(() => (listenForSubStepChanges.current = true), SUBSTEP_CHANGE_DEBOUNCE);\n\n return () => {\n clearTimeout(handle);\n listenForSubStepChanges.current = false;\n };\n }, []);\n\n useEffect(() => {\n const handle = setTimeout(\n () => subStepConfiguration.current.set(stepNumber, getSubStepConfiguration()),\n SUBSTEP_CHANGE_DEBOUNCE\n );\n return () => {\n clearTimeout(handle);\n };\n }, [stepNumber]);\n\n /* We debounce this handler, so that multiple containers can change at once without causing \n too many events. */\n const stepChangeCallback = useDebounceCallback(() => {\n // We don't want to emit the event after the component has been unmounted.\n if (!listenForSubStepChanges.current) {\n return;\n }\n\n subStepConfiguration.current.set(stepNumber, getSubStepConfiguration());\n handler(subStepConfiguration.current.get(stepNumber)!);\n }, SUBSTEP_CHANGE_DEBOUNCE);\n\n return { onStepChange: stepChangeCallback, subStepConfiguration };\n}\n\nconst InnerAnalyticsFunnelStep = ({\n children,\n stepNumber,\n stepIdentifier,\n stepErrorContext,\n ...rest\n}: AnalyticsFunnelStepProps) => {\n const { funnelInteractionId, funnelIdentifier, funnelNameSelector, funnelState, funnelType } = useFunnel();\n const parentStep = useFunnelStep();\n const parentStepExists = parentStep.isInStep;\n const parentStepFunnelInteractionId = parentStep.funnelInteractionId;\n\n const funnelStepProps = { [DATA_ATTR_FUNNEL_STEP]: stepNumber };\n\n const subStepCount = useRef<number>(0);\n\n const stepNameSelector = rest.stepNameSelector || funnelNameSelector;\n const { onStepChange, subStepConfiguration } = useStepChangeListener(stepNumber, subStepConfiguration => {\n if (!funnelInteractionId) {\n return;\n }\n\n FunnelMetrics.funnelStepChange({\n stepIdentifier,\n funnelIdentifier,\n funnelInteractionId,\n stepNumber,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n totalSubSteps: subStepCount.current,\n subStepConfiguration,\n });\n });\n\n // This useEffect hook is used to track the start and completion of interaction with the step.\n // On mount, if there is a valid funnel interaction id, it calls the 'funnelStepStart' method from FunnelMetrics\n // to record the beginning of the interaction with the current step.\n // On unmount, it does a similar thing but this time calling 'funnelStepComplete' to record the completion of the interaction.\n useEffect(() => {\n if (!funnelInteractionId) {\n // This step is not inside an active funnel.\n return;\n }\n if (parentStepExists && parentStepFunnelInteractionId) {\n /*\n This step is inside another step, which already reports events as\n part of an active funnel (i.e. that step is not a parent of a Wizard).\n Thus, this current step does not need to report any events.\n */\n return;\n }\n\n const stepName = getNameFromSelector(stepNameSelector);\n\n if (funnelState.current === 'default') {\n FunnelMetrics.funnelStepStart({\n stepIdentifier,\n funnelIdentifier,\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n totalSubSteps: subStepCount.current,\n subStepConfiguration: getSubStepConfiguration(),\n });\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n if (funnelState.current !== 'cancelled') {\n FunnelMetrics.funnelStepComplete({\n funnelIdentifier,\n funnelInteractionId,\n stepIdentifier,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepAllSelector: getSubStepAllSelector(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n totalSubSteps: subStepCount.current,\n });\n }\n };\n }, [\n stepIdentifier,\n funnelIdentifier,\n funnelInteractionId,\n stepNumber,\n stepNameSelector,\n funnelState,\n parentStepExists,\n funnelType,\n parentStepFunnelInteractionId,\n ]);\n\n const contextValue: FunnelStepContextValue = {\n stepIdentifier,\n stepNumber,\n stepNameSelector,\n funnelStepProps,\n subStepCount,\n isInStep: true,\n funnelInteractionId,\n onStepChange,\n subStepConfiguration,\n stepErrorContext,\n };\n\n /*\n If this step is inside another step which already reports events as part of an active\n funnel (i.e. that step is not a parent of a Wizard), the current step becomes invisible\n in the hierarchy by passing the context of its parent through.\n */\n const effectiveContextValue = parentStepExists && parentStepFunnelInteractionId ? parentStep : contextValue;\n\n return (\n <FunnelStepContext.Provider value={effectiveContextValue}>\n {typeof children === 'function' ? children(effectiveContextValue) : children}\n </FunnelStepContext.Provider>\n );\n};\ninterface AnalyticsFunnelSubStepProps {\n subStepIdentifier?: AnalyticsMetadata['instanceIdentifier'];\n subStepErrorContext?: AnalyticsMetadata['errorContext'];\n children?: React.ReactNode | ((props: FunnelSubStepContextValue) => React.ReactNode);\n}\n\nexport const AnalyticsFunnelSubStep = ({\n children,\n subStepIdentifier,\n subStepErrorContext,\n}: AnalyticsFunnelSubStepProps) => {\n const subStepId = useUniqueId('substep');\n const subStepSelector = getSubStepSelector(subStepId);\n const subStepNameSelector = getSubStepNameSelector(subStepId);\n const subStepRef = useRef<HTMLDivElement | null>(null);\n const { subStepCount, onStepChange } = useFunnelStep();\n const mousePressed = useRef<boolean>(false);\n const isFocusedSubStep = useRef<boolean>(false);\n const focusCleanupFunction = useRef<undefined | (() => void)>(undefined);\n const { funnelState, funnelInteractionId } = useFunnel();\n const { stepNumber, stepNameSelector } = useFunnelStep();\n\n const newContext: FunnelSubStepContextValue = {\n subStepIdentifier,\n subStepErrorContext,\n subStepSelector,\n subStepNameSelector,\n subStepId,\n subStepRef,\n mousePressed,\n isFocusedSubStep,\n focusCleanupFunction,\n isNestedSubStep: false,\n };\n\n const inheritedContext = { ...useContext(FunnelSubStepContext), isNestedSubStep: true };\n\n const isNested = Boolean(inheritedContext.subStepId);\n\n useEffect(() => {\n if (!isNested) {\n subStepCount.current++;\n onStepChange();\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n subStepCount.current--;\n onStepChange();\n };\n }\n }, [isNested, subStepCount, onStepChange]);\n\n const context = isNested ? inheritedContext : newContext;\n\n useEffect(() => {\n if (isNested || !subStepRef.current) {\n return;\n }\n\n const onMouseDown = () => (mousePressed.current = true);\n\n const onMouseUp = async () => {\n mousePressed.current = false;\n\n if (!isFocusedSubStep.current) {\n return;\n }\n\n /*\n Some mouse events result in an element being focused. However,\n this happens only _after_ the onMouseUp event. We yield the\n event loop here, so that `document.activeElement` has the\n correct new value. \n */\n await new Promise(r => setTimeout(r, 1));\n\n if (!subStepRef.current || !document.activeElement || !nodeBelongs(subStepRef.current, document.activeElement)) {\n isFocusedSubStep.current = false;\n\n /*\n Run this substep's own focus cleanup function if another substep\n hasn't already done it for us.\n */\n focusCleanupFunction.current?.();\n }\n };\n window.addEventListener('mousedown', onMouseDown);\n window.addEventListener('mouseup', onMouseUp);\n return () => {\n window.removeEventListener('mousedown', onMouseDown);\n window.removeEventListener('mouseup', onMouseUp);\n };\n }, [\n funnelInteractionId,\n funnelState,\n stepNameSelector,\n stepNumber,\n subStepNameSelector,\n subStepSelector,\n focusCleanupFunction,\n isNested,\n subStepRef,\n ]);\n\n return (\n <FunnelSubStepContext.Provider value={context}>\n {typeof children === 'function' ? children(context) : children}\n </FunnelSubStepContext.Provider>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/internal/analytics/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEtF,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,cAAc,QAE7D;AACD,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,mBAAmB,QAE5E;AACD,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,iBAAiB,QAEtE;AAED;;;GAGG;AACH,eAAO,IAAI,aAAa,EAAE,cAoBzB,CAAC;AAEF;;;GAGG;AACH,eAAO,IAAI,kBAAkB,EAAE,mBAE9B,CAAC;AAEF,eAAO,IAAI,gBAAgB,EAAE,iBAI5B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/internal/analytics/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEtF,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,cAAc,QAE7D;AACD,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,mBAAmB,QAE5E;AACD,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,iBAAiB,QAEtE;AAED;;;GAGG;AACH,eAAO,IAAI,aAAa,EAAE,cAoBzB,CAAC;AAEF;;;GAGG;AACH,eAAO,IAAI,kBAAkB,EAAE,mBAG9B,CAAC;AAEF,eAAO,IAAI,gBAAgB,EAAE,iBAI5B,CAAC"}
@@ -40,6 +40,7 @@ export let FunnelMetrics = {
40
40
  */
41
41
  export let PerformanceMetrics = {
42
42
  tableInteraction() { },
43
+ taskCompletionData() { },
43
44
  };
44
45
  export let ComponentMetrics = {
45
46
  componentMounted() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/analytics/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,0BAA0B;AAI1B,MAAM,UAAU,gBAAgB,CAAC,aAA6B;IAC5D,aAAa,GAAG,aAAa,CAAC;AAChC,CAAC;AACD,MAAM,UAAU,qBAAqB,CAAC,kBAAuC;IAC3E,kBAAkB,GAAG,kBAAkB,CAAC;AAC1C,CAAC;AACD,MAAM,UAAU,mBAAmB,CAAC,gBAAmC;IACrE,gBAAgB,GAAG,gBAAgB,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAI,aAAa,GAAmB;IACzC,WAAW;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,WAAW,KAAU,CAAC;IACtB,cAAc,KAAU,CAAC;IACzB,gBAAgB,KAAU,CAAC;IAC3B,eAAe,KAAU,CAAC;IAC1B,YAAY,KAAU,CAAC;IACvB,eAAe,KAAU,CAAC;IAC1B,kBAAkB,KAAU,CAAC;IAC7B,oBAAoB,KAAU,CAAC;IAC/B,eAAe,KAAU,CAAC;IAC1B,gBAAgB,KAAU,CAAC;IAC3B,kBAAkB,KAAU,CAAC;IAC7B,qBAAqB,KAAU,CAAC;IAChC,kBAAkB,KAAU,CAAC;IAC7B,mBAAmB,KAAU,CAAC;IAC9B,sBAAsB,KAAU,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,IAAI,kBAAkB,GAAwB;IACnD,gBAAgB,KAAU,CAAC;CAC5B,CAAC;AAEF,MAAM,CAAC,IAAI,gBAAgB,GAAsB;IAC/C,gBAAgB;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/* istanbul ignore file */\n\nimport { IComponentMetrics, IFunnelMetrics, IPerformanceMetrics } from './interfaces';\n\nexport function setFunnelMetrics(funnelMetrics: IFunnelMetrics) {\n FunnelMetrics = funnelMetrics;\n}\nexport function setPerformanceMetrics(performanceMetrics: IPerformanceMetrics) {\n PerformanceMetrics = performanceMetrics;\n}\nexport function setComponentMetrics(componentMetrics: IComponentMetrics) {\n ComponentMetrics = componentMetrics;\n}\n\n/**\n * This is a stub implementation of the FunnelMetrics interface and will be replaced during\n * build time with the actual implementation.\n */\nexport let FunnelMetrics: IFunnelMetrics = {\n funnelStart(): string {\n return '';\n },\n\n funnelError(): void {},\n funnelComplete(): void {},\n funnelSuccessful(): void {},\n funnelCancelled(): void {},\n funnelChange(): void {},\n funnelStepStart(): void {},\n funnelStepComplete(): void {},\n funnelStepNavigation(): void {},\n funnelStepError(): void {},\n funnelStepChange(): void {},\n funnelSubStepStart(): void {},\n funnelSubStepComplete(): void {},\n funnelSubStepError(): void {},\n helpPanelInteracted(): void {},\n externalLinkInteracted(): void {},\n};\n\n/**\n * This is a stub implementation of the PerformanceMetrics interface and will be replaced during\n * build time with the actual implementation.\n */\nexport let PerformanceMetrics: IPerformanceMetrics = {\n tableInteraction(): void {},\n};\n\nexport let ComponentMetrics: IComponentMetrics = {\n componentMounted(): string {\n return '';\n },\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/analytics/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,0BAA0B;AAI1B,MAAM,UAAU,gBAAgB,CAAC,aAA6B;IAC5D,aAAa,GAAG,aAAa,CAAC;AAChC,CAAC;AACD,MAAM,UAAU,qBAAqB,CAAC,kBAAuC;IAC3E,kBAAkB,GAAG,kBAAkB,CAAC;AAC1C,CAAC;AACD,MAAM,UAAU,mBAAmB,CAAC,gBAAmC;IACrE,gBAAgB,GAAG,gBAAgB,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAI,aAAa,GAAmB;IACzC,WAAW;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,WAAW,KAAU,CAAC;IACtB,cAAc,KAAU,CAAC;IACzB,gBAAgB,KAAU,CAAC;IAC3B,eAAe,KAAU,CAAC;IAC1B,YAAY,KAAU,CAAC;IACvB,eAAe,KAAU,CAAC;IAC1B,kBAAkB,KAAU,CAAC;IAC7B,oBAAoB,KAAU,CAAC;IAC/B,eAAe,KAAU,CAAC;IAC1B,gBAAgB,KAAU,CAAC;IAC3B,kBAAkB,KAAU,CAAC;IAC7B,qBAAqB,KAAU,CAAC;IAChC,kBAAkB,KAAU,CAAC;IAC7B,mBAAmB,KAAU,CAAC;IAC9B,sBAAsB,KAAU,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,IAAI,kBAAkB,GAAwB;IACnD,gBAAgB,KAAU,CAAC;IAC3B,kBAAkB,KAAU,CAAC;CAC9B,CAAC;AAEF,MAAM,CAAC,IAAI,gBAAgB,GAAsB;IAC/C,gBAAgB;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/* istanbul ignore file */\n\nimport { IComponentMetrics, IFunnelMetrics, IPerformanceMetrics } from './interfaces';\n\nexport function setFunnelMetrics(funnelMetrics: IFunnelMetrics) {\n FunnelMetrics = funnelMetrics;\n}\nexport function setPerformanceMetrics(performanceMetrics: IPerformanceMetrics) {\n PerformanceMetrics = performanceMetrics;\n}\nexport function setComponentMetrics(componentMetrics: IComponentMetrics) {\n ComponentMetrics = componentMetrics;\n}\n\n/**\n * This is a stub implementation of the FunnelMetrics interface and will be replaced during\n * build time with the actual implementation.\n */\nexport let FunnelMetrics: IFunnelMetrics = {\n funnelStart(): string {\n return '';\n },\n\n funnelError(): void {},\n funnelComplete(): void {},\n funnelSuccessful(): void {},\n funnelCancelled(): void {},\n funnelChange(): void {},\n funnelStepStart(): void {},\n funnelStepComplete(): void {},\n funnelStepNavigation(): void {},\n funnelStepError(): void {},\n funnelStepChange(): void {},\n funnelSubStepStart(): void {},\n funnelSubStepComplete(): void {},\n funnelSubStepError(): void {},\n helpPanelInteracted(): void {},\n externalLinkInteracted(): void {},\n};\n\n/**\n * This is a stub implementation of the PerformanceMetrics interface and will be replaced during\n * build time with the actual implementation.\n */\nexport let PerformanceMetrics: IPerformanceMetrics = {\n tableInteraction(): void {},\n taskCompletionData(): void {},\n};\n\nexport let ComponentMetrics: IComponentMetrics = {\n componentMounted(): string {\n return '';\n },\n};\n"]}
@@ -111,8 +111,18 @@ export interface IFunnelMetrics {
111
111
  helpPanelInteracted: FunnelMethod<FunnelLinkInteractionProps>;
112
112
  externalLinkInteracted: FunnelMethod<FunnelLinkInteractionProps>;
113
113
  }
114
+ export interface TaskCompletionDataProps {
115
+ timeToRespondAfterFormSubmit: number;
116
+ taskInteractionId: string;
117
+ taskIdentifier?: string;
118
+ taskFlowType?: string;
119
+ taskType?: FunnelType;
120
+ completionMetadata?: string;
121
+ }
122
+ export type TaskCompletionDataMethod = (props: TaskCompletionDataProps) => void;
114
123
  export interface IPerformanceMetrics {
115
124
  tableInteraction: TableInteractionMethod;
125
+ taskCompletionData: TaskCompletionDataMethod;
116
126
  }
117
127
  export interface ComponentMountedProps {
118
128
  componentName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/internal/analytics/interfaces.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,YAAY,CAAC;AACtD,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,CAAC;AAClF,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;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CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;AAEhF,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,kBAAkB,EAAE,wBAAwB,CAAC;CAC9C;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;CAChE;AACD,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,qBAAqB,KAAK,MAAM,CAAC;AAC9E,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,sBAAsB,CAAC;CAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/internal/analytics/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport type FunnelType = 'single-page' | 'multi-page';\nexport type FlowType = 'create' | 'edit' | 'home' | 'dashboard' | 'view-resource';\nexport interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n errorContext?: string;\n resourceType?: string;\n}\n\n// Common properties for all funnels\nexport interface BaseFunnelProps {\n funnelIdentifier?: string;\n funnelInteractionId: string;\n currentDocument?: Document;\n}\n\nexport interface FunnelErrorProps extends BaseFunnelProps {\n funnelErrorContext?: string;\n}\n\nexport interface FunnelStartProps extends Omit<BaseFunnelProps, 'funnelInteractionId'> {\n flowType?: FlowType;\n funnelNameSelector: string;\n totalFunnelSteps: number;\n optionalStepNumbers: number[];\n stepConfiguration?: StepConfiguration[];\n funnelType: FunnelType;\n funnelVersion: string;\n componentVersion: string;\n componentTheme: string;\n funnelInteractionId?: string;\n}\n\n// A function type for a generic funnel method\nexport type FunnelMethod<T extends BaseFunnelProps> = (props: T) => void;\n\n// Interface for table interaction method props\nexport interface TableInteractionProps {\n // Time to render table in either no data state or with data after user actions like filtering, pagination.\n // in milliseconds\n interactionTime: number;\n // User action like sorting, filtering, pagination which triggered new data load in table.\n userAction: string;\n // Unique instance identifier for the component.\n // Default: ''\n instanceIdentifier?: string;\n // Component identifier like table header which can be used to identify the table\n // Default: ''\n componentIdentifier?: string;\n // Number of resources in table after user action\n // Default: 0\n noOfResourcesInTable?: number;\n // Additional metadata related to user interaction\n interactionMetadata?: string;\n}\n\nexport type TableInteractionMethod = (props: TableInteractionProps) => void;\n\n// A function type specifically for funnelStart\nexport type FunnelStartMethod = (props: FunnelStartProps) => string;\n\n// Define individual method props by extending the base\nexport interface FunnelStepProps extends BaseFunnelProps {\n stepIdentifier?: string;\n stepNumber: number;\n stepName?: string | undefined;\n stepNameSelector?: string;\n subStepAllSelector: string;\n totalSubSteps?: number;\n subStepConfiguration?: SubStepConfiguration[];\n}\n\nexport interface FunnelStepNavigationProps extends FunnelStepProps {\n destinationStepNumber: number;\n navigationType: string;\n totalSubSteps?: number;\n}\n\nexport interface FunnelStepErrorProps extends FunnelStepProps {\n stepErrorContext?: string;\n stepErrorSelector: string;\n}\n\nexport interface FunnelSubStepProps extends FunnelStepProps {\n subStepIdentifier?: string;\n subStepSelector: string;\n subStepName?: string | undefined;\n subStepNameSelector: string;\n subStepNumber?: number;\n}\n\nexport interface FunnelSubStepErrorProps extends FunnelSubStepProps {\n subStepErrorContext?: string;\n fieldIdentifier?: string;\n fieldErrorContext?: string;\n fieldLabelSelector: string;\n fieldErrorSelector: string;\n}\n\nexport interface OptionalFunnelSubStepErrorProps extends FunnelSubStepProps {\n subStepErrorContext?: string;\n fieldIdentifier?: string;\n fieldErrorContext?: string;\n fieldLabelSelector?: string;\n fieldErrorSelector?: string;\n}\n\nexport interface FunnelLinkInteractionProps extends FunnelSubStepProps {\n elementSelector: string;\n}\n\nexport interface FunnelChangeProps extends BaseFunnelProps {\n stepConfiguration: StepConfiguration[];\n}\n\nexport interface StepConfiguration {\n number: number;\n name: string;\n isOptional: boolean;\n stepIdentifier?: string;\n}\n\nexport interface SubStepConfiguration {\n number: number;\n name: string;\n subStepIdentifier?: string;\n}\n\n// Define the interface using the method type\nexport interface IFunnelMetrics {\n funnelStart: FunnelStartMethod;\n funnelError: FunnelMethod<FunnelErrorProps>;\n funnelComplete: FunnelMethod<BaseFunnelProps>;\n funnelSuccessful: FunnelMethod<BaseFunnelProps>;\n funnelCancelled: FunnelMethod<BaseFunnelProps>;\n funnelChange: FunnelMethod<FunnelChangeProps>;\n\n funnelStepStart: FunnelMethod<FunnelStepProps>;\n funnelStepComplete: FunnelMethod<FunnelStepProps>;\n funnelStepNavigation: FunnelMethod<FunnelStepNavigationProps>;\n funnelStepError: FunnelMethod<FunnelStepErrorProps>;\n funnelStepChange: FunnelMethod<FunnelStepProps>;\n\n funnelSubStepStart: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepComplete: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepError: FunnelMethod<OptionalFunnelSubStepErrorProps>;\n\n helpPanelInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n externalLinkInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n}\n\nexport interface IPerformanceMetrics {\n tableInteraction: TableInteractionMethod;\n}\n\nexport interface ComponentMountedProps {\n componentName: string;\n details: Record<string, string | boolean | number | undefined>;\n}\nexport type ComponentMountedMethod = (props: ComponentMountedProps) => string;\nexport interface IComponentMetrics {\n componentMounted: ComponentMountedMethod;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/internal/analytics/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport type FunnelType = 'single-page' | 'multi-page';\nexport type FlowType = 'create' | 'edit' | 'home' | 'dashboard' | 'view-resource';\nexport interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n errorContext?: string;\n resourceType?: string;\n}\n\n// Common properties for all funnels\nexport interface BaseFunnelProps {\n funnelIdentifier?: string;\n funnelInteractionId: string;\n currentDocument?: Document;\n}\n\nexport interface FunnelErrorProps extends BaseFunnelProps {\n funnelErrorContext?: string;\n}\n\nexport interface FunnelStartProps extends Omit<BaseFunnelProps, 'funnelInteractionId'> {\n flowType?: FlowType;\n funnelNameSelector: string;\n totalFunnelSteps: number;\n optionalStepNumbers: number[];\n stepConfiguration?: StepConfiguration[];\n funnelType: FunnelType;\n funnelVersion: string;\n componentVersion: string;\n componentTheme: string;\n funnelInteractionId?: string;\n}\n\n// A function type for a generic funnel method\nexport type FunnelMethod<T extends BaseFunnelProps> = (props: T) => void;\n\n// Interface for table interaction method props\nexport interface TableInteractionProps {\n // Time to render table in either no data state or with data after user actions like filtering, pagination.\n // in milliseconds\n interactionTime: number;\n // User action like sorting, filtering, pagination which triggered new data load in table.\n userAction: string;\n // Unique instance identifier for the component.\n // Default: ''\n instanceIdentifier?: string;\n // Component identifier like table header which can be used to identify the table\n // Default: ''\n componentIdentifier?: string;\n // Number of resources in table after user action\n // Default: 0\n noOfResourcesInTable?: number;\n // Additional metadata related to user interaction\n interactionMetadata?: string;\n}\n\nexport type TableInteractionMethod = (props: TableInteractionProps) => void;\n\n// A function type specifically for funnelStart\nexport type FunnelStartMethod = (props: FunnelStartProps) => string;\n\n// Define individual method props by extending the base\nexport interface FunnelStepProps extends BaseFunnelProps {\n stepIdentifier?: string;\n stepNumber: number;\n stepName?: string | undefined;\n stepNameSelector?: string;\n subStepAllSelector: string;\n totalSubSteps?: number;\n subStepConfiguration?: SubStepConfiguration[];\n}\n\nexport interface FunnelStepNavigationProps extends FunnelStepProps {\n destinationStepNumber: number;\n navigationType: string;\n totalSubSteps?: number;\n}\n\nexport interface FunnelStepErrorProps extends FunnelStepProps {\n stepErrorContext?: string;\n stepErrorSelector: string;\n}\n\nexport interface FunnelSubStepProps extends FunnelStepProps {\n subStepIdentifier?: string;\n subStepSelector: string;\n subStepName?: string | undefined;\n subStepNameSelector: string;\n subStepNumber?: number;\n}\n\nexport interface FunnelSubStepErrorProps extends FunnelSubStepProps {\n subStepErrorContext?: string;\n fieldIdentifier?: string;\n fieldErrorContext?: string;\n fieldLabelSelector: string;\n fieldErrorSelector: string;\n}\n\nexport interface OptionalFunnelSubStepErrorProps extends FunnelSubStepProps {\n subStepErrorContext?: string;\n fieldIdentifier?: string;\n fieldErrorContext?: string;\n fieldLabelSelector?: string;\n fieldErrorSelector?: string;\n}\n\nexport interface FunnelLinkInteractionProps extends FunnelSubStepProps {\n elementSelector: string;\n}\n\nexport interface FunnelChangeProps extends BaseFunnelProps {\n stepConfiguration: StepConfiguration[];\n}\n\nexport interface StepConfiguration {\n number: number;\n name: string;\n isOptional: boolean;\n stepIdentifier?: string;\n}\n\nexport interface SubStepConfiguration {\n number: number;\n name: string;\n subStepIdentifier?: string;\n}\n\n// Define the interface using the method type\nexport interface IFunnelMetrics {\n funnelStart: FunnelStartMethod;\n funnelError: FunnelMethod<FunnelErrorProps>;\n funnelComplete: FunnelMethod<BaseFunnelProps>;\n funnelSuccessful: FunnelMethod<BaseFunnelProps>;\n funnelCancelled: FunnelMethod<BaseFunnelProps>;\n funnelChange: FunnelMethod<FunnelChangeProps>;\n\n funnelStepStart: FunnelMethod<FunnelStepProps>;\n funnelStepComplete: FunnelMethod<FunnelStepProps>;\n funnelStepNavigation: FunnelMethod<FunnelStepNavigationProps>;\n funnelStepError: FunnelMethod<FunnelStepErrorProps>;\n funnelStepChange: FunnelMethod<FunnelStepProps>;\n\n funnelSubStepStart: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepComplete: FunnelMethod<FunnelSubStepProps>;\n funnelSubStepError: FunnelMethod<OptionalFunnelSubStepErrorProps>;\n\n helpPanelInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n externalLinkInteracted: FunnelMethod<FunnelLinkInteractionProps>;\n}\n\n// Interface for task completion method props\nexport interface TaskCompletionDataProps {\n // Time taken to respond to customers after customers submit the form\n // in milliseconds\n timeToRespondAfterFormSubmit: number;\n // Unique identifier for the task aka funnelInteractionId.\n // Default: ''\n taskInteractionId: string;\n // Task name identifier to identify the task aka funnelName\n // Default: ''\n taskIdentifier?: string;\n // To identify create or edit flow\n // Default: ''\n taskFlowType?: string;\n //\"single-page\" | \"multi-page\"\n // Default: ''\n taskType?: FunnelType;\n // Additional metadata related to completion such as success or error\n completionMetadata?: string;\n}\n\nexport type TaskCompletionDataMethod = (props: TaskCompletionDataProps) => void;\n\nexport interface IPerformanceMetrics {\n tableInteraction: TableInteractionMethod;\n taskCompletionData: TaskCompletionDataMethod;\n}\n\nexport interface ComponentMountedProps {\n componentName: string;\n details: Record<string, string | boolean | number | undefined>;\n}\nexport type ComponentMountedMethod = (props: ComponentMountedProps) => string;\nexport interface IComponentMetrics {\n componentMounted: ComponentMountedMethod;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (c27dce42)";
2
+ export var PACKAGE_VERSION = "3.0.0 (4b05e5df)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (c27dce42)",
3
+ "PACKAGE_VERSION": "3.0.0 (4b05e5df)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "c27dce42beffecd7d4c920cf4a1008d10ebff8e8"
2
+ "commit": "4b05e5df6472e4cfcae14cd994bee61d65dcaaec"
3
3
  }
package/package.json CHANGED
@@ -126,7 +126,7 @@
126
126
  "./internal/base-component/index.js",
127
127
  "./internal/base-component/styles.css.js"
128
128
  ],
129
- "version": "3.0.765",
129
+ "version": "3.0.766",
130
130
  "repository": {
131
131
  "type": "git",
132
132
  "url": "https://github.com/cloudscape-design/components.git"