@cloudscape-design/components 3.0.190 → 3.0.192

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 (98) hide show
  1. package/app-layout/drawer.d.ts +1 -4
  2. package/app-layout/drawer.d.ts.map +1 -1
  3. package/app-layout/drawer.js +4 -13
  4. package/app-layout/drawer.js.map +1 -1
  5. package/app-layout/index.d.ts.map +1 -1
  6. package/app-layout/index.js +4 -15
  7. package/app-layout/index.js.map +1 -1
  8. package/app-layout/mobile-toolbar/index.js +3 -3
  9. package/app-layout/mobile-toolbar/index.js.map +1 -1
  10. package/app-layout/navigation-panel.d.ts +1 -3
  11. package/app-layout/navigation-panel.d.ts.map +1 -1
  12. package/app-layout/navigation-panel.js +2 -2
  13. package/app-layout/navigation-panel.js.map +1 -1
  14. package/app-layout/notifications/index.d.ts +0 -4
  15. package/app-layout/notifications/index.d.ts.map +1 -1
  16. package/app-layout/notifications/index.js +1 -2
  17. package/app-layout/notifications/index.js.map +1 -1
  18. package/app-layout/styles.css.js +26 -38
  19. package/app-layout/styles.scoped.css +34 -109
  20. package/app-layout/styles.selectors.js +26 -38
  21. package/app-layout/tools-and-split-panel.d.ts +1 -8
  22. package/app-layout/tools-and-split-panel.d.ts.map +1 -1
  23. package/app-layout/tools-and-split-panel.js +2 -3
  24. package/app-layout/tools-and-split-panel.js.map +1 -1
  25. package/app-layout/visual-refresh/header.d.ts.map +1 -1
  26. package/app-layout/visual-refresh/header.js +2 -1
  27. package/app-layout/visual-refresh/header.js.map +1 -1
  28. package/app-layout/visual-refresh/notifications.d.ts.map +1 -1
  29. package/app-layout/visual-refresh/notifications.js +2 -1
  30. package/app-layout/visual-refresh/notifications.js.map +1 -1
  31. package/app-layout/visual-refresh/styles.css.js +60 -60
  32. package/app-layout/visual-refresh/styles.scoped.css +150 -148
  33. package/app-layout/visual-refresh/styles.selectors.js +60 -60
  34. package/flashbar/collapsible-flashbar.d.ts.map +1 -1
  35. package/flashbar/collapsible-flashbar.js +5 -7
  36. package/flashbar/collapsible-flashbar.js.map +1 -1
  37. package/flashbar/internal/analytics.d.ts.map +1 -1
  38. package/flashbar/internal/analytics.js +5 -3
  39. package/flashbar/internal/analytics.js.map +1 -1
  40. package/internal/base-component/index.d.ts.map +1 -1
  41. package/internal/base-component/index.js +3 -11
  42. package/internal/base-component/index.js.map +1 -1
  43. package/internal/base-component/init-awsui-versions.d.ts +2 -0
  44. package/internal/base-component/init-awsui-versions.d.ts.map +1 -0
  45. package/internal/base-component/init-awsui-versions.js +15 -0
  46. package/internal/base-component/init-awsui-versions.js.map +1 -0
  47. package/internal/environment.d.ts +1 -0
  48. package/internal/environment.js +2 -1
  49. package/internal/hooks/use-base-component/component-metadata.d.ts +3 -0
  50. package/internal/hooks/use-base-component/component-metadata.d.ts.map +1 -0
  51. package/internal/hooks/use-base-component/component-metadata.js +21 -0
  52. package/internal/hooks/use-base-component/component-metadata.js.map +1 -0
  53. package/internal/hooks/use-base-component/index.d.ts +0 -1
  54. package/internal/hooks/use-base-component/index.d.ts.map +1 -1
  55. package/internal/hooks/use-base-component/index.js +3 -28
  56. package/internal/hooks/use-base-component/index.js.map +1 -1
  57. package/internal/hooks/use-telemetry/index.d.ts.map +1 -1
  58. package/internal/hooks/use-telemetry/index.js +4 -15
  59. package/internal/hooks/use-telemetry/index.js.map +1 -1
  60. package/internal/hooks/use-telemetry/telemetry.d.ts +8 -0
  61. package/internal/hooks/use-telemetry/telemetry.d.ts.map +1 -0
  62. package/internal/hooks/use-telemetry/telemetry.js +20 -0
  63. package/internal/hooks/use-telemetry/telemetry.js.map +1 -0
  64. package/internal/manifest.json +1 -1
  65. package/internal/metrics/index.d.ts +3 -0
  66. package/internal/metrics/index.d.ts.map +1 -0
  67. package/internal/metrics/index.js +5 -0
  68. package/internal/metrics/index.js.map +1 -0
  69. package/internal/metrics/log-clients.d.ts +39 -0
  70. package/internal/metrics/log-clients.d.ts.map +1 -0
  71. package/internal/metrics/log-clients.js +90 -0
  72. package/internal/metrics/log-clients.js.map +1 -0
  73. package/internal/metrics/metrics-formatters.d.ts +7 -0
  74. package/internal/metrics/metrics-formatters.d.ts.map +1 -0
  75. package/internal/metrics/metrics-formatters.js +36 -0
  76. package/internal/metrics/metrics-formatters.js.map +1 -0
  77. package/internal/{metrics.d.ts → metrics/metrics.d.ts} +11 -18
  78. package/internal/metrics/metrics.d.ts.map +1 -0
  79. package/internal/metrics/metrics.js +95 -0
  80. package/internal/metrics/metrics.js.map +1 -0
  81. package/package.json +1 -1
  82. package/property-filter/index.d.ts.map +1 -1
  83. package/property-filter/index.js +1 -1
  84. package/property-filter/index.js.map +1 -1
  85. package/wizard/internal/analytics.d.ts.map +1 -1
  86. package/wizard/internal/analytics.js +5 -3
  87. package/wizard/internal/analytics.js.map +1 -1
  88. package/app-layout/toggle-buttons.d.ts +0 -12
  89. package/app-layout/toggle-buttons.d.ts.map +0 -1
  90. package/app-layout/toggle-buttons.js +0 -13
  91. package/app-layout/toggle-buttons.js.map +0 -1
  92. package/internal/hooks/use-previous-frame/index.d.ts +0 -8
  93. package/internal/hooks/use-previous-frame/index.d.ts.map +0 -1
  94. package/internal/hooks/use-previous-frame/index.js +0 -20
  95. package/internal/hooks/use-previous-frame/index.js.map +0 -1
  96. package/internal/metrics.d.ts.map +0 -1
  97. package/internal/metrics.js +0 -177
  98. package/internal/metrics.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../../src/wizard/internal/analytics.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,IAAM,MAAM,GAAG,YAAY,CAAC;AAE5B,IAAM,eAAe,GAAG,UAAC,SAAiB,IAAK,OAAA,UAAG,MAAM,cAAI,SAAS,CAAE,EAAxB,CAAwB,CAAC;AACxE,IAAM,kBAAkB,GAAG,UAAC,SAAa;IAAb,0BAAA,EAAA,a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AAC,EACzC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,IAC/B,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,EAC1D,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,aAAa,GAAG,UAC3B,eAAuB,EACvB,kBAA0B,EAC1B,MAAoC;IAEpC,IAAM,YAAY,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACzD,IAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IAEvB,OAAO,CAAC,kBAAkB,CAAC;QACzB,YAAY,cAAA;QACZ,WAAW,EAAE,iBAAiB,CAAC,kBAAkB,CAAC;QAClD,SAAS,EAAE,eAAe,CAAC,UAAU,CAAC;QACtC,UAAU,aAAI,MAAM,QAAA,IAAK,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,MAAA,EAAE,CAAC,CAAE;KAC5D,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,SAAiB;IAC3C,IAAM,YAAY,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACnD,8BAA8B;IAC9B,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7B,OAAO,CAAC,kBAAkB,YACxB,YAAY,cAAA,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,EAC1D,CAAC;AACL,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Metrics } from '../../internal/metrics';\nimport { WizardProps } from '../interfaces';\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\nconst timeCache: Record<string, number> = {};\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 timeStart(prefix);\n};\n\nexport const trackStartStep = (stepIndex?: number) => {\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 ...(time !== undefined && { eventValue: time.toString() }),\n });\n};\n\nexport const trackNavigate = (\n activeStepIndex: number,\n requestedStepIndex: number,\n reason: WizardProps.NavigationReason\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 });\n};\n\nexport const trackSubmit = (stepIndex: number) => {\n const eventContext = createEventContext(stepIndex);\n // End the timer of the wizard\n const time = timeEnd(prefix);\n\n Metrics.sendPanoramaMetric({\n eventContext,\n eventDetail: createEventDetail(stepIndex),\n eventType: createEventType('submit'),\n ...(time !== undefined && { eventValue: time.toString() }),\n });\n};\n"]}
1
+ {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../../src/wizard/internal/analytics.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,EAAE,cAAc,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AAiB,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,EAC1D,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 '../../internal/metrics';\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\nconst timeCache: Record<string, number> = {};\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 timeStart(prefix);\n};\n\nexport const trackStartStep = (stepIndex?: number) => {\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 ...(time !== undefined && { eventValue: time.toString() }),\n });\n};\n\nexport const trackNavigate = (\n activeStepIndex: number,\n requestedStepIndex: number,\n reason: WizardProps.NavigationReason\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 });\n};\n\nexport const trackSubmit = (stepIndex: number) => {\n const eventContext = createEventContext(stepIndex);\n // End the timer of the wizard\n const time = timeEnd(prefix);\n\n metrics.sendPanoramaMetric({\n eventContext,\n eventDetail: createEventDetail(stepIndex),\n eventType: createEventType('submit'),\n ...(time !== undefined && { eventValue: time.toString() }),\n });\n};\n"]}
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { AppLayoutProps } from './interfaces';
3
- interface ToggleButtonsProps {
4
- anyPanelOpen: boolean;
5
- children: React.ReactNode;
6
- ariaLabels: AppLayoutProps.Labels | undefined;
7
- isHidden: boolean;
8
- opaqueBackground: boolean;
9
- }
10
- export declare function ToggleButtons({ children, ariaLabels, anyPanelOpen, isHidden, opaqueBackground }: ToggleButtonsProps): JSX.Element;
11
- export {};
12
- //# sourceMappingURL=toggle-buttons.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toggle-buttons.d.ts","sourceRoot":"","sources":["../../../src/app-layout/toggle-buttons.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,UAAU,kBAAkB;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,EAAE,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAC9C,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,eAkBnH"}
@@ -1,13 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import React from 'react';
4
- import clsx from 'clsx';
5
- import SpaceBetween from '../space-between/internal';
6
- import styles from './styles.css.js';
7
- export function ToggleButtons(_a) {
8
- var children = _a.children, ariaLabels = _a.ariaLabels, anyPanelOpen = _a.anyPanelOpen, isHidden = _a.isHidden, opaqueBackground = _a.opaqueBackground;
9
- return (React.createElement("div", { className: clsx(styles['button-toggles-container'], anyPanelOpen && styles['button-toggles-container-open'], isHidden && styles['button-toggles-container-is-hidden'], opaqueBackground && styles['opaque-background']) },
10
- React.createElement("aside", { "aria-label": ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.tools, className: clsx(styles['visual-refresh-toggle'], styles["visual-refresh-toggle-type-tools"]) },
11
- React.createElement(SpaceBetween, { size: "xs" }, children))));
12
- }
13
- //# sourceMappingURL=toggle-buttons.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toggle-buttons.js","sourceRoot":"","sources":["../../../src/app-layout/toggle-buttons.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAWrC,MAAM,UAAU,aAAa,CAAC,EAAsF;QAApF,QAAQ,cAAA,EAAE,UAAU,gBAAA,EAAE,YAAY,kBAAA,EAAE,QAAQ,cAAA,EAAE,gBAAgB,sBAAA;IAC5F,OAAO,CACL,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,0BAA0B,CAAC,EAClC,YAAY,IAAI,MAAM,CAAC,+BAA+B,CAAC,EACvD,QAAQ,IAAI,MAAM,CAAC,oCAAoC,CAAC,EACxD,gBAAgB,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAChD;QAED,6CACc,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,EAC7B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC,kCAAkC,CAAC,CAAC;YAE5F,oBAAC,YAAY,IAAC,IAAI,EAAC,IAAI,IAAE,QAAQ,CAAgB,CAC3C,CACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport SpaceBetween from '../space-between/internal';\nimport styles from './styles.css.js';\nimport { AppLayoutProps } from './interfaces';\n\ninterface ToggleButtonsProps {\n anyPanelOpen: boolean;\n children: React.ReactNode;\n ariaLabels: AppLayoutProps.Labels | undefined;\n isHidden: boolean;\n opaqueBackground: boolean;\n}\n\nexport function ToggleButtons({ children, ariaLabels, anyPanelOpen, isHidden, opaqueBackground }: ToggleButtonsProps) {\n return (\n <div\n className={clsx(\n styles['button-toggles-container'],\n anyPanelOpen && styles['button-toggles-container-open'],\n isHidden && styles['button-toggles-container-is-hidden'],\n opaqueBackground && styles['opaque-background']\n )}\n >\n <aside\n aria-label={ariaLabels?.tools}\n className={clsx(styles['visual-refresh-toggle'], styles[`visual-refresh-toggle-type-tools`])}\n >\n <SpaceBetween size=\"xs\">{children}</SpaceBetween>\n </aside>\n </div>\n );\n}\n"]}
@@ -1,8 +0,0 @@
1
- /**
2
- * This hook provides access to the value of any variable
3
- * from the previous render frame.
4
- * Even if multiple effects are flushed in a single render
5
- * loop, this hook still keeps the original value.
6
- */
7
- export declare const usePreviousFrameValue: <T>(value: T) => T | undefined;
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-previous-frame/index.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,gCASjC,CAAC"}
@@ -1,20 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { useRef, useEffect } from 'react';
4
- /**
5
- * This hook provides access to the value of any variable
6
- * from the previous render frame.
7
- * Even if multiple effects are flushed in a single render
8
- * loop, this hook still keeps the original value.
9
- */
10
- export var usePreviousFrameValue = function (value) {
11
- var ref = useRef();
12
- useEffect(function () {
13
- var handle = requestAnimationFrame(function () {
14
- ref.current = value;
15
- });
16
- return function () { return cancelAnimationFrame(handle); };
17
- });
18
- return ref.current;
19
- };
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-previous-frame/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,IAAM,qBAAqB,GAAG,UAAI,KAAQ;IAC/C,IAAM,GAAG,GAAG,MAAM,EAAK,CAAC;IACxB,SAAS,CAAC;QACR,IAAM,MAAM,GAAG,qBAAqB,CAAC;YACnC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,OAAO,cAAM,OAAA,oBAAoB,CAAC,MAAM,CAAC,EAA5B,CAA4B,CAAC;IAC5C,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useRef, useEffect } from 'react';\n\n/**\n * This hook provides access to the value of any variable\n * from the previous render frame.\n * Even if multiple effects are flushed in a single render\n * loop, this hook still keeps the original value.\n */\nexport const usePreviousFrameValue = <T>(value: T) => {\n const ref = useRef<T>();\n useEffect(() => {\n const handle = requestAnimationFrame(() => {\n ref.current = value;\n });\n return () => cancelAnimationFrame(handle);\n });\n return ref.current;\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACjE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;CACjE;AA8FD,eAAO,MAAM,OAAO;uBACC,MAAM;IAIzB;;;OAGG;2BACoB,MAAM,SAAS,MAAM,WAAW,MAAM,GAAG,IAAI;IAqBpE;;;OAGG;+BACwB,kBAAkB,GAAG,IAAI;6BAoB3B,cAAc,SAAS,MAAM,GAAG,IAAI;iCAIhC,cAAc,SAAS,MAAM,GAAG,IAAI;+BAYtC,MAAM,SAAS,MAAM,WAAW,MAAM,GAAG,IAAI;;oCA4BxC,MAAM;CAUvC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;iDA3KsB,MAAM;wCAIf,MAAM,WAAW,MAAM;CA+KjE,CAAC"}
@@ -1,177 +0,0 @@
1
- import { __assign } from "tslib";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- import { PACKAGE_VERSION } from './environment';
5
- var oneTimeMetrics = {};
6
- // In case we need to override the theme for VR
7
- var theme = '';
8
- function setTheme(newTheme) {
9
- theme = newTheme;
10
- }
11
- // react is the only framework we're using
12
- var framework = 'react';
13
- var buildMetricHash = function (_a) {
14
- var source = _a.source, action = _a.action;
15
- return ["src".concat(source), "action".concat(action)].join('_');
16
- };
17
- var getMajorVersion = function (versionString) {
18
- var majorVersionMatch = versionString.match(/^(\d+\.\d+)/);
19
- return majorVersionMatch ? majorVersionMatch[1] : '';
20
- };
21
- var formatMajorVersionForMetricDetail = function (version) {
22
- return version.replace(/\s/g, '');
23
- };
24
- var formatVersionForMetricName = function (theme, version) {
25
- return "".concat(theme.charAt(0)).concat(getMajorVersion(version).replace('.', ''));
26
- };
27
- var buildMetricDetail = function (_a) {
28
- var source = _a.source, action = _a.action, version = _a.version;
29
- var metricOrigin = typeof AWSUI_METRIC_ORIGIN !== 'undefined' ? AWSUI_METRIC_ORIGIN : 'main';
30
- var detailObject = {
31
- o: metricOrigin,
32
- s: source,
33
- t: theme,
34
- a: action,
35
- f: framework,
36
- v: formatMajorVersionForMetricDetail(version)
37
- };
38
- return JSON.stringify(detailObject);
39
- };
40
- var buildMetricName = function (_a) {
41
- var source = _a.source, version = _a.version;
42
- return ['awsui', source, "".concat(formatVersionForMetricName(theme, version))].join('_');
43
- };
44
- var findPanorama = function (currentWindow) {
45
- try {
46
- if (typeof (currentWindow === null || currentWindow === void 0 ? void 0 : currentWindow.panorama) === 'function') {
47
- return currentWindow === null || currentWindow === void 0 ? void 0 : currentWindow.panorama;
48
- }
49
- if (!currentWindow || currentWindow.parent === currentWindow) {
50
- // When the window has no more parents, it references itself
51
- return undefined;
52
- }
53
- return findPanorama(currentWindow.parent);
54
- }
55
- catch (ex) {
56
- // Most likely a cross-origin access error
57
- return undefined;
58
- }
59
- };
60
- var findAWSC = function (currentWindow) {
61
- try {
62
- if (typeof (currentWindow === null || currentWindow === void 0 ? void 0 : currentWindow.AWSC) === 'object') {
63
- return currentWindow === null || currentWindow === void 0 ? void 0 : currentWindow.AWSC;
64
- }
65
- if (!currentWindow || currentWindow.parent === currentWindow) {
66
- // When the window has no more parents, it references itself
67
- return undefined;
68
- }
69
- return findAWSC(currentWindow.parent);
70
- }
71
- catch (ex) {
72
- // Most likely a cross-origin access error
73
- return undefined;
74
- }
75
- };
76
- export var Metrics = {
77
- initMetrics: function (theme) {
78
- setTheme(theme);
79
- },
80
- /**
81
- * Calls Console Platform's client logging JS API with provided metric name, value, and detail.
82
- * Does nothing if Console Platform client logging JS is not present in page.
83
- */
84
- sendMetric: function (metricName, value, detail) {
85
- if (!theme) {
86
- // Metrics need to be initialized first (initMetrics)
87
- console.error('Metrics need to be initalized first.');
88
- return;
89
- }
90
- if (!metricName || !/^[a-zA-Z0-9_-]{1,32}$/.test(metricName)) {
91
- console.error("Invalid metric name: ".concat(metricName));
92
- return;
93
- }
94
- if (detail && detail.length > 200) {
95
- console.error("Detail for metric ".concat(metricName, " is too long: ").concat(detail));
96
- return;
97
- }
98
- var AWSC = findAWSC(window);
99
- if (typeof AWSC === 'object' && typeof AWSC.Clog === 'object' && typeof AWSC.Clog.log === 'function') {
100
- AWSC.Clog.log(metricName, value, detail);
101
- }
102
- },
103
- /**
104
- * Calls Console Platform's client v2 logging JS API with provided metric name and detail.
105
- * Does nothing if Console Platform client logging JS is not present in page.
106
- */
107
- sendPanoramaMetric: function (metric) {
108
- if (typeof metric.eventDetail === 'object') {
109
- metric.eventDetail = JSON.stringify(metric.eventDetail);
110
- }
111
- if (metric.eventDetail && metric.eventDetail.length > 200) {
112
- console.error("Detail for metric is too long: ".concat(metric.eventDetail));
113
- return;
114
- }
115
- if (typeof metric.eventValue === 'object') {
116
- metric.eventValue = JSON.stringify(metric.eventValue);
117
- }
118
- var panorama = findPanorama(window);
119
- if (typeof panorama === 'function') {
120
- panorama('trackCustomEvent', __assign(__assign({}, metric), { timestamp: Date.now() }));
121
- }
122
- },
123
- sendMetricObject: function (metric, value) {
124
- this.sendMetric(buildMetricName(metric), value, buildMetricDetail(metric));
125
- },
126
- sendMetricObjectOnce: function (metric, value) {
127
- var metricHash = buildMetricHash(metric);
128
- if (!oneTimeMetrics[metricHash]) {
129
- this.sendMetricObject(metric, value);
130
- oneTimeMetrics[metricHash] = true;
131
- }
132
- },
133
- /*
134
- * Calls Console Platform's client logging only the first time the provided metricName is used.
135
- * Subsequent calls with the same metricName are ignored.
136
- */
137
- sendMetricOnce: function (metricName, value, detail) {
138
- if (!oneTimeMetrics[metricName]) {
139
- this.sendMetric(metricName, value, detail);
140
- oneTimeMetrics[metricName] = true;
141
- }
142
- },
143
- /*
144
- * Reports a metric value 1 to Console Platform's client logging service to indicate that the
145
- * component was loaded. The component load event will only be reported as used to client logging
146
- * service once per page view.
147
- */
148
- logComponentLoaded: function () {
149
- this.sendMetricObjectOnce({
150
- source: 'components',
151
- action: 'loaded',
152
- version: PACKAGE_VERSION
153
- }, 1);
154
- },
155
- /*
156
- * Reports a metric value 1 to Console Platform's client logging service to indicate that the
157
- * component was used in the page. A component will only be reported as used to client logging
158
- * service once per page view.
159
- */
160
- logComponentUsed: function (componentName) {
161
- this.sendMetricObjectOnce({
162
- source: componentName,
163
- action: 'used',
164
- version: PACKAGE_VERSION
165
- }, 1);
166
- }
167
- };
168
- export var MetricsTestHelper = {
169
- resetOneTimeMetricsCache: function () {
170
- for (var prop in oneTimeMetrics) {
171
- delete oneTimeMetrics[prop];
172
- }
173
- },
174
- formatMajorVersionForMetricDetail: formatMajorVersionForMetricDetail,
175
- formatVersionForMetricName: formatVersionForMetricName
176
- };
177
- //# sourceMappingURL=metrics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA0BhD,IAAM,cAAc,GAA4B,EAAE,CAAC;AAEnD,+CAA+C;AAC/C,IAAI,KAAK,GAAG,EAAE,CAAC;AACf,SAAS,QAAQ,CAAC,QAAgB;IAChC,KAAK,GAAG,QAAQ,CAAC;AACnB,CAAC;AAED,0CAA0C;AAC1C,IAAM,SAAS,GAAG,OAAO,CAAC;AAE1B,IAAM,eAAe,GAAG,UAAC,EA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E,MAAM;YACd,OAAO,EAAE,eAAe;SACzB,EACD,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,iBAAiB,GAAG;IAC/B,wBAAwB,EAAE;QACxB,KAAK,IAAM,IAAI,IAAI,cAAc,EAAE;YACjC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;SAC7B;IACH,CAAC;IACD,iCAAiC,mCAAA;IACjC,0BAA0B,4BAAA;CAC3B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { PACKAGE_VERSION } from './environment';\n\nexport interface MetricsLogItem {\n source: string;\n action: string;\n version: string;\n}\n\nexport interface MetricsV2EventItem {\n eventType?: string;\n eventContext?: string;\n eventDetail?: string | Record<string, string | number | boolean>;\n eventValue?: string | Record<string, string | number | boolean>;\n}\n\ninterface AWSC {\n Clog: any;\n}\n\ninterface MetricsWindow extends Window {\n AWSC?: AWSC;\n panorama?: any;\n}\n\ndeclare const AWSUI_METRIC_ORIGIN: string | undefined;\n\nconst oneTimeMetrics: Record<string, boolean> = {};\n\n// In case we need to override the theme for VR\nlet theme = '';\nfunction setTheme(newTheme: string) {\n theme = newTheme;\n}\n\n// react is the only framework we're using\nconst framework = 'react';\n\nconst buildMetricHash = ({ source, action }: MetricsLogItem): string => {\n return [`src${source}`, `action${action}`].join('_');\n};\n\nconst getMajorVersion = (versionString: string): string => {\n const majorVersionMatch = versionString.match(/^(\\d+\\.\\d+)/);\n return majorVersionMatch ? majorVersionMatch[1] : '';\n};\n\nconst formatMajorVersionForMetricDetail = (version: string) => {\n return version.replace(/\\s/g, '');\n};\n\nconst formatVersionForMetricName = (theme: string, version: string) => {\n return `${theme.charAt(0)}${getMajorVersion(version).replace('.', '')}`;\n};\n\nconst buildMetricDetail = ({ source, action, version }: MetricsLogItem): string => {\n const metricOrigin = typeof AWSUI_METRIC_ORIGIN !== 'undefined' ? AWSUI_METRIC_ORIGIN : 'main';\n const detailObject = {\n o: metricOrigin,\n s: source,\n t: theme,\n a: action,\n f: framework,\n v: formatMajorVersionForMetricDetail(version),\n };\n return JSON.stringify(detailObject);\n};\n\nconst buildMetricName = ({ source, version }: MetricsLogItem): string => {\n return ['awsui', source, `${formatVersionForMetricName(theme, version)}`].join('_');\n};\n\nconst findPanorama = (currentWindow?: MetricsWindow): any | undefined => {\n try {\n if (typeof currentWindow?.panorama === 'function') {\n return currentWindow?.panorama;\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findPanorama(currentWindow.parent);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n};\n\nconst findAWSC = (currentWindow?: MetricsWindow): AWSC | undefined => {\n try {\n if (typeof currentWindow?.AWSC === 'object') {\n return currentWindow?.AWSC;\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findAWSC(currentWindow.parent);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n};\n\nexport const Metrics = {\n initMetrics(theme: string) {\n setTheme(theme);\n },\n\n /**\n * Calls Console Platform's client logging JS API with provided metric name, value, and detail.\n * Does nothing if Console Platform client logging JS is not present in page.\n */\n sendMetric(metricName: string, value: number, detail?: string): void {\n if (!theme) {\n // Metrics need to be initialized first (initMetrics)\n console.error('Metrics need to be initalized first.');\n return;\n }\n\n if (!metricName || !/^[a-zA-Z0-9_-]{1,32}$/.test(metricName)) {\n console.error(`Invalid metric name: ${metricName}`);\n return;\n }\n if (detail && detail.length > 200) {\n console.error(`Detail for metric ${metricName} is too long: ${detail}`);\n return;\n }\n const AWSC = findAWSC(window);\n if (typeof AWSC === 'object' && typeof AWSC.Clog === 'object' && typeof AWSC.Clog.log === 'function') {\n AWSC.Clog.log(metricName, value, detail);\n }\n },\n\n /**\n * Calls Console Platform's client v2 logging JS API with provided metric name and detail.\n * Does nothing if Console Platform client logging JS is not present in page.\n */\n sendPanoramaMetric(metric: MetricsV2EventItem): void {\n if (typeof metric.eventDetail === 'object') {\n metric.eventDetail = JSON.stringify(metric.eventDetail);\n }\n if (metric.eventDetail && metric.eventDetail.length > 200) {\n console.error(`Detail for metric is too long: ${metric.eventDetail}`);\n return;\n }\n if (typeof metric.eventValue === 'object') {\n metric.eventValue = JSON.stringify(metric.eventValue);\n }\n const panorama = findPanorama(window);\n if (typeof panorama === 'function') {\n panorama('trackCustomEvent', {\n ...metric,\n timestamp: Date.now(),\n });\n }\n },\n\n sendMetricObject(metric: MetricsLogItem, value: number): void {\n this.sendMetric(buildMetricName(metric), value, buildMetricDetail(metric));\n },\n\n sendMetricObjectOnce(metric: MetricsLogItem, value: number): void {\n const metricHash = buildMetricHash(metric);\n if (!oneTimeMetrics[metricHash]) {\n this.sendMetricObject(metric, value);\n oneTimeMetrics[metricHash] = true;\n }\n },\n\n /*\n * Calls Console Platform's client logging only the first time the provided metricName is used.\n * Subsequent calls with the same metricName are ignored.\n */\n sendMetricOnce(metricName: string, value: number, detail?: string): void {\n if (!oneTimeMetrics[metricName]) {\n this.sendMetric(metricName, value, detail);\n oneTimeMetrics[metricName] = true;\n }\n },\n\n /*\n * Reports a metric value 1 to Console Platform's client logging service to indicate that the\n * component was loaded. The component load event will only be reported as used to client logging\n * service once per page view.\n */\n logComponentLoaded() {\n this.sendMetricObjectOnce(\n {\n source: 'components',\n action: 'loaded',\n version: PACKAGE_VERSION,\n },\n 1\n );\n },\n\n /*\n * Reports a metric value 1 to Console Platform's client logging service to indicate that the\n * component was used in the page. A component will only be reported as used to client logging\n * service once per page view.\n */\n logComponentUsed(componentName: string) {\n this.sendMetricObjectOnce(\n {\n source: componentName,\n action: 'used',\n version: PACKAGE_VERSION,\n },\n 1\n );\n },\n};\n\nexport const MetricsTestHelper = {\n resetOneTimeMetricsCache: () => {\n for (const prop in oneTimeMetrics) {\n delete oneTimeMetrics[prop];\n }\n },\n formatMajorVersionForMetricDetail,\n formatVersionForMetricName,\n};\n"]}