@cloudscape-design/components 3.0.289 → 3.0.291

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.
Files changed (45) hide show
  1. package/bar-chart/index.d.ts.map +1 -1
  2. package/bar-chart/index.js +1 -1
  3. package/bar-chart/index.js.map +1 -1
  4. package/bar-chart/interfaces.d.ts +6 -1
  5. package/bar-chart/interfaces.d.ts.map +1 -1
  6. package/bar-chart/interfaces.js.map +1 -1
  7. package/button/index.d.ts.map +1 -1
  8. package/button/index.js +2 -2
  9. package/button/index.js.map +1 -1
  10. package/button/interfaces.d.ts +5 -1
  11. package/button/interfaces.d.ts.map +1 -1
  12. package/button/interfaces.js.map +1 -1
  13. package/button/internal.d.ts.map +1 -1
  14. package/button/internal.js +2 -1
  15. package/button/internal.js.map +1 -1
  16. package/button/styles.css.js +19 -18
  17. package/button/styles.scoped.css +140 -136
  18. package/button/styles.selectors.js +19 -18
  19. package/collection-preferences/interfaces.d.ts +6 -2
  20. package/collection-preferences/interfaces.d.ts.map +1 -1
  21. package/collection-preferences/interfaces.js.map +1 -1
  22. package/flashbar/flash.d.ts.map +1 -1
  23. package/flashbar/flash.js +1 -1
  24. package/flashbar/flash.js.map +1 -1
  25. package/internal/environment.js +1 -1
  26. package/internal/manifest.json +1 -1
  27. package/mixed-line-bar-chart/interfaces.d.ts +5 -0
  28. package/mixed-line-bar-chart/interfaces.d.ts.map +1 -1
  29. package/mixed-line-bar-chart/interfaces.js.map +1 -1
  30. package/package.json +1 -1
  31. package/wizard/index.d.ts +2 -1
  32. package/wizard/index.d.ts.map +1 -1
  33. package/wizard/index.js +11 -77
  34. package/wizard/index.js.map +1 -1
  35. package/wizard/internal.d.ts +7 -0
  36. package/wizard/internal.d.ts.map +1 -0
  37. package/wizard/internal.js +82 -0
  38. package/wizard/internal.js.map +1 -0
  39. package/wizard/wizard-form.d.ts.map +1 -1
  40. package/wizard/wizard-form.js +3 -1
  41. package/wizard/wizard-form.js.map +1 -1
  42. package/wizard/internal/analytics.d.ts +0 -8
  43. package/wizard/internal/analytics.d.ts.map +0 -1
  44. package/wizard/internal/analytics.js +0 -68
  45. package/wizard/internal/analytics.js.map +0 -1
@@ -9,6 +9,7 @@ import WizardActions from './wizard-actions';
9
9
  import WizardFormHeader from './wizard-form-header';
10
10
  import styles from './styles.css.js';
11
11
  import { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';
12
+ import { AnalyticsFunnelStep } from '../internal/analytics/components/analytics-funnel';
12
13
  export default function WizardForm({ steps, activeStepIndex, isVisualRefresh, showCollapsedSteps, i18nStrings, isPrimaryLoading, allowSkipTo, secondaryActions, onCancelClick, onPreviousClick, onPrimaryClick, onSkipToClick, }) {
13
14
  var _a;
14
15
  const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};
@@ -33,7 +34,8 @@ export default function WizardForm({ steps, activeStepIndex, isVisualRefresh, sh
33
34
  React.createElement("span", { className: styles['form-header-component-wrapper'], tabIndex: -1, ref: stepHeaderRef },
34
35
  title,
35
36
  isOptional && React.createElement("i", null, ` - ${i18nStrings.optional}`)))),
36
- React.createElement(InternalForm, { className: clsx(styles['form-component']), actions: React.createElement(WizardActions, { cancelButtonText: i18nStrings.cancelButton, primaryButtonText: isLastStep ? i18nStrings.submitButton : i18nStrings.nextButton, primaryButtonLoadingText: isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement, previousButtonText: i18nStrings.previousButton, onCancelClick: onCancelClick, onPreviousClick: onPreviousClick, onPrimaryClick: onPrimaryClick, onSkipToClick: () => onSkipToClick(skipToTargetIndex), showPrevious: activeStepIndex !== 0, isPrimaryLoading: isPrimaryLoading, showSkipTo: showSkipTo, skipToButtonText: skipToButtonText }), secondaryActions: secondaryActions, errorText: errorText, errorIconAriaLabel: i18nStrings.errorIconAriaLabel }, content)));
37
+ React.createElement(AnalyticsFunnelStep, { stepNameSelector: `.${styles['form-header-component-wrapper']}`, stepNumber: activeStepIndex + 1 },
38
+ React.createElement(InternalForm, { className: clsx(styles['form-component']), actions: React.createElement(WizardActions, { cancelButtonText: i18nStrings.cancelButton, primaryButtonText: isLastStep ? i18nStrings.submitButton : i18nStrings.nextButton, primaryButtonLoadingText: isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement, previousButtonText: i18nStrings.previousButton, onCancelClick: onCancelClick, onPreviousClick: onPreviousClick, onPrimaryClick: onPrimaryClick, onSkipToClick: () => onSkipToClick(skipToTargetIndex), showPrevious: activeStepIndex !== 0, isPrimaryLoading: isPrimaryLoading, showSkipTo: showSkipTo, skipToButtonText: skipToButtonText }), secondaryActions: secondaryActions, errorText: errorText, errorIconAriaLabel: i18nStrings.errorIconAriaLabel }, content))));
37
39
  }
