@levi-gemcommerce/analytics 1.0.0-dev.16 → 1.0.0-dev.17

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 (27) hide show
  1. package/dist/esm/components/GTimePicker/hooks/useDateTimeFilter.d.ts +2 -2
  2. package/dist/esm/core/gemxql/helpers/extractQueryData.d.ts +1 -1
  3. package/dist/esm/gemxql.js +2 -1
  4. package/dist/esm/gemxql.mjs +2 -1
  5. package/dist/esm/hooks/index.d.ts +2 -1
  6. package/dist/esm/hooks/useFetchCurrencyRates.d.ts +1 -0
  7. package/dist/esm/index.d.ts +2 -0
  8. package/dist/esm/index.js +98 -65
  9. package/dist/esm/index.mjs +98 -65
  10. package/dist/esm/providers/index.d.ts +0 -3
  11. package/dist/esm/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getDonutChartTooltipPosition.d.ts +1 -1
  12. package/dist/esm/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getLineChartTooltipPosition.d.ts +1 -1
  13. package/dist/esm/stores/currencyRatesStore.d.ts +7 -0
  14. package/dist/esm/stores/index.d.ts +2 -0
  15. package/dist/umd/esm/components/GTimePicker/hooks/useDateTimeFilter.d.ts +2 -2
  16. package/dist/umd/esm/core/gemxql/helpers/extractQueryData.d.ts +1 -1
  17. package/dist/umd/esm/hooks/index.d.ts +2 -1
  18. package/dist/umd/esm/hooks/useFetchCurrencyRates.d.ts +1 -0
  19. package/dist/umd/esm/index.d.ts +2 -0
  20. package/dist/umd/esm/providers/index.d.ts +0 -3
  21. package/dist/umd/esm/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getDonutChartTooltipPosition.d.ts +1 -1
  22. package/dist/umd/esm/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getLineChartTooltipPosition.d.ts +1 -1
  23. package/dist/umd/esm/stores/currencyRatesStore.d.ts +7 -0
  24. package/dist/umd/esm/stores/index.d.ts +2 -0
  25. package/dist/umd/gemxql.js +1 -1
  26. package/dist/umd/index.js +1 -1
  27. package/package.json +1 -1
