@gem-sdk/analytics 2.0.0-dev.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/CardPathAnalysis/components/PathAnalysisChart.d.ts +0 -1
- package/dist/esm/components/CardPathAnalysis/contexts/PathAnalysisConfigProvider.d.ts +8 -1
- package/dist/esm/components/CardPathAnalysis/hooks/usePathAnalysisChart.d.ts +1 -0
- package/dist/esm/components/CardPathAnalysis/hooks/usePathAnalysisFunnel.d.ts +2 -1
- package/dist/esm/components/GModalOrderJourney/GModalOrderJourney.d.ts +20 -0
- package/dist/esm/components/GModalOrderJourney/components/OrderJourneySkeleton.d.ts +1 -0
- package/dist/esm/components/GModalOrderJourney/components/index.d.ts +1 -0
- package/dist/esm/components/GModalOrderJourney/context/OrderJourneyContext.d.ts +6 -0
- package/dist/esm/components/GModalOrderJourney/context/index.d.ts +1 -0
- package/dist/esm/components/GModalOrderJourney/hooks/index.d.ts +1 -0
- package/dist/esm/components/GModalOrderJourney/hooks/useGModalOrderJourney.d.ts +7 -0
- package/dist/esm/components/GModalOrderJourney/index.d.ts +4 -0
- package/dist/esm/components/GModalOrderJourney/types/index.d.ts +4 -0
- package/dist/esm/components/GModalOrderJourney/utils/index.d.ts +28 -0
- package/dist/esm/components/GSelectableMetricChartCard/GSelectableMetricChartCard.d.ts +2 -1
- package/dist/esm/components/GSelectableMetricChartCard/MetricChartTab.d.ts +2 -1
- package/dist/esm/components/MetricDonutChartCard/MetricDonutChartCard.d.ts +2 -1
- package/dist/esm/components/OrderAnalytic/OrderListingLatestTable.d.ts +2 -1
- package/dist/esm/components/OrderAnalytic/components/OrderListing/OrderListingTable.d.ts +2 -1
- package/dist/esm/components/OrderAnalytic/stores/order-columns-selector.d.ts +0 -2
- package/dist/esm/components/OrderAnalytic/types/order.d.ts +32 -0
- package/dist/esm/components/SingleMetricChartCard/SingleMetricChartCard.d.ts +2 -1
- package/dist/esm/components/common/chart/MetricInfoBlock.d.ts +2 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/gemxql.js +67 -32
- package/dist/esm/gemxql.mjs +67 -32
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/useFetchCurrencyRates.d.ts +4 -1
- package/dist/esm/hooks/usePreventBodyScroll.d.ts +3 -0
- package/dist/esm/index.js +1080 -1941
- package/dist/esm/index.mjs +1080 -1941
- package/dist/esm/providers/TimezoneProvider.d.ts +11 -0
- package/dist/esm/providers/index.d.ts +2 -0
- package/dist/esm/shared/charts/components/GFunnelChart/components/types.d.ts +1 -0
- package/dist/esm/shared/charts/contexts/GChartProvider.d.ts +1 -1
- package/dist/esm/shared/components/GDotInline/GDotInline.d.ts +5 -0
- package/dist/esm/shared/components/GDotInline/index.d.ts +1 -0
- package/dist/esm/shared/components/GInlineCenter/GInlineCenter.d.ts +1 -1
- package/dist/esm/shared/components/GMockDataTooltip/GMockDataTooltip.d.ts +12 -0
- package/dist/esm/shared/components/GMockDataTooltip/index.d.ts +1 -0
- package/dist/esm/shared/components/GModal/GModal.d.ts +14 -0
- package/dist/esm/shared/components/GModal/index.d.ts +1 -0
- package/dist/esm/shared/components/GSpinner/GSpinner.d.ts +5 -0
- package/dist/esm/shared/components/GSpinner/index.d.ts +1 -0
- package/dist/esm/shared/components/index.d.ts +4 -0
- package/dist/esm/shared/journey/common/JourneyContainer/components/JourneyContainer.d.ts +10 -0
- package/dist/esm/shared/journey/common/JourneyContainer/components/JourneyTimeline.d.ts +1 -0
- package/dist/esm/shared/journey/common/JourneyContainer/components/index.d.ts +2 -0
- package/dist/esm/shared/journey/common/JourneyContainer/index.d.ts +1 -0
- package/dist/esm/shared/journey/common/index.d.ts +1 -0
- package/dist/esm/shared/journey/index.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/AcceptedPostPurchaseOffer/AcceptedPostPurchaseOffer.d.ts +10 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/AcceptedPostPurchaseOffer/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutCompleted/CheckoutCompleted.d.ts +9 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutCompleted/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutItems.d.ts +6 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/CheckoutStarted.d.ts +10 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/CheckoutStartedDetail.d.ts +8 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/index.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/PageViewed/PageViewed.d.ts +9 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/PageViewed/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductAddedToCart/ProductAddedToCart.d.ts +10 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductAddedToCart/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductQuantity/ProductQuantity.d.ts +6 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductQuantity/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductRemovedFromCart/ProductRemovedFromCart.d.ts +10 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductRemovedFromCart/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/index.d.ts +6 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/constants/event.d.ts +13 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/constants/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/index.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/types.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyGroup/JourneyGroup.d.ts +7 -0
- package/dist/esm/shared/journey/ui/JourneyGroup/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/EventMarkerIcon.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/JourneyDetail.d.ts +5 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/JourneyItem.d.ts +9 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/JourneyTime.d.ts +9 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/QuantityWrapper.d.ts +5 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/index.d.ts +3 -0
- package/dist/esm/shared/journey/ui/JourneyItem/index.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyItem/types/events.d.ts +18 -0
- package/dist/esm/shared/journey/ui/JourneyItem/types/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/JourneyDateBadge.d.ts +5 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/JourneyIdBadge.d.ts +6 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/JourneyLoadMore.d.ts +6 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/JourneyTitle.d.ts +9 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/index.d.ts +3 -0
- package/dist/esm/shared/journey/ui/type.d.ts +2 -0
- package/dist/esm/shared/reports/ui/ReportTable/ReportTable.d.ts +2 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/Cell.d.ts +2 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/OrderCellContainer.d.ts +1 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/OrderIdCell.d.ts +1 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/type.d.ts +1 -0
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Row.d.ts +2 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Footer/Pagination.d.ts +2 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Footer/WrapperFooter.d.ts +2 -1
- package/dist/esm/types/campaign.d.ts +4 -0
- package/dist/esm/types.js +6 -1
- package/dist/esm/types.mjs +6 -1
- package/dist/esm/utils/array.d.ts +1 -0
- package/dist/esm/utils/date-time.d.ts +1 -0
- package/dist/esm/utils/index.d.ts +3 -0
- package/dist/esm/utils/is-browser.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/umd/esm/components/CardPathAnalysis/components/PathAnalysisChart.d.ts +0 -1
- package/dist/umd/esm/components/CardPathAnalysis/contexts/PathAnalysisConfigProvider.d.ts +8 -1
- package/dist/umd/esm/components/CardPathAnalysis/hooks/usePathAnalysisChart.d.ts +1 -0
- package/dist/umd/esm/components/CardPathAnalysis/hooks/usePathAnalysisFunnel.d.ts +2 -1
- package/dist/umd/esm/components/GModalOrderJourney/GModalOrderJourney.d.ts +20 -0
- package/dist/umd/esm/components/GModalOrderJourney/components/OrderJourneySkeleton.d.ts +1 -0
- package/dist/umd/esm/components/GModalOrderJourney/components/index.d.ts +1 -0
- package/dist/umd/esm/components/GModalOrderJourney/context/OrderJourneyContext.d.ts +6 -0
- package/dist/umd/esm/components/GModalOrderJourney/context/index.d.ts +1 -0
- package/dist/umd/esm/components/GModalOrderJourney/hooks/index.d.ts +1 -0
- package/dist/umd/esm/components/GModalOrderJourney/hooks/useGModalOrderJourney.d.ts +7 -0
- package/dist/umd/esm/components/GModalOrderJourney/index.d.ts +4 -0
- package/dist/umd/esm/components/GModalOrderJourney/types/index.d.ts +4 -0
- package/dist/umd/esm/components/GModalOrderJourney/utils/index.d.ts +28 -0
- package/dist/umd/esm/components/GSelectableMetricChartCard/GSelectableMetricChartCard.d.ts +2 -1
- package/dist/umd/esm/components/GSelectableMetricChartCard/MetricChartTab.d.ts +2 -1
- package/dist/umd/esm/components/MetricDonutChartCard/MetricDonutChartCard.d.ts +2 -1
- package/dist/umd/esm/components/OrderAnalytic/OrderListingLatestTable.d.ts +2 -1
- package/dist/umd/esm/components/OrderAnalytic/components/OrderListing/OrderListingTable.d.ts +2 -1
- package/dist/umd/esm/components/OrderAnalytic/stores/order-columns-selector.d.ts +0 -2
- package/dist/umd/esm/components/OrderAnalytic/types/order.d.ts +32 -0
- package/dist/umd/esm/components/SingleMetricChartCard/SingleMetricChartCard.d.ts +2 -1
- package/dist/umd/esm/components/common/chart/MetricInfoBlock.d.ts +2 -1
- package/dist/umd/esm/components/index.d.ts +1 -0
- package/dist/umd/esm/hooks/index.d.ts +1 -0
- package/dist/umd/esm/hooks/useFetchCurrencyRates.d.ts +4 -1
- package/dist/umd/esm/hooks/usePreventBodyScroll.d.ts +3 -0
- package/dist/umd/esm/providers/TimezoneProvider.d.ts +11 -0
- package/dist/umd/esm/providers/index.d.ts +2 -0
- package/dist/umd/esm/shared/charts/components/GFunnelChart/components/types.d.ts +1 -0
- package/dist/umd/esm/shared/charts/contexts/GChartProvider.d.ts +1 -1
- package/dist/umd/esm/shared/components/GDotInline/GDotInline.d.ts +5 -0
- package/dist/umd/esm/shared/components/GDotInline/index.d.ts +1 -0
- package/dist/umd/esm/shared/components/GInlineCenter/GInlineCenter.d.ts +1 -1
- package/dist/umd/esm/shared/components/GMockDataTooltip/GMockDataTooltip.d.ts +12 -0
- package/dist/umd/esm/shared/components/GMockDataTooltip/index.d.ts +1 -0
- package/dist/umd/esm/shared/components/GModal/GModal.d.ts +14 -0
- package/dist/umd/esm/shared/components/GModal/index.d.ts +1 -0
- package/dist/umd/esm/shared/components/GSpinner/GSpinner.d.ts +5 -0
- package/dist/umd/esm/shared/components/GSpinner/index.d.ts +1 -0
- package/dist/umd/esm/shared/components/index.d.ts +4 -0
- package/dist/umd/esm/shared/journey/common/JourneyContainer/components/JourneyContainer.d.ts +10 -0
- package/dist/umd/esm/shared/journey/common/JourneyContainer/components/JourneyTimeline.d.ts +1 -0
- package/dist/umd/esm/shared/journey/common/JourneyContainer/components/index.d.ts +2 -0
- package/dist/umd/esm/shared/journey/common/JourneyContainer/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/common/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/index.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/AcceptedPostPurchaseOffer/AcceptedPostPurchaseOffer.d.ts +10 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/AcceptedPostPurchaseOffer/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutCompleted/CheckoutCompleted.d.ts +9 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutCompleted/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutItems.d.ts +6 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/CheckoutStarted.d.ts +10 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/CheckoutStartedDetail.d.ts +8 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/index.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/PageViewed/PageViewed.d.ts +9 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/PageViewed/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductAddedToCart/ProductAddedToCart.d.ts +10 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductAddedToCart/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductQuantity/ProductQuantity.d.ts +6 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductQuantity/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductRemovedFromCart/ProductRemovedFromCart.d.ts +10 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductRemovedFromCart/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/index.d.ts +6 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/constants/event.d.ts +13 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/constants/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/index.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/types.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyGroup/JourneyGroup.d.ts +7 -0
- package/dist/umd/esm/shared/journey/ui/JourneyGroup/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/EventMarkerIcon.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/JourneyDetail.d.ts +5 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/JourneyItem.d.ts +9 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/JourneyTime.d.ts +9 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/QuantityWrapper.d.ts +5 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/index.d.ts +3 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/index.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/types/events.d.ts +18 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/types/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/JourneyDateBadge.d.ts +5 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/JourneyIdBadge.d.ts +6 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/JourneyLoadMore.d.ts +6 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/JourneyTitle.d.ts +9 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/index.d.ts +3 -0
- package/dist/umd/esm/shared/journey/ui/type.d.ts +2 -0
- package/dist/umd/esm/shared/reports/ui/ReportTable/ReportTable.d.ts +2 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/Cell.d.ts +2 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/OrderCellContainer.d.ts +1 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/OrderIdCell.d.ts +1 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/type.d.ts +1 -0
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Row.d.ts +2 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Footer/Pagination.d.ts +2 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Footer/WrapperFooter.d.ts +2 -1
- package/dist/umd/esm/types/campaign.d.ts +4 -0
- package/dist/umd/esm/utils/array.d.ts +1 -0
- package/dist/umd/esm/utils/date-time.d.ts +1 -0
- package/dist/umd/esm/utils/index.d.ts +3 -0
- package/dist/umd/esm/utils/is-browser.d.ts +1 -0
- package/dist/umd/gemxql.js +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/types.js +1 -1
- package/package.json +6 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { Text, Box, InlineStack, Icon, InlineGrid, Tooltip as Tooltip$1, Popover, BlockStack, List, Button, Checkbox, RadioButton, ActionList, Link, SkeletonDisplayText, Pagination as Pagination$1, Card, SkeletonBodyText, TextField, Collapsible, useBreakpoints, Select, Scrollable, OptionList, DatePicker, ButtonGroup, Divider,
|
|
3
|
+
import { Text, Box, InlineStack, Icon, InlineGrid, Tooltip as Tooltip$1, Popover, BlockStack, List, Button, Checkbox, RadioButton, ActionList, Link, SkeletonDisplayText, Pagination as Pagination$1, Spinner, Modal, Card, SkeletonBodyText, TextField, Collapsible, useBreakpoints, Select, Scrollable, OptionList, DatePicker, ButtonGroup, Divider, Badge } from '@shopify/polaris';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { useMemo, useCallback, forwardRef, useState, useRef, useImperativeHandle, useEffect, Fragment as Fragment$1, createContext, useContext, createElement, useLayoutEffect, memo, Component } from 'react';
|
|
6
6
|
import dayjs from 'dayjs';
|
|
@@ -15,6 +15,8 @@ import { PolarisVizProvider, LineChart, DonutChart } from '@shopify/polaris-viz'
|
|
|
15
15
|
import chartStyle from '@shopify/polaris-viz/build/esm/styles.css?url';
|
|
16
16
|
import { t as t$1 } from 'i18next';
|
|
17
17
|
import { unstable_batchedUpdates, createPortal } from 'react-dom';
|
|
18
|
+
import { arc } from 'd3-shape';
|
|
19
|
+
import { scaleLinear, scaleBand } from 'd3-scale';
|
|
18
20
|
import { persist } from 'zustand/middleware';
|
|
19
21
|
|
|
20
22
|
var EMetricKey;
|
|
@@ -211,6 +213,11 @@ var ICampaignType;
|
|
|
211
213
|
ICampaignType["TEMPLATE_BUNDLE"] = "TEMPLATE_BUNDLE";
|
|
212
214
|
// THEME = 'THEME',
|
|
213
215
|
})(ICampaignType || (ICampaignType = {}));
|
|
216
|
+
var IVariantType$1;
|
|
217
|
+
(function (IVariantType) {
|
|
218
|
+
IVariantType["VARIANT_A"] = "A";
|
|
219
|
+
IVariantType["VARIANT_B"] = "B";
|
|
220
|
+
})(IVariantType$1 || (IVariantType$1 = {}));
|
|
214
221
|
|
|
215
222
|
const TARGET_VISITOR = [
|
|
216
223
|
{ value: EVisitorType.NEW, label: 'New' },
|
|
@@ -305,6 +312,20 @@ var SvgCaretDownIcon = function SvgCaretDownIcon(props) {
|
|
|
305
312
|
};
|
|
306
313
|
SvgCaretDownIcon.displayName = "CaretDownIcon";
|
|
307
314
|
|
|
315
|
+
var SvgCartIcon = function SvgCartIcon(props) {
|
|
316
|
+
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
317
|
+
viewBox: "0 0 20 20"
|
|
318
|
+
}, props), /*#__PURE__*/React__default.createElement("path", {
|
|
319
|
+
fillRule: "evenodd",
|
|
320
|
+
d: "M2.5 3.75a.75.75 0 0 1 .75-.75h1.612a1.75 1.75 0 0 1 1.732 1.5h9.656a.75.75 0 0 1 .748.808l-.358 4.653a2.75 2.75 0 0 1-2.742 2.539h-6.351l.093.78a.25.25 0 0 0 .248.22h6.362a.75.75 0 0 1 0 1.5h-6.362a1.75 1.75 0 0 1-1.738-1.543l-1.04-8.737a.25.25 0 0 0-.248-.22h-1.612a.75.75 0 0 1-.75-.75Zm4.868 7.25h6.53a1.25 1.25 0 0 0 1.246-1.154l.296-3.846h-8.667l.595 5Z"
|
|
321
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
322
|
+
d: "M10 17a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"
|
|
323
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
324
|
+
d: "M15 17a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"
|
|
325
|
+
}));
|
|
326
|
+
};
|
|
327
|
+
SvgCartIcon.displayName = "CartIcon";
|
|
328
|
+
|
|
308
329
|
var SvgChartLineIcon = function SvgChartLineIcon(props) {
|
|
309
330
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
310
331
|
viewBox: "0 0 20 20"
|
|
@@ -355,6 +376,39 @@ var SvgChevronUpIcon = function SvgChevronUpIcon(props) {
|
|
|
355
376
|
};
|
|
356
377
|
SvgChevronUpIcon.displayName = "ChevronUpIcon";
|
|
357
378
|
|
|
379
|
+
var SvgCursorIcon = function SvgCursorIcon(props) {
|
|
380
|
+
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
381
|
+
viewBox: "0 0 20 20"
|
|
382
|
+
}, props), /*#__PURE__*/React__default.createElement("path", {
|
|
383
|
+
d: "M10.5 3.75a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0v-2.5Z"
|
|
384
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
385
|
+
d: "M14.28 6.28a.75.75 0 0 0-1.06-1.06l-1 1a.75.75 0 0 0 1.06 1.06l1-1Z"
|
|
386
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
387
|
+
d: "M7.28 13.28a.75.75 0 0 0-1.06-1.06l-1 1a.75.75 0 1 0 1.06 1.06l1-1Z"
|
|
388
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
389
|
+
d: "M7 9.75a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h2.5a.75.75 0 0 1 .75.75Z"
|
|
390
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
391
|
+
d: "M5.97 7.03a.75.75 0 0 0 1.06-1.06l-1.75-1.75a.75.75 0 0 0-1.06 1.06l1.75 1.75Z"
|
|
392
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
393
|
+
fillRule: "evenodd",
|
|
394
|
+
d: "M8.22 8.22a.75.75 0 0 1 .767-.181l7.5 2.5a.75.75 0 0 1 .293 1.241l-1.97 1.97 1.97 1.97a.75.75 0 1 1-1.06 1.06l-1.97-1.97-1.97 1.97a.75.75 0 0 1-1.241-.293l-2.5-7.5a.75.75 0 0 1 .18-.767Zm4.998 5.001.002-.001.001-.002 1.64-1.64-4.925-1.642 1.642 4.926 1.64-1.64Z"
|
|
395
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
396
|
+
d: "M10.5 3.75a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0v-2.5Z"
|
|
397
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
398
|
+
d: "M14.28 6.28a.75.75 0 0 0-1.06-1.06l-1 1a.75.75 0 0 0 1.06 1.06l1-1Z"
|
|
399
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
400
|
+
d: "M7.28 13.28a.75.75 0 0 0-1.06-1.06l-1 1a.75.75 0 1 0 1.06 1.06l1-1Z"
|
|
401
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
402
|
+
d: "M7 9.75a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h2.5a.75.75 0 0 1 .75.75Z"
|
|
403
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
404
|
+
d: "M5.97 7.03a.75.75 0 0 0 1.06-1.06l-1.75-1.75a.75.75 0 0 0-1.06 1.06l1.75 1.75Z"
|
|
405
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
406
|
+
fillRule: "evenodd",
|
|
407
|
+
d: "M8.22 8.22a.75.75 0 0 1 .767-.181l7.5 2.5a.75.75 0 0 1 .293 1.241l-1.97 1.97 1.97 1.97a.75.75 0 1 1-1.06 1.06l-1.97-1.97-1.97 1.97a.75.75 0 0 1-1.241-.293l-2.5-7.5a.75.75 0 0 1 .18-.767Zm4.998 5.001.002-.001.001-.002 1.64-1.64-4.925-1.642 1.642 4.926 1.64-1.64Z"
|
|
408
|
+
}));
|
|
409
|
+
};
|
|
410
|
+
SvgCursorIcon.displayName = "CursorIcon";
|
|
411
|
+
|
|
358
412
|
var SvgDeleteIcon = function SvgDeleteIcon(props) {
|
|
359
413
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
360
414
|
viewBox: "0 0 20 20"
|
|
@@ -369,6 +423,17 @@ var SvgDeleteIcon = function SvgDeleteIcon(props) {
|
|
|
369
423
|
};
|
|
370
424
|
SvgDeleteIcon.displayName = "DeleteIcon";
|
|
371
425
|
|
|
426
|
+
var SvgExternalSmallIcon = function SvgExternalSmallIcon(props) {
|
|
427
|
+
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
428
|
+
viewBox: "0 0 20 20"
|
|
429
|
+
}, props), /*#__PURE__*/React__default.createElement("path", {
|
|
430
|
+
d: "M11.75 4.5a.75.75 0 0 0 0 1.5h1.19l-2.72 2.72a.75.75 0 1 0 1.06 1.06l2.72-2.72v1.19a.75.75 0 0 0 1.5 0v-3a.75.75 0 0 0-.75-.75h-3Z"
|
|
431
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
432
|
+
d: "M15 11.25a.75.75 0 0 0-1.5 0v1c0 .69-.56 1.25-1.25 1.25h-4.5c-.69 0-1.25-.56-1.25-1.25v-4.5c0-.69.56-1.25 1.25-1.25h1a.75.75 0 0 0 0-1.5h-1a2.75 2.75 0 0 0-2.75 2.75v4.5a2.75 2.75 0 0 0 2.75 2.75h4.5a2.75 2.75 0 0 0 2.75-2.75v-1Z"
|
|
433
|
+
}));
|
|
434
|
+
};
|
|
435
|
+
SvgExternalSmallIcon.displayName = "ExternalSmallIcon";
|
|
436
|
+
|
|
372
437
|
var SvgInfoIcon = function SvgInfoIcon(props) {
|
|
373
438
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
374
439
|
viewBox: "0 0 20 20"
|
|
@@ -405,6 +470,16 @@ var SvgOrderIcon = function SvgOrderIcon(props) {
|
|
|
405
470
|
};
|
|
406
471
|
SvgOrderIcon.displayName = "OrderIcon";
|
|
407
472
|
|
|
473
|
+
var SvgPaymentIcon = function SvgPaymentIcon(props) {
|
|
474
|
+
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
475
|
+
viewBox: "0 0 20 20"
|
|
476
|
+
}, props), /*#__PURE__*/React__default.createElement("path", {
|
|
477
|
+
fillRule: "evenodd",
|
|
478
|
+
d: "M9.621 4h5.258c.395 0 .736 0 1.017.023.297.024.592.078.875.222.424.216.768.56.984.984.144.283.198.578.222.875.023.28.023.622.023 1.017v2.258c0 .395 0 .736-.023 1.017a2.29 2.29 0 0 1-.222.875 2.25 2.25 0 0 1-.983.984c-.284.144-.58.198-.876.222-.28.023-.622.023-1.017.023h-2.58c-.08.083-.169.16-.265.23l-2.73 1.965c-.565.407-.93.67-1.335.859-.358.167-.736.29-1.125.363-.44.083-.889.083-1.586.083h-1.508a.75.75 0 0 1 0-1.5h1.436c.794 0 1.095-.003 1.379-.057.266-.05.524-.134.77-.248.261-.122.508-.296 1.152-.76l2.67-1.923a.423.423 0 0 0-.35-.753l-4.875 1.219a.75.75 0 0 1-.364-1.456l.932-.233v-2.289c-.59.002-.821.011-1.033.062a2.25 2.25 0 0 0-.65.27c-.21.128-.398.31-.943.854l-.594.594a.75.75 0 0 1-1.06-1.06l.654-.655c.46-.46.78-.78 1.16-1.012a3.75 3.75 0 0 1 1.083-.45c.397-.095.813-.103 1.387-.103a6.79 6.79 0 0 1 .019-.396 2.29 2.29 0 0 1 .222-.875 2.25 2.25 0 0 1 .984-.984 2.29 2.29 0 0 1 .875-.222c.28-.023.622-.023 1.017-.023Zm5.229 7h-2.024a1.925 1.925 0 0 0-2.382-1.697l-2.444.611v-1.414h8.5v.85c0 .432 0 .712-.018.924-.017.204-.045.28-.064.317a.75.75 0 0 1-.328.327c-.037.02-.112.047-.316.064-.212.017-.492.018-.924.018Zm1.645-4.5h-8.49c.002-.104.006-.194.013-.274.017-.204.045-.28.064-.316a.75.75 0 0 1 .328-.328c.037-.02.112-.047.316-.064.212-.017.492-.018.924-.018h5.2c.432 0 .712 0 .924.018.204.017.28.045.316.064a.75.75 0 0 1 .328.328c.02.037.047.112.064.316.007.08.01.17.013.274Z"
|
|
479
|
+
}));
|
|
480
|
+
};
|
|
481
|
+
SvgPaymentIcon.displayName = "PaymentIcon";
|
|
482
|
+
|
|
408
483
|
var SvgPlusIcon = function SvgPlusIcon(props) {
|
|
409
484
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
410
485
|
viewBox: "0 0 20 20"
|
|
@@ -414,6 +489,19 @@ var SvgPlusIcon = function SvgPlusIcon(props) {
|
|
|
414
489
|
};
|
|
415
490
|
SvgPlusIcon.displayName = "PlusIcon";
|
|
416
491
|
|
|
492
|
+
var SvgProductRemoveIcon = function SvgProductRemoveIcon(props) {
|
|
493
|
+
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
494
|
+
viewBox: "0 0 20 20"
|
|
495
|
+
}, props), /*#__PURE__*/React__default.createElement("path", {
|
|
496
|
+
d: "M8.575 4.649a3.75 3.75 0 0 1 2.7-1.149h1.975a3.25 3.25 0 0 1 3.25 3.25v2.371c0 .766-.311 1.498-.863 2.029a.75.75 0 1 1-1.04-1.08c.258-.249.403-.591.403-.949v-2.371a1.75 1.75 0 0 0-1.75-1.75h-1.974a2.25 2.25 0 0 0-1.62.69l-4.254 4.417a1.25 1.25 0 0 0 .016 1.75l2.898 2.898a1 1 0 0 0 1.4.014l.451-.434a.75.75 0 1 1 1.04 1.08l-.45.434a2.5 2.5 0 0 1-3.502-.033l-2.898-2.898a2.75 2.75 0 0 1-.036-3.852l4.254-4.417Z"
|
|
497
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
498
|
+
d: "M14 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"
|
|
499
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
500
|
+
d: "M12.25 12.25a.75.75 0 0 0 0 1.5h4a.75.75 0 0 0 0-1.5h-4Z"
|
|
501
|
+
}));
|
|
502
|
+
};
|
|
503
|
+
SvgProductRemoveIcon.displayName = "ProductRemoveIcon";
|
|
504
|
+
|
|
417
505
|
var SvgSearchIcon = function SvgSearchIcon(props) {
|
|
418
506
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
419
507
|
viewBox: "0 0 20 20"
|
|
@@ -594,21 +682,26 @@ function sortByArrayOrder(array, order, sortOrder = 'asc') {
|
|
|
594
682
|
dayjs.extend(utc);
|
|
595
683
|
dayjs.extend(timezone);
|
|
596
684
|
dayjs.extend(quarterOfYear);
|
|
597
|
-
let
|
|
685
|
+
// Stored on `globalThis` (not a module-local `let`): each entry-point bundle gets its
|
|
686
|
+
// own copy of this module, so a local var would let `setTz` and the query builder read
|
|
687
|
+
// different copies. A shared global slot keeps every bundle in sync.
|
|
688
|
+
const TZ_GLOBAL_KEY = '__GEM_SDK_ANALYTICS_TZ__';
|
|
598
689
|
const DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
|
599
690
|
function getInitialTimezone() {
|
|
600
|
-
return
|
|
691
|
+
return globalThis[TZ_GLOBAL_KEY] ?? 'UTC';
|
|
601
692
|
}
|
|
602
693
|
function setTz(value) {
|
|
603
|
-
|
|
694
|
+
globalThis[TZ_GLOBAL_KEY] = value;
|
|
604
695
|
dayjs.tz.setDefault(value);
|
|
605
696
|
}
|
|
606
697
|
const dayjsTz = (date) => {
|
|
698
|
+
const tz = getInitialTimezone();
|
|
607
699
|
if (!date)
|
|
608
700
|
return dayjs().tz(tz);
|
|
609
701
|
return dayjs(date).tz(tz);
|
|
610
702
|
};
|
|
611
703
|
const convertDateToTz = (date) => {
|
|
704
|
+
const tz = getInitialTimezone();
|
|
612
705
|
if (!date)
|
|
613
706
|
return dayjs.tz(dayjs().format(DEFAULT_DATE_FORMAT), tz);
|
|
614
707
|
return dayjs.tz(dayjs(date).format(DEFAULT_DATE_FORMAT), tz);
|
|
@@ -691,7 +784,7 @@ const getFormattedByInterval = (value, interval, options) => {
|
|
|
691
784
|
const deepCopy = (obj) => {
|
|
692
785
|
if (typeof obj !== 'object' || obj === null)
|
|
693
786
|
return obj;
|
|
694
|
-
return
|
|
787
|
+
return structuredClone(obj);
|
|
695
788
|
};
|
|
696
789
|
|
|
697
790
|
var TemplateType;
|
|
@@ -750,6 +843,25 @@ const toCapitalize = (string) => {
|
|
|
750
843
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
751
844
|
};
|
|
752
845
|
|
|
846
|
+
function findLastIndex(array, predicate, thisArg) {
|
|
847
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
|
848
|
+
if (predicate.call(thisArg, array[i], i, array)) {
|
|
849
|
+
return i;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
return -1;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
const isBrowser$1 = () => {
|
|
856
|
+
return typeof window !== 'undefined';
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
const formatDateBy = (format, date) => {
|
|
860
|
+
if (!date)
|
|
861
|
+
date = new Date();
|
|
862
|
+
return dayjsTz(date).format(format) ?? '-';
|
|
863
|
+
};
|
|
864
|
+
|
|
753
865
|
const GClickable = ({ children, fullWidth = false, cursor = 'pointer', onClick, onMouseEnter, onMouseLeave, }) => {
|
|
754
866
|
return (jsx("div", { role: "button", tabIndex: 0, className: cls({
|
|
755
867
|
'w-full': fullWidth,
|
|
@@ -943,11 +1055,10 @@ const GCheckboxMultiple = ({ options, onChange, onChangeSingleValue, emptySelect
|
|
|
943
1055
|
}
|
|
944
1056
|
return [];
|
|
945
1057
|
});
|
|
946
|
-
|
|
947
|
-
}, [selected]);
|
|
1058
|
+
}, [selected, options]);
|
|
948
1059
|
return (jsx(BlockStack, { children: options.map((item) => {
|
|
949
1060
|
const hasForceUnchecked = dependentDisabledValues?.has(item.value);
|
|
950
|
-
const isOnlyOneSelected = emptySelected &&
|
|
1061
|
+
const isOnlyOneSelected = !!emptySelected && settingOptions.length === 1;
|
|
951
1062
|
const handleCheckboxClick = () => {
|
|
952
1063
|
if (isOnlyOneSelected)
|
|
953
1064
|
return;
|
|
@@ -1025,13 +1136,16 @@ function GOptionList({ options, selected, onChange }) {
|
|
|
1025
1136
|
}) }) }));
|
|
1026
1137
|
}
|
|
1027
1138
|
|
|
1139
|
+
const defaultFormatActivatorContent = (text) => text.join(', ');
|
|
1028
1140
|
const GSelector = (props) => {
|
|
1029
1141
|
const [popoverActive, setPopoverActive] = useState(false);
|
|
1030
|
-
const { activatorText, selected, options, emptyLabel, preferredAlignment = 'right', formatActivatorContent =
|
|
1142
|
+
const { activatorText, selected, options, emptyLabel, preferredAlignment = 'right', formatActivatorContent = defaultFormatActivatorContent, } = props;
|
|
1031
1143
|
const togglePopoverActive = useCallback(() => setPopoverActive((prev) => !prev), []);
|
|
1032
1144
|
const selectedOption = useMemo(() => {
|
|
1145
|
+
// `choice` variant passes selected as string[]; `action-list` as a single string.
|
|
1146
|
+
const isSelected = (id) => (Array.isArray(selected) ? selected.includes(id) : id === selected);
|
|
1033
1147
|
return options
|
|
1034
|
-
.filter((item) => item.active || item.id
|
|
1148
|
+
.filter((item) => item.active || isSelected(item.id))
|
|
1035
1149
|
.map((item) => item.content || '')
|
|
1036
1150
|
.filter((item) => !!item);
|
|
1037
1151
|
}, [options, selected]);
|
|
@@ -1045,15 +1159,15 @@ const GSelector = (props) => {
|
|
|
1045
1159
|
}
|
|
1046
1160
|
return activatorText;
|
|
1047
1161
|
}, [selectedOption, emptyLabel, activatorText, formatActivatorContent]);
|
|
1048
|
-
const
|
|
1162
|
+
const renderSelectorMarkup = () => {
|
|
1049
1163
|
switch (props.variant) {
|
|
1050
1164
|
case 'choice':
|
|
1051
1165
|
return jsx(GSelectorChoice, { ...props, setPopoverActive: togglePopoverActive });
|
|
1052
1166
|
case 'action-list':
|
|
1053
1167
|
return jsx(GSelectorActionList, { ...props, setPopoverActive: togglePopoverActive });
|
|
1054
1168
|
}
|
|
1055
|
-
}
|
|
1056
|
-
return (jsx(Popover, { active: popoverActive, activator: jsx("div", { className: "flex items-center gap-1", children: jsx(Button, { onClick: togglePopoverActive, disclosure: popoverActive ? 'up' : 'down', children: activatorContent }) }), autofocusTarget: "first-node", fluidContent: true, onClose: togglePopoverActive, preferredAlignment: preferredAlignment, children:
|
|
1169
|
+
};
|
|
1170
|
+
return (jsx(Popover, { active: popoverActive, activator: jsx("div", { className: "flex items-center gap-1", children: jsx(Button, { onClick: togglePopoverActive, disclosure: popoverActive ? 'up' : 'down', children: activatorContent }) }), autofocusTarget: "first-node", fluidContent: true, onClose: togglePopoverActive, preferredAlignment: preferredAlignment, children: renderSelectorMarkup() }));
|
|
1057
1171
|
};
|
|
1058
1172
|
const GSelectorChoice = ({ options, selected, onSelect, maxWidth, minWidth, clearable, setPopoverActive, }) => {
|
|
1059
1173
|
const { t } = useTranslation();
|
|
@@ -1246,7 +1360,7 @@ const GPagination = ({ currentPage, totalPages, loading, handlePageChange, ...pa
|
|
|
1246
1360
|
return (jsxs(InlineStack, { gap: "500", blockAlign: "center", children: [jsx(Pagination$1, { ...paginationProps, hasPrevious: !loading && hasPrevious, onPrevious: () => handlePageChange(GPaginationDirection.PREVIOUS), hasNext: !loading && hasNext, onNext: () => handlePageChange(GPaginationDirection.NEXT) }), totalPages > 1 && (jsxs(Text, { as: "span", variant: "bodyMd", numeric: true, children: [currentPage, "/", totalPages] }))] }));
|
|
1247
1361
|
};
|
|
1248
1362
|
|
|
1249
|
-
const GInlineCenter = ({ align, inlineAlign, width, ...props }) => {
|
|
1363
|
+
const GInlineCenter = ({ align, inlineAlign, width, flexDirection, gap, ...props }) => {
|
|
1250
1364
|
const stickyStyle = useMemo(() => {
|
|
1251
1365
|
const style = {};
|
|
1252
1366
|
return style;
|
|
@@ -1255,8 +1369,8 @@ const GInlineCenter = ({ align, inlineAlign, width, ...props }) => {
|
|
|
1255
1369
|
...stickyStyle,
|
|
1256
1370
|
'--gp-inline-center-box-align': align,
|
|
1257
1371
|
'--gp-inline-center-box-inline-align': inlineAlign,
|
|
1258
|
-
'--gp-inline-center-box-flex-direction':
|
|
1259
|
-
'--gp-inline-center-box-gap':
|
|
1372
|
+
'--gp-inline-center-box-flex-direction': flexDirection,
|
|
1373
|
+
'--gp-inline-center-box-gap': gap ? `${(Number(gap) * 4) / 100}px` : undefined,
|
|
1260
1374
|
'--gp-inline-center-width': width,
|
|
1261
1375
|
}, children: jsx(Box, { ...props, minWidth: "0" }) }));
|
|
1262
1376
|
};
|
|
@@ -1797,7 +1911,7 @@ const fetchCurrencyRates = async () => {
|
|
|
1797
1911
|
};
|
|
1798
1912
|
const useFetchCurrencyRates = () => {
|
|
1799
1913
|
const setCurrencyRates = useCurrencyRatesStore((state) => state.setCurrencyRates);
|
|
1800
|
-
const { data } = useQuery({
|
|
1914
|
+
const { data, error, isError } = useQuery({
|
|
1801
1915
|
queryKey: ['sdk-currency-rates'],
|
|
1802
1916
|
queryFn: fetchCurrencyRates,
|
|
1803
1917
|
staleTime: 1000 * 60 * 60, // 1 hour — rates don't change often
|
|
@@ -1806,6 +1920,12 @@ const useFetchCurrencyRates = () => {
|
|
|
1806
1920
|
if (data)
|
|
1807
1921
|
setCurrencyRates(data);
|
|
1808
1922
|
}, [data, setCurrencyRates]);
|
|
1923
|
+
// Surface fetch failures: without rates, money renders in the base currency unconverted.
|
|
1924
|
+
useEffect(() => {
|
|
1925
|
+
if (isError)
|
|
1926
|
+
console.error('[gem-sdk/analytics] Failed to fetch currency rates:', error);
|
|
1927
|
+
}, [isError, error]);
|
|
1928
|
+
return { isError, error };
|
|
1809
1929
|
};
|
|
1810
1930
|
|
|
1811
1931
|
const getPriceByCurrency = (price, currency = DEFAULT_CURRENCY_ANALYTIC, options) => {
|
|
@@ -1816,34 +1936,26 @@ const getPriceByCurrency = (price, currency = DEFAULT_CURRENCY_ANALYTIC, options
|
|
|
1816
1936
|
// Support legacy 3rd arg as locale string
|
|
1817
1937
|
const opts = typeof options === 'string' ? { locale: options } : options;
|
|
1818
1938
|
const locale = opts?.locale ?? 'en-US';
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
minimumFractionDigits: 2,
|
|
1824
|
-
maximumFractionDigits: 2,
|
|
1825
|
-
}).format(price / 1_000_000_000)}B`;
|
|
1826
|
-
}
|
|
1827
|
-
if (price >= 1_000_000) {
|
|
1828
|
-
return `${new Intl.NumberFormat(locale, {
|
|
1829
|
-
style: 'currency',
|
|
1830
|
-
currency,
|
|
1831
|
-
minimumFractionDigits: 2,
|
|
1832
|
-
maximumFractionDigits: 2,
|
|
1833
|
-
}).format(price / 1_000_000)}M`;
|
|
1834
|
-
}
|
|
1835
|
-
if (opts?.compact && Math.abs(price) >= 1_000) {
|
|
1836
|
-
return `${new Intl.NumberFormat(locale, {
|
|
1837
|
-
style: 'currency',
|
|
1838
|
-
currency,
|
|
1839
|
-
minimumFractionDigits: 1,
|
|
1840
|
-
maximumFractionDigits: 1,
|
|
1841
|
-
}).format(price / 1_000)}K`;
|
|
1842
|
-
}
|
|
1843
|
-
return new Intl.NumberFormat(locale, {
|
|
1939
|
+
// Currency's natural minimum (USD → 2, JPY/KRW/VND → 0); used as the floor for scaled tiers.
|
|
1940
|
+
const currencyMinDigits = new Intl.NumberFormat(locale, { style: 'currency', currency }).resolvedOptions().minimumFractionDigits ?? 0;
|
|
1941
|
+
// For scaled tiers, allow extra precision but never force decimals on zero-decimal currencies.
|
|
1942
|
+
const formatCurrency = (value, maxDigits) => new Intl.NumberFormat(locale, {
|
|
1844
1943
|
style: 'currency',
|
|
1845
1944
|
currency,
|
|
1846
|
-
|
|
1945
|
+
...(maxDigits != null && {
|
|
1946
|
+
minimumFractionDigits: Math.min(currencyMinDigits, maxDigits),
|
|
1947
|
+
maximumFractionDigits: maxDigits,
|
|
1948
|
+
}),
|
|
1949
|
+
}).format(value);
|
|
1950
|
+
const magnitude = Math.abs(price);
|
|
1951
|
+
if (magnitude >= 1_000_000_000)
|
|
1952
|
+
return `${formatCurrency(price / 1_000_000_000, 2)}B`;
|
|
1953
|
+
if (magnitude >= 1_000_000)
|
|
1954
|
+
return `${formatCurrency(price / 1_000_000, 2)}M`;
|
|
1955
|
+
if (opts?.compact && magnitude >= 1_000)
|
|
1956
|
+
return `${formatCurrency(price / 1_000, 1)}K`;
|
|
1957
|
+
// Let Intl pick fraction digits per currency (e.g. JPY/KRW have 0) instead of hardcoding.
|
|
1958
|
+
return formatCurrency(price);
|
|
1847
1959
|
};
|
|
1848
1960
|
|
|
1849
1961
|
const ConvertMoneyContext = createContext({
|
|
@@ -1854,10 +1966,12 @@ const ConvertMoneyContext = createContext({
|
|
|
1854
1966
|
},
|
|
1855
1967
|
});
|
|
1856
1968
|
const convertAmount = (amount, from, to, rates) => {
|
|
1857
|
-
if (from === to
|
|
1969
|
+
if (from === to)
|
|
1858
1970
|
return amount;
|
|
1971
|
+
if (!rates[from] || !rates[to])
|
|
1972
|
+
return null;
|
|
1859
1973
|
const converted = (amount * rates[from]) / rates[to];
|
|
1860
|
-
return converted ?
|
|
1974
|
+
return Number.isFinite(converted) ? converted : null;
|
|
1861
1975
|
};
|
|
1862
1976
|
const ConvertMoneyProvider = ({ children, currency, locale = 'en-US' }) => {
|
|
1863
1977
|
useFetchCurrencyRates();
|
|
@@ -1869,10 +1983,16 @@ const ConvertMoneyProvider = ({ children, currency, locale = 'en-US' }) => {
|
|
|
1869
1983
|
return '0';
|
|
1870
1984
|
if (!currency)
|
|
1871
1985
|
return price.toString();
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1986
|
+
let displayAmount = price;
|
|
1987
|
+
let displayCurrency = DEFAULT_CURRENCY_ANALYTIC;
|
|
1988
|
+
if (currencyRates) {
|
|
1989
|
+
const converted = convertAmount(price, DEFAULT_CURRENCY_ANALYTIC, currency, currencyRates);
|
|
1990
|
+
if (converted !== null) {
|
|
1991
|
+
displayAmount = converted;
|
|
1992
|
+
displayCurrency = currency;
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
return trimDecimalZeros(getPriceByCurrency(displayAmount, displayCurrency, { locale, compact: options?.compact }) ?? '0');
|
|
1876
1996
|
}, [currency, locale, currencyRates]);
|
|
1877
1997
|
const value = useMemo(() => ({ getTextPrice }), [getTextPrice]);
|
|
1878
1998
|
return jsx(ConvertMoneyContext.Provider, { value: value, children: children });
|
|
@@ -2131,7 +2251,13 @@ const parseBreakdownItems = (raw) => parseJsonArray(raw)?.map((item) => ({ ...it
|
|
|
2131
2251
|
|
|
2132
2252
|
const readNumeric = (metric, key) => {
|
|
2133
2253
|
const raw = metric?.[key];
|
|
2134
|
-
|
|
2254
|
+
if (typeof raw === 'number')
|
|
2255
|
+
return raw;
|
|
2256
|
+
if (typeof raw === 'string') {
|
|
2257
|
+
const n = parseFloat(raw);
|
|
2258
|
+
return isNaN(n) ? 0 : n;
|
|
2259
|
+
}
|
|
2260
|
+
return 0;
|
|
2135
2261
|
};
|
|
2136
2262
|
|
|
2137
2263
|
const useAnalyticData = ({ getTextPrice: getTextPriceParam, } = {}) => {
|
|
@@ -2187,10 +2313,11 @@ const usePopoverResizeObserver = ({ active, onHeightChange, selector = '.Polaris
|
|
|
2187
2313
|
resizeObserver.observe(popoverContent);
|
|
2188
2314
|
}
|
|
2189
2315
|
};
|
|
2190
|
-
setTimeout(() => {
|
|
2316
|
+
const timer = setTimeout(() => {
|
|
2191
2317
|
setupResizeObserver();
|
|
2192
2318
|
}, 200);
|
|
2193
2319
|
return () => {
|
|
2320
|
+
clearTimeout(timer);
|
|
2194
2321
|
if (resizeObserver) {
|
|
2195
2322
|
resizeObserver.disconnect();
|
|
2196
2323
|
resizeObserver = null;
|
|
@@ -2242,6 +2369,18 @@ const useWindowSize = () => {
|
|
|
2242
2369
|
return { windowSize, windowWidth, isMobileTabletView, isMobileView };
|
|
2243
2370
|
};
|
|
2244
2371
|
|
|
2372
|
+
const usePreventBodyScroll = ({ enable }) => {
|
|
2373
|
+
useEffect(() => {
|
|
2374
|
+
if (!enable || !isBrowser$1())
|
|
2375
|
+
return;
|
|
2376
|
+
// Prevent layout shift from scrollbar removal
|
|
2377
|
+
document.body.style.overflowY = 'hidden';
|
|
2378
|
+
return () => {
|
|
2379
|
+
document.body.style.overflowY = 'unset';
|
|
2380
|
+
};
|
|
2381
|
+
}, [enable]);
|
|
2382
|
+
};
|
|
2383
|
+
|
|
2245
2384
|
// This default value is used in our tests so that consumers of Polaris Viz don't need to mock or fire a ResizeObserver event
|
|
2246
2385
|
const defaultEntry = process.env.NODE_ENV === 'test' ? { contentRect: { width: 500, height: 500 } } : null;
|
|
2247
2386
|
function resizeObserver(callback) {
|
|
@@ -2439,6 +2578,43 @@ const GBoxCard = ({ children, ...props }) => {
|
|
|
2439
2578
|
return (jsx(Box, { ...G_BOX_CARD_DEFAULT_PROPS, ...props, children: children }));
|
|
2440
2579
|
};
|
|
2441
2580
|
|
|
2581
|
+
/**
|
|
2582
|
+
* Wraps its children with a demo-experiment tooltip when `isMockData` is true.
|
|
2583
|
+
* When `isMockData` is false it renders the children untouched.
|
|
2584
|
+
*
|
|
2585
|
+
* Keeps the demo copy in a single place so it only needs to be edited here.
|
|
2586
|
+
*/
|
|
2587
|
+
const GMockDataTooltip = ({ isMockData, content, children, ...props }) => {
|
|
2588
|
+
const { t } = useTranslation();
|
|
2589
|
+
return (jsx(GTooltip, { isEnabled: isMockData, content: content ?? t('This is just a demo experiment. Create a real one to view order listing.'), dismissOnMouseOut: true, ...props, children: children }));
|
|
2590
|
+
};
|
|
2591
|
+
|
|
2592
|
+
const GDotInline = ({ tone }) => {
|
|
2593
|
+
const textColor = getTextColorByTone();
|
|
2594
|
+
return jsx("span", { className: textColor, children: "\u2022" });
|
|
2595
|
+
function getTextColorByTone() {
|
|
2596
|
+
switch (tone) {
|
|
2597
|
+
case 'inherit':
|
|
2598
|
+
return 'text-inherit';
|
|
2599
|
+
case 'disabled':
|
|
2600
|
+
return 'text-[#B5B5B5]';
|
|
2601
|
+
default:
|
|
2602
|
+
return 'text-inherit';
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
};
|
|
2606
|
+
|
|
2607
|
+
const GSpinner = (props) => {
|
|
2608
|
+
return (jsx("div", { className: cls('Polaris-GSpinner', props.tone ? `Polaris-GSpinner--${props.tone}` : undefined), children: jsx(Spinner, { ...props }) }));
|
|
2609
|
+
};
|
|
2610
|
+
|
|
2611
|
+
const GModal = ({ children, primaryAction, secondaryActions, ...props }) => {
|
|
2612
|
+
const { isMobileView } = useWindowSize();
|
|
2613
|
+
const resolvedSecondaryActions = secondaryActions ?? [];
|
|
2614
|
+
const showMobileFooter = isMobileView && (primaryAction || resolvedSecondaryActions.length > 0);
|
|
2615
|
+
return (jsxs(Modal, { ...props, size: isMobileView ? 'small' : props.size, primaryAction: showMobileFooter ? undefined : primaryAction, secondaryActions: showMobileFooter ? undefined : secondaryActions, children: [children, showMobileFooter && (jsx(Box, { padding: "400", borderBlockStartWidth: "025", borderColor: "border-secondary", children: jsxs(BlockStack, { gap: "200", children: [jsx(Button, { ...primaryAction, onClick: primaryAction?.onAction, variant: "primary", fullWidth: true, children: primaryAction?.content ?? 'Save' }), resolvedSecondaryActions.map((action, index) => (createElement(Button, { ...action, key: index, fullWidth: true, onClick: action.onAction }, action.content)))] }) }))] }));
|
|
2616
|
+
};
|
|
2617
|
+
|
|
2442
2618
|
const GChartSkeleton = () => {
|
|
2443
2619
|
return jsx(GSkeletonDisplayText, { height: "188px" });
|
|
2444
2620
|
};
|
|
@@ -2464,6 +2640,20 @@ const MetricChartProvider = ({ children, minHeight = CHART_MIN_HEIGHT, seriesCol
|
|
|
2464
2640
|
}, children: children })] }));
|
|
2465
2641
|
};
|
|
2466
2642
|
|
|
2643
|
+
const TimezoneContext = createContext({ tz: 'UTC' });
|
|
2644
|
+
const TimezoneProvider = ({ children, tz }) => {
|
|
2645
|
+
const [currentTz, setCurrentTz] = useState(() => {
|
|
2646
|
+
setTz(tz);
|
|
2647
|
+
return tz;
|
|
2648
|
+
});
|
|
2649
|
+
useEffect(() => {
|
|
2650
|
+
setTz(tz);
|
|
2651
|
+
setCurrentTz(tz);
|
|
2652
|
+
}, [tz]);
|
|
2653
|
+
return jsx(TimezoneContext.Provider, { value: { tz: currentTz }, children: children });
|
|
2654
|
+
};
|
|
2655
|
+
const useTimezoneContext = () => useContext(TimezoneContext);
|
|
2656
|
+
|
|
2467
2657
|
const MetricChart = ({ lineChartData, isLoading, isEmptyMetricData, columnTypes, metricKey, }) => {
|
|
2468
2658
|
const { formatValue, yAxisOptions } = useFormatLineChartData({ metricKey, columnTypes: columnTypes || {} });
|
|
2469
2659
|
if (!metricKey) {
|
|
@@ -2518,13 +2708,15 @@ const MetricPercentage = ({ change }) => {
|
|
|
2518
2708
|
|
|
2519
2709
|
const MetricChartTooltip = ({ data, formatValue }) => {
|
|
2520
2710
|
const { activeIndex } = data;
|
|
2521
|
-
const currentData = data?.dataSeries[0]?.data[activeIndex];
|
|
2522
|
-
const previousData = data?.dataSeries[1]?.data[activeIndex];
|
|
2711
|
+
const currentData = data?.dataSeries?.[0]?.data?.[activeIndex];
|
|
2712
|
+
const previousData = data?.dataSeries?.[1]?.data?.[activeIndex];
|
|
2523
2713
|
const formatPercent = () => {
|
|
2524
2714
|
const value = currentData.trend?.value;
|
|
2525
2715
|
if (!value)
|
|
2526
2716
|
return PLACEHOLDER_VALUE$1;
|
|
2527
2717
|
const valueNumber = Number(value.replace(/[%~]/g, ''));
|
|
2718
|
+
if (!Number.isFinite(valueNumber))
|
|
2719
|
+
return PLACEHOLDER_VALUE$1;
|
|
2528
2720
|
if (currentData.trend?.trend === 'negative') {
|
|
2529
2721
|
return valueNumber * -1;
|
|
2530
2722
|
}
|
|
@@ -2544,26 +2736,28 @@ const MetricDonutChartSkeleton = () => {
|
|
|
2544
2736
|
return (jsx(Card, { children: jsxs(BlockStack, { gap: "400", children: [jsx(MetricInfoSkeleton, { isShowOneLine: true }), jsx(GChartSkeleton, {})] }) }));
|
|
2545
2737
|
};
|
|
2546
2738
|
|
|
2547
|
-
const MetricValueSummary = ({ totalValue, hideComparison }) => (jsx(BlockStack, { gap: "200", children: jsxs(InlineStack, { blockAlign: "center", gap: "200",
|
|
2739
|
+
const MetricValueSummary = ({ totalValue, hideComparison }) => (jsx(BlockStack, { gap: "200", children: jsxs(InlineStack, { blockAlign: "center", gap: "200", children: [jsx(InlineStack, { blockAlign: "center", gap: "200", children: jsx(Text, { as: "span", variant: "headingSm", children: totalValue.value }) }), !hideComparison && jsx(MetricPercentage, { change: totalValue.change })] }) }));
|
|
2548
2740
|
|
|
2549
|
-
const MetricInfoBlock = ({ item, isHovered, isLoading, hideComparison, titleVariant = 'headingMd', titleFontWeight, onClickTitle, }) => {
|
|
2741
|
+
const MetricInfoBlock = ({ item, isHovered, isLoading, hideComparison, titleVariant = 'headingMd', titleFontWeight, isMockData, onClickTitle, }) => {
|
|
2550
2742
|
const { key, title, totalValue } = item;
|
|
2551
2743
|
const tooltip = ANALYTICS_METRIC_TOOLTIP[key];
|
|
2552
2744
|
if (isLoading)
|
|
2553
2745
|
return jsx(MetricInfoSkeleton, {});
|
|
2554
|
-
return (jsxs(BlockStack, { gap: "200", children: [jsx("div", { className:
|
|
2746
|
+
return (jsxs(BlockStack, { gap: "200", children: [jsx("div", { className: isMockData ? undefined : 'hover:cursor-pointer hover:text-[--p-color-text-link-hover]', onClick: (e) => {
|
|
2747
|
+
if (isMockData)
|
|
2748
|
+
return;
|
|
2555
2749
|
e?.stopPropagation();
|
|
2556
2750
|
onClickTitle?.(key);
|
|
2557
|
-
}, children: jsxs(InlineStack, { wrap: false, children: [jsx(Box, { maxWidth: "100%", overflowX: "hidden", children: jsx(GTooltipCard, { tooltip: tooltip, children: jsx(Text, { as: "span", variant: titleVariant, fontWeight: titleFontWeight, truncate: true, children: title }) }) }), isHovered && (jsx("div", { className: "flex h-[20px] w-[20px] items-center", children: jsx(Icon, { source: SvgChevronRightIcon, tone: "inherit" }) }))] }) }), jsx(MetricValueSummary, { totalValue: totalValue, hideComparison: hideComparison })] }));
|
|
2751
|
+
}, children: jsxs(InlineStack, { wrap: false, children: [jsx(Box, { maxWidth: "100%", overflowX: "hidden", children: jsx(GTooltipCard, { tooltip: tooltip, children: jsx(Text, { as: "span", variant: titleVariant, fontWeight: titleFontWeight, truncate: true, children: title }) }) }), isHovered && !isMockData && (jsx("div", { className: "flex h-[20px] w-[20px] items-center", children: jsx(Icon, { source: SvgChevronRightIcon, tone: "inherit" }) }))] }) }), jsx(MetricValueSummary, { totalValue: totalValue, hideComparison: hideComparison })] }));
|
|
2558
2752
|
};
|
|
2559
2753
|
|
|
2560
|
-
const MetricChartTab = ({ item, isActive, isLoading, hideComparison, onSelect, onClickTitle, }) => {
|
|
2754
|
+
const MetricChartTab = ({ item, isActive, isLoading, hideComparison, isMockData, onSelect, onClickTitle, }) => {
|
|
2561
2755
|
const [isHovered, setIsHovered] = useState(false);
|
|
2562
2756
|
const isHighlighted = isActive || isHovered;
|
|
2563
|
-
return (jsx("div", { className: "w-full cursor-pointer overflow-hidden", onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: () => onSelect(item.key), children: jsx(Box, { paddingBlock: "150", paddingInline: "300", borderRadius: "200", background: isHighlighted ? 'bg-surface-active' : undefined, children: jsx(MetricInfoBlock, { item: item, isHovered: isHovered, isLoading: isLoading, hideComparison: hideComparison, titleVariant: "headingSm", titleFontWeight: "semibold", onClickTitle: onClickTitle }) }) }));
|
|
2757
|
+
return (jsx("div", { className: "w-full cursor-pointer overflow-hidden", onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: () => onSelect(item.key), children: jsx(Box, { paddingBlock: "150", paddingInline: "300", borderRadius: "200", background: isHighlighted ? 'bg-surface-active' : undefined, children: jsx(MetricInfoBlock, { item: item, isHovered: isHovered, isLoading: isLoading, hideComparison: hideComparison, titleVariant: "headingSm", titleFontWeight: "semibold", isMockData: isMockData, onClickTitle: onClickTitle }) }) }));
|
|
2564
2758
|
};
|
|
2565
2759
|
|
|
2566
|
-
const GSelectableMetricChartCard = ({ metricInfo, dataChart, defaultActiveTab, isLoading, isEmptyMetricData, hideComparison, currentPeriodLabel = DEFAULT_CURRENT_PERIOD_LABEL, previousPeriodLabel = DEFAULT_PREVIOUS_PERIOD_LABEL, columnTypes, }) => {
|
|
2760
|
+
const GSelectableMetricChartCard = ({ metricInfo, dataChart, defaultActiveTab, isLoading, isEmptyMetricData, hideComparison, currentPeriodLabel = DEFAULT_CURRENT_PERIOD_LABEL, previousPeriodLabel = DEFAULT_PREVIOUS_PERIOD_LABEL, columnTypes, isMockData, onclickMetric, }) => {
|
|
2567
2761
|
const [activeTab, setActiveTab] = useState(defaultActiveTab);
|
|
2568
2762
|
const lineChartData = useMemo(() => {
|
|
2569
2763
|
const chartData = activeTab ? dataChart[activeTab] : undefined;
|
|
@@ -2579,7 +2773,7 @@ const GSelectableMetricChartCard = ({ metricInfo, dataChart, defaultActiveTab, i
|
|
|
2579
2773
|
gridTemplateColumns: `repeat(${metricInfo.length}, 1fr)`,
|
|
2580
2774
|
gap: '16px',
|
|
2581
2775
|
marginBottom: '16px',
|
|
2582
|
-
}, children: metricInfo.map((item) => (jsx(MetricChartTab, { item: item, isActive: activeTab === item.key, isLoading: isLoading, hideComparison: hideComparison, onSelect: setActiveTab }, item.key))) }), jsx(MetricChart, { lineChartData: lineChartData, isLoading: isLoading, isEmptyMetricData: isEmptyMetricData, metricKey: activeTab, columnTypes: columnTypes })] }));
|
|
2776
|
+
}, children: metricInfo.map((item) => (jsx(MetricChartTab, { item: item, isActive: activeTab === item.key, isLoading: isLoading, hideComparison: hideComparison, isMockData: isMockData, onSelect: setActiveTab, onClickTitle: onclickMetric }, item.key))) }), jsx(MetricChart, { lineChartData: lineChartData, isLoading: isLoading, isEmptyMetricData: isEmptyMetricData, metricKey: activeTab, columnTypes: columnTypes })] }));
|
|
2583
2777
|
};
|
|
2584
2778
|
|
|
2585
2779
|
EGroupOperator.OR;
|
|
@@ -2670,7 +2864,7 @@ const buildBreakdownDonutData = ({ targets, metricKey, totalsRow, comparisonTota
|
|
|
2670
2864
|
|
|
2671
2865
|
const DONUT_CHART_MIN_HEIGHT = 294;
|
|
2672
2866
|
const COMPACT_MAX_WIDTH = 1500;
|
|
2673
|
-
const MetricDonutChartCard = ({ label, metricKey, targets, totalsRow, comparisonTotalsRow, sort, isLoading, isEmptyMetricData, minHeight = DONUT_CHART_MIN_HEIGHT, onClick, }) => {
|
|
2867
|
+
const MetricDonutChartCard = ({ label, metricKey, targets, totalsRow, comparisonTotalsRow, sort, isLoading, isEmptyMetricData, minHeight = DONUT_CHART_MIN_HEIGHT, isMockData, onClick, }) => {
|
|
2674
2868
|
const tooltip = ANALYTICS_METRIC_TOOLTIP[metricKey];
|
|
2675
2869
|
const { windowWidth, windowSize } = useWindowSize();
|
|
2676
2870
|
const [isHovered, setIsHovered] = useState(false);
|
|
@@ -2682,20 +2876,22 @@ const MetricDonutChartCard = ({ label, metricKey, targets, totalsRow, comparison
|
|
|
2682
2876
|
return numberWithCommas(`${value}`);
|
|
2683
2877
|
};
|
|
2684
2878
|
const handleClickTitle = (event) => {
|
|
2879
|
+
if (isMockData)
|
|
2880
|
+
return;
|
|
2685
2881
|
event.stopPropagation();
|
|
2686
2882
|
onClick();
|
|
2687
2883
|
};
|
|
2688
2884
|
const isCompactView = windowWidth.lg && windowSize.width < COMPACT_MAX_WIDTH;
|
|
2689
|
-
return (jsx("div", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: jsx(Card, { children: jsxs(BlockStack, { gap: "200", children: [jsx(InlineStack, { children: jsx("div", { className:
|
|
2885
|
+
return (jsx("div", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: jsx(Card, { children: jsxs(BlockStack, { gap: "200", children: [jsx(InlineStack, { children: jsx("div", { className: isMockData ? undefined : 'hover:cursor-pointer hover:text-[--p-color-text-link-hover]', onClick: handleClickTitle, children: jsxs(InlineStack, { children: [jsx(GTooltipCard, { tooltip: tooltip, children: jsx(Text, { as: "h3", variant: "headingMd", children: label }) }), isHovered && !isMockData && jsx(Icon, { source: SvgChevronRightIcon, tone: "inherit" })] }) }) }), jsx("div", { className: cls('flex items-center justify-center', {
|
|
2690
2886
|
'max-h-[250px] overflow-hidden': isCompactView,
|
|
2691
2887
|
}), children: isEmptyMetricData ? (jsx(MetricChartEmpty, { title: "No data yet", description: "Data needs time to gather" })) : (jsx(MetricChartProvider, { minHeight: minHeight, seriesColors: {}, children: jsx(DonutChart, { data: data, legendPosition: "left", showLegendValues: true, showLegend: true, theme: "Light", tooltipOptions: {
|
|
2692
2888
|
valueFormatter: formatValue,
|
|
2693
2889
|
}, labelFormatter: formatValue }) })) })] }) }) }));
|
|
2694
2890
|
};
|
|
2695
2891
|
|
|
2696
|
-
const SingleMetricChartCard = ({ metricInfo, lineChartData, isLoading, hideComparison, columnTypes, isEmptyMetricData, onClickTitle, }) => {
|
|
2892
|
+
const SingleMetricChartCard = ({ metricInfo, lineChartData, isLoading, hideComparison, columnTypes, isEmptyMetricData, isMockData, onClickTitle, }) => {
|
|
2697
2893
|
const [isHovered, setIsHovered] = useState(false);
|
|
2698
|
-
return (jsx("div", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: jsx(Card, { children: jsxs(BlockStack, { gap: "200", children: [jsx(MetricInfoBlock, { item: metricInfo, isHovered: isHovered, isLoading: isLoading, hideComparison: hideComparison, onClickTitle: onClickTitle }), jsx(MetricChart, { lineChartData: lineChartData, isLoading: isLoading, isEmptyMetricData: isEmptyMetricData, columnTypes: columnTypes, metricKey: metricInfo.key })] }) }) }));
|
|
2894
|
+
return (jsx("div", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: jsx(Card, { children: jsxs(BlockStack, { gap: "200", children: [jsx(MetricInfoBlock, { item: metricInfo, isHovered: isHovered, isLoading: isLoading, hideComparison: hideComparison, isMockData: isMockData, onClickTitle: onClickTitle }), jsx(MetricChart, { lineChartData: lineChartData, isLoading: isLoading, isEmptyMetricData: isEmptyMetricData, columnTypes: columnTypes, metricKey: metricInfo.key })] }) }) }));
|
|
2699
2895
|
};
|
|
2700
2896
|
|
|
2701
2897
|
var IMAGE_FIRST_SESSION = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXAAAAC4CAMAAADNC0dgAAAAulBMVEUAAAD39/f39/f39/f39/f39/f8/Pz39/fb5P+WrPj///8aHB3j4+P09vfKzdDo6Ojy8vLl5ebd5f7h6P7n7Pzr6+vu7u5wcXLx8/nt8PsxNDn7+/vGxscphFrEzOS8yfakt/je5Pecsfjh4+zQ2fZjZnDr7vdSVFaHm95UnXt4sZd6f41Ek2/H0visvfTk7+vZ3OSOkJZXY4ipqqvX6OBIUm+u0cGRwKqpqqo3i2Vvc4CwtcGFkba82cvy+RBRAAAAB3RSTlMAduu/IJ8QQSls1wAACLJJREFUeNrs1kEKwEAIBEHdNfH/P84lhJzmtsJA1xMaUeN1516NQ9bOir/ajcOuX/JkuAes/Ho3RiS9tTPFi30yZlVEXI0xO6Iag242+KwMPvBROziZo1Y0RhFcI7g7gmsEd0dwjeDuCK4R3B3BNYK7I7hGcHcE1wjujuAawd0RXCO4O4JrBHdHcI3g7giuEdwdwTWCuyO4RnB3BNcI7u5h1+x2nIaBMHo5ThkrcVpbLVGbJlsVFthQEFqEBO//WnizTUddb6bEPyJInKv26kvPTMZu4v/Cef4L/9dJK1wanVtMAYmRRSHBZYY5KYUbhRfydM4Lrc4ZWgIx05x0wg0iKlP0baERMU9jw6BF5VrnV3WdbU4q4TJH1LAYqJ6+G4hOoWxMUT1ngLEhfffNOCeRcKkw73WTcoOoITKmrypRFYhKAsw4J7Zw8l0tXgAqmnHyULwIqXJUBcB8c9IIt2oXLqBCpgrvgTB97802J4lw3fe3CyBG7L6i9+Bi0wFgrjkphEvE3reLielCDR7cu90AzDUnhfB8uEKHSsVrcYP5SAogSoCZ5iQQLlFVixGKeC2uEMZSNBqAmeYkEG7QOJf2+Ovc4tGar6DGcwBEAJhnTgLhudsS37f3sZtPu3Pr86chpZ9c88xJIByxcnz/+HaZKRqioLByPGy/XxZnAzDPnPjCJeZjvi0y1hBH5Xr4QCkaYJ458YUXqGluk+8z4CucH63kgVLmmRNR+PFQ1/t91g3Cf2wfyXc8FevNalmWzZDy6V6Sh3gpcrOyMUK8mjMH4U29z55ph5543Frj5DtEBWmwEnqaIeV+ey/JQxzh69VSiPGcvy98/dBmF1pUCzJOvv0XTfJQioFyECGfTJCHAOFUVCG4nL8u/Fk3ccKKjJPv0P3D+skDgViRCfIQWlZJRU2TEy780GbX7Gjn+nj2TeSeO2S5FNfcISwuJshD4G5/XYqkOeHCj132Alo1Ld9e+AZU4MPGFUH/Z+UH8uD5f5aqmjQnXDi1N9Hi+NMH49yDviIa5okNt9nn2zttTrjwOnuNGnXU53iyF+G2XjEmwu/57EaIZDnhwsm3S3sKf4LMNx7feoXX3FoJkTYnXPg+G6EbGSra4wrJt9t6eRXhNiLfaXPChdfZKDUq8H8LyM8TQqEJf3NKvtPmhAt/yBjqV99zM1tCD9+iVKhDzwbQ/E6bEy78kFlY4/n1SQ7lda5gyZqIdfplLUTanHDhxzbj6U6IWl7OKinE3f4IU1ndNIEGrqqKzRKmIksxPccAQ3zh++wWbW2Vo9Ln03inzhYBJiLFLe4UYj6cYLSf7xohNjCRlfDIKROdvOIHCk+3O2HPaddlTxxgGqW4SdkovGB1W1wVngOcz1kBQ2Thx332h7Rd17Xt5dsaGBgTLE1z19P09ZmuohR+OcyPiS28zjx5gCmUwhMJE9gIT5bAES6cXzF5mBaPbcJt8QRlZVo8rnCa4OEtnsjE1Cm+EanqGi6c36K8//rMe7bFwWHq5vjw5WPPLo6KpUcKU9cUwpvsNb6+OfOWNd4A4bVZ+3jJ2cUYr9I/hd+Ahgvnl8yP9treWd7eMF4D4TNRflIOuQhYNjd8in9dw4XzE+U3e+ffmzYMhOH9dypZotZ2h4OqxKA0TJqogGnSBP3+n2sLK7mxiEvI2/No1ecLvOjxxflxtpklj5OGaU+NB2LGzCgnOQVee3ZEChNl9Wx9wzBJ8vDyE3tqvCZmxIxymlPAtWeAlO5ziobwdN4jfPpTNF7RMKwsvMkRXBgahodSujdnjQpf9QmfsHFgEjeSCs4psIs9x1Is9YJXeNkrnI1Lwsd9t+rkFNDF7rAUQ73gFR5E4Zv2eQq7a/oe4ZwD3TUdkNJAAnGE386SF75CwvMe4ZxTILOrBVIaYqxLuRGENzx8/82mFd6BCBfOOahwICWS8EwQznw+Lzw7kFLDOjtyTw332ZG1KJxzzqgw1R01pFkLcSL/AjMs5d0Iv8uOfIGEd1mv+4TfvhHhhAjHp5RODjilvAHhARMeiD6Et1yPcA8IBx8L5ZT4j4XlUOHYiw8o3BOjJ9ySgLbw/eQvMhY+oucj3M66OQX0ag+lGFXhcoNtlnybMM0rGtCBEGbXTs4MeudOgZRYH6/qcw2f5bRlmSRbnc+zm39zduDnWSBF9/MsE6QWm9BoQxoQzO40Z1mBDQggRb0BIa9Ked7+aNk+I19n5QV/+91jy24Pt9iAlFgttvkNANBEFsCayDL/v4lMi/G+Aw3GxzFhgZhYOyBW44VXNByjbILH9doXAvnxS91qGo6LY8JqDSsuHC/xki4gvfLFnI5EcOF4iV+4ByKPY8LqDyu+IF9vBsdV2AtNePVhxYXTk9IjCq4C33KCD2vcTVX4HZNxUSovtfrDim8b1JxQGBul8rz6sOLCqdRYi48X37jNZbnCqywmHDde0ihSE+VKd+qXES6cguINk/FG0TfjIvjGj+9QrG/GW0XfjFP3jQunlYJvYB43ngCcgm+1I5hkFhVBpE5FhHwp4c8nmHBgT/JTTSi5URAxamCtJ4hPhFIFzfJmF4oimNzKKcalhIELp7pcCLpXLALDW23d/coR3Swcp66Cnm7GO1XdrFyjutUO+2VCOSeQs4f9MsbmsAfhsF+27QnnlY+znq/KEA6qQ1lWNengc2cP2o2xLvcpqZD+STnGvFbKxx+Y/mKHjmkAAGAgCPl3XQefrpeABL6EVwnfhNcJ34TXCd+E1wnfhNcJ34TXCd+E1wnfhNcJ34TXCd+E1wnfhNcJ34TXCd+E1wnfhNcJ34TXCd+E1wnfhNcJ34TXCd+E1wnfhNcJ34Rfe/VyAjEQA0G09LF12vzTXTA2vs3NDQP9QihEa3cOvubgu3PwNQffnYOvOfjuHFyMHBNKakyoiDGh4BwTarwpSgfQfpsy2YBXXCfAxYWCW3hVBDLg0cfYx6qBV0f5zL/yy4oTLn9JSvy4U7oaTQAAAABJRU5ErkJggg==";
|
|
@@ -2930,7 +3126,7 @@ function formatDateTimeRange(data) {
|
|
|
2930
3126
|
if (sinceDate.isSame(untilDate, 'day')) {
|
|
2931
3127
|
return `${sinceDate.format(DATE_FORMAT.SHORT_WITH_TIME)} - ${endTime}`;
|
|
2932
3128
|
}
|
|
2933
|
-
if (sinceDate.isSame(untilDate, '
|
|
3129
|
+
if (sinceDate.isSame(untilDate, 'month')) {
|
|
2934
3130
|
const time = formatTimeRange({ since, until });
|
|
2935
3131
|
return `${sinceDate.format(DATE_FORMAT.SHORT)} (${time})`;
|
|
2936
3132
|
}
|
|
@@ -3202,6 +3398,7 @@ const COMPARE_DATE_TIME_FILTERS_MAP = {
|
|
|
3202
3398
|
};
|
|
3203
3399
|
|
|
3204
3400
|
const useDateTimeFilter = () => {
|
|
3401
|
+
useTimezoneContext();
|
|
3205
3402
|
const currentDate = dayjsTzToLocalTZ().startOf('day');
|
|
3206
3403
|
const mappings = getDateTimeFilterMapping();
|
|
3207
3404
|
const TODAY_CONFIG = mappings[MainDateTimePickerAlias.TODAY];
|
|
@@ -3347,24 +3544,6 @@ const useDateTimePicker = ({ ranges, initialPicked, onApply }) => {
|
|
|
3347
3544
|
month: dayjs(dateTimePicked.since).month(),
|
|
3348
3545
|
year: dayjs(dateTimePicked.since).year(),
|
|
3349
3546
|
});
|
|
3350
|
-
useEffect(() => {
|
|
3351
|
-
if (dateTimePicked) {
|
|
3352
|
-
const untilDate = new Date(dateTimePicked.until);
|
|
3353
|
-
const monthDiff = (referenceDate, newDate) => {
|
|
3354
|
-
return newDate.month - referenceDate.month + 12 * (referenceDate.year - newDate.year);
|
|
3355
|
-
};
|
|
3356
|
-
monthDiff({ year, month }, {
|
|
3357
|
-
year: untilDate.getFullYear(),
|
|
3358
|
-
month: untilDate.getMonth(),
|
|
3359
|
-
});
|
|
3360
|
-
// if (monthDifference > 1 || monthDifference < 0) {
|
|
3361
|
-
// setDate({
|
|
3362
|
-
// month: untilDate.getMonth(),
|
|
3363
|
-
// year: untilDate.getFullYear(),
|
|
3364
|
-
// });
|
|
3365
|
-
// }
|
|
3366
|
-
}
|
|
3367
|
-
}, [dateTimePicked, month, year]);
|
|
3368
3547
|
const onMonthChange = (month, year) => {
|
|
3369
3548
|
setDate({ month, year });
|
|
3370
3549
|
};
|
|
@@ -3575,8 +3754,9 @@ const useCompareDateTimePicker = ({ ranges, onApply }) => {
|
|
|
3575
3754
|
const newDateRange = allRanges.find((range) => {
|
|
3576
3755
|
return range.alias === alias;
|
|
3577
3756
|
});
|
|
3578
|
-
|
|
3579
|
-
|
|
3757
|
+
const mapper = COMPARE_DATE_TIME_FILTERS_MAP[alias];
|
|
3758
|
+
// If the alias is not found (or has no mapper), set the custom date range
|
|
3759
|
+
if (!newDateRange || !mapper) {
|
|
3580
3760
|
setDateRange({
|
|
3581
3761
|
alias: 'custom',
|
|
3582
3762
|
title: 'Custom',
|
|
@@ -3587,7 +3767,7 @@ const useCompareDateTimePicker = ({ ranges, onApply }) => {
|
|
|
3587
3767
|
}
|
|
3588
3768
|
setDateRange({
|
|
3589
3769
|
...newDateRange,
|
|
3590
|
-
...
|
|
3770
|
+
...mapper({
|
|
3591
3771
|
since: mainDateRange.since,
|
|
3592
3772
|
until: mainDateRange.until,
|
|
3593
3773
|
}),
|
|
@@ -3762,10 +3942,11 @@ const DEFAULT_CONFIG = {
|
|
|
3762
3942
|
isEnabledV2: false,
|
|
3763
3943
|
onView: () => { },
|
|
3764
3944
|
},
|
|
3945
|
+
autoExpandLevels: false,
|
|
3765
3946
|
};
|
|
3766
3947
|
const PathAnalysisConfigContext = createContext(DEFAULT_CONFIG);
|
|
3767
|
-
const PathAnalysisConfigProvider = ({ children, pricing, heatmap }) => {
|
|
3768
|
-
const value = useMemo(() => ({ pricing, heatmap }), [pricing, heatmap]);
|
|
3948
|
+
const PathAnalysisConfigProvider = ({ children, pricing, heatmap, autoExpandLevels, }) => {
|
|
3949
|
+
const value = useMemo(() => ({ pricing, heatmap, autoExpandLevels }), [pricing, heatmap, autoExpandLevels]);
|
|
3769
3950
|
return jsx(PathAnalysisConfigContext.Provider, { value: value, children: children });
|
|
3770
3951
|
};
|
|
3771
3952
|
const usePathAnalysisConfig = () => useContext(PathAnalysisConfigContext);
|
|
@@ -3856,8 +4037,9 @@ const toNumber = (value) => value ?? 0;
|
|
|
3856
4037
|
const divideRatio = (part, total) => {
|
|
3857
4038
|
const numerator = toNumber(part);
|
|
3858
4039
|
const denominator = toNumber(total);
|
|
3859
|
-
|
|
3860
|
-
|
|
4040
|
+
if (denominator <= 0 || !Number.isFinite(numerator))
|
|
4041
|
+
return undefined;
|
|
4042
|
+
return numerator / denominator;
|
|
3861
4043
|
};
|
|
3862
4044
|
const getTotalSessionMetric = ({ metric }) => detectDataV2By({
|
|
3863
4045
|
data: metric,
|
|
@@ -3964,7 +4146,6 @@ const getNewReturningCustomerMetric = ({ metric }) => detectDataV2By({
|
|
|
3964
4146
|
formatter: IMetricFormatter.NORMAL,
|
|
3965
4147
|
});
|
|
3966
4148
|
|
|
3967
|
-
const PA_METRIC_TOOLTIP = {};
|
|
3968
4149
|
const METRICS_COLUMNS = {
|
|
3969
4150
|
[IPAMetricKey.PAGE_SESSIONS]: { label: 'Sessions' },
|
|
3970
4151
|
[IPAMetricKey.PAGE_BR]: { label: 'Bounce rate' },
|
|
@@ -4070,14 +4251,19 @@ const buildTree = (items) => {
|
|
|
4070
4251
|
return;
|
|
4071
4252
|
map[item.parentID] = [...(map[item.parentID] || []), item];
|
|
4072
4253
|
});
|
|
4073
|
-
const buildChildren = (parentId) => {
|
|
4254
|
+
const buildChildren = (parentId, visited) => {
|
|
4074
4255
|
const children = map[parentId] || [];
|
|
4075
|
-
return children
|
|
4256
|
+
return children
|
|
4257
|
+
.filter((child) => child.id !== parentId && !visited.has(child.id))
|
|
4258
|
+
.map((child) => ({
|
|
4259
|
+
...child,
|
|
4260
|
+
children: buildChildren(child.id, new Set(visited).add(child.id)),
|
|
4261
|
+
}));
|
|
4076
4262
|
};
|
|
4077
4263
|
items
|
|
4078
4264
|
.filter((item) => item.level === 1)
|
|
4079
4265
|
.forEach((rootItem) => {
|
|
4080
|
-
tree.push({ ...rootItem, children: buildChildren(rootItem.id) });
|
|
4266
|
+
tree.push({ ...rootItem, children: buildChildren(rootItem.id, new Set([rootItem.id])) });
|
|
4081
4267
|
});
|
|
4082
4268
|
return tree;
|
|
4083
4269
|
};
|
|
@@ -4268,7 +4454,7 @@ const calculateConversionFunnelTrends = ({ pageWithMetric, previousPathAnalytics
|
|
|
4268
4454
|
return trends;
|
|
4269
4455
|
};
|
|
4270
4456
|
|
|
4271
|
-
const usePathAnalysisFunnel = ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, locationPath, }) => {
|
|
4457
|
+
const usePathAnalysisFunnel = ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, locationPath, autoExpandLevels, }) => {
|
|
4272
4458
|
const setFirstLevelLocationPath = usePathAnalysisStore((state) => state.setFirstLevelLocationPath);
|
|
4273
4459
|
const firstLevelLocationPath = usePathAnalysisStore((state) => state.firstLevelLocationPath) || locationPath;
|
|
4274
4460
|
const setCachedFunnelChartData = useFunnelChartStore((state) => state.setCachedFunnelChartData);
|
|
@@ -4379,6 +4565,25 @@ const usePathAnalysisFunnel = ({ pathAnalytics, pathAnalysisCacheKey, dataFirstL
|
|
|
4379
4565
|
dynamicLevels: dynamicLevels,
|
|
4380
4566
|
});
|
|
4381
4567
|
}, [dynamicLevels]);
|
|
4568
|
+
// Auto-expand the dominant path down every level when the flag is enabled:
|
|
4569
|
+
// first level → highest-traffic child → ... up to MAX_FUNNEL_ADDITIONAL_LEVEL,
|
|
4570
|
+
// stopping as soon as a level has no further paths.
|
|
4571
|
+
useEffect(() => {
|
|
4572
|
+
if (!autoExpandLevels || !pageWithMetric)
|
|
4573
|
+
return;
|
|
4574
|
+
const expandedLevels = [];
|
|
4575
|
+
let currentPage = pageWithMetric;
|
|
4576
|
+
while (expandedLevels.length < MAX_FUNNEL_ADDITIONAL_LEVEL) {
|
|
4577
|
+
const childrenPages = getFunnelChildrenPages(currentPage);
|
|
4578
|
+
if (!childrenPages.length)
|
|
4579
|
+
break;
|
|
4580
|
+
// Pick the dominant child (highest sessions) — matches the top of the "+" popover.
|
|
4581
|
+
const nextPage = childrenPages.reduce((prev, curr) => (curr.metric?.totalSessions || 0) > (prev.metric?.totalSessions || 0) ? curr : prev);
|
|
4582
|
+
expandedLevels.push(nextPage);
|
|
4583
|
+
currentPage = nextPage;
|
|
4584
|
+
}
|
|
4585
|
+
setDynamicLevels(expandedLevels);
|
|
4586
|
+
}, [autoExpandLevels, pageWithMetric]);
|
|
4382
4587
|
useEffect(() => {
|
|
4383
4588
|
return () => {
|
|
4384
4589
|
setFirstLevelLocationPath(undefined);
|
|
@@ -4437,12 +4642,14 @@ const PathAnalysisProvider = (props) => {
|
|
|
4437
4642
|
const locationPath = analyticsData?.locationPath;
|
|
4438
4643
|
const shopifyPageType = analyticsData?.shopifyPageType;
|
|
4439
4644
|
const pathAnalysisCacheKey = JSON.stringify({ mode, campaignVariantID, campaignVersionID });
|
|
4645
|
+
const { autoExpandLevels } = usePathAnalysisConfig();
|
|
4440
4646
|
const { processedPathAnalytics } = usePathAnalyticsMerger({ pathAnalytics, dataFirstLevels });
|
|
4441
4647
|
const pathAnalysisFunnelData = usePathAnalysisFunnel({
|
|
4442
4648
|
pathAnalytics: processedPathAnalytics,
|
|
4443
4649
|
pathAnalysisCacheKey,
|
|
4444
4650
|
dataFirstLevels,
|
|
4445
4651
|
locationPath,
|
|
4652
|
+
autoExpandLevels,
|
|
4446
4653
|
});
|
|
4447
4654
|
const isLoading = isLoadingMetric || isFetchingFirstLevelPaths;
|
|
4448
4655
|
return (jsx(PathAnalysisContext.Provider, { value: {
|
|
@@ -5034,341 +5241,150 @@ function clamp$1({
|
|
|
5034
5241
|
return amount;
|
|
5035
5242
|
}
|
|
5036
5243
|
|
|
5037
|
-
function
|
|
5038
|
-
return
|
|
5244
|
+
function isGradientStopType(item) {
|
|
5245
|
+
return item.offset != null && typeof item.offset === 'number' && item.color != null && typeof item.color === 'string';
|
|
5039
5246
|
}
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
return a == null || b == null ? NaN
|
|
5043
|
-
: b < a ? -1
|
|
5044
|
-
: b > a ? 1
|
|
5045
|
-
: b >= a ? 0
|
|
5046
|
-
: NaN;
|
|
5247
|
+
function isGradientType(color) {
|
|
5248
|
+
return Array.isArray(color) && color.every(item => isGradientStopType(item));
|
|
5047
5249
|
}
|
|
5048
5250
|
|
|
5049
|
-
|
|
5050
|
-
let
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
// used to test whether a single value is comparable.
|
|
5057
|
-
if (f.length !== 2) {
|
|
5058
|
-
compare1 = ascending;
|
|
5059
|
-
compare2 = (d, x) => ascending(f(d), x);
|
|
5060
|
-
delta = (d, x) => f(d) - x;
|
|
5061
|
-
} else {
|
|
5062
|
-
compare1 = f === ascending || f === descending ? f : zero$1;
|
|
5063
|
-
compare2 = f;
|
|
5064
|
-
delta = f;
|
|
5065
|
-
}
|
|
5251
|
+
const uniqueId = (() => {
|
|
5252
|
+
let num = 0;
|
|
5253
|
+
return prefix => {
|
|
5254
|
+
num++;
|
|
5255
|
+
return `${prefix}-${num}`;
|
|
5256
|
+
};
|
|
5257
|
+
})();
|
|
5066
5258
|
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5259
|
+
const isValidNumber$1 = value => {
|
|
5260
|
+
if (value === 0) return true;
|
|
5261
|
+
return value != null;
|
|
5262
|
+
};
|
|
5263
|
+
const paddingStringToObject = paddingString => {
|
|
5264
|
+
var _paddingString$match;
|
|
5265
|
+
const numberPattern = /\d+/g;
|
|
5266
|
+
const [top, right, bottom, left] = ((_paddingString$match = paddingString.match(numberPattern)) === null || _paddingString$match === void 0 ? void 0 : _paddingString$match.map(paddingSide => isValidNumber$1(paddingSide) ? paddingSide : null)) || [];
|
|
5267
|
+
const hasValidRight = isValidNumber$1(right);
|
|
5268
|
+
const alternateLeft = hasValidRight ? right : top;
|
|
5269
|
+
return {
|
|
5270
|
+
paddingTop: Number(top),
|
|
5271
|
+
paddingRight: Number(hasValidRight ? right : top),
|
|
5272
|
+
paddingBottom: Number(isValidNumber$1(bottom) ? bottom : top),
|
|
5273
|
+
paddingLeft: Number(isValidNumber$1(left) ? left : alternateLeft)
|
|
5274
|
+
};
|
|
5275
|
+
};
|
|
5078
5276
|
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5277
|
+
const DEFAULT_WIDTH = 11.63;
|
|
5278
|
+
function estimateStringWidth(string, characterWidths) {
|
|
5279
|
+
let sum = 0;
|
|
5280
|
+
for (const char of string) {
|
|
5281
|
+
let charWidth = characterWidths[char];
|
|
5282
|
+
if (charWidth == null || isNaN(charWidth)) {
|
|
5283
|
+
var _characterWidths$W;
|
|
5284
|
+
charWidth = (_characterWidths$W = characterWidths.W) !== null && _characterWidths$W !== void 0 ? _characterWidths$W : DEFAULT_WIDTH;
|
|
5087
5285
|
}
|
|
5088
|
-
|
|
5089
|
-
}
|
|
5090
|
-
|
|
5091
|
-
function center(a, x, lo = 0, hi = a.length) {
|
|
5092
|
-
const i = left(a, x, lo, hi - 1);
|
|
5093
|
-
return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
|
|
5286
|
+
sum += charWidth;
|
|
5094
5287
|
}
|
|
5095
|
-
|
|
5096
|
-
return {left, center, right};
|
|
5288
|
+
return sum;
|
|
5097
5289
|
}
|
|
5098
5290
|
|
|
5099
|
-
function
|
|
5100
|
-
|
|
5291
|
+
function getColorVisionEventAttrs({
|
|
5292
|
+
type,
|
|
5293
|
+
index,
|
|
5294
|
+
watch = true
|
|
5295
|
+
}) {
|
|
5296
|
+
return {
|
|
5297
|
+
[`${COLOR_VISION_EVENT.dataAttribute}-watch`]: watch,
|
|
5298
|
+
[`${COLOR_VISION_EVENT.dataAttribute}-type`]: type,
|
|
5299
|
+
[`${COLOR_VISION_EVENT.dataAttribute}-index`]: index
|
|
5300
|
+
};
|
|
5101
5301
|
}
|
|
5102
5302
|
|
|
5103
|
-
function
|
|
5104
|
-
|
|
5303
|
+
function getColorVisionStylesForActiveIndex({
|
|
5304
|
+
activeIndex,
|
|
5305
|
+
index,
|
|
5306
|
+
fadedOpacity = COLOR_VISION_FADED_OPACITY
|
|
5307
|
+
}) {
|
|
5308
|
+
const activeOpacity = activeIndex === index ? COLOR_VISION_ACTIVE_OPACITY : fadedOpacity;
|
|
5309
|
+
return {
|
|
5310
|
+
opacity: activeIndex === -1 ? COLOR_VISION_ACTIVE_OPACITY : activeOpacity,
|
|
5311
|
+
transition: 'opacity 100ms ease'
|
|
5312
|
+
};
|
|
5105
5313
|
}
|
|
5106
5314
|
|
|
5107
|
-
const
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5315
|
+
const isValidNumber = value => {
|
|
5316
|
+
if (value === 0) return true;
|
|
5317
|
+
return value != null;
|
|
5318
|
+
};
|
|
5319
|
+
const borderRadiusStringToObject = borderRadiusString => {
|
|
5320
|
+
var _borderRadiusString$m;
|
|
5321
|
+
const numberPattern = /\d+/g;
|
|
5322
|
+
const [topLeft, topRight, bottomRight, bottomLeft] = ((_borderRadiusString$m = borderRadiusString.match(numberPattern)) === null || _borderRadiusString$m === void 0 ? void 0 : _borderRadiusString$m.map(corner => isValidNumber(corner) ? corner : null)) || [];
|
|
5323
|
+
const hasValidRight = isValidNumber(topRight);
|
|
5324
|
+
const alternateLeft = hasValidRight ? topRight : topLeft;
|
|
5325
|
+
return {
|
|
5326
|
+
topLeft: Number(topLeft),
|
|
5327
|
+
topRight: Number(hasValidRight ? topRight : topLeft),
|
|
5328
|
+
bottomRight: Number(isValidNumber(bottomRight) ? bottomRight : topLeft),
|
|
5329
|
+
bottomLeft: Number(isValidNumber(bottomLeft) ? bottomLeft : alternateLeft)
|
|
5330
|
+
};
|
|
5331
|
+
};
|
|
5111
5332
|
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
}
|
|
5118
|
-
get(key) {
|
|
5119
|
-
return super.get(intern_get(this, key));
|
|
5120
|
-
}
|
|
5121
|
-
has(key) {
|
|
5122
|
-
return super.has(intern_get(this, key));
|
|
5123
|
-
}
|
|
5124
|
-
set(key, value) {
|
|
5125
|
-
return super.set(intern_set(this, key), value);
|
|
5126
|
-
}
|
|
5127
|
-
delete(key) {
|
|
5128
|
-
return super.delete(intern_delete(this, key));
|
|
5129
|
-
}
|
|
5333
|
+
function keepValuePositive(amount) {
|
|
5334
|
+
return Math.abs(clamp$1({
|
|
5335
|
+
amount,
|
|
5336
|
+
min: 0
|
|
5337
|
+
}));
|
|
5130
5338
|
}
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5339
|
+
function getRoundedRectPath({
|
|
5340
|
+
borderRadius,
|
|
5341
|
+
height,
|
|
5342
|
+
width
|
|
5343
|
+
}) {
|
|
5344
|
+
if (height == null || width == null) {
|
|
5345
|
+
return '';
|
|
5346
|
+
}
|
|
5347
|
+
let {
|
|
5348
|
+
topLeft,
|
|
5349
|
+
topRight,
|
|
5350
|
+
bottomRight,
|
|
5351
|
+
bottomLeft
|
|
5352
|
+
} = borderRadiusStringToObject(borderRadius);
|
|
5353
|
+
const smallestSize = Math.min(height, width);
|
|
5354
|
+
topLeft = Math.min(topLeft, smallestSize / 2);
|
|
5355
|
+
topRight = Math.min(topRight, smallestSize / 2);
|
|
5356
|
+
bottomRight = Math.min(bottomRight, smallestSize / 2);
|
|
5357
|
+
bottomLeft = Math.min(bottomLeft, smallestSize / 2);
|
|
5358
|
+
const top = topLeft + topRight;
|
|
5359
|
+
const right = topRight + bottomRight;
|
|
5360
|
+
const bottom = bottomRight + bottomLeft;
|
|
5361
|
+
const left = bottomLeft + topLeft;
|
|
5362
|
+
return `
|
|
5363
|
+
M${topLeft},0
|
|
5364
|
+
h${keepValuePositive(width - top)}
|
|
5365
|
+
a${topRight},${topRight} 0 0 1 ${topRight},${topRight}
|
|
5366
|
+
v${keepValuePositive(height - right)}
|
|
5367
|
+
a${bottomRight},${bottomRight} 0 0 1 -${bottomRight},${bottomRight}
|
|
5368
|
+
h-${keepValuePositive(width - bottom)}
|
|
5369
|
+
a${bottomLeft},${bottomLeft} 0 0 1 -${bottomLeft},-${bottomLeft}
|
|
5370
|
+
v-${keepValuePositive(height - left)}
|
|
5371
|
+
a${topLeft},${topLeft} 0 0 1 ${topLeft},-${topLeft}
|
|
5372
|
+
Z
|
|
5373
|
+
`;
|
|
5135
5374
|
}
|
|
5136
5375
|
|
|
5137
|
-
function
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
_intern.set(key, value);
|
|
5141
|
-
return value;
|
|
5376
|
+
function define(constructor, factory, prototype) {
|
|
5377
|
+
constructor.prototype = factory.prototype = prototype;
|
|
5378
|
+
prototype.constructor = constructor;
|
|
5142
5379
|
}
|
|
5143
5380
|
|
|
5144
|
-
function
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
_intern.delete(key);
|
|
5149
|
-
}
|
|
5150
|
-
return value;
|
|
5381
|
+
function extend(parent, definition) {
|
|
5382
|
+
var prototype = Object.create(parent.prototype);
|
|
5383
|
+
for (var key in definition) prototype[key] = definition[key];
|
|
5384
|
+
return prototype;
|
|
5151
5385
|
}
|
|
5152
5386
|
|
|
5153
|
-
function
|
|
5154
|
-
return value !== null && typeof value === "object" ? value.valueOf() : value;
|
|
5155
|
-
}
|
|
5156
|
-
|
|
5157
|
-
const e10 = Math.sqrt(50),
|
|
5158
|
-
e5 = Math.sqrt(10),
|
|
5159
|
-
e2 = Math.sqrt(2);
|
|
5160
|
-
|
|
5161
|
-
function tickSpec(start, stop, count) {
|
|
5162
|
-
const step = (stop - start) / Math.max(0, count),
|
|
5163
|
-
power = Math.floor(Math.log10(step)),
|
|
5164
|
-
error = step / Math.pow(10, power),
|
|
5165
|
-
factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
|
|
5166
|
-
let i1, i2, inc;
|
|
5167
|
-
if (power < 0) {
|
|
5168
|
-
inc = Math.pow(10, -power) / factor;
|
|
5169
|
-
i1 = Math.round(start * inc);
|
|
5170
|
-
i2 = Math.round(stop * inc);
|
|
5171
|
-
if (i1 / inc < start) ++i1;
|
|
5172
|
-
if (i2 / inc > stop) --i2;
|
|
5173
|
-
inc = -inc;
|
|
5174
|
-
} else {
|
|
5175
|
-
inc = Math.pow(10, power) * factor;
|
|
5176
|
-
i1 = Math.round(start / inc);
|
|
5177
|
-
i2 = Math.round(stop / inc);
|
|
5178
|
-
if (i1 * inc < start) ++i1;
|
|
5179
|
-
if (i2 * inc > stop) --i2;
|
|
5180
|
-
}
|
|
5181
|
-
if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);
|
|
5182
|
-
return [i1, i2, inc];
|
|
5183
|
-
}
|
|
5184
|
-
|
|
5185
|
-
function ticks(start, stop, count) {
|
|
5186
|
-
stop = +stop, start = +start, count = +count;
|
|
5187
|
-
if (!(count > 0)) return [];
|
|
5188
|
-
if (start === stop) return [start];
|
|
5189
|
-
const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
|
|
5190
|
-
if (!(i2 >= i1)) return [];
|
|
5191
|
-
const n = i2 - i1 + 1, ticks = new Array(n);
|
|
5192
|
-
if (reverse) {
|
|
5193
|
-
if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;
|
|
5194
|
-
else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;
|
|
5195
|
-
} else {
|
|
5196
|
-
if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;
|
|
5197
|
-
else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;
|
|
5198
|
-
}
|
|
5199
|
-
return ticks;
|
|
5200
|
-
}
|
|
5201
|
-
|
|
5202
|
-
function tickIncrement(start, stop, count) {
|
|
5203
|
-
stop = +stop, start = +start, count = +count;
|
|
5204
|
-
return tickSpec(start, stop, count)[2];
|
|
5205
|
-
}
|
|
5206
|
-
|
|
5207
|
-
function tickStep(start, stop, count) {
|
|
5208
|
-
stop = +stop, start = +start, count = +count;
|
|
5209
|
-
const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
|
|
5210
|
-
return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
|
|
5211
|
-
}
|
|
5212
|
-
|
|
5213
|
-
function range(start, stop, step) {
|
|
5214
|
-
start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
|
|
5215
|
-
|
|
5216
|
-
var i = -1,
|
|
5217
|
-
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
|
|
5218
|
-
range = new Array(n);
|
|
5219
|
-
|
|
5220
|
-
while (++i < n) {
|
|
5221
|
-
range[i] = start + i * step;
|
|
5222
|
-
}
|
|
5223
|
-
|
|
5224
|
-
return range;
|
|
5225
|
-
}
|
|
5226
|
-
|
|
5227
|
-
function initRange(domain, range) {
|
|
5228
|
-
switch (arguments.length) {
|
|
5229
|
-
case 0: break;
|
|
5230
|
-
case 1: this.range(domain); break;
|
|
5231
|
-
default: this.range(range).domain(domain); break;
|
|
5232
|
-
}
|
|
5233
|
-
return this;
|
|
5234
|
-
}
|
|
5235
|
-
|
|
5236
|
-
const implicit = Symbol("implicit");
|
|
5237
|
-
|
|
5238
|
-
function ordinal() {
|
|
5239
|
-
var index = new InternMap(),
|
|
5240
|
-
domain = [],
|
|
5241
|
-
range = [],
|
|
5242
|
-
unknown = implicit;
|
|
5243
|
-
|
|
5244
|
-
function scale(d) {
|
|
5245
|
-
let i = index.get(d);
|
|
5246
|
-
if (i === undefined) {
|
|
5247
|
-
if (unknown !== implicit) return unknown;
|
|
5248
|
-
index.set(d, i = domain.push(d) - 1);
|
|
5249
|
-
}
|
|
5250
|
-
return range[i % range.length];
|
|
5251
|
-
}
|
|
5252
|
-
|
|
5253
|
-
scale.domain = function(_) {
|
|
5254
|
-
if (!arguments.length) return domain.slice();
|
|
5255
|
-
domain = [], index = new InternMap();
|
|
5256
|
-
for (const value of _) {
|
|
5257
|
-
if (index.has(value)) continue;
|
|
5258
|
-
index.set(value, domain.push(value) - 1);
|
|
5259
|
-
}
|
|
5260
|
-
return scale;
|
|
5261
|
-
};
|
|
5262
|
-
|
|
5263
|
-
scale.range = function(_) {
|
|
5264
|
-
return arguments.length ? (range = Array.from(_), scale) : range.slice();
|
|
5265
|
-
};
|
|
5266
|
-
|
|
5267
|
-
scale.unknown = function(_) {
|
|
5268
|
-
return arguments.length ? (unknown = _, scale) : unknown;
|
|
5269
|
-
};
|
|
5270
|
-
|
|
5271
|
-
scale.copy = function() {
|
|
5272
|
-
return ordinal(domain, range).unknown(unknown);
|
|
5273
|
-
};
|
|
5274
|
-
|
|
5275
|
-
initRange.apply(scale, arguments);
|
|
5276
|
-
|
|
5277
|
-
return scale;
|
|
5278
|
-
}
|
|
5279
|
-
|
|
5280
|
-
function band() {
|
|
5281
|
-
var scale = ordinal().unknown(undefined),
|
|
5282
|
-
domain = scale.domain,
|
|
5283
|
-
ordinalRange = scale.range,
|
|
5284
|
-
r0 = 0,
|
|
5285
|
-
r1 = 1,
|
|
5286
|
-
step,
|
|
5287
|
-
bandwidth,
|
|
5288
|
-
round = false,
|
|
5289
|
-
paddingInner = 0,
|
|
5290
|
-
paddingOuter = 0,
|
|
5291
|
-
align = 0.5;
|
|
5292
|
-
|
|
5293
|
-
delete scale.unknown;
|
|
5294
|
-
|
|
5295
|
-
function rescale() {
|
|
5296
|
-
var n = domain().length,
|
|
5297
|
-
reverse = r1 < r0,
|
|
5298
|
-
start = reverse ? r1 : r0,
|
|
5299
|
-
stop = reverse ? r0 : r1;
|
|
5300
|
-
step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
|
|
5301
|
-
if (round) step = Math.floor(step);
|
|
5302
|
-
start += (stop - start - step * (n - paddingInner)) * align;
|
|
5303
|
-
bandwidth = step * (1 - paddingInner);
|
|
5304
|
-
if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
|
|
5305
|
-
var values = range(n).map(function(i) { return start + step * i; });
|
|
5306
|
-
return ordinalRange(reverse ? values.reverse() : values);
|
|
5307
|
-
}
|
|
5308
|
-
|
|
5309
|
-
scale.domain = function(_) {
|
|
5310
|
-
return arguments.length ? (domain(_), rescale()) : domain();
|
|
5311
|
-
};
|
|
5312
|
-
|
|
5313
|
-
scale.range = function(_) {
|
|
5314
|
-
return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
|
|
5315
|
-
};
|
|
5316
|
-
|
|
5317
|
-
scale.rangeRound = function(_) {
|
|
5318
|
-
return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();
|
|
5319
|
-
};
|
|
5320
|
-
|
|
5321
|
-
scale.bandwidth = function() {
|
|
5322
|
-
return bandwidth;
|
|
5323
|
-
};
|
|
5324
|
-
|
|
5325
|
-
scale.step = function() {
|
|
5326
|
-
return step;
|
|
5327
|
-
};
|
|
5328
|
-
|
|
5329
|
-
scale.round = function(_) {
|
|
5330
|
-
return arguments.length ? (round = !!_, rescale()) : round;
|
|
5331
|
-
};
|
|
5332
|
-
|
|
5333
|
-
scale.padding = function(_) {
|
|
5334
|
-
return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
|
|
5335
|
-
};
|
|
5336
|
-
|
|
5337
|
-
scale.paddingInner = function(_) {
|
|
5338
|
-
return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
|
|
5339
|
-
};
|
|
5340
|
-
|
|
5341
|
-
scale.paddingOuter = function(_) {
|
|
5342
|
-
return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
|
|
5343
|
-
};
|
|
5344
|
-
|
|
5345
|
-
scale.align = function(_) {
|
|
5346
|
-
return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
|
|
5347
|
-
};
|
|
5348
|
-
|
|
5349
|
-
scale.copy = function() {
|
|
5350
|
-
return band(domain(), [r0, r1])
|
|
5351
|
-
.round(round)
|
|
5352
|
-
.paddingInner(paddingInner)
|
|
5353
|
-
.paddingOuter(paddingOuter)
|
|
5354
|
-
.align(align);
|
|
5355
|
-
};
|
|
5356
|
-
|
|
5357
|
-
return initRange.apply(rescale(), arguments);
|
|
5358
|
-
}
|
|
5359
|
-
|
|
5360
|
-
function define(constructor, factory, prototype) {
|
|
5361
|
-
constructor.prototype = factory.prototype = prototype;
|
|
5362
|
-
prototype.constructor = constructor;
|
|
5363
|
-
}
|
|
5364
|
-
|
|
5365
|
-
function extend(parent, definition) {
|
|
5366
|
-
var prototype = Object.create(parent.prototype);
|
|
5367
|
-
for (var key in definition) prototype[key] = definition[key];
|
|
5368
|
-
return prototype;
|
|
5369
|
-
}
|
|
5370
|
-
|
|
5371
|
-
function Color() {}
|
|
5387
|
+
function Color() {}
|
|
5372
5388
|
|
|
5373
5389
|
var darker = 0.7;
|
|
5374
5390
|
var brighter = 1 / darker;
|
|
@@ -5601,7 +5617,7 @@ function rgbConvert(o) {
|
|
|
5601
5617
|
return new Rgb(o.r, o.g, o.b, o.opacity);
|
|
5602
5618
|
}
|
|
5603
5619
|
|
|
5604
|
-
function rgb$
|
|
5620
|
+
function rgb$1(r, g, b, opacity) {
|
|
5605
5621
|
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
|
5606
5622
|
}
|
|
5607
5623
|
|
|
@@ -5612,7 +5628,7 @@ function Rgb(r, g, b, opacity) {
|
|
|
5612
5628
|
this.opacity = +opacity;
|
|
5613
5629
|
}
|
|
5614
5630
|
|
|
5615
|
-
define(Rgb, rgb$
|
|
5631
|
+
define(Rgb, rgb$1, extend(Color, {
|
|
5616
5632
|
brighter(k) {
|
|
5617
5633
|
k = k == null ? brighter : Math.pow(brighter, k);
|
|
5618
5634
|
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
@@ -5725,919 +5741,42 @@ define(Hsl, hsl$1, extend(Color, {
|
|
|
5725
5741
|
l = this.l,
|
|
5726
5742
|
m2 = l + (l < 0.5 ? l : 1 - l) * s,
|
|
5727
5743
|
m1 = 2 * l - m2;
|
|
5728
|
-
return new Rgb(
|
|
5729
|
-
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
|
5730
|
-
hsl2rgb(h, m1, m2),
|
|
5731
|
-
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
|
5732
|
-
this.opacity
|
|
5733
|
-
);
|
|
5734
|
-
},
|
|
5735
|
-
clamp() {
|
|
5736
|
-
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
|
5737
|
-
},
|
|
5738
|
-
displayable() {
|
|
5739
|
-
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
|
5740
|
-
&& (0 <= this.l && this.l <= 1)
|
|
5741
|
-
&& (0 <= this.opacity && this.opacity <= 1);
|
|
5742
|
-
},
|
|
5743
|
-
formatHsl() {
|
|
5744
|
-
const a = clampa(this.opacity);
|
|
5745
|
-
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
|
|
5746
|
-
}
|
|
5747
|
-
}));
|
|
5748
|
-
|
|
5749
|
-
function clamph(value) {
|
|
5750
|
-
value = (value || 0) % 360;
|
|
5751
|
-
return value < 0 ? value + 360 : value;
|
|
5752
|
-
}
|
|
5753
|
-
|
|
5754
|
-
function clampt(value) {
|
|
5755
|
-
return Math.max(0, Math.min(1, value || 0));
|
|
5756
|
-
}
|
|
5757
|
-
|
|
5758
|
-
/* From FvD 13.37, CSS Color Module Level 3 */
|
|
5759
|
-
function hsl2rgb(h, m1, m2) {
|
|
5760
|
-
return (h < 60 ? m1 + (m2 - m1) * h / 60
|
|
5761
|
-
: h < 180 ? m2
|
|
5762
|
-
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
|
|
5763
|
-
: m1) * 255;
|
|
5764
|
-
}
|
|
5765
|
-
|
|
5766
|
-
var constant$1 = x => () => x;
|
|
5767
|
-
|
|
5768
|
-
function linear$1(a, d) {
|
|
5769
|
-
return function(t) {
|
|
5770
|
-
return a + t * d;
|
|
5771
|
-
};
|
|
5772
|
-
}
|
|
5773
|
-
|
|
5774
|
-
function exponential(a, b, y) {
|
|
5775
|
-
return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
|
|
5776
|
-
return Math.pow(a + t * b, y);
|
|
5777
|
-
};
|
|
5778
|
-
}
|
|
5779
|
-
|
|
5780
|
-
function gamma(y) {
|
|
5781
|
-
return (y = +y) === 1 ? nogamma : function(a, b) {
|
|
5782
|
-
return b - a ? exponential(a, b, y) : constant$1(isNaN(a) ? b : a);
|
|
5783
|
-
};
|
|
5784
|
-
}
|
|
5785
|
-
|
|
5786
|
-
function nogamma(a, b) {
|
|
5787
|
-
var d = b - a;
|
|
5788
|
-
return d ? linear$1(a, d) : constant$1(isNaN(a) ? b : a);
|
|
5789
|
-
}
|
|
5790
|
-
|
|
5791
|
-
var rgb$1 = (function rgbGamma(y) {
|
|
5792
|
-
var color = gamma(y);
|
|
5793
|
-
|
|
5794
|
-
function rgb(start, end) {
|
|
5795
|
-
var r = color((start = rgb$2(start)).r, (end = rgb$2(end)).r),
|
|
5796
|
-
g = color(start.g, end.g),
|
|
5797
|
-
b = color(start.b, end.b),
|
|
5798
|
-
opacity = nogamma(start.opacity, end.opacity);
|
|
5799
|
-
return function(t) {
|
|
5800
|
-
start.r = r(t);
|
|
5801
|
-
start.g = g(t);
|
|
5802
|
-
start.b = b(t);
|
|
5803
|
-
start.opacity = opacity(t);
|
|
5804
|
-
return start + "";
|
|
5805
|
-
};
|
|
5806
|
-
}
|
|
5807
|
-
|
|
5808
|
-
rgb.gamma = rgbGamma;
|
|
5809
|
-
|
|
5810
|
-
return rgb;
|
|
5811
|
-
})(1);
|
|
5812
|
-
|
|
5813
|
-
function numberArray(a, b) {
|
|
5814
|
-
if (!b) b = [];
|
|
5815
|
-
var n = a ? Math.min(b.length, a.length) : 0,
|
|
5816
|
-
c = b.slice(),
|
|
5817
|
-
i;
|
|
5818
|
-
return function(t) {
|
|
5819
|
-
for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
|
|
5820
|
-
return c;
|
|
5821
|
-
};
|
|
5822
|
-
}
|
|
5823
|
-
|
|
5824
|
-
function isNumberArray(x) {
|
|
5825
|
-
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
5826
|
-
}
|
|
5827
|
-
|
|
5828
|
-
function genericArray(a, b) {
|
|
5829
|
-
var nb = b ? b.length : 0,
|
|
5830
|
-
na = a ? Math.min(nb, a.length) : 0,
|
|
5831
|
-
x = new Array(na),
|
|
5832
|
-
c = new Array(nb),
|
|
5833
|
-
i;
|
|
5834
|
-
|
|
5835
|
-
for (i = 0; i < na; ++i) x[i] = interpolate$1(a[i], b[i]);
|
|
5836
|
-
for (; i < nb; ++i) c[i] = b[i];
|
|
5837
|
-
|
|
5838
|
-
return function(t) {
|
|
5839
|
-
for (i = 0; i < na; ++i) c[i] = x[i](t);
|
|
5840
|
-
return c;
|
|
5841
|
-
};
|
|
5842
|
-
}
|
|
5843
|
-
|
|
5844
|
-
function date(a, b) {
|
|
5845
|
-
var d = new Date;
|
|
5846
|
-
return a = +a, b = +b, function(t) {
|
|
5847
|
-
return d.setTime(a * (1 - t) + b * t), d;
|
|
5848
|
-
};
|
|
5849
|
-
}
|
|
5850
|
-
|
|
5851
|
-
function interpolateNumber(a, b) {
|
|
5852
|
-
return a = +a, b = +b, function(t) {
|
|
5853
|
-
return a * (1 - t) + b * t;
|
|
5854
|
-
};
|
|
5855
|
-
}
|
|
5856
|
-
|
|
5857
|
-
function object(a, b) {
|
|
5858
|
-
var i = {},
|
|
5859
|
-
c = {},
|
|
5860
|
-
k;
|
|
5861
|
-
|
|
5862
|
-
if (a === null || typeof a !== "object") a = {};
|
|
5863
|
-
if (b === null || typeof b !== "object") b = {};
|
|
5864
|
-
|
|
5865
|
-
for (k in b) {
|
|
5866
|
-
if (k in a) {
|
|
5867
|
-
i[k] = interpolate$1(a[k], b[k]);
|
|
5868
|
-
} else {
|
|
5869
|
-
c[k] = b[k];
|
|
5870
|
-
}
|
|
5871
|
-
}
|
|
5872
|
-
|
|
5873
|
-
return function(t) {
|
|
5874
|
-
for (k in i) c[k] = i[k](t);
|
|
5875
|
-
return c;
|
|
5876
|
-
};
|
|
5877
|
-
}
|
|
5878
|
-
|
|
5879
|
-
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
|
|
5880
|
-
reB = new RegExp(reA.source, "g");
|
|
5881
|
-
|
|
5882
|
-
function zero(b) {
|
|
5883
|
-
return function() {
|
|
5884
|
-
return b;
|
|
5885
|
-
};
|
|
5886
|
-
}
|
|
5887
|
-
|
|
5888
|
-
function one(b) {
|
|
5889
|
-
return function(t) {
|
|
5890
|
-
return b(t) + "";
|
|
5891
|
-
};
|
|
5892
|
-
}
|
|
5893
|
-
|
|
5894
|
-
function string(a, b) {
|
|
5895
|
-
var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
|
|
5896
|
-
am, // current match in a
|
|
5897
|
-
bm, // current match in b
|
|
5898
|
-
bs, // string preceding current number in b, if any
|
|
5899
|
-
i = -1, // index in s
|
|
5900
|
-
s = [], // string constants and placeholders
|
|
5901
|
-
q = []; // number interpolators
|
|
5902
|
-
|
|
5903
|
-
// Coerce inputs to strings.
|
|
5904
|
-
a = a + "", b = b + "";
|
|
5905
|
-
|
|
5906
|
-
// Interpolate pairs of numbers in a & b.
|
|
5907
|
-
while ((am = reA.exec(a))
|
|
5908
|
-
&& (bm = reB.exec(b))) {
|
|
5909
|
-
if ((bs = bm.index) > bi) { // a string precedes the next number in b
|
|
5910
|
-
bs = b.slice(bi, bs);
|
|
5911
|
-
if (s[i]) s[i] += bs; // coalesce with previous string
|
|
5912
|
-
else s[++i] = bs;
|
|
5913
|
-
}
|
|
5914
|
-
if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
|
|
5915
|
-
if (s[i]) s[i] += bm; // coalesce with previous string
|
|
5916
|
-
else s[++i] = bm;
|
|
5917
|
-
} else { // interpolate non-matching numbers
|
|
5918
|
-
s[++i] = null;
|
|
5919
|
-
q.push({i: i, x: interpolateNumber(am, bm)});
|
|
5920
|
-
}
|
|
5921
|
-
bi = reB.lastIndex;
|
|
5922
|
-
}
|
|
5923
|
-
|
|
5924
|
-
// Add remains of b.
|
|
5925
|
-
if (bi < b.length) {
|
|
5926
|
-
bs = b.slice(bi);
|
|
5927
|
-
if (s[i]) s[i] += bs; // coalesce with previous string
|
|
5928
|
-
else s[++i] = bs;
|
|
5929
|
-
}
|
|
5930
|
-
|
|
5931
|
-
// Special optimization for only a single match.
|
|
5932
|
-
// Otherwise, interpolate each of the numbers and rejoin the string.
|
|
5933
|
-
return s.length < 2 ? (q[0]
|
|
5934
|
-
? one(q[0].x)
|
|
5935
|
-
: zero(b))
|
|
5936
|
-
: (b = q.length, function(t) {
|
|
5937
|
-
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
|
|
5938
|
-
return s.join("");
|
|
5939
|
-
});
|
|
5940
|
-
}
|
|
5941
|
-
|
|
5942
|
-
function interpolate$1(a, b) {
|
|
5943
|
-
var t = typeof b, c;
|
|
5944
|
-
return b == null || t === "boolean" ? constant$1(b)
|
|
5945
|
-
: (t === "number" ? interpolateNumber
|
|
5946
|
-
: t === "string" ? ((c = color(b)) ? (b = c, rgb$1) : string)
|
|
5947
|
-
: b instanceof color ? rgb$1
|
|
5948
|
-
: b instanceof Date ? date
|
|
5949
|
-
: isNumberArray(b) ? numberArray
|
|
5950
|
-
: Array.isArray(b) ? genericArray
|
|
5951
|
-
: typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
|
|
5952
|
-
: interpolateNumber)(a, b);
|
|
5953
|
-
}
|
|
5954
|
-
|
|
5955
|
-
function interpolateRound(a, b) {
|
|
5956
|
-
return a = +a, b = +b, function(t) {
|
|
5957
|
-
return Math.round(a * (1 - t) + b * t);
|
|
5958
|
-
};
|
|
5959
|
-
}
|
|
5960
|
-
|
|
5961
|
-
function constants(x) {
|
|
5962
|
-
return function() {
|
|
5963
|
-
return x;
|
|
5964
|
-
};
|
|
5965
|
-
}
|
|
5966
|
-
|
|
5967
|
-
function number(x) {
|
|
5968
|
-
return +x;
|
|
5969
|
-
}
|
|
5970
|
-
|
|
5971
|
-
var unit = [0, 1];
|
|
5972
|
-
|
|
5973
|
-
function identity$1(x) {
|
|
5974
|
-
return x;
|
|
5975
|
-
}
|
|
5976
|
-
|
|
5977
|
-
function normalize(a, b) {
|
|
5978
|
-
return (b -= (a = +a))
|
|
5979
|
-
? function(x) { return (x - a) / b; }
|
|
5980
|
-
: constants(isNaN(b) ? NaN : 0.5);
|
|
5981
|
-
}
|
|
5982
|
-
|
|
5983
|
-
function clamper(a, b) {
|
|
5984
|
-
var t;
|
|
5985
|
-
if (a > b) t = a, a = b, b = t;
|
|
5986
|
-
return function(x) { return Math.max(a, Math.min(b, x)); };
|
|
5987
|
-
}
|
|
5988
|
-
|
|
5989
|
-
// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
|
|
5990
|
-
// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
|
|
5991
|
-
function bimap(domain, range, interpolate) {
|
|
5992
|
-
var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
|
|
5993
|
-
if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
|
|
5994
|
-
else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
|
|
5995
|
-
return function(x) { return r0(d0(x)); };
|
|
5996
|
-
}
|
|
5997
|
-
|
|
5998
|
-
function polymap(domain, range, interpolate) {
|
|
5999
|
-
var j = Math.min(domain.length, range.length) - 1,
|
|
6000
|
-
d = new Array(j),
|
|
6001
|
-
r = new Array(j),
|
|
6002
|
-
i = -1;
|
|
6003
|
-
|
|
6004
|
-
// Reverse descending domains.
|
|
6005
|
-
if (domain[j] < domain[0]) {
|
|
6006
|
-
domain = domain.slice().reverse();
|
|
6007
|
-
range = range.slice().reverse();
|
|
6008
|
-
}
|
|
6009
|
-
|
|
6010
|
-
while (++i < j) {
|
|
6011
|
-
d[i] = normalize(domain[i], domain[i + 1]);
|
|
6012
|
-
r[i] = interpolate(range[i], range[i + 1]);
|
|
6013
|
-
}
|
|
6014
|
-
|
|
6015
|
-
return function(x) {
|
|
6016
|
-
var i = bisect(domain, x, 1, j) - 1;
|
|
6017
|
-
return r[i](d[i](x));
|
|
6018
|
-
};
|
|
6019
|
-
}
|
|
6020
|
-
|
|
6021
|
-
function copy(source, target) {
|
|
6022
|
-
return target
|
|
6023
|
-
.domain(source.domain())
|
|
6024
|
-
.range(source.range())
|
|
6025
|
-
.interpolate(source.interpolate())
|
|
6026
|
-
.clamp(source.clamp())
|
|
6027
|
-
.unknown(source.unknown());
|
|
6028
|
-
}
|
|
6029
|
-
|
|
6030
|
-
function transformer() {
|
|
6031
|
-
var domain = unit,
|
|
6032
|
-
range = unit,
|
|
6033
|
-
interpolate = interpolate$1,
|
|
6034
|
-
transform,
|
|
6035
|
-
untransform,
|
|
6036
|
-
unknown,
|
|
6037
|
-
clamp = identity$1,
|
|
6038
|
-
piecewise,
|
|
6039
|
-
output,
|
|
6040
|
-
input;
|
|
6041
|
-
|
|
6042
|
-
function rescale() {
|
|
6043
|
-
var n = Math.min(domain.length, range.length);
|
|
6044
|
-
if (clamp !== identity$1) clamp = clamper(domain[0], domain[n - 1]);
|
|
6045
|
-
piecewise = n > 2 ? polymap : bimap;
|
|
6046
|
-
output = input = null;
|
|
6047
|
-
return scale;
|
|
6048
|
-
}
|
|
6049
|
-
|
|
6050
|
-
function scale(x) {
|
|
6051
|
-
return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));
|
|
6052
|
-
}
|
|
6053
|
-
|
|
6054
|
-
scale.invert = function(y) {
|
|
6055
|
-
return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));
|
|
6056
|
-
};
|
|
6057
|
-
|
|
6058
|
-
scale.domain = function(_) {
|
|
6059
|
-
return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();
|
|
6060
|
-
};
|
|
6061
|
-
|
|
6062
|
-
scale.range = function(_) {
|
|
6063
|
-
return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
|
|
6064
|
-
};
|
|
6065
|
-
|
|
6066
|
-
scale.rangeRound = function(_) {
|
|
6067
|
-
return range = Array.from(_), interpolate = interpolateRound, rescale();
|
|
6068
|
-
};
|
|
6069
|
-
|
|
6070
|
-
scale.clamp = function(_) {
|
|
6071
|
-
return arguments.length ? (clamp = _ ? true : identity$1, rescale()) : clamp !== identity$1;
|
|
6072
|
-
};
|
|
6073
|
-
|
|
6074
|
-
scale.interpolate = function(_) {
|
|
6075
|
-
return arguments.length ? (interpolate = _, rescale()) : interpolate;
|
|
6076
|
-
};
|
|
6077
|
-
|
|
6078
|
-
scale.unknown = function(_) {
|
|
6079
|
-
return arguments.length ? (unknown = _, scale) : unknown;
|
|
6080
|
-
};
|
|
6081
|
-
|
|
6082
|
-
return function(t, u) {
|
|
6083
|
-
transform = t, untransform = u;
|
|
6084
|
-
return rescale();
|
|
6085
|
-
};
|
|
6086
|
-
}
|
|
6087
|
-
|
|
6088
|
-
function continuous() {
|
|
6089
|
-
return transformer()(identity$1, identity$1);
|
|
6090
|
-
}
|
|
6091
|
-
|
|
6092
|
-
function formatDecimal(x) {
|
|
6093
|
-
return Math.abs(x = Math.round(x)) >= 1e21
|
|
6094
|
-
? x.toLocaleString("en").replace(/,/g, "")
|
|
6095
|
-
: x.toString(10);
|
|
6096
|
-
}
|
|
6097
|
-
|
|
6098
|
-
// Computes the decimal coefficient and exponent of the specified number x with
|
|
6099
|
-
// significant digits p, where x is positive and p is in [1, 21] or undefined.
|
|
6100
|
-
// For example, formatDecimalParts(1.23) returns ["123", 0].
|
|
6101
|
-
function formatDecimalParts(x, p) {
|
|
6102
|
-
if (!isFinite(x) || x === 0) return null; // NaN, ±Infinity, ±0
|
|
6103
|
-
var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
|
|
6104
|
-
|
|
6105
|
-
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+
|
|
6106
|
-
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
|
|
6107
|
-
return [
|
|
6108
|
-
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
|
|
6109
|
-
+x.slice(i + 1)
|
|
6110
|
-
];
|
|
6111
|
-
}
|
|
6112
|
-
|
|
6113
|
-
function exponent(x) {
|
|
6114
|
-
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
|
|
6115
|
-
}
|
|
6116
|
-
|
|
6117
|
-
function formatGroup(grouping, thousands) {
|
|
6118
|
-
return function(value, width) {
|
|
6119
|
-
var i = value.length,
|
|
6120
|
-
t = [],
|
|
6121
|
-
j = 0,
|
|
6122
|
-
g = grouping[0],
|
|
6123
|
-
length = 0;
|
|
6124
|
-
|
|
6125
|
-
while (i > 0 && g > 0) {
|
|
6126
|
-
if (length + g + 1 > width) g = Math.max(1, width - length);
|
|
6127
|
-
t.push(value.substring(i -= g, i + g));
|
|
6128
|
-
if ((length += g + 1) > width) break;
|
|
6129
|
-
g = grouping[j = (j + 1) % grouping.length];
|
|
6130
|
-
}
|
|
6131
|
-
|
|
6132
|
-
return t.reverse().join(thousands);
|
|
6133
|
-
};
|
|
6134
|
-
}
|
|
6135
|
-
|
|
6136
|
-
function formatNumerals(numerals) {
|
|
6137
|
-
return function(value) {
|
|
6138
|
-
return value.replace(/[0-9]/g, function(i) {
|
|
6139
|
-
return numerals[+i];
|
|
6140
|
-
});
|
|
6141
|
-
};
|
|
6142
|
-
}
|
|
6143
|
-
|
|
6144
|
-
// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
|
|
6145
|
-
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
6146
|
-
|
|
6147
|
-
function formatSpecifier(specifier) {
|
|
6148
|
-
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
|
|
6149
|
-
var match;
|
|
6150
|
-
return new FormatSpecifier({
|
|
6151
|
-
fill: match[1],
|
|
6152
|
-
align: match[2],
|
|
6153
|
-
sign: match[3],
|
|
6154
|
-
symbol: match[4],
|
|
6155
|
-
zero: match[5],
|
|
6156
|
-
width: match[6],
|
|
6157
|
-
comma: match[7],
|
|
6158
|
-
precision: match[8] && match[8].slice(1),
|
|
6159
|
-
trim: match[9],
|
|
6160
|
-
type: match[10]
|
|
6161
|
-
});
|
|
6162
|
-
}
|
|
6163
|
-
|
|
6164
|
-
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
|
|
6165
|
-
|
|
6166
|
-
function FormatSpecifier(specifier) {
|
|
6167
|
-
this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
|
|
6168
|
-
this.align = specifier.align === undefined ? ">" : specifier.align + "";
|
|
6169
|
-
this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
|
|
6170
|
-
this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
|
|
6171
|
-
this.zero = !!specifier.zero;
|
|
6172
|
-
this.width = specifier.width === undefined ? undefined : +specifier.width;
|
|
6173
|
-
this.comma = !!specifier.comma;
|
|
6174
|
-
this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
|
|
6175
|
-
this.trim = !!specifier.trim;
|
|
6176
|
-
this.type = specifier.type === undefined ? "" : specifier.type + "";
|
|
6177
|
-
}
|
|
6178
|
-
|
|
6179
|
-
FormatSpecifier.prototype.toString = function() {
|
|
6180
|
-
return this.fill
|
|
6181
|
-
+ this.align
|
|
6182
|
-
+ this.sign
|
|
6183
|
-
+ this.symbol
|
|
6184
|
-
+ (this.zero ? "0" : "")
|
|
6185
|
-
+ (this.width === undefined ? "" : Math.max(1, this.width | 0))
|
|
6186
|
-
+ (this.comma ? "," : "")
|
|
6187
|
-
+ (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
|
|
6188
|
-
+ (this.trim ? "~" : "")
|
|
6189
|
-
+ this.type;
|
|
6190
|
-
};
|
|
6191
|
-
|
|
6192
|
-
// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
|
|
6193
|
-
function formatTrim(s) {
|
|
6194
|
-
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
|
|
6195
|
-
switch (s[i]) {
|
|
6196
|
-
case ".": i0 = i1 = i; break;
|
|
6197
|
-
case "0": if (i0 === 0) i0 = i; i1 = i; break;
|
|
6198
|
-
default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
|
|
6199
|
-
}
|
|
6200
|
-
}
|
|
6201
|
-
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
|
|
6202
|
-
}
|
|
6203
|
-
|
|
6204
|
-
var prefixExponent;
|
|
6205
|
-
|
|
6206
|
-
function formatPrefixAuto(x, p) {
|
|
6207
|
-
var d = formatDecimalParts(x, p);
|
|
6208
|
-
if (!d) return prefixExponent = undefined, x.toPrecision(p);
|
|
6209
|
-
var coefficient = d[0],
|
|
6210
|
-
exponent = d[1],
|
|
6211
|
-
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
|
|
6212
|
-
n = coefficient.length;
|
|
6213
|
-
return i === n ? coefficient
|
|
6214
|
-
: i > n ? coefficient + new Array(i - n + 1).join("0")
|
|
6215
|
-
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
|
|
6216
|
-
: "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
|
|
6217
|
-
}
|
|
6218
|
-
|
|
6219
|
-
function formatRounded(x, p) {
|
|
6220
|
-
var d = formatDecimalParts(x, p);
|
|
6221
|
-
if (!d) return x + "";
|
|
6222
|
-
var coefficient = d[0],
|
|
6223
|
-
exponent = d[1];
|
|
6224
|
-
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
|
|
6225
|
-
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
|
|
6226
|
-
: coefficient + new Array(exponent - coefficient.length + 2).join("0");
|
|
6227
|
-
}
|
|
6228
|
-
|
|
6229
|
-
var formatTypes = {
|
|
6230
|
-
"%": (x, p) => (x * 100).toFixed(p),
|
|
6231
|
-
"b": (x) => Math.round(x).toString(2),
|
|
6232
|
-
"c": (x) => x + "",
|
|
6233
|
-
"d": formatDecimal,
|
|
6234
|
-
"e": (x, p) => x.toExponential(p),
|
|
6235
|
-
"f": (x, p) => x.toFixed(p),
|
|
6236
|
-
"g": (x, p) => x.toPrecision(p),
|
|
6237
|
-
"o": (x) => Math.round(x).toString(8),
|
|
6238
|
-
"p": (x, p) => formatRounded(x * 100, p),
|
|
6239
|
-
"r": formatRounded,
|
|
6240
|
-
"s": formatPrefixAuto,
|
|
6241
|
-
"X": (x) => Math.round(x).toString(16).toUpperCase(),
|
|
6242
|
-
"x": (x) => Math.round(x).toString(16)
|
|
6243
|
-
};
|
|
6244
|
-
|
|
6245
|
-
function identity(x) {
|
|
6246
|
-
return x;
|
|
6247
|
-
}
|
|
6248
|
-
|
|
6249
|
-
var map = Array.prototype.map,
|
|
6250
|
-
prefixes$1 = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
|
|
6251
|
-
|
|
6252
|
-
function formatLocale(locale) {
|
|
6253
|
-
var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
|
|
6254
|
-
currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
|
|
6255
|
-
currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
|
|
6256
|
-
decimal = locale.decimal === undefined ? "." : locale.decimal + "",
|
|
6257
|
-
numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
|
|
6258
|
-
percent = locale.percent === undefined ? "%" : locale.percent + "",
|
|
6259
|
-
minus = locale.minus === undefined ? "−" : locale.minus + "",
|
|
6260
|
-
nan = locale.nan === undefined ? "NaN" : locale.nan + "";
|
|
6261
|
-
|
|
6262
|
-
function newFormat(specifier, options) {
|
|
6263
|
-
specifier = formatSpecifier(specifier);
|
|
6264
|
-
|
|
6265
|
-
var fill = specifier.fill,
|
|
6266
|
-
align = specifier.align,
|
|
6267
|
-
sign = specifier.sign,
|
|
6268
|
-
symbol = specifier.symbol,
|
|
6269
|
-
zero = specifier.zero,
|
|
6270
|
-
width = specifier.width,
|
|
6271
|
-
comma = specifier.comma,
|
|
6272
|
-
precision = specifier.precision,
|
|
6273
|
-
trim = specifier.trim,
|
|
6274
|
-
type = specifier.type;
|
|
6275
|
-
|
|
6276
|
-
// The "n" type is an alias for ",g".
|
|
6277
|
-
if (type === "n") comma = true, type = "g";
|
|
6278
|
-
|
|
6279
|
-
// The "" type, and any invalid type, is an alias for ".12~g".
|
|
6280
|
-
else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
|
|
6281
|
-
|
|
6282
|
-
// If zero fill is specified, padding goes after sign and before digits.
|
|
6283
|
-
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
|
|
6284
|
-
|
|
6285
|
-
// Compute the prefix and suffix.
|
|
6286
|
-
// For SI-prefix, the suffix is lazily computed.
|
|
6287
|
-
var prefix = (options && options.prefix !== undefined ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""),
|
|
6288
|
-
suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== undefined ? options.suffix : "");
|
|
6289
|
-
|
|
6290
|
-
// What format function should we use?
|
|
6291
|
-
// Is this an integer type?
|
|
6292
|
-
// Can this type generate exponential notation?
|
|
6293
|
-
var formatType = formatTypes[type],
|
|
6294
|
-
maybeSuffix = /[defgprs%]/.test(type);
|
|
6295
|
-
|
|
6296
|
-
// Set the default precision if not specified,
|
|
6297
|
-
// or clamp the specified precision to the supported range.
|
|
6298
|
-
// For significant precision, it must be in [1, 21].
|
|
6299
|
-
// For fixed precision, it must be in [0, 20].
|
|
6300
|
-
precision = precision === undefined ? 6
|
|
6301
|
-
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
|
|
6302
|
-
: Math.max(0, Math.min(20, precision));
|
|
6303
|
-
|
|
6304
|
-
function format(value) {
|
|
6305
|
-
var valuePrefix = prefix,
|
|
6306
|
-
valueSuffix = suffix,
|
|
6307
|
-
i, n, c;
|
|
6308
|
-
|
|
6309
|
-
if (type === "c") {
|
|
6310
|
-
valueSuffix = formatType(value) + valueSuffix;
|
|
6311
|
-
value = "";
|
|
6312
|
-
} else {
|
|
6313
|
-
value = +value;
|
|
6314
|
-
|
|
6315
|
-
// Determine the sign. -0 is not less than 0, but 1 / -0 is!
|
|
6316
|
-
var valueNegative = value < 0 || 1 / value < 0;
|
|
6317
|
-
|
|
6318
|
-
// Perform the initial formatting.
|
|
6319
|
-
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
|
|
6320
|
-
|
|
6321
|
-
// Trim insignificant zeros.
|
|
6322
|
-
if (trim) value = formatTrim(value);
|
|
6323
|
-
|
|
6324
|
-
// If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
|
|
6325
|
-
if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
|
|
6326
|
-
|
|
6327
|
-
// Compute the prefix and suffix.
|
|
6328
|
-
valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
|
6329
|
-
valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== undefined ? prefixes$1[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
|
6330
|
-
|
|
6331
|
-
// Break the formatted value into the integer “value” part that can be
|
|
6332
|
-
// grouped, and fractional or exponential “suffix” part that is not.
|
|
6333
|
-
if (maybeSuffix) {
|
|
6334
|
-
i = -1, n = value.length;
|
|
6335
|
-
while (++i < n) {
|
|
6336
|
-
if (c = value.charCodeAt(i), 48 > c || c > 57) {
|
|
6337
|
-
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
|
|
6338
|
-
value = value.slice(0, i);
|
|
6339
|
-
break;
|
|
6340
|
-
}
|
|
6341
|
-
}
|
|
6342
|
-
}
|
|
6343
|
-
}
|
|
6344
|
-
|
|
6345
|
-
// If the fill character is not "0", grouping is applied before padding.
|
|
6346
|
-
if (comma && !zero) value = group(value, Infinity);
|
|
6347
|
-
|
|
6348
|
-
// Compute the padding.
|
|
6349
|
-
var length = valuePrefix.length + value.length + valueSuffix.length,
|
|
6350
|
-
padding = length < width ? new Array(width - length + 1).join(fill) : "";
|
|
6351
|
-
|
|
6352
|
-
// If the fill character is "0", grouping is applied after padding.
|
|
6353
|
-
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
|
|
6354
|
-
|
|
6355
|
-
// Reconstruct the final output based on the desired alignment.
|
|
6356
|
-
switch (align) {
|
|
6357
|
-
case "<": value = valuePrefix + value + valueSuffix + padding; break;
|
|
6358
|
-
case "=": value = valuePrefix + padding + value + valueSuffix; break;
|
|
6359
|
-
case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
|
|
6360
|
-
default: value = padding + valuePrefix + value + valueSuffix; break;
|
|
6361
|
-
}
|
|
6362
|
-
|
|
6363
|
-
return numerals(value);
|
|
6364
|
-
}
|
|
6365
|
-
|
|
6366
|
-
format.toString = function() {
|
|
6367
|
-
return specifier + "";
|
|
6368
|
-
};
|
|
6369
|
-
|
|
6370
|
-
return format;
|
|
6371
|
-
}
|
|
6372
|
-
|
|
6373
|
-
function formatPrefix(specifier, value) {
|
|
6374
|
-
var e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
|
|
6375
|
-
k = Math.pow(10, -e),
|
|
6376
|
-
f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), {suffix: prefixes$1[8 + e / 3]});
|
|
6377
|
-
return function(value) {
|
|
6378
|
-
return f(k * value);
|
|
6379
|
-
};
|
|
6380
|
-
}
|
|
6381
|
-
|
|
6382
|
-
return {
|
|
6383
|
-
format: newFormat,
|
|
6384
|
-
formatPrefix: formatPrefix
|
|
6385
|
-
};
|
|
6386
|
-
}
|
|
6387
|
-
|
|
6388
|
-
var locale;
|
|
6389
|
-
var format;
|
|
6390
|
-
var formatPrefix;
|
|
6391
|
-
|
|
6392
|
-
defaultLocale({
|
|
6393
|
-
thousands: ",",
|
|
6394
|
-
grouping: [3],
|
|
6395
|
-
currency: ["$", ""]
|
|
6396
|
-
});
|
|
6397
|
-
|
|
6398
|
-
function defaultLocale(definition) {
|
|
6399
|
-
locale = formatLocale(definition);
|
|
6400
|
-
format = locale.format;
|
|
6401
|
-
formatPrefix = locale.formatPrefix;
|
|
6402
|
-
return locale;
|
|
6403
|
-
}
|
|
6404
|
-
|
|
6405
|
-
function precisionFixed(step) {
|
|
6406
|
-
return Math.max(0, -exponent(Math.abs(step)));
|
|
6407
|
-
}
|
|
6408
|
-
|
|
6409
|
-
function precisionPrefix(step, value) {
|
|
6410
|
-
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
|
|
6411
|
-
}
|
|
6412
|
-
|
|
6413
|
-
function precisionRound(step, max) {
|
|
6414
|
-
step = Math.abs(step), max = Math.abs(max) - step;
|
|
6415
|
-
return Math.max(0, exponent(max) - exponent(step)) + 1;
|
|
6416
|
-
}
|
|
6417
|
-
|
|
6418
|
-
function tickFormat(start, stop, count, specifier) {
|
|
6419
|
-
var step = tickStep(start, stop, count),
|
|
6420
|
-
precision;
|
|
6421
|
-
specifier = formatSpecifier(specifier == null ? ",f" : specifier);
|
|
6422
|
-
switch (specifier.type) {
|
|
6423
|
-
case "s": {
|
|
6424
|
-
var value = Math.max(Math.abs(start), Math.abs(stop));
|
|
6425
|
-
if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
|
|
6426
|
-
return formatPrefix(specifier, value);
|
|
6427
|
-
}
|
|
6428
|
-
case "":
|
|
6429
|
-
case "e":
|
|
6430
|
-
case "g":
|
|
6431
|
-
case "p":
|
|
6432
|
-
case "r": {
|
|
6433
|
-
if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
|
|
6434
|
-
break;
|
|
6435
|
-
}
|
|
6436
|
-
case "f":
|
|
6437
|
-
case "%": {
|
|
6438
|
-
if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
|
|
6439
|
-
break;
|
|
6440
|
-
}
|
|
6441
|
-
}
|
|
6442
|
-
return format(specifier);
|
|
6443
|
-
}
|
|
6444
|
-
|
|
6445
|
-
function linearish(scale) {
|
|
6446
|
-
var domain = scale.domain;
|
|
6447
|
-
|
|
6448
|
-
scale.ticks = function(count) {
|
|
6449
|
-
var d = domain();
|
|
6450
|
-
return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
|
|
6451
|
-
};
|
|
6452
|
-
|
|
6453
|
-
scale.tickFormat = function(count, specifier) {
|
|
6454
|
-
var d = domain();
|
|
6455
|
-
return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
|
|
6456
|
-
};
|
|
6457
|
-
|
|
6458
|
-
scale.nice = function(count) {
|
|
6459
|
-
if (count == null) count = 10;
|
|
6460
|
-
|
|
6461
|
-
var d = domain();
|
|
6462
|
-
var i0 = 0;
|
|
6463
|
-
var i1 = d.length - 1;
|
|
6464
|
-
var start = d[i0];
|
|
6465
|
-
var stop = d[i1];
|
|
6466
|
-
var prestep;
|
|
6467
|
-
var step;
|
|
6468
|
-
var maxIter = 10;
|
|
6469
|
-
|
|
6470
|
-
if (stop < start) {
|
|
6471
|
-
step = start, start = stop, stop = step;
|
|
6472
|
-
step = i0, i0 = i1, i1 = step;
|
|
6473
|
-
}
|
|
6474
|
-
|
|
6475
|
-
while (maxIter-- > 0) {
|
|
6476
|
-
step = tickIncrement(start, stop, count);
|
|
6477
|
-
if (step === prestep) {
|
|
6478
|
-
d[i0] = start;
|
|
6479
|
-
d[i1] = stop;
|
|
6480
|
-
return domain(d);
|
|
6481
|
-
} else if (step > 0) {
|
|
6482
|
-
start = Math.floor(start / step) * step;
|
|
6483
|
-
stop = Math.ceil(stop / step) * step;
|
|
6484
|
-
} else if (step < 0) {
|
|
6485
|
-
start = Math.ceil(start * step) / step;
|
|
6486
|
-
stop = Math.floor(stop * step) / step;
|
|
6487
|
-
} else {
|
|
6488
|
-
break;
|
|
6489
|
-
}
|
|
6490
|
-
prestep = step;
|
|
6491
|
-
}
|
|
6492
|
-
|
|
6493
|
-
return scale;
|
|
6494
|
-
};
|
|
6495
|
-
|
|
6496
|
-
return scale;
|
|
6497
|
-
}
|
|
6498
|
-
|
|
6499
|
-
function linear() {
|
|
6500
|
-
var scale = continuous();
|
|
6501
|
-
|
|
6502
|
-
scale.copy = function() {
|
|
6503
|
-
return copy(scale, linear());
|
|
6504
|
-
};
|
|
6505
|
-
|
|
6506
|
-
initRange.apply(scale, arguments);
|
|
6507
|
-
|
|
6508
|
-
return linearish(scale);
|
|
6509
|
-
}
|
|
6510
|
-
|
|
6511
|
-
function isGradientStopType(item) {
|
|
6512
|
-
return item.offset != null && typeof item.offset === 'number' && item.color != null && typeof item.color === 'string';
|
|
6513
|
-
}
|
|
6514
|
-
function isGradientType(color) {
|
|
6515
|
-
return Array.isArray(color) && color.every(item => isGradientStopType(item));
|
|
6516
|
-
}
|
|
6517
|
-
|
|
6518
|
-
const uniqueId = (() => {
|
|
6519
|
-
let num = 0;
|
|
6520
|
-
return prefix => {
|
|
6521
|
-
num++;
|
|
6522
|
-
return `${prefix}-${num}`;
|
|
6523
|
-
};
|
|
6524
|
-
})();
|
|
6525
|
-
|
|
6526
|
-
const isValidNumber$1 = value => {
|
|
6527
|
-
if (value === 0) return true;
|
|
6528
|
-
return value != null;
|
|
6529
|
-
};
|
|
6530
|
-
const paddingStringToObject = paddingString => {
|
|
6531
|
-
var _paddingString$match;
|
|
6532
|
-
const numberPattern = /\d+/g;
|
|
6533
|
-
const [top, right, bottom, left] = ((_paddingString$match = paddingString.match(numberPattern)) === null || _paddingString$match === void 0 ? void 0 : _paddingString$match.map(paddingSide => isValidNumber$1(paddingSide) ? paddingSide : null)) || [];
|
|
6534
|
-
const hasValidRight = isValidNumber$1(right);
|
|
6535
|
-
const alternateLeft = hasValidRight ? right : top;
|
|
6536
|
-
return {
|
|
6537
|
-
paddingTop: Number(top),
|
|
6538
|
-
paddingRight: Number(hasValidRight ? right : top),
|
|
6539
|
-
paddingBottom: Number(isValidNumber$1(bottom) ? bottom : top),
|
|
6540
|
-
paddingLeft: Number(isValidNumber$1(left) ? left : alternateLeft)
|
|
6541
|
-
};
|
|
6542
|
-
};
|
|
6543
|
-
|
|
6544
|
-
const DEFAULT_WIDTH = 11.63;
|
|
6545
|
-
function estimateStringWidth(string, characterWidths) {
|
|
6546
|
-
let sum = 0;
|
|
6547
|
-
for (const char of string) {
|
|
6548
|
-
let charWidth = characterWidths[char];
|
|
6549
|
-
if (charWidth == null || isNaN(charWidth)) {
|
|
6550
|
-
var _characterWidths$W;
|
|
6551
|
-
charWidth = (_characterWidths$W = characterWidths.W) !== null && _characterWidths$W !== void 0 ? _characterWidths$W : DEFAULT_WIDTH;
|
|
6552
|
-
}
|
|
6553
|
-
sum += charWidth;
|
|
6554
|
-
}
|
|
6555
|
-
return sum;
|
|
6556
|
-
}
|
|
6557
|
-
|
|
6558
|
-
function getColorVisionEventAttrs({
|
|
6559
|
-
type,
|
|
6560
|
-
index,
|
|
6561
|
-
watch = true
|
|
6562
|
-
}) {
|
|
6563
|
-
return {
|
|
6564
|
-
[`${COLOR_VISION_EVENT.dataAttribute}-watch`]: watch,
|
|
6565
|
-
[`${COLOR_VISION_EVENT.dataAttribute}-type`]: type,
|
|
6566
|
-
[`${COLOR_VISION_EVENT.dataAttribute}-index`]: index
|
|
6567
|
-
};
|
|
6568
|
-
}
|
|
6569
|
-
|
|
6570
|
-
function getColorVisionStylesForActiveIndex({
|
|
6571
|
-
activeIndex,
|
|
6572
|
-
index,
|
|
6573
|
-
fadedOpacity = COLOR_VISION_FADED_OPACITY
|
|
6574
|
-
}) {
|
|
6575
|
-
const activeOpacity = activeIndex === index ? COLOR_VISION_ACTIVE_OPACITY : fadedOpacity;
|
|
6576
|
-
return {
|
|
6577
|
-
opacity: activeIndex === -1 ? COLOR_VISION_ACTIVE_OPACITY : activeOpacity,
|
|
6578
|
-
transition: 'opacity 100ms ease'
|
|
6579
|
-
};
|
|
6580
|
-
}
|
|
6581
|
-
|
|
6582
|
-
const isValidNumber = value => {
|
|
6583
|
-
if (value === 0) return true;
|
|
6584
|
-
return value != null;
|
|
6585
|
-
};
|
|
6586
|
-
const borderRadiusStringToObject = borderRadiusString => {
|
|
6587
|
-
var _borderRadiusString$m;
|
|
6588
|
-
const numberPattern = /\d+/g;
|
|
6589
|
-
const [topLeft, topRight, bottomRight, bottomLeft] = ((_borderRadiusString$m = borderRadiusString.match(numberPattern)) === null || _borderRadiusString$m === void 0 ? void 0 : _borderRadiusString$m.map(corner => isValidNumber(corner) ? corner : null)) || [];
|
|
6590
|
-
const hasValidRight = isValidNumber(topRight);
|
|
6591
|
-
const alternateLeft = hasValidRight ? topRight : topLeft;
|
|
6592
|
-
return {
|
|
6593
|
-
topLeft: Number(topLeft),
|
|
6594
|
-
topRight: Number(hasValidRight ? topRight : topLeft),
|
|
6595
|
-
bottomRight: Number(isValidNumber(bottomRight) ? bottomRight : topLeft),
|
|
6596
|
-
bottomLeft: Number(isValidNumber(bottomLeft) ? bottomLeft : alternateLeft)
|
|
6597
|
-
};
|
|
6598
|
-
};
|
|
6599
|
-
|
|
6600
|
-
function keepValuePositive(amount) {
|
|
6601
|
-
return Math.abs(clamp$1({
|
|
6602
|
-
amount,
|
|
6603
|
-
min: 0
|
|
6604
|
-
}));
|
|
6605
|
-
}
|
|
6606
|
-
function getRoundedRectPath({
|
|
6607
|
-
borderRadius,
|
|
6608
|
-
height,
|
|
6609
|
-
width
|
|
6610
|
-
}) {
|
|
6611
|
-
if (height == null || width == null) {
|
|
6612
|
-
return '';
|
|
6613
|
-
}
|
|
6614
|
-
let {
|
|
6615
|
-
topLeft,
|
|
6616
|
-
topRight,
|
|
6617
|
-
bottomRight,
|
|
6618
|
-
bottomLeft
|
|
6619
|
-
} = borderRadiusStringToObject(borderRadius);
|
|
6620
|
-
const smallestSize = Math.min(height, width);
|
|
6621
|
-
topLeft = Math.min(topLeft, smallestSize / 2);
|
|
6622
|
-
topRight = Math.min(topRight, smallestSize / 2);
|
|
6623
|
-
bottomRight = Math.min(bottomRight, smallestSize / 2);
|
|
6624
|
-
bottomLeft = Math.min(bottomLeft, smallestSize / 2);
|
|
6625
|
-
const top = topLeft + topRight;
|
|
6626
|
-
const right = topRight + bottomRight;
|
|
6627
|
-
const bottom = bottomRight + bottomLeft;
|
|
6628
|
-
const left = bottomLeft + topLeft;
|
|
6629
|
-
return `
|
|
6630
|
-
M${topLeft},0
|
|
6631
|
-
h${keepValuePositive(width - top)}
|
|
6632
|
-
a${topRight},${topRight} 0 0 1 ${topRight},${topRight}
|
|
6633
|
-
v${keepValuePositive(height - right)}
|
|
6634
|
-
a${bottomRight},${bottomRight} 0 0 1 -${bottomRight},${bottomRight}
|
|
6635
|
-
h-${keepValuePositive(width - bottom)}
|
|
6636
|
-
a${bottomLeft},${bottomLeft} 0 0 1 -${bottomLeft},-${bottomLeft}
|
|
6637
|
-
v-${keepValuePositive(height - left)}
|
|
6638
|
-
a${topLeft},${topLeft} 0 0 1 ${topLeft},-${topLeft}
|
|
6639
|
-
Z
|
|
6640
|
-
`;
|
|
5744
|
+
return new Rgb(
|
|
5745
|
+
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
|
5746
|
+
hsl2rgb(h, m1, m2),
|
|
5747
|
+
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
|
5748
|
+
this.opacity
|
|
5749
|
+
);
|
|
5750
|
+
},
|
|
5751
|
+
clamp() {
|
|
5752
|
+
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
|
5753
|
+
},
|
|
5754
|
+
displayable() {
|
|
5755
|
+
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
|
5756
|
+
&& (0 <= this.l && this.l <= 1)
|
|
5757
|
+
&& (0 <= this.opacity && this.opacity <= 1);
|
|
5758
|
+
},
|
|
5759
|
+
formatHsl() {
|
|
5760
|
+
const a = clampa(this.opacity);
|
|
5761
|
+
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
|
|
5762
|
+
}
|
|
5763
|
+
}));
|
|
5764
|
+
|
|
5765
|
+
function clamph(value) {
|
|
5766
|
+
value = (value || 0) % 360;
|
|
5767
|
+
return value < 0 ? value + 360 : value;
|
|
5768
|
+
}
|
|
5769
|
+
|
|
5770
|
+
function clampt(value) {
|
|
5771
|
+
return Math.max(0, Math.min(1, value || 0));
|
|
5772
|
+
}
|
|
5773
|
+
|
|
5774
|
+
/* From FvD 13.37, CSS Color Module Level 3 */
|
|
5775
|
+
function hsl2rgb(h, m1, m2) {
|
|
5776
|
+
return (h < 60 ? m1 + (m2 - m1) * h / 60
|
|
5777
|
+
: h < 180 ? m2
|
|
5778
|
+
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
|
|
5779
|
+
: m1) * 255;
|
|
6641
5780
|
}
|
|
6642
5781
|
|
|
6643
5782
|
function changeColorOpacity(colorString, opacity = 1) {
|
|
@@ -8163,462 +7302,6 @@ function useSpringConfig({
|
|
|
8163
7302
|
};
|
|
8164
7303
|
}
|
|
8165
7304
|
|
|
8166
|
-
function constant(x) {
|
|
8167
|
-
return function constant() {
|
|
8168
|
-
return x;
|
|
8169
|
-
};
|
|
8170
|
-
}
|
|
8171
|
-
|
|
8172
|
-
const abs = Math.abs;
|
|
8173
|
-
const atan2 = Math.atan2;
|
|
8174
|
-
const cos = Math.cos;
|
|
8175
|
-
const max = Math.max;
|
|
8176
|
-
const min = Math.min;
|
|
8177
|
-
const sin = Math.sin;
|
|
8178
|
-
const sqrt = Math.sqrt;
|
|
8179
|
-
|
|
8180
|
-
const epsilon$1 = 1e-12;
|
|
8181
|
-
const pi$1 = Math.PI;
|
|
8182
|
-
const halfPi = pi$1 / 2;
|
|
8183
|
-
const tau$1 = 2 * pi$1;
|
|
8184
|
-
|
|
8185
|
-
function acos(x) {
|
|
8186
|
-
return x > 1 ? 0 : x < -1 ? pi$1 : Math.acos(x);
|
|
8187
|
-
}
|
|
8188
|
-
|
|
8189
|
-
function asin(x) {
|
|
8190
|
-
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
|
|
8191
|
-
}
|
|
8192
|
-
|
|
8193
|
-
const pi = Math.PI,
|
|
8194
|
-
tau = 2 * pi,
|
|
8195
|
-
epsilon = 1e-6,
|
|
8196
|
-
tauEpsilon = tau - epsilon;
|
|
8197
|
-
|
|
8198
|
-
function append(strings) {
|
|
8199
|
-
this._ += strings[0];
|
|
8200
|
-
for (let i = 1, n = strings.length; i < n; ++i) {
|
|
8201
|
-
this._ += arguments[i] + strings[i];
|
|
8202
|
-
}
|
|
8203
|
-
}
|
|
8204
|
-
|
|
8205
|
-
function appendRound(digits) {
|
|
8206
|
-
let d = Math.floor(digits);
|
|
8207
|
-
if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);
|
|
8208
|
-
if (d > 15) return append;
|
|
8209
|
-
const k = 10 ** d;
|
|
8210
|
-
return function(strings) {
|
|
8211
|
-
this._ += strings[0];
|
|
8212
|
-
for (let i = 1, n = strings.length; i < n; ++i) {
|
|
8213
|
-
this._ += Math.round(arguments[i] * k) / k + strings[i];
|
|
8214
|
-
}
|
|
8215
|
-
};
|
|
8216
|
-
}
|
|
8217
|
-
|
|
8218
|
-
class Path {
|
|
8219
|
-
constructor(digits) {
|
|
8220
|
-
this._x0 = this._y0 = // start of current subpath
|
|
8221
|
-
this._x1 = this._y1 = null; // end of current subpath
|
|
8222
|
-
this._ = "";
|
|
8223
|
-
this._append = digits == null ? append : appendRound(digits);
|
|
8224
|
-
}
|
|
8225
|
-
moveTo(x, y) {
|
|
8226
|
-
this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
|
|
8227
|
-
}
|
|
8228
|
-
closePath() {
|
|
8229
|
-
if (this._x1 !== null) {
|
|
8230
|
-
this._x1 = this._x0, this._y1 = this._y0;
|
|
8231
|
-
this._append`Z`;
|
|
8232
|
-
}
|
|
8233
|
-
}
|
|
8234
|
-
lineTo(x, y) {
|
|
8235
|
-
this._append`L${this._x1 = +x},${this._y1 = +y}`;
|
|
8236
|
-
}
|
|
8237
|
-
quadraticCurveTo(x1, y1, x, y) {
|
|
8238
|
-
this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;
|
|
8239
|
-
}
|
|
8240
|
-
bezierCurveTo(x1, y1, x2, y2, x, y) {
|
|
8241
|
-
this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;
|
|
8242
|
-
}
|
|
8243
|
-
arcTo(x1, y1, x2, y2, r) {
|
|
8244
|
-
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
|
|
8245
|
-
|
|
8246
|
-
// Is the radius negative? Error.
|
|
8247
|
-
if (r < 0) throw new Error(`negative radius: ${r}`);
|
|
8248
|
-
|
|
8249
|
-
let x0 = this._x1,
|
|
8250
|
-
y0 = this._y1,
|
|
8251
|
-
x21 = x2 - x1,
|
|
8252
|
-
y21 = y2 - y1,
|
|
8253
|
-
x01 = x0 - x1,
|
|
8254
|
-
y01 = y0 - y1,
|
|
8255
|
-
l01_2 = x01 * x01 + y01 * y01;
|
|
8256
|
-
|
|
8257
|
-
// Is this path empty? Move to (x1,y1).
|
|
8258
|
-
if (this._x1 === null) {
|
|
8259
|
-
this._append`M${this._x1 = x1},${this._y1 = y1}`;
|
|
8260
|
-
}
|
|
8261
|
-
|
|
8262
|
-
// Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
|
|
8263
|
-
else if (!(l01_2 > epsilon));
|
|
8264
|
-
|
|
8265
|
-
// Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
|
|
8266
|
-
// Equivalently, is (x1,y1) coincident with (x2,y2)?
|
|
8267
|
-
// Or, is the radius zero? Line to (x1,y1).
|
|
8268
|
-
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
|
|
8269
|
-
this._append`L${this._x1 = x1},${this._y1 = y1}`;
|
|
8270
|
-
}
|
|
8271
|
-
|
|
8272
|
-
// Otherwise, draw an arc!
|
|
8273
|
-
else {
|
|
8274
|
-
let x20 = x2 - x0,
|
|
8275
|
-
y20 = y2 - y0,
|
|
8276
|
-
l21_2 = x21 * x21 + y21 * y21,
|
|
8277
|
-
l20_2 = x20 * x20 + y20 * y20,
|
|
8278
|
-
l21 = Math.sqrt(l21_2),
|
|
8279
|
-
l01 = Math.sqrt(l01_2),
|
|
8280
|
-
l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
|
|
8281
|
-
t01 = l / l01,
|
|
8282
|
-
t21 = l / l21;
|
|
8283
|
-
|
|
8284
|
-
// If the start tangent is not coincident with (x0,y0), line to.
|
|
8285
|
-
if (Math.abs(t01 - 1) > epsilon) {
|
|
8286
|
-
this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
|
|
8287
|
-
}
|
|
8288
|
-
|
|
8289
|
-
this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
|
|
8290
|
-
}
|
|
8291
|
-
}
|
|
8292
|
-
arc(x, y, r, a0, a1, ccw) {
|
|
8293
|
-
x = +x, y = +y, r = +r, ccw = !!ccw;
|
|
8294
|
-
|
|
8295
|
-
// Is the radius negative? Error.
|
|
8296
|
-
if (r < 0) throw new Error(`negative radius: ${r}`);
|
|
8297
|
-
|
|
8298
|
-
let dx = r * Math.cos(a0),
|
|
8299
|
-
dy = r * Math.sin(a0),
|
|
8300
|
-
x0 = x + dx,
|
|
8301
|
-
y0 = y + dy,
|
|
8302
|
-
cw = 1 ^ ccw,
|
|
8303
|
-
da = ccw ? a0 - a1 : a1 - a0;
|
|
8304
|
-
|
|
8305
|
-
// Is this path empty? Move to (x0,y0).
|
|
8306
|
-
if (this._x1 === null) {
|
|
8307
|
-
this._append`M${x0},${y0}`;
|
|
8308
|
-
}
|
|
8309
|
-
|
|
8310
|
-
// Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
|
|
8311
|
-
else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
|
|
8312
|
-
this._append`L${x0},${y0}`;
|
|
8313
|
-
}
|
|
8314
|
-
|
|
8315
|
-
// Is this arc empty? We’re done.
|
|
8316
|
-
if (!r) return;
|
|
8317
|
-
|
|
8318
|
-
// Does the angle go the wrong way? Flip the direction.
|
|
8319
|
-
if (da < 0) da = da % tau + tau;
|
|
8320
|
-
|
|
8321
|
-
// Is this a complete circle? Draw two arcs to complete the circle.
|
|
8322
|
-
if (da > tauEpsilon) {
|
|
8323
|
-
this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
|
|
8324
|
-
}
|
|
8325
|
-
|
|
8326
|
-
// Is this arc non-empty? Draw an arc!
|
|
8327
|
-
else if (da > epsilon) {
|
|
8328
|
-
this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;
|
|
8329
|
-
}
|
|
8330
|
-
}
|
|
8331
|
-
rect(x, y, w, h) {
|
|
8332
|
-
this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;
|
|
8333
|
-
}
|
|
8334
|
-
toString() {
|
|
8335
|
-
return this._;
|
|
8336
|
-
}
|
|
8337
|
-
}
|
|
8338
|
-
|
|
8339
|
-
function withPath(shape) {
|
|
8340
|
-
let digits = 3;
|
|
8341
|
-
|
|
8342
|
-
shape.digits = function(_) {
|
|
8343
|
-
if (!arguments.length) return digits;
|
|
8344
|
-
if (_ == null) {
|
|
8345
|
-
digits = null;
|
|
8346
|
-
} else {
|
|
8347
|
-
const d = Math.floor(_);
|
|
8348
|
-
if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
|
|
8349
|
-
digits = d;
|
|
8350
|
-
}
|
|
8351
|
-
return shape;
|
|
8352
|
-
};
|
|
8353
|
-
|
|
8354
|
-
return () => new Path(digits);
|
|
8355
|
-
}
|
|
8356
|
-
|
|
8357
|
-
function arcInnerRadius(d) {
|
|
8358
|
-
return d.innerRadius;
|
|
8359
|
-
}
|
|
8360
|
-
|
|
8361
|
-
function arcOuterRadius(d) {
|
|
8362
|
-
return d.outerRadius;
|
|
8363
|
-
}
|
|
8364
|
-
|
|
8365
|
-
function arcStartAngle(d) {
|
|
8366
|
-
return d.startAngle;
|
|
8367
|
-
}
|
|
8368
|
-
|
|
8369
|
-
function arcEndAngle(d) {
|
|
8370
|
-
return d.endAngle;
|
|
8371
|
-
}
|
|
8372
|
-
|
|
8373
|
-
function arcPadAngle(d) {
|
|
8374
|
-
return d && d.padAngle; // Note: optional!
|
|
8375
|
-
}
|
|
8376
|
-
|
|
8377
|
-
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
8378
|
-
var x10 = x1 - x0, y10 = y1 - y0,
|
|
8379
|
-
x32 = x3 - x2, y32 = y3 - y2,
|
|
8380
|
-
t = y32 * x10 - x32 * y10;
|
|
8381
|
-
if (t * t < epsilon$1) return;
|
|
8382
|
-
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
|
8383
|
-
return [x0 + t * x10, y0 + t * y10];
|
|
8384
|
-
}
|
|
8385
|
-
|
|
8386
|
-
// Compute perpendicular offset line of length rc.
|
|
8387
|
-
// http://mathworld.wolfram.com/Circle-LineIntersection.html
|
|
8388
|
-
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
8389
|
-
var x01 = x0 - x1,
|
|
8390
|
-
y01 = y0 - y1,
|
|
8391
|
-
lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),
|
|
8392
|
-
ox = lo * y01,
|
|
8393
|
-
oy = -lo * x01,
|
|
8394
|
-
x11 = x0 + ox,
|
|
8395
|
-
y11 = y0 + oy,
|
|
8396
|
-
x10 = x1 + ox,
|
|
8397
|
-
y10 = y1 + oy,
|
|
8398
|
-
x00 = (x11 + x10) / 2,
|
|
8399
|
-
y00 = (y11 + y10) / 2,
|
|
8400
|
-
dx = x10 - x11,
|
|
8401
|
-
dy = y10 - y11,
|
|
8402
|
-
d2 = dx * dx + dy * dy,
|
|
8403
|
-
r = r1 - rc,
|
|
8404
|
-
D = x11 * y10 - x10 * y11,
|
|
8405
|
-
d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),
|
|
8406
|
-
cx0 = (D * dy - dx * d) / d2,
|
|
8407
|
-
cy0 = (-D * dx - dy * d) / d2,
|
|
8408
|
-
cx1 = (D * dy + dx * d) / d2,
|
|
8409
|
-
cy1 = (-D * dx + dy * d) / d2,
|
|
8410
|
-
dx0 = cx0 - x00,
|
|
8411
|
-
dy0 = cy0 - y00,
|
|
8412
|
-
dx1 = cx1 - x00,
|
|
8413
|
-
dy1 = cy1 - y00;
|
|
8414
|
-
|
|
8415
|
-
// Pick the closer of the two intersection points.
|
|
8416
|
-
// TODO Is there a faster way to determine which intersection to use?
|
|
8417
|
-
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
|
|
8418
|
-
|
|
8419
|
-
return {
|
|
8420
|
-
cx: cx0,
|
|
8421
|
-
cy: cy0,
|
|
8422
|
-
x01: -ox,
|
|
8423
|
-
y01: -oy,
|
|
8424
|
-
x11: cx0 * (r1 / r - 1),
|
|
8425
|
-
y11: cy0 * (r1 / r - 1)
|
|
8426
|
-
};
|
|
8427
|
-
}
|
|
8428
|
-
|
|
8429
|
-
function arc() {
|
|
8430
|
-
var innerRadius = arcInnerRadius,
|
|
8431
|
-
outerRadius = arcOuterRadius,
|
|
8432
|
-
cornerRadius = constant(0),
|
|
8433
|
-
padRadius = null,
|
|
8434
|
-
startAngle = arcStartAngle,
|
|
8435
|
-
endAngle = arcEndAngle,
|
|
8436
|
-
padAngle = arcPadAngle,
|
|
8437
|
-
context = null,
|
|
8438
|
-
path = withPath(arc);
|
|
8439
|
-
|
|
8440
|
-
function arc() {
|
|
8441
|
-
var buffer,
|
|
8442
|
-
r,
|
|
8443
|
-
r0 = +innerRadius.apply(this, arguments),
|
|
8444
|
-
r1 = +outerRadius.apply(this, arguments),
|
|
8445
|
-
a0 = startAngle.apply(this, arguments) - halfPi,
|
|
8446
|
-
a1 = endAngle.apply(this, arguments) - halfPi,
|
|
8447
|
-
da = abs(a1 - a0),
|
|
8448
|
-
cw = a1 > a0;
|
|
8449
|
-
|
|
8450
|
-
if (!context) context = buffer = path();
|
|
8451
|
-
|
|
8452
|
-
// Ensure that the outer radius is always larger than the inner radius.
|
|
8453
|
-
if (r1 < r0) r = r1, r1 = r0, r0 = r;
|
|
8454
|
-
|
|
8455
|
-
// Is it a point?
|
|
8456
|
-
if (!(r1 > epsilon$1)) context.moveTo(0, 0);
|
|
8457
|
-
|
|
8458
|
-
// Or is it a circle or annulus?
|
|
8459
|
-
else if (da > tau$1 - epsilon$1) {
|
|
8460
|
-
context.moveTo(r1 * cos(a0), r1 * sin(a0));
|
|
8461
|
-
context.arc(0, 0, r1, a0, a1, !cw);
|
|
8462
|
-
if (r0 > epsilon$1) {
|
|
8463
|
-
context.moveTo(r0 * cos(a1), r0 * sin(a1));
|
|
8464
|
-
context.arc(0, 0, r0, a1, a0, cw);
|
|
8465
|
-
}
|
|
8466
|
-
}
|
|
8467
|
-
|
|
8468
|
-
// Or is it a circular or annular sector?
|
|
8469
|
-
else {
|
|
8470
|
-
var a01 = a0,
|
|
8471
|
-
a11 = a1,
|
|
8472
|
-
a00 = a0,
|
|
8473
|
-
a10 = a1,
|
|
8474
|
-
da0 = da,
|
|
8475
|
-
da1 = da,
|
|
8476
|
-
ap = padAngle.apply(this, arguments) / 2,
|
|
8477
|
-
rp = (ap > epsilon$1) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),
|
|
8478
|
-
rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
|
|
8479
|
-
rc0 = rc,
|
|
8480
|
-
rc1 = rc,
|
|
8481
|
-
t0,
|
|
8482
|
-
t1;
|
|
8483
|
-
|
|
8484
|
-
// Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
|
|
8485
|
-
if (rp > epsilon$1) {
|
|
8486
|
-
var p0 = asin(rp / r0 * sin(ap)),
|
|
8487
|
-
p1 = asin(rp / r1 * sin(ap));
|
|
8488
|
-
if ((da0 -= p0 * 2) > epsilon$1) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;
|
|
8489
|
-
else da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
|
8490
|
-
if ((da1 -= p1 * 2) > epsilon$1) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;
|
|
8491
|
-
else da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
|
8492
|
-
}
|
|
8493
|
-
|
|
8494
|
-
var x01 = r1 * cos(a01),
|
|
8495
|
-
y01 = r1 * sin(a01),
|
|
8496
|
-
x10 = r0 * cos(a10),
|
|
8497
|
-
y10 = r0 * sin(a10);
|
|
8498
|
-
|
|
8499
|
-
// Apply rounded corners?
|
|
8500
|
-
if (rc > epsilon$1) {
|
|
8501
|
-
var x11 = r1 * cos(a11),
|
|
8502
|
-
y11 = r1 * sin(a11),
|
|
8503
|
-
x00 = r0 * cos(a00),
|
|
8504
|
-
y00 = r0 * sin(a00),
|
|
8505
|
-
oc;
|
|
8506
|
-
|
|
8507
|
-
// Restrict the corner radius according to the sector angle. If this
|
|
8508
|
-
// intersection fails, it’s probably because the arc is too small, so
|
|
8509
|
-
// disable the corner radius entirely.
|
|
8510
|
-
if (da < pi$1) {
|
|
8511
|
-
if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
|
|
8512
|
-
var ax = x01 - oc[0],
|
|
8513
|
-
ay = y01 - oc[1],
|
|
8514
|
-
bx = x11 - oc[0],
|
|
8515
|
-
by = y11 - oc[1],
|
|
8516
|
-
kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
|
|
8517
|
-
lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
8518
|
-
rc0 = min(rc, (r0 - lc) / (kc - 1));
|
|
8519
|
-
rc1 = min(rc, (r1 - lc) / (kc + 1));
|
|
8520
|
-
} else {
|
|
8521
|
-
rc0 = rc1 = 0;
|
|
8522
|
-
}
|
|
8523
|
-
}
|
|
8524
|
-
}
|
|
8525
|
-
|
|
8526
|
-
// Is the sector collapsed to a line?
|
|
8527
|
-
if (!(da1 > epsilon$1)) context.moveTo(x01, y01);
|
|
8528
|
-
|
|
8529
|
-
// Does the sector’s outer ring have rounded corners?
|
|
8530
|
-
else if (rc1 > epsilon$1) {
|
|
8531
|
-
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
|
8532
|
-
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
|
8533
|
-
|
|
8534
|
-
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
8535
|
-
|
|
8536
|
-
// Have the corners merged?
|
|
8537
|
-
if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
8538
|
-
|
|
8539
|
-
// Otherwise, draw the two corners and the ring.
|
|
8540
|
-
else {
|
|
8541
|
-
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
8542
|
-
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
|
|
8543
|
-
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
8544
|
-
}
|
|
8545
|
-
}
|
|
8546
|
-
|
|
8547
|
-
// Or is the outer ring just a circular arc?
|
|
8548
|
-
else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
|
|
8549
|
-
|
|
8550
|
-
// Is there no inner ring, and it’s a circular sector?
|
|
8551
|
-
// Or perhaps it’s an annular sector collapsed due to padding?
|
|
8552
|
-
if (!(r0 > epsilon$1) || !(da0 > epsilon$1)) context.lineTo(x10, y10);
|
|
8553
|
-
|
|
8554
|
-
// Does the sector’s inner ring (or point) have rounded corners?
|
|
8555
|
-
else if (rc0 > epsilon$1) {
|
|
8556
|
-
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
|
8557
|
-
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
|
8558
|
-
|
|
8559
|
-
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
8560
|
-
|
|
8561
|
-
// Have the corners merged?
|
|
8562
|
-
if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
8563
|
-
|
|
8564
|
-
// Otherwise, draw the two corners and the ring.
|
|
8565
|
-
else {
|
|
8566
|
-
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
8567
|
-
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
|
|
8568
|
-
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
8569
|
-
}
|
|
8570
|
-
}
|
|
8571
|
-
|
|
8572
|
-
// Or is the inner ring just a circular arc?
|
|
8573
|
-
else context.arc(0, 0, r0, a10, a00, cw);
|
|
8574
|
-
}
|
|
8575
|
-
|
|
8576
|
-
context.closePath();
|
|
8577
|
-
|
|
8578
|
-
if (buffer) return context = null, buffer + "" || null;
|
|
8579
|
-
}
|
|
8580
|
-
|
|
8581
|
-
arc.centroid = function() {
|
|
8582
|
-
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,
|
|
8583
|
-
a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$1 / 2;
|
|
8584
|
-
return [cos(a) * r, sin(a) * r];
|
|
8585
|
-
};
|
|
8586
|
-
|
|
8587
|
-
arc.innerRadius = function(_) {
|
|
8588
|
-
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
|
|
8589
|
-
};
|
|
8590
|
-
|
|
8591
|
-
arc.outerRadius = function(_) {
|
|
8592
|
-
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
|
|
8593
|
-
};
|
|
8594
|
-
|
|
8595
|
-
arc.cornerRadius = function(_) {
|
|
8596
|
-
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
|
|
8597
|
-
};
|
|
8598
|
-
|
|
8599
|
-
arc.padRadius = function(_) {
|
|
8600
|
-
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
|
|
8601
|
-
};
|
|
8602
|
-
|
|
8603
|
-
arc.startAngle = function(_) {
|
|
8604
|
-
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
|
|
8605
|
-
};
|
|
8606
|
-
|
|
8607
|
-
arc.endAngle = function(_) {
|
|
8608
|
-
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
|
|
8609
|
-
};
|
|
8610
|
-
|
|
8611
|
-
arc.padAngle = function(_) {
|
|
8612
|
-
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
|
|
8613
|
-
};
|
|
8614
|
-
|
|
8615
|
-
arc.context = function(_) {
|
|
8616
|
-
return arguments.length ? ((context = _ == null ? null : _), arc) : context;
|
|
8617
|
-
};
|
|
8618
|
-
|
|
8619
|
-
return arc;
|
|
8620
|
-
}
|
|
8621
|
-
|
|
8622
7305
|
function LinearGradientWithStops({
|
|
8623
7306
|
gradient,
|
|
8624
7307
|
id,
|
|
@@ -23407,6 +22090,8 @@ function FunnelChartLabels({ formattedValues, labels, labelWidth, barWidth, perc
|
|
|
23407
22090
|
}
|
|
23408
22091
|
|
|
23409
22092
|
function calculateDropOff(value, nextValue) {
|
|
22093
|
+
if (!value)
|
|
22094
|
+
return 0;
|
|
23410
22095
|
return ((nextValue - value) / value) * 100;
|
|
23411
22096
|
}
|
|
23412
22097
|
|
|
@@ -23457,9 +22142,7 @@ function Tooltip({ activeIndex, dataSeries, trends, tooltipLabels, funnelColors,
|
|
|
23457
22142
|
return (jsx(TooltipContentContainer, { maxWidth: TOOLTIP_WIDTH, minWidth: TOOLTIP_WIDTH, theme: DEFAULT_THEME_NAME, color: selectedTheme.tooltip.backgroundColor, children: () => (jsxs(Fragment$1, { children: [jsx(TooltipTitle, { theme: DEFAULT_THEME_NAME, color: selectedTheme.tooltip.textColor, "aria-label": `Step: ${point.key}`, children: point.key }), jsx("div", { className: "GFunnelChartNextTooltip-rows", children: data.map(({ key, value, color, percent, trendKey }, index) => {
|
|
23458
22143
|
const formattedPercent = percent === null ? '-' : percentageFormatter(percent);
|
|
23459
22144
|
const ariaLabel = `${key}: ${value}, ${formattedPercent}`;
|
|
23460
|
-
const { trendIndicatorProps } = getTrendIndicatorData(
|
|
23461
|
-
? trends?.[activeIndex]
|
|
23462
|
-
: trends?.[activeIndex]);
|
|
22145
|
+
const { trendIndicatorProps } = getTrendIndicatorData(trends?.[activeIndex]);
|
|
23463
22146
|
const trendByKey = trendIndicatorProps[trendKey];
|
|
23464
22147
|
return (jsxs("div", { className: "GFunnelChartNextTooltip-row", "aria-label": ariaLabel, children: [jsxs("div", { className: "GFunnelChartNextTooltip-keys", children: [jsx(SeriesIcon, { color: color }), jsx("span", { children: key })] }), jsxs("div", { className: "GFunnelChartNextTooltip-values", children: [jsx("span", { children: jsx("strong", { children: value }) }), jsx("span", { children: jsx("strong", { children: formattedPercent }) }), trendIndicatorProps && (jsx("div", { className: "GFunnelChartNextTooltip-trendIndicator", children: jsx(TrendIndicator, { ...trendByKey }) }))] })] }, `row-${index}-${key}`));
|
|
23465
22148
|
}) })] })) }));
|
|
@@ -23625,7 +22308,7 @@ function Chart({ data, tooltipLabels, showTooltip = true, showPercentages = true
|
|
|
23625
22308
|
y: 0,
|
|
23626
22309
|
};
|
|
23627
22310
|
const highestYValue = Math.max(...sanitizedYValues);
|
|
23628
|
-
const yScale =
|
|
22311
|
+
const yScale = scaleLinear()
|
|
23629
22312
|
.range([0, drawableHeight - LABELS_HEIGHT - barHeightAdjustment])
|
|
23630
22313
|
.domain([0, highestYValue]);
|
|
23631
22314
|
const { getBarHeight, shouldApplyScaling } = useFunnelBarScaling({
|
|
@@ -23642,8 +22325,8 @@ function Chart({ data, tooltipLabels, showTooltip = true, showPercentages = true
|
|
|
23642
22325
|
const totalStepWidth = drawableWidth / xValues.length;
|
|
23643
22326
|
const connectorWidth = totalStepWidth * (1 - SEGMENT_WIDTH_RATIO);
|
|
23644
22327
|
const drawableWidthWithLastConnector = drawableWidth + connectorWidth;
|
|
23645
|
-
const xScale =
|
|
23646
|
-
const labelXScale =
|
|
22328
|
+
const xScale = scaleBand().domain(xValues).range([0, drawableWidthWithLastConnector]);
|
|
22329
|
+
const labelXScale = scaleBand()
|
|
23647
22330
|
.range([0, drawableWidthWithLastConnector])
|
|
23648
22331
|
.domain(labels.map((_, index) => index.toString()));
|
|
23649
22332
|
const sectionWidth = xScale.bandwidth();
|
|
@@ -23707,6 +22390,10 @@ const ChartContainerWrapper = ({ props, children, height, }) => {
|
|
|
23707
22390
|
};
|
|
23708
22391
|
|
|
23709
22392
|
const GChartProvider = ({ children, minHeight = 228, seriesColors, }) => {
|
|
22393
|
+
const [mounted, setMounted] = useState(false);
|
|
22394
|
+
useEffect(() => setMounted(true), []);
|
|
22395
|
+
if (!mounted)
|
|
22396
|
+
return null;
|
|
23710
22397
|
return (jsxs(Fragment, { children: [jsx("link", { rel: "stylesheet", href: chartStyle }), jsx(PolarisVizProvider, { themes: {
|
|
23711
22398
|
Light: {
|
|
23712
22399
|
chartContainer: {
|
|
@@ -23814,7 +22501,7 @@ const FunnelSelectionPopover = (props) => {
|
|
|
23814
22501
|
const FunnelChartActionIcon = ({ level, isLastLevel, isFinalFixedLevel, actionProps, }) => {
|
|
23815
22502
|
const { t } = useTranslation();
|
|
23816
22503
|
const { isMobileView } = useWindowSize();
|
|
23817
|
-
const { listFunnelSelection, onAddNextFunnel, onNotify, isDisabledAddICon } = actionProps || {};
|
|
22504
|
+
const { listFunnelSelection, onAddNextFunnel, onNotify, isDisabledAddICon, hideAddIcon } = actionProps || {};
|
|
23818
22505
|
const lengthDisplayedLevels = actionProps?.lengthDisplayedLevels || 0;
|
|
23819
22506
|
const [isOpenPathSelectionPopover, setIsOpenPathSelectionPopover] = useState(false);
|
|
23820
22507
|
if (isLastLevel)
|
|
@@ -23822,7 +22509,7 @@ const FunnelChartActionIcon = ({ level, isLastLevel, isFinalFixedLevel, actionPr
|
|
|
23822
22509
|
if (level < lengthDisplayedLevels || isFinalFixedLevel) {
|
|
23823
22510
|
return jsx(Icon, { source: SvgArrowRightIcon });
|
|
23824
22511
|
}
|
|
23825
|
-
if (isMobileView)
|
|
22512
|
+
if (isMobileView || hideAddIcon)
|
|
23826
22513
|
return null;
|
|
23827
22514
|
const tooltip = isDisabledAddICon ? t('Funnel step limit reached.') : t('Add funnel step');
|
|
23828
22515
|
return (jsx(FunnelSelectionPopover, { open: isOpenPathSelectionPopover, onClose: () => setIsOpenPathSelectionPopover(false), listFunnelSelection: listFunnelSelection, onAddNextFunnel: onAddNextFunnel, onNotify: onNotify, activator: jsx(GTooltip, { content: tooltip, children: jsx(Button, { icon: jsx(Icon, { source: SvgPlusIcon }), onClick: () => setIsOpenPathSelectionPopover((prev) => !prev), disabled: isDisabledAddICon }) }) }));
|
|
@@ -23852,12 +22539,15 @@ const FunnelChartAction = ({ dataSeries, actionProps }) => {
|
|
|
23852
22539
|
const { containerBounds } = useChartContext();
|
|
23853
22540
|
const { LINE_OFFSET, LINE_WIDTH, SEGMENT_WIDTH_RATIO, GAP } = FUNNEL_CHART_NEXT_CONSTANTS;
|
|
23854
22541
|
const drawableWidth = containerBounds?.width ?? 0;
|
|
23855
|
-
const dataPoints = dataSeries[0]
|
|
22542
|
+
const dataPoints = dataSeries[0]?.data ?? [];
|
|
22543
|
+
// Layout math below relies on at least two steps (rectX[0]/rectX[1]); bail out on loading/empty/single-step.
|
|
22544
|
+
if (dataPoints.length < 2)
|
|
22545
|
+
return null;
|
|
23856
22546
|
const xValues = dataPoints.map(({ key }) => key);
|
|
23857
22547
|
const totalStepWidth = drawableWidth / xValues.length;
|
|
23858
22548
|
const connectorWidth = totalStepWidth * (1 - SEGMENT_WIDTH_RATIO);
|
|
23859
22549
|
const drawableWidthWithLastConnector = drawableWidth + connectorWidth;
|
|
23860
|
-
const xScale =
|
|
22550
|
+
const xScale = scaleBand().domain(xValues).range([0, drawableWidthWithLastConnector]);
|
|
23861
22551
|
const sectionWidth = xScale.bandwidth();
|
|
23862
22552
|
const barWidth = sectionWidth * SEGMENT_WIDTH_RATIO;
|
|
23863
22553
|
const rectX = dataPoints.map((dataPoint) => {
|
|
@@ -24057,7 +22747,7 @@ const NON_HEATMAP_PAGE_TYPES = new Set([TemplateType.CHECKOUT]);
|
|
|
24057
22747
|
const usePathAnalysisChart = () => {
|
|
24058
22748
|
const { t } = useTranslation();
|
|
24059
22749
|
const { getTextPrice } = useConvertMoneyContext();
|
|
24060
|
-
const { heatmap } = usePathAnalysisConfig();
|
|
22750
|
+
const { heatmap, autoExpandLevels } = usePathAnalysisConfig();
|
|
24061
22751
|
const { shopifyPageType, pageWithMetric, nextLevelPages, dynamicLevels, previousPathAnalyticsMap, handleAddNextLevel, handleChangeLevel, getPagesByParentID, handleDeleteLevel, } = usePathAnalysisContext();
|
|
24062
22752
|
const orderedPages = useMemo(() => [pageWithMetric, ...dynamicLevels].filter(Boolean), [pageWithMetric, dynamicLevels]);
|
|
24063
22753
|
const chartTooltipPrimaryAction = useMemo(() => {
|
|
@@ -24097,17 +22787,17 @@ const usePathAnalysisChart = () => {
|
|
|
24097
22787
|
{
|
|
24098
22788
|
value: Number(totalAddedToCart ?? 0),
|
|
24099
22789
|
key: METRICS_COLUMNS[IPAMetricKey.PAGE_ADDED_TO_CART]?.label ?? t('Added to cart'),
|
|
24100
|
-
labelTooltip:
|
|
22790
|
+
labelTooltip: ANALYTICS_METRIC_TOOLTIP[EMetricKey.CART_ADDITION],
|
|
24101
22791
|
},
|
|
24102
22792
|
{
|
|
24103
22793
|
value: Number(totalReachedCheckout ?? 0),
|
|
24104
22794
|
key: t('Reached checkout'),
|
|
24105
|
-
labelTooltip:
|
|
22795
|
+
labelTooltip: ANALYTICS_METRIC_TOOLTIP[EMetricKey.REACHED_CHECKOUT],
|
|
24106
22796
|
},
|
|
24107
22797
|
{
|
|
24108
22798
|
value: Number(totalCompletedCheckout ?? 0),
|
|
24109
22799
|
key: t('Completed checkout'),
|
|
24110
|
-
labelTooltip:
|
|
22800
|
+
labelTooltip: ANALYTICS_METRIC_TOOLTIP[EMetricKey.COMPLETE_CHECKOUT],
|
|
24111
22801
|
},
|
|
24112
22802
|
];
|
|
24113
22803
|
}, [t]);
|
|
@@ -24124,12 +22814,15 @@ const usePathAnalysisChart = () => {
|
|
|
24124
22814
|
getTextPrice,
|
|
24125
22815
|
}),
|
|
24126
22816
|
chartTooltipPrimaryAction: heatmap.isEnabledV2 ? getTooltipAction(item?.pageType ?? undefined) : undefined,
|
|
24127
|
-
|
|
24128
|
-
|
|
24129
|
-
|
|
24130
|
-
|
|
24131
|
-
|
|
24132
|
-
|
|
22817
|
+
// Auto-expand mode is a read-only view: hide the delete (trash) action.
|
|
22818
|
+
secondaryActions: autoExpandLevels
|
|
22819
|
+
? undefined
|
|
22820
|
+
: [
|
|
22821
|
+
{
|
|
22822
|
+
onAction: () => onDeleteFunnel(item.id),
|
|
22823
|
+
icon: SvgDeleteIcon,
|
|
22824
|
+
},
|
|
22825
|
+
],
|
|
24133
22826
|
title: item.pageTitle ?? undefined,
|
|
24134
22827
|
});
|
|
24135
22828
|
// Previous data
|
|
@@ -24139,7 +22832,15 @@ const usePathAnalysisChart = () => {
|
|
|
24139
22832
|
title: item.pageTitle ?? undefined,
|
|
24140
22833
|
});
|
|
24141
22834
|
return acc;
|
|
24142
|
-
}, { currentData: [], previousData: [] }), [
|
|
22835
|
+
}, { currentData: [], previousData: [] }), [
|
|
22836
|
+
dynamicLevels,
|
|
22837
|
+
previousPathAnalyticsMap,
|
|
22838
|
+
onDeleteFunnel,
|
|
22839
|
+
getTextPrice,
|
|
22840
|
+
getTooltipAction,
|
|
22841
|
+
heatmap.isEnabledV2,
|
|
22842
|
+
autoExpandLevels,
|
|
22843
|
+
]);
|
|
24143
22844
|
const lastLevelPreviousData = previousPathAnalyticsMap[lastLevel?.id ?? ''];
|
|
24144
22845
|
const funnelData = useMemo(() => {
|
|
24145
22846
|
const firstLevelKey = pageWithMetric?.pageTitle ||
|
|
@@ -24223,6 +22924,9 @@ const usePathAnalysisChart = () => {
|
|
|
24223
22924
|
}, [nextLevelPages]);
|
|
24224
22925
|
//list funnel selection to change funnel
|
|
24225
22926
|
const getListFunnelByID = (data) => {
|
|
22927
|
+
// Auto-expand mode is read-only: collapse the change-path popover to a static label.
|
|
22928
|
+
if (autoExpandLevels)
|
|
22929
|
+
return [];
|
|
24226
22930
|
const { level, parentID } = data;
|
|
24227
22931
|
const availableChildPages = getPagesByParentID({ level, parentID });
|
|
24228
22932
|
// if (level === 0) {
|
|
@@ -24242,6 +22946,7 @@ const usePathAnalysisChart = () => {
|
|
|
24242
22946
|
lengthDisplayedLevels,
|
|
24243
22947
|
listFunnelSelection,
|
|
24244
22948
|
isDisabledAddICon,
|
|
22949
|
+
hideAddIcon: !!autoExpandLevels,
|
|
24245
22950
|
funnelData,
|
|
24246
22951
|
onDeleteFunnel,
|
|
24247
22952
|
onAddNextFunnel,
|
|
@@ -24251,7 +22956,7 @@ const usePathAnalysisChart = () => {
|
|
|
24251
22956
|
};
|
|
24252
22957
|
|
|
24253
22958
|
const PathAnalysisChart = ({ funnelColors, isEnabled }) => {
|
|
24254
|
-
const { lengthDisplayedLevels, listFunnelSelection, isDisabledAddICon, funnelData, getListFunnelByID, onAddNextFunnel, onChangeFunnel, } = usePathAnalysisChart();
|
|
22959
|
+
const { lengthDisplayedLevels, listFunnelSelection, isDisabledAddICon, hideAddIcon, funnelData, getListFunnelByID, onAddNextFunnel, onChangeFunnel, } = usePathAnalysisChart();
|
|
24255
22960
|
const dataSeries = useMemo(() => {
|
|
24256
22961
|
if (!isEnabled)
|
|
24257
22962
|
return MOCK_DATA_PATH_ANALYSIS;
|
|
@@ -24262,6 +22967,7 @@ const PathAnalysisChart = ({ funnelColors, isEnabled }) => {
|
|
|
24262
22967
|
lengthDisplayedLevels,
|
|
24263
22968
|
listFunnelSelection,
|
|
24264
22969
|
isDisabledAddICon,
|
|
22970
|
+
hideAddIcon,
|
|
24265
22971
|
getListFunnelByID,
|
|
24266
22972
|
onAddNextFunnel,
|
|
24267
22973
|
onChangeFunnel,
|
|
@@ -24334,11 +23040,17 @@ const CardJourneyAnalysis = ({ analyticMode, config, ...props }) => {
|
|
|
24334
23040
|
return (jsx(PathAnalysisConfigProvider, { ...config, children: jsx(CardPathAnalysis, { analyticMode: analyticMode || EAnalyticMode.ALL_SESSION, ...props, children: jsx(InlineStack, { gap: "200", children: jsx(GTooltipCard, { tooltip: ANALYTICS_METRIC_TOOLTIP[EMetricKey.PAGE_PATH_ANALYSIS], children: jsx(Text, { as: "h3", variant: "headingMd", children: t('Journey analysis') }) }) }) }) }));
|
|
24335
23041
|
};
|
|
24336
23042
|
|
|
24337
|
-
var
|
|
24338
|
-
(function (
|
|
24339
|
-
|
|
24340
|
-
|
|
24341
|
-
|
|
23043
|
+
var EReportColumnKey;
|
|
23044
|
+
(function (EReportColumnKey) {
|
|
23045
|
+
EReportColumnKey["ORDER_ID"] = "order_id";
|
|
23046
|
+
EReportColumnKey["ORDER_DATE"] = "order_date";
|
|
23047
|
+
EReportColumnKey["TOTAL"] = "total_price";
|
|
23048
|
+
EReportColumnKey["CAMPAIGNS"] = "experiments";
|
|
23049
|
+
EReportColumnKey["TRAFFIC_SOURCE"] = "traffic_source";
|
|
23050
|
+
EReportColumnKey["ITEMS"] = "items";
|
|
23051
|
+
EReportColumnKey["DEVICE"] = "device";
|
|
23052
|
+
EReportColumnKey["VISITOR"] = "visitor_type";
|
|
23053
|
+
})(EReportColumnKey || (EReportColumnKey = {}));
|
|
24342
23054
|
|
|
24343
23055
|
var EReportDataType;
|
|
24344
23056
|
(function (EReportDataType) {
|
|
@@ -24394,17 +23106,74 @@ var IRMetricKey;
|
|
|
24394
23106
|
IRMetricKey["VISITOR_BY_TYPE"] = "visitor_type";
|
|
24395
23107
|
})(IRMetricKey || (IRMetricKey = {}));
|
|
24396
23108
|
|
|
24397
|
-
|
|
24398
|
-
(
|
|
24399
|
-
|
|
24400
|
-
|
|
24401
|
-
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
|
|
24406
|
-
|
|
24407
|
-
|
|
23109
|
+
[IRVariantType.VARIANT_A, IRVariantType.VARIANT_B];
|
|
23110
|
+
({
|
|
23111
|
+
[IRVariantType.VARIANT_A]: 'Control',
|
|
23112
|
+
[IRVariantType.VARIANT_B]: 'Variant',
|
|
23113
|
+
});
|
|
23114
|
+
|
|
23115
|
+
const COLUMN_SEPARATOR = '___';
|
|
23116
|
+
const DIMENSION_SEPARATOR = '__';
|
|
23117
|
+
const COMPARISON_PREFIX = 'comparison';
|
|
23118
|
+
const PREVIOUS_PERIOD_KEY = 'previous_period';
|
|
23119
|
+
const TOTAL_SUFFIX = 'totals';
|
|
23120
|
+
|
|
23121
|
+
const joinColumnParts = (...parts) => parts.join(COLUMN_SEPARATOR);
|
|
23122
|
+
const getDimensionPathKey = (dimensions, dimensionIndex) => dimensions.slice(0, dimensionIndex + 1).join(DIMENSION_SEPARATOR);
|
|
23123
|
+
function getPreviousColumnName(key) {
|
|
23124
|
+
return joinColumnParts(COMPARISON_PREFIX, key, PREVIOUS_PERIOD_KEY);
|
|
23125
|
+
}
|
|
23126
|
+
function getPreviousTotalColumnName(key) {
|
|
23127
|
+
return joinColumnParts(COMPARISON_PREFIX, key, PREVIOUS_PERIOD_KEY, TOTAL_SUFFIX);
|
|
23128
|
+
}
|
|
23129
|
+
function getTotalColumnName(key) {
|
|
23130
|
+
return joinColumnParts(key, TOTAL_SUFFIX);
|
|
23131
|
+
}
|
|
23132
|
+
function getTotalColumnNameByDimensions(dimensions, key, dimensionIndex) {
|
|
23133
|
+
return joinColumnParts(key, getDimensionPathKey(dimensions, dimensionIndex), TOTAL_SUFFIX);
|
|
23134
|
+
}
|
|
23135
|
+
function getPreviousTotalColumnNameByDimensions(dimensions, key, dimensionIndex) {
|
|
23136
|
+
return joinColumnParts(COMPARISON_PREFIX, key, PREVIOUS_PERIOD_KEY, getDimensionPathKey(dimensions, dimensionIndex), TOTAL_SUFFIX);
|
|
23137
|
+
}
|
|
23138
|
+
function getMetricPreviousValue(row, key) {
|
|
23139
|
+
return row[getPreviousColumnName(key)];
|
|
23140
|
+
}
|
|
23141
|
+
|
|
23142
|
+
const convertOrderItemsToReportTableRows = (orderItems) => {
|
|
23143
|
+
return orderItems.map((orderItem) => {
|
|
23144
|
+
const { events: _events, ...restOrderItem } = orderItem;
|
|
23145
|
+
return {
|
|
23146
|
+
...restOrderItem,
|
|
23147
|
+
items: typeof orderItem.items === 'string' ? JSON.parse(orderItem.items) : (orderItem.items ?? []),
|
|
23148
|
+
experiments: typeof orderItem.experiments === 'string' ? JSON.parse(orderItem.experiments) : (orderItem.experiments ?? []),
|
|
23149
|
+
};
|
|
23150
|
+
});
|
|
23151
|
+
};
|
|
23152
|
+
const applyTotalToSummaryRow = (rows) => {
|
|
23153
|
+
let totalPrice = 0;
|
|
23154
|
+
let totalItems = 0;
|
|
23155
|
+
rows.forEach((row) => {
|
|
23156
|
+
const rowTotal = row[EReportColumnKey.TOTAL];
|
|
23157
|
+
const rowItems = row[EReportColumnKey.ITEMS];
|
|
23158
|
+
if (typeof rowTotal === 'number') {
|
|
23159
|
+
totalPrice += rowTotal;
|
|
23160
|
+
}
|
|
23161
|
+
if (Array.isArray(rowItems)) {
|
|
23162
|
+
totalItems += rowItems.reduce((acc, item) => acc + Number(item.quantity), 0);
|
|
23163
|
+
}
|
|
23164
|
+
});
|
|
23165
|
+
return rows.map((row, index) => {
|
|
23166
|
+
const totalItemsLabel = totalItems > 1 ? `${totalItems} items` : `${totalItems} item`;
|
|
23167
|
+
return {
|
|
23168
|
+
// Only add totals to first row (used by SummaryRow)
|
|
23169
|
+
...(index === 0 && {
|
|
23170
|
+
[getTotalColumnName(EReportColumnKey.TOTAL)]: totalPrice,
|
|
23171
|
+
[getTotalColumnName(EReportColumnKey.ITEMS)]: totalItemsLabel,
|
|
23172
|
+
}),
|
|
23173
|
+
...row,
|
|
23174
|
+
};
|
|
23175
|
+
});
|
|
23176
|
+
};
|
|
24408
23177
|
|
|
24409
23178
|
const ORDER_LISTING_DIMENSION_LAYOUT = {
|
|
24410
23179
|
width: '158px',
|
|
@@ -24614,79 +23383,6 @@ const DEFAULT_SELECTED_COLUMNS_FOR_EXPERIMENT = [
|
|
|
24614
23383
|
EReportColumnKey.VISITOR,
|
|
24615
23384
|
];
|
|
24616
23385
|
|
|
24617
|
-
const OrderListingTableEmpty = ({ title, description }) => {
|
|
24618
|
-
return (jsx(GBlockCenter, { paddingBlock: "400", children: jsxs(BlockStack, { gap: "400", inlineAlign: "center", children: [jsx("img", { src: ANALYTIC_EMPTY, alt: "No orders", width: 80, height: 80 }), jsxs(BlockStack, { gap: "200", inlineAlign: "center", children: [jsx(Text, { as: "p", variant: "headingSm", fontWeight: "semibold", children: title }), jsx(Text, { as: "p", variant: "bodyMd", tone: "subdued", alignment: "center", children: description })] })] }) }));
|
|
24619
|
-
};
|
|
24620
|
-
|
|
24621
|
-
[IRVariantType.VARIANT_A, IRVariantType.VARIANT_B];
|
|
24622
|
-
({
|
|
24623
|
-
[IRVariantType.VARIANT_A]: 'Control',
|
|
24624
|
-
[IRVariantType.VARIANT_B]: 'Variant',
|
|
24625
|
-
});
|
|
24626
|
-
|
|
24627
|
-
const COLUMN_SEPARATOR = '___';
|
|
24628
|
-
const DIMENSION_SEPARATOR = '__';
|
|
24629
|
-
const COMPARISON_PREFIX = 'comparison';
|
|
24630
|
-
const PREVIOUS_PERIOD_KEY = 'previous_period';
|
|
24631
|
-
const TOTAL_SUFFIX = 'totals';
|
|
24632
|
-
|
|
24633
|
-
const joinColumnParts = (...parts) => parts.join(COLUMN_SEPARATOR);
|
|
24634
|
-
const getDimensionPathKey = (dimensions, dimensionIndex) => dimensions.slice(0, dimensionIndex + 1).join(DIMENSION_SEPARATOR);
|
|
24635
|
-
function getPreviousColumnName(key) {
|
|
24636
|
-
return joinColumnParts(COMPARISON_PREFIX, key, PREVIOUS_PERIOD_KEY);
|
|
24637
|
-
}
|
|
24638
|
-
function getPreviousTotalColumnName(key) {
|
|
24639
|
-
return joinColumnParts(COMPARISON_PREFIX, key, PREVIOUS_PERIOD_KEY, TOTAL_SUFFIX);
|
|
24640
|
-
}
|
|
24641
|
-
function getTotalColumnName(key) {
|
|
24642
|
-
return joinColumnParts(key, TOTAL_SUFFIX);
|
|
24643
|
-
}
|
|
24644
|
-
function getTotalColumnNameByDimensions(dimensions, key, dimensionIndex) {
|
|
24645
|
-
return joinColumnParts(key, getDimensionPathKey(dimensions, dimensionIndex), TOTAL_SUFFIX);
|
|
24646
|
-
}
|
|
24647
|
-
function getPreviousTotalColumnNameByDimensions(dimensions, key, dimensionIndex) {
|
|
24648
|
-
return joinColumnParts(COMPARISON_PREFIX, key, PREVIOUS_PERIOD_KEY, getDimensionPathKey(dimensions, dimensionIndex), TOTAL_SUFFIX);
|
|
24649
|
-
}
|
|
24650
|
-
function getMetricPreviousValue(row, key) {
|
|
24651
|
-
return row[getPreviousColumnName(key)];
|
|
24652
|
-
}
|
|
24653
|
-
|
|
24654
|
-
const convertOrderItemsToReportTableRows = (orderItems) => {
|
|
24655
|
-
return orderItems.map((orderItem) => {
|
|
24656
|
-
const { events: _events, ...restOrderItem } = orderItem;
|
|
24657
|
-
return {
|
|
24658
|
-
...restOrderItem,
|
|
24659
|
-
items: typeof orderItem.items === 'string' ? JSON.parse(orderItem.items) : (orderItem.items ?? []),
|
|
24660
|
-
experiments: typeof orderItem.experiments === 'string' ? JSON.parse(orderItem.experiments) : (orderItem.experiments ?? []),
|
|
24661
|
-
};
|
|
24662
|
-
});
|
|
24663
|
-
};
|
|
24664
|
-
const applyTotalToSummaryRow = (rows) => {
|
|
24665
|
-
let totalPrice = 0;
|
|
24666
|
-
let totalItems = 0;
|
|
24667
|
-
rows.forEach((row) => {
|
|
24668
|
-
const rowTotal = row[EReportColumnKey.TOTAL];
|
|
24669
|
-
const rowItems = row[EReportColumnKey.ITEMS];
|
|
24670
|
-
if (typeof rowTotal === 'number') {
|
|
24671
|
-
totalPrice += rowTotal;
|
|
24672
|
-
}
|
|
24673
|
-
if (Array.isArray(rowItems)) {
|
|
24674
|
-
totalItems += rowItems.reduce((acc, item) => acc + Number(item.quantity), 0);
|
|
24675
|
-
}
|
|
24676
|
-
});
|
|
24677
|
-
return rows.map((row, index) => {
|
|
24678
|
-
const totalItemsLabel = totalItems > 1 ? `${totalItems} items` : `${totalItems} item`;
|
|
24679
|
-
return {
|
|
24680
|
-
// Only add totals to first row (used by SummaryRow)
|
|
24681
|
-
...(index === 0 && {
|
|
24682
|
-
[getTotalColumnName(EReportColumnKey.TOTAL)]: totalPrice,
|
|
24683
|
-
[getTotalColumnName(EReportColumnKey.ITEMS)]: totalItemsLabel,
|
|
24684
|
-
}),
|
|
24685
|
-
...row,
|
|
24686
|
-
};
|
|
24687
|
-
});
|
|
24688
|
-
};
|
|
24689
|
-
|
|
24690
23386
|
const SKELETON_METRICS = [
|
|
24691
23387
|
EReportColumnKey.ORDER_DATE,
|
|
24692
23388
|
EReportColumnKey.TOTAL,
|
|
@@ -24772,6 +23468,10 @@ const OrderListingTableSkeleton = ({ rowCount = 5 }) => {
|
|
|
24772
23468
|
return (jsxs("div", { className: "GReportTable__Container rounded-xl overflow-hidden", children: [jsxs("div", { className: "GReportTable__Wrapper", children: [jsx("div", { className: "GReportTable__StickyHeader", children: jsxs("div", { children: [jsx(SkeletonHeader, {}), jsx(SkeletonSummaryRow, {})] }) }), jsx("div", { className: "GReportTable__ScrollWrap", children: Array.from({ length: rowCount }).map((_, index) => (jsx(SkeletonRow, {}, index))) })] }), jsx("div", { className: "GReportTable__Pagination", children: jsx(InlineStack, { align: "space-between", blockAlign: "center", gap: "400", children: jsx("div", { className: "w-24", children: jsx(SkeletonBodyText, { lines: 1 }) }) }) })] }));
|
|
24773
23469
|
};
|
|
24774
23470
|
|
|
23471
|
+
const OrderListingTableEmpty = ({ title, description }) => {
|
|
23472
|
+
return (jsx(GBlockCenter, { paddingBlock: "400", children: jsxs(BlockStack, { gap: "400", inlineAlign: "center", children: [jsx("img", { src: ANALYTIC_EMPTY, alt: "No orders", width: 80, height: 80 }), jsxs(BlockStack, { gap: "200", inlineAlign: "center", children: [jsx(Text, { as: "p", variant: "headingSm", fontWeight: "semibold", children: title }), jsx(Text, { as: "p", variant: "bodyMd", tone: "subdued", alignment: "center", children: description })] })] }) }));
|
|
23473
|
+
};
|
|
23474
|
+
|
|
24775
23475
|
var EOrderDirectionType;
|
|
24776
23476
|
(function (EOrderDirectionType) {
|
|
24777
23477
|
EOrderDirectionType["ASC"] = "ASC";
|
|
@@ -24784,8 +23484,6 @@ const useOrderControlStore = create()((set) => ({
|
|
|
24784
23484
|
}));
|
|
24785
23485
|
|
|
24786
23486
|
const useOrderColumnsSelectorStore = create()(persist((set) => ({
|
|
24787
|
-
isChangeSelectedColumnsPreviously: false,
|
|
24788
|
-
setIsChangeSelectedColumnsPreviously: () => set({ isChangeSelectedColumnsPreviously: true }),
|
|
24789
23487
|
selectedColumns: DEFAULT_SELECTED_COLUMNS_FOR_EXPERIMENT,
|
|
24790
23488
|
columnsOrder: Object.values(ORDER_COLUMN_MAPPING).map((column) => column.value),
|
|
24791
23489
|
setColumnsOrder: (columnsOrder) => set({ columnsOrder }),
|
|
@@ -24795,8 +23493,8 @@ const useOrderColumnsSelectorStore = create()(persist((set) => ({
|
|
|
24795
23493
|
const useOrderListingData = ({ limitRowAmount, orderListing = [], fixedColumns }) => {
|
|
24796
23494
|
const selectedColumns = useOrderColumnsSelectorStore((state) => state.selectedColumns);
|
|
24797
23495
|
const columnsOrder = useOrderColumnsSelectorStore((state) => state.columnsOrder);
|
|
24798
|
-
const showColumns = ORDER_LISTING_COLUMNS.filter((column) => (fixedColumns ?? selectedColumns).includes(column.name));
|
|
24799
|
-
const sortedMetrics = sortByArrayOrder(ORDER_LISTING_METRICS ?? [], columnsOrder);
|
|
23496
|
+
const showColumns = useMemo(() => ORDER_LISTING_COLUMNS.filter((column) => (fixedColumns ?? selectedColumns).includes(column.name)), [fixedColumns, selectedColumns]);
|
|
23497
|
+
const sortedMetrics = useMemo(() => sortByArrayOrder(ORDER_LISTING_METRICS ?? [], columnsOrder), [columnsOrder]);
|
|
24800
23498
|
const tableData = useMemo(() => {
|
|
24801
23499
|
const rows = convertOrderItemsToReportTableRows(orderListing);
|
|
24802
23500
|
const showRows = limitRowAmount ? rows.slice(0, limitRowAmount) : rows;
|
|
@@ -25182,7 +23880,7 @@ const useReportData = () => {
|
|
|
25182
23880
|
};
|
|
25183
23881
|
};
|
|
25184
23882
|
|
|
25185
|
-
const Pagination = ({ totalRows, itemCount, viewAllMetricContent = 'order', showViewAllButton, paginationProps, isPaginationHidden, }) => {
|
|
23883
|
+
const Pagination = ({ totalRows, itemCount, viewAllMetricContent = 'order', showViewAllButton, paginationProps, isPaginationHidden, isMockData, }) => {
|
|
25186
23884
|
const { t } = useTranslation();
|
|
25187
23885
|
const { onViewAllStoreOrders } = useReportTableActionsContext();
|
|
25188
23886
|
const isHasTotalRows = Boolean(totalRows && totalRows > 0);
|
|
@@ -25197,7 +23895,7 @@ const Pagination = ({ totalRows, itemCount, viewAllMetricContent = 'order', show
|
|
|
25197
23895
|
'justify-end': isShowViewAllStoreOrders,
|
|
25198
23896
|
'justify-center': isHasTotalRows,
|
|
25199
23897
|
'justify-between': (isHasTotalRows || paginationProps) && isShowViewAllStoreOrders,
|
|
25200
|
-
}), children: [paginationProps && jsx(GPagination, { ...paginationProps }), isHasTotalRows && (jsx(Text, { variant: "bodyMd", as: "span", children: t(
|
|
23898
|
+
}), children: [paginationProps && jsx(GPagination, { ...paginationProps }), isHasTotalRows && (jsx(Text, { variant: "bodyMd", as: "span", children: t('{{count}} rows', { count: totalRows }) })), isShowViewAllStoreOrders && (jsx(GMockDataTooltip, { isMockData: isMockData, children: jsx(Button, { variant: "plain", disabled: isMockData, onClick: handleClickViewAllStoreOrders, children: getViewAllStoreOrdersText() }) }))] }));
|
|
25201
23899
|
function getViewAllStoreOrdersText() {
|
|
25202
23900
|
if (itemCount && itemCount > 1) {
|
|
25203
23901
|
return t('View all store {{metric}}s by date range ({{itemCount}})', {
|
|
@@ -25216,8 +23914,8 @@ const ScrollBar = forwardRef(({ isPaginationHidden }, ref) => {
|
|
|
25216
23914
|
});
|
|
25217
23915
|
ScrollBar.displayName = 'ScrollBar';
|
|
25218
23916
|
|
|
25219
|
-
const WrapperFooter = ({ scrollbarContainerRef, itemCount, totalPaginationRows, showViewAllButton, paginationProps, isPaginationHidden, }) => {
|
|
25220
|
-
return (jsxs("div", { className: "GReportTable__FooterWrapper", children: [scrollbarContainerRef && jsx(ScrollBar, { ref: scrollbarContainerRef, isPaginationHidden: isPaginationHidden }), jsx(Pagination, { totalRows: totalPaginationRows, itemCount: itemCount, showViewAllButton: showViewAllButton, paginationProps: paginationProps, isPaginationHidden: isPaginationHidden })] }));
|
|
23917
|
+
const WrapperFooter = ({ scrollbarContainerRef, itemCount, totalPaginationRows, showViewAllButton, paginationProps, isPaginationHidden, isMockData, }) => {
|
|
23918
|
+
return (jsxs("div", { className: "GReportTable__FooterWrapper", children: [scrollbarContainerRef && jsx(ScrollBar, { ref: scrollbarContainerRef, isPaginationHidden: isPaginationHidden }), jsx(Pagination, { totalRows: totalPaginationRows, itemCount: itemCount, showViewAllButton: showViewAllButton, paginationProps: paginationProps, isPaginationHidden: isPaginationHidden, isMockData: isMockData })] }));
|
|
25221
23919
|
};
|
|
25222
23920
|
|
|
25223
23921
|
const PreviousCell = ({ previousValue, isMergedWithPrev }) => {
|
|
@@ -25235,16 +23933,21 @@ const DefaultCell = ({ isMergedWithPrev, value, previousValue, columnLayout, isT
|
|
|
25235
23933
|
return (jsx(WrapperCell, { previousValue: previousValue, isMergedWithPrev: isMergedWithPrev, columnLayout: columnLayout, children: jsx("div", { className: "w-full min-w-0", children: jsx(GTextTruncated, { as: "span", variant: "bodySm", truncate: true, fontWeight: isTotalRow && !isDimensionCol ? 'semibold' : 'regular', alignment: columnLayout?.align, children: isMergedWithPrev ? '' : toCapitalize(valueString) }) }) }));
|
|
25236
23934
|
};
|
|
25237
23935
|
|
|
23936
|
+
const LoadingData = () => {
|
|
23937
|
+
return (jsx(GInlineCenter, { minHeight: "200px", align: "center", inlineAlign: "center", children: jsx(Spinner, { accessibilityLabel: "Fetching orders", size: "small" }) }));
|
|
23938
|
+
};
|
|
23939
|
+
|
|
23940
|
+
const NoData = () => {
|
|
23941
|
+
const { t } = useTranslation();
|
|
23942
|
+
return (jsx(GInlineCenter, { minHeight: "200px", align: "center", inlineAlign: "center", children: jsx(Text, { as: "p", children: t('No orders found.') }) }));
|
|
23943
|
+
};
|
|
23944
|
+
|
|
25238
23945
|
const OrderCellBase = ({ value, justifyContent, isPrevious, isTotalRow, interactive, }) => {
|
|
25239
23946
|
const { onClick, hovering, onHoverChange } = interactive ?? {};
|
|
25240
23947
|
const ableInteractive = !!interactive;
|
|
25241
23948
|
return (jsx("div", { className: cls('GReportTable__CellContent--clickable flex h-7 w-full items-center px-[8px] pl-3', { 'hover:bg-surface-hover cursor-pointer': ableInteractive }, { 'GReportTable__CellContent--noClick': !ableInteractive }), style: { justifyContent }, onClick: onClick ?? undefined, onMouseEnter: ableInteractive ? () => onHoverChange?.(true) : undefined, onMouseLeave: ableInteractive ? () => onHoverChange?.(false) : undefined, children: jsxs(InlineStack, { blockAlign: "center", wrap: false, children: [jsx(Text, { as: "span", variant: "bodyMd", fontWeight: isTotalRow ? 'semibold' : 'regular', tone: isPrevious ? 'subdued' : 'inherit', children: value }), jsx(Box, { opacity: hovering && ableInteractive ? '1' : '0', children: jsx(Icon, { source: SvgCaretDownIcon }) })] }) }));
|
|
25242
23949
|
};
|
|
25243
23950
|
|
|
25244
|
-
const LoadingData = () => {
|
|
25245
|
-
return (jsx(GInlineCenter, { minHeight: "200px", align: "center", inlineAlign: "center", children: jsx(Spinner, { accessibilityLabel: "Fetching orders", size: "small" }) }));
|
|
25246
|
-
};
|
|
25247
|
-
|
|
25248
23951
|
const OrderItem = ({ order }) => {
|
|
25249
23952
|
const { t } = useTranslation();
|
|
25250
23953
|
const { onViewOrderJourney, onViewOrderDetails } = useReportTableActionsContext();
|
|
@@ -25258,18 +23961,13 @@ const OrderItem = ({ order }) => {
|
|
|
25258
23961
|
return (jsx(Box, { padding: "300", borderBlockEndWidth: "025", borderColor: "border", children: jsxs(InlineStack, { align: "space-between", blockAlign: "center", gap: "200", children: [jsxs(BlockStack, { gap: "200", children: [jsx(Text, { as: "p", variant: "bodyMd", children: `ID: ${orderId}` }), jsx(Text, { as: "p", variant: "bodyXs", tone: "subdued", children: formatDate(date) })] }), jsxs(InlineStack, { gap: "100", children: [jsx(Tooltip$1, { content: t('View order details'), children: jsx(Button, { icon: jsx(Icon, { source: SvgOrderIcon, tone: "critical" }), variant: "tertiary", size: "slim", onClick: () => onViewOrderDetails?.(orderId) }) }), jsx(Tooltip$1, { content: t('View order journey'), children: jsx(Button, { icon: jsx(Icon, { source: SvgChartLineIcon, tone: "primary" }), variant: "tertiary", size: "slim", onClick: () => onViewOrderJourney?.(orderId) }) })] })] }) }));
|
|
25259
23962
|
};
|
|
25260
23963
|
|
|
25261
|
-
const
|
|
25262
|
-
const { t } = useTranslation();
|
|
25263
|
-
return (jsx(GInlineCenter, { minHeight: "200px", align: "center", inlineAlign: "center", children: jsx(Text, { as: "p", children: t('No orders found.') }) }));
|
|
25264
|
-
};
|
|
25265
|
-
|
|
25266
|
-
const OrderCell = ({ value, columnLayout, orderCellProps, isPrevious, isTotalRow, }) => {
|
|
23964
|
+
const OrderCell = ({ value, columnLayout, orderCellProps, isPrevious, isTotalRow, isMockData, }) => {
|
|
25267
23965
|
const { value: itemHovering, setTrue, setFalse } = useToggle(false);
|
|
25268
23966
|
const { value: active, toggle: toggleActive } = useToggle(false);
|
|
25269
23967
|
const { orderList, onClickOrderCell, isFetching } = orderCellProps ?? {};
|
|
25270
23968
|
if (typeof value !== 'string')
|
|
25271
23969
|
return null;
|
|
25272
|
-
if (isTotalRow || value === '0') {
|
|
23970
|
+
if (isMockData || isTotalRow || value === '0') {
|
|
25273
23971
|
return (jsx(OrderCellBase, { value: value, justifyContent: columnLayout?.align, isPrevious: isPrevious, isTotalRow: !!isTotalRow }));
|
|
25274
23972
|
}
|
|
25275
23973
|
const openOrderModal = () => {
|
|
@@ -25290,8 +23988,8 @@ const OrderCell = ({ value, columnLayout, orderCellProps, isPrevious, isTotalRow
|
|
|
25290
23988
|
}, isPrevious: isPrevious }), onClose: toggleActive, children: jsx(Box, { width: "291px", children: getContent() }) }));
|
|
25291
23989
|
};
|
|
25292
23990
|
|
|
25293
|
-
const OrderCellContainer = ({ value, columnLayout, orderCellProps, previousValue, isTotalRow, }) => {
|
|
25294
|
-
return (jsxs(BlockStack, { align: "center", children: [jsx(Box, { width: "100%", children: jsx(OrderCell, { value: value, columnLayout: columnLayout, orderCellProps: orderCellProps, isTotalRow: isTotalRow }) }), typeof previousValue === 'string' && (jsx(Box, { width: "100%", children: jsx(OrderCell, { value: previousValue, columnLayout: columnLayout, orderCellProps: orderCellProps, isPrevious: true, isTotalRow: isTotalRow }) }))] }));
|
|
23991
|
+
const OrderCellContainer = ({ value, columnLayout, orderCellProps, previousValue, isTotalRow, isMockData, }) => {
|
|
23992
|
+
return (jsxs(BlockStack, { align: "center", children: [jsx(Box, { width: "100%", children: jsx(OrderCell, { value: value, columnLayout: columnLayout, orderCellProps: orderCellProps, isTotalRow: isTotalRow, isMockData: isMockData }) }), typeof previousValue === 'string' && (jsx(Box, { width: "100%", children: jsx(OrderCell, { value: previousValue, columnLayout: columnLayout, orderCellProps: orderCellProps, isPrevious: true, isTotalRow: isTotalRow, isMockData: isMockData }) }))] }));
|
|
25295
23993
|
};
|
|
25296
23994
|
|
|
25297
23995
|
var GVariantBadgeType;
|
|
@@ -25407,11 +24105,14 @@ const VersionCell = ({ value, previousValue, isMergedWithPrev, columnLayout }) =
|
|
|
25407
24105
|
return (jsx(WrapperCell, { previousValue: previousValue, isMergedWithPrev: isMergedWithPrev, columnLayout: columnLayout, children: variantValue && (jsx(GVariantBadge, { variant: variantValue.value, tone: variantValue.value === 'A' ? 'active' : 'inactive', size: "xs" })) }));
|
|
25408
24106
|
};
|
|
25409
24107
|
|
|
25410
|
-
const OrderIdCell = ({ value }) => {
|
|
24108
|
+
const OrderIdCell = ({ value, isMockData }) => {
|
|
25411
24109
|
const { t } = useTranslation();
|
|
25412
24110
|
const [active, setActive] = useState(false);
|
|
25413
24111
|
const { onViewOrderJourney, onViewOrderDetails } = useReportTableActionsContext();
|
|
25414
24112
|
const toggleActive = useCallback(() => setActive((active) => !active), []);
|
|
24113
|
+
if (isMockData) {
|
|
24114
|
+
return (jsx(Text, { as: "span", variant: "bodyMd", tone: "subdued", children: value }));
|
|
24115
|
+
}
|
|
25415
24116
|
return (jsx(Popover, { active: active, activator: jsx("div", { className: "GReportTable__CellContent--clickable flex h-full w-full cursor-pointer items-center rounded-md pl-3", onClick: toggleActive, children: jsxs(InlineStack, { gap: "200", blockAlign: "center", wrap: false, children: [jsx(Text, { as: "span", variant: "bodyMd", tone: "subdued", children: value }), jsx("span", { className: "opacity-0 group-hover/GReportTable__Row:opacity-100", children: jsx(Icon, { source: SvgCaretDownIcon }) })] }) }), onClose: toggleActive, children: jsx(ActionList, { actionRole: "menuitem", items: [
|
|
25416
24117
|
{
|
|
25417
24118
|
id: 'view_order_journey',
|
|
@@ -25430,7 +24131,7 @@ const OrderIdCell = ({ value }) => {
|
|
|
25430
24131
|
|
|
25431
24132
|
const DateCell = ({ value, isMergedWithPrev }) => (jsx(Text, { as: "span", variant: "bodySm", children: isMergedWithPrev ? '' : value }));
|
|
25432
24133
|
|
|
25433
|
-
const CheckoutStartedDetail = ({ lineItems = [], activatorWrapperProps }) => {
|
|
24134
|
+
const CheckoutStartedDetail$1 = ({ lineItems = [], activatorWrapperProps }) => {
|
|
25434
24135
|
const { t } = useTranslation();
|
|
25435
24136
|
const [active, setActive] = useState(false);
|
|
25436
24137
|
const toggleActive = useCallback(() => setActive((active) => !active), []);
|
|
@@ -25454,16 +24155,16 @@ const ItemsCell = ({ value }) => {
|
|
|
25454
24155
|
const lineItems = value.map((item) => ({
|
|
25455
24156
|
imageURL: item.image_url,
|
|
25456
24157
|
productTitle: item.product_title,
|
|
25457
|
-
quantity: Number(item.quantity),
|
|
24158
|
+
quantity: Number(item.quantity) || 0,
|
|
25458
24159
|
title: item.title,
|
|
25459
24160
|
}));
|
|
25460
24161
|
const getItemText = () => {
|
|
25461
|
-
const itemQuantity = value.reduce((acc, item) => acc + Number(item.quantity), 0);
|
|
24162
|
+
const itemQuantity = value.reduce((acc, item) => acc + (Number(item.quantity) || 0), 0);
|
|
25462
24163
|
if (itemQuantity === 1)
|
|
25463
24164
|
return t('{{itemQuantity}} item', { itemQuantity });
|
|
25464
24165
|
return t('{{itemQuantity}} items', { itemQuantity });
|
|
25465
24166
|
};
|
|
25466
|
-
return (jsx("div", { onMouseEnter: setTrue, onMouseLeave: setFalse, children: jsxs(InlineStack, { gap: "200", blockAlign: "center", children: [jsx(Text, { as: "span", variant: "bodyMd", tone: "subdued", children: getItemText() }), jsx(CheckoutStartedDetail, { lineItems: lineItems, activatorWrapperProps: {
|
|
24167
|
+
return (jsx("div", { onMouseEnter: setTrue, onMouseLeave: setFalse, children: jsxs(InlineStack, { gap: "200", blockAlign: "center", children: [jsx(Text, { as: "span", variant: "bodyMd", tone: "subdued", children: getItemText() }), jsx(CheckoutStartedDetail$1, { lineItems: lineItems, activatorWrapperProps: {
|
|
25467
24168
|
paddingBlockStart: '100',
|
|
25468
24169
|
opacity: itemHovering ? '1' : '0',
|
|
25469
24170
|
} })] }) }));
|
|
@@ -25483,10 +24184,10 @@ const cellMap = {
|
|
|
25483
24184
|
return null;
|
|
25484
24185
|
return jsx(VersionCell, { value: value, isMergedWithPrev: isMergedWithPrev });
|
|
25485
24186
|
},
|
|
25486
|
-
[IRMetricKey.ORDERS]: ({ value, columnLayout, orderCellProps, previousValue, isTotalRow }) => {
|
|
24187
|
+
[IRMetricKey.ORDERS]: ({ value, columnLayout, orderCellProps, previousValue, isTotalRow, isMockData }) => {
|
|
25487
24188
|
if (!isString(value))
|
|
25488
24189
|
return null;
|
|
25489
|
-
return (jsx(OrderCellContainer, { value: value, columnLayout: columnLayout, orderCellProps: orderCellProps, previousValue: previousValue, isTotalRow: isTotalRow }));
|
|
24190
|
+
return (jsx(OrderCellContainer, { value: value, columnLayout: columnLayout, orderCellProps: orderCellProps, previousValue: previousValue, isTotalRow: isTotalRow, isMockData: isMockData }));
|
|
25490
24191
|
},
|
|
25491
24192
|
[EReportColumnKey.ORDER_DATE]: ({ value, isMergedWithPrev }) => {
|
|
25492
24193
|
if (!isString(value))
|
|
@@ -25503,10 +24204,10 @@ const cellMap = {
|
|
|
25503
24204
|
return null;
|
|
25504
24205
|
return jsx(CampaignsCell, { value: value, campaignsCellProps: campaignsCellProps });
|
|
25505
24206
|
},
|
|
25506
|
-
[EReportColumnKey.ORDER_ID]: ({ value }) => {
|
|
24207
|
+
[EReportColumnKey.ORDER_ID]: ({ value, isMockData }) => {
|
|
25507
24208
|
if (!isString(value))
|
|
25508
24209
|
return null;
|
|
25509
|
-
return jsx(OrderIdCell, { value: value });
|
|
24210
|
+
return jsx(OrderIdCell, { value: value, isMockData: isMockData });
|
|
25510
24211
|
},
|
|
25511
24212
|
};
|
|
25512
24213
|
|
|
@@ -25516,7 +24217,7 @@ const NoneCell = ({ isMergedWithPrev, previousValue, columnLayout }) => {
|
|
|
25516
24217
|
return (jsx(WrapperCell, { previousValue: previousValue, isMergedWithPrev: isMergedWithPrev, columnLayout: columnLayout, children: jsx("div", { className: "w-[11px] h-[2px] bg-[#8A8A8A]" }) }));
|
|
25517
24218
|
};
|
|
25518
24219
|
|
|
25519
|
-
const Cell = ({ value, isMergedWithPrev, columnLayout, name, isDimensionCol, formatter, hasTooltipCard, previousValue, orderCellProps, campaignsCellProps, isTotalRow, }) => {
|
|
24220
|
+
const Cell = ({ value, isMergedWithPrev, columnLayout, name, isDimensionCol, formatter, hasTooltipCard, previousValue, orderCellProps, campaignsCellProps, isTotalRow, isMockData, }) => {
|
|
25520
24221
|
const columnLayoutStyles = getColumnLayoutStyles(columnLayout, hasTooltipCard);
|
|
25521
24222
|
const { formatData } = useReportData();
|
|
25522
24223
|
const formattedValue = formatData({ value, formatter, name });
|
|
@@ -25533,12 +24234,12 @@ const Cell = ({ value, isMergedWithPrev, columnLayout, name, isDimensionCol, for
|
|
|
25533
24234
|
if (formattedValue === NONE_VALUE) {
|
|
25534
24235
|
Renderer = NoneCell;
|
|
25535
24236
|
}
|
|
25536
|
-
return (jsx(Renderer, { value: formattedValue, name: name, isMergedWithPrev: isMergedWithPrev, previousValue: formattedPreviousValue, columnLayout: columnLayout, orderCellProps: orderCellProps, campaignsCellProps: campaignsCellProps, isTotalRow: isTotalRow, isDimensionCol: isDimensionCol }));
|
|
24237
|
+
return (jsx(Renderer, { value: formattedValue, name: name, isMergedWithPrev: isMergedWithPrev, previousValue: formattedPreviousValue, columnLayout: columnLayout, orderCellProps: orderCellProps, campaignsCellProps: campaignsCellProps, isTotalRow: isTotalRow, isDimensionCol: isDimensionCol, isMockData: isMockData }));
|
|
25537
24238
|
};
|
|
25538
24239
|
return (jsx("div", { className: cls('GReportTable__Cell', { 'GReportTable__Cell--dimension': isDimensionCol }), style: cellStyles, children: jsx("div", { className: "GReportTable__CellContent", style: columnLayoutStyles, children: renderContent() }) }));
|
|
25539
24240
|
};
|
|
25540
24241
|
|
|
25541
|
-
const Row = ({ row, rowIndex, columns, dimensions, prevRow, columnLayoutMap, orderCellProps, isHideCampaignContent, minWidth, }) => {
|
|
24242
|
+
const Row = ({ row, rowIndex, columns, dimensions, prevRow, columnLayoutMap, orderCellProps, isHideCampaignContent, minWidth, isMockData, }) => {
|
|
25542
24243
|
const checkMergedWithPrev = (col) => {
|
|
25543
24244
|
const isDimensionCol = dimensions.includes(col);
|
|
25544
24245
|
let isMergedWithPrev = false;
|
|
@@ -25558,7 +24259,7 @@ const Row = ({ row, rowIndex, columns, dimensions, prevRow, columnLayoutMap, ord
|
|
|
25558
24259
|
return (jsx("div", { className: "GReportTable__Row group/GReportTable__Row", style: { minWidth }, children: columns.map((col) => {
|
|
25559
24260
|
const hasTooltipCard = !!col.tooltipCardProps;
|
|
25560
24261
|
const orderId = row[EReportColumnKey.ORDER_ID]?.toString() ?? '';
|
|
25561
|
-
return (jsx(Cell, { value: row[col.name], isTotalRow: row[IS_TOTAL_ROW_FIELD], previousValue: getMetricPreviousValue(row, col.name), isMergedWithPrev: checkMergedWithPrev(col.name), columnLayout: columnLayoutMap[col.name], name: col.name, campaignsCellProps: { orderId, isHideCampaignContent }, isDimensionCol: dimensions.includes(col.name), formatter: col.dataType, hasTooltipCard: hasTooltipCard, orderCellProps: customOrderCellProps }, col.name));
|
|
24262
|
+
return (jsx(Cell, { value: row[col.name], isTotalRow: row[IS_TOTAL_ROW_FIELD], previousValue: getMetricPreviousValue(row, col.name), isMergedWithPrev: checkMergedWithPrev(col.name), columnLayout: columnLayoutMap[col.name], name: col.name, campaignsCellProps: { orderId, isHideCampaignContent }, isDimensionCol: dimensions.includes(col.name), formatter: col.dataType, hasTooltipCard: hasTooltipCard, orderCellProps: customOrderCellProps, isMockData: isMockData }, col.name));
|
|
25562
24263
|
}) }));
|
|
25563
24264
|
};
|
|
25564
24265
|
|
|
@@ -25581,10 +24282,8 @@ const SummaryRow = ({ columns, row, dimensions, summary, columnLayoutMap }) => {
|
|
|
25581
24282
|
return '';
|
|
25582
24283
|
const cellValue = row?.[getTotalColumnName(columnName)];
|
|
25583
24284
|
const previousValue = row?.[getPreviousTotalColumnName(columnName)];
|
|
25584
|
-
const formattedValue = cellValue ? formatData({ value: cellValue, formatter, name: columnName })
|
|
25585
|
-
const formattedPreviousValue = previousValue
|
|
25586
|
-
? formatData({ value: previousValue, formatter, name: columnName })
|
|
25587
|
-
: previousValue;
|
|
24285
|
+
const formattedValue = cellValue == null ? cellValue : formatData({ value: cellValue, formatter, name: columnName });
|
|
24286
|
+
const formattedPreviousValue = previousValue == null ? previousValue : formatData({ value: previousValue, formatter, name: columnName });
|
|
25588
24287
|
if (typeof formattedValue === 'object')
|
|
25589
24288
|
return '';
|
|
25590
24289
|
return (jsx(SummaryCell, { currentValue: formattedValue, showPrevious: showPrevious, previousValue: formattedPreviousValue, columnLayout: layout }));
|
|
@@ -25657,7 +24356,7 @@ WrapperHeader.displayName = 'WrapperHeader';
|
|
|
25657
24356
|
|
|
25658
24357
|
const mockDimensions = ['session_device_type', 'month', 'session_country', 'session_device_os'];
|
|
25659
24358
|
const mockMetrics = ['online_store_visitors', 'sessions', 'bounces'];
|
|
25660
|
-
const ReportTable = ({ dimensions = mockDimensions, metrics = mockMetrics, data, activeColumn, orderBy, options, paginationProps, itemCount, dimensionLayout, metricLayouts, orderCellProps, isHideCampaignContent = false, showViewAllButton, emptyStateComponent, isLoading, onChangeOrderBy, onViewAllStoreOrders, onViewOrderJourney, onViewOrderDetails, skeletons, }) => {
|
|
24359
|
+
const ReportTable = ({ dimensions = mockDimensions, metrics = mockMetrics, data, activeColumn, orderBy, options, paginationProps, itemCount, dimensionLayout, metricLayouts, orderCellProps, isHideCampaignContent = false, showViewAllButton, emptyStateComponent, isLoading, isMockData, onChangeOrderBy, onViewAllStoreOrders, onViewOrderJourney, onViewOrderDetails, skeletons, }) => {
|
|
25661
24360
|
const { summary = {}, hideBorderTop, hidePaginationRow } = options ?? {};
|
|
25662
24361
|
const { columns, rows } = useReportTable({ dimensions, metrics, tableData: data ?? { columns: [], rows: [] } });
|
|
25663
24362
|
const { headerRef, bodyRef, scrollbarContainerRef, leftShadowRef, rightShadowRef } = useSyncedScroll({ columns });
|
|
@@ -25688,15 +24387,15 @@ const ReportTable = ({ dimensions = mockDimensions, metrics = mockMetrics, data,
|
|
|
25688
24387
|
return (jsx(ReportTableActionsProvider, { onViewOrderJourney: onViewOrderJourney, onViewOrderDetails: onViewOrderDetails, onViewAllStoreOrders: onViewAllStoreOrders, children: jsxs("div", { className: cls('GReportTable__Container', {
|
|
25689
24388
|
'GReportTable__Container--border-top': !hideBorderTop,
|
|
25690
24389
|
'GReportTable__Container--pagination-hidden': isPaginationHidden,
|
|
25691
|
-
}), children: [jsxs("div", { className: "GReportTable__Wrapper", children: [jsx(WrapperHeader, { columns: columns, dimensions: dimensions, row: data?.rows[0], ref: headerRef, columnLayoutMap: columnLayoutMap, activeColumn: activeColumn, orderBy: orderBy, summary: summary, onChangeOrderBy: onChangeOrderBy, minWidth: totalTableWidth }), jsx("div", { className: "GReportTable__ScrollWrap", ref: bodyRef, children: rows.map((row, index) => (jsx(Row, { row: row, rowIndex: index, columns: columns, dimensions: dimensions, prevRow: rows[index - 1], columnLayoutMap: columnLayoutMap, orderCellProps: orderCellProps, isHideCampaignContent: isHideCampaignContent, minWidth: totalTableWidth }, index))) })] }), jsx(WrapperFooter, { scrollbarContainerRef: scrollbarContainerRef, totalPaginationRows: totalPaginationRows, itemCount: itemCount, showViewAllButton: showViewAllButton, paginationProps: paginationProps, isPaginationHidden: isPaginationHidden }), jsx("div", { className: "GReportTable__LeftShadow", style: { left: tableDimensionLayout.width }, ref: leftShadowRef }), jsx("div", { className: "GReportTable__RightShadow", ref: rightShadowRef })] }) }));
|
|
24390
|
+
}), children: [jsxs("div", { className: "GReportTable__Wrapper", children: [jsx(WrapperHeader, { columns: columns, dimensions: dimensions, row: data?.rows[0], ref: headerRef, columnLayoutMap: columnLayoutMap, activeColumn: activeColumn, orderBy: orderBy, summary: summary, onChangeOrderBy: onChangeOrderBy, minWidth: totalTableWidth }), jsx("div", { className: "GReportTable__ScrollWrap", ref: bodyRef, children: rows.map((row, index) => (jsx(Row, { row: row, rowIndex: index, columns: columns, dimensions: dimensions, prevRow: rows[index - 1], columnLayoutMap: columnLayoutMap, orderCellProps: orderCellProps, isHideCampaignContent: isHideCampaignContent, minWidth: totalTableWidth, isMockData: isMockData }, index))) })] }), jsx(WrapperFooter, { scrollbarContainerRef: scrollbarContainerRef, totalPaginationRows: totalPaginationRows, itemCount: itemCount, showViewAllButton: showViewAllButton, paginationProps: paginationProps, isPaginationHidden: isPaginationHidden, isMockData: isMockData }), jsx("div", { className: "GReportTable__LeftShadow", style: { left: tableDimensionLayout.width }, ref: leftShadowRef }), jsx("div", { className: "GReportTable__RightShadow", ref: rightShadowRef })] }) }));
|
|
25692
24391
|
function renderEmptyState() {
|
|
25693
24392
|
return (jsxs("div", { className: cls('GReportTable__Container', {
|
|
25694
24393
|
'GReportTable__Container--border-top': !hideBorderTop,
|
|
25695
|
-
}), children: [emptyStateComponent, jsx(WrapperFooter, { totalPaginationRows: 0, itemCount: itemCount, showViewAllButton: showViewAllButton, paginationProps: paginationProps, isPaginationHidden: true })] }));
|
|
24394
|
+
}), children: [emptyStateComponent, jsx(WrapperFooter, { totalPaginationRows: 0, itemCount: itemCount, showViewAllButton: showViewAllButton, paginationProps: paginationProps, isPaginationHidden: true, isMockData: isMockData })] }));
|
|
25696
24395
|
}
|
|
25697
24396
|
};
|
|
25698
24397
|
|
|
25699
|
-
const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, paginationProps, tableOptions, onViewAllStoreOrders, onViewOrderJourney, onViewOrderDetails, }) => {
|
|
24398
|
+
const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, paginationProps, tableOptions, isMockData, onViewAllStoreOrders, onViewOrderJourney, onViewOrderDetails, }) => {
|
|
25700
24399
|
const { hideSummary, limitRowAmount, hidePaginationRow, hideBorderTop, fixedColumns, isLatestTable } = tableOptions ?? {};
|
|
25701
24400
|
const { t } = useTranslation();
|
|
25702
24401
|
const orderBy = useOrderControlStore((state) => state.orderBy);
|
|
@@ -25722,7 +24421,7 @@ const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, pa
|
|
|
25722
24421
|
};
|
|
25723
24422
|
if (isLatestTable && isLoading)
|
|
25724
24423
|
return jsx(OrderListingTableSkeleton, {});
|
|
25725
|
-
return (jsx(Fragment, { children: jsx(ReportTable, { metrics: sortedMetrics, dimensions: ORDER_LISTING_DIMENSIONS, options: getOptionsProps(), paginationProps: paginationProps, data: reportTableData, itemCount: totalStoreOrders, dimensionLayout: ORDER_LISTING_DIMENSION_LAYOUT, metricLayouts: ORDER_LISTING_METRIC_LAYOUTS, orderBy: orderBy ? { [orderBy.field]: orderBy } : undefined, showViewAllButton: showViewAllButton, isHideCampaignContent: !!isLatestTable, emptyStateComponent: renderEmptyState(), onChangeOrderBy: handleChangeOrderBy, onViewAllStoreOrders: onViewAllStoreOrders, onViewOrderJourney: onViewOrderJourney, onViewOrderDetails: onViewOrderDetails }) }));
|
|
24424
|
+
return (jsx(Fragment, { children: jsx(ReportTable, { metrics: sortedMetrics, dimensions: ORDER_LISTING_DIMENSIONS, options: getOptionsProps(), paginationProps: paginationProps, data: reportTableData, itemCount: totalStoreOrders, dimensionLayout: ORDER_LISTING_DIMENSION_LAYOUT, metricLayouts: ORDER_LISTING_METRIC_LAYOUTS, orderBy: orderBy ? { [orderBy.field]: orderBy } : undefined, showViewAllButton: showViewAllButton, isHideCampaignContent: !!isLatestTable, isMockData: isMockData, emptyStateComponent: renderEmptyState(), onChangeOrderBy: handleChangeOrderBy, onViewAllStoreOrders: onViewAllStoreOrders, onViewOrderJourney: onViewOrderJourney, onViewOrderDetails: onViewOrderDetails }) }));
|
|
25726
24425
|
function renderEmptyState() {
|
|
25727
24426
|
const isNoOrderWithCurrentFilters = orders.length === 0;
|
|
25728
24427
|
return (jsx(GBlockCenter, { paddingBlockStart: isNoOrderWithCurrentFilters ? '500' : '0', paddingBlockEnd: isNoOrderWithCurrentFilters ? '800' : '0', children: jsx(GBlockCenter, { paddingBlock: "1600", children: jsx(OrderListingTableEmpty, { title: isNoOrderWithCurrentFilters ? t('No order') : t('No order found'), description: isNoOrderWithCurrentFilters ? t('Try changing the filters') : t('Try changing the filters or search term') }) }) }));
|
|
@@ -25740,7 +24439,13 @@ const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, pa
|
|
|
25740
24439
|
};
|
|
25741
24440
|
var OrderListingTable$1 = memo(OrderListingTable);
|
|
25742
24441
|
|
|
25743
|
-
|
|
24442
|
+
var EReportSource;
|
|
24443
|
+
(function (EReportSource) {
|
|
24444
|
+
EReportSource["CAMPAIGN"] = "campaign";
|
|
24445
|
+
EReportSource["PAGE"] = "page";
|
|
24446
|
+
})(EReportSource || (EReportSource = {}));
|
|
24447
|
+
|
|
24448
|
+
const OrderListingLatestTable = ({ source, data, callbacks, isMockData }) => {
|
|
25744
24449
|
const { orders, isLoading, totalFilteredOrders, totalStoreOrders } = data;
|
|
25745
24450
|
const { onViewAllOrders, onViewAllStoreOrders, onViewOrderJourney, onViewOrderDetails } = callbacks ?? {};
|
|
25746
24451
|
const { t } = useTranslation();
|
|
@@ -25752,10 +24457,10 @@ const OrderListingLatestTable = ({ source, data, callbacks }) => {
|
|
|
25752
24457
|
return ORDER_LISTING_LATEST_COLUMNS_FOR_PAGE;
|
|
25753
24458
|
return ORDER_LISTING_COLUMNS;
|
|
25754
24459
|
}, [source]);
|
|
25755
|
-
return (jsxs(GBoxCard, { padding: "0", overflowX: "hidden", children: [jsx(Box, { padding: "400", borderStartStartRadius: "400", borderStartEndRadius: "400", background: "bg-fill", children: jsxs(InlineStack, { blockAlign: "center", align: "space-between", children: [jsx(GTextTooltip, { tooltipProps: tooltipContent ? { content: tooltipContent } : undefined, as: "p", variant: "headingMd", fontWeight: "semibold", children: t('Orders from {{source}}', { source: sourceText }) }), !isEmpty && (jsx(Button, { variant: "secondary", onClick: onViewAllOrders, children: t('View {{source}} orders ({{totalOrders}})', {
|
|
25756
|
-
|
|
25757
|
-
|
|
25758
|
-
|
|
24460
|
+
return (jsxs(GBoxCard, { padding: "0", overflowX: "hidden", children: [jsx(Box, { padding: "400", borderStartStartRadius: "400", borderStartEndRadius: "400", background: "bg-fill", children: jsxs(InlineStack, { blockAlign: "center", align: "space-between", children: [jsx(GTextTooltip, { tooltipProps: tooltipContent ? { content: tooltipContent } : undefined, as: "p", variant: "headingMd", fontWeight: "semibold", children: t('Orders from {{source}}', { source: sourceText }) }), !isEmpty && (jsx(GMockDataTooltip, { isMockData: isMockData, children: jsx(Button, { variant: "secondary", disabled: isMockData, onClick: onViewAllOrders, children: t('View {{source}} orders ({{totalOrders}})', {
|
|
24461
|
+
source: sourceText,
|
|
24462
|
+
totalOrders: totalFilteredOrders,
|
|
24463
|
+
}) }) }))] }) }), isEmpty ? (jsx(OrderListingTableEmpty, { title: t('No order yet'), description: t('There are no orders from this {{source}} yet', { source }) })) : (jsx(OrderListingTable$1, { orders: orders, isLoading: isLoading, totalStoreOrders: totalStoreOrders, isMockData: isMockData, onViewAllStoreOrders: onViewAllStoreOrders, onViewOrderJourney: onViewOrderJourney, onViewOrderDetails: onViewOrderDetails, tableOptions: {
|
|
25759
24464
|
hideSummary: true,
|
|
25760
24465
|
hidePaginationRow: true,
|
|
25761
24466
|
limitRowAmount: ORDER_LISTING_CONFIG.SHOW_LATEST_ORDER_LISTING_AMOUNT,
|
|
@@ -25792,6 +24497,440 @@ var EJourneyEvent;
|
|
|
25792
24497
|
EJourneyEvent["SEARCH_SUBMITTED"] = "SEARCH_SUBMITTED";
|
|
25793
24498
|
})(EJourneyEvent || (EJourneyEvent = {}));
|
|
25794
24499
|
|
|
24500
|
+
const useGModalOrderJourney = () => {
|
|
24501
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
24502
|
+
const [initialValues, setInitialValues] = useState(null);
|
|
24503
|
+
const handleOpenModalOrderJourney = useCallback((data) => {
|
|
24504
|
+
setInitialValues(data);
|
|
24505
|
+
setIsOpen(true);
|
|
24506
|
+
}, []);
|
|
24507
|
+
const handleCloseModalOrderJourney = useCallback(() => {
|
|
24508
|
+
setIsOpen(false);
|
|
24509
|
+
setInitialValues(null);
|
|
24510
|
+
}, []);
|
|
24511
|
+
return {
|
|
24512
|
+
isOpen,
|
|
24513
|
+
initialValues,
|
|
24514
|
+
handleOpenModalOrderJourney,
|
|
24515
|
+
handleCloseModalOrderJourney,
|
|
24516
|
+
};
|
|
24517
|
+
};
|
|
24518
|
+
|
|
24519
|
+
const OrderJourneyContext = createContext(undefined);
|
|
24520
|
+
const OrderJourneyProvider = OrderJourneyContext.Provider;
|
|
24521
|
+
const useOrderJourneyContext = () => {
|
|
24522
|
+
const context = useContext(OrderJourneyContext);
|
|
24523
|
+
if (!context)
|
|
24524
|
+
throw new Error('useOrderJourneyContext must be used within OrderJourneyProvider');
|
|
24525
|
+
return context;
|
|
24526
|
+
};
|
|
24527
|
+
|
|
24528
|
+
const EventMarkerIcon = ({ icon, tone = 'base', hasPadding = true }) => {
|
|
24529
|
+
const wrapperBackground = getWrapperBackground();
|
|
24530
|
+
const iconSource = isIconSource(icon) ? jsx(Icon, { source: icon, tone: tone }) : icon;
|
|
24531
|
+
return (jsx(Box, { padding: hasPadding ? '100' : '0', background: wrapperBackground, borderRadius: "full", children: iconSource }));
|
|
24532
|
+
function getWrapperBackground() {
|
|
24533
|
+
switch (tone) {
|
|
24534
|
+
case 'success':
|
|
24535
|
+
return 'bg-surface-success';
|
|
24536
|
+
default:
|
|
24537
|
+
return 'bg-surface-secondary';
|
|
24538
|
+
}
|
|
24539
|
+
}
|
|
24540
|
+
function isIconSource(x) {
|
|
24541
|
+
return typeof x === 'string' || (typeof x === 'object' && x.body) || typeof x === 'function';
|
|
24542
|
+
}
|
|
24543
|
+
};
|
|
24544
|
+
|
|
24545
|
+
const JourneyDetail = ({ title, children }) => {
|
|
24546
|
+
return (jsx(Box, { padding: "300", overflowX: "hidden", children: jsxs(BlockStack, { gap: "050", children: [typeof title === 'string' ? (jsx(Text, { as: "span", variant: "bodyMd", fontWeight: "medium", children: title })) : (title), children] }) }));
|
|
24547
|
+
};
|
|
24548
|
+
|
|
24549
|
+
var JourneyTimeFormat;
|
|
24550
|
+
(function (JourneyTimeFormat) {
|
|
24551
|
+
JourneyTimeFormat["HH_MM_SS"] = "HH:mm:ss";
|
|
24552
|
+
})(JourneyTimeFormat || (JourneyTimeFormat = {}));
|
|
24553
|
+
const JourneyTime = ({ time, format = JourneyTimeFormat.HH_MM_SS }) => {
|
|
24554
|
+
const formattedTime = formatDateBy(format, time);
|
|
24555
|
+
const width = getWidthByFormat();
|
|
24556
|
+
return (jsx("div", { style: { minWidth: width, maxWidth: width }, children: jsx(Text, { as: "span", variant: "bodyXs", children: formattedTime }) }));
|
|
24557
|
+
function getWidthByFormat() {
|
|
24558
|
+
switch (format) {
|
|
24559
|
+
case JourneyTimeFormat.HH_MM_SS:
|
|
24560
|
+
return '48px';
|
|
24561
|
+
default:
|
|
24562
|
+
return '48px';
|
|
24563
|
+
}
|
|
24564
|
+
}
|
|
24565
|
+
};
|
|
24566
|
+
|
|
24567
|
+
const JourneyItem = ({ time, title, eventMarker, children }) => {
|
|
24568
|
+
return (jsx(Box, { paddingInlineStart: "600", children: jsxs(InlineStack, { blockAlign: "center", gap: "400", wrap: false, children: [jsx(JourneyTime, { time: time }), jsx(EventMarkerIcon, { ...eventMarker }), jsx(JourneyDetail, { title: title, children: children })] }) }));
|
|
24569
|
+
};
|
|
24570
|
+
|
|
24571
|
+
const QuantityWrapper = ({ quantity }) => {
|
|
24572
|
+
if (!quantity)
|
|
24573
|
+
return null;
|
|
24574
|
+
return (jsx(Box, { paddingBlock: "050", paddingInline: "200", borderRadius: "200", background: "bg-fill-secondary", minWidth: "24px", children: jsx(Text, { as: "span", variant: "bodySm", fontWeight: "medium", tone: "subdued", alignment: "center", children: quantity }) }));
|
|
24575
|
+
};
|
|
24576
|
+
|
|
24577
|
+
const CheckoutStarted = ({ event }) => {
|
|
24578
|
+
const { t } = useTranslation();
|
|
24579
|
+
return (jsx(JourneyItem, { time: event.date, title: t('Started checkout'), eventMarker: { icon: SvgPaymentIcon }, children: jsx(CheckoutItems, { lineItems: event.lineItems ?? [] }) }));
|
|
24580
|
+
};
|
|
24581
|
+
|
|
24582
|
+
const CheckoutStartedDetail = ({ lineItems = [], activatorWrapperProps }) => {
|
|
24583
|
+
const { t } = useTranslation();
|
|
24584
|
+
const [active, setActive] = useState(false);
|
|
24585
|
+
const toggleActive = useCallback(() => setActive((active) => !active), []);
|
|
24586
|
+
if (!lineItems || lineItems.length === 0) {
|
|
24587
|
+
return null;
|
|
24588
|
+
}
|
|
24589
|
+
return (jsx(Popover, { active: active, activator: jsx(Box, { ...activatorWrapperProps, children: jsx(Button, { variant: "tertiary", icon: active ? SvgChevronUpIcon : SvgChevronDownIcon, onClick: toggleActive }) }), onClose: toggleActive, children: jsx(Box, { padding: "300", width: "340px", children: jsx(BlockStack, { gap: "300", children: lineItems.map((product, index, self) => {
|
|
24590
|
+
const isLast = index === self.length - 1;
|
|
24591
|
+
const boxProps = {
|
|
24592
|
+
borderBlockEndWidth: '025',
|
|
24593
|
+
borderColor: 'border-secondary',
|
|
24594
|
+
paddingBlockEnd: '300',
|
|
24595
|
+
};
|
|
24596
|
+
return (jsx(Box, { ...(!isLast && boxProps), children: jsxs(InlineStack, { gap: "300", wrap: false, children: [jsx("div", { className: "size-10", children: jsx(GThumbnail, { source: product.imageURL ?? '', alt: product.productTitle ?? '', size: "small" }) }), jsxs("div", { className: "flex flex-col gap-1 w-full", children: [jsxs(InlineStack, { gap: "200", align: "space-between", wrap: false, children: [jsx(Text, { as: "span", variant: "bodyMd", fontWeight: "medium", children: product.productTitle }), jsx("div", { className: "text-nowrap", children: jsx(Text, { as: "span", variant: "bodyMd", tone: "subdued", children: t('x {{quantity}}', { quantity: product.quantity }) }) })] }), product.title && (jsx("span", { children: jsx(Badge, { children: product.title }) }))] })] }) }, product.productID));
|
|
24597
|
+
}) }) }) }));
|
|
24598
|
+
};
|
|
24599
|
+
|
|
24600
|
+
const CheckoutItems = ({ lineItems }) => {
|
|
24601
|
+
const { t } = useTranslation();
|
|
24602
|
+
const cartQuantity = lineItems.reduce((acc, curr) => acc + (curr.quantity ?? 0), 0);
|
|
24603
|
+
return (jsxs(InlineStack, { gap: "100", children: [jsx(QuantityWrapper, { quantity: cartQuantity }), jsx(Text, { as: "span", variant: "bodyMd", tone: "subdued", children: cartQuantity > 1 ? t('items') : t('item') }), jsx(CheckoutStartedDetail, { lineItems: lineItems })] }));
|
|
24604
|
+
};
|
|
24605
|
+
|
|
24606
|
+
const CheckoutCompleted = ({ event }) => {
|
|
24607
|
+
const { t } = useTranslation();
|
|
24608
|
+
const { orderId } = useOrderJourneyContext();
|
|
24609
|
+
const isCheckoutCompletedEventOfCurrentOrder = event.orderID === orderId;
|
|
24610
|
+
const titleMarkup = renderTitleMarkup();
|
|
24611
|
+
return (jsx(JourneyItem, { time: event.date, title: titleMarkup, eventMarker: {
|
|
24612
|
+
icon: SvgCheckIcon,
|
|
24613
|
+
tone: isCheckoutCompletedEventOfCurrentOrder ? 'success' : 'base',
|
|
24614
|
+
}, children: jsx(CheckoutItems, { lineItems: event.lineItems ?? [] }) }));
|
|
24615
|
+
function renderTitleMarkup() {
|
|
24616
|
+
return (jsxs(InlineStack, { gap: "200", blockAlign: "center", wrap: false, children: [jsx(Text, { as: "span", variant: "bodyMd", fontWeight: "medium", children: t('Completed checkout') }), event.orderID && (jsxs(Fragment, { children: [jsx(GDotInline, { tone: "disabled" }), jsxs(InlineStack, { gap: "025", blockAlign: "center", wrap: false, children: [jsx(Icon, { source: SvgOrderIcon, tone: "base" }), jsx(Text, { as: "span", variant: "bodySm", tone: "subdued", children: event.orderID })] })] }))] }));
|
|
24617
|
+
}
|
|
24618
|
+
};
|
|
24619
|
+
|
|
24620
|
+
/**
|
|
24621
|
+
* Slices journey items based on the analytic metric mode.
|
|
24622
|
+
*
|
|
24623
|
+
* - FIRST_SESSION: Returns all items (no slicing)
|
|
24624
|
+
* - PAGE_ONLY: Slices from the LAST matching event (most recent relevant interaction)
|
|
24625
|
+
* - ALL_SESSION: Slices from the FIRST matching event (entire journey from first interaction)
|
|
24626
|
+
*/
|
|
24627
|
+
const sliceJourneyItems = ({ journeyItems, mode, source, filteredCampaignId, pageAnalytic, }) => {
|
|
24628
|
+
if (mode === EAnalyticMode.FIRST_SESSION)
|
|
24629
|
+
return journeyItems;
|
|
24630
|
+
const isCampaignVariant = ({ campaignGroupID = '', campaignID = '' }) => !isCampaignOfAnother({ campaignGroupID: campaignGroupID ?? '', campaignID: campaignID ?? '', filteredCampaignId });
|
|
24631
|
+
const isMatchingPage = ({ locationPath = '' }) => locationPath === pageAnalytic?.path;
|
|
24632
|
+
const sliceFromIndex = (index) => (index !== -1 ? journeyItems.slice(index) : journeyItems);
|
|
24633
|
+
const predicate = source === EReportSource.CAMPAIGN ? isCampaignVariant : isMatchingPage;
|
|
24634
|
+
// PAGE_ONLY: slice from LAST matching event (most recent relevant interaction)
|
|
24635
|
+
if (mode === EAnalyticMode.PAGE_ONLY) {
|
|
24636
|
+
return sliceFromIndex(findLastIndex(journeyItems, predicate));
|
|
24637
|
+
}
|
|
24638
|
+
// ALL_SESSION: slice from FIRST matching event (entire journey from first interaction)
|
|
24639
|
+
if (mode === EAnalyticMode.ALL_SESSION) {
|
|
24640
|
+
return sliceFromIndex(journeyItems.findIndex(predicate));
|
|
24641
|
+
}
|
|
24642
|
+
return journeyItems;
|
|
24643
|
+
};
|
|
24644
|
+
const getEventCampaignIdByType = ({ campaignGroupID, campaignID, }) => {
|
|
24645
|
+
return campaignGroupID !== '0' ? campaignGroupID : campaignID;
|
|
24646
|
+
};
|
|
24647
|
+
const isCampaignOfAnother = ({ campaignGroupID, campaignID, filteredCampaignId, }) => {
|
|
24648
|
+
const eventCampaignIdByType = getEventCampaignIdByType({ campaignGroupID, campaignID });
|
|
24649
|
+
const isEventOfAnotherCampaign = filteredCampaignId && eventCampaignIdByType !== filteredCampaignId;
|
|
24650
|
+
return isEventOfAnotherCampaign;
|
|
24651
|
+
};
|
|
24652
|
+
|
|
24653
|
+
const PageViewed = ({ event }) => {
|
|
24654
|
+
const { t } = useTranslation();
|
|
24655
|
+
const { date, locationPath, campaignGroupID = '', campaignID = '', filteredCampaignId, campaignName, campaignGroupName, campaignVariantType, } = event;
|
|
24656
|
+
const eventCampaignName = filteredCampaignId ? '' : campaignGroupName || campaignName;
|
|
24657
|
+
const isEventWithNoCampaign = !campaignVariantType;
|
|
24658
|
+
const eventCampaignIdByType = getEventCampaignIdByType({
|
|
24659
|
+
campaignGroupID: campaignGroupID ?? '',
|
|
24660
|
+
campaignID: campaignID ?? '',
|
|
24661
|
+
});
|
|
24662
|
+
const isEventOfAnotherCampaign = isCampaignOfAnother({
|
|
24663
|
+
campaignGroupID: campaignGroupID ?? '',
|
|
24664
|
+
campaignID: campaignID ?? '',
|
|
24665
|
+
filteredCampaignId,
|
|
24666
|
+
});
|
|
24667
|
+
const pageViewEventMarkerIcon = getPageViewEventMarkerIcon();
|
|
24668
|
+
const titleMarkup = renderTitleMarkup();
|
|
24669
|
+
const hasPadding = useMemo(() => {
|
|
24670
|
+
if (isEventWithNoCampaign)
|
|
24671
|
+
return true;
|
|
24672
|
+
if (!filteredCampaignId)
|
|
24673
|
+
return false;
|
|
24674
|
+
return eventCampaignIdByType !== filteredCampaignId;
|
|
24675
|
+
}, [filteredCampaignId, eventCampaignIdByType, isEventWithNoCampaign]);
|
|
24676
|
+
return (jsx(JourneyItem, { time: date, title: titleMarkup, eventMarker: { icon: pageViewEventMarkerIcon, hasPadding }, children: jsx(InlineStack, { gap: "200", wrap: false, blockAlign: "center", children: jsx("div", { className: "min-w-0 w-full", children: jsx(GTextTruncated, { as: "span", variant: "bodySm", tone: "subdued", children: locationPath ?? '' }) }) }) }));
|
|
24677
|
+
function getPageViewEventMarkerIcon() {
|
|
24678
|
+
if (isEventOfAnotherCampaign)
|
|
24679
|
+
return SvgCursorIcon;
|
|
24680
|
+
switch (campaignVariantType) {
|
|
24681
|
+
case IVariantType$1.VARIANT_A:
|
|
24682
|
+
return jsx(GVariantBadge, { variant: "A", size: "md", tone: "active" });
|
|
24683
|
+
case IVariantType$1.VARIANT_B:
|
|
24684
|
+
return jsx(GVariantBadge, { variant: "B", size: "md" });
|
|
24685
|
+
default:
|
|
24686
|
+
return SvgCursorIcon;
|
|
24687
|
+
}
|
|
24688
|
+
}
|
|
24689
|
+
function renderTitleMarkup() {
|
|
24690
|
+
return (jsxs(InlineStack, { gap: "200", blockAlign: "center", wrap: false, children: [jsx("span", { className: "text-nowrap", children: jsx(Text, { as: "span", variant: "bodyMd", fontWeight: "medium", breakWord: false, children: t('Visited page') }) }), eventCampaignName && !isEventOfAnotherCampaign && (jsxs(Fragment, { children: [jsx(GDotInline, { tone: "disabled" }), jsx("div", { className: "min-w-0 w-full", children: jsx(GI18NText, { as: "span", variant: "bodySm", tone: "subdued", truncate: true, transformers: {
|
|
24691
|
+
1: (name) => (jsx(Text, { as: "span", variant: "bodySm", tone: "subdued", fontWeight: "medium", children: name })),
|
|
24692
|
+
}, children: t('Experiment: [1]{{name}}[]', { name: eventCampaignName }) }) })] }))] }));
|
|
24693
|
+
}
|
|
24694
|
+
};
|
|
24695
|
+
|
|
24696
|
+
const ProductAddedToCart = ({ event }) => {
|
|
24697
|
+
const { t } = useTranslation();
|
|
24698
|
+
return (jsx(JourneyItem, { time: event.date, title: t('Added product to cart'), eventMarker: { icon: SvgCartIcon }, children: jsx(CheckoutItems, { lineItems: event.lineItems ?? [] }) }));
|
|
24699
|
+
};
|
|
24700
|
+
|
|
24701
|
+
const ProductRemovedFromCart = ({ event }) => {
|
|
24702
|
+
const { t } = useTranslation();
|
|
24703
|
+
return (jsx(JourneyItem, { time: event.date, title: t('Remove product from cart'), eventMarker: { icon: SvgProductRemoveIcon }, children: jsx(CheckoutItems, { lineItems: event.lineItems ?? [] }) }));
|
|
24704
|
+
};
|
|
24705
|
+
|
|
24706
|
+
const DefaultEventComponent = () => null;
|
|
24707
|
+
const JOURNEY_EVENT_COMPONENTS_MAP = {
|
|
24708
|
+
[EJourneyEvent.ADDED_TO_CART]: DefaultEventComponent,
|
|
24709
|
+
[EJourneyEvent.CHECKOUT_ADDRESS_INFO_SUBMITTED]: DefaultEventComponent,
|
|
24710
|
+
[EJourneyEvent.CHECKOUT_COMPLETED]: CheckoutCompleted,
|
|
24711
|
+
[EJourneyEvent.CHECKOUT_CONTACT_INFO_SUBMITTED]: DefaultEventComponent,
|
|
24712
|
+
[EJourneyEvent.CHECKOUT_SHIPPING_INFO_SUBMITTED]: DefaultEventComponent,
|
|
24713
|
+
[EJourneyEvent.CHECKOUT_STARTED]: CheckoutStarted,
|
|
24714
|
+
[EJourneyEvent.COLLECTION_VIEWED]: DefaultEventComponent,
|
|
24715
|
+
[EJourneyEvent.ORDER]: DefaultEventComponent,
|
|
24716
|
+
[EJourneyEvent.PAGE_VIEWED]: PageViewed,
|
|
24717
|
+
[EJourneyEvent.PAYMENT_INFO_SUBMITTED]: DefaultEventComponent,
|
|
24718
|
+
[EJourneyEvent.PRODUCT_ADDED_TO_CART]: ProductAddedToCart,
|
|
24719
|
+
[EJourneyEvent.PRODUCT_REMOVED_FROM_CART]: ProductRemovedFromCart,
|
|
24720
|
+
[EJourneyEvent.PRODUCT_VIEWED]: DefaultEventComponent,
|
|
24721
|
+
[EJourneyEvent.SEARCH_SUBMITTED]: DefaultEventComponent,
|
|
24722
|
+
};
|
|
24723
|
+
|
|
24724
|
+
const JourneyDateBadge = ({ content }) => {
|
|
24725
|
+
return (jsx(Box, { background: "bg-surface-secondary", paddingBlock: "100", paddingInline: "200", borderRadius: "200", minWidth: "110px", children: jsx(GBlockCenter, { children: jsx(Text, { as: "p", variant: "bodyMd", fontWeight: "medium", children: content }) }) }));
|
|
24726
|
+
};
|
|
24727
|
+
|
|
24728
|
+
const BOX_BACKGROUND = {
|
|
24729
|
+
default: 'bg-surface-secondary-active',
|
|
24730
|
+
onHover: 'bg-surface-secondary',
|
|
24731
|
+
};
|
|
24732
|
+
const JourneyLoadMore = ({ isFetching, onLoadMode }) => {
|
|
24733
|
+
const [boxBackground, setBoxBackground] = useState(BOX_BACKGROUND.default);
|
|
24734
|
+
const { t } = useTranslation();
|
|
24735
|
+
if (isFetching) {
|
|
24736
|
+
return (jsx(Box, { paddingBlock: "100", paddingInline: "300", background: BOX_BACKGROUND.onHover, borderRadius: "200", children: jsx(GSpinner, { size: "small" }) }));
|
|
24737
|
+
}
|
|
24738
|
+
return (jsx("div", { className: "cursor-pointer", onMouseEnter: () => setBoxBackground(BOX_BACKGROUND.onHover), onMouseLeave: () => setBoxBackground(BOX_BACKGROUND.default), onClick: onLoadMode, children: jsx(Box, { paddingBlock: "100", paddingInline: "200", background: boxBackground, borderRadius: "200", children: jsxs(InlineStack, { gap: "050", wrap: false, blockAlign: "center", children: [jsx(Icon, { source: SvgChevronUpIcon }), jsx(Text, { as: "p", variant: "bodySm", fontWeight: "medium", children: t('More steps') })] }) }) }));
|
|
24739
|
+
};
|
|
24740
|
+
|
|
24741
|
+
const JourneyIdBadge = ({ id, type = 'order' }) => {
|
|
24742
|
+
const { t } = useTranslation();
|
|
24743
|
+
const idContent = getIdContent();
|
|
24744
|
+
const { onViewOrderDetails } = useOrderJourneyContext();
|
|
24745
|
+
return (jsx(GTooltip, { content: t('View order details'), children: jsx("div", { className: "cursor-pointer", onClick: () => onViewOrderDetails?.(id), children: jsx(Box, { background: "bg-surface-secondary-active", paddingBlock: "100", paddingInline: "200", borderRadius: "200", children: jsxs(InlineStack, { gap: "100", blockAlign: "center", children: [jsx(GI18NText, { as: "p", variant: "bodyMd", fontWeight: "medium", tone: "subdued", transformers: {
|
|
24746
|
+
1: (text) => {
|
|
24747
|
+
return (jsx(Text, { as: "span", tone: "base", children: text }));
|
|
24748
|
+
},
|
|
24749
|
+
}, children: idContent }), jsx(Icon, { source: SvgExternalSmallIcon })] }) }) }) }));
|
|
24750
|
+
function getIdContent() {
|
|
24751
|
+
switch (type) {
|
|
24752
|
+
case 'order':
|
|
24753
|
+
return t('Order ID: [1]{{id}}[]', { id });
|
|
24754
|
+
default:
|
|
24755
|
+
return id;
|
|
24756
|
+
}
|
|
24757
|
+
}
|
|
24758
|
+
};
|
|
24759
|
+
|
|
24760
|
+
const JourneyTitle = ({ content, id, hasMoreSteps, isFetching = false, onLoadMode }) => {
|
|
24761
|
+
const isStickyHeader = !!id;
|
|
24762
|
+
const isShowLoadMore = isStickyHeader && hasMoreSteps && onLoadMode;
|
|
24763
|
+
return (jsxs(Box, { paddingBlock: "300", paddingInline: "400", position: "relative", children: [jsxs(InlineStack, { align: "space-between", gap: "100", children: [jsxs(InlineStack, { gap: "400", children: [jsx(JourneyDateBadge, { content: content }), id && jsx(JourneyIdBadge, { id: id })] }), isShowLoadMore && jsx(JourneyLoadMore, { isFetching: isFetching, onLoadMode: onLoadMode })] }), jsx(JourneyTitleLine, {})] }));
|
|
24764
|
+
};
|
|
24765
|
+
const JourneyTitleLine = () => {
|
|
24766
|
+
return jsx("div", { className: "absolute top-[50%] right-0 left-0 translate-y-[-50%] h-[1px] bg-border -z-[1]" });
|
|
24767
|
+
};
|
|
24768
|
+
|
|
24769
|
+
const JourneyGroup = ({ eventsByDate, sectionRefs }) => {
|
|
24770
|
+
return eventsByDate.map(({ dateKey, date, events }, index) => {
|
|
24771
|
+
const isLatestDate = index === 0;
|
|
24772
|
+
return (jsxs("div", { ref: (el) => {
|
|
24773
|
+
if (el)
|
|
24774
|
+
sectionRefs.current.set(dateKey, el);
|
|
24775
|
+
}, className: "relative", children: [!isLatestDate && jsx(JourneyTitle, { content: date }), events.map((event, eventIndex) => (jsx(JourneyEventRenderer, { event: event }, `${event.eventType}-${event.date}-${eventIndex}`))), jsx(JourneyTimeline, {})] }, dateKey));
|
|
24776
|
+
});
|
|
24777
|
+
};
|
|
24778
|
+
function JourneyEventRenderer({ event }) {
|
|
24779
|
+
const Component = JOURNEY_EVENT_COMPONENTS_MAP[event.eventType];
|
|
24780
|
+
if (!Component)
|
|
24781
|
+
return null;
|
|
24782
|
+
return jsx(Component, { event: event });
|
|
24783
|
+
}
|
|
24784
|
+
|
|
24785
|
+
const JourneyContainer = ({ orderId, eventsByDate, hasMoreSteps, isFetchingMoreSteps, onLoadMore, }) => {
|
|
24786
|
+
const firstEventsByDate = eventsByDate[0];
|
|
24787
|
+
const { isMobileView } = useWindowSize();
|
|
24788
|
+
const [currentDate, setCurrentDate] = useState(firstEventsByDate?.date || '');
|
|
24789
|
+
const [showShadow, setShowShadow] = useState(false);
|
|
24790
|
+
const scrollContainerRef = useRef(null);
|
|
24791
|
+
const sectionRefs = useRef(new Map());
|
|
24792
|
+
const scrollableRef = useRef(null);
|
|
24793
|
+
const prevIsFetchingRef = useRef(isFetchingMoreSteps);
|
|
24794
|
+
useEffect(() => {
|
|
24795
|
+
// Find the Polaris Scrollable container after mount
|
|
24796
|
+
if (!isBrowser$1() || !scrollContainerRef.current)
|
|
24797
|
+
return;
|
|
24798
|
+
let element = scrollContainerRef.current.parentElement;
|
|
24799
|
+
// Traverse up to find the scrollable container
|
|
24800
|
+
while (element) {
|
|
24801
|
+
const overflow = getComputedStyle(element).overflowY;
|
|
24802
|
+
if (overflow === 'auto' || overflow === 'scroll') {
|
|
24803
|
+
scrollableRef.current = element;
|
|
24804
|
+
break;
|
|
24805
|
+
}
|
|
24806
|
+
element = element.parentElement;
|
|
24807
|
+
}
|
|
24808
|
+
const scrollableElement = scrollableRef.current;
|
|
24809
|
+
if (!scrollableElement)
|
|
24810
|
+
return;
|
|
24811
|
+
const handleScroll = () => {
|
|
24812
|
+
const scrollTop = scrollableElement.scrollTop;
|
|
24813
|
+
setShowShadow(scrollTop > 10);
|
|
24814
|
+
// Find which date section is currently visible at the top
|
|
24815
|
+
let currentSection = firstEventsByDate;
|
|
24816
|
+
const headerOffset = 20; // Account for fixed header height
|
|
24817
|
+
const scrollableContainerRect = scrollableElement.getBoundingClientRect();
|
|
24818
|
+
for (const dateGroup of eventsByDate) {
|
|
24819
|
+
const element = sectionRefs.current.get(dateGroup.dateKey);
|
|
24820
|
+
if (!element)
|
|
24821
|
+
continue;
|
|
24822
|
+
const rect = element.getBoundingClientRect();
|
|
24823
|
+
// If section top is above or near the header position
|
|
24824
|
+
if (rect.top - scrollableContainerRect.top <= headerOffset) {
|
|
24825
|
+
currentSection = dateGroup;
|
|
24826
|
+
}
|
|
24827
|
+
}
|
|
24828
|
+
setCurrentDate(currentSection?.date || firstEventsByDate?.date || '');
|
|
24829
|
+
};
|
|
24830
|
+
scrollableElement.addEventListener('scroll', handleScroll);
|
|
24831
|
+
handleScroll(); // Initial call
|
|
24832
|
+
return () => scrollableElement.removeEventListener('scroll', handleScroll);
|
|
24833
|
+
}, [eventsByDate, firstEventsByDate]);
|
|
24834
|
+
const handleScrollToTop = () => {
|
|
24835
|
+
if (!scrollableRef.current)
|
|
24836
|
+
return;
|
|
24837
|
+
scrollableRef.current.scrollTo({ top: 0, behavior: 'smooth' });
|
|
24838
|
+
};
|
|
24839
|
+
// Auto-scroll to top when more steps are fetched
|
|
24840
|
+
useEffect(() => {
|
|
24841
|
+
const wasFetching = prevIsFetchingRef.current;
|
|
24842
|
+
const isNowDone = !isFetchingMoreSteps;
|
|
24843
|
+
// If we were fetching and now we're done, scroll to top
|
|
24844
|
+
if (wasFetching && isNowDone) {
|
|
24845
|
+
handleScrollToTop();
|
|
24846
|
+
}
|
|
24847
|
+
// Update ref for next render
|
|
24848
|
+
prevIsFetchingRef.current = isFetchingMoreSteps;
|
|
24849
|
+
}, [isFetchingMoreSteps]);
|
|
24850
|
+
return (jsxs(Scrollable, { scrollbarWidth: "thin", vertical: true, horizontal: true, className: "pb-5", style: { maxHeight: isMobileView ? '100vh' : 'calc(100vh - 120px)' }, children: [jsx(GBox, { ariaShadow: showShadow ? 'shadow-outset-200' : undefined, position: "sticky", insetBlockStart: "0", zIndex: "10", background: "bg-fill", children: jsx(JourneyTitle, { content: currentDate, id: orderId, hasMoreSteps: hasMoreSteps, isFetching: isFetchingMoreSteps, onLoadMode: () => {
|
|
24851
|
+
onLoadMore();
|
|
24852
|
+
handleScrollToTop();
|
|
24853
|
+
} }) }), jsx("div", { ref: scrollContainerRef, className: "min-h-[100vh] md:min-h-[calc(100vh-192px)]", children: jsx(JourneyGroup, { eventsByDate: eventsByDate, sectionRefs: sectionRefs }) })] }));
|
|
24854
|
+
};
|
|
24855
|
+
|
|
24856
|
+
const JourneyTimeline = () => {
|
|
24857
|
+
const journeyItemPaddingInlineStart = 24;
|
|
24858
|
+
const journeyItemTimeWidth = 48;
|
|
24859
|
+
const journeyItemInlineGap = 16;
|
|
24860
|
+
const eventMarkerIconSize = 28;
|
|
24861
|
+
const journeyTimeLineWidth = 2;
|
|
24862
|
+
const timelineLeft = journeyItemPaddingInlineStart +
|
|
24863
|
+
journeyItemTimeWidth +
|
|
24864
|
+
journeyItemInlineGap +
|
|
24865
|
+
eventMarkerIconSize / 2 -
|
|
24866
|
+
journeyTimeLineWidth / 2;
|
|
24867
|
+
return jsx("div", { className: cls('w-[2px] absolute top-5 bottom-7 bg-[#F3F3F3] -z-[1]'), style: { left: timelineLeft } });
|
|
24868
|
+
};
|
|
24869
|
+
|
|
24870
|
+
const OrderJourneySkeleton = () => {
|
|
24871
|
+
return (jsxs(Scrollable, { scrollbarWidth: "thin", vertical: true, horizontal: true, className: "max-h-[100vh] md:max-h-[calc(100vh-120px)] pb-5", children: [jsx(GBox, { position: "sticky", insetBlockStart: "0", zIndex: "10", background: "bg-fill", children: jsxs(Box, { paddingBlock: "300", paddingInline: "400", position: "relative", children: [jsx(InlineStack, { align: "space-between", gap: "100", children: jsxs(InlineStack, { gap: "400", children: [jsx("div", { className: "bg-surface-secondary rounded-md px-3 py-1.5", children: jsx("div", { className: "w-24", children: jsx(SkeletonBodyText, { lines: 1 }) }) }), jsx("div", { className: "bg-surface-secondary rounded-md px-3 py-1.5", children: jsx("div", { className: "w-40", children: jsx(SkeletonBodyText, { lines: 1 }) }) })] }) }), jsx("div", { className: "absolute top-[50%] right-0 left-0 translate-y-[-50%] h-[1px] bg-border -z-[1]" })] }) }), jsxs("div", { className: "min-h-[100vh] md:min-h-[calc(100vh-120px)] relative mt-4", children: [jsx("div", { className: "w-[2px] absolute top-4 bottom-4 bg-[#F3F3F3] -z-[1]", style: { left: 110 } }), Array.from({ length: 8 }).map((_, index) => (jsx(JourneyEventSkeleton, { isLast: index === 7 }, index)))] })] }));
|
|
24872
|
+
};
|
|
24873
|
+
const JourneyEventSkeleton = ({ isLast }) => {
|
|
24874
|
+
return (jsx(Box, { paddingInlineStart: "600", children: jsxs(InlineStack, { blockAlign: "start", gap: "400", wrap: false, children: [jsx("div", { className: "w-12 pt-1", children: jsx(SkeletonBodyText, { lines: 1 }) }), jsx("div", { className: "shrink-0 mt-0.5", children: jsx("div", { className: "w-7 h-7 bg-border-secondary rounded-full animate-pulse" }) }), jsxs(Box, { paddingBlockEnd: "400", width: "100%", children: [jsx("div", { className: "mb-2", children: jsx(SkeletonDisplayText, { size: "small" }) }), !isLast ? (jsx("div", { className: "max-w-[70%]", children: jsx(SkeletonBodyText, { lines: Math.random() > 0.5 ? 1 : 2 }) })) : (jsx("div", { className: "max-w-[40%]", children: jsx(SkeletonBodyText, { lines: 1 }) }))] })] }) }));
|
|
24875
|
+
};
|
|
24876
|
+
|
|
24877
|
+
const GModalOrderJourney = ({ open, onClose, title, orderId, journeyItems, isLoading = false, hasNextPage = false, isFetchingNextPage = false, fetchNextPage, reportCampaign, pageAnalytic, mode, journeySource, onViewOrderDetails, }) => {
|
|
24878
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
24879
|
+
usePreventBodyScroll({ enable: open });
|
|
24880
|
+
const source = useMemo(() => {
|
|
24881
|
+
if (journeySource)
|
|
24882
|
+
return journeySource;
|
|
24883
|
+
if (reportCampaign)
|
|
24884
|
+
return EReportSource.CAMPAIGN;
|
|
24885
|
+
if (pageAnalytic)
|
|
24886
|
+
return EReportSource.PAGE;
|
|
24887
|
+
}, [reportCampaign, pageAnalytic, journeySource]);
|
|
24888
|
+
const filteredCampaignId = reportCampaign?.id;
|
|
24889
|
+
const slicedJourneyItems = useMemo(() => {
|
|
24890
|
+
if (!source)
|
|
24891
|
+
return journeyItems;
|
|
24892
|
+
return sliceJourneyItems({
|
|
24893
|
+
journeyItems,
|
|
24894
|
+
mode,
|
|
24895
|
+
source,
|
|
24896
|
+
pageAnalytic,
|
|
24897
|
+
filteredCampaignId,
|
|
24898
|
+
});
|
|
24899
|
+
}, [journeyItems, mode, source, pageAnalytic, filteredCampaignId]);
|
|
24900
|
+
const isSliced = slicedJourneyItems.length < journeyItems.length;
|
|
24901
|
+
const displayedItems = isExpanded ? journeyItems : slicedJourneyItems;
|
|
24902
|
+
const hasMoreSteps = (!isExpanded && isSliced) || hasNextPage;
|
|
24903
|
+
const handleLoadMore = useCallback(() => {
|
|
24904
|
+
if (!isExpanded && isSliced) {
|
|
24905
|
+
setIsExpanded(true);
|
|
24906
|
+
}
|
|
24907
|
+
else if (hasNextPage) {
|
|
24908
|
+
fetchNextPage?.();
|
|
24909
|
+
}
|
|
24910
|
+
}, [isExpanded, isSliced, hasNextPage, fetchNextPage]);
|
|
24911
|
+
const eventsByDate = useMemo(() => {
|
|
24912
|
+
const grouped = new Map();
|
|
24913
|
+
displayedItems?.forEach((journeyItem) => {
|
|
24914
|
+
const dateKey = formatDateBy('MMMM D', journeyItem.date);
|
|
24915
|
+
if (!grouped.has(dateKey))
|
|
24916
|
+
grouped.set(dateKey, []);
|
|
24917
|
+
grouped.get(dateKey)?.push(journeyItem);
|
|
24918
|
+
});
|
|
24919
|
+
return Array.from(grouped.entries()).map(([date, events]) => ({
|
|
24920
|
+
date,
|
|
24921
|
+
dateKey: date,
|
|
24922
|
+
events: events.map((event) => ({ ...event, filteredCampaignId })),
|
|
24923
|
+
}));
|
|
24924
|
+
}, [displayedItems, filteredCampaignId]);
|
|
24925
|
+
useEffect(() => {
|
|
24926
|
+
if (!open)
|
|
24927
|
+
setIsExpanded(false);
|
|
24928
|
+
}, [open]);
|
|
24929
|
+
if (!orderId)
|
|
24930
|
+
return null;
|
|
24931
|
+
return (jsx(GModal, { open: open, title: title, onClose: onClose, children: jsx(OrderJourneyProvider, { value: { orderId, onViewOrderDetails }, children: isLoading ? (jsx(OrderJourneySkeleton, {})) : (jsx(JourneyContainer, { orderId: orderId, eventsByDate: eventsByDate, hasMoreSteps: hasMoreSteps, isFetchingMoreSteps: isFetchingNextPage, onLoadMore: handleLoadMore })) }) }));
|
|
24932
|
+
};
|
|
24933
|
+
|
|
25795
24934
|
function isBrowser() {
|
|
25796
24935
|
return typeof window !== 'undefined';
|
|
25797
24936
|
}
|
|
@@ -25835,4 +24974,4 @@ const useStickyFilterBoxProps = ({ id }) => {
|
|
|
25835
24974
|
};
|
|
25836
24975
|
};
|
|
25837
24976
|
|
|
25838
|
-
export { ANALYTICS_METRIC_TOOLTIP, AnalyticModeSelector, CAMPAIGN_BACKGROUND_MAIN, CHART_MIN_HEIGHT, COMPARE_DATE_TIME_FILTERS_MAP, CardJourneyAnalysis, CardPathAnalysis, CompareDateTimePickerAlias, ConvertMoneyProvider, CurrencySelector, DATE_TIME_COMPARISON_FILTERS, DEFAULT_CURRENCY_ANALYTIC, DEFAULT_CURRENT_PERIOD_LABEL, DEFAULT_PREVIOUS_PERIOD_LABEL, DEFAULT_SELECTED_COLUMNS_FOR_EXPERIMENT, DateTimeFilterInputs, DateTimeFilters, DateTimePickerContext, DateTimePickerProvider, EJourneyEvent, EReportSource, FUNNEL_POPOVER_KEY, GSelectableMetricChartCard, GTimePicker, IVariantType, MOCK_DATA_PATH_ANALYSIS, MainDateTimePickerAlias, MetricChartProvider, MetricDonutChartCard, ORDER_COLUMN_MAPPING, ORDER_LISTING_COLUMNS, ORDER_LISTING_CONFIG, ORDER_LISTING_DIMENSIONS, ORDER_LISTING_DIMENSION_LAYOUT, ORDER_LISTING_LATEST_COLUMNS_FOR_PAGE, ORDER_LISTING_METRICS, ORDER_LISTING_METRIC_LAYOUTS, OrderListingLatestTable, PLACEHOLDER_VALUE$1 as PLACEHOLDER_VALUE, PREVIOUS_PERIOD_FILTER, PathAnalysisConfigProvider, PathAnalysisContext, PathAnalysisProvider, SERIES_COLORS, SORT_ORDER_LISTING_DEFAULT, 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, useFunnelChartStore, useIsStickyById, useOrderColumnsSelectorStore, useOrderControlStore, usePathAnalysisCampaignStore, usePathAnalysisConfig, usePathAnalysisContext, usePathAnalysisStore, useStickyFilterBoxProps, useVersionDateTimeFilters };
|
|
24977
|
+
export { ANALYTICS_METRIC_TOOLTIP, AnalyticModeSelector, CAMPAIGN_BACKGROUND_MAIN, CHART_MIN_HEIGHT, COMPARE_DATE_TIME_FILTERS_MAP, CardJourneyAnalysis, CardPathAnalysis, CompareDateTimePickerAlias, ConvertMoneyProvider, CurrencySelector, DATE_TIME_COMPARISON_FILTERS, DEFAULT_CURRENCY_ANALYTIC, DEFAULT_CURRENT_PERIOD_LABEL, DEFAULT_PREVIOUS_PERIOD_LABEL, DEFAULT_SELECTED_COLUMNS_FOR_EXPERIMENT, DateTimeFilterInputs, DateTimeFilters, DateTimePickerContext, DateTimePickerProvider, EJourneyEvent, EReportSource, FUNNEL_POPOVER_KEY, GModalOrderJourney, GSelectableMetricChartCard, GTimePicker, IVariantType, MOCK_DATA_PATH_ANALYSIS, MainDateTimePickerAlias, MetricChartProvider, MetricDonutChartCard, ORDER_COLUMN_MAPPING, ORDER_LISTING_COLUMNS, ORDER_LISTING_CONFIG, ORDER_LISTING_DIMENSIONS, ORDER_LISTING_DIMENSION_LAYOUT, ORDER_LISTING_LATEST_COLUMNS_FOR_PAGE, ORDER_LISTING_METRICS, ORDER_LISTING_METRIC_LAYOUTS, OrderJourneyProvider, OrderListingLatestTable, PLACEHOLDER_VALUE$1 as PLACEHOLDER_VALUE, PREVIOUS_PERIOD_FILTER, PathAnalysisConfigProvider, PathAnalysisContext, PathAnalysisProvider, SERIES_COLORS, SORT_ORDER_LISTING_DEFAULT, SingleMetricChartCard, TARGET_CHANNEL, TARGET_DEVICES, TARGET_VISITOR, THUMB_PRODUCT_DEFAULT, TREND_TONE, TimezoneProvider, 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, useFunnelChartStore, useGModalOrderJourney, useIsStickyById, useOrderColumnsSelectorStore, useOrderControlStore, useOrderJourneyContext, usePathAnalysisCampaignStore, usePathAnalysisConfig, usePathAnalysisContext, usePathAnalysisStore, useStickyFilterBoxProps, useTimezoneContext, useVersionDateTimeFilters };
|