@cloudscape-design/components 3.0.731 → 3.0.733
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-layout/classic.d.ts.map +1 -1
- package/app-layout/classic.js +6 -1
- package/app-layout/classic.js.map +1 -1
- package/app-layout/index.d.ts.map +1 -1
- package/app-layout/index.js +2 -2
- package/app-layout/index.js.map +1 -1
- package/app-layout/interfaces.d.ts +13 -0
- package/app-layout/interfaces.d.ts.map +1 -1
- package/app-layout/interfaces.js.map +1 -1
- package/app-layout/resize/styles.css.js +4 -4
- package/app-layout/resize/styles.scoped.css +9 -9
- package/app-layout/resize/styles.selectors.js +4 -4
- package/app-layout/visual-refresh/context.d.ts +1 -1
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +4 -1
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/drawers.d.ts +8 -0
- package/app-layout/visual-refresh/drawers.d.ts.map +1 -1
- package/app-layout/visual-refresh/drawers.js +12 -4
- package/app-layout/visual-refresh/drawers.js.map +1 -1
- package/app-layout/visual-refresh/trigger-button.d.ts +8 -1
- package/app-layout/visual-refresh/trigger-button.d.ts.map +1 -1
- package/app-layout/visual-refresh/trigger-button.js +10 -6
- package/app-layout/visual-refresh/trigger-button.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/compute-layout.d.ts +1 -0
- package/app-layout/visual-refresh-toolbar/compute-layout.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/compute-layout.js +3 -1
- package/app-layout/visual-refresh-toolbar/compute-layout.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/index.js +8 -7
- package/app-layout/visual-refresh-toolbar/drawer/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.js +8 -4
- package/app-layout/visual-refresh-toolbar/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/navigation/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/navigation/index.js +9 -7
- package/app-layout/visual-refresh-toolbar/navigation/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
- package/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -6
- package/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
- package/app-layout/visual-refresh-toolbar/skeleton/index.js +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +16 -16
- package/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +32 -31
- package/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +16 -16
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js +3 -1
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.js +4 -4
- package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/styles.css.js +12 -13
- package/app-layout/visual-refresh-toolbar/toolbar/styles.scoped.css +17 -18
- package/app-layout/visual-refresh-toolbar/toolbar/styles.selectors.js +12 -13
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.d.ts +8 -2
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js +3 -4
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js.map +1 -1
- package/container/index.d.ts.map +1 -1
- package/container/index.js +9 -1
- package/container/index.js.map +1 -1
- package/expandable-section/index.d.ts.map +1 -1
- package/expandable-section/index.js +6 -1
- package/expandable-section/index.js.map +1 -1
- package/form/index.d.ts.map +1 -1
- package/form/index.js +11 -2
- package/form/index.js.map +1 -1
- package/form/interfaces.d.ts +2 -0
- package/form/interfaces.d.ts.map +1 -1
- package/form/interfaces.js.map +1 -1
- package/form-field/index.d.ts.map +1 -1
- package/form-field/index.js +8 -1
- package/form-field/index.js.map +1 -1
- package/i18n/messages/all.all.js +1 -1
- package/i18n/messages/all.all.json +1 -1
- package/i18n/messages/all.ar.js +1 -1
- package/i18n/messages/all.ar.json +1 -1
- package/i18n/messages/all.de.js +1 -1
- package/i18n/messages/all.de.json +1 -1
- package/i18n/messages/all.en-GB.js +1 -1
- package/i18n/messages/all.en-GB.json +1 -1
- package/i18n/messages/all.es.js +1 -1
- package/i18n/messages/all.es.json +1 -1
- package/i18n/messages/all.fr.js +1 -1
- package/i18n/messages/all.fr.json +1 -1
- package/i18n/messages/all.id.js +1 -1
- package/i18n/messages/all.id.json +1 -1
- package/i18n/messages/all.it.js +1 -1
- package/i18n/messages/all.it.json +1 -1
- package/i18n/messages/all.ja.js +1 -1
- package/i18n/messages/all.ja.json +1 -1
- package/i18n/messages/all.ko.js +1 -1
- package/i18n/messages/all.ko.json +1 -1
- package/i18n/messages/all.pt-BR.js +1 -1
- package/i18n/messages/all.pt-BR.json +1 -1
- package/i18n/messages/all.tr.js +1 -1
- package/i18n/messages/all.tr.json +1 -1
- package/i18n/messages/all.zh-CN.js +1 -1
- package/i18n/messages/all.zh-CN.json +1 -1
- package/i18n/messages/all.zh-TW.js +1 -1
- package/i18n/messages/all.zh-TW.json +1 -1
- package/internal/analytics/components/analytics-funnel.d.ts +1 -0
- package/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
- package/internal/analytics/components/analytics-funnel.js.map +1 -1
- package/internal/analytics/hooks/use-funnel.d.ts +1 -1
- package/internal/analytics/interfaces.d.ts +2 -1
- package/internal/analytics/interfaces.d.ts.map +1 -1
- package/internal/analytics/interfaces.js.map +1 -1
- package/internal/base-component/index.d.ts +2 -1
- package/internal/base-component/index.d.ts.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/property-filter/i18n-utils.d.ts.map +1 -1
- package/property-filter/i18n-utils.js +10 -16
- package/property-filter/i18n-utils.js.map +1 -1
- package/property-filter/internal.js +1 -1
- package/property-filter/internal.js.map +1 -1
- package/table/index.d.ts.map +1 -1
- package/table/index.js +4 -1
- package/table/index.js.map +1 -1
- package/wizard/index.d.ts.map +1 -1
- package/wizard/index.js +11 -2
- package/wizard/index.js.map +1 -1
- package/wizard/interfaces.d.ts +2 -0
- package/wizard/interfaces.d.ts.map +1 -1
- package/wizard/interfaces.js.map +1 -1
|
@@ -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,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,MAAM,UAAU,CAAC;AAQzC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,cAAc,CAAC;A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C;;;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 } 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}\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,iBAAi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CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,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 } 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"]}
|
|
@@ -42,7 +42,7 @@ export declare const useFunnel: () => {
|
|
|
42
42
|
funnelInteractionId: string | undefined;
|
|
43
43
|
funnelIdentifier?: string | undefined;
|
|
44
44
|
funnelErrorContext?: string | undefined;
|
|
45
|
-
funnelFlowType?: "
|
|
45
|
+
funnelFlowType?: import("../interfaces").FlowType | undefined;
|
|
46
46
|
funnelType: import("../interfaces").FunnelType;
|
|
47
47
|
funnelNameSelector: string;
|
|
48
48
|
optionalStepNumbers: number[];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export type FunnelType = 'single-page' | 'multi-page';
|
|
2
|
-
export type FlowType = 'create';
|
|
2
|
+
export type FlowType = 'create' | 'edit' | 'home' | 'dashboard';
|
|
3
3
|
export interface AnalyticsMetadata {
|
|
4
4
|
instanceIdentifier?: string;
|
|
5
5
|
flowType?: FlowType;
|
|
6
6
|
errorContext?: string;
|
|
7
|
+
resourceType?: string;
|
|
7
8
|
}
|
|
8
9
|
export interface BaseFunnelProps {
|
|
9
10
|
funnelIdentifier?: 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,CAAC;
|
|
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,CAAC;AAChE,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,QAAQ,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAiB,SAAQ,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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';\nexport interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n errorContext?: 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"]}
|
|
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';\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"]}
|
|
@@ -25,7 +25,8 @@ export interface BasePropsWithAnalyticsMetadata {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function getAnalyticsMetadataProps(props?: BasePropsWithAnalyticsMetadata): {
|
|
27
27
|
instanceIdentifier?: string | undefined;
|
|
28
|
-
flowType?: "
|
|
28
|
+
flowType?: import("../analytics/interfaces").FlowType | undefined;
|
|
29
29
|
errorContext?: string | undefined;
|
|
30
|
+
resourceType?: string | undefined;
|
|
30
31
|
};
|
|
31
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/internal/base-component/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D,OAAO,iBAAiB,CAAC;AAIzB,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CAIb;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,sBAQrD;AAED,MAAM,WAAW,8BAA8B;IAC7C,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,mBAAmB,CAAC,EAAE,iBAAiB,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,EAAE,8BAA8B
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/internal/base-component/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D,OAAO,iBAAiB,CAAC;AAIzB,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CAIb;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,sBAQrD;AAED,MAAM,WAAW,8BAA8B;IAC7C,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,mBAAmB,CAAC,EAAE,iBAAiB,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,EAAE,8BAA8B;;;;;EAE/E"}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-utils.d.ts","sourceRoot":"","sources":["../../../src/property-filter/i18n-utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE9F,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,uBAAuB,CAAC;IACnC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,m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G,EAAE,WAAW,GAAG,cAAc,GAAG,mBAAmB,CAoI5F;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,oBAAoB,sBA4BpG"}
|
|
@@ -19,17 +19,6 @@ export function usePropertyFilterI18n(def) {
|
|
|
19
19
|
const tokenValue = valueFormatter ? valueFormatter(token.value) : token.value;
|
|
20
20
|
return { propertyKey: (_b = token.property) === null || _b === void 0 ? void 0 : _b.propertyKey, propertyLabel, operator: token.operator, value: tokenValue };
|
|
21
21
|
}
|
|
22
|
-
function toI18n(token, { ariaLabel }) {
|
|
23
|
-
var _a;
|
|
24
|
-
const formatted = toFormatted(token);
|
|
25
|
-
return {
|
|
26
|
-
token__propertyKey: (_a = formatted.propertyKey) !== null && _a !== void 0 ? _a : '',
|
|
27
|
-
token__propertyLabel: formatted.propertyLabel,
|
|
28
|
-
token__operator: ariaLabel ? getOperatorI18nString(formatted.operator) : formatted.operator,
|
|
29
|
-
token__value: formatted.value,
|
|
30
|
-
token__formattedText: formatToken(formatted),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
22
|
return Object.assign(Object.assign({}, def), { allPropertiesLabel,
|
|
34
23
|
operationAndText,
|
|
35
24
|
operationOrText, applyActionText: i18n('i18nStrings.applyActionText', def === null || def === void 0 ? void 0 : def.applyActionText), cancelActionText: i18n('i18nStrings.cancelActionText', def === null || def === void 0 ? void 0 : def.cancelActionText), clearFiltersText: i18n('i18nStrings.clearFiltersText', def === null || def === void 0 ? void 0 : def.clearFiltersText), editTokenHeader: i18n('i18nStrings.editTokenHeader', def === null || def === void 0 ? void 0 : def.editTokenHeader), groupPropertiesText: i18n('i18nStrings.groupPropertiesText', def === null || def === void 0 ? void 0 : def.groupPropertiesText), groupValuesText: i18n('i18nStrings.groupValuesText', def === null || def === void 0 ? void 0 : def.groupValuesText), operatorContainsText: i18n('i18nStrings.operatorContainsText', def === null || def === void 0 ? void 0 : def.operatorContainsText), operatorDoesNotContainText: i18n('i18nStrings.operatorDoesNotContainText', def === null || def === void 0 ? void 0 : def.operatorDoesNotContainText), operatorDoesNotEqualText: i18n('i18nStrings.operatorDoesNotEqualText', def === null || def === void 0 ? void 0 : def.operatorDoesNotEqualText), operatorEqualsText: i18n('i18nStrings.operatorEqualsText', def === null || def === void 0 ? void 0 : def.operatorEqualsText), operatorGreaterOrEqualText: i18n('i18nStrings.operatorGreaterOrEqualText', def === null || def === void 0 ? void 0 : def.operatorGreaterOrEqualText), operatorGreaterText: i18n('i18nStrings.operatorGreaterText', def === null || def === void 0 ? void 0 : def.operatorGreaterText), operatorLessOrEqualText: i18n('i18nStrings.operatorLessOrEqualText', def === null || def === void 0 ? void 0 : def.operatorLessOrEqualText), operatorLessText: i18n('i18nStrings.operatorLessText', def === null || def === void 0 ? void 0 : def.operatorLessText), operatorStartsWithText: i18n('i18nStrings.operatorStartsWithText', def === null || def === void 0 ? void 0 : def.operatorStartsWithText), operatorDoesNotStartWithText: i18n('i18nStrings.operatorDoesNotStartWithText', def === null || def === void 0 ? void 0 : def.operatorDoesNotStartWithText), operatorText: i18n('i18nStrings.operatorText', def === null || def === void 0 ? void 0 : def.operatorText), operatorsText: i18n('i18nStrings.operatorsText', def === null || def === void 0 ? void 0 : def.operatorsText), propertyText: i18n('i18nStrings.propertyText', def === null || def === void 0 ? void 0 : def.propertyText), tokenLimitShowFewer: i18n('i18nStrings.tokenLimitShowFewer', def === null || def === void 0 ? void 0 : def.tokenLimitShowFewer), tokenLimitShowMore: i18n('i18nStrings.tokenLimitShowMore', def === null || def === void 0 ? void 0 : def.tokenLimitShowMore), valueText: i18n('i18nStrings.valueText', def === null || def === void 0 ? void 0 : def.valueText), tokenEditorTokenRemoveLabel: i18n('i18nStrings.tokenEditorTokenRemoveLabel', def === null || def === void 0 ? void 0 : def.tokenEditorTokenRemoveLabel), tokenEditorTokenRemoveFromGroupLabel: i18n('i18nStrings.tokenEditorTokenRemoveFromGroupLabel', def === null || def === void 0 ? void 0 : def.tokenEditorTokenRemoveFromGroupLabel), tokenEditorAddNewTokenLabel: i18n('i18nStrings.tokenEditorAddNewTokenLabel', def === null || def === void 0 ? void 0 : def.tokenEditorAddNewTokenLabel), tokenEditorAddTokenActionsAriaLabel: i18n('i18nStrings.tokenEditorAddTokenActionsAriaLabel', def === null || def === void 0 ? void 0 : def.tokenEditorAddTokenActionsAriaLabel), formatToken: token => {
|
|
@@ -51,23 +40,28 @@ export function usePropertyFilterI18n(def) {
|
|
|
51
40
|
return (_b = formatter === null || formatter === void 0 ? void 0 : formatter({ operation, operationLabel, tokens })) !== null && _b !== void 0 ? _b : '';
|
|
52
41
|
}, removeTokenButtonAriaLabel: token => {
|
|
53
42
|
var _a;
|
|
54
|
-
const formatter = i18n('i18nStrings.removeTokenButtonAriaLabel', def.removeTokenButtonAriaLabel, format => () => format(
|
|
43
|
+
const formatter = i18n('i18nStrings.removeTokenButtonAriaLabel', def.removeTokenButtonAriaLabel, format => () => format({ token__formattedText: formatToken(toFormatted(token)) }));
|
|
55
44
|
return (_a = formatter === null || formatter === void 0 ? void 0 : formatter(toFormatted(token))) !== null && _a !== void 0 ? _a : '';
|
|
56
45
|
}, tokenEditorTokenActionsAriaLabel: token => {
|
|
57
46
|
var _a;
|
|
58
|
-
const formatter = i18n('i18nStrings.tokenEditorTokenActionsAriaLabel', def.tokenEditorTokenActionsAriaLabel, format => () => format(
|
|
47
|
+
const formatter = i18n('i18nStrings.tokenEditorTokenActionsAriaLabel', def.tokenEditorTokenActionsAriaLabel, format => () => format({ token__formattedText: formatToken(toFormatted(token)) }));
|
|
59
48
|
return (_a = formatter === null || formatter === void 0 ? void 0 : formatter(toFormatted(token))) !== null && _a !== void 0 ? _a : '';
|
|
60
49
|
}, tokenEditorTokenRemoveAriaLabel: token => {
|
|
61
50
|
var _a;
|
|
62
|
-
const formatter = i18n('i18nStrings.tokenEditorTokenRemoveAriaLabel', def.tokenEditorTokenRemoveAriaLabel, format => () => format(
|
|
51
|
+
const formatter = i18n('i18nStrings.tokenEditorTokenRemoveAriaLabel', def.tokenEditorTokenRemoveAriaLabel, format => () => format({ token__formattedText: formatToken(toFormatted(token)) }));
|
|
63
52
|
return (_a = formatter === null || formatter === void 0 ? void 0 : formatter(toFormatted(token))) !== null && _a !== void 0 ? _a : '';
|
|
64
53
|
}, tokenEditorAddExistingTokenAriaLabel: token => {
|
|
65
54
|
var _a;
|
|
66
|
-
const formatter = i18n('i18nStrings.tokenEditorAddExistingTokenAriaLabel', def.tokenEditorAddExistingTokenAriaLabel, format => () => format(
|
|
55
|
+
const formatter = i18n('i18nStrings.tokenEditorAddExistingTokenAriaLabel', def.tokenEditorAddExistingTokenAriaLabel, format => () => format({ token__formattedText: formatToken(toFormatted(token)) }));
|
|
67
56
|
return (_a = formatter === null || formatter === void 0 ? void 0 : formatter(toFormatted(token))) !== null && _a !== void 0 ? _a : '';
|
|
68
57
|
}, tokenEditorAddExistingTokenLabel: token => {
|
|
69
58
|
var _a;
|
|
70
|
-
const
|
|
59
|
+
const formattedToken = toFormatted(token);
|
|
60
|
+
const formatter = i18n('i18nStrings.tokenEditorAddExistingTokenLabel', def.tokenEditorAddExistingTokenLabel, format => () => format({
|
|
61
|
+
token__propertyLabel: formattedToken.propertyLabel,
|
|
62
|
+
token__operator: formattedToken.operator,
|
|
63
|
+
token__value: formattedToken.value,
|
|
64
|
+
}));
|
|
71
65
|
return (_a = formatter === null || formatter === void 0 ? void 0 : formatter(toFormatted(token))) !== null && _a !== void 0 ? _a : '';
|
|
72
66
|
} });
|
|
73
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-utils.js","sourceRoot":"","sources":["../../../src/property-filter/i18n-utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAiElD,MAAM,UAAU,qBAAqB,CAAC,GAAiC;;IACrE,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,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;QAC9B,KAAK,GAAG;YACN,OAAO,WAAW,CAAC;QACrB,KAAK,IAAI;YACP,OAAO,iBAAiB,CAAC;QAC3B,KAAK,GAAG;YACN,OAAO,UAAU,CAAC;QACpB,KAAK,IAAI;YACP,OAAO,cAAc,CAAC;QACxB,KAAK,GAAG;YACN,OAAO,aAAa,CAAC;QACvB,KAAK,IAAI;YACP,OAAO,iBAAiB,CAAC;QAC3B,iEAAiE;QACjE,sFAAsF;QACtF,0BAA0B;QAC1B;YACE,OAAO,QAAQ,CAAC;KACnB;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PropertyFilterOperation } from '@cloudscape-design/collection-hooks';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { ComparisonOperator, FormattedToken, I18nStrings, InternalToken } from './interfaces';\n\nexport interface InternalTokenGroup {\n operation: PropertyFilterOperation;\n tokens: readonly InternalToken[];\n}\n\nexport interface FormattedTokenGroup {\n tokens: FormattedToken[];\n operation: string;\n operationLabel: string;\n}\n\nexport type I18nStringsOperators = Pick<\n I18nStrings,\n | 'operatorLessText'\n | 'operatorLessOrEqualText'\n | 'operatorGreaterText'\n | 'operatorGreaterOrEqualText'\n | 'operatorContainsText'\n | 'operatorDoesNotContainText'\n | 'operatorEqualsText'\n | 'operatorDoesNotEqualText'\n | 'operatorStartsWithText'\n | 'operatorDoesNotStartWithText'\n>;\n\n// Unreleased i18n properties\nexport interface I18nStringsExt {\n groupEditAriaLabel?: (group: FormattedTokenGroup) => string;\n tokenEditorTokenActionsAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveLabel?: string;\n tokenEditorTokenRemoveFromGroupLabel?: string;\n tokenEditorAddNewTokenLabel?: string;\n tokenEditorAddTokenActionsAriaLabel?: string;\n tokenEditorAddExistingTokenAriaLabel?: (token: FormattedToken) => string;\n tokenEditorAddExistingTokenLabel?: (token: FormattedToken) => string;\n}\n\n// Replacing i18n function with ones taking internal tokens as argument.\nexport type I18nStringsInternal = Omit<I18nStrings, 'formatToken' | 'removeTokenButtonAriaLabel'> &\n Omit<\n I18nStringsExt,\n | 'groupEditAriaLabel'\n | 'tokenEditorTokenActionsAriaLabel'\n | 'tokenEditorTokenRemoveAriaLabel'\n | 'tokenEditorAddExistingTokenAriaLabel'\n | 'tokenEditorAddExistingTokenLabel'\n > & {\n formatToken: (token: InternalToken) => {\n propertyLabel: string;\n operator: string;\n value: string;\n formattedText: string;\n };\n groupEditAriaLabel: (group: InternalTokenGroup) => string;\n removeTokenButtonAriaLabel: (token: InternalToken) => string;\n tokenEditorTokenActionsAriaLabel: (token: InternalToken) => string;\n tokenEditorTokenRemoveAriaLabel: (token: InternalToken) => string;\n tokenEditorAddExistingTokenAriaLabel: (token: InternalToken) => string;\n tokenEditorAddExistingTokenLabel: (token: InternalToken) => string;\n };\n\nexport function usePropertyFilterI18n(def: I18nStrings & I18nStringsExt): I18nStringsInternal {\n const i18n = useInternalI18n('property-filter');\n\n const allPropertiesLabel = i18n('i18nStrings.allPropertiesLabel', def?.allPropertiesLabel);\n const operationAndText = i18n('i18nStrings.operationAndText', def?.operationAndText);\n const operationOrText = i18n('i18nStrings.operationOrText', def?.operationOrText);\n const formatToken =\n i18n(\n 'i18nStrings.formatToken',\n def.formatToken,\n format => token =>\n format({\n token__propertyLabel: token.propertyLabel,\n token__operator: getOperatorI18nString(token.operator),\n token__value: token.value,\n })\n ) ?? (token => `${token.propertyLabel} ${token.operator} ${token.value}`);\n\n function toFormatted(token: InternalToken): FormattedToken {\n const valueFormatter = token.property?.getValueFormatter(token.operator);\n const propertyLabel = token.property ? token.property.propertyLabel : allPropertiesLabel ?? '';\n const tokenValue = valueFormatter ? valueFormatter(token.value) : token.value;\n return { propertyKey: token.property?.propertyKey, propertyLabel, operator: token.operator, value: tokenValue };\n }\n\n function toI18n(\n token: InternalToken,\n { ariaLabel }: { ariaLabel: boolean }\n ): {\n token__propertyKey: string;\n token__propertyLabel: string;\n token__operator: string;\n token__value: string;\n token__formattedText: string;\n } {\n const formatted = toFormatted(token);\n return {\n token__propertyKey: formatted.propertyKey ?? '',\n token__propertyLabel: formatted.propertyLabel,\n token__operator: ariaLabel ? getOperatorI18nString(formatted.operator) : formatted.operator,\n token__value: formatted.value,\n token__formattedText: formatToken(formatted),\n };\n }\n\n return {\n ...def,\n allPropertiesLabel,\n operationAndText,\n operationOrText,\n applyActionText: i18n('i18nStrings.applyActionText', def?.applyActionText),\n cancelActionText: i18n('i18nStrings.cancelActionText', def?.cancelActionText),\n clearFiltersText: i18n('i18nStrings.clearFiltersText', def?.clearFiltersText),\n editTokenHeader: i18n('i18nStrings.editTokenHeader', def?.editTokenHeader),\n groupPropertiesText: i18n('i18nStrings.groupPropertiesText', def?.groupPropertiesText),\n groupValuesText: i18n('i18nStrings.groupValuesText', def?.groupValuesText),\n operatorContainsText: i18n('i18nStrings.operatorContainsText', def?.operatorContainsText),\n operatorDoesNotContainText: i18n('i18nStrings.operatorDoesNotContainText', def?.operatorDoesNotContainText),\n operatorDoesNotEqualText: i18n('i18nStrings.operatorDoesNotEqualText', def?.operatorDoesNotEqualText),\n operatorEqualsText: i18n('i18nStrings.operatorEqualsText', def?.operatorEqualsText),\n operatorGreaterOrEqualText: i18n('i18nStrings.operatorGreaterOrEqualText', def?.operatorGreaterOrEqualText),\n operatorGreaterText: i18n('i18nStrings.operatorGreaterText', def?.operatorGreaterText),\n operatorLessOrEqualText: i18n('i18nStrings.operatorLessOrEqualText', def?.operatorLessOrEqualText),\n operatorLessText: i18n('i18nStrings.operatorLessText', def?.operatorLessText),\n operatorStartsWithText: i18n('i18nStrings.operatorStartsWithText', def?.operatorStartsWithText),\n operatorDoesNotStartWithText: i18n('i18nStrings.operatorDoesNotStartWithText', def?.operatorDoesNotStartWithText),\n operatorText: i18n('i18nStrings.operatorText', def?.operatorText),\n operatorsText: i18n('i18nStrings.operatorsText', def?.operatorsText),\n propertyText: i18n('i18nStrings.propertyText', def?.propertyText),\n tokenLimitShowFewer: i18n('i18nStrings.tokenLimitShowFewer', def?.tokenLimitShowFewer),\n tokenLimitShowMore: i18n('i18nStrings.tokenLimitShowMore', def?.tokenLimitShowMore),\n valueText: i18n('i18nStrings.valueText', def?.valueText),\n tokenEditorTokenRemoveLabel: i18n('i18nStrings.tokenEditorTokenRemoveLabel', def?.tokenEditorTokenRemoveLabel),\n tokenEditorTokenRemoveFromGroupLabel: i18n(\n 'i18nStrings.tokenEditorTokenRemoveFromGroupLabel',\n def?.tokenEditorTokenRemoveFromGroupLabel\n ),\n tokenEditorAddNewTokenLabel: i18n('i18nStrings.tokenEditorAddNewTokenLabel', def?.tokenEditorAddNewTokenLabel),\n tokenEditorAddTokenActionsAriaLabel: i18n(\n 'i18nStrings.tokenEditorAddTokenActionsAriaLabel',\n def?.tokenEditorAddTokenActionsAriaLabel\n ),\n formatToken: token => {\n const formattedToken = toFormatted(token);\n return { ...formattedToken, formattedText: formatToken(toFormatted(token)) };\n },\n groupEditAriaLabel: group => {\n const tokens = group.tokens.map(token => toFormatted(token));\n const operation = group.operation;\n const operationLabel = (operation === 'and' ? operationAndText : operationOrText) ?? '';\n const formatter = i18n(\n 'i18nStrings.groupEditAriaLabel',\n def.groupEditAriaLabel,\n format => () =>\n format({\n group__operationLabel: operationLabel,\n group__formattedTokens__length: tokens.length.toString(),\n group__formattedTokens0__formattedText: tokens[0] ? formatToken(tokens[0]) : '',\n group__formattedTokens1__formattedText: tokens[1] ? formatToken(tokens[0]) : '',\n group__formattedTokens2__formattedText: tokens[2] ? formatToken(tokens[0]) : '',\n group__formattedTokens3__formattedText: tokens[3] ? formatToken(tokens[0]) : '',\n })\n );\n return formatter?.({ operation, operationLabel, tokens }) ?? '';\n },\n removeTokenButtonAriaLabel: token => {\n const formatter = i18n(\n 'i18nStrings.removeTokenButtonAriaLabel',\n def.removeTokenButtonAriaLabel,\n format => () => format(toI18n(token, { ariaLabel: true }))\n );\n return formatter?.(toFormatted(token)) ?? '';\n },\n tokenEditorTokenActionsAriaLabel: token => {\n const formatter = i18n(\n 'i18nStrings.tokenEditorTokenActionsAriaLabel',\n def.tokenEditorTokenActionsAriaLabel,\n format => () => format(toI18n(token, { ariaLabel: true }))\n );\n return formatter?.(toFormatted(token)) ?? '';\n },\n tokenEditorTokenRemoveAriaLabel: token => {\n const formatter = i18n(\n 'i18nStrings.tokenEditorTokenRemoveAriaLabel',\n def.tokenEditorTokenRemoveAriaLabel,\n format => () => format(toI18n(token, { ariaLabel: true }))\n );\n return formatter?.(toFormatted(token)) ?? '';\n },\n tokenEditorAddExistingTokenAriaLabel: token => {\n const formatter = i18n(\n 'i18nStrings.tokenEditorAddExistingTokenAriaLabel',\n def.tokenEditorAddExistingTokenAriaLabel,\n format => () => format(toI18n(token, { ariaLabel: true }))\n );\n return formatter?.(toFormatted(token)) ?? '';\n },\n tokenEditorAddExistingTokenLabel: token => {\n const formatter = i18n(\n 'i18nStrings.tokenEditorAddExistingTokenLabel',\n def.tokenEditorAddExistingTokenLabel,\n format => () => format(toI18n(token, { ariaLabel: false }))\n );\n return formatter?.(toFormatted(token)) ?? '';\n },\n };\n}\n\nexport function operatorToDescription(operator: ComparisonOperator, i18nStrings: I18nStringsOperators) {\n switch (operator) {\n case '<':\n return i18nStrings.operatorLessText;\n case '<=':\n return i18nStrings.operatorLessOrEqualText;\n case '>':\n return i18nStrings.operatorGreaterText;\n case '>=':\n return i18nStrings.operatorGreaterOrEqualText;\n case ':':\n return i18nStrings.operatorContainsText;\n case '!:':\n return i18nStrings.operatorDoesNotContainText;\n case '=':\n return i18nStrings.operatorEqualsText;\n case '!=':\n return i18nStrings.operatorDoesNotEqualText;\n case '^':\n return i18nStrings.operatorStartsWithText;\n case '!^':\n return i18nStrings.operatorDoesNotStartWithText;\n // The line is ignored from coverage because it is not reachable.\n // The purpose of it is to prevent TS errors if ComparisonOperator type gets extended.\n /* istanbul ignore next */\n default:\n return '';\n }\n}\n\nfunction getOperatorI18nString(operator: ComparisonOperator): string {\n switch (operator) {\n case '=':\n return 'equals';\n case '!=':\n return 'not_equals';\n case '>':\n return 'greater_than';\n case '>=':\n return 'greater_than_equal';\n case '<':\n return 'less_than';\n case '<=':\n return 'less_than_equal';\n case ':':\n return 'contains';\n case '!:':\n return 'not_contains';\n case '^':\n return 'starts_with';\n case '!^':\n return 'not_starts_with';\n // The line is ignored from coverage because it is not reachable.\n // The purpose of it is to prevent TS errors if ComparisonOperator type gets extended.\n /* istanbul ignore next */\n default:\n return operator;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"i18n-utils.js","sourceRoot":"","sources":["../../../src/property-filter/i18n-utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAiElD,MAAM,UAAU,qBAAqB,CAAC,GAAiC;;IACrE,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAEhD,MAAM,kBAAkB,GAAG,IAAI,CAAC,gCAAgC,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,kBAAkB,CAAC,CAAC;IAC3F,MAAM,gBAAgB,GAAG,IAAI,CAAC,8BAA8B,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,gBAAgB,CAAC,CAAC;IACrF,MAAM,eAAe,GAAG,IAAI,CAAC,6BAA6B,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,eAAe,CAAC,CAAC;IAClF,MAAM,WAAW,GACf,MAAA,IAAI,CACF,yBAAyB,EACzB,GAAG,CAAC,WAAW,EACf,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAChB,MAAM,CAAC;QACL,oBAAoB,EAAE,KAAK,CAAC,aAAa;QACzC,eAAe,EAAE,qBAAqB,CAAC,KAAK,CAAC,QAAQ,CAAC;QACtD,YAAY,EAAE,KAAK,CAAC,KAAK;KA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AAC;QAClD,iEAAiE;QACjE,sFAAsF;QACtF,0BAA0B;QAC1B;YACE,OAAO,EAAE,CAAC;KACb;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,QAA4B;IACzD,QAAQ,QAAQ,EAAE;QAChB,KAAK,GAAG;YACN,OAAO,QAAQ,CAAC;QAClB,KAAK,IAAI;YACP,OAAO,YAAY,CAAC;QACtB,KAAK,GAAG;YACN,OAAO,cAAc,CAAC;QACxB,KAAK,IAAI;YACP,OAAO,oBAAoB,CAAC;QAC9B,KAAK,GAAG;YACN,OAAO,WAAW,CAAC;QACrB,KAAK,IAAI;YACP,OAAO,iBAAiB,CAAC;QAC3B,KAAK,GAAG;YACN,OAAO,UAAU,CAAC;QACpB,KAAK,IAAI;YACP,OAAO,cAAc,CAAC;QACxB,KAAK,GAAG;YACN,OAAO,aAAa,CAAC;QACvB,KAAK,IAAI;YACP,OAAO,iBAAiB,CAAC;QAC3B,iEAAiE;QACjE,sFAAsF;QACtF,0BAA0B;QAC1B;YACE,OAAO,QAAQ,CAAC;KACnB;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PropertyFilterOperation } from '@cloudscape-design/collection-hooks';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { ComparisonOperator, FormattedToken, I18nStrings, InternalToken } from './interfaces';\n\nexport interface InternalTokenGroup {\n operation: PropertyFilterOperation;\n tokens: readonly InternalToken[];\n}\n\nexport interface FormattedTokenGroup {\n tokens: FormattedToken[];\n operation: string;\n operationLabel: string;\n}\n\nexport type I18nStringsOperators = Pick<\n I18nStrings,\n | 'operatorLessText'\n | 'operatorLessOrEqualText'\n | 'operatorGreaterText'\n | 'operatorGreaterOrEqualText'\n | 'operatorContainsText'\n | 'operatorDoesNotContainText'\n | 'operatorEqualsText'\n | 'operatorDoesNotEqualText'\n | 'operatorStartsWithText'\n | 'operatorDoesNotStartWithText'\n>;\n\n// Unreleased i18n properties\nexport interface I18nStringsExt {\n groupEditAriaLabel?: (group: FormattedTokenGroup) => string;\n tokenEditorTokenActionsAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveLabel?: string;\n tokenEditorTokenRemoveFromGroupLabel?: string;\n tokenEditorAddNewTokenLabel?: string;\n tokenEditorAddTokenActionsAriaLabel?: string;\n tokenEditorAddExistingTokenAriaLabel?: (token: FormattedToken) => string;\n tokenEditorAddExistingTokenLabel?: (token: FormattedToken) => string;\n}\n\n// Replacing i18n function with ones taking internal tokens as argument.\nexport type I18nStringsInternal = Omit<I18nStrings, 'formatToken' | 'removeTokenButtonAriaLabel'> &\n Omit<\n I18nStringsExt,\n | 'groupEditAriaLabel'\n | 'tokenEditorTokenActionsAriaLabel'\n | 'tokenEditorTokenRemoveAriaLabel'\n | 'tokenEditorAddExistingTokenAriaLabel'\n | 'tokenEditorAddExistingTokenLabel'\n > & {\n formatToken: (token: InternalToken) => {\n propertyLabel: string;\n operator: string;\n value: string;\n formattedText: string;\n };\n groupEditAriaLabel: (group: InternalTokenGroup) => string;\n removeTokenButtonAriaLabel: (token: InternalToken) => string;\n tokenEditorTokenActionsAriaLabel: (token: InternalToken) => string;\n tokenEditorTokenRemoveAriaLabel: (token: InternalToken) => string;\n tokenEditorAddExistingTokenAriaLabel: (token: InternalToken) => string;\n tokenEditorAddExistingTokenLabel: (token: InternalToken) => string;\n };\n\nexport function usePropertyFilterI18n(def: I18nStrings & I18nStringsExt): I18nStringsInternal {\n const i18n = useInternalI18n('property-filter');\n\n const allPropertiesLabel = i18n('i18nStrings.allPropertiesLabel', def?.allPropertiesLabel);\n const operationAndText = i18n('i18nStrings.operationAndText', def?.operationAndText);\n const operationOrText = i18n('i18nStrings.operationOrText', def?.operationOrText);\n const formatToken =\n i18n(\n 'i18nStrings.formatToken',\n def.formatToken,\n format => token =>\n format({\n token__propertyLabel: token.propertyLabel,\n token__operator: getOperatorI18nString(token.operator),\n token__value: token.value,\n })\n ) ?? (token => `${token.propertyLabel} ${token.operator} ${token.value}`);\n\n function toFormatted(token: InternalToken): FormattedToken {\n const valueFormatter = token.property?.getValueFormatter(token.operator);\n const propertyLabel = token.property ? token.property.propertyLabel : allPropertiesLabel ?? '';\n const tokenValue = valueFormatter ? valueFormatter(token.value) : token.value;\n return { propertyKey: token.property?.propertyKey, propertyLabel, operator: token.operator, value: tokenValue };\n }\n\n return {\n ...def,\n allPropertiesLabel,\n operationAndText,\n operationOrText,\n applyActionText: i18n('i18nStrings.applyActionText', def?.applyActionText),\n cancelActionText: i18n('i18nStrings.cancelActionText', def?.cancelActionText),\n clearFiltersText: i18n('i18nStrings.clearFiltersText', def?.clearFiltersText),\n editTokenHeader: i18n('i18nStrings.editTokenHeader', def?.editTokenHeader),\n groupPropertiesText: i18n('i18nStrings.groupPropertiesText', def?.groupPropertiesText),\n groupValuesText: i18n('i18nStrings.groupValuesText', def?.groupValuesText),\n operatorContainsText: i18n('i18nStrings.operatorContainsText', def?.operatorContainsText),\n operatorDoesNotContainText: i18n('i18nStrings.operatorDoesNotContainText', def?.operatorDoesNotContainText),\n operatorDoesNotEqualText: i18n('i18nStrings.operatorDoesNotEqualText', def?.operatorDoesNotEqualText),\n operatorEqualsText: i18n('i18nStrings.operatorEqualsText', def?.operatorEqualsText),\n operatorGreaterOrEqualText: i18n('i18nStrings.operatorGreaterOrEqualText', def?.operatorGreaterOrEqualText),\n operatorGreaterText: i18n('i18nStrings.operatorGreaterText', def?.operatorGreaterText),\n operatorLessOrEqualText: i18n('i18nStrings.operatorLessOrEqualText', def?.operatorLessOrEqualText),\n operatorLessText: i18n('i18nStrings.operatorLessText', def?.operatorLessText),\n operatorStartsWithText: i18n('i18nStrings.operatorStartsWithText', def?.operatorStartsWithText),\n operatorDoesNotStartWithText: i18n('i18nStrings.operatorDoesNotStartWithText', def?.operatorDoesNotStartWithText),\n operatorText: i18n('i18nStrings.operatorText', def?.operatorText),\n operatorsText: i18n('i18nStrings.operatorsText', def?.operatorsText),\n propertyText: i18n('i18nStrings.propertyText', def?.propertyText),\n tokenLimitShowFewer: i18n('i18nStrings.tokenLimitShowFewer', def?.tokenLimitShowFewer),\n tokenLimitShowMore: i18n('i18nStrings.tokenLimitShowMore', def?.tokenLimitShowMore),\n valueText: i18n('i18nStrings.valueText', def?.valueText),\n tokenEditorTokenRemoveLabel: i18n('i18nStrings.tokenEditorTokenRemoveLabel', def?.tokenEditorTokenRemoveLabel),\n tokenEditorTokenRemoveFromGroupLabel: i18n(\n 'i18nStrings.tokenEditorTokenRemoveFromGroupLabel',\n def?.tokenEditorTokenRemoveFromGroupLabel\n ),\n tokenEditorAddNewTokenLabel: i18n('i18nStrings.tokenEditorAddNewTokenLabel', def?.tokenEditorAddNewTokenLabel),\n tokenEditorAddTokenActionsAriaLabel: i18n(\n 'i18nStrings.tokenEditorAddTokenActionsAriaLabel',\n def?.tokenEditorAddTokenActionsAriaLabel\n ),\n formatToken: token => {\n const formattedToken = toFormatted(token);\n return { ...formattedToken, formattedText: formatToken(toFormatted(token)) };\n },\n groupEditAriaLabel: group => {\n const tokens = group.tokens.map(token => toFormatted(token));\n const operation = group.operation;\n const operationLabel = (operation === 'and' ? operationAndText : operationOrText) ?? '';\n const formatter = i18n(\n 'i18nStrings.groupEditAriaLabel',\n def.groupEditAriaLabel,\n format => () =>\n format({\n group__operationLabel: operationLabel,\n group__formattedTokens__length: tokens.length.toString(),\n group__formattedTokens0__formattedText: tokens[0] ? formatToken(tokens[0]) : '',\n group__formattedTokens1__formattedText: tokens[1] ? formatToken(tokens[0]) : '',\n group__formattedTokens2__formattedText: tokens[2] ? formatToken(tokens[0]) : '',\n group__formattedTokens3__formattedText: tokens[3] ? formatToken(tokens[0]) : '',\n })\n );\n return formatter?.({ operation, operationLabel, tokens }) ?? '';\n },\n removeTokenButtonAriaLabel: token => {\n const formatter = i18n(\n 'i18nStrings.removeTokenButtonAriaLabel',\n def.removeTokenButtonAriaLabel,\n format => () => format({ token__formattedText: formatToken(toFormatted(token)) })\n );\n return formatter?.(toFormatted(token)) ?? '';\n },\n tokenEditorTokenActionsAriaLabel: token => {\n const formatter = i18n(\n 'i18nStrings.tokenEditorTokenActionsAriaLabel',\n def.tokenEditorTokenActionsAriaLabel,\n format => () => format({ token__formattedText: formatToken(toFormatted(token)) })\n );\n return formatter?.(toFormatted(token)) ?? '';\n },\n tokenEditorTokenRemoveAriaLabel: token => {\n const formatter = i18n(\n 'i18nStrings.tokenEditorTokenRemoveAriaLabel',\n def.tokenEditorTokenRemoveAriaLabel,\n format => () => format({ token__formattedText: formatToken(toFormatted(token)) })\n );\n return formatter?.(toFormatted(token)) ?? '';\n },\n tokenEditorAddExistingTokenAriaLabel: token => {\n const formatter = i18n(\n 'i18nStrings.tokenEditorAddExistingTokenAriaLabel',\n def.tokenEditorAddExistingTokenAriaLabel,\n format => () => format({ token__formattedText: formatToken(toFormatted(token)) })\n );\n return formatter?.(toFormatted(token)) ?? '';\n },\n tokenEditorAddExistingTokenLabel: token => {\n const formattedToken = toFormatted(token);\n const formatter = i18n(\n 'i18nStrings.tokenEditorAddExistingTokenLabel',\n def.tokenEditorAddExistingTokenLabel,\n format => () =>\n format({\n token__propertyLabel: formattedToken.propertyLabel,\n token__operator: formattedToken.operator,\n token__value: formattedToken.value,\n })\n );\n return formatter?.(toFormatted(token)) ?? '';\n },\n };\n}\n\nexport function operatorToDescription(operator: ComparisonOperator, i18nStrings: I18nStringsOperators) {\n switch (operator) {\n case '<':\n return i18nStrings.operatorLessText;\n case '<=':\n return i18nStrings.operatorLessOrEqualText;\n case '>':\n return i18nStrings.operatorGreaterText;\n case '>=':\n return i18nStrings.operatorGreaterOrEqualText;\n case ':':\n return i18nStrings.operatorContainsText;\n case '!:':\n return i18nStrings.operatorDoesNotContainText;\n case '=':\n return i18nStrings.operatorEqualsText;\n case '!=':\n return i18nStrings.operatorDoesNotEqualText;\n case '^':\n return i18nStrings.operatorStartsWithText;\n case '!^':\n return i18nStrings.operatorDoesNotStartWithText;\n // The line is ignored from coverage because it is not reachable.\n // The purpose of it is to prevent TS errors if ComparisonOperator type gets extended.\n /* istanbul ignore next */\n default:\n return '';\n }\n}\n\nfunction getOperatorI18nString(operator: ComparisonOperator): string {\n switch (operator) {\n case '=':\n return 'equals';\n case '!=':\n return 'not_equals';\n case '>':\n return 'greater_than';\n case '>=':\n return 'greater_than_equal';\n case '<':\n return 'less_than';\n case '<=':\n return 'less_than_equal';\n case ':':\n return 'contains';\n case '!:':\n return 'not_contains';\n case '^':\n return 'starts_with';\n case '!^':\n return 'not_starts_with';\n // The line is ignored from coverage because it is not reachable.\n // The purpose of it is to prevent TS errors if ComparisonOperator type gets extended.\n /* istanbul ignore next */\n default:\n return operator;\n }\n}\n"]}
|
|
@@ -107,7 +107,7 @@ const PropertyFilterInternal = React.forwardRef((_a, ref) => {
|
|
|
107
107
|
break;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
if (internalFreeText.disabled && !
|
|
110
|
+
if (internalFreeText.disabled && !newToken.property) {
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
addToken(newToken);
|