38
40
  function findSkipToTargetIndex(steps, activeStepIndex) {
39
41
  let nextRequiredStepIndex = activeStepIndex;
@@ -1 +1 @@
1
- {"version":3,"file":"wizard-form.js","sourceRoot":"lib/default/","sources":["wizard/wizard-form.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAiB3E,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,a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,IAAI,qBAAqB,GAAG,eAAe,CAAC;IAC5C,GAAG;QACD,qBAAqB,EAAE,CAAC;KACzB,QAAQ,qBAAqB,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,UAAU,EAAE;IAE9F,OAAO,qBAAqB,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport InternalForm from '../form/internal';\nimport InternalHeader from '../header/internal';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport WizardActions from './wizard-actions';\nimport { WizardProps } from './interfaces';\nimport WizardFormHeader from './wizard-form-header';\nimport styles from './styles.css.js';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\n\ninterface WizardFormProps {\n steps: ReadonlyArray<WizardProps.Step>;\n activeStepIndex: number;\n isVisualRefresh: boolean;\n showCollapsedSteps: boolean;\n i18nStrings: WizardProps.I18nStrings;\n isPrimaryLoading: boolean;\n allowSkipTo: boolean;\n secondaryActions?: React.ReactNode;\n onCancelClick: () => void;\n onPreviousClick: () => void;\n onPrimaryClick: () => void;\n onSkipToClick: (stepIndex: number) => void;\n}\n\nexport default function WizardForm({\n steps,\n activeStepIndex,\n isVisualRefresh,\n showCollapsedSteps,\n i18nStrings,\n isPrimaryLoading,\n allowSkipTo,\n secondaryActions,\n onCancelClick,\n onPreviousClick,\n onPrimaryClick,\n onSkipToClick,\n}: WizardFormProps) {\n const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};\n const isLastStep = activeStepIndex >= steps.length - 1;\n const skipToTargetIndex = findSkipToTargetIndex(steps, activeStepIndex);\n const isMobile = useMobile();\n const stepHeaderRef = useRef<HTMLDivElement | null>(null);\n\n useEffectOnUpdate(() => {\n if (stepHeaderRef && stepHeaderRef.current) {\n stepHeaderRef.current?.focus();\n }\n }, [activeStepIndex]);\n\n const showSkipTo = allowSkipTo && skipToTargetIndex !== -1;\n const skipToButtonText =\n skipToTargetIndex !== -1 && i18nStrings.skipToButtonLabel\n ? i18nStrings.skipToButtonLabel(steps[skipToTargetIndex], skipToTargetIndex + 1)\n : undefined;\n\n return (\n <>\n <WizardFormHeader isMobile={isMobile || showCollapsedSteps} isVisualRefresh={isVisualRefresh}>\n <div\n className={clsx(\n styles['collapsed-steps'],\n !showCollapsedSteps && styles['collapsed-steps-hidden'],\n isVisualRefresh && isMobile && styles['collapsed-steps-extra-padding']\n )}\n >\n {i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length)}\n </div>\n <InternalHeader className={styles['form-header-component']} variant=\"h1\" description={description} info={info}>\n <span className={styles['form-header-component-wrapper']} tabIndex={-1} ref={stepHeaderRef}>\n {title}\n {isOptional && <i>{` - ${i18nStrings.optional}`}</i>}\n </span>\n </InternalHeader>\n </WizardFormHeader>\n <InternalForm\n className={clsx(styles['form-component'])}\n actions={\n <WizardActions\n cancelButtonText={i18nStrings.cancelButton}\n primaryButtonText={isLastStep ? i18nStrings.submitButton : i18nStrings.nextButton}\n primaryButtonLoadingText={\n isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement\n }\n previousButtonText={i18nStrings.previousButton}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onPrimaryClick={onPrimaryClick}\n onSkipToClick={() => onSkipToClick(skipToTargetIndex)}\n showPrevious={activeStepIndex !== 0}\n isPrimaryLoading={isPrimaryLoading}\n showSkipTo={showSkipTo}\n skipToButtonText={skipToButtonText}\n />\n }\n secondaryActions={secondaryActions}\n errorText={errorText}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n >\n {content}\n </InternalForm>\n </>\n );\n}\n\nfunction findSkipToTargetIndex(steps: ReadonlyArray<WizardProps.Step>, activeStepIndex: number): number {\n let nextRequiredStepIndex = activeStepIndex;\n do {\n nextRequiredStepIndex++;\n } while (nextRequiredStepIndex < steps.length - 1 && steps[nextRequiredStepIndex].isOptional);\n\n return nextRequiredStepIndex > activeStepIndex + 1 ? nextRequiredStepIndex : -1;\n}\n"]}
1
+ {"version":3,"file":"wizard-form.js","sourceRoot":"lib/default/","sources":["wizard/wizard-form.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAiBxF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,cAAc,EACd,aAAa,GACG;;IAChB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IAClG,MAAM,UAAU,GAAG,eAAe,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACvD,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IAC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GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport InternalForm from '../form/internal';\nimport InternalHeader from '../header/internal';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport WizardActions from './wizard-actions';\nimport { WizardProps } from './interfaces';\nimport WizardFormHeader from './wizard-form-header';\nimport styles from './styles.css.js';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { AnalyticsFunnelStep } from '../internal/analytics/components/analytics-funnel';\n\ninterface WizardFormProps {\n steps: ReadonlyArray<WizardProps.Step>;\n activeStepIndex: number;\n isVisualRefresh: boolean;\n showCollapsedSteps: boolean;\n i18nStrings: WizardProps.I18nStrings;\n isPrimaryLoading: boolean;\n allowSkipTo: boolean;\n secondaryActions?: React.ReactNode;\n onCancelClick: () => void;\n onPreviousClick: () => void;\n onPrimaryClick: () => void;\n onSkipToClick: (stepIndex: number) => void;\n}\n\nexport default function WizardForm({\n steps,\n activeStepIndex,\n isVisualRefresh,\n showCollapsedSteps,\n i18nStrings,\n isPrimaryLoading,\n allowSkipTo,\n secondaryActions,\n onCancelClick,\n onPreviousClick,\n onPrimaryClick,\n onSkipToClick,\n}: WizardFormProps) {\n const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};\n const isLastStep = activeStepIndex >= steps.length - 1;\n const skipToTargetIndex = findSkipToTargetIndex(steps, activeStepIndex);\n const isMobile = useMobile();\n const stepHeaderRef = useRef<HTMLDivElement | null>(null);\n\n useEffectOnUpdate(() => {\n if (stepHeaderRef && stepHeaderRef.current) {\n stepHeaderRef.current?.focus();\n }\n }, [activeStepIndex]);\n\n const showSkipTo = allowSkipTo && skipToTargetIndex !== -1;\n const skipToButtonText =\n skipToTargetIndex !== -1 && i18nStrings.skipToButtonLabel\n ? i18nStrings.skipToButtonLabel(steps[skipToTargetIndex], skipToTargetIndex + 1)\n : undefined;\n\n return (\n <>\n <WizardFormHeader isMobile={isMobile || showCollapsedSteps} isVisualRefresh={isVisualRefresh}>\n <div\n className={clsx(\n styles['collapsed-steps'],\n !showCollapsedSteps && styles['collapsed-steps-hidden'],\n isVisualRefresh && isMobile && styles['collapsed-steps-extra-padding']\n )}\n >\n {i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length)}\n </div>\n <InternalHeader className={styles['form-header-component']} variant=\"h1\" description={description} info={info}>\n <span className={styles['form-header-component-wrapper']} tabIndex={-1} ref={stepHeaderRef}>\n {title}\n {isOptional && <i>{` - ${i18nStrings.optional}`}</i>}\n </span>\n </InternalHeader>\n </WizardFormHeader>\n <AnalyticsFunnelStep\n stepNameSelector={`.${styles['form-header-component-wrapper']}`}\n stepNumber={activeStepIndex + 1}\n >\n <InternalForm\n className={clsx(styles['form-component'])}\n actions={\n <WizardActions\n cancelButtonText={i18nStrings.cancelButton}\n primaryButtonText={isLastStep ? i18nStrings.submitButton : i18nStrings.nextButton}\n primaryButtonLoadingText={\n isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement\n }\n previousButtonText={i18nStrings.previousButton}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onPrimaryClick={onPrimaryClick}\n onSkipToClick={() => onSkipToClick(skipToTargetIndex)}\n showPrevious={activeStepIndex !== 0}\n isPrimaryLoading={isPrimaryLoading}\n showSkipTo={showSkipTo}\n skipToButtonText={skipToButtonText}\n />\n }\n secondaryActions={secondaryActions}\n errorText={errorText}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n >\n {content}\n </InternalForm>\n </AnalyticsFunnelStep>\n </>\n );\n}\n\nfunction findSkipToTargetIndex(steps: ReadonlyArray<WizardProps.Step>, activeStepIndex: number): number {\n let nextRequiredStepIndex = activeStepIndex;\n do {\n nextRequiredStepIndex++;\n } while (nextRequiredStepIndex < steps.length - 1 && steps[nextRequiredStepIndex].isOptional);\n\n return nextRequiredStepIndex > activeStepIndex + 1 ? nextRequiredStepIndex : -1;\n}\n"]}
@@ -1,8 +0,0 @@
1
- import { WizardProps } from '../interfaces';
2
- export declare const trackStartWizard: () => void;
3
- export declare const trackEndWizard: (funnelId: string | undefined) => void;
4
- export declare const trackStartStep: (stepIndex: number, funnelId?: string) => void;
5
- export declare const trackNavigate: (activeStepIndex: number, requestedStepIndex: number, reason: WizardProps.NavigationReason, funnelId?: string) => void;
6
- export declare const trackSubmit: (stepIndex: number, funnelId?: string) => void;
7
- export declare const trackCancel: (stepIndex: number, funnelId?: string) => void;
8
- //# sourceMappingURL=analytics.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"lib/default/","sources":["wizard/internal/analytics.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAmC5C,eAAO,MAAM,gBAAgB,YAM5B,CAAC;AAEF,eAAO,MAAM,cAAc,aAAc,MAAM,GAAG,SAAS,SAY1D,CAAC;AAEF,eAAO,MAAM,cAAc,cAAe,MAAM,aAAa,MAAM,SAiBlE,CAAC;AAEF,eAAO,MAAM,aAAa,oBACP,MAAM,sBACH,MAAM,UAClB,YAAY,gBAAgB,aACzB,MAAM,SAYlB,CAAC;AAEF,eAAO,MAAM,WAAW,cAAe,MAAM,aAAa,MAAM,SAY/D,CAAC;AAEF,eAAO,MAAM,WAAW,cAAe,MAAM,aAAa,MAAM,SAY/D,CAAC"}
@@ -1,68 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { PACKAGE_SOURCE, PACKAGE_VERSION } from '../../internal/environment';
4
- import { Metrics } from '@cloudscape-design/component-toolkit/internal';
5
- const metrics = new Metrics(PACKAGE_SOURCE, PACKAGE_VERSION);
6
- const prefix = 'csa_wizard';
7
- const createEventType = (eventType) => `${prefix}_${eventType}`;
8
- const createEventContext = (stepIndex = 0) => `${prefix}_step${stepIndex + 1}`;
9
- const createEventDetail = (stepIndex = 0) => `step${stepIndex + 1}`;
10
- // A custom time cache is used to not clear the timer between navigation attempts
11
- // This allows us the ability to track time to attempt each step as well as the time to complete
12
- // each step
13
- let timeCache;
14
- let currentStepIndex;
15
- let success;
16
- const timeStart = (key = 'current') => {
17
- timeCache[key] = Date.now();
18
- };
19
- const timeEnd = (key = 'current', clear = false) => {
20
- const start = timeCache[key];
21
- // No start time is available when starting the first step
22
- if (!start) {
23
- return undefined;
24
- }
25
- if (clear) {
26
- delete timeCache[key];
27
- }
28
- return (Date.now() - start) / 1000; // Convert to seconds
29
- };
30
- export const trackStartWizard = () => {
31
- timeCache = {};
32
- currentStepIndex = 0;
33
- success = false;
34
- timeStart(prefix);
35
- };
36
- export const trackEndWizard = (funnelId) => {
37
- // End the timer of the wizard
38
- const time = timeEnd(prefix, true);
39
- const eventContext = createEventContext(currentStepIndex);
40
- metrics.sendPanoramaMetric(Object.assign(Object.assign({ eventContext, eventDetail: `${success}`, eventType: createEventType('end') }, (time !== undefined && { eventValue: time.toString() })), (funnelId && { funnel: funnelId })));
41
- };
42
- export const trackStartStep = (stepIndex, funnelId) => {
43
- currentStepIndex = stepIndex;
44
- const eventContext = createEventContext(stepIndex);
45
- // End the timer of the previous step
46
- const time = timeEnd();
47
- // Start a new timer of the current step
48
- timeStart();
49
- metrics.sendPanoramaMetric(Object.assign(Object.assign({ eventContext, eventDetail: createEventDetail(stepIndex), eventType: createEventType('step') }, (funnelId && { funnel: funnelId })), (time !== undefined && { eventValue: time.toString() })));
50
- };
51
- export const trackNavigate = (activeStepIndex, requestedStepIndex, reason, funnelId) => {
52
- const eventContext = createEventContext(activeStepIndex);
53
- const time = timeEnd();
54
- metrics.sendPanoramaMetric(Object.assign({ eventContext, eventDetail: createEventDetail(requestedStepIndex), eventType: createEventType('navigate'), eventValue: Object.assign({ reason }, (time !== undefined && { time })) }, (funnelId && { funnel: funnelId })));
55
- };
56
- export const trackSubmit = (stepIndex, funnelId) => {
57
- success = true;
58
- const time = timeEnd(prefix);
59
- const eventContext = createEventContext(stepIndex);
60
- metrics.sendPanoramaMetric(Object.assign(Object.assign({ eventContext, eventDetail: createEventDetail(stepIndex), eventType: createEventType('submit') }, (time !== undefined && { eventValue: time.toString() })), (funnelId && { funnel: funnelId })));
61
- };
62
- export const trackCancel = (stepIndex, funnelId) => {
63
- success = false;
64
- const time = timeEnd(prefix);
65
- const eventContext = createEventContext(stepIndex);
66
- metrics.sendPanoramaMetric(Object.assign(Object.assign({ eventContext, eventDetail: createEventDetail(stepIndex), eventType: createEventType('cancel') }, (time !== undefined && { eventValue: time.toString() })), (funnelId && { funnel: funnelId })));
67
- };
68
- //# sourceMappingURL=analytics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"lib/default/","sources":["wizard/internal/analytics.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAGxE,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAE7D,MAAM,MAAM,GAAG,YAAY,CAAC;AAE5B,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,GAAG,MAAM,IAAI,SAAS,EAAE,CAAC;AACxE,MAAM,kBAAkB,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,QAAQ,SAAS,GAAG,CAAC,EAAE,CAAC;AAC/E,MAAM,iBAAiB,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE,EAAE,CAAC,OAAO,SAAS,GAAG,CAAC,EAAE,CAAC;AAEpE,iFAAiF;AACjF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,CAAC,SAAiB,EAAE,QAAiB,EAAE,EAAE;IAClE,OAAO,GAAG,IAAI,CAAC;IACf,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,YAAY,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAEnD,OAAO,CAAC,kBAAkB,+BACxB,YAAY,EACZ,WAAW,EAAE,iBAAiB,CAAC,SAAS,CAAC,EACzC,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC,IACjC,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,GACvD,CAAC,QAAQ,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EACrC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAE,QAAiB,EAAE,EAAE;IAClE,OAAO,GAAG,KAAK,CAAC;IAChB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,YAAY,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAEnD,OAAO,CAAC,kBAAkB,+BACxB,YAAY,EACZ,WAAW,EAAE,iBAAiB,CAAC,SAAS,CAAC,EACzC,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC,IACjC,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,GACvD,CAAC,QAAQ,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EACrC,CAAC;AACL,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PACKAGE_SOURCE, PACKAGE_VERSION } from '../../internal/environment';\nimport { Metrics } from '@cloudscape-design/component-toolkit/internal';\nimport { WizardProps } from '../interfaces';\n\nconst metrics = new Metrics(PACKAGE_SOURCE, PACKAGE_VERSION);\n\nconst prefix = 'csa_wizard';\n\nconst createEventType = (eventType: string) => `${prefix}_${eventType}`;\nconst createEventContext = (stepIndex = 0) => `${prefix}_step${stepIndex + 1}`;\nconst createEventDetail = (stepIndex = 0) => `step${stepIndex + 1}`;\n\n// A custom time cache is used to not clear the timer between navigation attempts\n// This allows us the ability to track time to attempt each step as well as the time to complete\n// each step\nlet timeCache: Record<string, number>;\nlet currentStepIndex: number;\nlet success: boolean;\n\nconst timeStart = (key = 'current') => {\n timeCache[key] = Date.now();\n};\n\nconst timeEnd = (key = 'current', clear = false) => {\n const start = timeCache[key];\n // No start time is available when starting the first step\n if (!start) {\n return undefined;\n }\n\n if (clear) {\n delete timeCache[key];\n }\n\n return (Date.now() - start) / 1000; // Convert to seconds\n};\n\nexport const trackStartWizard = () => {\n timeCache = {};\n currentStepIndex = 0;\n success = false;\n\n timeStart(prefix);\n};\n\nexport const trackEndWizard = (funnelId: string | undefined) => {\n // End the timer of the wizard\n const time = timeEnd(prefix, true);\n\n const eventContext = createEventContext(currentStepIndex);\n metrics.sendPanoramaMetric({\n eventContext,\n eventDetail: `${success}`,\n eventType: createEventType('end'),\n ...(time !== undefined && { eventValue: time.toString() }),\n ...(funnelId && { funnel: funnelId }),\n });\n};\n\nexport const trackStartStep = (stepIndex: number, funnelId?: string) => {\n currentStepIndex = stepIndex;\n const eventContext = createEventContext(stepIndex);\n\n // End the timer of the previous step\n const time = timeEnd();\n\n // Start a new timer of the current step\n timeStart();\n\n metrics.sendPanoramaMetric({\n eventContext,\n eventDetail: createEventDetail(stepIndex),\n eventType: createEventType('step'),\n ...(funnelId && { funnel: funnelId }),\n ...(time !== undefined && { eventValue: time.toString() }),\n });\n};\n\nexport const trackNavigate = (\n activeStepIndex: number,\n requestedStepIndex: number,\n reason: WizardProps.NavigationReason,\n funnelId?: string\n) => {\n const eventContext = createEventContext(activeStepIndex);\n const time = timeEnd();\n\n metrics.sendPanoramaMetric({\n eventContext,\n eventDetail: createEventDetail(requestedStepIndex),\n eventType: createEventType('navigate'),\n eventValue: { reason, ...(time !== undefined && { time }) },\n ...(funnelId && { funnel: funnelId }),\n });\n};\n\nexport const trackSubmit = (stepIndex: number, funnelId?: string) => {\n success = true;\n const time = timeEnd(prefix);\n const eventContext = createEventContext(stepIndex);\n\n metrics.sendPanoramaMetric({\n eventContext,\n eventDetail: createEventDetail(stepIndex),\n eventType: createEventType('submit'),\n ...(time !== undefined && { eventValue: time.toString() }),\n ...(funnelId && { funnel: funnelId }),\n });\n};\n\nexport const trackCancel = (stepIndex: number, funnelId?: string) => {\n success = false;\n const time = timeEnd(prefix);\n const eventContext = createEventContext(stepIndex);\n\n metrics.sendPanoramaMetric({\n eventContext,\n eventDetail: createEventDetail(stepIndex),\n eventType: createEventType('cancel'),\n ...(time !== undefined && { eventValue: time.toString() }),\n ...(funnelId && { funnel: funnelId }),\n });\n};\n"]}