@gem-sdk/analytics 1.0.2-dev.0 → 1.0.2-dev.1
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 +2 -1
- package/dist/esm/components/GModalOrderJourney/context/OrderJourneyContext.d.ts +1 -0
- package/dist/esm/components/OrderAnalytic/components/OrderListing/OrderListingTable.d.ts +10 -5
- package/dist/esm/components/OrderAnalytic/components/OrderListing/index.d.ts +2 -0
- package/dist/esm/components/OrderAnalytic/components/index.d.ts +1 -0
- package/dist/esm/components/OrderAnalytic/hooks/useOrderListingData.d.ts +4 -1
- package/dist/esm/components/OrderAnalytic/index.d.ts +3 -2
- package/dist/esm/components/OrderAnalytic/types/order.d.ts +1 -0
- package/dist/esm/gemxql.js +26 -13
- package/dist/esm/gemxql.mjs +26 -13
- package/dist/esm/index.js +1013 -964
- package/dist/esm/index.mjs +1013 -964
- package/dist/esm/shared/journey/ui/JourneyTitle/components/GemxIdBadge.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/index.d.ts +1 -0
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/GemxIdCell.d.ts +2 -0
- package/dist/esm/shared/reports/ui/ReportTable/types/report-columns.d.ts +1 -0
- package/dist/esm/types/index.d.ts +5 -4
- package/dist/esm/types/report-columns.d.ts +1 -0
- package/dist/esm/types.js +51 -38
- package/dist/esm/types.mjs +51 -38
- package/dist/style.css +1 -1
- package/dist/umd/esm/components/GModalOrderJourney/GModalOrderJourney.d.ts +2 -1
- package/dist/umd/esm/components/GModalOrderJourney/context/OrderJourneyContext.d.ts +1 -0
- package/dist/umd/esm/components/OrderAnalytic/components/OrderListing/OrderListingTable.d.ts +10 -5
- package/dist/umd/esm/components/OrderAnalytic/components/OrderListing/index.d.ts +2 -0
- package/dist/umd/esm/components/OrderAnalytic/components/index.d.ts +1 -0
- package/dist/umd/esm/components/OrderAnalytic/hooks/useOrderListingData.d.ts +4 -1
- package/dist/umd/esm/components/OrderAnalytic/index.d.ts +3 -2
- package/dist/umd/esm/components/OrderAnalytic/types/order.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/GemxIdBadge.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/index.d.ts +1 -0
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/GemxIdCell.d.ts +2 -0
- package/dist/umd/esm/shared/reports/ui/ReportTable/types/report-columns.d.ts +1 -0
- package/dist/umd/esm/types/index.d.ts +5 -4
- package/dist/umd/esm/types/report-columns.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.js
CHANGED
|
@@ -168,6 +168,20 @@ var ETrafficSourceType;
|
|
|
168
168
|
ETrafficSourceType["SMS"] = "sms";
|
|
169
169
|
})(ETrafficSourceType || (ETrafficSourceType = {}));
|
|
170
170
|
|
|
171
|
+
var ICampaignType;
|
|
172
|
+
(function (ICampaignType) {
|
|
173
|
+
// CONTENT = 'CONTENT',
|
|
174
|
+
ICampaignType["PRICE"] = "PRICE";
|
|
175
|
+
ICampaignType["TEMPLATE"] = "TEMPLATE";
|
|
176
|
+
ICampaignType["TEMPLATE_BUNDLE"] = "TEMPLATE_BUNDLE";
|
|
177
|
+
// THEME = 'THEME',
|
|
178
|
+
})(ICampaignType || (ICampaignType = {}));
|
|
179
|
+
var IVariantType$1;
|
|
180
|
+
(function (IVariantType) {
|
|
181
|
+
IVariantType["VARIANT_A"] = "A";
|
|
182
|
+
IVariantType["VARIANT_B"] = "B";
|
|
183
|
+
})(IVariantType$1 || (IVariantType$1 = {}));
|
|
184
|
+
|
|
171
185
|
/**
|
|
172
186
|
* Pricing enums mirrored from the host app (`~/modules/pricing/types`).
|
|
173
187
|
*
|
|
@@ -205,19 +219,18 @@ var IShopPlanState;
|
|
|
205
219
|
IShopPlanState["ACTIVE_FUNNEL_OPT_AND_TRIAL_FUNNEL_OPT"] = "ACTIVE_FUNNEL_OPT_AND_TRIAL_FUNNEL_OPT";
|
|
206
220
|
})(IShopPlanState || (IShopPlanState = {}));
|
|
207
221
|
|
|
208
|
-
var
|
|
209
|
-
(function (
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
})(IVariantType$1 || (IVariantType$1 = {}));
|
|
222
|
+
var EReportColumnKey;
|
|
223
|
+
(function (EReportColumnKey) {
|
|
224
|
+
EReportColumnKey["ORDER_ID"] = "order_id";
|
|
225
|
+
EReportColumnKey["GEMX_ID"] = "gx_id";
|
|
226
|
+
EReportColumnKey["ORDER_DATE"] = "order_date";
|
|
227
|
+
EReportColumnKey["TOTAL"] = "total_price";
|
|
228
|
+
EReportColumnKey["CAMPAIGNS"] = "experiments";
|
|
229
|
+
EReportColumnKey["TRAFFIC_SOURCE"] = "traffic_source";
|
|
230
|
+
EReportColumnKey["ITEMS"] = "items";
|
|
231
|
+
EReportColumnKey["DEVICE"] = "device";
|
|
232
|
+
EReportColumnKey["VISITOR"] = "visitor_type";
|
|
233
|
+
})(EReportColumnKey || (EReportColumnKey = {}));
|
|
221
234
|
|
|
222
235
|
const TARGET_VISITOR = [
|
|
223
236
|
{ value: EVisitorType.NEW, label: 'New' },
|
|
@@ -23040,17 +23053,109 @@ const CardJourneyAnalysis = ({ analyticMode, config, ...props }) => {
|
|
|
23040
23053
|
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') }) }) }) }) }));
|
|
23041
23054
|
};
|
|
23042
23055
|
|
|
23043
|
-
var
|
|
23044
|
-
(function (
|
|
23045
|
-
|
|
23046
|
-
|
|
23047
|
-
|
|
23048
|
-
|
|
23049
|
-
|
|
23050
|
-
|
|
23051
|
-
|
|
23052
|
-
|
|
23053
|
-
|
|
23056
|
+
var EDimensionKey;
|
|
23057
|
+
(function (EDimensionKey) {
|
|
23058
|
+
EDimensionKey["TIME"] = "time";
|
|
23059
|
+
EDimensionKey["EXPERIMENT_ID"] = "experiment_id";
|
|
23060
|
+
EDimensionKey["VERSION"] = "version";
|
|
23061
|
+
EDimensionKey["VISITOR"] = "visitor_type";
|
|
23062
|
+
EDimensionKey["TRAFFIC_SOURCE"] = "traffic_source";
|
|
23063
|
+
EDimensionKey["DEVICE"] = "device";
|
|
23064
|
+
})(EDimensionKey || (EDimensionKey = {}));
|
|
23065
|
+
|
|
23066
|
+
var ETooltipCategory;
|
|
23067
|
+
(function (ETooltipCategory) {
|
|
23068
|
+
ETooltipCategory["ALPHABETICAL"] = "ALPHABETICAL";
|
|
23069
|
+
ETooltipCategory["NUMERIC"] = "NUMERIC";
|
|
23070
|
+
ETooltipCategory["DATE"] = "DATE";
|
|
23071
|
+
})(ETooltipCategory || (ETooltipCategory = {}));
|
|
23072
|
+
const TooltipPresets = {
|
|
23073
|
+
[ETooltipCategory.ALPHABETICAL]: { ASC: 'A-Z', DESC: 'Z-A' },
|
|
23074
|
+
[ETooltipCategory.NUMERIC]: { ASC: 'Lowest first', DESC: 'Highest first' },
|
|
23075
|
+
[ETooltipCategory.DATE]: { ASC: 'Oldest first', DESC: 'Newest first' },
|
|
23076
|
+
};
|
|
23077
|
+
const DEFAULT_TOOLTIP = TooltipPresets[ETooltipCategory.NUMERIC];
|
|
23078
|
+
const reportOrderTooltip = {
|
|
23079
|
+
day: TooltipPresets[ETooltipCategory.DATE],
|
|
23080
|
+
order_date: TooltipPresets[ETooltipCategory.DATE],
|
|
23081
|
+
month: TooltipPresets[ETooltipCategory.DATE],
|
|
23082
|
+
year: TooltipPresets[ETooltipCategory.DATE],
|
|
23083
|
+
hour: TooltipPresets[ETooltipCategory.DATE],
|
|
23084
|
+
quarter: TooltipPresets[ETooltipCategory.DATE],
|
|
23085
|
+
week: TooltipPresets[ETooltipCategory.DATE],
|
|
23086
|
+
[EDimensionKey.DEVICE]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23087
|
+
[EDimensionKey.VISITOR]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23088
|
+
[EDimensionKey.VERSION]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23089
|
+
[EDimensionKey.TRAFFIC_SOURCE]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23090
|
+
};
|
|
23091
|
+
|
|
23092
|
+
const DEFAULT_DIMENSION_LAYOUT = {
|
|
23093
|
+
width: '200px',
|
|
23094
|
+
minWidth: '200px',
|
|
23095
|
+
align: 'start',
|
|
23096
|
+
paddingRight: '28px',
|
|
23097
|
+
headerPaddingRight: '0',
|
|
23098
|
+
};
|
|
23099
|
+
const DEFAULT_METRIC_LAYOUT = {
|
|
23100
|
+
minWidth: '140px',
|
|
23101
|
+
align: 'end',
|
|
23102
|
+
paddingRight: '28px',
|
|
23103
|
+
headerPaddingRight: '0',
|
|
23104
|
+
};
|
|
23105
|
+
const IS_TOTAL_ROW_FIELD = 'isTotalRow';
|
|
23106
|
+
|
|
23107
|
+
const ReportTableActionsContext = createContext({});
|
|
23108
|
+
const ReportTableActionsProvider = ({ children, onViewOrderJourney, onViewOrderDetails, onViewAllStoreOrders, }) => {
|
|
23109
|
+
return (jsx(ReportTableActionsContext.Provider, { value: { onViewOrderJourney, onViewOrderDetails, onViewAllStoreOrders }, children: children }));
|
|
23110
|
+
};
|
|
23111
|
+
const useReportTableActionsContext = () => useContext(ReportTableActionsContext);
|
|
23112
|
+
|
|
23113
|
+
var GEMX_LOGO = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzgiIGhlaWdodD0iNDIiIHZpZXdCb3g9IjAgMCAzOCA0MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM4MzQzXzMwMTI3KSI+CjxwYXRoIGQ9Ik0yMi43Nzc4IDEuODk4NjdMMTkuNTU5IDcuNzcyMDZDMTkuNTMyNCA3LjgyNDYyIDE5LjUzMjQgNy44OTAzMiAxOS41NTkgNy45NDI4OEwyNi40NjIyIDIwLjU0MzdDMjYuNTI4NyAyMC42Njg2IDI2LjcwODMgMjAuNjY4NiAyNi43NzQ4IDIwLjU0MzdMMzcuODg3NyAwLjI2Mjc5MkMzNy45NTQyIDAuMTQ0NTM1IDM3Ljg2NzggMCAzNy43MjgxIDBIMjYuMDAzM0MyNC42NTMzIDAgMjMuNDE2MyAwLjcyOTI0NyAyMi43Nzc4IDEuODk4NjdaIiBmaWxsPSIjQ0NDQ0NDIi8+CjxwYXRoIGQ9Ik0xMi4zODI5IDBIMC40NTE5OTVDMC4xMTI4MjEgMCAtMC4xMDY2NDUgMC4zNjEzMzggMC4wNTk2MTY4IDAuNjU2OTc5TDExLjA5OTQgMjAuODEzMUwwLjA1Mjk2NjMgNDAuOTgyNEMtMC4xMDY2NDUgNDEuMjc4IDAuMTA2MTcgNDEuNjM5MyAwLjQ1MTk5NSA0MS42MzkzSDEyLjM1NjNDMTIuNjIyNCA0MS42MzkzIDEyLjg3NTEgNDEuNDk0OCAxMy4wMDE0IDQxLjI1ODNMMjQuMDQxMiAyMS4xMDIyQzI0LjE0NzYgMjAuOTExNiAyNC4xNDc2IDIwLjY3NTEgMjQuMDQxMiAyMC40ODQ2TDEzLjAyOCAwLjM4MTA0OEMxMi45MDE3IDAuMTQ0NTM1IDEyLjY1NTYgMCAxMi4zODI5IDBaIiBmaWxsPSIjQ0NDQ0NDIi8+CjxwYXRoIGQ9Ik0yMi43Nzc4IDM5Ljc5OTdMMTkuNTU5IDMzLjkyNjNDMTkuNTMyNCAzMy44NzM4IDE5LjUzMjQgMzMuODA4MSAxOS41NTkgMzMuNzU1NUwyNi40NjIyIDIxLjE1NDdDMjYuNTI4NyAyMS4wMjk4IDI2LjcwODMgMjEuMDI5OCAyNi43NzQ4IDIxLjE1NDdMMzcuODgxMSA0MS40MzU2QzM3Ljk0NzYgNDEuNTUzOSAzNy44NjExIDQxLjY5ODQgMzcuNzIxNSA0MS42OTg0SDI1Ljk5NjdDMjQuNjQ2NiA0MS42OTg0IDIzLjQwOTYgNDAuOTY5MSAyMi43NzEyIDM5Ljc5OTdIMjIuNzc3OFoiIGZpbGw9IiNDQ0NDQ0MiLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8zODM0M18zMDEyNyI+CjxyZWN0IHdpZHRoPSIzNy45MDc3IiBoZWlnaHQ9IjQxLjY5ODUiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";
|
|
23114
|
+
|
|
23115
|
+
const getColumnLayoutStyles = (columnLayout, hasTooltipCard) => {
|
|
23116
|
+
return {
|
|
23117
|
+
'--column-cell-min-width': columnLayout.minWidth,
|
|
23118
|
+
'--column-cell-max-width': columnLayout.maxWidth,
|
|
23119
|
+
'--column-cell-justify-content': columnLayout.align,
|
|
23120
|
+
'--column-cell-padding-inline': columnLayout.paddingInline,
|
|
23121
|
+
'--column-first-padding-inline': columnLayout.columnFirstPaddingInline,
|
|
23122
|
+
'--column-wrapper-width': columnLayout.columnWrapperWidth,
|
|
23123
|
+
'--column-cell-padding-right': !hasTooltipCard ? columnLayout.paddingRight : columnLayout.paddingInline,
|
|
23124
|
+
'--column-header-cell-padding-right': !hasTooltipCard
|
|
23125
|
+
? columnLayout.headerPaddingRight
|
|
23126
|
+
: columnLayout.paddingInline,
|
|
23127
|
+
'--column-dimension-box-shadow': columnLayout.dimensionBoxShadow,
|
|
23128
|
+
'--column-border-right-width': columnLayout.borderRightWidth,
|
|
23129
|
+
};
|
|
23130
|
+
};
|
|
23131
|
+
|
|
23132
|
+
var EOrderDirectionType;
|
|
23133
|
+
(function (EOrderDirectionType) {
|
|
23134
|
+
EOrderDirectionType["ASC"] = "ASC";
|
|
23135
|
+
EOrderDirectionType["DESC"] = "DESC";
|
|
23136
|
+
})(EOrderDirectionType || (EOrderDirectionType = {}));
|
|
23137
|
+
|
|
23138
|
+
const formatReportTableDate = (dateString) => {
|
|
23139
|
+
if (!dateString)
|
|
23140
|
+
return 'None';
|
|
23141
|
+
const date = dayjsTz(dateString);
|
|
23142
|
+
const now = dayjsTz();
|
|
23143
|
+
const yesterday = dayjsTz().subtract(1, 'day');
|
|
23144
|
+
const isToday = date.format('YYYY-MM-DD') === now.format('YYYY-MM-DD');
|
|
23145
|
+
const isYesterday = date.format('YYYY-MM-DD') === yesterday.format('YYYY-MM-DD');
|
|
23146
|
+
if (isToday) {
|
|
23147
|
+
return `Today at ${date.format('HH:mm')}`;
|
|
23148
|
+
}
|
|
23149
|
+
if (isYesterday) {
|
|
23150
|
+
return `Yesterday at ${date.format('HH:mm')}`;
|
|
23151
|
+
}
|
|
23152
|
+
const daysDiff = now.diff(date, 'day');
|
|
23153
|
+
const isWithinWeek = daysDiff >= 0 && daysDiff < 7;
|
|
23154
|
+
if (isWithinWeek) {
|
|
23155
|
+
return `${date.format('dddd')} at ${date.format('HH:mm')}`;
|
|
23156
|
+
}
|
|
23157
|
+
return `${date.format('MMM D')} at ${date.format('hh:mm a')}`;
|
|
23158
|
+
};
|
|
23054
23159
|
|
|
23055
23160
|
var EReportDataType;
|
|
23056
23161
|
(function (EReportDataType) {
|
|
@@ -23106,6 +23211,91 @@ var IRMetricKey;
|
|
|
23106
23211
|
IRMetricKey["VISITOR_BY_TYPE"] = "visitor_type";
|
|
23107
23212
|
})(IRMetricKey || (IRMetricKey = {}));
|
|
23108
23213
|
|
|
23214
|
+
const formatReportData = ({ value, formatter, getTextPrice, name, }) => {
|
|
23215
|
+
const dataTypeIsObjectOrArray = value !== null && (typeof value === 'object' || Array.isArray(value));
|
|
23216
|
+
if (dataTypeIsObjectOrArray)
|
|
23217
|
+
return value;
|
|
23218
|
+
switch (formatter) {
|
|
23219
|
+
case EReportDataType.INTEGER: {
|
|
23220
|
+
return numberWithCommas((value ?? 0).toString());
|
|
23221
|
+
}
|
|
23222
|
+
case EReportDataType.CURRENCY: {
|
|
23223
|
+
return getTextPrice(value, false);
|
|
23224
|
+
}
|
|
23225
|
+
case EReportDataType.DATE: {
|
|
23226
|
+
return formatReportTableDate(value);
|
|
23227
|
+
}
|
|
23228
|
+
case EReportDataType.PERCENT: {
|
|
23229
|
+
if (typeof value !== 'number')
|
|
23230
|
+
return calcPercentageString(0, 1, 2) ?? '';
|
|
23231
|
+
return calcPercentageString(value / 100, 1, 2) ?? '';
|
|
23232
|
+
}
|
|
23233
|
+
case EReportDataType.DURATION: {
|
|
23234
|
+
return getTimeDurationLabel(Number(value));
|
|
23235
|
+
}
|
|
23236
|
+
case EReportDataType.STRING: {
|
|
23237
|
+
const fallbackValue = name === EReportColumnKey.CAMPAIGNS ? '' : NONE_VALUE;
|
|
23238
|
+
return value ?? fallbackValue;
|
|
23239
|
+
}
|
|
23240
|
+
case EReportDataType.DAY: {
|
|
23241
|
+
return getFormattedByInterval(value, AnalyticInterval.DAY, {
|
|
23242
|
+
isExpandDetail: true,
|
|
23243
|
+
});
|
|
23244
|
+
}
|
|
23245
|
+
case EReportDataType.HOUR: {
|
|
23246
|
+
return getFormattedByInterval(value, AnalyticInterval.HOUR, {
|
|
23247
|
+
isExpandDetail: true,
|
|
23248
|
+
});
|
|
23249
|
+
}
|
|
23250
|
+
case EReportDataType.MONTH: {
|
|
23251
|
+
return getFormattedByInterval(value, AnalyticInterval.MONTH, {
|
|
23252
|
+
isExpandDetail: true,
|
|
23253
|
+
});
|
|
23254
|
+
}
|
|
23255
|
+
case EReportDataType.YEAR: {
|
|
23256
|
+
return getFormattedByInterval(value, AnalyticInterval.YEAR);
|
|
23257
|
+
}
|
|
23258
|
+
case EReportDataType.WEEK: {
|
|
23259
|
+
return getFormattedByInterval(value, AnalyticInterval.WEEK, {
|
|
23260
|
+
isExpandDetail: true,
|
|
23261
|
+
});
|
|
23262
|
+
}
|
|
23263
|
+
case EReportDataType.QUARTER: {
|
|
23264
|
+
return getFormattedByInterval(value, AnalyticInterval.QUARTER, {
|
|
23265
|
+
isExpandDetail: true,
|
|
23266
|
+
});
|
|
23267
|
+
}
|
|
23268
|
+
case EReportDataType.OBJECT:
|
|
23269
|
+
case EReportDataType.ARRAY: {
|
|
23270
|
+
return value;
|
|
23271
|
+
}
|
|
23272
|
+
default:
|
|
23273
|
+
return `${value}`;
|
|
23274
|
+
}
|
|
23275
|
+
};
|
|
23276
|
+
|
|
23277
|
+
const COLOR_NORMAL = '#FFFFFF';
|
|
23278
|
+
const COLOR_ACTIVE = '#F8F8F8';
|
|
23279
|
+
const ReportTableSkeleton = ({ rows = 3, columns = 2, startBackgroundColor = 'normal', hiddenPagination = true, showLogo = false, }) => {
|
|
23280
|
+
const colors = startBackgroundColor === 'normal' ? [COLOR_NORMAL, COLOR_ACTIVE] : [COLOR_ACTIVE, COLOR_NORMAL];
|
|
23281
|
+
const getRowColor = (index) => colors[index % 2];
|
|
23282
|
+
const getColJustify = (colIndex) => {
|
|
23283
|
+
if (colIndex === 0)
|
|
23284
|
+
return 'start';
|
|
23285
|
+
if (colIndex === columns - 1)
|
|
23286
|
+
return 'end';
|
|
23287
|
+
return 'center';
|
|
23288
|
+
};
|
|
23289
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: cls('GReportTable__Container', {
|
|
23290
|
+
'GReportTable__Container--pagination-hidden': hiddenPagination,
|
|
23291
|
+
}), children: jsx("div", { className: "GReportTable__Wrapper", children: jsx("div", { className: "GReportTable__ScrollWrap", children: Array.from({ length: rows }).map((_, rowIndex) => (jsx("div", { className: "GReportTable__Row", children: Array.from({ length: columns }).map((_, colIndex) => (jsx("div", { className: "GReportTable__Cell !border-r-0 px-5", style: {
|
|
23292
|
+
backgroundColor: getRowColor(rowIndex),
|
|
23293
|
+
...getColumnLayoutStyles({
|
|
23294
|
+
align: getColJustify(colIndex),
|
|
23295
|
+
}),
|
|
23296
|
+
}, children: jsx(Box, { width: "92px", children: jsx(SkeletonBodyText, { lines: 1 }) }) }, colIndex))) }, rowIndex))) }) }) }), showLogo && (jsx(GInlineCenter, { align: "center", inlineAlign: "center", minHeight: "320px", children: jsx("img", { src: GEMX_LOGO, alt: "Gemx", width: 38, height: 42 }) }))] }));
|
|
23297
|
+
};
|
|
23298
|
+
|
|
23109
23299
|
[IRVariantType.VARIANT_A, IRVariantType.VARIANT_B];
|
|
23110
23300
|
({
|
|
23111
23301
|
[IRVariantType.VARIANT_A]: 'Control',
|
|
@@ -23139,560 +23329,6 @@ function getMetricPreviousValue(row, key) {
|
|
|
23139
23329
|
return row[getPreviousColumnName(key)];
|
|
23140
23330
|
}
|
|
23141
23331
|
|
|
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
|
-
};
|
|
23177
|
-
|
|
23178
|
-
const ORDER_LISTING_DIMENSION_LAYOUT = {
|
|
23179
|
-
width: '158px',
|
|
23180
|
-
minWidth: '158px',
|
|
23181
|
-
maxWidth: '158px',
|
|
23182
|
-
paddingInline: '12px',
|
|
23183
|
-
columnFirstPaddingInline: '12px',
|
|
23184
|
-
align: 'start',
|
|
23185
|
-
dimensionBoxShadow: 'none',
|
|
23186
|
-
borderRightWidth: '0px',
|
|
23187
|
-
};
|
|
23188
|
-
// Remaining space after fixed Order ID column
|
|
23189
|
-
const METRIC_COLUMN_MAX_WIDTH = `max(var(--column-cell-min-width), calc(100% - ${ORDER_LISTING_DIMENSION_LAYOUT.width}))`;
|
|
23190
|
-
const ORDER_LISTING_METRIC_LAYOUTS = {
|
|
23191
|
-
[EReportColumnKey.ORDER_DATE]: {
|
|
23192
|
-
minWidth: '180px',
|
|
23193
|
-
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
23194
|
-
align: 'start',
|
|
23195
|
-
},
|
|
23196
|
-
[EReportColumnKey.TOTAL]: {
|
|
23197
|
-
minWidth: '120px',
|
|
23198
|
-
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
23199
|
-
align: 'end',
|
|
23200
|
-
},
|
|
23201
|
-
[EReportColumnKey.CAMPAIGNS]: {
|
|
23202
|
-
minWidth: '246px',
|
|
23203
|
-
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
23204
|
-
align: 'start',
|
|
23205
|
-
columnWrapperWidth: '100%',
|
|
23206
|
-
},
|
|
23207
|
-
[EReportColumnKey.TRAFFIC_SOURCE]: {
|
|
23208
|
-
minWidth: '120px',
|
|
23209
|
-
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
23210
|
-
align: 'start',
|
|
23211
|
-
},
|
|
23212
|
-
[EReportColumnKey.DEVICE]: {
|
|
23213
|
-
minWidth: '120px',
|
|
23214
|
-
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
23215
|
-
align: 'start',
|
|
23216
|
-
},
|
|
23217
|
-
[EReportColumnKey.VISITOR]: {
|
|
23218
|
-
minWidth: '120px',
|
|
23219
|
-
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
23220
|
-
align: 'start',
|
|
23221
|
-
},
|
|
23222
|
-
[EReportColumnKey.ITEMS]: {
|
|
23223
|
-
minWidth: '140px',
|
|
23224
|
-
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
23225
|
-
align: 'start',
|
|
23226
|
-
},
|
|
23227
|
-
};
|
|
23228
|
-
const ORDER_LISTING_COLUMNS = [
|
|
23229
|
-
{
|
|
23230
|
-
name: EReportColumnKey.ORDER_ID,
|
|
23231
|
-
dataType: EReportDataType.STRING,
|
|
23232
|
-
displayName: 'Order ID',
|
|
23233
|
-
tooltipCardProps: {
|
|
23234
|
-
tooltip: {
|
|
23235
|
-
title: 'Order ID',
|
|
23236
|
-
content: 'Shopify identifier for the order',
|
|
23237
|
-
width: 'wide',
|
|
23238
|
-
},
|
|
23239
|
-
},
|
|
23240
|
-
},
|
|
23241
|
-
{
|
|
23242
|
-
name: EReportColumnKey.ORDER_DATE,
|
|
23243
|
-
dataType: EReportDataType.DATE,
|
|
23244
|
-
displayName: 'Date',
|
|
23245
|
-
tooltipCardProps: {
|
|
23246
|
-
tooltip: {
|
|
23247
|
-
title: 'Date',
|
|
23248
|
-
content: 'Date when the order was placed',
|
|
23249
|
-
width: 'wide',
|
|
23250
|
-
},
|
|
23251
|
-
},
|
|
23252
|
-
},
|
|
23253
|
-
{
|
|
23254
|
-
name: EReportColumnKey.TOTAL,
|
|
23255
|
-
dataType: EReportDataType.CURRENCY,
|
|
23256
|
-
displayName: 'Total',
|
|
23257
|
-
tooltipCardProps: {
|
|
23258
|
-
tooltip: {
|
|
23259
|
-
title: 'Total',
|
|
23260
|
-
content: 'The money amount customers paid for the order',
|
|
23261
|
-
width: 'wide',
|
|
23262
|
-
},
|
|
23263
|
-
},
|
|
23264
|
-
},
|
|
23265
|
-
{
|
|
23266
|
-
name: EReportColumnKey.CAMPAIGNS,
|
|
23267
|
-
dataType: EReportDataType.OBJECT,
|
|
23268
|
-
displayName: 'Experiment version',
|
|
23269
|
-
tooltipCardProps: {
|
|
23270
|
-
tooltip: {
|
|
23271
|
-
title: 'Experiment',
|
|
23272
|
-
content: 'The specific template variant shown to the customer that resulted in the order',
|
|
23273
|
-
width: 'wide',
|
|
23274
|
-
},
|
|
23275
|
-
},
|
|
23276
|
-
},
|
|
23277
|
-
{
|
|
23278
|
-
name: EReportColumnKey.TRAFFIC_SOURCE,
|
|
23279
|
-
dataType: EReportDataType.STRING,
|
|
23280
|
-
displayName: 'Traffic source',
|
|
23281
|
-
tooltipCardProps: {
|
|
23282
|
-
tooltip: {
|
|
23283
|
-
title: 'Traffic source',
|
|
23284
|
-
content: 'Where your customers came from',
|
|
23285
|
-
width: 'wide',
|
|
23286
|
-
},
|
|
23287
|
-
},
|
|
23288
|
-
},
|
|
23289
|
-
{
|
|
23290
|
-
name: EReportColumnKey.DEVICE,
|
|
23291
|
-
dataType: EReportDataType.STRING,
|
|
23292
|
-
displayName: 'Device',
|
|
23293
|
-
tooltipCardProps: {
|
|
23294
|
-
tooltip: {
|
|
23295
|
-
title: 'Device',
|
|
23296
|
-
content: 'Device customers used to place the order',
|
|
23297
|
-
width: 'wide',
|
|
23298
|
-
},
|
|
23299
|
-
},
|
|
23300
|
-
},
|
|
23301
|
-
{
|
|
23302
|
-
name: EReportColumnKey.VISITOR,
|
|
23303
|
-
dataType: EReportDataType.STRING,
|
|
23304
|
-
displayName: 'Customer type',
|
|
23305
|
-
tooltipCardProps: {
|
|
23306
|
-
tooltip: {
|
|
23307
|
-
title: 'Customer type',
|
|
23308
|
-
content: 'Customers who placed the order',
|
|
23309
|
-
width: 'wide',
|
|
23310
|
-
},
|
|
23311
|
-
},
|
|
23312
|
-
},
|
|
23313
|
-
{
|
|
23314
|
-
name: EReportColumnKey.ITEMS,
|
|
23315
|
-
dataType: EReportDataType.OBJECT,
|
|
23316
|
-
displayName: 'Items',
|
|
23317
|
-
tooltipCardProps: {
|
|
23318
|
-
tooltip: {
|
|
23319
|
-
title: 'Items',
|
|
23320
|
-
content: 'Number of units across all line items in the order',
|
|
23321
|
-
width: 'wide',
|
|
23322
|
-
},
|
|
23323
|
-
},
|
|
23324
|
-
},
|
|
23325
|
-
];
|
|
23326
|
-
const ORDER_LISTING_LATEST_COLUMNS_FOR_PAGE = ORDER_LISTING_COLUMNS.filter((column) => ![EReportColumnKey.CAMPAIGNS].includes(column.name));
|
|
23327
|
-
const ORDER_LISTING_METRICS = [
|
|
23328
|
-
EReportColumnKey.ORDER_DATE,
|
|
23329
|
-
EReportColumnKey.TOTAL,
|
|
23330
|
-
EReportColumnKey.CAMPAIGNS,
|
|
23331
|
-
EReportColumnKey.TRAFFIC_SOURCE,
|
|
23332
|
-
EReportColumnKey.DEVICE,
|
|
23333
|
-
EReportColumnKey.VISITOR,
|
|
23334
|
-
EReportColumnKey.ITEMS,
|
|
23335
|
-
];
|
|
23336
|
-
const ORDER_LISTING_DIMENSIONS = ['order_id'];
|
|
23337
|
-
const ORDER_LISTING_CONFIG = {
|
|
23338
|
-
SHOW_LATEST_ORDER_LISTING_AMOUNT: 5,
|
|
23339
|
-
};
|
|
23340
|
-
const SORT_ORDER_LISTING_DEFAULT = [`${EReportColumnKey.ORDER_DATE} desc`];
|
|
23341
|
-
|
|
23342
|
-
const ORDER_COLUMN_MAPPING = {
|
|
23343
|
-
[EReportColumnKey.ORDER_ID]: {
|
|
23344
|
-
label: 'Order ID',
|
|
23345
|
-
value: EReportColumnKey.ORDER_ID,
|
|
23346
|
-
},
|
|
23347
|
-
[EReportColumnKey.ORDER_DATE]: {
|
|
23348
|
-
label: 'Date',
|
|
23349
|
-
value: EReportColumnKey.ORDER_DATE,
|
|
23350
|
-
},
|
|
23351
|
-
[EReportColumnKey.TOTAL]: {
|
|
23352
|
-
label: 'Total',
|
|
23353
|
-
value: EReportColumnKey.TOTAL,
|
|
23354
|
-
},
|
|
23355
|
-
[EReportColumnKey.CAMPAIGNS]: {
|
|
23356
|
-
label: 'Experiment version',
|
|
23357
|
-
value: EReportColumnKey.CAMPAIGNS,
|
|
23358
|
-
},
|
|
23359
|
-
[EReportColumnKey.TRAFFIC_SOURCE]: {
|
|
23360
|
-
label: 'Traffic source',
|
|
23361
|
-
value: EReportColumnKey.TRAFFIC_SOURCE,
|
|
23362
|
-
},
|
|
23363
|
-
[EReportColumnKey.DEVICE]: {
|
|
23364
|
-
label: 'Device',
|
|
23365
|
-
value: EReportColumnKey.DEVICE,
|
|
23366
|
-
},
|
|
23367
|
-
[EReportColumnKey.VISITOR]: {
|
|
23368
|
-
label: 'Customer type',
|
|
23369
|
-
value: EReportColumnKey.VISITOR,
|
|
23370
|
-
},
|
|
23371
|
-
[EReportColumnKey.ITEMS]: {
|
|
23372
|
-
label: 'Items',
|
|
23373
|
-
value: EReportColumnKey.ITEMS,
|
|
23374
|
-
},
|
|
23375
|
-
};
|
|
23376
|
-
const DEFAULT_SELECTED_COLUMNS_FOR_EXPERIMENT = [
|
|
23377
|
-
EReportColumnKey.ORDER_ID,
|
|
23378
|
-
EReportColumnKey.ORDER_DATE,
|
|
23379
|
-
EReportColumnKey.TOTAL,
|
|
23380
|
-
EReportColumnKey.CAMPAIGNS,
|
|
23381
|
-
EReportColumnKey.TRAFFIC_SOURCE,
|
|
23382
|
-
EReportColumnKey.DEVICE,
|
|
23383
|
-
EReportColumnKey.VISITOR,
|
|
23384
|
-
];
|
|
23385
|
-
|
|
23386
|
-
const SKELETON_METRICS = [
|
|
23387
|
-
EReportColumnKey.ORDER_DATE,
|
|
23388
|
-
EReportColumnKey.TOTAL,
|
|
23389
|
-
EReportColumnKey.CAMPAIGNS,
|
|
23390
|
-
EReportColumnKey.TRAFFIC_SOURCE,
|
|
23391
|
-
EReportColumnKey.DEVICE,
|
|
23392
|
-
EReportColumnKey.VISITOR,
|
|
23393
|
-
EReportColumnKey.ITEMS,
|
|
23394
|
-
];
|
|
23395
|
-
|
|
23396
|
-
const SkeletonSummaryRow = () => {
|
|
23397
|
-
const summaryColumns = [
|
|
23398
|
-
{ key: 'order_id', layout: ORDER_LISTING_DIMENSION_LAYOUT },
|
|
23399
|
-
...SKELETON_METRICS.map((metric) => ({
|
|
23400
|
-
key: metric,
|
|
23401
|
-
layout: ORDER_LISTING_METRIC_LAYOUTS[metric],
|
|
23402
|
-
})),
|
|
23403
|
-
];
|
|
23404
|
-
return (jsx("div", { className: "GReportTable__Summary-Row", children: summaryColumns.map((col, index) => (jsx("div", { className: "GReportTable__Summary-Cell", style: {
|
|
23405
|
-
minWidth: col.layout?.minWidth,
|
|
23406
|
-
maxWidth: col.layout?.maxWidth,
|
|
23407
|
-
justifyContent: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
23408
|
-
['--column-cell-justify-content']: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
23409
|
-
}, children: index === 0 && (jsx("div", { className: "w-20", children: jsx(SkeletonBodyText, { lines: 1 }) })) }, col.key))) }));
|
|
23410
|
-
};
|
|
23411
|
-
|
|
23412
|
-
const SkeletonHeader = () => {
|
|
23413
|
-
const headerColumns = [
|
|
23414
|
-
{ key: 'order_id', label: 'Order ID', layout: ORDER_LISTING_DIMENSION_LAYOUT },
|
|
23415
|
-
...SKELETON_METRICS.map((metric) => ({
|
|
23416
|
-
key: metric,
|
|
23417
|
-
label: metric,
|
|
23418
|
-
layout: ORDER_LISTING_METRIC_LAYOUTS[metric],
|
|
23419
|
-
})),
|
|
23420
|
-
];
|
|
23421
|
-
return (jsx("div", { className: "GReportTable__Header", children: headerColumns.map((col, index) => (jsx("div", { className: "GReportTable__Header-Cell", style: {
|
|
23422
|
-
minWidth: col.layout?.minWidth,
|
|
23423
|
-
maxWidth: col.layout?.maxWidth,
|
|
23424
|
-
justifyContent: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
23425
|
-
['--column-cell-justify-content']: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
23426
|
-
}, children: jsx("div", { className: index === 0 ? 'w-16' : 'w-12', children: jsx(SkeletonBodyText, { lines: 1 }) }) }, col.key))) }));
|
|
23427
|
-
};
|
|
23428
|
-
|
|
23429
|
-
const SkeletonCellContent = ({ columnKey }) => {
|
|
23430
|
-
switch (columnKey) {
|
|
23431
|
-
case 'order_id':
|
|
23432
|
-
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-20", children: jsx(SkeletonDisplayText, { size: "small" }) }) }));
|
|
23433
|
-
case EReportColumnKey.ORDER_DATE:
|
|
23434
|
-
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-28", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
23435
|
-
case EReportColumnKey.TOTAL:
|
|
23436
|
-
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-16", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
23437
|
-
case EReportColumnKey.CAMPAIGNS:
|
|
23438
|
-
return (jsx(Box, { paddingInline: "300", width: "100%", children: jsxs(InlineStack, { gap: "200", blockAlign: "center", children: [jsx("div", { className: "bg-surface-secondary h-6 w-6 shrink-0 animate-pulse rounded" }), jsx("div", { className: "max-w-40 flex-1", children: jsx(SkeletonBodyText, { lines: 1 }) })] }) }));
|
|
23439
|
-
case EReportColumnKey.TRAFFIC_SOURCE:
|
|
23440
|
-
case EReportColumnKey.DEVICE:
|
|
23441
|
-
case EReportColumnKey.VISITOR:
|
|
23442
|
-
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-16", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
23443
|
-
case EReportColumnKey.ITEMS:
|
|
23444
|
-
return (jsx(Box, { paddingInline: "300", children: jsxs(InlineStack, { gap: "100", blockAlign: "center", children: [jsx("div", { className: "bg-surface-secondary h-6 w-6 shrink-0 animate-pulse rounded" }), jsx("div", { className: "w-4", children: jsx(SkeletonBodyText, { lines: 1 }) })] }) }));
|
|
23445
|
-
default:
|
|
23446
|
-
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-16", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
23447
|
-
}
|
|
23448
|
-
};
|
|
23449
|
-
|
|
23450
|
-
const SkeletonRow = () => {
|
|
23451
|
-
const rowColumns = [
|
|
23452
|
-
{ key: 'order_id', layout: ORDER_LISTING_DIMENSION_LAYOUT, isDimension: true },
|
|
23453
|
-
...SKELETON_METRICS.map((metric) => ({
|
|
23454
|
-
key: metric,
|
|
23455
|
-
layout: ORDER_LISTING_METRIC_LAYOUTS[metric],
|
|
23456
|
-
isDimension: false,
|
|
23457
|
-
})),
|
|
23458
|
-
];
|
|
23459
|
-
return (jsx("div", { className: "GReportTable__Row", children: rowColumns.map((col) => (jsx("div", { className: `GReportTable__Cell ${col.isDimension ? 'GReportTable__Cell--dimension' : ''}`, style: {
|
|
23460
|
-
minWidth: col.layout?.minWidth,
|
|
23461
|
-
maxWidth: col.layout?.maxWidth,
|
|
23462
|
-
justifyContent: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
23463
|
-
['--column-cell-justify-content']: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
23464
|
-
}, children: jsx("div", { className: "GReportTable__CellContent", children: jsx(SkeletonCellContent, { columnKey: col.key }) }) }, col.key))) }));
|
|
23465
|
-
};
|
|
23466
|
-
|
|
23467
|
-
const OrderListingTableSkeleton = ({ rowCount = 5 }) => {
|
|
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 }) }) }) })] }));
|
|
23469
|
-
};
|
|
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
|
-
|
|
23475
|
-
var EOrderDirectionType;
|
|
23476
|
-
(function (EOrderDirectionType) {
|
|
23477
|
-
EOrderDirectionType["ASC"] = "ASC";
|
|
23478
|
-
EOrderDirectionType["DESC"] = "DESC";
|
|
23479
|
-
})(EOrderDirectionType || (EOrderDirectionType = {}));
|
|
23480
|
-
|
|
23481
|
-
const useOrderControlStore = create()((set) => ({
|
|
23482
|
-
orderBy: { field: EReportColumnKey.ORDER_DATE, direction: EOrderDirectionType.DESC },
|
|
23483
|
-
changeOrderBy: (newOrderBy) => set(() => ({ orderBy: newOrderBy })),
|
|
23484
|
-
}));
|
|
23485
|
-
|
|
23486
|
-
const useOrderColumnsSelectorStore = create()(persist((set) => ({
|
|
23487
|
-
selectedColumns: DEFAULT_SELECTED_COLUMNS_FOR_EXPERIMENT,
|
|
23488
|
-
columnsOrder: Object.values(ORDER_COLUMN_MAPPING).map((column) => column.value),
|
|
23489
|
-
setColumnsOrder: (columnsOrder) => set({ columnsOrder }),
|
|
23490
|
-
setSelectedColumns: (selectedColumns) => set({ selectedColumns }),
|
|
23491
|
-
}), { name: 'order-listing-columns-config' }));
|
|
23492
|
-
|
|
23493
|
-
const useOrderListingData = ({ limitRowAmount, orderListing = [], fixedColumns }) => {
|
|
23494
|
-
const selectedColumns = useOrderColumnsSelectorStore((state) => state.selectedColumns);
|
|
23495
|
-
const columnsOrder = useOrderColumnsSelectorStore((state) => state.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]);
|
|
23498
|
-
const tableData = useMemo(() => {
|
|
23499
|
-
const rows = convertOrderItemsToReportTableRows(orderListing);
|
|
23500
|
-
const showRows = limitRowAmount ? rows.slice(0, limitRowAmount) : rows;
|
|
23501
|
-
return {
|
|
23502
|
-
rows: showRows,
|
|
23503
|
-
columns: showColumns,
|
|
23504
|
-
};
|
|
23505
|
-
}, [limitRowAmount, orderListing, showColumns]);
|
|
23506
|
-
return {
|
|
23507
|
-
showColumns,
|
|
23508
|
-
tableData,
|
|
23509
|
-
sortedMetrics,
|
|
23510
|
-
};
|
|
23511
|
-
};
|
|
23512
|
-
|
|
23513
|
-
var EDimensionKey;
|
|
23514
|
-
(function (EDimensionKey) {
|
|
23515
|
-
EDimensionKey["TIME"] = "time";
|
|
23516
|
-
EDimensionKey["EXPERIMENT_ID"] = "experiment_id";
|
|
23517
|
-
EDimensionKey["VERSION"] = "version";
|
|
23518
|
-
EDimensionKey["VISITOR"] = "visitor_type";
|
|
23519
|
-
EDimensionKey["TRAFFIC_SOURCE"] = "traffic_source";
|
|
23520
|
-
EDimensionKey["DEVICE"] = "device";
|
|
23521
|
-
})(EDimensionKey || (EDimensionKey = {}));
|
|
23522
|
-
|
|
23523
|
-
var ETooltipCategory;
|
|
23524
|
-
(function (ETooltipCategory) {
|
|
23525
|
-
ETooltipCategory["ALPHABETICAL"] = "ALPHABETICAL";
|
|
23526
|
-
ETooltipCategory["NUMERIC"] = "NUMERIC";
|
|
23527
|
-
ETooltipCategory["DATE"] = "DATE";
|
|
23528
|
-
})(ETooltipCategory || (ETooltipCategory = {}));
|
|
23529
|
-
const TooltipPresets = {
|
|
23530
|
-
[ETooltipCategory.ALPHABETICAL]: { ASC: 'A-Z', DESC: 'Z-A' },
|
|
23531
|
-
[ETooltipCategory.NUMERIC]: { ASC: 'Lowest first', DESC: 'Highest first' },
|
|
23532
|
-
[ETooltipCategory.DATE]: { ASC: 'Oldest first', DESC: 'Newest first' },
|
|
23533
|
-
};
|
|
23534
|
-
const DEFAULT_TOOLTIP = TooltipPresets[ETooltipCategory.NUMERIC];
|
|
23535
|
-
const reportOrderTooltip = {
|
|
23536
|
-
day: TooltipPresets[ETooltipCategory.DATE],
|
|
23537
|
-
order_date: TooltipPresets[ETooltipCategory.DATE],
|
|
23538
|
-
month: TooltipPresets[ETooltipCategory.DATE],
|
|
23539
|
-
year: TooltipPresets[ETooltipCategory.DATE],
|
|
23540
|
-
hour: TooltipPresets[ETooltipCategory.DATE],
|
|
23541
|
-
quarter: TooltipPresets[ETooltipCategory.DATE],
|
|
23542
|
-
week: TooltipPresets[ETooltipCategory.DATE],
|
|
23543
|
-
[EDimensionKey.DEVICE]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23544
|
-
[EDimensionKey.VISITOR]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23545
|
-
[EDimensionKey.VERSION]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23546
|
-
[EDimensionKey.TRAFFIC_SOURCE]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23547
|
-
};
|
|
23548
|
-
|
|
23549
|
-
const DEFAULT_DIMENSION_LAYOUT = {
|
|
23550
|
-
width: '200px',
|
|
23551
|
-
minWidth: '200px',
|
|
23552
|
-
align: 'start',
|
|
23553
|
-
paddingRight: '28px',
|
|
23554
|
-
headerPaddingRight: '0',
|
|
23555
|
-
};
|
|
23556
|
-
const DEFAULT_METRIC_LAYOUT = {
|
|
23557
|
-
minWidth: '140px',
|
|
23558
|
-
align: 'end',
|
|
23559
|
-
paddingRight: '28px',
|
|
23560
|
-
headerPaddingRight: '0',
|
|
23561
|
-
};
|
|
23562
|
-
const IS_TOTAL_ROW_FIELD = 'isTotalRow';
|
|
23563
|
-
|
|
23564
|
-
const ReportTableActionsContext = createContext({});
|
|
23565
|
-
const ReportTableActionsProvider = ({ children, onViewOrderJourney, onViewOrderDetails, onViewAllStoreOrders, }) => {
|
|
23566
|
-
return (jsx(ReportTableActionsContext.Provider, { value: { onViewOrderJourney, onViewOrderDetails, onViewAllStoreOrders }, children: children }));
|
|
23567
|
-
};
|
|
23568
|
-
const useReportTableActionsContext = () => useContext(ReportTableActionsContext);
|
|
23569
|
-
|
|
23570
|
-
var GEMX_LOGO = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzgiIGhlaWdodD0iNDIiIHZpZXdCb3g9IjAgMCAzOCA0MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM4MzQzXzMwMTI3KSI+CjxwYXRoIGQ9Ik0yMi43Nzc4IDEuODk4NjdMMTkuNTU5IDcuNzcyMDZDMTkuNTMyNCA3LjgyNDYyIDE5LjUzMjQgNy44OTAzMiAxOS41NTkgNy45NDI4OEwyNi40NjIyIDIwLjU0MzdDMjYuNTI4NyAyMC42Njg2IDI2LjcwODMgMjAuNjY4NiAyNi43NzQ4IDIwLjU0MzdMMzcuODg3NyAwLjI2Mjc5MkMzNy45NTQyIDAuMTQ0NTM1IDM3Ljg2NzggMCAzNy43MjgxIDBIMjYuMDAzM0MyNC42NTMzIDAgMjMuNDE2MyAwLjcyOTI0NyAyMi43Nzc4IDEuODk4NjdaIiBmaWxsPSIjQ0NDQ0NDIi8+CjxwYXRoIGQ9Ik0xMi4zODI5IDBIMC40NTE5OTVDMC4xMTI4MjEgMCAtMC4xMDY2NDUgMC4zNjEzMzggMC4wNTk2MTY4IDAuNjU2OTc5TDExLjA5OTQgMjAuODEzMUwwLjA1Mjk2NjMgNDAuOTgyNEMtMC4xMDY2NDUgNDEuMjc4IDAuMTA2MTcgNDEuNjM5MyAwLjQ1MTk5NSA0MS42MzkzSDEyLjM1NjNDMTIuNjIyNCA0MS42MzkzIDEyLjg3NTEgNDEuNDk0OCAxMy4wMDE0IDQxLjI1ODNMMjQuMDQxMiAyMS4xMDIyQzI0LjE0NzYgMjAuOTExNiAyNC4xNDc2IDIwLjY3NTEgMjQuMDQxMiAyMC40ODQ2TDEzLjAyOCAwLjM4MTA0OEMxMi45MDE3IDAuMTQ0NTM1IDEyLjY1NTYgMCAxMi4zODI5IDBaIiBmaWxsPSIjQ0NDQ0NDIi8+CjxwYXRoIGQ9Ik0yMi43Nzc4IDM5Ljc5OTdMMTkuNTU5IDMzLjkyNjNDMTkuNTMyNCAzMy44NzM4IDE5LjUzMjQgMzMuODA4MSAxOS41NTkgMzMuNzU1NUwyNi40NjIyIDIxLjE1NDdDMjYuNTI4NyAyMS4wMjk4IDI2LjcwODMgMjEuMDI5OCAyNi43NzQ4IDIxLjE1NDdMMzcuODgxMSA0MS40MzU2QzM3Ljk0NzYgNDEuNTUzOSAzNy44NjExIDQxLjY5ODQgMzcuNzIxNSA0MS42OTg0SDI1Ljk5NjdDMjQuNjQ2NiA0MS42OTg0IDIzLjQwOTYgNDAuOTY5MSAyMi43NzEyIDM5Ljc5OTdIMjIuNzc3OFoiIGZpbGw9IiNDQ0NDQ0MiLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8zODM0M18zMDEyNyI+CjxyZWN0IHdpZHRoPSIzNy45MDc3IiBoZWlnaHQ9IjQxLjY5ODUiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";
|
|
23571
|
-
|
|
23572
|
-
const getColumnLayoutStyles = (columnLayout, hasTooltipCard) => {
|
|
23573
|
-
return {
|
|
23574
|
-
'--column-cell-min-width': columnLayout.minWidth,
|
|
23575
|
-
'--column-cell-max-width': columnLayout.maxWidth,
|
|
23576
|
-
'--column-cell-justify-content': columnLayout.align,
|
|
23577
|
-
'--column-cell-padding-inline': columnLayout.paddingInline,
|
|
23578
|
-
'--column-first-padding-inline': columnLayout.columnFirstPaddingInline,
|
|
23579
|
-
'--column-wrapper-width': columnLayout.columnWrapperWidth,
|
|
23580
|
-
'--column-cell-padding-right': !hasTooltipCard ? columnLayout.paddingRight : columnLayout.paddingInline,
|
|
23581
|
-
'--column-header-cell-padding-right': !hasTooltipCard
|
|
23582
|
-
? columnLayout.headerPaddingRight
|
|
23583
|
-
: columnLayout.paddingInline,
|
|
23584
|
-
'--column-dimension-box-shadow': columnLayout.dimensionBoxShadow,
|
|
23585
|
-
'--column-border-right-width': columnLayout.borderRightWidth,
|
|
23586
|
-
};
|
|
23587
|
-
};
|
|
23588
|
-
|
|
23589
|
-
const formatReportTableDate = (dateString) => {
|
|
23590
|
-
if (!dateString)
|
|
23591
|
-
return 'None';
|
|
23592
|
-
const date = dayjsTz(dateString);
|
|
23593
|
-
const now = dayjsTz();
|
|
23594
|
-
const yesterday = dayjsTz().subtract(1, 'day');
|
|
23595
|
-
const isToday = date.format('YYYY-MM-DD') === now.format('YYYY-MM-DD');
|
|
23596
|
-
const isYesterday = date.format('YYYY-MM-DD') === yesterday.format('YYYY-MM-DD');
|
|
23597
|
-
if (isToday) {
|
|
23598
|
-
return `Today at ${date.format('HH:mm')}`;
|
|
23599
|
-
}
|
|
23600
|
-
if (isYesterday) {
|
|
23601
|
-
return `Yesterday at ${date.format('HH:mm')}`;
|
|
23602
|
-
}
|
|
23603
|
-
const daysDiff = now.diff(date, 'day');
|
|
23604
|
-
const isWithinWeek = daysDiff >= 0 && daysDiff < 7;
|
|
23605
|
-
if (isWithinWeek) {
|
|
23606
|
-
return `${date.format('dddd')} at ${date.format('HH:mm')}`;
|
|
23607
|
-
}
|
|
23608
|
-
return `${date.format('MMM D')} at ${date.format('hh:mm a')}`;
|
|
23609
|
-
};
|
|
23610
|
-
|
|
23611
|
-
const formatReportData = ({ value, formatter, getTextPrice, name, }) => {
|
|
23612
|
-
const dataTypeIsObjectOrArray = value !== null && (typeof value === 'object' || Array.isArray(value));
|
|
23613
|
-
if (dataTypeIsObjectOrArray)
|
|
23614
|
-
return value;
|
|
23615
|
-
switch (formatter) {
|
|
23616
|
-
case EReportDataType.INTEGER: {
|
|
23617
|
-
return numberWithCommas((value ?? 0).toString());
|
|
23618
|
-
}
|
|
23619
|
-
case EReportDataType.CURRENCY: {
|
|
23620
|
-
return getTextPrice(value, false);
|
|
23621
|
-
}
|
|
23622
|
-
case EReportDataType.DATE: {
|
|
23623
|
-
return formatReportTableDate(value);
|
|
23624
|
-
}
|
|
23625
|
-
case EReportDataType.PERCENT: {
|
|
23626
|
-
if (typeof value !== 'number')
|
|
23627
|
-
return calcPercentageString(0, 1, 2) ?? '';
|
|
23628
|
-
return calcPercentageString(value / 100, 1, 2) ?? '';
|
|
23629
|
-
}
|
|
23630
|
-
case EReportDataType.DURATION: {
|
|
23631
|
-
return getTimeDurationLabel(Number(value));
|
|
23632
|
-
}
|
|
23633
|
-
case EReportDataType.STRING: {
|
|
23634
|
-
const fallbackValue = name === EReportColumnKey.CAMPAIGNS ? '' : NONE_VALUE;
|
|
23635
|
-
return value ?? fallbackValue;
|
|
23636
|
-
}
|
|
23637
|
-
case EReportDataType.DAY: {
|
|
23638
|
-
return getFormattedByInterval(value, AnalyticInterval.DAY, {
|
|
23639
|
-
isExpandDetail: true,
|
|
23640
|
-
});
|
|
23641
|
-
}
|
|
23642
|
-
case EReportDataType.HOUR: {
|
|
23643
|
-
return getFormattedByInterval(value, AnalyticInterval.HOUR, {
|
|
23644
|
-
isExpandDetail: true,
|
|
23645
|
-
});
|
|
23646
|
-
}
|
|
23647
|
-
case EReportDataType.MONTH: {
|
|
23648
|
-
return getFormattedByInterval(value, AnalyticInterval.MONTH, {
|
|
23649
|
-
isExpandDetail: true,
|
|
23650
|
-
});
|
|
23651
|
-
}
|
|
23652
|
-
case EReportDataType.YEAR: {
|
|
23653
|
-
return getFormattedByInterval(value, AnalyticInterval.YEAR);
|
|
23654
|
-
}
|
|
23655
|
-
case EReportDataType.WEEK: {
|
|
23656
|
-
return getFormattedByInterval(value, AnalyticInterval.WEEK, {
|
|
23657
|
-
isExpandDetail: true,
|
|
23658
|
-
});
|
|
23659
|
-
}
|
|
23660
|
-
case EReportDataType.QUARTER: {
|
|
23661
|
-
return getFormattedByInterval(value, AnalyticInterval.QUARTER, {
|
|
23662
|
-
isExpandDetail: true,
|
|
23663
|
-
});
|
|
23664
|
-
}
|
|
23665
|
-
case EReportDataType.OBJECT:
|
|
23666
|
-
case EReportDataType.ARRAY: {
|
|
23667
|
-
return value;
|
|
23668
|
-
}
|
|
23669
|
-
default:
|
|
23670
|
-
return `${value}`;
|
|
23671
|
-
}
|
|
23672
|
-
};
|
|
23673
|
-
|
|
23674
|
-
const COLOR_NORMAL = '#FFFFFF';
|
|
23675
|
-
const COLOR_ACTIVE = '#F8F8F8';
|
|
23676
|
-
const ReportTableSkeleton = ({ rows = 3, columns = 2, startBackgroundColor = 'normal', hiddenPagination = true, showLogo = false, }) => {
|
|
23677
|
-
const colors = startBackgroundColor === 'normal' ? [COLOR_NORMAL, COLOR_ACTIVE] : [COLOR_ACTIVE, COLOR_NORMAL];
|
|
23678
|
-
const getRowColor = (index) => colors[index % 2];
|
|
23679
|
-
const getColJustify = (colIndex) => {
|
|
23680
|
-
if (colIndex === 0)
|
|
23681
|
-
return 'start';
|
|
23682
|
-
if (colIndex === columns - 1)
|
|
23683
|
-
return 'end';
|
|
23684
|
-
return 'center';
|
|
23685
|
-
};
|
|
23686
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: cls('GReportTable__Container', {
|
|
23687
|
-
'GReportTable__Container--pagination-hidden': hiddenPagination,
|
|
23688
|
-
}), children: jsx("div", { className: "GReportTable__Wrapper", children: jsx("div", { className: "GReportTable__ScrollWrap", children: Array.from({ length: rows }).map((_, rowIndex) => (jsx("div", { className: "GReportTable__Row", children: Array.from({ length: columns }).map((_, colIndex) => (jsx("div", { className: "GReportTable__Cell !border-r-0 px-5", style: {
|
|
23689
|
-
backgroundColor: getRowColor(rowIndex),
|
|
23690
|
-
...getColumnLayoutStyles({
|
|
23691
|
-
align: getColJustify(colIndex),
|
|
23692
|
-
}),
|
|
23693
|
-
}, children: jsx(Box, { width: "92px", children: jsx(SkeletonBodyText, { lines: 1 }) }) }, colIndex))) }, rowIndex))) }) }) }), showLogo && (jsx(GInlineCenter, { align: "center", inlineAlign: "center", minHeight: "320px", children: jsx("img", { src: GEMX_LOGO, alt: "Gemx", width: 38, height: 42 }) }))] }));
|
|
23694
|
-
};
|
|
23695
|
-
|
|
23696
23332
|
const useReportTable = ({ dimensions, tableData, metrics }) => {
|
|
23697
23333
|
const columnsByName = useMemo(() => {
|
|
23698
23334
|
return tableData.columns.reduce((lookup, column) => {
|
|
@@ -23907,30 +23543,174 @@ const Pagination = ({ totalRows, itemCount, viewAllMetricContent = 'order', show
|
|
|
23907
23543
|
}
|
|
23908
23544
|
};
|
|
23909
23545
|
|
|
23910
|
-
const ScrollBar = forwardRef(({ isPaginationHidden }, ref) => {
|
|
23911
|
-
return (jsx("div", { className: cls('GReportTable__ScrollBarContainer', {
|
|
23912
|
-
'GReportTable__ScrollBarContainer--pagination-hidden': isPaginationHidden,
|
|
23913
|
-
}), ref: ref, children: jsx("div", { className: "GReportTable__ScrollBar", children: jsx("div", { className: "GReportTable__ScrollBarContent" }) }) }));
|
|
23914
|
-
});
|
|
23915
|
-
ScrollBar.displayName = 'ScrollBar';
|
|
23546
|
+
const ScrollBar = forwardRef(({ isPaginationHidden }, ref) => {
|
|
23547
|
+
return (jsx("div", { className: cls('GReportTable__ScrollBarContainer', {
|
|
23548
|
+
'GReportTable__ScrollBarContainer--pagination-hidden': isPaginationHidden,
|
|
23549
|
+
}), ref: ref, children: jsx("div", { className: "GReportTable__ScrollBar", children: jsx("div", { className: "GReportTable__ScrollBarContent" }) }) }));
|
|
23550
|
+
});
|
|
23551
|
+
ScrollBar.displayName = 'ScrollBar';
|
|
23552
|
+
|
|
23553
|
+
const WrapperFooter = ({ scrollbarContainerRef, itemCount, totalPaginationRows, showViewAllButton, paginationProps, isPaginationHidden, isMockData, }) => {
|
|
23554
|
+
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 })] }));
|
|
23555
|
+
};
|
|
23556
|
+
|
|
23557
|
+
const PreviousCell = ({ previousValue, isMergedWithPrev }) => {
|
|
23558
|
+
if (isMergedWithPrev || typeof previousValue !== 'string')
|
|
23559
|
+
return null;
|
|
23560
|
+
return (jsx(Text, { as: "span", variant: "bodySm", tone: "subdued", children: previousValue }));
|
|
23561
|
+
};
|
|
23562
|
+
|
|
23563
|
+
const WrapperCell = ({ children, previousValue, isMergedWithPrev, columnLayout, }) => {
|
|
23564
|
+
return (jsxs(GInlineCenter, { flexDirection: "column", align: columnLayout?.align, gap: "100", paddingBlock: "200", width: columnLayout?.columnWrapperWidth, children: [children, jsx(PreviousCell, { previousValue: previousValue, isMergedWithPrev: isMergedWithPrev })] }));
|
|
23565
|
+
};
|
|
23566
|
+
|
|
23567
|
+
const DefaultCell = ({ isMergedWithPrev, value, previousValue, columnLayout, isTotalRow, isDimensionCol, }) => {
|
|
23568
|
+
const valueString = typeof value === 'string' ? value : String(value);
|
|
23569
|
+
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) }) }) }));
|
|
23570
|
+
};
|
|
23571
|
+
|
|
23572
|
+
var GVariantBadgeType;
|
|
23573
|
+
(function (GVariantBadgeType) {
|
|
23574
|
+
GVariantBadgeType["ORIGIN"] = "ORIGIN";
|
|
23575
|
+
GVariantBadgeType["VARIANT_B"] = "VARIANT_B";
|
|
23576
|
+
GVariantBadgeType["VARIANT_C"] = "VARIANT_C";
|
|
23577
|
+
GVariantBadgeType["VARIANT_D"] = "VARIANT_D";
|
|
23578
|
+
GVariantBadgeType["VARIANT_E"] = "VARIANT_E";
|
|
23579
|
+
})(GVariantBadgeType || (GVariantBadgeType = {}));
|
|
23580
|
+
var GVariantBadgeSize;
|
|
23581
|
+
(function (GVariantBadgeSize) {
|
|
23582
|
+
GVariantBadgeSize["XS"] = "xs";
|
|
23583
|
+
GVariantBadgeSize["SM"] = "sm";
|
|
23584
|
+
GVariantBadgeSize["MD"] = "md";
|
|
23585
|
+
GVariantBadgeSize["LG"] = "lg";
|
|
23586
|
+
})(GVariantBadgeSize || (GVariantBadgeSize = {}));
|
|
23587
|
+
var GVariantBadgeTone;
|
|
23588
|
+
(function (GVariantBadgeTone) {
|
|
23589
|
+
GVariantBadgeTone["ACTIVE"] = "active";
|
|
23590
|
+
GVariantBadgeTone["SUBDUED"] = "subdued";
|
|
23591
|
+
GVariantBadgeTone["INACTIVE"] = "inactive";
|
|
23592
|
+
})(GVariantBadgeTone || (GVariantBadgeTone = {}));
|
|
23593
|
+
|
|
23594
|
+
const GVariant = ({ variant, size, tone }) => {
|
|
23595
|
+
const sizeIcon = useMemo(() => {
|
|
23596
|
+
switch (size) {
|
|
23597
|
+
case 'xs':
|
|
23598
|
+
return '20px';
|
|
23599
|
+
case 'sm':
|
|
23600
|
+
return '24px';
|
|
23601
|
+
case 'md':
|
|
23602
|
+
return '28px';
|
|
23603
|
+
case 'lg':
|
|
23604
|
+
return '32px';
|
|
23605
|
+
default:
|
|
23606
|
+
return '28px';
|
|
23607
|
+
}
|
|
23608
|
+
}, [size]);
|
|
23609
|
+
const textColor = cls({
|
|
23610
|
+
'text-variant-a': tone === 'active',
|
|
23611
|
+
'text-variant-subdued': tone === 'subdued',
|
|
23612
|
+
'text-variant-b': !tone || tone === 'inactive',
|
|
23613
|
+
});
|
|
23614
|
+
const textSize = useMemo(() => {
|
|
23615
|
+
switch (size) {
|
|
23616
|
+
case 'xs':
|
|
23617
|
+
return 'Polaris-Text--bodyXs';
|
|
23618
|
+
case 'sm':
|
|
23619
|
+
return 'Polaris-Text--bodySm';
|
|
23620
|
+
case 'md':
|
|
23621
|
+
return 'Polaris-Text--headingMd';
|
|
23622
|
+
case 'lg':
|
|
23623
|
+
return 'Polaris-Text--headingMd';
|
|
23624
|
+
default:
|
|
23625
|
+
return 'Polaris-Text--headingMd';
|
|
23626
|
+
}
|
|
23627
|
+
}, [size]);
|
|
23628
|
+
return (jsx(Box, { minHeight: sizeIcon, minWidth: sizeIcon, width: sizeIcon, borderRadius: "full", children: jsx("div", { className: "Polaris-GVariantBadge-Icon", style: { height: sizeIcon }, children: jsx("h2", { className: `Polaris-Text--headingMd Polaris-Text--semibold ${textColor} ${textSize}`, children: variant }) }) }));
|
|
23629
|
+
};
|
|
23630
|
+
|
|
23631
|
+
const CAMPAIGN_BACKGROUND = {
|
|
23632
|
+
ORIGIN: '#D5E5FF', //`var(--p-color-${CAMPAIGN_BACKGROUND.ORIGIN})`,
|
|
23633
|
+
VARIANT: '#FDDBE2', //`var(--p-color-${CAMPAIGN_BACKGROUND.VARIANT})`,
|
|
23634
|
+
SUBDUED: '#F2F2F2', //`var(--p-color-${CAMPAIGN_BACKGROUND.VARIANT})`,
|
|
23635
|
+
};
|
|
23636
|
+
const GVariantBadge = ({ label, variant, tone, isShowWinner, size = GVariantBadgeSize.MD, labelProps, linkAction, tooltip, hideVariant = false, }) => {
|
|
23637
|
+
const { t } = useTranslation();
|
|
23638
|
+
const background = tone === GVariantBadgeTone.ACTIVE
|
|
23639
|
+
? CAMPAIGN_BACKGROUND.ORIGIN
|
|
23640
|
+
: tone === GVariantBadgeTone.SUBDUED
|
|
23641
|
+
? CAMPAIGN_BACKGROUND.SUBDUED
|
|
23642
|
+
: CAMPAIGN_BACKGROUND.VARIANT;
|
|
23643
|
+
return (jsx(Box, { maxWidth: "100%", children: jsxs(InlineStack, { gap: "200", blockAlign: "center", wrap: false, children: [!hideVariant && (jsx("div", { className: "Polaris-GVariantBadge", style: { backgroundColor: background, borderRadius: '100%' }, children: jsx(GVariant, { variant: variant, size: size, tone: tone }) })), label && (jsx(GTextLink, { linkAction: linkAction, children: jsx(Text, { as: "h2", variant: "headingMd", ...labelProps, truncate: true, children: label }) })), tooltip && (jsx(GTooltip, { ...tooltip, children: jsx(Icon, { source: SvgInfoIcon }) })), isShowWinner && (jsx(Text, { as: "p", variant: "bodySm", fontWeight: "semibold", children: jsx(Badge, { tone: "success", children: t('Winner') }) }))] }) }));
|
|
23644
|
+
};
|
|
23645
|
+
|
|
23646
|
+
const CampaignsCellVersion = ({ version }) => {
|
|
23647
|
+
if (!version)
|
|
23648
|
+
return null;
|
|
23649
|
+
return jsx(GVariantBadge, { variant: version, tone: version === 'A' ? 'active' : 'inactive', size: "xs" });
|
|
23650
|
+
};
|
|
23651
|
+
|
|
23652
|
+
const CampaignsCell = ({ value, campaignsCellProps, }) => {
|
|
23653
|
+
const { orderId, isHideCampaignContent } = campaignsCellProps ?? {};
|
|
23654
|
+
const { t } = useTranslation();
|
|
23655
|
+
const { onViewOrderJourney } = useReportTableActionsContext();
|
|
23656
|
+
const [active, setActive] = useState(false);
|
|
23657
|
+
const toggleActive = useCallback(() => setActive((active) => !active), []);
|
|
23658
|
+
const campaignLeadingToOrder = value.at(0);
|
|
23659
|
+
const isShowPopupCampaigns = value.length > 1 && !isHideCampaignContent;
|
|
23660
|
+
if (!campaignLeadingToOrder)
|
|
23661
|
+
return null;
|
|
23662
|
+
return (jsx(Popover, { active: active, activator: jsxs("div", { className: cls('GReportTable__CellContent--clickable flex h-full w-full items-center px-2', {
|
|
23663
|
+
'cursor-pointer': isShowPopupCampaigns,
|
|
23664
|
+
'hover:!bg-[#f7f7f7]': !isShowPopupCampaigns,
|
|
23665
|
+
}), onClick: isShowPopupCampaigns ? toggleActive : undefined, children: [jsx(CampaignsCellVersion, { version: campaignLeadingToOrder.version }), !isHideCampaignContent && (jsxs(Fragment, { children: [jsx(Box, { minWidth: "0", paddingInlineStart: campaignLeadingToOrder.version ? '200' : '0', children: jsx(GTextTruncated, { as: "span", variant: "bodyMd", tone: "subdued", useWrapper: true, tooltip: { hoverDelay: 300 }, children: campaignLeadingToOrder.campaign_group_name || campaignLeadingToOrder.campaign_name }) }), isShowPopupCampaigns && (jsx("span", { className: "opacity-0 group-hover/GReportTable__Row:opacity-100", children: jsx(Icon, { source: SvgCaretDownIcon }) }))] }))] }), onClose: toggleActive, children: jsxs(Box, { padding: "0", width: "340px", overflowX: "hidden", children: [jsx(Box, { padding: "300", children: jsx(Text, { as: "p", variant: "bodyMd", fontWeight: "semibold", children: t('Experiments visited before order') }) }), jsx(Box, { borderBlockEndWidth: "025", borderBlockStartWidth: "025", borderColor: "border-secondary", children: jsx(Scrollable, { vertical: true, scrollbarWidth: "thin", horizontal: false, className: 'max-h-[216px]', children: jsx(Box, { paddingBlock: "200", children: value.map((campaign, index) => {
|
|
23666
|
+
return (jsx(Box, { paddingInline: "300", paddingBlock: "200", children: jsx(Box, { paddingBlock: "050", children: jsxs(InlineStack, { gap: "200", wrap: false, children: [jsx(CampaignsCellVersion, { version: campaign.version }), jsx(Box, { minWidth: "0", children: jsx(GTextTruncated, { as: "span", variant: "bodyMd", tone: "subdued", useWrapper: true, children: campaign.campaign_group_name || campaign.campaign_name }) })] }) }) }, index));
|
|
23667
|
+
}) }) }) }), jsx(Box, { padding: "300", children: jsx(Button, { icon: SvgChartLineIcon, fullWidth: true, onClick: () => onViewOrderJourney?.(orderId ?? ''), children: t('View order journey') }) })] }) }));
|
|
23668
|
+
};
|
|
23669
|
+
|
|
23670
|
+
const DateCell = ({ value, isMergedWithPrev }) => (jsx(Text, { as: "span", variant: "bodySm", children: isMergedWithPrev ? '' : value }));
|
|
23916
23671
|
|
|
23917
|
-
const
|
|
23918
|
-
|
|
23672
|
+
const GemxIdCell = ({ value, isMergedWithPrev, previousValue, columnLayout }) => {
|
|
23673
|
+
const valueString = typeof value === 'string' ? value : String(value);
|
|
23674
|
+
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, alignment: columnLayout?.align, children: isMergedWithPrev ? '' : valueString }) }) }));
|
|
23919
23675
|
};
|
|
23920
23676
|
|
|
23921
|
-
const
|
|
23922
|
-
|
|
23677
|
+
const CheckoutStartedDetail$1 = ({ lineItems = [], activatorWrapperProps }) => {
|
|
23678
|
+
const { t } = useTranslation();
|
|
23679
|
+
const [active, setActive] = useState(false);
|
|
23680
|
+
const toggleActive = useCallback(() => setActive((active) => !active), []);
|
|
23681
|
+
if (!lineItems || lineItems.length === 0) {
|
|
23923
23682
|
return null;
|
|
23924
|
-
|
|
23925
|
-
}
|
|
23926
|
-
|
|
23927
|
-
const
|
|
23928
|
-
|
|
23683
|
+
}
|
|
23684
|
+
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) => {
|
|
23685
|
+
const isLast = index === self.length - 1;
|
|
23686
|
+
const boxProps = {
|
|
23687
|
+
borderBlockEndWidth: '025',
|
|
23688
|
+
borderColor: 'border-secondary',
|
|
23689
|
+
paddingBlockEnd: '300',
|
|
23690
|
+
};
|
|
23691
|
+
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 w-full flex-col gap-1", 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));
|
|
23692
|
+
}) }) }) }));
|
|
23929
23693
|
};
|
|
23930
23694
|
|
|
23931
|
-
const
|
|
23932
|
-
const
|
|
23933
|
-
|
|
23695
|
+
const ItemsCell = ({ value }) => {
|
|
23696
|
+
const { t } = useTranslation();
|
|
23697
|
+
const { value: itemHovering, setTrue, setFalse } = useToggle(false);
|
|
23698
|
+
const lineItems = value.map((item) => ({
|
|
23699
|
+
imageURL: item.image_url,
|
|
23700
|
+
productTitle: item.product_title,
|
|
23701
|
+
quantity: Number(item.quantity) || 0,
|
|
23702
|
+
title: item.title,
|
|
23703
|
+
}));
|
|
23704
|
+
const getItemText = () => {
|
|
23705
|
+
const itemQuantity = value.reduce((acc, item) => acc + (Number(item.quantity) || 0), 0);
|
|
23706
|
+
if (itemQuantity === 1)
|
|
23707
|
+
return t('{{itemQuantity}} item', { itemQuantity });
|
|
23708
|
+
return t('{{itemQuantity}} items', { itemQuantity });
|
|
23709
|
+
};
|
|
23710
|
+
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: {
|
|
23711
|
+
paddingBlockStart: '100',
|
|
23712
|
+
opacity: itemHovering ? '1' : '0',
|
|
23713
|
+
} })] }) }));
|
|
23934
23714
|
};
|
|
23935
23715
|
|
|
23936
23716
|
const LoadingData = () => {
|
|
@@ -23992,410 +23772,667 @@ const OrderCellContainer = ({ value, columnLayout, orderCellProps, previousValue
|
|
|
23992
23772
|
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 }) }))] }));
|
|
23993
23773
|
};
|
|
23994
23774
|
|
|
23995
|
-
|
|
23996
|
-
|
|
23997
|
-
|
|
23998
|
-
|
|
23999
|
-
|
|
24000
|
-
|
|
24001
|
-
|
|
24002
|
-
}
|
|
24003
|
-
|
|
24004
|
-
|
|
24005
|
-
|
|
24006
|
-
|
|
24007
|
-
|
|
24008
|
-
|
|
24009
|
-
}
|
|
24010
|
-
|
|
24011
|
-
|
|
24012
|
-
|
|
24013
|
-
|
|
24014
|
-
|
|
24015
|
-
}
|
|
23775
|
+
const OrderIdCell = ({ value, isMockData }) => {
|
|
23776
|
+
const { t } = useTranslation();
|
|
23777
|
+
const [active, setActive] = useState(false);
|
|
23778
|
+
const { onViewOrderJourney, onViewOrderDetails } = useReportTableActionsContext();
|
|
23779
|
+
const toggleActive = useCallback(() => setActive((active) => !active), []);
|
|
23780
|
+
if (isMockData) {
|
|
23781
|
+
return (jsx(Text, { as: "span", variant: "bodyMd", tone: "subdued", children: value }));
|
|
23782
|
+
}
|
|
23783
|
+
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: [
|
|
23784
|
+
{
|
|
23785
|
+
id: 'view_order_journey',
|
|
23786
|
+
content: t('View order journey'),
|
|
23787
|
+
icon: SvgChartLineIcon,
|
|
23788
|
+
onAction: () => onViewOrderJourney?.(value),
|
|
23789
|
+
},
|
|
23790
|
+
{
|
|
23791
|
+
id: 'view_order_details',
|
|
23792
|
+
content: t('View order details on Shopify'),
|
|
23793
|
+
icon: SvgOrderIcon,
|
|
23794
|
+
onAction: () => onViewOrderDetails?.(value),
|
|
23795
|
+
},
|
|
23796
|
+
] }) }));
|
|
23797
|
+
};
|
|
24016
23798
|
|
|
24017
|
-
const
|
|
24018
|
-
|
|
24019
|
-
|
|
24020
|
-
|
|
24021
|
-
|
|
24022
|
-
|
|
24023
|
-
|
|
24024
|
-
|
|
24025
|
-
|
|
24026
|
-
|
|
24027
|
-
|
|
24028
|
-
|
|
24029
|
-
|
|
23799
|
+
const VERSION_LABEL = {
|
|
23800
|
+
[IVariantType.VARIANT_A]: 'Control A',
|
|
23801
|
+
[IVariantType.VARIANT_B]: 'Variant B',
|
|
23802
|
+
};
|
|
23803
|
+
const VERSION_OPTIONS = [
|
|
23804
|
+
{ label: VERSION_LABEL[IVariantType.VARIANT_A], value: IVariantType.VARIANT_A },
|
|
23805
|
+
{ label: VERSION_LABEL[IVariantType.VARIANT_B], value: IVariantType.VARIANT_B },
|
|
23806
|
+
];
|
|
23807
|
+
const VersionCell = ({ value, previousValue, isMergedWithPrev, columnLayout }) => {
|
|
23808
|
+
const variantValue = VERSION_OPTIONS.find((opt) => opt.label.split(' ')[1] === value);
|
|
23809
|
+
if (isMergedWithPrev)
|
|
23810
|
+
return '';
|
|
23811
|
+
return (jsx(WrapperCell, { previousValue: previousValue, isMergedWithPrev: isMergedWithPrev, columnLayout: columnLayout, children: variantValue && (jsx(GVariantBadge, { variant: variantValue.value, tone: variantValue.value === 'A' ? 'active' : 'inactive', size: "xs" })) }));
|
|
23812
|
+
};
|
|
23813
|
+
|
|
23814
|
+
const isString = (value) => typeof value === 'string';
|
|
23815
|
+
const isNonEmptyArray = (value) => Array.isArray(value) && value.length > 0;
|
|
23816
|
+
const isOrderExperiments = (value) => {
|
|
23817
|
+
return isNonEmptyArray(value);
|
|
23818
|
+
};
|
|
23819
|
+
const isOrderItems = (value) => {
|
|
23820
|
+
return isNonEmptyArray(value);
|
|
23821
|
+
};
|
|
23822
|
+
const cellMap = {
|
|
23823
|
+
[EDimensionKey.VERSION]: ({ value, isMergedWithPrev }) => {
|
|
23824
|
+
if (!isString(value))
|
|
23825
|
+
return null;
|
|
23826
|
+
return jsx(VersionCell, { value: value, isMergedWithPrev: isMergedWithPrev });
|
|
23827
|
+
},
|
|
23828
|
+
[IRMetricKey.ORDERS]: ({ value, columnLayout, orderCellProps, previousValue, isTotalRow, isMockData }) => {
|
|
23829
|
+
if (!isString(value))
|
|
23830
|
+
return null;
|
|
23831
|
+
return (jsx(OrderCellContainer, { value: value, columnLayout: columnLayout, orderCellProps: orderCellProps, previousValue: previousValue, isTotalRow: isTotalRow, isMockData: isMockData }));
|
|
23832
|
+
},
|
|
23833
|
+
[EReportColumnKey.ORDER_DATE]: ({ value, isMergedWithPrev }) => {
|
|
23834
|
+
if (!isString(value))
|
|
23835
|
+
return null;
|
|
23836
|
+
return jsx(DateCell, { value: value, isMergedWithPrev: isMergedWithPrev });
|
|
23837
|
+
},
|
|
23838
|
+
[EReportColumnKey.ITEMS]: ({ value }) => {
|
|
23839
|
+
if (!isOrderItems(value))
|
|
23840
|
+
return null;
|
|
23841
|
+
return jsx(ItemsCell, { value: value });
|
|
23842
|
+
},
|
|
23843
|
+
[EReportColumnKey.CAMPAIGNS]: ({ value, campaignsCellProps }) => {
|
|
23844
|
+
if (!isOrderExperiments(value))
|
|
23845
|
+
return null;
|
|
23846
|
+
return jsx(CampaignsCell, { value: value, campaignsCellProps: campaignsCellProps });
|
|
23847
|
+
},
|
|
23848
|
+
[EReportColumnKey.ORDER_ID]: ({ value, isMockData }) => {
|
|
23849
|
+
if (!isString(value))
|
|
23850
|
+
return null;
|
|
23851
|
+
return jsx(OrderIdCell, { value: value, isMockData: isMockData });
|
|
23852
|
+
},
|
|
23853
|
+
[EReportColumnKey.GEMX_ID]: ({ value, isMergedWithPrev, previousValue, columnLayout }) => {
|
|
23854
|
+
if (!isString(value))
|
|
23855
|
+
return null;
|
|
23856
|
+
return (jsx(GemxIdCell, { value: value, isMergedWithPrev: isMergedWithPrev, previousValue: previousValue, columnLayout: columnLayout }));
|
|
23857
|
+
},
|
|
23858
|
+
};
|
|
23859
|
+
|
|
23860
|
+
const TotalCell = ({ value, isTotalRow }) => (jsx(Text, { as: "span", variant: "bodySm", fontWeight: isTotalRow ? 'semibold' : 'regular', children: value }));
|
|
23861
|
+
|
|
23862
|
+
const NoneCell = ({ isMergedWithPrev, previousValue, columnLayout }) => {
|
|
23863
|
+
return (jsx(WrapperCell, { previousValue: previousValue, isMergedWithPrev: isMergedWithPrev, columnLayout: columnLayout, children: jsx("div", { className: "w-[11px] h-[2px] bg-[#8A8A8A]" }) }));
|
|
23864
|
+
};
|
|
23865
|
+
|
|
23866
|
+
const Cell = ({ value, isMergedWithPrev, columnLayout, name, isDimensionCol, formatter, hasTooltipCard, previousValue, orderCellProps, campaignsCellProps, isTotalRow, isMockData, }) => {
|
|
23867
|
+
const columnLayoutStyles = getColumnLayoutStyles(columnLayout, hasTooltipCard);
|
|
23868
|
+
const { formatData } = useReportData();
|
|
23869
|
+
const formattedValue = formatData({ value, formatter, name });
|
|
23870
|
+
const formattedPreviousValue = typeof previousValue === 'undefined' ? previousValue : formatData({ value: previousValue, formatter, name });
|
|
23871
|
+
const cellStyles = {
|
|
23872
|
+
borderTop: isMergedWithPrev ? '0' : undefined,
|
|
23873
|
+
...columnLayoutStyles,
|
|
23874
|
+
};
|
|
23875
|
+
const renderContent = () => {
|
|
23876
|
+
if (value === 'Total') {
|
|
23877
|
+
return jsx(TotalCell, { value: value, isTotalRow: isTotalRow });
|
|
24030
23878
|
}
|
|
24031
|
-
|
|
24032
|
-
|
|
24033
|
-
|
|
24034
|
-
'text-variant-subdued': tone === 'subdued',
|
|
24035
|
-
'text-variant-b': !tone || tone === 'inactive',
|
|
24036
|
-
});
|
|
24037
|
-
const textSize = useMemo(() => {
|
|
24038
|
-
switch (size) {
|
|
24039
|
-
case 'xs':
|
|
24040
|
-
return 'Polaris-Text--bodyXs';
|
|
24041
|
-
case 'sm':
|
|
24042
|
-
return 'Polaris-Text--bodySm';
|
|
24043
|
-
case 'md':
|
|
24044
|
-
return 'Polaris-Text--headingMd';
|
|
24045
|
-
case 'lg':
|
|
24046
|
-
return 'Polaris-Text--headingMd';
|
|
24047
|
-
default:
|
|
24048
|
-
return 'Polaris-Text--headingMd';
|
|
23879
|
+
let Renderer = cellMap[name] ?? DefaultCell;
|
|
23880
|
+
if (formattedValue === NONE_VALUE) {
|
|
23881
|
+
Renderer = NoneCell;
|
|
24049
23882
|
}
|
|
24050
|
-
|
|
24051
|
-
|
|
23883
|
+
return (jsx(Renderer, { value: formattedValue, name: name, isMergedWithPrev: isMergedWithPrev, previousValue: formattedPreviousValue, columnLayout: columnLayout, orderCellProps: orderCellProps, campaignsCellProps: campaignsCellProps, isTotalRow: isTotalRow, isDimensionCol: isDimensionCol, isMockData: isMockData }));
|
|
23884
|
+
};
|
|
23885
|
+
return (jsx("div", { className: cls('GReportTable__Cell', { 'GReportTable__Cell--dimension': isDimensionCol }), style: cellStyles, children: jsx("div", { className: "GReportTable__CellContent", style: columnLayoutStyles, children: renderContent() }) }));
|
|
24052
23886
|
};
|
|
24053
23887
|
|
|
24054
|
-
const
|
|
24055
|
-
|
|
24056
|
-
|
|
24057
|
-
|
|
24058
|
-
|
|
24059
|
-
const
|
|
24060
|
-
|
|
24061
|
-
|
|
24062
|
-
|
|
24063
|
-
|
|
24064
|
-
|
|
24065
|
-
|
|
24066
|
-
|
|
23888
|
+
const Row = ({ row, rowIndex, columns, dimensions, prevRow, columnLayoutMap, orderCellProps, isHideCampaignContent, minWidth, isMockData, }) => {
|
|
23889
|
+
const checkMergedWithPrev = (col) => {
|
|
23890
|
+
const isDimensionCol = dimensions.includes(col);
|
|
23891
|
+
let isMergedWithPrev = false;
|
|
23892
|
+
if (isDimensionCol && rowIndex > 0 && prevRow) {
|
|
23893
|
+
const dimIndex = dimensions.indexOf(col);
|
|
23894
|
+
const allMatch = dimensions.slice(0, dimIndex + 1).every((d) => row[d] === prevRow[d]);
|
|
23895
|
+
isMergedWithPrev = allMatch;
|
|
23896
|
+
}
|
|
23897
|
+
return isMergedWithPrev;
|
|
23898
|
+
};
|
|
23899
|
+
const customOrderCellProps = orderCellProps
|
|
23900
|
+
? {
|
|
23901
|
+
...orderCellProps,
|
|
23902
|
+
onClickOrderCell: (data) => orderCellProps?.onClickOrderCell({ row, isPrevious: data.isPrevious }),
|
|
23903
|
+
}
|
|
23904
|
+
: orderCellProps;
|
|
23905
|
+
return (jsx("div", { className: "GReportTable__Row group/GReportTable__Row", style: { minWidth }, children: columns.map((col) => {
|
|
23906
|
+
const hasTooltipCard = !!col.tooltipCardProps;
|
|
23907
|
+
const orderId = row[EReportColumnKey.ORDER_ID]?.toString() ?? '';
|
|
23908
|
+
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));
|
|
23909
|
+
}) }));
|
|
24067
23910
|
};
|
|
24068
23911
|
|
|
24069
|
-
const
|
|
24070
|
-
|
|
24071
|
-
return null;
|
|
24072
|
-
return jsx(GVariantBadge, { variant: version, tone: version === 'A' ? 'active' : 'inactive', size: "xs" });
|
|
23912
|
+
const SummaryCell = ({ currentValue, previousValue, showPrevious, columnLayout }) => {
|
|
23913
|
+
return (jsxs(GInlineCenter, { flexDirection: "column", align: columnLayout.align, gap: "100", paddingBlock: "200", children: [jsx(Text, { as: "span", variant: "bodySm", fontWeight: "semibold", children: currentValue }), showPrevious && typeof previousValue !== 'object' && (jsx(Text, { as: "span", variant: "bodySm", fontWeight: "semibold", tone: "subdued", children: previousValue }))] }));
|
|
24073
23914
|
};
|
|
24074
23915
|
|
|
24075
|
-
const
|
|
24076
|
-
const { orderId, isHideCampaignContent } = campaignsCellProps ?? {};
|
|
23916
|
+
const SummaryRow = ({ columns, row, dimensions, summary, columnLayoutMap }) => {
|
|
24077
23917
|
const { t } = useTranslation();
|
|
24078
|
-
const {
|
|
24079
|
-
const
|
|
24080
|
-
|
|
24081
|
-
const campaignLeadingToOrder = value.at(0);
|
|
24082
|
-
const isShowPopupCampaigns = value.length > 1 && !isHideCampaignContent;
|
|
24083
|
-
if (!campaignLeadingToOrder)
|
|
23918
|
+
const { showPrevious, previousContent, content } = summary || {};
|
|
23919
|
+
const { formatData } = useReportData();
|
|
23920
|
+
if (summary?.hide || !dimensions.length)
|
|
24084
23921
|
return null;
|
|
24085
|
-
|
|
24086
|
-
|
|
24087
|
-
|
|
24088
|
-
|
|
24089
|
-
|
|
24090
|
-
|
|
23922
|
+
const getCellValue = (columnName, index, formatter) => {
|
|
23923
|
+
const layout = columnLayoutMap[columnName];
|
|
23924
|
+
if (index === 0)
|
|
23925
|
+
return (jsx(SummaryCell, { currentValue: content || t('Summary'), showPrevious: showPrevious, previousValue: previousContent, columnLayout: layout }));
|
|
23926
|
+
const isDimensionCol = dimensions.includes(columnName);
|
|
23927
|
+
if (isDimensionCol)
|
|
23928
|
+
return '';
|
|
23929
|
+
const cellValue = row?.[getTotalColumnName(columnName)];
|
|
23930
|
+
const previousValue = row?.[getPreviousTotalColumnName(columnName)];
|
|
23931
|
+
const formattedValue = cellValue == null ? cellValue : formatData({ value: cellValue, formatter, name: columnName });
|
|
23932
|
+
const formattedPreviousValue = previousValue == null ? previousValue : formatData({ value: previousValue, formatter, name: columnName });
|
|
23933
|
+
if (typeof formattedValue === 'object')
|
|
23934
|
+
return '';
|
|
23935
|
+
return (jsx(SummaryCell, { currentValue: formattedValue, showPrevious: showPrevious, previousValue: formattedPreviousValue, columnLayout: layout }));
|
|
23936
|
+
};
|
|
23937
|
+
return (jsx("div", { className: "GReportTable__Summary-Row", children: columns.map(({ name, dataType }, index) => (jsx("div", { className: "GReportTable__Summary-Cell", style: getColumnLayoutStyles(columnLayoutMap[name]), children: getCellValue(name, index, dataType) }, name))) }));
|
|
24091
23938
|
};
|
|
24092
23939
|
|
|
24093
|
-
const
|
|
24094
|
-
[
|
|
24095
|
-
|
|
24096
|
-
|
|
24097
|
-
const VERSION_OPTIONS = [
|
|
24098
|
-
{ label: VERSION_LABEL[IVariantType.VARIANT_A], value: IVariantType.VARIANT_A },
|
|
24099
|
-
{ label: VERSION_LABEL[IVariantType.VARIANT_B], value: IVariantType.VARIANT_B },
|
|
24100
|
-
];
|
|
24101
|
-
const VersionCell = ({ value, previousValue, isMergedWithPrev, columnLayout }) => {
|
|
24102
|
-
const variantValue = VERSION_OPTIONS.find((opt) => opt.label.split(' ')[1] === value);
|
|
24103
|
-
if (isMergedWithPrev)
|
|
24104
|
-
return '';
|
|
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" })) }));
|
|
23940
|
+
const getOrderTooltip = (field, direction) => {
|
|
23941
|
+
if (!reportOrderTooltip[field])
|
|
23942
|
+
return DEFAULT_TOOLTIP[direction];
|
|
23943
|
+
return reportOrderTooltip[field][direction];
|
|
24106
23944
|
};
|
|
24107
23945
|
|
|
24108
|
-
const
|
|
24109
|
-
const {
|
|
24110
|
-
|
|
24111
|
-
|
|
24112
|
-
|
|
24113
|
-
|
|
24114
|
-
|
|
23946
|
+
const SortableHeaderWithTooltip = ({ item, orderBy, onChangeOrderBy }) => {
|
|
23947
|
+
const { displayName, name, tooltipCardProps } = item;
|
|
23948
|
+
return (jsxs(InlineStack, { gap: "050", blockAlign: "center", children: [jsx(GTooltipCard, { ...tooltipCardProps, children: jsx(Text, { as: "span", variant: "bodySm", fontWeight: "medium", truncate: true, tone: "subdued", children: displayName }) }), hasOrderByName(name) && (jsx("div", { className: "-mb-1", children: jsx(GButton, { variant: "plain", icon: getOrderIcon(name), tooltip: getSortTooltip(name), onClick: () => onChangeOrderBy?.(name) }) }))] }));
|
|
23949
|
+
function hasOrderByName(name) {
|
|
23950
|
+
const orderByField = orderBy?.[name];
|
|
23951
|
+
return !!orderByField;
|
|
23952
|
+
}
|
|
23953
|
+
function getSortTooltip(name) {
|
|
23954
|
+
const orderByField = orderBy?.[name];
|
|
23955
|
+
if (!hasOrderByName(name) || !orderByField)
|
|
23956
|
+
return undefined;
|
|
23957
|
+
const content = getOrderTooltip(name, orderByField?.direction);
|
|
23958
|
+
return { content };
|
|
23959
|
+
}
|
|
23960
|
+
function getOrderIcon(name) {
|
|
23961
|
+
const orderByField = orderBy?.[name];
|
|
23962
|
+
if (!orderByField)
|
|
23963
|
+
return SvgArrowUpIcon;
|
|
23964
|
+
return orderByField.direction === EOrderDirectionType.ASC ? SvgArrowUpIcon : SvgArrowDownIcon;
|
|
24115
23965
|
}
|
|
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: [
|
|
24117
|
-
{
|
|
24118
|
-
id: 'view_order_journey',
|
|
24119
|
-
content: t('View order journey'),
|
|
24120
|
-
icon: SvgChartLineIcon,
|
|
24121
|
-
onAction: () => onViewOrderJourney?.(value),
|
|
24122
|
-
},
|
|
24123
|
-
{
|
|
24124
|
-
id: 'view_order_details',
|
|
24125
|
-
content: t('View order details on Shopify'),
|
|
24126
|
-
icon: SvgOrderIcon,
|
|
24127
|
-
onAction: () => onViewOrderDetails?.(value),
|
|
24128
|
-
},
|
|
24129
|
-
] }) }));
|
|
24130
23966
|
};
|
|
24131
23967
|
|
|
24132
|
-
const
|
|
24133
|
-
|
|
24134
|
-
|
|
24135
|
-
|
|
24136
|
-
|
|
24137
|
-
|
|
24138
|
-
if (!lineItems || lineItems.length === 0) {
|
|
24139
|
-
return null;
|
|
23968
|
+
const SortableHeader = ({ item, orderBy, itemHovering, onChangeOrderBy }) => {
|
|
23969
|
+
const { displayName, name } = item;
|
|
23970
|
+
function getTooltipInfo(name) {
|
|
23971
|
+
const orderByField = orderBy?.[name];
|
|
23972
|
+
const content = getOrderTooltip(name, orderByField?.direction || EOrderDirectionType.ASC);
|
|
23973
|
+
return { content };
|
|
24140
23974
|
}
|
|
24141
|
-
|
|
24142
|
-
|
|
24143
|
-
|
|
24144
|
-
|
|
24145
|
-
|
|
24146
|
-
|
|
24147
|
-
|
|
24148
|
-
|
|
24149
|
-
|
|
23975
|
+
function getOpacity(name) {
|
|
23976
|
+
return itemHovering === name ? '1' : '0';
|
|
23977
|
+
}
|
|
23978
|
+
function getOrderIcon(name) {
|
|
23979
|
+
const orderByField = orderBy?.[name];
|
|
23980
|
+
if (!orderByField)
|
|
23981
|
+
return SvgSortAscendingIcon;
|
|
23982
|
+
return orderByField.direction === EOrderDirectionType.ASC ? SvgSortAscendingIcon : SvgSortDescendingIcon;
|
|
23983
|
+
}
|
|
23984
|
+
return (jsxs("button", { className: "GReportTable-SortableHeaderButton", onClick: () => onChangeOrderBy?.(name), children: [jsx("div", { className: "min-w-0", children: jsx(GTextTruncated, { as: "p", variant: "bodySm", fontWeight: "medium", tone: "subdued", tooltip: getTooltipInfo(name), children: displayName }) }), jsx(Box, { opacity: getOpacity(name), children: jsx(Icon, { source: getOrderIcon(name) }) })] }));
|
|
24150
23985
|
};
|
|
24151
23986
|
|
|
24152
|
-
const
|
|
24153
|
-
const
|
|
24154
|
-
|
|
24155
|
-
|
|
24156
|
-
|
|
24157
|
-
|
|
24158
|
-
|
|
24159
|
-
|
|
24160
|
-
|
|
24161
|
-
const getItemText = () => {
|
|
24162
|
-
const itemQuantity = value.reduce((acc, item) => acc + (Number(item.quantity) || 0), 0);
|
|
24163
|
-
if (itemQuantity === 1)
|
|
24164
|
-
return t('{{itemQuantity}} item', { itemQuantity });
|
|
24165
|
-
return t('{{itemQuantity}} items', { itemQuantity });
|
|
24166
|
-
};
|
|
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: {
|
|
24168
|
-
paddingBlockStart: '100',
|
|
24169
|
-
opacity: itemHovering ? '1' : '0',
|
|
24170
|
-
} })] }) }));
|
|
23987
|
+
const Header = ({ columns, columnLayoutMap, activeColumn, orderBy, showSummary, onChangeOrderBy, }) => {
|
|
23988
|
+
const [itemHovering, setItemHovering] = useState();
|
|
23989
|
+
return (jsx("div", { className: cls('GReportTable__Header', {
|
|
23990
|
+
'GReportTable__Header--hide-summary': !showSummary,
|
|
23991
|
+
}), children: columns.map((item) => {
|
|
23992
|
+
const isTooltipCard = !!item.tooltipCardProps;
|
|
23993
|
+
const SortableHeaderComponent = isTooltipCard ? SortableHeaderWithTooltip : SortableHeader;
|
|
23994
|
+
return (jsxs("div", { className: "GReportTable__Header-Cell", style: getColumnLayoutStyles(columnLayoutMap[item.name]), onMouseEnter: () => setItemHovering(item.name), onMouseLeave: () => setItemHovering(undefined), children: [activeColumn === item.name && (jsx(Box, { children: jsx(Icon, { source: SvgCheckIcon }) })), jsx(SortableHeaderComponent, { item: item, orderBy: orderBy, itemHovering: itemHovering, onChangeOrderBy: onChangeOrderBy, ...item.tooltipCardProps })] }, item.name));
|
|
23995
|
+
}) }));
|
|
24171
23996
|
};
|
|
24172
23997
|
|
|
24173
|
-
const
|
|
24174
|
-
|
|
24175
|
-
|
|
24176
|
-
|
|
23998
|
+
const WrapperHeader = forwardRef(({ columns, dimensions, row, columnLayoutMap, activeColumn, orderBy, summary, minWidth, onChangeOrderBy }, ref) => {
|
|
23999
|
+
return (jsx("div", { className: "GReportTable__StickyHeader", ref: ref, children: jsxs("div", { style: { minWidth }, children: [jsx(Header, { columns: columns, columnLayoutMap: columnLayoutMap, activeColumn: activeColumn, orderBy: orderBy, showSummary: !summary?.hide && !!dimensions.length, onChangeOrderBy: onChangeOrderBy }), jsx(SummaryRow, { columns: columns, row: row, dimensions: dimensions, summary: summary, columnLayoutMap: columnLayoutMap })] }) }));
|
|
24000
|
+
});
|
|
24001
|
+
WrapperHeader.displayName = 'WrapperHeader';
|
|
24002
|
+
|
|
24003
|
+
const mockDimensions = ['session_device_type', 'month', 'session_country', 'session_device_os'];
|
|
24004
|
+
const mockMetrics = ['online_store_visitors', 'sessions', 'bounces'];
|
|
24005
|
+
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, }) => {
|
|
24006
|
+
const { summary = {}, hideBorderTop, hidePaginationRow } = options ?? {};
|
|
24007
|
+
const { columns, rows } = useReportTable({ dimensions, metrics, tableData: data ?? { columns: [], rows: [] } });
|
|
24008
|
+
const { headerRef, bodyRef, scrollbarContainerRef, leftShadowRef, rightShadowRef } = useSyncedScroll({ columns });
|
|
24009
|
+
const tableDimensionLayout = dimensionLayout ?? DEFAULT_DIMENSION_LAYOUT;
|
|
24010
|
+
const isEmpty = rows.length === 0;
|
|
24011
|
+
const totalPaginationRows = hidePaginationRow ? 0 : rows.length;
|
|
24012
|
+
const isHasTotalRows = Boolean(totalPaginationRows && totalPaginationRows > 0);
|
|
24013
|
+
const isPaginationHidden = !isHasTotalRows && !showViewAllButton && !paginationProps;
|
|
24014
|
+
const columnLayoutMap = useMemo(() => {
|
|
24015
|
+
return columns.reduce((acc, col) => {
|
|
24016
|
+
const tableMetricLayout = metricLayouts?.[col.name] ?? DEFAULT_METRIC_LAYOUT;
|
|
24017
|
+
acc[col.name] = dimensions.includes(col.name) ? tableDimensionLayout : tableMetricLayout;
|
|
24018
|
+
return acc;
|
|
24019
|
+
}, {});
|
|
24020
|
+
}, [columns, metricLayouts, tableDimensionLayout, dimensions]);
|
|
24021
|
+
const totalTableWidth = useMemo(() => {
|
|
24022
|
+
return columns.reduce((acc, col) => {
|
|
24023
|
+
const layout = columnLayoutMap[col.name];
|
|
24024
|
+
const widthStr = layout?.minWidth || '0';
|
|
24025
|
+
const widthVal = parseInt(widthStr, 10) || 0;
|
|
24026
|
+
return acc + widthVal;
|
|
24027
|
+
}, 0);
|
|
24028
|
+
}, [columns, columnLayoutMap]);
|
|
24029
|
+
if (isLoading)
|
|
24030
|
+
return jsx(ReportTableSkeleton, { ...skeletons });
|
|
24031
|
+
if (isEmpty)
|
|
24032
|
+
return emptyStateComponent ? (jsx(ReportTableActionsProvider, { onViewAllStoreOrders: onViewAllStoreOrders, children: renderEmptyState() })) : null;
|
|
24033
|
+
return (jsx(ReportTableActionsProvider, { onViewOrderJourney: onViewOrderJourney, onViewOrderDetails: onViewOrderDetails, onViewAllStoreOrders: onViewAllStoreOrders, children: jsxs("div", { className: cls('GReportTable__Container', {
|
|
24034
|
+
'GReportTable__Container--border-top': !hideBorderTop,
|
|
24035
|
+
'GReportTable__Container--pagination-hidden': isPaginationHidden,
|
|
24036
|
+
}), 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 })] }) }));
|
|
24037
|
+
function renderEmptyState() {
|
|
24038
|
+
return (jsxs("div", { className: cls('GReportTable__Container', {
|
|
24039
|
+
'GReportTable__Container--border-top': !hideBorderTop,
|
|
24040
|
+
}), children: [emptyStateComponent, jsx(WrapperFooter, { totalPaginationRows: 0, itemCount: itemCount, showViewAllButton: showViewAllButton, paginationProps: paginationProps, isPaginationHidden: true, isMockData: isMockData })] }));
|
|
24041
|
+
}
|
|
24177
24042
|
};
|
|
24178
|
-
|
|
24179
|
-
|
|
24043
|
+
|
|
24044
|
+
const ORDER_LISTING_DIMENSION_LAYOUT = {
|
|
24045
|
+
width: '158px',
|
|
24046
|
+
minWidth: '158px',
|
|
24047
|
+
maxWidth: '158px',
|
|
24048
|
+
paddingInline: '12px',
|
|
24049
|
+
columnFirstPaddingInline: '12px',
|
|
24050
|
+
align: 'start',
|
|
24051
|
+
dimensionBoxShadow: 'none',
|
|
24052
|
+
borderRightWidth: '0px',
|
|
24053
|
+
};
|
|
24054
|
+
// Remaining space after fixed Order ID column
|
|
24055
|
+
const METRIC_COLUMN_MAX_WIDTH = `max(var(--column-cell-min-width), calc(100% - ${ORDER_LISTING_DIMENSION_LAYOUT.width}))`;
|
|
24056
|
+
const ORDER_LISTING_METRIC_LAYOUTS = {
|
|
24057
|
+
[EReportColumnKey.GEMX_ID]: {
|
|
24058
|
+
minWidth: '119.5px',
|
|
24059
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24060
|
+
align: 'start',
|
|
24061
|
+
columnWrapperWidth: '100%',
|
|
24062
|
+
},
|
|
24063
|
+
[EReportColumnKey.ORDER_DATE]: {
|
|
24064
|
+
minWidth: '180px',
|
|
24065
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24066
|
+
align: 'start',
|
|
24067
|
+
},
|
|
24068
|
+
[EReportColumnKey.TOTAL]: {
|
|
24069
|
+
minWidth: '120px',
|
|
24070
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24071
|
+
align: 'end',
|
|
24072
|
+
},
|
|
24073
|
+
[EReportColumnKey.CAMPAIGNS]: {
|
|
24074
|
+
minWidth: '246px',
|
|
24075
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24076
|
+
align: 'start',
|
|
24077
|
+
columnWrapperWidth: '100%',
|
|
24078
|
+
},
|
|
24079
|
+
[EReportColumnKey.TRAFFIC_SOURCE]: {
|
|
24080
|
+
minWidth: '120px',
|
|
24081
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24082
|
+
align: 'start',
|
|
24083
|
+
},
|
|
24084
|
+
[EReportColumnKey.DEVICE]: {
|
|
24085
|
+
minWidth: '120px',
|
|
24086
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24087
|
+
align: 'start',
|
|
24088
|
+
},
|
|
24089
|
+
[EReportColumnKey.VISITOR]: {
|
|
24090
|
+
minWidth: '120px',
|
|
24091
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24092
|
+
align: 'start',
|
|
24093
|
+
},
|
|
24094
|
+
[EReportColumnKey.ITEMS]: {
|
|
24095
|
+
minWidth: '140px',
|
|
24096
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24097
|
+
align: 'start',
|
|
24098
|
+
},
|
|
24180
24099
|
};
|
|
24181
|
-
const
|
|
24182
|
-
|
|
24183
|
-
|
|
24184
|
-
|
|
24185
|
-
|
|
24100
|
+
const ORDER_LISTING_COLUMNS = [
|
|
24101
|
+
{
|
|
24102
|
+
name: EReportColumnKey.ORDER_ID,
|
|
24103
|
+
dataType: EReportDataType.STRING,
|
|
24104
|
+
displayName: 'Order ID',
|
|
24105
|
+
tooltipCardProps: {
|
|
24106
|
+
tooltip: {
|
|
24107
|
+
title: 'Order ID',
|
|
24108
|
+
content: 'Shopify identifier for the order',
|
|
24109
|
+
width: 'wide',
|
|
24110
|
+
},
|
|
24111
|
+
},
|
|
24186
24112
|
},
|
|
24187
|
-
|
|
24188
|
-
|
|
24189
|
-
|
|
24190
|
-
|
|
24113
|
+
{
|
|
24114
|
+
name: EReportColumnKey.GEMX_ID,
|
|
24115
|
+
dataType: EReportDataType.STRING,
|
|
24116
|
+
displayName: 'GemX ID',
|
|
24117
|
+
tooltipCardProps: {
|
|
24118
|
+
tooltip: {
|
|
24119
|
+
title: 'GemX ID',
|
|
24120
|
+
content: 'A tracking ID GemX attaches to the order so you can trace where it came from',
|
|
24121
|
+
width: 'wide',
|
|
24122
|
+
},
|
|
24123
|
+
},
|
|
24191
24124
|
},
|
|
24192
|
-
|
|
24193
|
-
|
|
24194
|
-
|
|
24195
|
-
|
|
24125
|
+
{
|
|
24126
|
+
name: EReportColumnKey.ORDER_DATE,
|
|
24127
|
+
dataType: EReportDataType.DATE,
|
|
24128
|
+
displayName: 'Date',
|
|
24129
|
+
tooltipCardProps: {
|
|
24130
|
+
tooltip: {
|
|
24131
|
+
title: 'Date',
|
|
24132
|
+
content: 'Date when the order was placed',
|
|
24133
|
+
width: 'wide',
|
|
24134
|
+
},
|
|
24135
|
+
},
|
|
24196
24136
|
},
|
|
24197
|
-
|
|
24198
|
-
|
|
24199
|
-
|
|
24200
|
-
|
|
24137
|
+
{
|
|
24138
|
+
name: EReportColumnKey.TOTAL,
|
|
24139
|
+
dataType: EReportDataType.CURRENCY,
|
|
24140
|
+
displayName: 'Total',
|
|
24141
|
+
tooltipCardProps: {
|
|
24142
|
+
tooltip: {
|
|
24143
|
+
title: 'Total',
|
|
24144
|
+
content: 'The money amount customers paid for the order',
|
|
24145
|
+
width: 'wide',
|
|
24146
|
+
},
|
|
24147
|
+
},
|
|
24201
24148
|
},
|
|
24202
|
-
|
|
24203
|
-
|
|
24204
|
-
|
|
24205
|
-
|
|
24149
|
+
{
|
|
24150
|
+
name: EReportColumnKey.CAMPAIGNS,
|
|
24151
|
+
dataType: EReportDataType.OBJECT,
|
|
24152
|
+
displayName: 'Experiment version',
|
|
24153
|
+
tooltipCardProps: {
|
|
24154
|
+
tooltip: {
|
|
24155
|
+
title: 'Experiment',
|
|
24156
|
+
content: 'The specific template variant shown to the customer that resulted in the order',
|
|
24157
|
+
width: 'wide',
|
|
24158
|
+
},
|
|
24159
|
+
},
|
|
24206
24160
|
},
|
|
24207
|
-
|
|
24208
|
-
|
|
24209
|
-
|
|
24210
|
-
|
|
24161
|
+
{
|
|
24162
|
+
name: EReportColumnKey.TRAFFIC_SOURCE,
|
|
24163
|
+
dataType: EReportDataType.STRING,
|
|
24164
|
+
displayName: 'Traffic source',
|
|
24165
|
+
tooltipCardProps: {
|
|
24166
|
+
tooltip: {
|
|
24167
|
+
title: 'Traffic source',
|
|
24168
|
+
content: 'Where your customers came from',
|
|
24169
|
+
width: 'wide',
|
|
24170
|
+
},
|
|
24171
|
+
},
|
|
24172
|
+
},
|
|
24173
|
+
{
|
|
24174
|
+
name: EReportColumnKey.DEVICE,
|
|
24175
|
+
dataType: EReportDataType.STRING,
|
|
24176
|
+
displayName: 'Device',
|
|
24177
|
+
tooltipCardProps: {
|
|
24178
|
+
tooltip: {
|
|
24179
|
+
title: 'Device',
|
|
24180
|
+
content: 'Device customers used to place the order',
|
|
24181
|
+
width: 'wide',
|
|
24182
|
+
},
|
|
24183
|
+
},
|
|
24184
|
+
},
|
|
24185
|
+
{
|
|
24186
|
+
name: EReportColumnKey.VISITOR,
|
|
24187
|
+
dataType: EReportDataType.STRING,
|
|
24188
|
+
displayName: 'Customer type',
|
|
24189
|
+
tooltipCardProps: {
|
|
24190
|
+
tooltip: {
|
|
24191
|
+
title: 'Customer type',
|
|
24192
|
+
content: 'Customers who placed the order',
|
|
24193
|
+
width: 'wide',
|
|
24194
|
+
},
|
|
24195
|
+
},
|
|
24196
|
+
},
|
|
24197
|
+
{
|
|
24198
|
+
name: EReportColumnKey.ITEMS,
|
|
24199
|
+
dataType: EReportDataType.OBJECT,
|
|
24200
|
+
displayName: 'Items',
|
|
24201
|
+
tooltipCardProps: {
|
|
24202
|
+
tooltip: {
|
|
24203
|
+
title: 'Items',
|
|
24204
|
+
content: 'Number of units across all line items in the order',
|
|
24205
|
+
width: 'wide',
|
|
24206
|
+
},
|
|
24207
|
+
},
|
|
24211
24208
|
},
|
|
24209
|
+
];
|
|
24210
|
+
const ORDER_LISTING_LATEST_COLUMNS_FOR_PAGE = ORDER_LISTING_COLUMNS.filter((column) => ![EReportColumnKey.CAMPAIGNS, EReportColumnKey.GEMX_ID].includes(column.name));
|
|
24211
|
+
const ORDER_LISTING_METRICS = [
|
|
24212
|
+
EReportColumnKey.GEMX_ID,
|
|
24213
|
+
EReportColumnKey.ORDER_DATE,
|
|
24214
|
+
EReportColumnKey.TOTAL,
|
|
24215
|
+
EReportColumnKey.CAMPAIGNS,
|
|
24216
|
+
EReportColumnKey.TRAFFIC_SOURCE,
|
|
24217
|
+
EReportColumnKey.DEVICE,
|
|
24218
|
+
EReportColumnKey.VISITOR,
|
|
24219
|
+
EReportColumnKey.ITEMS,
|
|
24220
|
+
];
|
|
24221
|
+
const ORDER_LISTING_DIMENSIONS = ['order_id'];
|
|
24222
|
+
const ORDER_LISTING_CONFIG = {
|
|
24223
|
+
SHOW_LATEST_ORDER_LISTING_AMOUNT: 5,
|
|
24212
24224
|
};
|
|
24225
|
+
const SORT_ORDER_LISTING_DEFAULT = [`${EReportColumnKey.ORDER_DATE} desc`];
|
|
24213
24226
|
|
|
24214
|
-
const
|
|
24215
|
-
|
|
24216
|
-
|
|
24217
|
-
|
|
24227
|
+
const ORDER_COLUMN_MAPPING = {
|
|
24228
|
+
[EReportColumnKey.ORDER_ID]: {
|
|
24229
|
+
label: 'Order ID',
|
|
24230
|
+
value: EReportColumnKey.ORDER_ID,
|
|
24231
|
+
},
|
|
24232
|
+
[EReportColumnKey.GEMX_ID]: {
|
|
24233
|
+
label: 'GemX ID',
|
|
24234
|
+
value: EReportColumnKey.GEMX_ID,
|
|
24235
|
+
},
|
|
24236
|
+
[EReportColumnKey.ORDER_DATE]: {
|
|
24237
|
+
label: 'Date',
|
|
24238
|
+
value: EReportColumnKey.ORDER_DATE,
|
|
24239
|
+
},
|
|
24240
|
+
[EReportColumnKey.TOTAL]: {
|
|
24241
|
+
label: 'Total',
|
|
24242
|
+
value: EReportColumnKey.TOTAL,
|
|
24243
|
+
},
|
|
24244
|
+
[EReportColumnKey.CAMPAIGNS]: {
|
|
24245
|
+
label: 'Experiment version',
|
|
24246
|
+
value: EReportColumnKey.CAMPAIGNS,
|
|
24247
|
+
},
|
|
24248
|
+
[EReportColumnKey.TRAFFIC_SOURCE]: {
|
|
24249
|
+
label: 'Traffic source',
|
|
24250
|
+
value: EReportColumnKey.TRAFFIC_SOURCE,
|
|
24251
|
+
},
|
|
24252
|
+
[EReportColumnKey.DEVICE]: {
|
|
24253
|
+
label: 'Device',
|
|
24254
|
+
value: EReportColumnKey.DEVICE,
|
|
24255
|
+
},
|
|
24256
|
+
[EReportColumnKey.VISITOR]: {
|
|
24257
|
+
label: 'Customer type',
|
|
24258
|
+
value: EReportColumnKey.VISITOR,
|
|
24259
|
+
},
|
|
24260
|
+
[EReportColumnKey.ITEMS]: {
|
|
24261
|
+
label: 'Items',
|
|
24262
|
+
value: EReportColumnKey.ITEMS,
|
|
24263
|
+
},
|
|
24218
24264
|
};
|
|
24265
|
+
const DEFAULT_SELECTED_COLUMNS_FOR_EXPERIMENT = [
|
|
24266
|
+
EReportColumnKey.ORDER_ID,
|
|
24267
|
+
EReportColumnKey.GEMX_ID,
|
|
24268
|
+
EReportColumnKey.ORDER_DATE,
|
|
24269
|
+
EReportColumnKey.TOTAL,
|
|
24270
|
+
EReportColumnKey.CAMPAIGNS,
|
|
24271
|
+
EReportColumnKey.TRAFFIC_SOURCE,
|
|
24272
|
+
EReportColumnKey.DEVICE,
|
|
24273
|
+
EReportColumnKey.VISITOR,
|
|
24274
|
+
];
|
|
24219
24275
|
|
|
24220
|
-
const
|
|
24221
|
-
|
|
24222
|
-
|
|
24223
|
-
|
|
24224
|
-
|
|
24225
|
-
|
|
24226
|
-
|
|
24227
|
-
|
|
24228
|
-
};
|
|
24229
|
-
const renderContent = () => {
|
|
24230
|
-
if (value === 'Total') {
|
|
24231
|
-
return jsx(TotalCell, { value: value, isTotalRow: isTotalRow });
|
|
24232
|
-
}
|
|
24233
|
-
let Renderer = cellMap[name] ?? DefaultCell;
|
|
24234
|
-
if (formattedValue === NONE_VALUE) {
|
|
24235
|
-
Renderer = NoneCell;
|
|
24236
|
-
}
|
|
24237
|
-
return (jsx(Renderer, { value: formattedValue, name: name, isMergedWithPrev: isMergedWithPrev, previousValue: formattedPreviousValue, columnLayout: columnLayout, orderCellProps: orderCellProps, campaignsCellProps: campaignsCellProps, isTotalRow: isTotalRow, isDimensionCol: isDimensionCol, isMockData: isMockData }));
|
|
24238
|
-
};
|
|
24239
|
-
return (jsx("div", { className: cls('GReportTable__Cell', { 'GReportTable__Cell--dimension': isDimensionCol }), style: cellStyles, children: jsx("div", { className: "GReportTable__CellContent", style: columnLayoutStyles, children: renderContent() }) }));
|
|
24276
|
+
const convertOrderItemsToReportTableRows = (orderItems) => {
|
|
24277
|
+
return orderItems.map((orderItem) => {
|
|
24278
|
+
const { events: _events, ...restOrderItem } = orderItem;
|
|
24279
|
+
return {
|
|
24280
|
+
...restOrderItem,
|
|
24281
|
+
items: typeof orderItem.items === 'string' ? JSON.parse(orderItem.items) : (orderItem.items ?? []),
|
|
24282
|
+
experiments: typeof orderItem.experiments === 'string' ? JSON.parse(orderItem.experiments) : (orderItem.experiments ?? []),
|
|
24283
|
+
};
|
|
24284
|
+
});
|
|
24240
24285
|
};
|
|
24241
|
-
|
|
24242
|
-
|
|
24243
|
-
|
|
24244
|
-
|
|
24245
|
-
|
|
24246
|
-
|
|
24247
|
-
|
|
24248
|
-
|
|
24249
|
-
isMergedWithPrev = allMatch;
|
|
24286
|
+
const applyTotalToSummaryRow = (rows) => {
|
|
24287
|
+
let totalPrice = 0;
|
|
24288
|
+
let totalItems = 0;
|
|
24289
|
+
rows.forEach((row) => {
|
|
24290
|
+
const rowTotal = row[EReportColumnKey.TOTAL];
|
|
24291
|
+
const rowItems = row[EReportColumnKey.ITEMS];
|
|
24292
|
+
if (typeof rowTotal === 'number') {
|
|
24293
|
+
totalPrice += rowTotal;
|
|
24250
24294
|
}
|
|
24251
|
-
|
|
24252
|
-
|
|
24253
|
-
const customOrderCellProps = orderCellProps
|
|
24254
|
-
? {
|
|
24255
|
-
...orderCellProps,
|
|
24256
|
-
onClickOrderCell: (data) => orderCellProps?.onClickOrderCell({ row, isPrevious: data.isPrevious }),
|
|
24295
|
+
if (Array.isArray(rowItems)) {
|
|
24296
|
+
totalItems += rowItems.reduce((acc, item) => acc + Number(item.quantity), 0);
|
|
24257
24297
|
}
|
|
24258
|
-
|
|
24259
|
-
return (
|
|
24260
|
-
|
|
24261
|
-
|
|
24262
|
-
|
|
24263
|
-
|
|
24298
|
+
});
|
|
24299
|
+
return rows.map((row, index) => {
|
|
24300
|
+
const totalItemsLabel = totalItems > 1 ? `${totalItems} items` : `${totalItems} item`;
|
|
24301
|
+
return {
|
|
24302
|
+
// Only add totals to first row (used by SummaryRow)
|
|
24303
|
+
...(index === 0 && {
|
|
24304
|
+
[getTotalColumnName(EReportColumnKey.TOTAL)]: totalPrice,
|
|
24305
|
+
[getTotalColumnName(EReportColumnKey.ITEMS)]: totalItemsLabel,
|
|
24306
|
+
}),
|
|
24307
|
+
...row,
|
|
24308
|
+
};
|
|
24309
|
+
});
|
|
24264
24310
|
};
|
|
24265
24311
|
|
|
24266
|
-
const
|
|
24267
|
-
|
|
24268
|
-
}
|
|
24312
|
+
const useOrderControlStore = create()((set) => ({
|
|
24313
|
+
orderBy: { field: EReportColumnKey.ORDER_DATE, direction: EOrderDirectionType.DESC },
|
|
24314
|
+
changeOrderBy: (newOrderBy) => set(() => ({ orderBy: newOrderBy })),
|
|
24315
|
+
}));
|
|
24269
24316
|
|
|
24270
|
-
const
|
|
24271
|
-
|
|
24272
|
-
|
|
24273
|
-
|
|
24274
|
-
|
|
24275
|
-
|
|
24276
|
-
|
|
24277
|
-
|
|
24278
|
-
|
|
24279
|
-
|
|
24280
|
-
|
|
24281
|
-
|
|
24282
|
-
|
|
24283
|
-
|
|
24284
|
-
|
|
24285
|
-
const
|
|
24286
|
-
const
|
|
24287
|
-
|
|
24288
|
-
|
|
24289
|
-
|
|
24317
|
+
const useOrderColumnsSelectorStore = create()(persist((set) => ({
|
|
24318
|
+
selectedColumns: DEFAULT_SELECTED_COLUMNS_FOR_EXPERIMENT,
|
|
24319
|
+
columnsOrder: Object.values(ORDER_COLUMN_MAPPING).map((column) => column.value),
|
|
24320
|
+
setColumnsOrder: (columnsOrder) => set({ columnsOrder }),
|
|
24321
|
+
setSelectedColumns: (selectedColumns) => set({ selectedColumns }),
|
|
24322
|
+
}), { name: 'order-listing-columns-config' }));
|
|
24323
|
+
|
|
24324
|
+
const useOrderListingData = ({ limitRowAmount, orderListing = [], fixedColumns, selectedColumns: externalSelectedColumns, columnsOrder: externalColumnsOrder, }) => {
|
|
24325
|
+
const storeSelectedColumns = useOrderColumnsSelectorStore((state) => state.selectedColumns);
|
|
24326
|
+
const storeColumnsOrder = useOrderColumnsSelectorStore((state) => state.columnsOrder);
|
|
24327
|
+
const selectedColumns = externalSelectedColumns ?? storeSelectedColumns;
|
|
24328
|
+
const columnsOrder = externalColumnsOrder ?? storeColumnsOrder;
|
|
24329
|
+
const showColumns = useMemo(() => ORDER_LISTING_COLUMNS.filter((column) => (fixedColumns ?? selectedColumns).includes(column.name)), [fixedColumns, selectedColumns]);
|
|
24330
|
+
const sortedMetrics = useMemo(() => sortByArrayOrder(ORDER_LISTING_METRICS ?? [], columnsOrder), [columnsOrder]);
|
|
24331
|
+
const tableData = useMemo(() => {
|
|
24332
|
+
const rows = convertOrderItemsToReportTableRows(orderListing);
|
|
24333
|
+
const showRows = limitRowAmount ? rows.slice(0, limitRowAmount) : rows;
|
|
24334
|
+
return {
|
|
24335
|
+
rows: showRows,
|
|
24336
|
+
columns: showColumns,
|
|
24337
|
+
};
|
|
24338
|
+
}, [limitRowAmount, orderListing, showColumns]);
|
|
24339
|
+
return {
|
|
24340
|
+
showColumns,
|
|
24341
|
+
tableData,
|
|
24342
|
+
sortedMetrics,
|
|
24290
24343
|
};
|
|
24291
|
-
return (jsx("div", { className: "GReportTable__Summary-Row", children: columns.map(({ name, dataType }, index) => (jsx("div", { className: "GReportTable__Summary-Cell", style: getColumnLayoutStyles(columnLayoutMap[name]), children: getCellValue(name, index, dataType) }, name))) }));
|
|
24292
24344
|
};
|
|
24293
24345
|
|
|
24294
|
-
const
|
|
24295
|
-
|
|
24296
|
-
|
|
24297
|
-
|
|
24346
|
+
const SKELETON_METRICS = [
|
|
24347
|
+
EReportColumnKey.ORDER_DATE,
|
|
24348
|
+
EReportColumnKey.TOTAL,
|
|
24349
|
+
EReportColumnKey.CAMPAIGNS,
|
|
24350
|
+
EReportColumnKey.TRAFFIC_SOURCE,
|
|
24351
|
+
EReportColumnKey.DEVICE,
|
|
24352
|
+
EReportColumnKey.VISITOR,
|
|
24353
|
+
EReportColumnKey.ITEMS,
|
|
24354
|
+
];
|
|
24355
|
+
|
|
24356
|
+
const SkeletonSummaryRow = () => {
|
|
24357
|
+
const summaryColumns = [
|
|
24358
|
+
{ key: 'order_id', layout: ORDER_LISTING_DIMENSION_LAYOUT },
|
|
24359
|
+
...SKELETON_METRICS.map((metric) => ({
|
|
24360
|
+
key: metric,
|
|
24361
|
+
layout: ORDER_LISTING_METRIC_LAYOUTS[metric],
|
|
24362
|
+
})),
|
|
24363
|
+
];
|
|
24364
|
+
return (jsx("div", { className: "GReportTable__Summary-Row", children: summaryColumns.map((col, index) => (jsx("div", { className: "GReportTable__Summary-Cell", style: {
|
|
24365
|
+
minWidth: col.layout?.minWidth,
|
|
24366
|
+
maxWidth: col.layout?.maxWidth,
|
|
24367
|
+
justifyContent: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24368
|
+
['--column-cell-justify-content']: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24369
|
+
}, children: index === 0 && (jsx("div", { className: "w-20", children: jsx(SkeletonBodyText, { lines: 1 }) })) }, col.key))) }));
|
|
24298
24370
|
};
|
|
24299
24371
|
|
|
24300
|
-
const
|
|
24301
|
-
const
|
|
24302
|
-
|
|
24303
|
-
|
|
24304
|
-
|
|
24305
|
-
|
|
24306
|
-
|
|
24307
|
-
|
|
24308
|
-
|
|
24309
|
-
|
|
24310
|
-
|
|
24311
|
-
|
|
24312
|
-
|
|
24313
|
-
|
|
24314
|
-
|
|
24315
|
-
const orderByField = orderBy?.[name];
|
|
24316
|
-
if (!orderByField)
|
|
24317
|
-
return SvgArrowUpIcon;
|
|
24318
|
-
return orderByField.direction === EOrderDirectionType.ASC ? SvgArrowUpIcon : SvgArrowDownIcon;
|
|
24319
|
-
}
|
|
24372
|
+
const SkeletonHeader = () => {
|
|
24373
|
+
const headerColumns = [
|
|
24374
|
+
{ key: 'order_id', label: 'Order ID', layout: ORDER_LISTING_DIMENSION_LAYOUT },
|
|
24375
|
+
...SKELETON_METRICS.map((metric) => ({
|
|
24376
|
+
key: metric,
|
|
24377
|
+
label: metric,
|
|
24378
|
+
layout: ORDER_LISTING_METRIC_LAYOUTS[metric],
|
|
24379
|
+
})),
|
|
24380
|
+
];
|
|
24381
|
+
return (jsx("div", { className: "GReportTable__Header", children: headerColumns.map((col, index) => (jsx("div", { className: "GReportTable__Header-Cell", style: {
|
|
24382
|
+
minWidth: col.layout?.minWidth,
|
|
24383
|
+
maxWidth: col.layout?.maxWidth,
|
|
24384
|
+
justifyContent: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24385
|
+
['--column-cell-justify-content']: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24386
|
+
}, children: jsx("div", { className: index === 0 ? 'w-16' : 'w-12', children: jsx(SkeletonBodyText, { lines: 1 }) }) }, col.key))) }));
|
|
24320
24387
|
};
|
|
24321
24388
|
|
|
24322
|
-
const
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
|
|
24326
|
-
|
|
24327
|
-
|
|
24328
|
-
|
|
24329
|
-
|
|
24330
|
-
|
|
24331
|
-
|
|
24332
|
-
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
return
|
|
24336
|
-
|
|
24389
|
+
const SkeletonCellContent = ({ columnKey }) => {
|
|
24390
|
+
switch (columnKey) {
|
|
24391
|
+
case 'order_id':
|
|
24392
|
+
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-20", children: jsx(SkeletonDisplayText, { size: "small" }) }) }));
|
|
24393
|
+
case EReportColumnKey.ORDER_DATE:
|
|
24394
|
+
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-28", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
24395
|
+
case EReportColumnKey.TOTAL:
|
|
24396
|
+
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-16", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
24397
|
+
case EReportColumnKey.CAMPAIGNS:
|
|
24398
|
+
return (jsx(Box, { paddingInline: "300", width: "100%", children: jsxs(InlineStack, { gap: "200", blockAlign: "center", children: [jsx("div", { className: "bg-surface-secondary h-6 w-6 shrink-0 animate-pulse rounded" }), jsx("div", { className: "max-w-40 flex-1", children: jsx(SkeletonBodyText, { lines: 1 }) })] }) }));
|
|
24399
|
+
case EReportColumnKey.TRAFFIC_SOURCE:
|
|
24400
|
+
case EReportColumnKey.DEVICE:
|
|
24401
|
+
case EReportColumnKey.VISITOR:
|
|
24402
|
+
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-16", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
24403
|
+
case EReportColumnKey.ITEMS:
|
|
24404
|
+
return (jsx(Box, { paddingInline: "300", children: jsxs(InlineStack, { gap: "100", blockAlign: "center", children: [jsx("div", { className: "bg-surface-secondary h-6 w-6 shrink-0 animate-pulse rounded" }), jsx("div", { className: "w-4", children: jsx(SkeletonBodyText, { lines: 1 }) })] }) }));
|
|
24405
|
+
default:
|
|
24406
|
+
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-16", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
24337
24407
|
}
|
|
24338
|
-
return (jsxs("button", { className: "GReportTable-SortableHeaderButton", onClick: () => onChangeOrderBy?.(name), children: [jsx("div", { className: "min-w-0", children: jsx(GTextTruncated, { as: "p", variant: "bodySm", fontWeight: "medium", tone: "subdued", tooltip: getTooltipInfo(name), children: displayName }) }), jsx(Box, { opacity: getOpacity(name), children: jsx(Icon, { source: getOrderIcon(name) }) })] }));
|
|
24339
24408
|
};
|
|
24340
24409
|
|
|
24341
|
-
const
|
|
24342
|
-
const
|
|
24343
|
-
|
|
24344
|
-
|
|
24345
|
-
|
|
24346
|
-
|
|
24347
|
-
|
|
24348
|
-
|
|
24349
|
-
|
|
24410
|
+
const SkeletonRow = () => {
|
|
24411
|
+
const rowColumns = [
|
|
24412
|
+
{ key: 'order_id', layout: ORDER_LISTING_DIMENSION_LAYOUT, isDimension: true },
|
|
24413
|
+
...SKELETON_METRICS.map((metric) => ({
|
|
24414
|
+
key: metric,
|
|
24415
|
+
layout: ORDER_LISTING_METRIC_LAYOUTS[metric],
|
|
24416
|
+
isDimension: false,
|
|
24417
|
+
})),
|
|
24418
|
+
];
|
|
24419
|
+
return (jsx("div", { className: "GReportTable__Row", children: rowColumns.map((col) => (jsx("div", { className: `GReportTable__Cell ${col.isDimension ? 'GReportTable__Cell--dimension' : ''}`, style: {
|
|
24420
|
+
minWidth: col.layout?.minWidth,
|
|
24421
|
+
maxWidth: col.layout?.maxWidth,
|
|
24422
|
+
justifyContent: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24423
|
+
['--column-cell-justify-content']: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24424
|
+
}, children: jsx("div", { className: "GReportTable__CellContent", children: jsx(SkeletonCellContent, { columnKey: col.key }) }) }, col.key))) }));
|
|
24350
24425
|
};
|
|
24351
24426
|
|
|
24352
|
-
const
|
|
24353
|
-
return (
|
|
24354
|
-
}
|
|
24355
|
-
WrapperHeader.displayName = 'WrapperHeader';
|
|
24427
|
+
const OrderListingTableSkeleton = ({ rowCount = 5 }) => {
|
|
24428
|
+
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 }) }) }) })] }));
|
|
24429
|
+
};
|
|
24356
24430
|
|
|
24357
|
-
const
|
|
24358
|
-
|
|
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, }) => {
|
|
24360
|
-
const { summary = {}, hideBorderTop, hidePaginationRow } = options ?? {};
|
|
24361
|
-
const { columns, rows } = useReportTable({ dimensions, metrics, tableData: data ?? { columns: [], rows: [] } });
|
|
24362
|
-
const { headerRef, bodyRef, scrollbarContainerRef, leftShadowRef, rightShadowRef } = useSyncedScroll({ columns });
|
|
24363
|
-
const tableDimensionLayout = dimensionLayout ?? DEFAULT_DIMENSION_LAYOUT;
|
|
24364
|
-
const isEmpty = rows.length === 0;
|
|
24365
|
-
const totalPaginationRows = hidePaginationRow ? 0 : rows.length;
|
|
24366
|
-
const isHasTotalRows = Boolean(totalPaginationRows && totalPaginationRows > 0);
|
|
24367
|
-
const isPaginationHidden = !isHasTotalRows && !showViewAllButton && !paginationProps;
|
|
24368
|
-
const columnLayoutMap = useMemo(() => {
|
|
24369
|
-
return columns.reduce((acc, col) => {
|
|
24370
|
-
const tableMetricLayout = metricLayouts?.[col.name] ?? DEFAULT_METRIC_LAYOUT;
|
|
24371
|
-
acc[col.name] = dimensions.includes(col.name) ? tableDimensionLayout : tableMetricLayout;
|
|
24372
|
-
return acc;
|
|
24373
|
-
}, {});
|
|
24374
|
-
}, [columns, metricLayouts, tableDimensionLayout, dimensions]);
|
|
24375
|
-
const totalTableWidth = useMemo(() => {
|
|
24376
|
-
return columns.reduce((acc, col) => {
|
|
24377
|
-
const layout = columnLayoutMap[col.name];
|
|
24378
|
-
const widthStr = layout?.minWidth || '0';
|
|
24379
|
-
const widthVal = parseInt(widthStr, 10) || 0;
|
|
24380
|
-
return acc + widthVal;
|
|
24381
|
-
}, 0);
|
|
24382
|
-
}, [columns, columnLayoutMap]);
|
|
24383
|
-
if (isLoading)
|
|
24384
|
-
return jsx(ReportTableSkeleton, { ...skeletons });
|
|
24385
|
-
if (isEmpty)
|
|
24386
|
-
return emptyStateComponent ? (jsx(ReportTableActionsProvider, { onViewAllStoreOrders: onViewAllStoreOrders, children: renderEmptyState() })) : null;
|
|
24387
|
-
return (jsx(ReportTableActionsProvider, { onViewOrderJourney: onViewOrderJourney, onViewOrderDetails: onViewOrderDetails, onViewAllStoreOrders: onViewAllStoreOrders, children: jsxs("div", { className: cls('GReportTable__Container', {
|
|
24388
|
-
'GReportTable__Container--border-top': !hideBorderTop,
|
|
24389
|
-
'GReportTable__Container--pagination-hidden': isPaginationHidden,
|
|
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 })] }) }));
|
|
24391
|
-
function renderEmptyState() {
|
|
24392
|
-
return (jsxs("div", { className: cls('GReportTable__Container', {
|
|
24393
|
-
'GReportTable__Container--border-top': !hideBorderTop,
|
|
24394
|
-
}), children: [emptyStateComponent, jsx(WrapperFooter, { totalPaginationRows: 0, itemCount: itemCount, showViewAllButton: showViewAllButton, paginationProps: paginationProps, isPaginationHidden: true, isMockData: isMockData })] }));
|
|
24395
|
-
}
|
|
24431
|
+
const OrderListingTableEmpty = ({ title, description }) => {
|
|
24432
|
+
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 })] })] }) }));
|
|
24396
24433
|
};
|
|
24397
24434
|
|
|
24398
|
-
const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, paginationProps, tableOptions, isMockData, onViewAllStoreOrders, onViewOrderJourney, onViewOrderDetails, }) => {
|
|
24435
|
+
const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, paginationProps, tableOptions, isMockData, selectedColumns, columnsOrder, isFilteredByCampaign, isHasControlFilters, onViewAllStoreOrders, onViewOrderJourney, onViewOrderDetails, }) => {
|
|
24399
24436
|
const { hideSummary, limitRowAmount, hidePaginationRow, hideBorderTop, fixedColumns, isLatestTable } = tableOptions ?? {};
|
|
24400
24437
|
const { t } = useTranslation();
|
|
24401
24438
|
const orderBy = useOrderControlStore((state) => state.orderBy);
|
|
@@ -24404,9 +24441,11 @@ const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, pa
|
|
|
24404
24441
|
limitRowAmount,
|
|
24405
24442
|
orderListing: orders,
|
|
24406
24443
|
fixedColumns,
|
|
24444
|
+
selectedColumns,
|
|
24445
|
+
columnsOrder,
|
|
24407
24446
|
});
|
|
24408
24447
|
const isNoResultFoundForQuery = !!queryValue?.trim() && tableData.rows.length === 0;
|
|
24409
|
-
const showViewAllButton = isLatestTable || isNoResultFoundForQuery;
|
|
24448
|
+
const showViewAllButton = isLatestTable || isHasControlFilters || isNoResultFoundForQuery;
|
|
24410
24449
|
const reportTableData = useMemo(() => {
|
|
24411
24450
|
return {
|
|
24412
24451
|
rows: applyTotalToSummaryRow(tableData.rows),
|
|
@@ -24421,7 +24460,7 @@ const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, pa
|
|
|
24421
24460
|
};
|
|
24422
24461
|
if (isLatestTable && isLoading)
|
|
24423
24462
|
return jsx(OrderListingTableSkeleton, {});
|
|
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 }) }));
|
|
24463
|
+
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 || !!isFilteredByCampaign, isMockData: isMockData, emptyStateComponent: renderEmptyState(), onChangeOrderBy: handleChangeOrderBy, onViewAllStoreOrders: onViewAllStoreOrders, onViewOrderJourney: onViewOrderJourney, onViewOrderDetails: onViewOrderDetails }) }));
|
|
24425
24464
|
function renderEmptyState() {
|
|
24426
24465
|
const isNoOrderWithCurrentFilters = orders.length === 0;
|
|
24427
24466
|
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') }) }) }));
|
|
@@ -24721,21 +24760,18 @@ const JOURNEY_EVENT_COMPONENTS_MAP = {
|
|
|
24721
24760
|
[EJourneyEvent.SEARCH_SUBMITTED]: DefaultEventComponent,
|
|
24722
24761
|
};
|
|
24723
24762
|
|
|
24724
|
-
const
|
|
24725
|
-
|
|
24763
|
+
const GemxIdBadge = () => {
|
|
24764
|
+
const { t } = useTranslation();
|
|
24765
|
+
const { gxId } = useOrderJourneyContext();
|
|
24766
|
+
if (!gxId)
|
|
24767
|
+
return null;
|
|
24768
|
+
return (jsx(Box, { background: "bg-surface-secondary-active", paddingBlock: "100", paddingInline: "200", borderRadius: "200", children: jsx(InlineStack, { gap: "100", blockAlign: "center", children: jsx("span", { className: "text-[var(--p-color-text-emphasis)]", children: jsx(GI18NText, { as: "span", variant: "bodyMd", tone: "subdued", transformers: {
|
|
24769
|
+
1: (text) => (jsx(Text, { as: "span", variant: "bodyMd", fontWeight: "medium", tone: "base", children: text })),
|
|
24770
|
+
}, children: t('GemX ID: [1]{{gxId}}[]', { gxId }) }) }) }) }));
|
|
24726
24771
|
};
|
|
24727
24772
|
|
|
24728
|
-
const
|
|
24729
|
-
|
|
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') })] }) }) }));
|
|
24773
|
+
const JourneyDateBadge = ({ content }) => {
|
|
24774
|
+
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 }) }) }));
|
|
24739
24775
|
};
|
|
24740
24776
|
|
|
24741
24777
|
const JourneyIdBadge = ({ id, type = 'order' }) => {
|
|
@@ -24757,13 +24793,26 @@ const JourneyIdBadge = ({ id, type = 'order' }) => {
|
|
|
24757
24793
|
}
|
|
24758
24794
|
};
|
|
24759
24795
|
|
|
24796
|
+
const BOX_BACKGROUND = {
|
|
24797
|
+
default: 'bg-surface-secondary-active',
|
|
24798
|
+
onHover: 'bg-surface-secondary',
|
|
24799
|
+
};
|
|
24800
|
+
const JourneyLoadMore = ({ isFetching, onLoadMode }) => {
|
|
24801
|
+
const [boxBackground, setBoxBackground] = useState(BOX_BACKGROUND.default);
|
|
24802
|
+
const { t } = useTranslation();
|
|
24803
|
+
if (isFetching) {
|
|
24804
|
+
return (jsx(Box, { paddingBlock: "100", paddingInline: "300", background: BOX_BACKGROUND.onHover, borderRadius: "200", children: jsx(GSpinner, { size: "small" }) }));
|
|
24805
|
+
}
|
|
24806
|
+
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') })] }) }) }));
|
|
24807
|
+
};
|
|
24808
|
+
|
|
24760
24809
|
const JourneyTitle = ({ content, id, hasMoreSteps, isFetching = false, onLoadMode }) => {
|
|
24761
24810
|
const isStickyHeader = !!id;
|
|
24762
24811
|
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, {})] }));
|
|
24812
|
+
return (jsxs(Box, { paddingBlock: "300", paddingInline: "400", position: "relative", children: [jsxs(InlineStack, { align: "space-between", gap: "100", children: [jsxs(InlineStack, { gap: "400", wrap: false, children: [jsx(JourneyDateBadge, { content: content }), id && jsx(JourneyIdBadge, { id: id }), id && jsx(GemxIdBadge, {})] }), isShowLoadMore && jsx(JourneyLoadMore, { isFetching: isFetching, onLoadMode: onLoadMode })] }), jsx(JourneyTitleLine, {})] }));
|
|
24764
24813
|
};
|
|
24765
24814
|
const JourneyTitleLine = () => {
|
|
24766
|
-
return jsx("div", { className: "absolute
|
|
24815
|
+
return jsx("div", { className: "bg-border absolute left-0 right-0 top-[50%] -z-[1] h-[1px] translate-y-[-50%]" });
|
|
24767
24816
|
};
|
|
24768
24817
|
|
|
24769
24818
|
const JourneyGroup = ({ eventsByDate, sectionRefs }) => {
|
|
@@ -24874,7 +24923,7 @@ const JourneyEventSkeleton = ({ isLast }) => {
|
|
|
24874
24923
|
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
24924
|
};
|
|
24876
24925
|
|
|
24877
|
-
const GModalOrderJourney = ({ open, onClose, title, orderId, journeyItems, isLoading = false, hasNextPage = false, isFetchingNextPage = false, fetchNextPage, reportCampaign, pageAnalytic, mode, journeySource, onViewOrderDetails, }) => {
|
|
24926
|
+
const GModalOrderJourney = ({ open, onClose, title, orderId, gxId, journeyItems, isLoading = false, hasNextPage = false, isFetchingNextPage = false, fetchNextPage, reportCampaign, pageAnalytic, mode, journeySource, onViewOrderDetails, }) => {
|
|
24878
24927
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
24879
24928
|
usePreventBodyScroll({ enable: open });
|
|
24880
24929
|
const source = useMemo(() => {
|
|
@@ -24928,7 +24977,7 @@ const GModalOrderJourney = ({ open, onClose, title, orderId, journeyItems, isLoa
|
|
|
24928
24977
|
}, [open]);
|
|
24929
24978
|
if (!orderId)
|
|
24930
24979
|
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 })) }) }));
|
|
24980
|
+
return (jsx(GModal, { open: open, title: title, onClose: onClose, children: jsx(OrderJourneyProvider, { value: { orderId, gxId, onViewOrderDetails }, children: isLoading ? (jsx(OrderJourneySkeleton, {})) : (jsx(JourneyContainer, { orderId: orderId, eventsByDate: eventsByDate, hasMoreSteps: hasMoreSteps, isFetchingMoreSteps: isFetchingNextPage, onLoadMore: handleLoadMore })) }) }));
|
|
24932
24981
|
};
|
|
24933
24982
|
|
|
24934
24983
|
function isBrowser() {
|
|
@@ -24974,4 +25023,4 @@ const useStickyFilterBoxProps = ({ id }) => {
|
|
|
24974
25023
|
};
|
|
24975
25024
|
};
|
|
24976
25025
|
|
|
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 };
|
|
25026
|
+
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, OrderListingTable$1 as OrderListingTable, 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 };
|