@@ -4,14 +4,14 @@ export declare const useDateTimeFilter: () => {
4
4
  LAST_7_DAYS_DATE_RANGE: {
5
5
  since: string | number;
6
6
  until: string | number;
7
- getDateRange: (date: import("dayjs").Dayjs) => import("../types").IDateTimeFilterValue;
7
+ getDateRange: (date: import("dayjs").Dayjs) => import("..").IDateTimeFilterValue;
8
8
  title: string;
9
9
  alias: string;
10
10
  };
11
11
  LAST_30_DAYS_DATE_RANGE: {
12
12
  since: string | number;
13
13
  until: string | number;
14
- getDateRange: (date: import("dayjs").Dayjs) => import("../types").IDateTimeFilterValue;
14
+ getDateRange: (date: import("dayjs").Dayjs) => import("..").IDateTimeFilterValue;
15
15
  title: string;
16
16
  alias: string;
17
17
  };
@@ -1,5 +1,5 @@
1
1
  import type { GemxQlQueryResponse, TableDataType } from '../graphql';
2
2
  export type ColumnTypesMap = Record<string, TableDataType>;
3
3
  export declare const extractQueryRows: (response?: GemxQlQueryResponse) => Record<string, unknown>[];
4
- export declare const extractQueryColumns: (response?: GemxQlQueryResponse) => import("../graphql").Maybe<Pick<import("../graphql").IColumn, "dataType" | "displayName" | "name">>[];
4
+ export declare const extractQueryColumns: (response?: GemxQlQueryResponse) => import("..").Maybe<Pick<import("..").IColumn, "dataType" | "displayName" | "name">>[];
5
5
  export declare const extractColumnTypes: (response?: GemxQlQueryResponse) => ColumnTypesMap;
@@ -4,8 +4,8 @@ import timezone from 'dayjs/plugin/timezone.js';
4
4
  import utc from 'dayjs/plugin/utc.js';
5
5
  import { useQuery } from '@tanstack/react-query';
6
6
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
7
- import { createContext, useContext, useState, useRef, useCallback, useEffect } from 'react';
8
7
  import { create } from 'zustand';
8
+ import { createContext, useContext, useState, useRef, useCallback, useEffect } from 'react';
9
9
 
10
10
  const NONE_VALUE = 'None';
11
11
  const PLACEHOLDER_VALUE = '-';
@@ -1130,6 +1130,7 @@ const useConvertMoneyContext = () => useContext(ConvertMoneyContext);
1130
1130
  const useAnalyticData = () => {
1131
1131
  const { getTextPrice } = useConvertMoneyContext();
1132
1132
  const formatData = ({ value, formatter, name }) => {
1133
+ console.log({ value, formatter, getTextPrice, name });
1133
1134
  return formatAnalyticData({ value, formatter, getTextPrice, name });
1134
1135
  };
1135
1136
  const computeMetric = ({ metric, previousMetric, metricKey, formatter, }) => {
@@ -4,8 +4,8 @@ import timezone from 'dayjs/plugin/timezone.js';
4
4
  import utc from 'dayjs/plugin/utc.js';
5
5
  import { useQuery } from '@tanstack/react-query';
6
6
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
7
- import { createContext, useContext, useState, useRef, useCallback, useEffect } from 'react';
8
7
  import { create } from 'zustand';
8
+ import { createContext, useContext, useState, useRef, useCallback, useEffect } from 'react';
9
9
 
10
10
  const NONE_VALUE = 'None';
11
11
  const PLACEHOLDER_VALUE = '-';
@@ -1130,6 +1130,7 @@ const useConvertMoneyContext = () => useContext(ConvertMoneyContext);
1130
1130
  const useAnalyticData = () => {
1131
1131
  const { getTextPrice } = useConvertMoneyContext();
1132
1132
  const formatData = ({ value, formatter, name }) => {
1133
+ console.log({ value, formatter, getTextPrice, name });
1133
1134
  return formatAnalyticData({ value, formatter, getTextPrice, name });
1134
1135
  };
1135
1136
  const computeMetric = ({ metric, previousMetric, metricKey, formatter, }) => {
@@ -1,5 +1,6 @@
1
1
  export { useEnhancedEffect } from './useEnhancedEffect';
2
- export { useToggle } from './useToggle';
2
+ export { useFetchCurrencyRates } from './useFetchCurrencyRates';
3
3
  export { useFormatLineChartData } from './useFormatLineChartData';
4
4
  export { usePopoverResizeObserver } from './usePopoverResizeObserver';
5
+ export { useToggle } from './useToggle';
5
6
  export { useWindowSize } from './useWindowSize';
@@ -0,0 +1 @@
1
+ export declare const useFetchCurrencyRates: () => void;
@@ -1,4 +1,6 @@
1
1
  export * from './components';
2
2
  export * from './constants';
3
+ export * from './hooks';
3
4
  export * from './providers';
5
+ export * from './stores';
4
6
  export * from './utils/dayjs';
package/dist/esm/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use client"
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { Text, Box, InlineStack, Icon, InlineGrid, Tooltip, Button, BlockStack, Checkbox, RadioButton, Popover, ActionList, Link, SkeletonDisplayText, List, Card, SkeletonBodyText, TextField, Collapsible, useBreakpoints, Select, Scrollable, OptionList, DatePicker, ButtonGroup } from '@shopify/polaris';
4
- import React, { useMemo, useCallback, useState, useEffect, forwardRef, Fragment as Fragment$1, useRef, useImperativeHandle, createContext, useContext } from 'react';
4
+ import * as React from 'react';
5
+ import React__default, { useMemo, useCallback, useState, useEffect, forwardRef, Fragment as Fragment$1, useRef, useImperativeHandle, createContext, useContext } from 'react';
5
6
  import dayjs from 'dayjs';
6
7
  export { default as dayjs } from 'dayjs';
7
8
  import quarterOfYear from 'dayjs/plugin/quarterOfYear.js';
@@ -200,9 +201,9 @@ const DEFAULT_CURRENCY_ANALYTIC = 'USD';
200
201
  var THUMB_PRODUCT_DEFAULT = "data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSI5MCIKICBoZWlnaHQ9IjcyIgogIHZpZXdCb3g9IjAgMCA5MCA3MiIKICBmaWxsPSJub25lIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKPgogIDxwYXRoCiAgICBkPSJNNDguNzUgMzQuNUM0OS45OTI2IDM0LjUgNTEgMzMuNDkyNiA1MSAzMi4yNUM1MSAzMS4wMDc0IDQ5Ljk5MjYgMzAgNDguNzUgMzBDNDcuNTA3NCAzMCA0Ni41IDMxLjAwNzQgNDYuNSAzMi4yNUM0Ni41IDMzLjQ5MjYgNDcuNTA3NCAzNC41IDQ4Ljc1IDM0LjVaIgogICAgZmlsbD0iIzYxNjE2MSIKICAvPgogIDxwYXRoCiAgICBmaWxsUnVsZT0iZXZlbm9kZCIKICAgIGNsaXBSdWxlPSJldmV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L3N2Zz4K";
201
202
 
202
203
  var SvgArrowRightIcon = function SvgArrowRightIcon(props) {
203
- return /*#__PURE__*/React.createElement("svg", Object.assign({
204
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
204
205
  viewBox: "0 0 20 20"
205
- }, props), /*#__PURE__*/React.createElement("path", {
206
+ }, props), /*#__PURE__*/React__default.createElement("path", {
206
207
  fillRule: "evenodd",
207
208
  d: "M3.5 10a.75.75 0 0 1 .75-.75h9.69l-2.72-2.72a.75.75 0 1 1 1.06-1.06l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 0 1-1.06-1.06l2.72-2.72h-9.69a.75.75 0 0 1-.75-.75Z"
208
209
  }));
@@ -210,9 +211,9 @@ var SvgArrowRightIcon = function SvgArrowRightIcon(props) {
210
211
  SvgArrowRightIcon.displayName = "ArrowRightIcon";
211
212
 
212
213
  var SvgCalendarIcon = function SvgCalendarIcon(props) {
213
- return /*#__PURE__*/React.createElement("svg", Object.assign({
214
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
214
215
  viewBox: "0 0 20 20"
215
- }, props), /*#__PURE__*/React.createElement("path", {
216
+ }, props), /*#__PURE__*/React__default.createElement("path", {
216
217
  fillRule: "evenodd",
217
218
  d: "M7.75 3.5a.75.75 0 0 0-1.5 0v.407a3.075 3.075 0 0 0-.702.252 3.75 3.75 0 0 0-1.64 1.639c-.226.444-.32.924-.365 1.47-.043.531-.043 1.187-.043 2v1.464c0 .813 0 1.469.043 2 .045.546.14 1.026.366 1.47a3.75 3.75 0 0 0 1.639 1.64c.444.226.924.32 1.47.365.531.043 1.187.043 2 .043h3.383c.323 0 .542 0 .735-.02a3.75 3.75 0 0 0 3.344-3.344c.02-.193.02-.412.02-.735v-2.883c0-.813 0-1.469-.043-2-.045-.546-.14-1.026-.366-1.47a3.75 3.75 0 0 0-1.639-1.64 3.076 3.076 0 0 0-.702-.251v-.407a.75.75 0 0 0-1.5 0v.259c-.373-.009-.794-.009-1.268-.009h-1.964c-.474 0-.895 0-1.268.009v-.259Zm-1.521 1.995c.197-.1.458-.17.912-.207.462-.037 1.057-.038 1.909-.038h1.9c.853 0 1.447 0 1.91.038.453.037.714.107.912.207.423.216.767.56.983.984.1.197.17.458.207.912.014.18.024.38.029.609h-9.982c.006-.228.015-.429.03-.61.036-.453.106-.714.206-.911a2.25 2.25 0 0 1 .984-.984Zm-1.229 4.005v1.2c0 .853 0 1.447.038 1.91.037.453.107.714.207.912.216.423.56.767.984.983.197.1.458.17.912.207.462.037 1.057.038 1.909.038h3.306c.385 0 .52-.001.626-.012a2.25 2.25 0 0 0 2.006-2.006c.011-.106.012-.241.012-.626v-2.606h-10Z"
218
219
  }));
@@ -220,9 +221,9 @@ var SvgCalendarIcon = function SvgCalendarIcon(props) {
220
221
  SvgCalendarIcon.displayName = "CalendarIcon";
221
222
 
222
223
  var SvgCheckIcon = function SvgCheckIcon(props) {
223
- return /*#__PURE__*/React.createElement("svg", Object.assign({
224
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
224
225
  viewBox: "0 0 20 20"
225
- }, props), /*#__PURE__*/React.createElement("path", {
226
+ }, props), /*#__PURE__*/React__default.createElement("path", {
226
227
  fillRule: "evenodd",
227
228
  d: "M15.78 5.97a.75.75 0 0 1 0 1.06l-6.5 6.5a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 1 1 1.06-1.06l2.72 2.72 5.97-5.97a.75.75 0 0 1 1.06 0Z"
228
229
  }));
@@ -230,9 +231,9 @@ var SvgCheckIcon = function SvgCheckIcon(props) {
230
231
  SvgCheckIcon.displayName = "CheckIcon";
231
232
 
232
233
  var SvgChevronDownIcon = function SvgChevronDownIcon(props) {
233
- return /*#__PURE__*/React.createElement("svg", Object.assign({
234
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
234
235
  viewBox: "0 0 20 20"
235
- }, props), /*#__PURE__*/React.createElement("path", {
236
+ }, props), /*#__PURE__*/React__default.createElement("path", {
236
237
  fillRule: "evenodd",
237
238
  d: "M5.72 8.47a.75.75 0 0 1 1.06 0l3.47 3.47 3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06Z"
238
239
  }));
@@ -240,9 +241,9 @@ var SvgChevronDownIcon = function SvgChevronDownIcon(props) {
240
241
  SvgChevronDownIcon.displayName = "ChevronDownIcon";
241
242
 
242
243
  var SvgChevronRightIcon = function SvgChevronRightIcon(props) {
243
- return /*#__PURE__*/React.createElement("svg", Object.assign({
244
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
244
245
  viewBox: "0 0 20 20"
245
- }, props), /*#__PURE__*/React.createElement("path", {
246
+ }, props), /*#__PURE__*/React__default.createElement("path", {
246
247
  fillRule: "evenodd",
247
248
  d: "M7.72 14.53a.75.75 0 0 1 0-1.06l3.47-3.47-3.47-3.47a.75.75 0 0 1 1.06-1.06l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 0 1-1.06 0Z"
248
249
  }));
@@ -250,9 +251,9 @@ var SvgChevronRightIcon = function SvgChevronRightIcon(props) {
250
251
  SvgChevronRightIcon.displayName = "ChevronRightIcon";
251
252
 
252
253
  var SvgChevronUpIcon = function SvgChevronUpIcon(props) {
253
- return /*#__PURE__*/React.createElement("svg", Object.assign({
254
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
254
255
  viewBox: "0 0 20 20"
255
- }, props), /*#__PURE__*/React.createElement("path", {
256
+ }, props), /*#__PURE__*/React__default.createElement("path", {
256
257
  fillRule: "evenodd",
257
258
  d: "M14.53 12.28a.75.75 0 0 1-1.06 0l-3.47-3.47-3.47 3.47a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1 0 1.06Z"
258
259
  }));
@@ -880,44 +881,6 @@ const GChartSkeleton = () => {
880
881
  return jsx(GSkeletonDisplayText, { height: "188px" });
881
882
  };
882
883
 
883
- const getPriceByCurrency = (price, currency = DEFAULT_CURRENCY_ANALYTIC, options) => {
884
- if (typeof price === 'string')
885
- return price;
886
- if (typeof price !== 'number')
887
- return;
888
- // Support legacy 3rd arg as locale string
889
- const opts = typeof options === 'string' ? { locale: options } : options;
890
- const locale = opts?.locale ?? 'en-US';
891
- if (price >= 1_000_000_000) {
892
- return `${new Intl.NumberFormat(locale, {
893
- style: 'currency',
894
- currency,
895
- minimumFractionDigits: 2,
896
- maximumFractionDigits: 2,
897
- }).format(price / 1_000_000_000)}B`;
898
- }
899
- if (price >= 1_000_000) {
900
- return `${new Intl.NumberFormat(locale, {
901
- style: 'currency',
902
- currency,
903
- minimumFractionDigits: 2,
904
- maximumFractionDigits: 2,
905
- }).format(price / 1_000_000)}M`;
906
- }
907
- if (opts?.compact && Math.abs(price) >= 1_000) {
908
- return `${new Intl.NumberFormat(locale, {
909
- style: 'currency',
910
- currency,
911
- minimumFractionDigits: 1,
912
- maximumFractionDigits: 1,
913
- }).format(price / 1_000)}K`;
914
- }
915
- return new Intl.NumberFormat(locale, {
916
- style: 'currency',
917
- currency,
918
- }).format(price);
919
- };
920
-
921
884
  const useCurrencyRatesStore = create((set) => ({
922
885
  currencyRates: null,
923
886
  setCurrencyRates: (rates) => set({ currencyRates: rates }),
@@ -959,6 +922,44 @@ const useFetchCurrencyRates = () => {
959
922
  }, [data, setCurrencyRates]);
960
923
  };
961
924
 
925
+ const getPriceByCurrency = (price, currency = DEFAULT_CURRENCY_ANALYTIC, options) => {
926
+ if (typeof price === 'string')
927
+ return price;
928
+ if (typeof price !== 'number')
929
+ return;
930
+ // Support legacy 3rd arg as locale string
931
+ const opts = typeof options === 'string' ? { locale: options } : options;
932
+ const locale = opts?.locale ?? 'en-US';
933
+ if (price >= 1_000_000_000) {
934
+ return `${new Intl.NumberFormat(locale, {
935
+ style: 'currency',
936
+ currency,
937
+ minimumFractionDigits: 2,
938
+ maximumFractionDigits: 2,
939
+ }).format(price / 1_000_000_000)}B`;
940
+ }
941
+ if (price >= 1_000_000) {
942
+ return `${new Intl.NumberFormat(locale, {
943
+ style: 'currency',
944
+ currency,
945
+ minimumFractionDigits: 2,
946
+ maximumFractionDigits: 2,
947
+ }).format(price / 1_000_000)}M`;
948
+ }
949
+ if (opts?.compact && Math.abs(price) >= 1_000) {
950
+ return `${new Intl.NumberFormat(locale, {
951
+ style: 'currency',
952
+ currency,
953
+ minimumFractionDigits: 1,
954
+ maximumFractionDigits: 1,
955
+ }).format(price / 1_000)}K`;
956
+ }
957
+ return new Intl.NumberFormat(locale, {
958
+ style: 'currency',
959
+ currency,
960
+ }).format(price);
961
+ };
962
+
962
963
  const ConvertMoneyContext = createContext({
963
964
  getTextPrice: (price) => {
964
965
  if (typeof price === 'string')
@@ -1013,19 +1014,7 @@ const MetricChartProvider = ({ children, minHeight = CHART_MIN_HEIGHT, seriesCol
1013
1014
  }, children: children }));
1014
1015
  };
1015
1016
 
1016
- /**
1017
- * Returns a stateful value, and a set of memoized functions to toggle it,
1018
- * set it to true and set it to false
1019
- */
1020
- function useToggle(initialState) {
1021
- const [value, setState] = useState(initialState);
1022
- return {
1023
- value,
1024
- toggle: useCallback(() => setState((state) => !state), []),
1025
- setTrue: useCallback(() => setState(true), []),
1026
- setFalse: useCallback(() => setState(false), []),
1027
- };
1028
- }
1017
+ const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
1029
1018
 
1030
1019
  const NONE_VALUE = 'None';
1031
1020
  const PLACEHOLDER_VALUE = '-';
@@ -1285,6 +1274,7 @@ const readNumeric = (metric, key) => {
1285
1274
  const useAnalyticData = () => {
1286
1275
  const { getTextPrice } = useConvertMoneyContext();
1287
1276
  const formatData = ({ value, formatter, name }) => {
1277
+ console.log({ value, formatter, getTextPrice, name });
1288
1278
  return formatAnalyticData({ value, formatter, getTextPrice, name });
1289
1279
  };
1290
1280
  const computeMetric = ({ metric, previousMetric, metricKey, formatter, }) => {
@@ -1323,6 +1313,49 @@ const useFormatLineChartData = ({ metricKey, columnTypes }) => {
1323
1313
  return { formatValue, yAxisOptions };
1324
1314
  };
1325
1315
 
1316
+ const usePopoverResizeObserver = ({ active, onHeightChange, selector = '.Polaris-Popover__Content--fluidContent', }) => {
1317
+ useEffect(() => {
1318
+ if (!active)
1319
+ return;
1320
+ let resizeObserver = null;
1321
+ const setupResizeObserver = () => {
1322
+ const popoverContent = document.querySelector(selector);
1323
+ if (popoverContent && !resizeObserver) {
1324
+ resizeObserver = new ResizeObserver((entries) => {
1325
+ for (const entry of entries) {
1326
+ const { height } = entry.contentRect;
1327
+ onHeightChange?.(height);
1328
+ }
1329
+ });
1330
+ resizeObserver.observe(popoverContent);
1331
+ }
1332
+ };
1333
+ setTimeout(() => {
1334
+ setupResizeObserver();
1335
+ }, 200);
1336
+ return () => {
1337
+ if (resizeObserver) {
1338
+ resizeObserver.disconnect();
1339
+ resizeObserver = null;
1340
+ }
1341
+ };
1342
+ }, [active, selector]);
1343
+ };
1344
+
1345
+ /**
1346
+ * Returns a stateful value, and a set of memoized functions to toggle it,
1347
+ * set it to true and set it to false
1348
+ */
1349
+ function useToggle(initialState) {
1350
+ const [value, setState] = useState(initialState);
1351
+ return {
1352
+ value,
1353
+ toggle: useCallback(() => setState((state) => !state), []),
1354
+ setTrue: useCallback(() => setState(true), []),
1355
+ setFalse: useCallback(() => setState(false), []),
1356
+ };
1357
+ }
1358
+
1326
1359
  const useWindowSize = () => {
1327
1360
  const [windowSize, setWindowSize] = useState(() => ({
1328
1361
  width: typeof window !== 'undefined' ? window.innerWidth : 0,
@@ -2639,4 +2672,4 @@ const GTimePicker = (props) => {
2639
2672
  return (jsxs(InlineStack, { gap: "200", children: [jsx(MainTimePicker, { ...timePickerProps }), isCompare && (jsx(CompareTimePicker, { rangeAddition: timePickerProps.rangeAddition, popoverProps: timePickerProps.popoverProps }))] }));
2640
2673
  };
2641
2674
 
2642
- export { ANALYTICS_METRIC_TOOLTIP, AnalyticModeSelector, CAMPAIGN_BACKGROUND_MAIN, CHART_MIN_HEIGHT, COMPARE_DATE_TIME_FILTERS_MAP, CompareDateTimePickerAlias, ConvertMoneyProvider, CurrencySelector, DATE_TIME_COMPARISON_FILTERS, DEFAULT_CURRENCY_ANALYTIC, DEFAULT_CURRENT_PERIOD_LABEL, DEFAULT_PREVIOUS_PERIOD_LABEL, DateTimeFilterInputs, DateTimeFilters, DateTimePickerContext, DateTimePickerProvider, GSelectableMetricChartCard, GTimePicker, MainDateTimePickerAlias, MetricChartProvider, MetricDonutChartCard, PLACEHOLDER_VALUE$1 as PLACEHOLDER_VALUE, PREVIOUS_PERIOD_FILTER, SERIES_COLORS, SingleMetricChartCard, TARGET_CHANNEL, TARGET_DEVICES, TARGET_VISITOR, THUMB_PRODUCT_DEFAULT, TREND_TONE, convertDateToTz, convertToDateTimeFilters, createLastDaysRange, dayjsTz, dayjsTzToDate, dayjsTzToLocalTZ, formatDate, formatDateTimeRange, formatDayjs, formatMs, formatTime, formatTimeRange, getDateRangeTitle, getDateTimeFilterBase, getDateTimeFilterByAlias, getDateTimeFilterMapping, getEndOfDayBy, getInitialTimezone, getLast12Months, getLast30Days, getLast365Days, getLast7Days, getLast90Days, getLastMonth, getLastYear, getMonthAndYearByDateFilter, getNoComparison, getPreviousMonth, getPreviousPeriod, getPreviousQuarter, getPreviousWeek, getPreviousYear, getToday, getVersionDateDescription, getVersionDateRangeTitle, getYesterday, isDate, isMidnight, isSameDayTimestamp, isValidDate, isValidYearMonthDayDateString, parseYearMonthDayDateString, setTz, useConvertMoneyContext, useCurrencyRatesStore, useDateTimeFilter, useDateTimePicker, useDateTimePickerContext, useFetchCurrencyRates, useVersionDateTimeFilters };
2675
+ export { ANALYTICS_METRIC_TOOLTIP, AnalyticModeSelector, CAMPAIGN_BACKGROUND_MAIN, CHART_MIN_HEIGHT, COMPARE_DATE_TIME_FILTERS_MAP, CompareDateTimePickerAlias, ConvertMoneyProvider, CurrencySelector, DATE_TIME_COMPARISON_FILTERS, DEFAULT_CURRENCY_ANALYTIC, DEFAULT_CURRENT_PERIOD_LABEL, DEFAULT_PREVIOUS_PERIOD_LABEL, DateTimeFilterInputs, DateTimeFilters, DateTimePickerContext, DateTimePickerProvider, GSelectableMetricChartCard, GTimePicker, MainDateTimePickerAlias, MetricChartProvider, MetricDonutChartCard, PLACEHOLDER_VALUE$1 as PLACEHOLDER_VALUE, PREVIOUS_PERIOD_FILTER, SERIES_COLORS, SingleMetricChartCard, TARGET_CHANNEL, TARGET_DEVICES, TARGET_VISITOR, THUMB_PRODUCT_DEFAULT, TREND_TONE, convertDateToTz, convertToDateTimeFilters, createLastDaysRange, dayjsTz, dayjsTzToDate, dayjsTzToLocalTZ, formatDate, formatDateTimeRange, formatDayjs, formatMs, formatTime, formatTimeRange, getDateRangeTitle, getDateTimeFilterBase, getDateTimeFilterByAlias, getDateTimeFilterMapping, getEndOfDayBy, getInitialTimezone, getLast12Months, getLast30Days, getLast365Days, getLast7Days, getLast90Days, getLastMonth, getLastYear, getMonthAndYearByDateFilter, getNoComparison, getPreviousMonth, getPreviousPeriod, getPreviousQuarter, getPreviousWeek, getPreviousYear, getToday, getVersionDateDescription, getVersionDateRangeTitle, getYesterday, isDate, isMidnight, isSameDayTimestamp, isValidDate, isValidYearMonthDayDateString, parseYearMonthDayDateString, setTz, useConvertMoneyContext, useCurrencyRatesStore, useDateTimeFilter, useDateTimePicker, useDateTimePickerContext, useEnhancedEffect, useFetchCurrencyRates, useFormatLineChartData, usePopoverResizeObserver, useToggle, useVersionDateTimeFilters, useWindowSize };
@@ -1,7 +1,8 @@
1
1
  "use client"
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { Text, Box, InlineStack, Icon, InlineGrid, Tooltip, Button, BlockStack, Checkbox, RadioButton, Popover, ActionList, Link, SkeletonDisplayText, List, Card, SkeletonBodyText, TextField, Collapsible, useBreakpoints, Select, Scrollable, OptionList, DatePicker, ButtonGroup } from '@shopify/polaris';
4
- import React, { useMemo, useCallback, useState, useEffect, forwardRef, Fragment as Fragment$1, useRef, useImperativeHandle, createContext, useContext } from 'react';
4
+ import * as React from 'react';
5
+ import React__default, { useMemo, useCallback, useState, useEffect, forwardRef, Fragment as Fragment$1, useRef, useImperativeHandle, createContext, useContext } from 'react';
5
6
  import dayjs from 'dayjs';
6
7
  export { default as dayjs } from 'dayjs';
7
8
  import quarterOfYear from 'dayjs/plugin/quarterOfYear.js';
@@ -200,9 +201,9 @@ const DEFAULT_CURRENCY_ANALYTIC = 'USD';
200
201
  var THUMB_PRODUCT_DEFAULT = "data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSI5MCIKICBoZWlnaHQ9IjcyIgogIHZpZXdCb3g9IjAgMCA5MCA3MiIKICBmaWxsPSJub25lIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKPgogIDxwYXRoCiAgICBkPSJNNDguNzUgMzQuNUM0OS45OTI2IDM0LjUgNTEgMzMuNDkyNiA1MSAzMi4yNUM1MSAzMS4wMDc0IDQ5Ljk5MjYgMzAgNDguNzUgMzBDNDcuNTA3NCAzMCA0Ni41IDMxLjAwNzQgNDYuNSAzMi4yNUM0Ni41IDMzLjQ5MjYgNDcuNTA3NCAzNC41IDQ4Ljc1IDM0LjVaIgogICAgZmlsbD0iIzYxNjE2MSIKICAvPgogIDxwYXRoCiAgICBmaWxsUnVsZT0iZXZlbm9kZCIKICAgIGNsaXBSdWxlPSJldmVub2RkIgogICAgZD0iTTQzLjUyNjggMjYuMjVINDYuNDczMkM0Ny42OTI0IDI2LjI1IDQ4LjY3NTggMjYuMjUgNDkuNDcyMiAyNi4zMTVDNTAuMjkyMiAyNi4zODIgNTEuMDEyNCAyNi41MjM2IDUxLjY3ODcgMjYuODYzMUM1Mi43MzcxIDI3LjQwMjQgNTMuNTk3NiAyOC4yNjI5IDU0LjEzNjkgMjkuMzIxM0M1NC40NzY0IDI5Ljk4NzYgNTQuNjE4IDMwLjcwNzggNTQuNjg1IDMxLjUyNzhDNTQuNzUgMzIuMzI0MiA1NC43NSAzMy4zMDc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YuODMyTDQ1LjcwNDUgNDEuNjcwNkM0Ni4xNDM4IDQyLjEwOTkgNDYuODU2MSA0Mi4xMDk5IDQ3LjI5NTUgNDEuNjcwNkw0OS44NjA0IDM5LjEwNTZDNTAuMDE4NSAzOC45NDc2IDUwLjI3ODggMzguOTYyIDUwLjQxODQgMzkuMTM2NUw1Mi4yMzc3IDQxLjQxMDdDNTIuMjA1NiA0MS41MDEgNTIuMTcwNCA0MS41ODIyIDUyLjEzMjEgNDEuNjU3MkM1MS44MDg2IDQyLjI5MjMgNTEuMjkyMyA0Mi44MDg2IDUwLjY1NzIgNDMuMTMyMUM1MC4zNjA5IDQzLjI4MzEgNDkuOTY5OCA0My4zODY4IDQ5LjI4OSA0My40NDI0QzQ4LjU5NSA0My40OTkxIDQ3LjcwMzcgNDMuNSA0Ni40MjUgNDMuNUg0My41NzVDNDIuMjk2MyA0My41IDQxLjQwNSA0My40OTkxIDQwLjcxMSA0My40NDI0QzQwLjAzMDIgNDMuMzg2OCAzOS42MzkxIDQzLjI4MzEgMzkuMzQyOCA0My4xMzIxQzM4LjcwNzcgNDIuODA4NiAzOC4xOTE0IDQyLjI5MjMgMzcuODY3OSA0MS42NTcyQzM3LjcxNjkgNDEuMzYwOSAzNy42MTMyIDQwLjk2OTggMzcuNTU3NiA0MC4yODlaIgogICAgZmlsbD0iIzYxNjE2MSIKICAvPgo8L3N2Zz4K";
201
202
 
202
203
  var SvgArrowRightIcon = function SvgArrowRightIcon(props) {
203
- return /*#__PURE__*/React.createElement("svg", Object.assign({
204
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
204
205
  viewBox: "0 0 20 20"
205
- }, props), /*#__PURE__*/React.createElement("path", {
206
+ }, props), /*#__PURE__*/React__default.createElement("path", {
206
207
  fillRule: "evenodd",
207
208
  d: "M3.5 10a.75.75 0 0 1 .75-.75h9.69l-2.72-2.72a.75.75 0 1 1 1.06-1.06l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 0 1-1.06-1.06l2.72-2.72h-9.69a.75.75 0 0 1-.75-.75Z"
208
209
  }));
@@ -210,9 +211,9 @@ var SvgArrowRightIcon = function SvgArrowRightIcon(props) {
210
211
  SvgArrowRightIcon.displayName = "ArrowRightIcon";
211
212
 
212
213
  var SvgCalendarIcon = function SvgCalendarIcon(props) {
213
- return /*#__PURE__*/React.createElement("svg", Object.assign({
214
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
214
215
  viewBox: "0 0 20 20"
215
- }, props), /*#__PURE__*/React.createElement("path", {
216
+ }, props), /*#__PURE__*/React__default.createElement("path", {
216
217
  fillRule: "evenodd",
217
218
  d: "M7.75 3.5a.75.75 0 0 0-1.5 0v.407a3.075 3.075 0 0 0-.702.252 3.75 3.75 0 0 0-1.64 1.639c-.226.444-.32.924-.365 1.47-.043.531-.043 1.187-.043 2v1.464c0 .813 0 1.469.043 2 .045.546.14 1.026.366 1.47a3.75 3.75 0 0 0 1.639 1.64c.444.226.924.32 1.47.365.531.043 1.187.043 2 .043h3.383c.323 0 .542 0 .735-.02a3.75 3.75 0 0 0 3.344-3.344c.02-.193.02-.412.02-.735v-2.883c0-.813 0-1.469-.043-2-.045-.546-.14-1.026-.366-1.47a3.75 3.75 0 0 0-1.639-1.64 3.076 3.076 0 0 0-.702-.251v-.407a.75.75 0 0 0-1.5 0v.259c-.373-.009-.794-.009-1.268-.009h-1.964c-.474 0-.895 0-1.268.009v-.259Zm-1.521 1.995c.197-.1.458-.17.912-.207.462-.037 1.057-.038 1.909-.038h1.9c.853 0 1.447 0 1.91.038.453.037.714.107.912.207.423.216.767.56.983.984.1.197.17.458.207.912.014.18.024.38.029.609h-9.982c.006-.228.015-.429.03-.61.036-.453.106-.714.206-.911a2.25 2.25 0 0 1 .984-.984Zm-1.229 4.005v1.2c0 .853 0 1.447.038 1.91.037.453.107.714.207.912.216.423.56.767.984.983.197.1.458.17.912.207.462.037 1.057.038 1.909.038h3.306c.385 0 .52-.001.626-.012a2.25 2.25 0 0 0 2.006-2.006c.011-.106.012-.241.012-.626v-2.606h-10Z"
218
219
  }));
@@ -220,9 +221,9 @@ var SvgCalendarIcon = function SvgCalendarIcon(props) {
220
221
  SvgCalendarIcon.displayName = "CalendarIcon";
221
222
 
222
223
  var SvgCheckIcon = function SvgCheckIcon(props) {
223
- return /*#__PURE__*/React.createElement("svg", Object.assign({
224
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
224
225
  viewBox: "0 0 20 20"
225
- }, props), /*#__PURE__*/React.createElement("path", {
226
+ }, props), /*#__PURE__*/React__default.createElement("path", {
226
227
  fillRule: "evenodd",
227
228
  d: "M15.78 5.97a.75.75 0 0 1 0 1.06l-6.5 6.5a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 1 1 1.06-1.06l2.72 2.72 5.97-5.97a.75.75 0 0 1 1.06 0Z"
228
229
  }));
@@ -230,9 +231,9 @@ var SvgCheckIcon = function SvgCheckIcon(props) {
230
231
  SvgCheckIcon.displayName = "CheckIcon";
231
232
 
232
233
  var SvgChevronDownIcon = function SvgChevronDownIcon(props) {
233
- return /*#__PURE__*/React.createElement("svg", Object.assign({
234
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
234
235
  viewBox: "0 0 20 20"
235
- }, props), /*#__PURE__*/React.createElement("path", {
236
+ }, props), /*#__PURE__*/React__default.createElement("path", {
236
237
  fillRule: "evenodd",
237
238
  d: "M5.72 8.47a.75.75 0 0 1 1.06 0l3.47 3.47 3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06Z"
238
239
  }));
@@ -240,9 +241,9 @@ var SvgChevronDownIcon = function SvgChevronDownIcon(props) {
240
241
  SvgChevronDownIcon.displayName = "ChevronDownIcon";
241
242
 
242
243
  var SvgChevronRightIcon = function SvgChevronRightIcon(props) {
243
- return /*#__PURE__*/React.createElement("svg", Object.assign({
244
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
244
245
  viewBox: "0 0 20 20"
245
- }, props), /*#__PURE__*/React.createElement("path", {
246
+ }, props), /*#__PURE__*/React__default.createElement("path", {
246
247
  fillRule: "evenodd",
247
248
  d: "M7.72 14.53a.75.75 0 0 1 0-1.06l3.47-3.47-3.47-3.47a.75.75 0 0 1 1.06-1.06l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 0 1-1.06 0Z"
248
249
  }));
@@ -250,9 +251,9 @@ var SvgChevronRightIcon = function SvgChevronRightIcon(props) {
250
251
  SvgChevronRightIcon.displayName = "ChevronRightIcon";
251
252
 
252
253
  var SvgChevronUpIcon = function SvgChevronUpIcon(props) {
253
- return /*#__PURE__*/React.createElement("svg", Object.assign({
254
+ return /*#__PURE__*/React__default.createElement("svg", Object.assign({
254
255
  viewBox: "0 0 20 20"
255
- }, props), /*#__PURE__*/React.createElement("path", {
256
+ }, props), /*#__PURE__*/React__default.createElement("path", {
256
257
  fillRule: "evenodd",
257
258
  d: "M14.53 12.28a.75.75 0 0 1-1.06 0l-3.47-3.47-3.47 3.47a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1 0 1.06Z"
258
259
  }));
@@ -880,44 +881,6 @@ const GChartSkeleton = () => {
880
881
  return jsx(GSkeletonDisplayText, { height: "188px" });
881
882
  };
882
883
 
883
- const getPriceByCurrency = (price, currency = DEFAULT_CURRENCY_ANALYTIC, options) => {
884
- if (typeof price === 'string')
885
- return price;
886
- if (typeof price !== 'number')
887
- return;
888
- // Support legacy 3rd arg as locale string
889
- const opts = typeof options === 'string' ? { locale: options } : options;
890
- const locale = opts?.locale ?? 'en-US';
891
- if (price >= 1_000_000_000) {
892
- return `${new Intl.NumberFormat(locale, {
893
- style: 'currency',
894
- currency,
895
- minimumFractionDigits: 2,
896
- maximumFractionDigits: 2,
897
- }).format(price / 1_000_000_000)}B`;
898
- }
899
- if (price >= 1_000_000) {
900
- return `${new Intl.NumberFormat(locale, {
901
- style: 'currency',
902
- currency,
903
- minimumFractionDigits: 2,
904
- maximumFractionDigits: 2,
905
- }).format(price / 1_000_000)}M`;
906
- }
907
- if (opts?.compact && Math.abs(price) >= 1_000) {
908
- return `${new Intl.NumberFormat(locale, {
909
- style: 'currency',
910
- currency,
911
- minimumFractionDigits: 1,
912
- maximumFractionDigits: 1,
913
- }).format(price / 1_000)}K`;
914
- }
915
- return new Intl.NumberFormat(locale, {
916
- style: 'currency',
917
- currency,
918
- }).format(price);
919
- };
920
-
921
884
  const useCurrencyRatesStore = create((set) => ({
922
885
  currencyRates: null,
923
886
  setCurrencyRates: (rates) => set({ currencyRates: rates }),
@@ -959,6 +922,44 @@ const useFetchCurrencyRates = () => {
959
922
  }, [data, setCurrencyRates]);
960
923
  };
961
924
 
925
+ const getPriceByCurrency = (price, currency = DEFAULT_CURRENCY_ANALYTIC, options) => {
926
+ if (typeof price === 'string')
927
+ return price;
928
+ if (typeof price !== 'number')
929
+ return;
930
+ // Support legacy 3rd arg as locale string
931
+ const opts = typeof options === 'string' ? { locale: options } : options;
932
+ const locale = opts?.locale ?? 'en-US';
933
+ if (price >= 1_000_000_000) {
934
+ return `${new Intl.NumberFormat(locale, {
935
+ style: 'currency',
936
+ currency,
937
+ minimumFractionDigits: 2,
938
+ maximumFractionDigits: 2,
939
+ }).format(price / 1_000_000_000)}B`;
940
+ }
941
+ if (price >= 1_000_000) {
942
+ return `${new Intl.NumberFormat(locale, {
943
+ style: 'currency',
944
+ currency,
945
+ minimumFractionDigits: 2,
946
+ maximumFractionDigits: 2,
947
+ }).format(price / 1_000_000)}M`;
948
+ }
949
+ if (opts?.compact && Math.abs(price) >= 1_000) {
950
+ return `${new Intl.NumberFormat(locale, {
951
+ style: 'currency',
952
+ currency,
953
+ minimumFractionDigits: 1,
954
+ maximumFractionDigits: 1,
955
+ }).format(price / 1_000)}K`;
956
+ }
957
+ return new Intl.NumberFormat(locale, {
958
+ style: 'currency',
959
+ currency,
960
+ }).format(price);
961
+ };
962
+
962
963
  const ConvertMoneyContext = createContext({
963
964
  getTextPrice: (price) => {
964
965
  if (typeof price === 'string')
@@ -1013,19 +1014,7 @@ const MetricChartProvider = ({ children, minHeight = CHART_MIN_HEIGHT, seriesCol
1013
1014
  }, children: children }));
1014
1015
  };
1015
1016
 
1016
- /**
1017
- * Returns a stateful value, and a set of memoized functions to toggle it,
1018
- * set it to true and set it to false
1019
- */
1020
- function useToggle(initialState) {
1021
- const [value, setState] = useState(initialState);
1022
- return {
1023
- value,
1024
- toggle: useCallback(() => setState((state) => !state), []),
1025
- setTrue: useCallback(() => setState(true), []),
1026
- setFalse: useCallback(() => setState(false), []),
1027
- };
1028
- }
1017
+ const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
1029
1018
 
1030
1019
  const NONE_VALUE = 'None';
1031
1020
  const PLACEHOLDER_VALUE = '-';
@@ -1285,6 +1274,7 @@ const readNumeric = (metric, key) => {
1285
1274
  const useAnalyticData = () => {
1286
1275
  const { getTextPrice } = useConvertMoneyContext();
1287
1276
  const formatData = ({ value, formatter, name }) => {
1277
+ console.log({ value, formatter, getTextPrice, name });
1288
1278
  return formatAnalyticData({ value, formatter, getTextPrice, name });
1289
1279
  };
1290
1280
  const computeMetric = ({ metric, previousMetric, metricKey, formatter, }) => {
@@ -1323,6 +1313,49 @@ const useFormatLineChartData = ({ metricKey, columnTypes }) => {
1323
1313
  return { formatValue, yAxisOptions };
1324
1314
  };
1325
1315
 
1316
+ const usePopoverResizeObserver = ({ active, onHeightChange, selector = '.Polaris-Popover__Content--fluidContent', }) => {
1317
+ useEffect(() => {
1318
+ if (!active)
1319
+ return;
1320
+ let resizeObserver = null;
1321
+ const setupResizeObserver = () => {
1322
+ const popoverContent = document.querySelector(selector);
1323
+ if (popoverContent && !resizeObserver) {
1324
+ resizeObserver = new ResizeObserver((entries) => {
1325
+ for (const entry of entries) {
1326
+ const { height } = entry.contentRect;
1327
+ onHeightChange?.(height);
1328
+ }
1329
+ });
1330
+ resizeObserver.observe(popoverContent);
1331
+ }
1332
+ };
1333
+ setTimeout(() => {
1334
+ setupResizeObserver();
1335
+ }, 200);
1336
+ return () => {
1337
+ if (resizeObserver) {
1338
+ resizeObserver.disconnect();
1339
+ resizeObserver = null;
1340
+ }
1341
+ };
1342
+ }, [active, selector]);
1343
+ };
1344
+
1345
+ /**
1346
+ * Returns a stateful value, and a set of memoized functions to toggle it,
1347
+ * set it to true and set it to false
1348
+ */
1349
+ function useToggle(initialState) {
1350
+ const [value, setState] = useState(initialState);
1351
+ return {
1352
+ value,
1353
+ toggle: useCallback(() => setState((state) => !state), []),
1354
+ setTrue: useCallback(() => setState(true), []),
1355
+ setFalse: useCallback(() => setState(false), []),
1356
+ };
1357
+ }
1358
+
1326
1359
  const useWindowSize = () => {
1327
1360
  const [windowSize, setWindowSize] = useState(() => ({
1328
1361
  width: typeof window !== 'undefined' ? window.innerWidth : 0,
@@ -2639,4 +2672,4 @@ const GTimePicker = (props) => {
2639
2672
  return (jsxs(InlineStack, { gap: "200", children: [jsx(MainTimePicker, { ...timePickerProps }), isCompare && (jsx(CompareTimePicker, { rangeAddition: timePickerProps.rangeAddition, popoverProps: timePickerProps.popoverProps }))] }));
2640
2673
  };
2641
2674
 
2642
- export { ANALYTICS_METRIC_TOOLTIP, AnalyticModeSelector, CAMPAIGN_BACKGROUND_MAIN, CHART_MIN_HEIGHT, COMPARE_DATE_TIME_FILTERS_MAP, CompareDateTimePickerAlias, ConvertMoneyProvider, CurrencySelector, DATE_TIME_COMPARISON_FILTERS, DEFAULT_CURRENCY_ANALYTIC, DEFAULT_CURRENT_PERIOD_LABEL, DEFAULT_PREVIOUS_PERIOD_LABEL, DateTimeFilterInputs, DateTimeFilters, DateTimePickerContext, DateTimePickerProvider, GSelectableMetricChartCard, GTimePicker, MainDateTimePickerAlias, MetricChartProvider, MetricDonutChartCard, PLACEHOLDER_VALUE$1 as PLACEHOLDER_VALUE, PREVIOUS_PERIOD_FILTER, SERIES_COLORS, SingleMetricChartCard, TARGET_CHANNEL, TARGET_DEVICES, TARGET_VISITOR, THUMB_PRODUCT_DEFAULT, TREND_TONE, convertDateToTz, convertToDateTimeFilters, createLastDaysRange, dayjsTz, dayjsTzToDate, dayjsTzToLocalTZ, formatDate, formatDateTimeRange, formatDayjs, formatMs, formatTime, formatTimeRange, getDateRangeTitle, getDateTimeFilterBase, getDateTimeFilterByAlias, getDateTimeFilterMapping, getEndOfDayBy, getInitialTimezone, getLast12Months, getLast30Days, getLast365Days, getLast7Days, getLast90Days, getLastMonth, getLastYear, getMonthAndYearByDateFilter, getNoComparison, getPreviousMonth, getPreviousPeriod, getPreviousQuarter, getPreviousWeek, getPreviousYear, getToday, getVersionDateDescription, getVersionDateRangeTitle, getYesterday, isDate, isMidnight, isSameDayTimestamp, isValidDate, isValidYearMonthDayDateString, parseYearMonthDayDateString, setTz, useConvertMoneyContext, useCurrencyRatesStore, useDateTimeFilter, useDateTimePicker, useDateTimePickerContext, useFetchCurrencyRates, useVersionDateTimeFilters };
2675
+ export { ANALYTICS_METRIC_TOOLTIP, AnalyticModeSelector, CAMPAIGN_BACKGROUND_MAIN, CHART_MIN_HEIGHT, COMPARE_DATE_TIME_FILTERS_MAP, CompareDateTimePickerAlias, ConvertMoneyProvider, CurrencySelector, DATE_TIME_COMPARISON_FILTERS, DEFAULT_CURRENCY_ANALYTIC, DEFAULT_CURRENT_PERIOD_LABEL, DEFAULT_PREVIOUS_PERIOD_LABEL, DateTimeFilterInputs, DateTimeFilters, DateTimePickerContext, DateTimePickerProvider, GSelectableMetricChartCard, GTimePicker, MainDateTimePickerAlias, MetricChartProvider, MetricDonutChartCard, PLACEHOLDER_VALUE$1 as PLACEHOLDER_VALUE, PREVIOUS_PERIOD_FILTER, SERIES_COLORS, SingleMetricChartCard, TARGET_CHANNEL, TARGET_DEVICES, TARGET_VISITOR, THUMB_PRODUCT_DEFAULT, TREND_TONE, convertDateToTz, convertToDateTimeFilters, createLastDaysRange, dayjsTz, dayjsTzToDate, dayjsTzToLocalTZ, formatDate, formatDateTimeRange, formatDayjs, formatMs, formatTime, formatTimeRange, getDateRangeTitle, getDateTimeFilterBase, getDateTimeFilterByAlias, getDateTimeFilterMapping, getEndOfDayBy, getInitialTimezone, getLast12Months, getLast30Days, getLast365Days, getLast7Days, getLast90Days, getLastMonth, getLastYear, getMonthAndYearByDateFilter, getNoComparison, getPreviousMonth, getPreviousPeriod, getPreviousQuarter, getPreviousWeek, getPreviousYear, getToday, getVersionDateDescription, getVersionDateRangeTitle, getYesterday, isDate, isMidnight, isSameDayTimestamp, isValidDate, isValidYearMonthDayDateString, parseYearMonthDayDateString, setTz, useConvertMoneyContext, useCurrencyRatesStore, useDateTimeFilter, useDateTimePicker, useDateTimePickerContext, useEnhancedEffect, useFetchCurrencyRates, useFormatLineChartData, usePopoverResizeObserver, useToggle, useVersionDateTimeFilters, useWindowSize };
@@ -1,6 +1,3 @@
1
1
  export { ConvertMoneyProvider, useConvertMoneyContext } from './ConvertMoneyProvider';
2
2
  export type { IProps as IConvertMoneyProviderProps } from './ConvertMoneyProvider';
3
- export { useCurrencyRatesStore } from './currencyRatesStore';
4
- export type { ICurrencyRates } from './currencyRatesStore';
5
3
  export { MetricChartProvider } from './MetricChartProvider';
6
- export { useFetchCurrencyRates } from './useFetchCurrencyRates';
@@ -4,5 +4,5 @@ interface Props extends Pick<TooltipPositionParams, 'event' | 'eventType' | 'ind
4
4
  containerBounds: BoundingRect;
5
5
  parentElement: SVGSVGElement | null;
6
6
  }
7
- export declare function getDonutChartTooltipPosition({ containerBounds, event, eventType, index, parentElement }: Props): import("../types").TooltipPosition;
7
+ export declare function getDonutChartTooltipPosition({ containerBounds, event, eventType, index, parentElement }: Props): import("..").TooltipPosition;
8
8
  export {};
@@ -7,5 +7,5 @@ interface Props extends Omit<TooltipPositionParams, 'xScale'> {
7
7
  scrollY: number;
8
8
  xScale: ScaleLinear<number, number>;
9
9
  }
10
- export declare function getLineChartTooltipPosition({ containerBounds, chartBounds, data, event, eventType, index, isTouchDevice, longestSeriesIndex, scrollY, xScale, }: Props): import("../types").TooltipPosition;
10
+ export declare function getLineChartTooltipPosition({ containerBounds, chartBounds, data, event, eventType, index, isTouchDevice, longestSeriesIndex, scrollY, xScale, }: Props): import("..").TooltipPosition;
11
11
  export {};
@@ -0,0 +1,7 @@
1
+ export type ICurrencyRates = Record<string, number>;
2
+ interface ICurrencyRatesStore {
3
+ currencyRates: ICurrencyRates | null;
4
+ setCurrencyRates: (rates: ICurrencyRates) => void;
5
+ }
6
+ export declare const useCurrencyRatesStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ICurrencyRatesStore>>;
7
+ export {};