@gem-sdk/analytics 0.1.0-staging.2 → 0.1.0-staging.4
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/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/OrderAnalytic/types/order.d.ts +32 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/gemxql.js +11 -2
- package/dist/esm/gemxql.mjs +11 -2
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/usePreventBodyScroll.d.ts +3 -0
- package/dist/esm/index.js +607 -17
- package/dist/esm/index.mjs +607 -17
- 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/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 +3 -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/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/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/OrderAnalytic/types/order.d.ts +32 -0
- 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/usePreventBodyScroll.d.ts +3 -0
- 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/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 +3 -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/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 +1 -1
package/dist/esm/index.mjs
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';
|
|
@@ -213,6 +213,11 @@ var ICampaignType;
|
|
|
213
213
|
ICampaignType["TEMPLATE_BUNDLE"] = "TEMPLATE_BUNDLE";
|
|
214
214
|
// THEME = 'THEME',
|
|
215
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 = {}));
|
|
216
221
|
|
|
217
222
|
const TARGET_VISITOR = [
|
|
218
223
|
{ value: EVisitorType.NEW, label: 'New' },
|
|
@@ -307,6 +312,20 @@ var SvgCaretDownIcon = function SvgCaretDownIcon(props) {
|
|
|
307
312
|
};
|
|
308
313
|
SvgCaretDownIcon.displayName = "CaretDownIcon";
|
|
309
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
|
+
|
|
310
329
|
var SvgChartLineIcon = function SvgChartLineIcon(props) {
|
|
311
330
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
312
331
|
viewBox: "0 0 20 20"
|
|
@@ -357,6 +376,39 @@ var SvgChevronUpIcon = function SvgChevronUpIcon(props) {
|
|
|
357
376
|
};
|
|
358
377
|
SvgChevronUpIcon.displayName = "ChevronUpIcon";
|
|
359
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
|
+
|
|
360
412
|
var SvgDeleteIcon = function SvgDeleteIcon(props) {
|
|
361
413
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
362
414
|
viewBox: "0 0 20 20"
|
|
@@ -371,6 +423,17 @@ var SvgDeleteIcon = function SvgDeleteIcon(props) {
|
|
|
371
423
|
};
|
|
372
424
|
SvgDeleteIcon.displayName = "DeleteIcon";
|
|
373
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
|
+
|
|
374
437
|
var SvgInfoIcon = function SvgInfoIcon(props) {
|
|
375
438
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
376
439
|
viewBox: "0 0 20 20"
|
|
@@ -407,6 +470,16 @@ var SvgOrderIcon = function SvgOrderIcon(props) {
|
|
|
407
470
|
};
|
|
408
471
|
SvgOrderIcon.displayName = "OrderIcon";
|
|
409
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
|
+
|
|
410
483
|
var SvgPlusIcon = function SvgPlusIcon(props) {
|
|
411
484
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
412
485
|
viewBox: "0 0 20 20"
|
|
@@ -416,6 +489,19 @@ var SvgPlusIcon = function SvgPlusIcon(props) {
|
|
|
416
489
|
};
|
|
417
490
|
SvgPlusIcon.displayName = "PlusIcon";
|
|
418
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
|
+
|
|
419
505
|
var SvgSearchIcon = function SvgSearchIcon(props) {
|
|
420
506
|
return /*#__PURE__*/React__default.createElement("svg", Object.assign({
|
|
421
507
|
viewBox: "0 0 20 20"
|
|
@@ -596,21 +682,26 @@ function sortByArrayOrder(array, order, sortOrder = 'asc') {
|
|
|
596
682
|
dayjs.extend(utc);
|
|
597
683
|
dayjs.extend(timezone);
|
|
598
684
|
dayjs.extend(quarterOfYear);
|
|
599
|
-
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__';
|
|
600
689
|
const DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
|
601
690
|
function getInitialTimezone() {
|
|
602
|
-
return
|
|
691
|
+
return globalThis[TZ_GLOBAL_KEY] ?? 'UTC';
|
|
603
692
|
}
|
|
604
693
|
function setTz(value) {
|
|
605
|
-
|
|
694
|
+
globalThis[TZ_GLOBAL_KEY] = value;
|
|
606
695
|
dayjs.tz.setDefault(value);
|
|
607
696
|
}
|
|
608
697
|
const dayjsTz = (date) => {
|
|
698
|
+
const tz = getInitialTimezone();
|
|
609
699
|
if (!date)
|
|
610
700
|
return dayjs().tz(tz);
|
|
611
701
|
return dayjs(date).tz(tz);
|
|
612
702
|
};
|
|
613
703
|
const convertDateToTz = (date) => {
|
|
704
|
+
const tz = getInitialTimezone();
|
|
614
705
|
if (!date)
|
|
615
706
|
return dayjs.tz(dayjs().format(DEFAULT_DATE_FORMAT), tz);
|
|
616
707
|
return dayjs.tz(dayjs(date).format(DEFAULT_DATE_FORMAT), tz);
|
|
@@ -752,6 +843,25 @@ const toCapitalize = (string) => {
|
|
|
752
843
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
753
844
|
};
|
|
754
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
|
+
|
|
755
865
|
const GClickable = ({ children, fullWidth = false, cursor = 'pointer', onClick, onMouseEnter, onMouseLeave, }) => {
|
|
756
866
|
return (jsx("div", { role: "button", tabIndex: 0, className: cls({
|
|
757
867
|
'w-full': fullWidth,
|
|
@@ -1826,15 +1936,25 @@ const getPriceByCurrency = (price, currency = DEFAULT_CURRENCY_ANALYTIC, options
|
|
|
1826
1936
|
// Support legacy 3rd arg as locale string
|
|
1827
1937
|
const opts = typeof options === 'string' ? { locale: options } : options;
|
|
1828
1938
|
const locale = opts?.locale ?? 'en-US';
|
|
1829
|
-
//
|
|
1830
|
-
const
|
|
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, {
|
|
1943
|
+
style: 'currency',
|
|
1944
|
+
currency,
|
|
1945
|
+
...(maxDigits != null && {
|
|
1946
|
+
minimumFractionDigits: Math.min(currencyMinDigits, maxDigits),
|
|
1947
|
+
maximumFractionDigits: maxDigits,
|
|
1948
|
+
}),
|
|
1949
|
+
}).format(value);
|
|
1831
1950
|
const magnitude = Math.abs(price);
|
|
1832
1951
|
if (magnitude >= 1_000_000_000)
|
|
1833
|
-
return `${formatCurrency(price / 1_000_000_000)}B`;
|
|
1952
|
+
return `${formatCurrency(price / 1_000_000_000, 2)}B`;
|
|
1834
1953
|
if (magnitude >= 1_000_000)
|
|
1835
|
-
return `${formatCurrency(price / 1_000_000)}M`;
|
|
1954
|
+
return `${formatCurrency(price / 1_000_000, 2)}M`;
|
|
1836
1955
|
if (opts?.compact && magnitude >= 1_000)
|
|
1837
|
-
return `${formatCurrency(price / 1_000)}K`;
|
|
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.
|
|
1838
1958
|
return formatCurrency(price);
|
|
1839
1959
|
};
|
|
1840
1960
|
|
|
@@ -2249,6 +2369,18 @@ const useWindowSize = () => {
|
|
|
2249
2369
|
return { windowSize, windowWidth, isMobileTabletView, isMobileView };
|
|
2250
2370
|
};
|
|
2251
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
|
+
|
|
2252
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
|
|
2253
2385
|
const defaultEntry = process.env.NODE_ENV === 'test' ? { contentRect: { width: 500, height: 500 } } : null;
|
|
2254
2386
|
function resizeObserver(callback) {
|
|
@@ -2457,6 +2589,32 @@ const GMockDataTooltip = ({ isMockData, content, children, ...props }) => {
|
|
|
2457
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 }));
|
|
2458
2590
|
};
|
|
2459
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
|
+
|
|
2460
2618
|
const GChartSkeleton = () => {
|
|
2461
2619
|
return jsx(GSkeletonDisplayText, { height: "188px" });
|
|
2462
2620
|
};
|
|
@@ -2578,7 +2736,7 @@ const MetricDonutChartSkeleton = () => {
|
|
|
2578
2736
|
return (jsx(Card, { children: jsxs(BlockStack, { gap: "400", children: [jsx(MetricInfoSkeleton, { isShowOneLine: true }), jsx(GChartSkeleton, {})] }) }));
|
|
2579
2737
|
};
|
|
2580
2738
|
|
|
2581
|
-
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 })] }) }));
|
|
2582
2740
|
|
|
2583
2741
|
const MetricInfoBlock = ({ item, isHovered, isLoading, hideComparison, titleVariant = 'headingMd', titleFontWeight, isMockData, onClickTitle, }) => {
|
|
2584
2742
|
const { key, title, totalValue } = item;
|
|
@@ -3988,7 +4146,6 @@ const getNewReturningCustomerMetric = ({ metric }) => detectDataV2By({
|
|
|
3988
4146
|
formatter: IMetricFormatter.NORMAL,
|
|
3989
4147
|
});
|
|
3990
4148
|
|
|
3991
|
-
const PA_METRIC_TOOLTIP = {};
|
|
3992
4149
|
const METRICS_COLUMNS = {
|
|
3993
4150
|
[IPAMetricKey.PAGE_SESSIONS]: { label: 'Sessions' },
|
|
3994
4151
|
[IPAMetricKey.PAGE_BR]: { label: 'Bounce rate' },
|
|
@@ -22630,17 +22787,17 @@ const usePathAnalysisChart = () => {
|
|
|
22630
22787
|
{
|
|
22631
22788
|
value: Number(totalAddedToCart ?? 0),
|
|
22632
22789
|
key: METRICS_COLUMNS[IPAMetricKey.PAGE_ADDED_TO_CART]?.label ?? t('Added to cart'),
|
|
22633
|
-
labelTooltip:
|
|
22790
|
+
labelTooltip: ANALYTICS_METRIC_TOOLTIP[EMetricKey.CART_ADDITION],
|
|
22634
22791
|
},
|
|
22635
22792
|
{
|
|
22636
22793
|
value: Number(totalReachedCheckout ?? 0),
|
|
22637
22794
|
key: t('Reached checkout'),
|
|
22638
|
-
labelTooltip:
|
|
22795
|
+
labelTooltip: ANALYTICS_METRIC_TOOLTIP[EMetricKey.REACHED_CHECKOUT],
|
|
22639
22796
|
},
|
|
22640
22797
|
{
|
|
22641
22798
|
value: Number(totalCompletedCheckout ?? 0),
|
|
22642
22799
|
key: t('Completed checkout'),
|
|
22643
|
-
labelTooltip:
|
|
22800
|
+
labelTooltip: ANALYTICS_METRIC_TOOLTIP[EMetricKey.COMPLETE_CHECKOUT],
|
|
22644
22801
|
},
|
|
22645
22802
|
];
|
|
22646
22803
|
}, [t]);
|
|
@@ -23974,7 +24131,7 @@ const OrderIdCell = ({ value, isMockData }) => {
|
|
|
23974
24131
|
|
|
23975
24132
|
const DateCell = ({ value, isMergedWithPrev }) => (jsx(Text, { as: "span", variant: "bodySm", children: isMergedWithPrev ? '' : value }));
|
|
23976
24133
|
|
|
23977
|
-
const CheckoutStartedDetail = ({ lineItems = [], activatorWrapperProps }) => {
|
|
24134
|
+
const CheckoutStartedDetail$1 = ({ lineItems = [], activatorWrapperProps }) => {
|
|
23978
24135
|
const { t } = useTranslation();
|
|
23979
24136
|
const [active, setActive] = useState(false);
|
|
23980
24137
|
const toggleActive = useCallback(() => setActive((active) => !active), []);
|
|
@@ -24007,7 +24164,7 @@ const ItemsCell = ({ value }) => {
|
|
|
24007
24164
|
return t('{{itemQuantity}} item', { itemQuantity });
|
|
24008
24165
|
return t('{{itemQuantity}} items', { itemQuantity });
|
|
24009
24166
|
};
|
|
24010
|
-
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: {
|
|
24011
24168
|
paddingBlockStart: '100',
|
|
24012
24169
|
opacity: itemHovering ? '1' : '0',
|
|
24013
24170
|
} })] }) }));
|
|
@@ -24340,6 +24497,439 @@ var EJourneyEvent;
|
|
|
24340
24497
|
EJourneyEvent["SEARCH_SUBMITTED"] = "SEARCH_SUBMITTED";
|
|
24341
24498
|
})(EJourneyEvent || (EJourneyEvent = {}));
|
|
24342
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 [currentDate, setCurrentDate] = useState(firstEventsByDate?.date || '');
|
|
24788
|
+
const [showShadow, setShowShadow] = useState(false);
|
|
24789
|
+
const scrollContainerRef = useRef(null);
|
|
24790
|
+
const sectionRefs = useRef(new Map());
|
|
24791
|
+
const scrollableRef = useRef(null);
|
|
24792
|
+
const prevIsFetchingRef = useRef(isFetchingMoreSteps);
|
|
24793
|
+
useEffect(() => {
|
|
24794
|
+
// Find the Polaris Scrollable container after mount
|
|
24795
|
+
if (!isBrowser$1() || !scrollContainerRef.current)
|
|
24796
|
+
return;
|
|
24797
|
+
let element = scrollContainerRef.current.parentElement;
|
|
24798
|
+
// Traverse up to find the scrollable container
|
|
24799
|
+
while (element) {
|
|
24800
|
+
const overflow = getComputedStyle(element).overflowY;
|
|
24801
|
+
if (overflow === 'auto' || overflow === 'scroll') {
|
|
24802
|
+
scrollableRef.current = element;
|
|
24803
|
+
break;
|
|
24804
|
+
}
|
|
24805
|
+
element = element.parentElement;
|
|
24806
|
+
}
|
|
24807
|
+
const scrollableElement = scrollableRef.current;
|
|
24808
|
+
if (!scrollableElement)
|
|
24809
|
+
return;
|
|
24810
|
+
const handleScroll = () => {
|
|
24811
|
+
const scrollTop = scrollableElement.scrollTop;
|
|
24812
|
+
setShowShadow(scrollTop > 10);
|
|
24813
|
+
// Find which date section is currently visible at the top
|
|
24814
|
+
let currentSection = firstEventsByDate;
|
|
24815
|
+
const headerOffset = 20; // Account for fixed header height
|
|
24816
|
+
const scrollableContainerRect = scrollableElement.getBoundingClientRect();
|
|
24817
|
+
for (const dateGroup of eventsByDate) {
|
|
24818
|
+
const element = sectionRefs.current.get(dateGroup.dateKey);
|
|
24819
|
+
if (!element)
|
|
24820
|
+
continue;
|
|
24821
|
+
const rect = element.getBoundingClientRect();
|
|
24822
|
+
// If section top is above or near the header position
|
|
24823
|
+
if (rect.top - scrollableContainerRect.top <= headerOffset) {
|
|
24824
|
+
currentSection = dateGroup;
|
|
24825
|
+
}
|
|
24826
|
+
}
|
|
24827
|
+
setCurrentDate(currentSection?.date || firstEventsByDate?.date || '');
|
|
24828
|
+
};
|
|
24829
|
+
scrollableElement.addEventListener('scroll', handleScroll);
|
|
24830
|
+
handleScroll(); // Initial call
|
|
24831
|
+
return () => scrollableElement.removeEventListener('scroll', handleScroll);
|
|
24832
|
+
}, [eventsByDate, firstEventsByDate]);
|
|
24833
|
+
const handleScrollToTop = () => {
|
|
24834
|
+
if (!scrollableRef.current)
|
|
24835
|
+
return;
|
|
24836
|
+
scrollableRef.current.scrollTo({ top: 0, behavior: 'smooth' });
|
|
24837
|
+
};
|
|
24838
|
+
// Auto-scroll to top when more steps are fetched
|
|
24839
|
+
useEffect(() => {
|
|
24840
|
+
const wasFetching = prevIsFetchingRef.current;
|
|
24841
|
+
const isNowDone = !isFetchingMoreSteps;
|
|
24842
|
+
// If we were fetching and now we're done, scroll to top
|
|
24843
|
+
if (wasFetching && isNowDone) {
|
|
24844
|
+
handleScrollToTop();
|
|
24845
|
+
}
|
|
24846
|
+
// Update ref for next render
|
|
24847
|
+
prevIsFetchingRef.current = isFetchingMoreSteps;
|
|
24848
|
+
}, [isFetchingMoreSteps]);
|
|
24849
|
+
return (jsxs(Scrollable, { scrollbarWidth: "thin", vertical: true, horizontal: true, className: "max-h-[100vh] md:max-h-[calc(100vh-120px)] pb-5", 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: () => {
|
|
24850
|
+
onLoadMore();
|
|
24851
|
+
handleScrollToTop();
|
|
24852
|
+
} }) }), jsx("div", { ref: scrollContainerRef, className: "min-h-[100vh] md:min-h-[calc(100vh-192px)]", children: jsx(JourneyGroup, { eventsByDate: eventsByDate, sectionRefs: sectionRefs }) })] }));
|
|
24853
|
+
};
|
|
24854
|
+
|
|
24855
|
+
const JourneyTimeline = () => {
|
|
24856
|
+
const journeyItemPaddingInlineStart = 24;
|
|
24857
|
+
const journeyItemTimeWidth = 48;
|
|
24858
|
+
const journeyItemInlineGap = 16;
|
|
24859
|
+
const eventMarkerIconSize = 28;
|
|
24860
|
+
const journeyTimeLineWidth = 2;
|
|
24861
|
+
const timelineLeft = journeyItemPaddingInlineStart +
|
|
24862
|
+
journeyItemTimeWidth +
|
|
24863
|
+
journeyItemInlineGap +
|
|
24864
|
+
eventMarkerIconSize / 2 -
|
|
24865
|
+
journeyTimeLineWidth / 2;
|
|
24866
|
+
return jsx("div", { className: cls('w-[2px] absolute top-5 bottom-7 bg-[#F3F3F3] -z-[1]'), style: { left: timelineLeft } });
|
|
24867
|
+
};
|
|
24868
|
+
|
|
24869
|
+
const OrderJourneySkeleton = () => {
|
|
24870
|
+
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)))] })] }));
|
|
24871
|
+
};
|
|
24872
|
+
const JourneyEventSkeleton = ({ isLast }) => {
|
|
24873
|
+
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 }) }))] })] }) }));
|
|
24874
|
+
};
|
|
24875
|
+
|
|
24876
|
+
const GModalOrderJourney = ({ open, onClose, title, orderId, journeyItems, isLoading = false, hasNextPage = false, isFetchingNextPage = false, fetchNextPage, reportCampaign, pageAnalytic, mode, journeySource, onViewOrderDetails, }) => {
|
|
24877
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
24878
|
+
usePreventBodyScroll({ enable: open });
|
|
24879
|
+
const source = useMemo(() => {
|
|
24880
|
+
if (journeySource)
|
|
24881
|
+
return journeySource;
|
|
24882
|
+
if (reportCampaign)
|
|
24883
|
+
return EReportSource.CAMPAIGN;
|
|
24884
|
+
if (pageAnalytic)
|
|
24885
|
+
return EReportSource.PAGE;
|
|
24886
|
+
}, [reportCampaign, pageAnalytic, journeySource]);
|
|
24887
|
+
const filteredCampaignId = reportCampaign?.id;
|
|
24888
|
+
const slicedJourneyItems = useMemo(() => {
|
|
24889
|
+
if (!source)
|
|
24890
|
+
return journeyItems;
|
|
24891
|
+
return sliceJourneyItems({
|
|
24892
|
+
journeyItems,
|
|
24893
|
+
mode,
|
|
24894
|
+
source,
|
|
24895
|
+
pageAnalytic,
|
|
24896
|
+
filteredCampaignId,
|
|
24897
|
+
});
|
|
24898
|
+
}, [journeyItems, mode, source, pageAnalytic, filteredCampaignId]);
|
|
24899
|
+
const isSliced = slicedJourneyItems.length < journeyItems.length;
|
|
24900
|
+
const displayedItems = isExpanded ? journeyItems : slicedJourneyItems;
|
|
24901
|
+
const hasMoreSteps = (!isExpanded && isSliced) || hasNextPage;
|
|
24902
|
+
const handleLoadMore = useCallback(() => {
|
|
24903
|
+
if (!isExpanded && isSliced) {
|
|
24904
|
+
setIsExpanded(true);
|
|
24905
|
+
}
|
|
24906
|
+
else if (hasNextPage) {
|
|
24907
|
+
fetchNextPage?.();
|
|
24908
|
+
}
|
|
24909
|
+
}, [isExpanded, isSliced, hasNextPage, fetchNextPage]);
|
|
24910
|
+
const eventsByDate = useMemo(() => {
|
|
24911
|
+
const grouped = new Map();
|
|
24912
|
+
displayedItems?.forEach((journeyItem) => {
|
|
24913
|
+
const dateKey = formatDateBy('MMMM D', journeyItem.date);
|
|
24914
|
+
if (!grouped.has(dateKey))
|
|
24915
|
+
grouped.set(dateKey, []);
|
|
24916
|
+
grouped.get(dateKey)?.push(journeyItem);
|
|
24917
|
+
});
|
|
24918
|
+
return Array.from(grouped.entries()).map(([date, events]) => ({
|
|
24919
|
+
date,
|
|
24920
|
+
dateKey: date,
|
|
24921
|
+
events: events.map((event) => ({ ...event, filteredCampaignId })),
|
|
24922
|
+
}));
|
|
24923
|
+
}, [displayedItems, filteredCampaignId]);
|
|
24924
|
+
useEffect(() => {
|
|
24925
|
+
if (!open)
|
|
24926
|
+
setIsExpanded(false);
|
|
24927
|
+
}, [open]);
|
|
24928
|
+
if (!orderId)
|
|
24929
|
+
return null;
|
|
24930
|
+
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 })) }) }));
|
|
24931
|
+
};
|
|
24932
|
+
|
|
24343
24933
|
function isBrowser() {
|
|
24344
24934
|
return typeof window !== 'undefined';
|
|
24345
24935
|
}
|
|
@@ -24383,4 +24973,4 @@ const useStickyFilterBoxProps = ({ id }) => {
|
|
|
24383
24973
|
};
|
|
24384
24974
|
};
|
|
24385
24975
|
|
|
24386
|
-
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, 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, useIsStickyById, useOrderColumnsSelectorStore, useOrderControlStore, usePathAnalysisCampaignStore, usePathAnalysisConfig, usePathAnalysisContext, usePathAnalysisStore, useStickyFilterBoxProps, useTimezoneContext, useVersionDateTimeFilters };
|
|
24976
|
+
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 };
|