@gem-sdk/analytics 1.0.2-dev.0 → 1.0.2-dev.2
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/OrderListingLatestTable.d.ts +1 -1
- package/dist/esm/components/OrderAnalytic/components/OrderListing/OrderListingTable.d.ts +11 -6
- 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.d.ts +3 -0
- package/dist/esm/index.js +1131 -1079
- package/dist/esm/index.mjs +1131 -1079
- 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/ReportTable.d.ts +4 -4
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/CampaignsCell/CampaignsCell.d.ts +1 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/Cell.d.ts +3 -2
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/GemxIdCell.d.ts +2 -0
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/OrderIdCell.d.ts +1 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/type.d.ts +2 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Row.d.ts +1 -1
- package/dist/esm/shared/reports/ui/ReportTable/context/ReportTableActionsContext.d.ts +1 -1
- package/dist/esm/shared/reports/ui/ReportTable/types/index.d.ts +1 -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/OrderListingLatestTable.d.ts +1 -1
- package/dist/umd/esm/components/OrderAnalytic/components/OrderListing/OrderListingTable.d.ts +11 -6
- 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/index.d.ts +3 -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/ReportTable.d.ts +4 -4
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/CampaignsCell/CampaignsCell.d.ts +1 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/Cell.d.ts +3 -2
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/GemxIdCell.d.ts +2 -0
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/OrderIdCell.d.ts +1 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/type.d.ts +2 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Row.d.ts +1 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/context/ReportTableActionsContext.d.ts +1 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/types/index.d.ts +1 -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,18 +23053,6 @@ 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 EReportColumnKey;
|
|
23044
|
-
(function (EReportColumnKey) {
|
|
23045
|
-
EReportColumnKey["ORDER_ID"] = "order_id";
|
|
23046
|
-
EReportColumnKey["ORDER_DATE"] = "order_date";
|
|
23047
|
-
EReportColumnKey["TOTAL"] = "total_price";
|
|
23048
|
-
EReportColumnKey["CAMPAIGNS"] = "experiments";
|
|
23049
|
-
EReportColumnKey["TRAFFIC_SOURCE"] = "traffic_source";
|
|
23050
|
-
EReportColumnKey["ITEMS"] = "items";
|
|
23051
|
-
EReportColumnKey["DEVICE"] = "device";
|
|
23052
|
-
EReportColumnKey["VISITOR"] = "visitor_type";
|
|
23053
|
-
})(EReportColumnKey || (EReportColumnKey = {}));
|
|
23054
|
-
|
|
23055
23056
|
var EReportDataType;
|
|
23056
23057
|
(function (EReportDataType) {
|
|
23057
23058
|
EReportDataType["DATE"] = "DATE";
|
|
@@ -23139,666 +23140,163 @@ function getMetricPreviousValue(row, key) {
|
|
|
23139
23140
|
return row[getPreviousColumnName(key)];
|
|
23140
23141
|
}
|
|
23141
23142
|
|
|
23142
|
-
|
|
23143
|
-
|
|
23144
|
-
|
|
23145
|
-
|
|
23146
|
-
|
|
23147
|
-
|
|
23148
|
-
|
|
23149
|
-
|
|
23150
|
-
|
|
23143
|
+
var EDimensionKey;
|
|
23144
|
+
(function (EDimensionKey) {
|
|
23145
|
+
EDimensionKey["TIME"] = "time";
|
|
23146
|
+
EDimensionKey["EXPERIMENT_ID"] = "experiment_id";
|
|
23147
|
+
EDimensionKey["VERSION"] = "version";
|
|
23148
|
+
EDimensionKey["VISITOR"] = "visitor_type";
|
|
23149
|
+
EDimensionKey["TRAFFIC_SOURCE"] = "traffic_source";
|
|
23150
|
+
EDimensionKey["DEVICE"] = "device";
|
|
23151
|
+
})(EDimensionKey || (EDimensionKey = {}));
|
|
23152
|
+
|
|
23153
|
+
var ETooltipCategory;
|
|
23154
|
+
(function (ETooltipCategory) {
|
|
23155
|
+
ETooltipCategory["ALPHABETICAL"] = "ALPHABETICAL";
|
|
23156
|
+
ETooltipCategory["NUMERIC"] = "NUMERIC";
|
|
23157
|
+
ETooltipCategory["DATE"] = "DATE";
|
|
23158
|
+
})(ETooltipCategory || (ETooltipCategory = {}));
|
|
23159
|
+
const TooltipPresets = {
|
|
23160
|
+
[ETooltipCategory.ALPHABETICAL]: { ASC: 'A-Z', DESC: 'Z-A' },
|
|
23161
|
+
[ETooltipCategory.NUMERIC]: { ASC: 'Lowest first', DESC: 'Highest first' },
|
|
23162
|
+
[ETooltipCategory.DATE]: { ASC: 'Oldest first', DESC: 'Newest first' },
|
|
23151
23163
|
};
|
|
23152
|
-
const
|
|
23153
|
-
|
|
23154
|
-
|
|
23155
|
-
|
|
23156
|
-
|
|
23157
|
-
|
|
23158
|
-
|
|
23159
|
-
|
|
23164
|
+
const DEFAULT_TOOLTIP = TooltipPresets[ETooltipCategory.NUMERIC];
|
|
23165
|
+
const reportOrderTooltip = {
|
|
23166
|
+
day: TooltipPresets[ETooltipCategory.DATE],
|
|
23167
|
+
order_date: TooltipPresets[ETooltipCategory.DATE],
|
|
23168
|
+
month: TooltipPresets[ETooltipCategory.DATE],
|
|
23169
|
+
year: TooltipPresets[ETooltipCategory.DATE],
|
|
23170
|
+
hour: TooltipPresets[ETooltipCategory.DATE],
|
|
23171
|
+
quarter: TooltipPresets[ETooltipCategory.DATE],
|
|
23172
|
+
week: TooltipPresets[ETooltipCategory.DATE],
|
|
23173
|
+
[EDimensionKey.DEVICE]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23174
|
+
[EDimensionKey.VISITOR]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23175
|
+
[EDimensionKey.VERSION]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23176
|
+
[EDimensionKey.TRAFFIC_SOURCE]: TooltipPresets[ETooltipCategory.ALPHABETICAL],
|
|
23177
|
+
};
|
|
23178
|
+
|
|
23179
|
+
const DEFAULT_DIMENSION_LAYOUT = {
|
|
23180
|
+
width: '200px',
|
|
23181
|
+
minWidth: '200px',
|
|
23182
|
+
align: 'start',
|
|
23183
|
+
paddingRight: '28px',
|
|
23184
|
+
headerPaddingRight: '0',
|
|
23185
|
+
};
|
|
23186
|
+
const DEFAULT_METRIC_LAYOUT = {
|
|
23187
|
+
minWidth: '140px',
|
|
23188
|
+
align: 'end',
|
|
23189
|
+
paddingRight: '28px',
|
|
23190
|
+
headerPaddingRight: '0',
|
|
23191
|
+
};
|
|
23192
|
+
const IS_TOTAL_ROW_FIELD = 'isTotalRow';
|
|
23193
|
+
|
|
23194
|
+
const useReportTable = ({ dimensions, tableData, metrics }) => {
|
|
23195
|
+
const columnsByName = useMemo(() => {
|
|
23196
|
+
return tableData.columns.reduce((lookup, column) => {
|
|
23197
|
+
lookup[column.name] = column;
|
|
23198
|
+
return lookup;
|
|
23199
|
+
}, {});
|
|
23200
|
+
}, [tableData.columns]);
|
|
23201
|
+
const mainColumns = useMemo(() => {
|
|
23202
|
+
return [...dimensions, ...metrics]
|
|
23203
|
+
.map((columnName) => columnsByName[columnName])
|
|
23204
|
+
.filter(Boolean);
|
|
23205
|
+
}, [dimensions, metrics, columnsByName]);
|
|
23206
|
+
const compareColumnsByMainColumn = useMemo(() => {
|
|
23207
|
+
const compareColumns = {};
|
|
23208
|
+
mainColumns.forEach(({ name }) => {
|
|
23209
|
+
const compareColumnName = getPreviousColumnName(name);
|
|
23210
|
+
if (!columnsByName[compareColumnName])
|
|
23211
|
+
return;
|
|
23212
|
+
compareColumns[name] = columnsByName[compareColumnName];
|
|
23213
|
+
});
|
|
23214
|
+
return compareColumns;
|
|
23215
|
+
}, [mainColumns, columnsByName]);
|
|
23216
|
+
const areDimensionsEqual = useCallback((row1, row2, depth) => {
|
|
23217
|
+
if (!row1 || !row2)
|
|
23218
|
+
return false;
|
|
23219
|
+
return dimensions.slice(0, depth + 1).every((dim) => row1[dim] === row2[dim]);
|
|
23220
|
+
}, [dimensions]);
|
|
23221
|
+
const getSubtotalCellValue = useCallback((data) => {
|
|
23222
|
+
const { currentRow, column, columnIndex, dimensionIndex, compareColumn } = data;
|
|
23223
|
+
const isDimension = dimensions.includes(column.name);
|
|
23224
|
+
if (columnIndex === dimensionIndex + 1) {
|
|
23225
|
+
return {
|
|
23226
|
+
cellValue: 'Total',
|
|
23227
|
+
compareCellValue: '',
|
|
23228
|
+
};
|
|
23160
23229
|
}
|
|
23161
|
-
|
|
23162
|
-
|
|
23230
|
+
//handle metric
|
|
23231
|
+
if (!isDimension) {
|
|
23232
|
+
return {
|
|
23233
|
+
cellValue: currentRow[getTotalColumnNameByDimensions(dimensions, column.name, dimensionIndex)],
|
|
23234
|
+
compareCellValue: compareColumn
|
|
23235
|
+
? currentRow[getPreviousTotalColumnNameByDimensions(dimensions, column.name, dimensionIndex)]
|
|
23236
|
+
: '',
|
|
23237
|
+
};
|
|
23238
|
+
}
|
|
23239
|
+
//handle dimension
|
|
23240
|
+
const dimensionDepth = dimensions.indexOf(column.name);
|
|
23241
|
+
if (dimensionDepth > dimensionIndex) {
|
|
23242
|
+
return { cellValue: '', compareCellValue: '' };
|
|
23163
23243
|
}
|
|
23164
|
-
});
|
|
23165
|
-
return rows.map((row, index) => {
|
|
23166
|
-
const totalItemsLabel = totalItems > 1 ? `${totalItems} items` : `${totalItems} item`;
|
|
23167
23244
|
return {
|
|
23168
|
-
|
|
23169
|
-
|
|
23170
|
-
[getTotalColumnName(EReportColumnKey.TOTAL)]: totalPrice,
|
|
23171
|
-
[getTotalColumnName(EReportColumnKey.ITEMS)]: totalItemsLabel,
|
|
23172
|
-
}),
|
|
23173
|
-
...row,
|
|
23245
|
+
cellValue: currentRow[column.name],
|
|
23246
|
+
compareCellValue: compareColumn ? currentRow[compareColumn.name] : '',
|
|
23174
23247
|
};
|
|
23175
|
-
});
|
|
23176
|
-
|
|
23177
|
-
|
|
23178
|
-
|
|
23179
|
-
|
|
23180
|
-
|
|
23181
|
-
|
|
23182
|
-
|
|
23183
|
-
|
|
23184
|
-
|
|
23185
|
-
|
|
23186
|
-
|
|
23187
|
-
|
|
23188
|
-
|
|
23189
|
-
|
|
23190
|
-
|
|
23191
|
-
|
|
23192
|
-
|
|
23193
|
-
|
|
23194
|
-
|
|
23195
|
-
|
|
23196
|
-
|
|
23197
|
-
|
|
23198
|
-
|
|
23199
|
-
|
|
23200
|
-
|
|
23201
|
-
|
|
23202
|
-
|
|
23203
|
-
|
|
23204
|
-
|
|
23205
|
-
|
|
23206
|
-
|
|
23207
|
-
|
|
23208
|
-
|
|
23209
|
-
|
|
23210
|
-
|
|
23211
|
-
},
|
|
23212
|
-
|
|
23213
|
-
|
|
23214
|
-
|
|
23215
|
-
|
|
23216
|
-
|
|
23217
|
-
|
|
23218
|
-
|
|
23219
|
-
|
|
23220
|
-
|
|
23221
|
-
|
|
23222
|
-
|
|
23223
|
-
|
|
23224
|
-
|
|
23225
|
-
|
|
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
|
-
const useReportTable = ({ dimensions, tableData, metrics }) => {
|
|
23697
|
-
const columnsByName = useMemo(() => {
|
|
23698
|
-
return tableData.columns.reduce((lookup, column) => {
|
|
23699
|
-
lookup[column.name] = column;
|
|
23700
|
-
return lookup;
|
|
23701
|
-
}, {});
|
|
23702
|
-
}, [tableData.columns]);
|
|
23703
|
-
const mainColumns = useMemo(() => {
|
|
23704
|
-
return [...dimensions, ...metrics]
|
|
23705
|
-
.map((columnName) => columnsByName[columnName])
|
|
23706
|
-
.filter(Boolean);
|
|
23707
|
-
}, [dimensions, metrics, columnsByName]);
|
|
23708
|
-
const compareColumnsByMainColumn = useMemo(() => {
|
|
23709
|
-
const compareColumns = {};
|
|
23710
|
-
mainColumns.forEach(({ name }) => {
|
|
23711
|
-
const compareColumnName = getPreviousColumnName(name);
|
|
23712
|
-
if (!columnsByName[compareColumnName])
|
|
23713
|
-
return;
|
|
23714
|
-
compareColumns[name] = columnsByName[compareColumnName];
|
|
23715
|
-
});
|
|
23716
|
-
return compareColumns;
|
|
23717
|
-
}, [mainColumns, columnsByName]);
|
|
23718
|
-
const areDimensionsEqual = useCallback((row1, row2, depth) => {
|
|
23719
|
-
if (!row1 || !row2)
|
|
23720
|
-
return false;
|
|
23721
|
-
return dimensions.slice(0, depth + 1).every((dim) => row1[dim] === row2[dim]);
|
|
23722
|
-
}, [dimensions]);
|
|
23723
|
-
const getSubtotalCellValue = useCallback((data) => {
|
|
23724
|
-
const { currentRow, column, columnIndex, dimensionIndex, compareColumn } = data;
|
|
23725
|
-
const isDimension = dimensions.includes(column.name);
|
|
23726
|
-
if (columnIndex === dimensionIndex + 1) {
|
|
23727
|
-
return {
|
|
23728
|
-
cellValue: 'Total',
|
|
23729
|
-
compareCellValue: '',
|
|
23730
|
-
};
|
|
23731
|
-
}
|
|
23732
|
-
//handle metric
|
|
23733
|
-
if (!isDimension) {
|
|
23734
|
-
return {
|
|
23735
|
-
cellValue: currentRow[getTotalColumnNameByDimensions(dimensions, column.name, dimensionIndex)],
|
|
23736
|
-
compareCellValue: compareColumn
|
|
23737
|
-
? currentRow[getPreviousTotalColumnNameByDimensions(dimensions, column.name, dimensionIndex)]
|
|
23738
|
-
: '',
|
|
23739
|
-
};
|
|
23740
|
-
}
|
|
23741
|
-
//handle dimension
|
|
23742
|
-
const dimensionDepth = dimensions.indexOf(column.name);
|
|
23743
|
-
if (dimensionDepth > dimensionIndex) {
|
|
23744
|
-
return { cellValue: '', compareCellValue: '' };
|
|
23745
|
-
}
|
|
23746
|
-
return {
|
|
23747
|
-
cellValue: currentRow[column.name],
|
|
23748
|
-
compareCellValue: compareColumn ? currentRow[compareColumn.name] : '',
|
|
23749
|
-
};
|
|
23750
|
-
}, [dimensions]);
|
|
23751
|
-
const createSubtotalRowAtLevel = useCallback((currentRow, dimensionIndex) => {
|
|
23752
|
-
const subtotalRow = {};
|
|
23753
|
-
mainColumns.forEach((column, columnIndex) => {
|
|
23754
|
-
const compareColumn = compareColumnsByMainColumn[column.name];
|
|
23755
|
-
const { cellValue, compareCellValue } = getSubtotalCellValue({
|
|
23756
|
-
currentRow,
|
|
23757
|
-
column,
|
|
23758
|
-
columnIndex,
|
|
23759
|
-
dimensionIndex,
|
|
23760
|
-
compareColumn,
|
|
23761
|
-
});
|
|
23762
|
-
subtotalRow[column.name] = cellValue;
|
|
23763
|
-
if (compareColumn)
|
|
23764
|
-
subtotalRow[compareColumn.name] = compareCellValue;
|
|
23765
|
-
});
|
|
23766
|
-
subtotalRow[IS_TOTAL_ROW_FIELD] = 'true';
|
|
23767
|
-
return subtotalRow;
|
|
23768
|
-
}, [mainColumns, compareColumnsByMainColumn, getSubtotalCellValue]);
|
|
23769
|
-
const shouldInsertSubtotal = useCallback((data) => {
|
|
23770
|
-
const { currentRow, nextRow, previousRow, dimensionIndex } = data;
|
|
23771
|
-
const matchesNext = areDimensionsEqual(currentRow, nextRow, dimensionIndex);
|
|
23772
|
-
const matchesPrevious = areDimensionsEqual(currentRow, previousRow, dimensionIndex);
|
|
23773
|
-
return matchesNext && !matchesPrevious;
|
|
23774
|
-
}, [areDimensionsEqual]);
|
|
23775
|
-
const generateSubtotalRows = useCallback((data) => {
|
|
23776
|
-
const { currentRow, nextRow, previousRow } = data;
|
|
23777
|
-
const subtotals = [];
|
|
23778
|
-
const subtotalLevels = dimensions.slice(0, -1);
|
|
23779
|
-
subtotalLevels.forEach((_, dimensionIndex) => {
|
|
23780
|
-
if (shouldInsertSubtotal({ currentRow, nextRow, previousRow, dimensionIndex })) {
|
|
23781
|
-
const subtotalRow = createSubtotalRowAtLevel(currentRow, dimensionIndex);
|
|
23782
|
-
subtotals.push(subtotalRow);
|
|
23783
|
-
}
|
|
23784
|
-
});
|
|
23785
|
-
return [...subtotals, currentRow];
|
|
23786
|
-
}, [createSubtotalRowAtLevel, dimensions, shouldInsertSubtotal]);
|
|
23787
|
-
const buildTableWithSubtotals = useCallback(() => {
|
|
23788
|
-
const rows = [];
|
|
23789
|
-
tableData.rows.forEach((row, index) => {
|
|
23790
|
-
const nextRow = tableData.rows[index + 1];
|
|
23791
|
-
const previousRow = tableData.rows[index - 1];
|
|
23792
|
-
rows.push(...generateSubtotalRows({ currentRow: row, nextRow, previousRow }));
|
|
23793
|
-
});
|
|
23794
|
-
return rows;
|
|
23795
|
-
}, [tableData.rows, generateSubtotalRows]);
|
|
23796
|
-
const rowsWithSubtotals = useMemo(() => buildTableWithSubtotals(), [buildTableWithSubtotals]);
|
|
23797
|
-
return {
|
|
23798
|
-
columns: mainColumns,
|
|
23799
|
-
rows: rowsWithSubtotals,
|
|
23800
|
-
columnsByName,
|
|
23801
|
-
};
|
|
23248
|
+
}, [dimensions]);
|
|
23249
|
+
const createSubtotalRowAtLevel = useCallback((currentRow, dimensionIndex) => {
|
|
23250
|
+
const subtotalRow = {};
|
|
23251
|
+
mainColumns.forEach((column, columnIndex) => {
|
|
23252
|
+
const compareColumn = compareColumnsByMainColumn[column.name];
|
|
23253
|
+
const { cellValue, compareCellValue } = getSubtotalCellValue({
|
|
23254
|
+
currentRow,
|
|
23255
|
+
column,
|
|
23256
|
+
columnIndex,
|
|
23257
|
+
dimensionIndex,
|
|
23258
|
+
compareColumn,
|
|
23259
|
+
});
|
|
23260
|
+
subtotalRow[column.name] = cellValue;
|
|
23261
|
+
if (compareColumn)
|
|
23262
|
+
subtotalRow[compareColumn.name] = compareCellValue;
|
|
23263
|
+
});
|
|
23264
|
+
subtotalRow[IS_TOTAL_ROW_FIELD] = 'true';
|
|
23265
|
+
return subtotalRow;
|
|
23266
|
+
}, [mainColumns, compareColumnsByMainColumn, getSubtotalCellValue]);
|
|
23267
|
+
const shouldInsertSubtotal = useCallback((data) => {
|
|
23268
|
+
const { currentRow, nextRow, previousRow, dimensionIndex } = data;
|
|
23269
|
+
const matchesNext = areDimensionsEqual(currentRow, nextRow, dimensionIndex);
|
|
23270
|
+
const matchesPrevious = areDimensionsEqual(currentRow, previousRow, dimensionIndex);
|
|
23271
|
+
return matchesNext && !matchesPrevious;
|
|
23272
|
+
}, [areDimensionsEqual]);
|
|
23273
|
+
const generateSubtotalRows = useCallback((data) => {
|
|
23274
|
+
const { currentRow, nextRow, previousRow } = data;
|
|
23275
|
+
const subtotals = [];
|
|
23276
|
+
const subtotalLevels = dimensions.slice(0, -1);
|
|
23277
|
+
subtotalLevels.forEach((_, dimensionIndex) => {
|
|
23278
|
+
if (shouldInsertSubtotal({ currentRow, nextRow, previousRow, dimensionIndex })) {
|
|
23279
|
+
const subtotalRow = createSubtotalRowAtLevel(currentRow, dimensionIndex);
|
|
23280
|
+
subtotals.push(subtotalRow);
|
|
23281
|
+
}
|
|
23282
|
+
});
|
|
23283
|
+
return [...subtotals, currentRow];
|
|
23284
|
+
}, [createSubtotalRowAtLevel, dimensions, shouldInsertSubtotal]);
|
|
23285
|
+
const buildTableWithSubtotals = useCallback(() => {
|
|
23286
|
+
const rows = [];
|
|
23287
|
+
tableData.rows.forEach((row, index) => {
|
|
23288
|
+
const nextRow = tableData.rows[index + 1];
|
|
23289
|
+
const previousRow = tableData.rows[index - 1];
|
|
23290
|
+
rows.push(...generateSubtotalRows({ currentRow: row, nextRow, previousRow }));
|
|
23291
|
+
});
|
|
23292
|
+
return rows;
|
|
23293
|
+
}, [tableData.rows, generateSubtotalRows]);
|
|
23294
|
+
const rowsWithSubtotals = useMemo(() => buildTableWithSubtotals(), [buildTableWithSubtotals]);
|
|
23295
|
+
return {
|
|
23296
|
+
columns: mainColumns,
|
|
23297
|
+
rows: rowsWithSubtotals,
|
|
23298
|
+
columnsByName,
|
|
23299
|
+
};
|
|
23802
23300
|
};
|
|
23803
23301
|
|
|
23804
23302
|
const SCROLL_THRESHOLD = 2;
|
|
@@ -23865,6 +23363,114 @@ const useSyncedScroll = ({ columns }) => {
|
|
|
23865
23363
|
return { headerRef, bodyRef, scrollbarContainerRef, leftShadowRef, rightShadowRef };
|
|
23866
23364
|
};
|
|
23867
23365
|
|
|
23366
|
+
const getColumnLayoutStyles = (columnLayout, hasTooltipCard) => {
|
|
23367
|
+
return {
|
|
23368
|
+
'--column-cell-min-width': columnLayout.minWidth,
|
|
23369
|
+
'--column-cell-max-width': columnLayout.maxWidth,
|
|
23370
|
+
'--column-cell-justify-content': columnLayout.align,
|
|
23371
|
+
'--column-cell-padding-inline': columnLayout.paddingInline,
|
|
23372
|
+
'--column-first-padding-inline': columnLayout.columnFirstPaddingInline,
|
|
23373
|
+
'--column-wrapper-width': columnLayout.columnWrapperWidth,
|
|
23374
|
+
'--column-cell-padding-right': !hasTooltipCard ? columnLayout.paddingRight : columnLayout.paddingInline,
|
|
23375
|
+
'--column-header-cell-padding-right': !hasTooltipCard
|
|
23376
|
+
? columnLayout.headerPaddingRight
|
|
23377
|
+
: columnLayout.paddingInline,
|
|
23378
|
+
'--column-dimension-box-shadow': columnLayout.dimensionBoxShadow,
|
|
23379
|
+
'--column-border-right-width': columnLayout.borderRightWidth,
|
|
23380
|
+
};
|
|
23381
|
+
};
|
|
23382
|
+
|
|
23383
|
+
var EOrderDirectionType;
|
|
23384
|
+
(function (EOrderDirectionType) {
|
|
23385
|
+
EOrderDirectionType["ASC"] = "ASC";
|
|
23386
|
+
EOrderDirectionType["DESC"] = "DESC";
|
|
23387
|
+
})(EOrderDirectionType || (EOrderDirectionType = {}));
|
|
23388
|
+
|
|
23389
|
+
const formatReportTableDate = (dateString) => {
|
|
23390
|
+
if (!dateString)
|
|
23391
|
+
return 'None';
|
|
23392
|
+
const date = dayjsTz(dateString);
|
|
23393
|
+
const now = dayjsTz();
|
|
23394
|
+
const yesterday = dayjsTz().subtract(1, 'day');
|
|
23395
|
+
const isToday = date.format('YYYY-MM-DD') === now.format('YYYY-MM-DD');
|
|
23396
|
+
const isYesterday = date.format('YYYY-MM-DD') === yesterday.format('YYYY-MM-DD');
|
|
23397
|
+
if (isToday) {
|
|
23398
|
+
return `Today at ${date.format('HH:mm')}`;
|
|
23399
|
+
}
|
|
23400
|
+
if (isYesterday) {
|
|
23401
|
+
return `Yesterday at ${date.format('HH:mm')}`;
|
|
23402
|
+
}
|
|
23403
|
+
const daysDiff = now.diff(date, 'day');
|
|
23404
|
+
const isWithinWeek = daysDiff >= 0 && daysDiff < 7;
|
|
23405
|
+
if (isWithinWeek) {
|
|
23406
|
+
return `${date.format('dddd')} at ${date.format('HH:mm')}`;
|
|
23407
|
+
}
|
|
23408
|
+
return `${date.format('MMM D')} at ${date.format('hh:mm a')}`;
|
|
23409
|
+
};
|
|
23410
|
+
|
|
23411
|
+
const formatReportData = ({ value, formatter, getTextPrice, name, }) => {
|
|
23412
|
+
const dataTypeIsObjectOrArray = value !== null && (typeof value === 'object' || Array.isArray(value));
|
|
23413
|
+
if (dataTypeIsObjectOrArray)
|
|
23414
|
+
return value;
|
|
23415
|
+
switch (formatter) {
|
|
23416
|
+
case EReportDataType.INTEGER: {
|
|
23417
|
+
return numberWithCommas((value ?? 0).toString());
|
|
23418
|
+
}
|
|
23419
|
+
case EReportDataType.CURRENCY: {
|
|
23420
|
+
return getTextPrice(value, false);
|
|
23421
|
+
}
|
|
23422
|
+
case EReportDataType.DATE: {
|
|
23423
|
+
return formatReportTableDate(value);
|
|
23424
|
+
}
|
|
23425
|
+
case EReportDataType.PERCENT: {
|
|
23426
|
+
if (typeof value !== 'number')
|
|
23427
|
+
return calcPercentageString(0, 1, 2) ?? '';
|
|
23428
|
+
return calcPercentageString(value / 100, 1, 2) ?? '';
|
|
23429
|
+
}
|
|
23430
|
+
case EReportDataType.DURATION: {
|
|
23431
|
+
return getTimeDurationLabel(Number(value));
|
|
23432
|
+
}
|
|
23433
|
+
case EReportDataType.STRING: {
|
|
23434
|
+
const fallbackValue = name === EReportColumnKey.CAMPAIGNS ? '' : NONE_VALUE;
|
|
23435
|
+
return value ?? fallbackValue;
|
|
23436
|
+
}
|
|
23437
|
+
case EReportDataType.DAY: {
|
|
23438
|
+
return getFormattedByInterval(value, AnalyticInterval.DAY, {
|
|
23439
|
+
isExpandDetail: true,
|
|
23440
|
+
});
|
|
23441
|
+
}
|
|
23442
|
+
case EReportDataType.HOUR: {
|
|
23443
|
+
return getFormattedByInterval(value, AnalyticInterval.HOUR, {
|
|
23444
|
+
isExpandDetail: true,
|
|
23445
|
+
});
|
|
23446
|
+
}
|
|
23447
|
+
case EReportDataType.MONTH: {
|
|
23448
|
+
return getFormattedByInterval(value, AnalyticInterval.MONTH, {
|
|
23449
|
+
isExpandDetail: true,
|
|
23450
|
+
});
|
|
23451
|
+
}
|
|
23452
|
+
case EReportDataType.YEAR: {
|
|
23453
|
+
return getFormattedByInterval(value, AnalyticInterval.YEAR);
|
|
23454
|
+
}
|
|
23455
|
+
case EReportDataType.WEEK: {
|
|
23456
|
+
return getFormattedByInterval(value, AnalyticInterval.WEEK, {
|
|
23457
|
+
isExpandDetail: true,
|
|
23458
|
+
});
|
|
23459
|
+
}
|
|
23460
|
+
case EReportDataType.QUARTER: {
|
|
23461
|
+
return getFormattedByInterval(value, AnalyticInterval.QUARTER, {
|
|
23462
|
+
isExpandDetail: true,
|
|
23463
|
+
});
|
|
23464
|
+
}
|
|
23465
|
+
case EReportDataType.OBJECT:
|
|
23466
|
+
case EReportDataType.ARRAY: {
|
|
23467
|
+
return value;
|
|
23468
|
+
}
|
|
23469
|
+
default:
|
|
23470
|
+
return `${value}`;
|
|
23471
|
+
}
|
|
23472
|
+
};
|
|
23473
|
+
|
|
23868
23474
|
const useReportData = () => {
|
|
23869
23475
|
const { getTextPrice } = useConvertMoneyContext();
|
|
23870
23476
|
const formatData = ({ value, formatter, name, }) => {
|
|
@@ -23880,44 +23486,112 @@ const useReportData = () => {
|
|
|
23880
23486
|
};
|
|
23881
23487
|
};
|
|
23882
23488
|
|
|
23883
|
-
const
|
|
23884
|
-
|
|
23885
|
-
|
|
23886
|
-
|
|
23887
|
-
|
|
23888
|
-
|
|
23889
|
-
|
|
23890
|
-
|
|
23891
|
-
|
|
23892
|
-
|
|
23893
|
-
|
|
23894
|
-
|
|
23895
|
-
|
|
23896
|
-
|
|
23897
|
-
|
|
23898
|
-
|
|
23899
|
-
|
|
23900
|
-
|
|
23901
|
-
|
|
23902
|
-
|
|
23903
|
-
|
|
23904
|
-
|
|
23489
|
+
const ReportTableActionsContext = createContext({});
|
|
23490
|
+
const ReportTableActionsProvider = ({ children, onViewOrderJourney, onViewOrderDetails, onViewAllStoreOrders, }) => {
|
|
23491
|
+
return (jsx(ReportTableActionsContext.Provider, { value: { onViewOrderJourney, onViewOrderDetails, onViewAllStoreOrders }, children: children }));
|
|
23492
|
+
};
|
|
23493
|
+
const useReportTableActionsContext = () => useContext(ReportTableActionsContext);
|
|
23494
|
+
|
|
23495
|
+
var GVariantBadgeType;
|
|
23496
|
+
(function (GVariantBadgeType) {
|
|
23497
|
+
GVariantBadgeType["ORIGIN"] = "ORIGIN";
|
|
23498
|
+
GVariantBadgeType["VARIANT_B"] = "VARIANT_B";
|
|
23499
|
+
GVariantBadgeType["VARIANT_C"] = "VARIANT_C";
|
|
23500
|
+
GVariantBadgeType["VARIANT_D"] = "VARIANT_D";
|
|
23501
|
+
GVariantBadgeType["VARIANT_E"] = "VARIANT_E";
|
|
23502
|
+
})(GVariantBadgeType || (GVariantBadgeType = {}));
|
|
23503
|
+
var GVariantBadgeSize;
|
|
23504
|
+
(function (GVariantBadgeSize) {
|
|
23505
|
+
GVariantBadgeSize["XS"] = "xs";
|
|
23506
|
+
GVariantBadgeSize["SM"] = "sm";
|
|
23507
|
+
GVariantBadgeSize["MD"] = "md";
|
|
23508
|
+
GVariantBadgeSize["LG"] = "lg";
|
|
23509
|
+
})(GVariantBadgeSize || (GVariantBadgeSize = {}));
|
|
23510
|
+
var GVariantBadgeTone;
|
|
23511
|
+
(function (GVariantBadgeTone) {
|
|
23512
|
+
GVariantBadgeTone["ACTIVE"] = "active";
|
|
23513
|
+
GVariantBadgeTone["SUBDUED"] = "subdued";
|
|
23514
|
+
GVariantBadgeTone["INACTIVE"] = "inactive";
|
|
23515
|
+
})(GVariantBadgeTone || (GVariantBadgeTone = {}));
|
|
23516
|
+
|
|
23517
|
+
const GVariant = ({ variant, size, tone }) => {
|
|
23518
|
+
const sizeIcon = useMemo(() => {
|
|
23519
|
+
switch (size) {
|
|
23520
|
+
case 'xs':
|
|
23521
|
+
return '20px';
|
|
23522
|
+
case 'sm':
|
|
23523
|
+
return '24px';
|
|
23524
|
+
case 'md':
|
|
23525
|
+
return '28px';
|
|
23526
|
+
case 'lg':
|
|
23527
|
+
return '32px';
|
|
23528
|
+
default:
|
|
23529
|
+
return '28px';
|
|
23905
23530
|
}
|
|
23906
|
-
|
|
23907
|
-
|
|
23531
|
+
}, [size]);
|
|
23532
|
+
const textColor = cls({
|
|
23533
|
+
'text-variant-a': tone === 'active',
|
|
23534
|
+
'text-variant-subdued': tone === 'subdued',
|
|
23535
|
+
'text-variant-b': !tone || tone === 'inactive',
|
|
23536
|
+
});
|
|
23537
|
+
const textSize = useMemo(() => {
|
|
23538
|
+
switch (size) {
|
|
23539
|
+
case 'xs':
|
|
23540
|
+
return 'Polaris-Text--bodyXs';
|
|
23541
|
+
case 'sm':
|
|
23542
|
+
return 'Polaris-Text--bodySm';
|
|
23543
|
+
case 'md':
|
|
23544
|
+
return 'Polaris-Text--headingMd';
|
|
23545
|
+
case 'lg':
|
|
23546
|
+
return 'Polaris-Text--headingMd';
|
|
23547
|
+
default:
|
|
23548
|
+
return 'Polaris-Text--headingMd';
|
|
23549
|
+
}
|
|
23550
|
+
}, [size]);
|
|
23551
|
+
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 }) }) }));
|
|
23908
23552
|
};
|
|
23909
23553
|
|
|
23910
|
-
const
|
|
23911
|
-
|
|
23912
|
-
|
|
23913
|
-
|
|
23914
|
-
}
|
|
23915
|
-
|
|
23554
|
+
const CAMPAIGN_BACKGROUND = {
|
|
23555
|
+
ORIGIN: '#D5E5FF', //`var(--p-color-${CAMPAIGN_BACKGROUND.ORIGIN})`,
|
|
23556
|
+
VARIANT: '#FDDBE2', //`var(--p-color-${CAMPAIGN_BACKGROUND.VARIANT})`,
|
|
23557
|
+
SUBDUED: '#F2F2F2', //`var(--p-color-${CAMPAIGN_BACKGROUND.VARIANT})`,
|
|
23558
|
+
};
|
|
23559
|
+
const GVariantBadge = ({ label, variant, tone, isShowWinner, size = GVariantBadgeSize.MD, labelProps, linkAction, tooltip, hideVariant = false, }) => {
|
|
23560
|
+
const { t } = useTranslation();
|
|
23561
|
+
const background = tone === GVariantBadgeTone.ACTIVE
|
|
23562
|
+
? CAMPAIGN_BACKGROUND.ORIGIN
|
|
23563
|
+
: tone === GVariantBadgeTone.SUBDUED
|
|
23564
|
+
? CAMPAIGN_BACKGROUND.SUBDUED
|
|
23565
|
+
: CAMPAIGN_BACKGROUND.VARIANT;
|
|
23566
|
+
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') }) }))] }) }));
|
|
23567
|
+
};
|
|
23916
23568
|
|
|
23917
|
-
const
|
|
23918
|
-
|
|
23569
|
+
const CampaignsCellVersion = ({ version }) => {
|
|
23570
|
+
if (!version)
|
|
23571
|
+
return null;
|
|
23572
|
+
return jsx(GVariantBadge, { variant: version, tone: version === 'A' ? 'active' : 'inactive', size: "xs" });
|
|
23573
|
+
};
|
|
23574
|
+
|
|
23575
|
+
const CampaignsCell = ({ value, campaignsCellProps, }) => {
|
|
23576
|
+
const { orderId, gxId, isHideCampaignContent } = campaignsCellProps ?? {};
|
|
23577
|
+
const { t } = useTranslation();
|
|
23578
|
+
const { onViewOrderJourney } = useReportTableActionsContext();
|
|
23579
|
+
const [active, setActive] = useState(false);
|
|
23580
|
+
const toggleActive = useCallback(() => setActive((active) => !active), []);
|
|
23581
|
+
const campaignLeadingToOrder = value.at(0);
|
|
23582
|
+
const isShowPopupCampaigns = value.length > 1 && !isHideCampaignContent;
|
|
23583
|
+
if (!campaignLeadingToOrder)
|
|
23584
|
+
return null;
|
|
23585
|
+
return (jsx(Popover, { active: active, activator: jsxs("div", { className: cls('GReportTable__CellContent--clickable flex h-full w-full items-center px-2', {
|
|
23586
|
+
'cursor-pointer': isShowPopupCampaigns,
|
|
23587
|
+
'hover:!bg-[#f7f7f7]': !isShowPopupCampaigns,
|
|
23588
|
+
}), 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) => {
|
|
23589
|
+
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));
|
|
23590
|
+
}) }) }) }), jsx(Box, { padding: "300", children: jsx(Button, { icon: SvgChartLineIcon, fullWidth: true, onClick: () => onViewOrderJourney?.(orderId ?? '', gxId), children: t('View order journey') }) })] }) }));
|
|
23919
23591
|
};
|
|
23920
23592
|
|
|
23593
|
+
const DateCell = ({ value, isMergedWithPrev }) => (jsx(Text, { as: "span", variant: "bodySm", children: isMergedWithPrev ? '' : value }));
|
|
23594
|
+
|
|
23921
23595
|
const PreviousCell = ({ previousValue, isMergedWithPrev }) => {
|
|
23922
23596
|
if (isMergedWithPrev || typeof previousValue !== 'string')
|
|
23923
23597
|
return null;
|
|
@@ -23928,9 +23602,48 @@ const WrapperCell = ({ children, previousValue, isMergedWithPrev, columnLayout,
|
|
|
23928
23602
|
return (jsxs(GInlineCenter, { flexDirection: "column", align: columnLayout?.align, gap: "100", paddingBlock: "200", width: columnLayout?.columnWrapperWidth, children: [children, jsx(PreviousCell, { previousValue: previousValue, isMergedWithPrev: isMergedWithPrev })] }));
|
|
23929
23603
|
};
|
|
23930
23604
|
|
|
23931
|
-
const
|
|
23932
|
-
const valueString = typeof value === 'string' ? value : String(value);
|
|
23933
|
-
return (jsx(WrapperCell, { previousValue: previousValue, isMergedWithPrev: isMergedWithPrev, columnLayout: columnLayout, children: jsx("div", { className: "w-full min-w-0", children: jsx(GTextTruncated, { as: "span", variant: "bodySm", truncate: true,
|
|
23605
|
+
const GemxIdCell = ({ value, isMergedWithPrev, previousValue, columnLayout }) => {
|
|
23606
|
+
const valueString = typeof value === 'string' ? value : String(value);
|
|
23607
|
+
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 }) }) }));
|
|
23608
|
+
};
|
|
23609
|
+
|
|
23610
|
+
const CheckoutStartedDetail$1 = ({ lineItems = [], activatorWrapperProps }) => {
|
|
23611
|
+
const { t } = useTranslation();
|
|
23612
|
+
const [active, setActive] = useState(false);
|
|
23613
|
+
const toggleActive = useCallback(() => setActive((active) => !active), []);
|
|
23614
|
+
if (!lineItems || lineItems.length === 0) {
|
|
23615
|
+
return null;
|
|
23616
|
+
}
|
|
23617
|
+
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) => {
|
|
23618
|
+
const isLast = index === self.length - 1;
|
|
23619
|
+
const boxProps = {
|
|
23620
|
+
borderBlockEndWidth: '025',
|
|
23621
|
+
borderColor: 'border-secondary',
|
|
23622
|
+
paddingBlockEnd: '300',
|
|
23623
|
+
};
|
|
23624
|
+
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));
|
|
23625
|
+
}) }) }) }));
|
|
23626
|
+
};
|
|
23627
|
+
|
|
23628
|
+
const ItemsCell = ({ value }) => {
|
|
23629
|
+
const { t } = useTranslation();
|
|
23630
|
+
const { value: itemHovering, setTrue, setFalse } = useToggle(false);
|
|
23631
|
+
const lineItems = value.map((item) => ({
|
|
23632
|
+
imageURL: item.image_url,
|
|
23633
|
+
productTitle: item.product_title,
|
|
23634
|
+
quantity: Number(item.quantity) || 0,
|
|
23635
|
+
title: item.title,
|
|
23636
|
+
}));
|
|
23637
|
+
const getItemText = () => {
|
|
23638
|
+
const itemQuantity = value.reduce((acc, item) => acc + (Number(item.quantity) || 0), 0);
|
|
23639
|
+
if (itemQuantity === 1)
|
|
23640
|
+
return t('{{itemQuantity}} item', { itemQuantity });
|
|
23641
|
+
return t('{{itemQuantity}} items', { itemQuantity });
|
|
23642
|
+
};
|
|
23643
|
+
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: {
|
|
23644
|
+
paddingBlockStart: '100',
|
|
23645
|
+
opacity: itemHovering ? '1' : '0',
|
|
23646
|
+
} })] }) }));
|
|
23934
23647
|
};
|
|
23935
23648
|
|
|
23936
23649
|
const LoadingData = () => {
|
|
@@ -23955,10 +23668,12 @@ const OrderItem = ({ order }) => {
|
|
|
23955
23668
|
return dayjsTz(date).format('MMMM D, YYYY [at] h:mm a');
|
|
23956
23669
|
};
|
|
23957
23670
|
const orderId = `${order[EReportColumnKey.ORDER_ID]}`;
|
|
23671
|
+
const rawGxId = order[EReportColumnKey.GEMX_ID];
|
|
23672
|
+
const gxId = rawGxId ? `${rawGxId}` : '';
|
|
23958
23673
|
const date = `${order[EReportColumnKey.ORDER_DATE]}`;
|
|
23959
23674
|
if (!orderId)
|
|
23960
23675
|
return null;
|
|
23961
|
-
return (jsx(Box, { padding: "300", borderBlockEndWidth: "025", borderColor: "border", children: jsxs(InlineStack, { align: "space-between", blockAlign: "center", gap: "200", children: [jsxs(BlockStack, { gap: "200", children: [jsx(Text, { as: "p", variant: "bodyMd", children: `ID: ${orderId}` }), jsx(Text, { as: "p", variant: "bodyXs", tone: "subdued", children: formatDate(date) })] }), jsxs(InlineStack, { gap: "100", children: [jsx(Tooltip$1, { content: t('View order details'), children: jsx(Button, { icon: jsx(Icon, { source: SvgOrderIcon, tone: "critical" }), variant: "tertiary", size: "slim", onClick: () => onViewOrderDetails?.(orderId) }) }), jsx(Tooltip$1, { content: t('View order journey'), children: jsx(Button, { icon: jsx(Icon, { source: SvgChartLineIcon, tone: "primary" }), variant: "tertiary", size: "slim", onClick: () => onViewOrderJourney?.(orderId) }) })] })] }) }));
|
|
23676
|
+
return (jsx(Box, { padding: "300", borderBlockEndWidth: "025", borderColor: "border", children: jsxs(InlineStack, { align: "space-between", blockAlign: "center", gap: "200", children: [jsxs(BlockStack, { gap: "200", children: [jsx(Text, { as: "p", variant: "bodyMd", children: `ID: ${orderId}` }), jsx(Text, { as: "p", variant: "bodyXs", tone: "subdued", children: formatDate(date) }), gxId && (jsxs(InlineStack, { gap: "100", blockAlign: "center", children: [jsx(Text, { as: "span", variant: "bodyXs", children: t('GemX ID:') }), jsx(Box, { background: "bg-surface-emphasis-active", paddingBlock: "050", paddingInline: "150", borderRadius: "200", children: jsx(Text, { as: "span", variant: "bodySm", children: jsx("span", { style: { color: 'var(--p-color-text-emphasis-active)' }, children: gxId }) }) })] }))] }), jsxs(InlineStack, { gap: "100", children: [jsx(Tooltip$1, { content: t('View order details'), children: jsx(Button, { icon: jsx(Icon, { source: SvgOrderIcon, tone: "critical" }), variant: "tertiary", size: "slim", onClick: () => onViewOrderDetails?.(orderId) }) }), jsx(Tooltip$1, { content: t('View order journey'), children: jsx(Button, { icon: jsx(Icon, { source: SvgChartLineIcon, tone: "primary" }), variant: "tertiary", size: "slim", onClick: () => onViewOrderJourney?.(orderId, gxId) }) })] })] }) }));
|
|
23962
23677
|
};
|
|
23963
23678
|
|
|
23964
23679
|
const OrderCell = ({ value, columnLayout, orderCellProps, isPrevious, isTotalRow, isMockData, }) => {
|
|
@@ -23992,410 +23707,735 @@ const OrderCellContainer = ({ value, columnLayout, orderCellProps, previousValue
|
|
|
23992
23707
|
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
23708
|
};
|
|
23994
23709
|
|
|
23995
|
-
|
|
23996
|
-
|
|
23997
|
-
|
|
23998
|
-
|
|
23999
|
-
|
|
24000
|
-
|
|
24001
|
-
|
|
24002
|
-
}
|
|
24003
|
-
|
|
24004
|
-
|
|
24005
|
-
|
|
24006
|
-
|
|
24007
|
-
|
|
24008
|
-
|
|
24009
|
-
}
|
|
24010
|
-
|
|
24011
|
-
|
|
24012
|
-
|
|
24013
|
-
|
|
24014
|
-
|
|
24015
|
-
}
|
|
23710
|
+
const OrderIdCell = ({ value, isMockData, gxId, }) => {
|
|
23711
|
+
const { t } = useTranslation();
|
|
23712
|
+
const [active, setActive] = useState(false);
|
|
23713
|
+
const { onViewOrderJourney, onViewOrderDetails } = useReportTableActionsContext();
|
|
23714
|
+
const toggleActive = useCallback(() => setActive((active) => !active), []);
|
|
23715
|
+
if (isMockData) {
|
|
23716
|
+
return (jsx(Text, { as: "span", variant: "bodyMd", tone: "subdued", children: value }));
|
|
23717
|
+
}
|
|
23718
|
+
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: [
|
|
23719
|
+
{
|
|
23720
|
+
id: 'view_order_journey',
|
|
23721
|
+
content: t('View order journey'),
|
|
23722
|
+
icon: SvgChartLineIcon,
|
|
23723
|
+
onAction: () => onViewOrderJourney?.(value, gxId),
|
|
23724
|
+
},
|
|
23725
|
+
{
|
|
23726
|
+
id: 'view_order_details',
|
|
23727
|
+
content: t('View order details on Shopify'),
|
|
23728
|
+
icon: SvgOrderIcon,
|
|
23729
|
+
onAction: () => onViewOrderDetails?.(value),
|
|
23730
|
+
},
|
|
23731
|
+
] }) }));
|
|
23732
|
+
};
|
|
24016
23733
|
|
|
24017
|
-
const
|
|
24018
|
-
|
|
24019
|
-
|
|
24020
|
-
|
|
24021
|
-
|
|
24022
|
-
|
|
24023
|
-
|
|
24024
|
-
|
|
24025
|
-
|
|
24026
|
-
|
|
24027
|
-
|
|
24028
|
-
|
|
24029
|
-
|
|
23734
|
+
const VERSION_LABEL = {
|
|
23735
|
+
[IVariantType.VARIANT_A]: 'Control A',
|
|
23736
|
+
[IVariantType.VARIANT_B]: 'Variant B',
|
|
23737
|
+
};
|
|
23738
|
+
const VERSION_OPTIONS = [
|
|
23739
|
+
{ label: VERSION_LABEL[IVariantType.VARIANT_A], value: IVariantType.VARIANT_A },
|
|
23740
|
+
{ label: VERSION_LABEL[IVariantType.VARIANT_B], value: IVariantType.VARIANT_B },
|
|
23741
|
+
];
|
|
23742
|
+
const VersionCell = ({ value, previousValue, isMergedWithPrev, columnLayout }) => {
|
|
23743
|
+
const variantValue = VERSION_OPTIONS.find((opt) => opt.label.split(' ')[1] === value);
|
|
23744
|
+
if (isMergedWithPrev)
|
|
23745
|
+
return '';
|
|
23746
|
+
return (jsx(WrapperCell, { previousValue: previousValue, isMergedWithPrev: isMergedWithPrev, columnLayout: columnLayout, children: variantValue && (jsx(GVariantBadge, { variant: variantValue.value, tone: variantValue.value === 'A' ? 'active' : 'inactive', size: "xs" })) }));
|
|
23747
|
+
};
|
|
23748
|
+
|
|
23749
|
+
const isString = (value) => typeof value === 'string';
|
|
23750
|
+
const isNonEmptyArray = (value) => Array.isArray(value) && value.length > 0;
|
|
23751
|
+
const isOrderExperiments = (value) => {
|
|
23752
|
+
return isNonEmptyArray(value);
|
|
23753
|
+
};
|
|
23754
|
+
const isOrderItems = (value) => {
|
|
23755
|
+
return isNonEmptyArray(value);
|
|
23756
|
+
};
|
|
23757
|
+
const cellMap = {
|
|
23758
|
+
[EDimensionKey.VERSION]: ({ value, isMergedWithPrev }) => {
|
|
23759
|
+
if (!isString(value))
|
|
23760
|
+
return null;
|
|
23761
|
+
return jsx(VersionCell, { value: value, isMergedWithPrev: isMergedWithPrev });
|
|
23762
|
+
},
|
|
23763
|
+
[IRMetricKey.ORDERS]: ({ value, columnLayout, orderCellProps, previousValue, isTotalRow, isMockData }) => {
|
|
23764
|
+
if (!isString(value))
|
|
23765
|
+
return null;
|
|
23766
|
+
return (jsx(OrderCellContainer, { value: value, columnLayout: columnLayout, orderCellProps: orderCellProps, previousValue: previousValue, isTotalRow: isTotalRow, isMockData: isMockData }));
|
|
23767
|
+
},
|
|
23768
|
+
[EReportColumnKey.ORDER_DATE]: ({ value, isMergedWithPrev }) => {
|
|
23769
|
+
if (!isString(value))
|
|
23770
|
+
return null;
|
|
23771
|
+
return jsx(DateCell, { value: value, isMergedWithPrev: isMergedWithPrev });
|
|
23772
|
+
},
|
|
23773
|
+
[EReportColumnKey.ITEMS]: ({ value }) => {
|
|
23774
|
+
if (!isOrderItems(value))
|
|
23775
|
+
return null;
|
|
23776
|
+
return jsx(ItemsCell, { value: value });
|
|
23777
|
+
},
|
|
23778
|
+
[EReportColumnKey.CAMPAIGNS]: ({ value, campaignsCellProps }) => {
|
|
23779
|
+
if (!isOrderExperiments(value))
|
|
23780
|
+
return null;
|
|
23781
|
+
return jsx(CampaignsCell, { value: value, campaignsCellProps: campaignsCellProps });
|
|
23782
|
+
},
|
|
23783
|
+
[EReportColumnKey.ORDER_ID]: ({ value, isMockData, gxId }) => {
|
|
23784
|
+
if (!isString(value))
|
|
23785
|
+
return null;
|
|
23786
|
+
return jsx(OrderIdCell, { value: value, isMockData: isMockData, gxId: gxId });
|
|
23787
|
+
},
|
|
23788
|
+
[EReportColumnKey.GEMX_ID]: ({ value, isMergedWithPrev, previousValue, columnLayout }) => {
|
|
23789
|
+
if (!isString(value))
|
|
23790
|
+
return null;
|
|
23791
|
+
return (jsx(GemxIdCell, { value: value, isMergedWithPrev: isMergedWithPrev, previousValue: previousValue, columnLayout: columnLayout }));
|
|
23792
|
+
},
|
|
23793
|
+
};
|
|
23794
|
+
|
|
23795
|
+
const DefaultCell = ({ isMergedWithPrev, value, previousValue, columnLayout, isTotalRow, isDimensionCol, }) => {
|
|
23796
|
+
const valueString = typeof value === 'string' ? value : String(value);
|
|
23797
|
+
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) }) }) }));
|
|
23798
|
+
};
|
|
23799
|
+
|
|
23800
|
+
const NoneCell = ({ isMergedWithPrev, previousValue, columnLayout }) => {
|
|
23801
|
+
return (jsx(WrapperCell, { previousValue: previousValue, isMergedWithPrev: isMergedWithPrev, columnLayout: columnLayout, children: jsx("div", { className: "w-[11px] h-[2px] bg-[#8A8A8A]" }) }));
|
|
23802
|
+
};
|
|
23803
|
+
|
|
23804
|
+
const TotalCell = ({ value, isTotalRow }) => (jsx(Text, { as: "span", variant: "bodySm", fontWeight: isTotalRow ? 'semibold' : 'regular', children: value }));
|
|
23805
|
+
|
|
23806
|
+
const Cell = ({ value, gxId, isMergedWithPrev, columnLayout, name, isDimensionCol, formatter, hasTooltipCard, previousValue, orderCellProps, campaignsCellProps, isTotalRow, isMockData, }) => {
|
|
23807
|
+
const columnLayoutStyles = getColumnLayoutStyles(columnLayout, hasTooltipCard);
|
|
23808
|
+
const { formatData } = useReportData();
|
|
23809
|
+
const formattedValue = formatData({ value, formatter, name });
|
|
23810
|
+
const formattedPreviousValue = typeof previousValue === 'undefined' ? previousValue : formatData({ value: previousValue, formatter, name });
|
|
23811
|
+
const cellStyles = {
|
|
23812
|
+
borderTop: isMergedWithPrev ? '0' : undefined,
|
|
23813
|
+
...columnLayoutStyles,
|
|
23814
|
+
};
|
|
23815
|
+
const renderContent = () => {
|
|
23816
|
+
if (value === 'Total') {
|
|
23817
|
+
return jsx(TotalCell, { value: value, isTotalRow: isTotalRow });
|
|
24030
23818
|
}
|
|
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';
|
|
23819
|
+
let Renderer = cellMap[name] ?? DefaultCell;
|
|
23820
|
+
if (formattedValue === NONE_VALUE) {
|
|
23821
|
+
Renderer = NoneCell;
|
|
24049
23822
|
}
|
|
24050
|
-
|
|
24051
|
-
|
|
23823
|
+
return (jsx(Renderer, { value: formattedValue, gxId: gxId, name: name, isMergedWithPrev: isMergedWithPrev, previousValue: formattedPreviousValue, columnLayout: columnLayout, orderCellProps: orderCellProps, campaignsCellProps: campaignsCellProps, isTotalRow: isTotalRow, isDimensionCol: isDimensionCol, isMockData: isMockData }));
|
|
23824
|
+
};
|
|
23825
|
+
return (jsx("div", { className: cls('GReportTable__Cell', { 'GReportTable__Cell--dimension': isDimensionCol }), style: cellStyles, children: jsx("div", { className: "GReportTable__CellContent", style: columnLayoutStyles, children: renderContent() }) }));
|
|
24052
23826
|
};
|
|
24053
23827
|
|
|
24054
|
-
const
|
|
24055
|
-
|
|
24056
|
-
|
|
24057
|
-
|
|
24058
|
-
|
|
24059
|
-
const
|
|
24060
|
-
|
|
24061
|
-
|
|
24062
|
-
|
|
24063
|
-
|
|
24064
|
-
|
|
24065
|
-
|
|
24066
|
-
|
|
23828
|
+
const Row = ({ row, rowIndex, columns, dimensions, prevRow, columnLayoutMap, orderCellProps, isHideCampaignContent, minWidth, isMockData, }) => {
|
|
23829
|
+
const checkMergedWithPrev = (col) => {
|
|
23830
|
+
const isDimensionCol = dimensions.includes(col);
|
|
23831
|
+
let isMergedWithPrev = false;
|
|
23832
|
+
if (isDimensionCol && rowIndex > 0 && prevRow) {
|
|
23833
|
+
const dimIndex = dimensions.indexOf(col);
|
|
23834
|
+
const allMatch = dimensions.slice(0, dimIndex + 1).every((d) => row[d] === prevRow[d]);
|
|
23835
|
+
isMergedWithPrev = allMatch;
|
|
23836
|
+
}
|
|
23837
|
+
return isMergedWithPrev;
|
|
23838
|
+
};
|
|
23839
|
+
const customOrderCellProps = orderCellProps
|
|
23840
|
+
? {
|
|
23841
|
+
...orderCellProps,
|
|
23842
|
+
onClickOrderCell: (data) => orderCellProps?.onClickOrderCell({ row, isPrevious: data.isPrevious }),
|
|
23843
|
+
}
|
|
23844
|
+
: orderCellProps;
|
|
23845
|
+
return (jsx("div", { className: "GReportTable__Row group/GReportTable__Row", style: { minWidth }, children: columns.map((col) => {
|
|
23846
|
+
const hasTooltipCard = !!col.tooltipCardProps;
|
|
23847
|
+
const orderId = row[EReportColumnKey.ORDER_ID]?.toString() ?? '';
|
|
23848
|
+
const gxId = row[EReportColumnKey.GEMX_ID]?.toString() ?? '';
|
|
23849
|
+
return (jsx(Cell, { value: row[col.name], gxId: gxId, isTotalRow: row[IS_TOTAL_ROW_FIELD], previousValue: getMetricPreviousValue(row, col.name), isMergedWithPrev: checkMergedWithPrev(col.name), columnLayout: columnLayoutMap[col.name], name: col.name, campaignsCellProps: { orderId, gxId, isHideCampaignContent }, isDimensionCol: dimensions.includes(col.name), formatter: col.dataType, hasTooltipCard: hasTooltipCard, orderCellProps: customOrderCellProps, isMockData: isMockData }, col.name));
|
|
23850
|
+
}) }));
|
|
24067
23851
|
};
|
|
24068
23852
|
|
|
24069
|
-
const
|
|
24070
|
-
|
|
24071
|
-
return null;
|
|
24072
|
-
return jsx(GVariantBadge, { variant: version, tone: version === 'A' ? 'active' : 'inactive', size: "xs" });
|
|
23853
|
+
const SummaryCell = ({ currentValue, previousValue, showPrevious, columnLayout }) => {
|
|
23854
|
+
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
23855
|
};
|
|
24074
23856
|
|
|
24075
|
-
const
|
|
24076
|
-
const { orderId, isHideCampaignContent } = campaignsCellProps ?? {};
|
|
23857
|
+
const SummaryRow = ({ columns, row, dimensions, summary, columnLayoutMap }) => {
|
|
24077
23858
|
const { t } = useTranslation();
|
|
24078
|
-
const {
|
|
24079
|
-
const
|
|
24080
|
-
|
|
24081
|
-
const campaignLeadingToOrder = value.at(0);
|
|
24082
|
-
const isShowPopupCampaigns = value.length > 1 && !isHideCampaignContent;
|
|
24083
|
-
if (!campaignLeadingToOrder)
|
|
23859
|
+
const { showPrevious, previousContent, content } = summary || {};
|
|
23860
|
+
const { formatData } = useReportData();
|
|
23861
|
+
if (summary?.hide || !dimensions.length)
|
|
24084
23862
|
return null;
|
|
24085
|
-
|
|
24086
|
-
|
|
24087
|
-
|
|
24088
|
-
|
|
24089
|
-
|
|
24090
|
-
|
|
23863
|
+
const getCellValue = (columnName, index, formatter) => {
|
|
23864
|
+
const layout = columnLayoutMap[columnName];
|
|
23865
|
+
if (index === 0)
|
|
23866
|
+
return (jsx(SummaryCell, { currentValue: content || t('Summary'), showPrevious: showPrevious, previousValue: previousContent, columnLayout: layout }));
|
|
23867
|
+
const isDimensionCol = dimensions.includes(columnName);
|
|
23868
|
+
if (isDimensionCol)
|
|
23869
|
+
return '';
|
|
23870
|
+
const cellValue = row?.[getTotalColumnName(columnName)];
|
|
23871
|
+
const previousValue = row?.[getPreviousTotalColumnName(columnName)];
|
|
23872
|
+
const formattedValue = cellValue == null ? cellValue : formatData({ value: cellValue, formatter, name: columnName });
|
|
23873
|
+
const formattedPreviousValue = previousValue == null ? previousValue : formatData({ value: previousValue, formatter, name: columnName });
|
|
23874
|
+
if (typeof formattedValue === 'object')
|
|
23875
|
+
return '';
|
|
23876
|
+
return (jsx(SummaryCell, { currentValue: formattedValue, showPrevious: showPrevious, previousValue: formattedPreviousValue, columnLayout: layout }));
|
|
23877
|
+
};
|
|
23878
|
+
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
23879
|
};
|
|
24092
23880
|
|
|
24093
|
-
const
|
|
24094
|
-
[
|
|
24095
|
-
|
|
23881
|
+
const getOrderTooltip = (field, direction) => {
|
|
23882
|
+
if (!reportOrderTooltip[field])
|
|
23883
|
+
return DEFAULT_TOOLTIP[direction];
|
|
23884
|
+
return reportOrderTooltip[field][direction];
|
|
24096
23885
|
};
|
|
24097
|
-
|
|
24098
|
-
|
|
24099
|
-
{
|
|
24100
|
-
];
|
|
24101
|
-
|
|
24102
|
-
|
|
24103
|
-
|
|
24104
|
-
|
|
24105
|
-
|
|
23886
|
+
|
|
23887
|
+
const SortableHeaderWithTooltip = ({ item, orderBy, onChangeOrderBy }) => {
|
|
23888
|
+
const { displayName, name, tooltipCardProps } = item;
|
|
23889
|
+
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) }) }))] }));
|
|
23890
|
+
function hasOrderByName(name) {
|
|
23891
|
+
const orderByField = orderBy?.[name];
|
|
23892
|
+
return !!orderByField;
|
|
23893
|
+
}
|
|
23894
|
+
function getSortTooltip(name) {
|
|
23895
|
+
const orderByField = orderBy?.[name];
|
|
23896
|
+
if (!hasOrderByName(name) || !orderByField)
|
|
23897
|
+
return undefined;
|
|
23898
|
+
const content = getOrderTooltip(name, orderByField?.direction);
|
|
23899
|
+
return { content };
|
|
23900
|
+
}
|
|
23901
|
+
function getOrderIcon(name) {
|
|
23902
|
+
const orderByField = orderBy?.[name];
|
|
23903
|
+
if (!orderByField)
|
|
23904
|
+
return SvgArrowUpIcon;
|
|
23905
|
+
return orderByField.direction === EOrderDirectionType.ASC ? SvgArrowUpIcon : SvgArrowDownIcon;
|
|
23906
|
+
}
|
|
24106
23907
|
};
|
|
24107
23908
|
|
|
24108
|
-
const
|
|
24109
|
-
const {
|
|
24110
|
-
|
|
24111
|
-
|
|
24112
|
-
|
|
24113
|
-
|
|
24114
|
-
return (jsx(Text, { as: "span", variant: "bodyMd", tone: "subdued", children: value }));
|
|
23909
|
+
const SortableHeader = ({ item, orderBy, itemHovering, onChangeOrderBy }) => {
|
|
23910
|
+
const { displayName, name } = item;
|
|
23911
|
+
function getTooltipInfo(name) {
|
|
23912
|
+
const orderByField = orderBy?.[name];
|
|
23913
|
+
const content = getOrderTooltip(name, orderByField?.direction || EOrderDirectionType.ASC);
|
|
23914
|
+
return { content };
|
|
24115
23915
|
}
|
|
24116
|
-
|
|
24117
|
-
|
|
24118
|
-
|
|
24119
|
-
|
|
24120
|
-
|
|
24121
|
-
|
|
24122
|
-
|
|
24123
|
-
|
|
24124
|
-
|
|
24125
|
-
|
|
24126
|
-
icon: SvgOrderIcon,
|
|
24127
|
-
onAction: () => onViewOrderDetails?.(value),
|
|
24128
|
-
},
|
|
24129
|
-
] }) }));
|
|
23916
|
+
function getOpacity(name) {
|
|
23917
|
+
return itemHovering === name ? '1' : '0';
|
|
23918
|
+
}
|
|
23919
|
+
function getOrderIcon(name) {
|
|
23920
|
+
const orderByField = orderBy?.[name];
|
|
23921
|
+
if (!orderByField)
|
|
23922
|
+
return SvgSortAscendingIcon;
|
|
23923
|
+
return orderByField.direction === EOrderDirectionType.ASC ? SvgSortAscendingIcon : SvgSortDescendingIcon;
|
|
23924
|
+
}
|
|
23925
|
+
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) }) })] }));
|
|
24130
23926
|
};
|
|
24131
23927
|
|
|
24132
|
-
const
|
|
23928
|
+
const Header = ({ columns, columnLayoutMap, activeColumn, orderBy, showSummary, onChangeOrderBy, }) => {
|
|
23929
|
+
const [itemHovering, setItemHovering] = useState();
|
|
23930
|
+
return (jsx("div", { className: cls('GReportTable__Header', {
|
|
23931
|
+
'GReportTable__Header--hide-summary': !showSummary,
|
|
23932
|
+
}), children: columns.map((item) => {
|
|
23933
|
+
const isTooltipCard = !!item.tooltipCardProps;
|
|
23934
|
+
const SortableHeaderComponent = isTooltipCard ? SortableHeaderWithTooltip : SortableHeader;
|
|
23935
|
+
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));
|
|
23936
|
+
}) }));
|
|
23937
|
+
};
|
|
24133
23938
|
|
|
24134
|
-
const
|
|
23939
|
+
const WrapperHeader = forwardRef(({ columns, dimensions, row, columnLayoutMap, activeColumn, orderBy, summary, minWidth, onChangeOrderBy }, ref) => {
|
|
23940
|
+
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 })] }) }));
|
|
23941
|
+
});
|
|
23942
|
+
WrapperHeader.displayName = 'WrapperHeader';
|
|
23943
|
+
|
|
23944
|
+
const Pagination = ({ totalRows, itemCount, viewAllMetricContent = 'order', showViewAllButton, paginationProps, isPaginationHidden, isMockData, }) => {
|
|
24135
23945
|
const { t } = useTranslation();
|
|
24136
|
-
const
|
|
24137
|
-
const
|
|
24138
|
-
|
|
23946
|
+
const { onViewAllStoreOrders } = useReportTableActionsContext();
|
|
23947
|
+
const isHasTotalRows = Boolean(totalRows && totalRows > 0);
|
|
23948
|
+
const isHasTotalStoreOrders = Boolean(itemCount && itemCount > 0);
|
|
23949
|
+
const isShowViewAllStoreOrders = isHasTotalStoreOrders && showViewAllButton;
|
|
23950
|
+
const handleClickViewAllStoreOrders = () => {
|
|
23951
|
+
onViewAllStoreOrders?.();
|
|
23952
|
+
};
|
|
23953
|
+
if (isPaginationHidden)
|
|
24139
23954
|
return null;
|
|
23955
|
+
return (jsxs("div", { className: cls('GReportTable__Pagination', {
|
|
23956
|
+
'justify-end': isShowViewAllStoreOrders,
|
|
23957
|
+
'justify-center': isHasTotalRows,
|
|
23958
|
+
'justify-between': (isHasTotalRows || paginationProps) && isShowViewAllStoreOrders,
|
|
23959
|
+
}), children: [paginationProps && jsx(GPagination, { ...paginationProps }), isHasTotalRows && (jsx(Text, { variant: "bodyMd", as: "span", children: t('{{count}} rows', { count: totalRows }) })), isShowViewAllStoreOrders && (jsx(GMockDataTooltip, { isMockData: isMockData, children: jsx(Button, { variant: "plain", disabled: isMockData, onClick: handleClickViewAllStoreOrders, children: getViewAllStoreOrdersText() }) }))] }));
|
|
23960
|
+
function getViewAllStoreOrdersText() {
|
|
23961
|
+
if (itemCount && itemCount > 1) {
|
|
23962
|
+
return t('View all store {{metric}}s by date range ({{itemCount}})', {
|
|
23963
|
+
itemCount,
|
|
23964
|
+
metric: viewAllMetricContent,
|
|
23965
|
+
});
|
|
23966
|
+
}
|
|
23967
|
+
return t('View all store {{metric}} by date range(1)', { metric: viewAllMetricContent });
|
|
24140
23968
|
}
|
|
24141
|
-
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) => {
|
|
24142
|
-
const isLast = index === self.length - 1;
|
|
24143
|
-
const boxProps = {
|
|
24144
|
-
borderBlockEndWidth: '025',
|
|
24145
|
-
borderColor: 'border-secondary',
|
|
24146
|
-
paddingBlockEnd: '300',
|
|
24147
|
-
};
|
|
24148
|
-
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));
|
|
24149
|
-
}) }) }) }));
|
|
24150
23969
|
};
|
|
24151
23970
|
|
|
24152
|
-
const
|
|
24153
|
-
|
|
24154
|
-
|
|
24155
|
-
|
|
24156
|
-
|
|
24157
|
-
|
|
24158
|
-
|
|
24159
|
-
|
|
24160
|
-
}));
|
|
24161
|
-
|
|
24162
|
-
|
|
24163
|
-
|
|
24164
|
-
|
|
24165
|
-
|
|
23971
|
+
const ScrollBar = forwardRef(({ isPaginationHidden }, ref) => {
|
|
23972
|
+
return (jsx("div", { className: cls('GReportTable__ScrollBarContainer', {
|
|
23973
|
+
'GReportTable__ScrollBarContainer--pagination-hidden': isPaginationHidden,
|
|
23974
|
+
}), ref: ref, children: jsx("div", { className: "GReportTable__ScrollBar", children: jsx("div", { className: "GReportTable__ScrollBarContent" }) }) }));
|
|
23975
|
+
});
|
|
23976
|
+
ScrollBar.displayName = 'ScrollBar';
|
|
23977
|
+
|
|
23978
|
+
const WrapperFooter = ({ scrollbarContainerRef, itemCount, totalPaginationRows, showViewAllButton, paginationProps, isPaginationHidden, isMockData, }) => {
|
|
23979
|
+
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 })] }));
|
|
23980
|
+
};
|
|
23981
|
+
|
|
23982
|
+
var GEMX_LOGO = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzgiIGhlaWdodD0iNDIiIHZpZXdCb3g9IjAgMCAzOCA0MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM4MzQzXzMwMTI3KSI+CjxwYXRoIGQ9Ik0yMi43Nzc4IDEuODk4NjdMMTkuNTU5IDcuNzcyMDZDMTkuNTMyNCA3LjgyNDYyIDE5LjUzMjQgNy44OTAzMiAxOS41NTkgNy45NDI4OEwyNi40NjIyIDIwLjU0MzdDMjYuNTI4NyAyMC42Njg2IDI2LjcwODMgMjAuNjY4NiAyNi43NzQ4IDIwLjU0MzdMMzcuODg3NyAwLjI2Mjc5MkMzNy45NTQyIDAuMTQ0NTM1IDM3Ljg2NzggMCAzNy43MjgxIDBIMjYuMDAzM0MyNC42NTMzIDAgMjMuNDE2MyAwLjcyOTI0NyAyMi43Nzc4IDEuODk4NjdaIiBmaWxsPSIjQ0NDQ0NDIi8+CjxwYXRoIGQ9Ik0xMi4zODI5IDBIMC40NTE5OTVDMC4xMTI4MjEgMCAtMC4xMDY2NDUgMC4zNjEzMzggMC4wNTk2MTY4IDAuNjU2OTc5TDExLjA5OTQgMjAuODEzMUwwLjA1Mjk2NjMgNDAuOTgyNEMtMC4xMDY2NDUgNDEuMjc4IDAuMTA2MTcgNDEuNjM5MyAwLjQ1MTk5NSA0MS42MzkzSDEyLjM1NjNDMTIuNjIyNCA0MS42MzkzIDEyLjg3NTEgNDEuNDk0OCAxMy4wMDE0IDQxLjI1ODNMMjQuMDQxMiAyMS4xMDIyQzI0LjE0NzYgMjAuOTExNiAyNC4xNDc2IDIwLjY3NTEgMjQuMDQxMiAyMC40ODQ2TDEzLjAyOCAwLjM4MTA0OEMxMi45MDE3IDAuMTQ0NTM1IDEyLjY1NTYgMCAxMi4zODI5IDBaIiBmaWxsPSIjQ0NDQ0NDIi8+CjxwYXRoIGQ9Ik0yMi43Nzc4IDM5Ljc5OTdMMTkuNTU5IDMzLjkyNjNDMTkuNTMyNCAzMy44NzM4IDE5LjUzMjQgMzMuODA4MSAxOS41NTkgMzMuNzU1NUwyNi40NjIyIDIxLjE1NDdDMjYuNTI4NyAyMS4wMjk4IDI2LjcwODMgMjEuMDI5OCAyNi43NzQ4IDIxLjE1NDdMMzcuODgxMSA0MS40MzU2QzM3Ljk0NzYgNDEuNTUzOSAzNy44NjExIDQxLjY5ODQgMzcuNzIxNSA0MS42OTg0SDI1Ljk5NjdDMjQuNjQ2NiA0MS42OTg0IDIzLjQwOTYgNDAuOTY5MSAyMi43NzEyIDM5Ljc5OTdIMjIuNzc3OFoiIGZpbGw9IiNDQ0NDQ0MiLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8zODM0M18zMDEyNyI+CjxyZWN0IHdpZHRoPSIzNy45MDc3IiBoZWlnaHQ9IjQxLjY5ODUiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";
|
|
23983
|
+
|
|
23984
|
+
const COLOR_NORMAL = '#FFFFFF';
|
|
23985
|
+
const COLOR_ACTIVE = '#F8F8F8';
|
|
23986
|
+
const ReportTableSkeleton = ({ rows = 3, columns = 2, startBackgroundColor = 'normal', hiddenPagination = true, showLogo = false, }) => {
|
|
23987
|
+
const colors = startBackgroundColor === 'normal' ? [COLOR_NORMAL, COLOR_ACTIVE] : [COLOR_ACTIVE, COLOR_NORMAL];
|
|
23988
|
+
const getRowColor = (index) => colors[index % 2];
|
|
23989
|
+
const getColJustify = (colIndex) => {
|
|
23990
|
+
if (colIndex === 0)
|
|
23991
|
+
return 'start';
|
|
23992
|
+
if (colIndex === columns - 1)
|
|
23993
|
+
return 'end';
|
|
23994
|
+
return 'center';
|
|
24166
23995
|
};
|
|
24167
|
-
return (
|
|
24168
|
-
|
|
24169
|
-
|
|
24170
|
-
|
|
23996
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: cls('GReportTable__Container', {
|
|
23997
|
+
'GReportTable__Container--pagination-hidden': hiddenPagination,
|
|
23998
|
+
}), 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: {
|
|
23999
|
+
backgroundColor: getRowColor(rowIndex),
|
|
24000
|
+
...getColumnLayoutStyles({
|
|
24001
|
+
align: getColJustify(colIndex),
|
|
24002
|
+
}),
|
|
24003
|
+
}, 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 }) }))] }));
|
|
24171
24004
|
};
|
|
24172
24005
|
|
|
24173
|
-
const
|
|
24174
|
-
const
|
|
24175
|
-
const
|
|
24176
|
-
|
|
24006
|
+
const mockDimensions = ['session_device_type', 'month', 'session_country', 'session_device_os'];
|
|
24007
|
+
const mockMetrics = ['online_store_visitors', 'sessions', 'bounces'];
|
|
24008
|
+
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, }) => {
|
|
24009
|
+
const { summary = {}, hideBorderTop, hidePaginationRow } = options ?? {};
|
|
24010
|
+
const { columns, rows } = useReportTable({ dimensions, metrics, tableData: data ?? { columns: [], rows: [] } });
|
|
24011
|
+
const { headerRef, bodyRef, scrollbarContainerRef, leftShadowRef, rightShadowRef } = useSyncedScroll({ columns });
|
|
24012
|
+
const tableDimensionLayout = dimensionLayout ?? DEFAULT_DIMENSION_LAYOUT;
|
|
24013
|
+
const isEmpty = rows.length === 0;
|
|
24014
|
+
const totalPaginationRows = hidePaginationRow ? 0 : rows.length;
|
|
24015
|
+
const isHasTotalRows = Boolean(totalPaginationRows && totalPaginationRows > 0);
|
|
24016
|
+
const isPaginationHidden = !isHasTotalRows && !showViewAllButton && !paginationProps;
|
|
24017
|
+
const columnLayoutMap = useMemo(() => {
|
|
24018
|
+
return columns.reduce((acc, col) => {
|
|
24019
|
+
const tableMetricLayout = metricLayouts?.[col.name] ?? DEFAULT_METRIC_LAYOUT;
|
|
24020
|
+
acc[col.name] = dimensions.includes(col.name) ? tableDimensionLayout : tableMetricLayout;
|
|
24021
|
+
return acc;
|
|
24022
|
+
}, {});
|
|
24023
|
+
}, [columns, metricLayouts, tableDimensionLayout, dimensions]);
|
|
24024
|
+
const totalTableWidth = useMemo(() => {
|
|
24025
|
+
return columns.reduce((acc, col) => {
|
|
24026
|
+
const layout = columnLayoutMap[col.name];
|
|
24027
|
+
const widthStr = layout?.minWidth || '0';
|
|
24028
|
+
const widthVal = parseInt(widthStr, 10) || 0;
|
|
24029
|
+
return acc + widthVal;
|
|
24030
|
+
}, 0);
|
|
24031
|
+
}, [columns, columnLayoutMap]);
|
|
24032
|
+
if (isLoading)
|
|
24033
|
+
return jsx(ReportTableSkeleton, { ...skeletons });
|
|
24034
|
+
if (isEmpty)
|
|
24035
|
+
return emptyStateComponent ? (jsx(ReportTableActionsProvider, { onViewAllStoreOrders: onViewAllStoreOrders, children: renderEmptyState() })) : null;
|
|
24036
|
+
return (jsx(ReportTableActionsProvider, { onViewOrderJourney: onViewOrderJourney, onViewOrderDetails: onViewOrderDetails, onViewAllStoreOrders: onViewAllStoreOrders, children: jsxs("div", { className: cls('GReportTable__Container', {
|
|
24037
|
+
'GReportTable__Container--border-top': !hideBorderTop,
|
|
24038
|
+
'GReportTable__Container--pagination-hidden': isPaginationHidden,
|
|
24039
|
+
}), 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 })] }) }));
|
|
24040
|
+
function renderEmptyState() {
|
|
24041
|
+
return (jsxs("div", { className: cls('GReportTable__Container', {
|
|
24042
|
+
'GReportTable__Container--border-top': !hideBorderTop,
|
|
24043
|
+
}), children: [emptyStateComponent, jsx(WrapperFooter, { totalPaginationRows: 0, itemCount: itemCount, showViewAllButton: showViewAllButton, paginationProps: paginationProps, isPaginationHidden: true, isMockData: isMockData })] }));
|
|
24044
|
+
}
|
|
24177
24045
|
};
|
|
24178
|
-
|
|
24179
|
-
|
|
24046
|
+
|
|
24047
|
+
const ORDER_LISTING_DIMENSION_LAYOUT = {
|
|
24048
|
+
width: '158px',
|
|
24049
|
+
minWidth: '158px',
|
|
24050
|
+
maxWidth: '158px',
|
|
24051
|
+
paddingInline: '12px',
|
|
24052
|
+
columnFirstPaddingInline: '12px',
|
|
24053
|
+
align: 'start',
|
|
24054
|
+
dimensionBoxShadow: 'none',
|
|
24055
|
+
borderRightWidth: '0px',
|
|
24056
|
+
};
|
|
24057
|
+
// Remaining space after fixed Order ID column
|
|
24058
|
+
const METRIC_COLUMN_MAX_WIDTH = `max(var(--column-cell-min-width), calc(100% - ${ORDER_LISTING_DIMENSION_LAYOUT.width}))`;
|
|
24059
|
+
const ORDER_LISTING_METRIC_LAYOUTS = {
|
|
24060
|
+
[EReportColumnKey.GEMX_ID]: {
|
|
24061
|
+
minWidth: '120px',
|
|
24062
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24063
|
+
align: 'start',
|
|
24064
|
+
columnWrapperWidth: '100%',
|
|
24065
|
+
},
|
|
24066
|
+
[EReportColumnKey.ORDER_DATE]: {
|
|
24067
|
+
minWidth: '170px',
|
|
24068
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24069
|
+
align: 'start',
|
|
24070
|
+
},
|
|
24071
|
+
[EReportColumnKey.TOTAL]: {
|
|
24072
|
+
minWidth: '96px',
|
|
24073
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24074
|
+
align: 'end',
|
|
24075
|
+
},
|
|
24076
|
+
[EReportColumnKey.CAMPAIGNS]: {
|
|
24077
|
+
minWidth: '128px',
|
|
24078
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24079
|
+
align: 'start',
|
|
24080
|
+
columnWrapperWidth: '100%',
|
|
24081
|
+
},
|
|
24082
|
+
[EReportColumnKey.TRAFFIC_SOURCE]: {
|
|
24083
|
+
minWidth: '120px',
|
|
24084
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24085
|
+
align: 'start',
|
|
24086
|
+
},
|
|
24087
|
+
[EReportColumnKey.DEVICE]: {
|
|
24088
|
+
minWidth: '120px',
|
|
24089
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24090
|
+
align: 'start',
|
|
24091
|
+
},
|
|
24092
|
+
[EReportColumnKey.VISITOR]: {
|
|
24093
|
+
minWidth: '120px',
|
|
24094
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24095
|
+
align: 'start',
|
|
24096
|
+
},
|
|
24097
|
+
[EReportColumnKey.ITEMS]: {
|
|
24098
|
+
minWidth: '120px',
|
|
24099
|
+
maxWidth: METRIC_COLUMN_MAX_WIDTH,
|
|
24100
|
+
align: 'start',
|
|
24101
|
+
},
|
|
24180
24102
|
};
|
|
24181
|
-
const
|
|
24182
|
-
|
|
24183
|
-
|
|
24184
|
-
|
|
24185
|
-
|
|
24103
|
+
const ORDER_LISTING_COLUMNS = [
|
|
24104
|
+
{
|
|
24105
|
+
name: EReportColumnKey.ORDER_ID,
|
|
24106
|
+
dataType: EReportDataType.STRING,
|
|
24107
|
+
displayName: 'Order ID',
|
|
24108
|
+
tooltipCardProps: {
|
|
24109
|
+
tooltip: {
|
|
24110
|
+
title: 'Order ID',
|
|
24111
|
+
content: 'Shopify identifier for the order',
|
|
24112
|
+
width: 'wide',
|
|
24113
|
+
},
|
|
24114
|
+
},
|
|
24186
24115
|
},
|
|
24187
|
-
|
|
24188
|
-
|
|
24189
|
-
|
|
24190
|
-
|
|
24116
|
+
{
|
|
24117
|
+
name: EReportColumnKey.GEMX_ID,
|
|
24118
|
+
dataType: EReportDataType.STRING,
|
|
24119
|
+
displayName: 'GemX ID',
|
|
24120
|
+
tooltipCardProps: {
|
|
24121
|
+
tooltip: {
|
|
24122
|
+
title: 'GemX ID',
|
|
24123
|
+
content: 'A tracking ID GemX attaches to the order so you can trace where it came from',
|
|
24124
|
+
width: 'wide',
|
|
24125
|
+
},
|
|
24126
|
+
},
|
|
24191
24127
|
},
|
|
24192
|
-
|
|
24193
|
-
|
|
24194
|
-
|
|
24195
|
-
|
|
24128
|
+
{
|
|
24129
|
+
name: EReportColumnKey.ORDER_DATE,
|
|
24130
|
+
dataType: EReportDataType.DATE,
|
|
24131
|
+
displayName: 'Date',
|
|
24132
|
+
tooltipCardProps: {
|
|
24133
|
+
tooltip: {
|
|
24134
|
+
title: 'Date',
|
|
24135
|
+
content: 'Date when the order was placed',
|
|
24136
|
+
width: 'wide',
|
|
24137
|
+
},
|
|
24138
|
+
},
|
|
24196
24139
|
},
|
|
24197
|
-
|
|
24198
|
-
|
|
24199
|
-
|
|
24200
|
-
|
|
24140
|
+
{
|
|
24141
|
+
name: EReportColumnKey.TOTAL,
|
|
24142
|
+
dataType: EReportDataType.CURRENCY,
|
|
24143
|
+
displayName: 'Total',
|
|
24144
|
+
tooltipCardProps: {
|
|
24145
|
+
tooltip: {
|
|
24146
|
+
title: 'Total',
|
|
24147
|
+
content: 'The money amount customers paid for the order',
|
|
24148
|
+
width: 'wide',
|
|
24149
|
+
},
|
|
24150
|
+
},
|
|
24201
24151
|
},
|
|
24202
|
-
|
|
24203
|
-
|
|
24204
|
-
|
|
24205
|
-
|
|
24152
|
+
{
|
|
24153
|
+
name: EReportColumnKey.CAMPAIGNS,
|
|
24154
|
+
dataType: EReportDataType.OBJECT,
|
|
24155
|
+
displayName: 'Experiment version',
|
|
24156
|
+
tooltipCardProps: {
|
|
24157
|
+
tooltip: {
|
|
24158
|
+
title: 'Experiment',
|
|
24159
|
+
content: 'The specific template variant shown to the customer that resulted in the order',
|
|
24160
|
+
width: 'wide',
|
|
24161
|
+
},
|
|
24162
|
+
},
|
|
24206
24163
|
},
|
|
24207
|
-
|
|
24208
|
-
|
|
24209
|
-
|
|
24210
|
-
|
|
24164
|
+
{
|
|
24165
|
+
name: EReportColumnKey.TRAFFIC_SOURCE,
|
|
24166
|
+
dataType: EReportDataType.STRING,
|
|
24167
|
+
displayName: 'Traffic source',
|
|
24168
|
+
tooltipCardProps: {
|
|
24169
|
+
tooltip: {
|
|
24170
|
+
title: 'Traffic source',
|
|
24171
|
+
content: 'Where your customers came from',
|
|
24172
|
+
width: 'wide',
|
|
24173
|
+
},
|
|
24174
|
+
},
|
|
24175
|
+
},
|
|
24176
|
+
{
|
|
24177
|
+
name: EReportColumnKey.DEVICE,
|
|
24178
|
+
dataType: EReportDataType.STRING,
|
|
24179
|
+
displayName: 'Device',
|
|
24180
|
+
tooltipCardProps: {
|
|
24181
|
+
tooltip: {
|
|
24182
|
+
title: 'Device',
|
|
24183
|
+
content: 'Device customers used to place the order',
|
|
24184
|
+
width: 'wide',
|
|
24185
|
+
},
|
|
24186
|
+
},
|
|
24187
|
+
},
|
|
24188
|
+
{
|
|
24189
|
+
name: EReportColumnKey.VISITOR,
|
|
24190
|
+
dataType: EReportDataType.STRING,
|
|
24191
|
+
displayName: 'Customer type',
|
|
24192
|
+
tooltipCardProps: {
|
|
24193
|
+
tooltip: {
|
|
24194
|
+
title: 'Customer type',
|
|
24195
|
+
content: 'Customers who placed the order',
|
|
24196
|
+
width: 'wide',
|
|
24197
|
+
},
|
|
24198
|
+
},
|
|
24199
|
+
},
|
|
24200
|
+
{
|
|
24201
|
+
name: EReportColumnKey.ITEMS,
|
|
24202
|
+
dataType: EReportDataType.OBJECT,
|
|
24203
|
+
displayName: 'Items',
|
|
24204
|
+
tooltipCardProps: {
|
|
24205
|
+
tooltip: {
|
|
24206
|
+
title: 'Items',
|
|
24207
|
+
content: 'Number of units across all line items in the order',
|
|
24208
|
+
width: 'wide',
|
|
24209
|
+
},
|
|
24210
|
+
},
|
|
24211
24211
|
},
|
|
24212
|
+
];
|
|
24213
|
+
const ORDER_LISTING_LATEST_COLUMNS_FOR_PAGE = ORDER_LISTING_COLUMNS.filter((column) => ![EReportColumnKey.CAMPAIGNS, EReportColumnKey.GEMX_ID].includes(column.name));
|
|
24214
|
+
const ORDER_LISTING_METRICS = [
|
|
24215
|
+
EReportColumnKey.GEMX_ID,
|
|
24216
|
+
EReportColumnKey.ORDER_DATE,
|
|
24217
|
+
EReportColumnKey.TOTAL,
|
|
24218
|
+
EReportColumnKey.CAMPAIGNS,
|
|
24219
|
+
EReportColumnKey.TRAFFIC_SOURCE,
|
|
24220
|
+
EReportColumnKey.DEVICE,
|
|
24221
|
+
EReportColumnKey.VISITOR,
|
|
24222
|
+
EReportColumnKey.ITEMS,
|
|
24223
|
+
];
|
|
24224
|
+
const ORDER_LISTING_DIMENSIONS = ['order_id'];
|
|
24225
|
+
const ORDER_LISTING_CONFIG = {
|
|
24226
|
+
SHOW_LATEST_ORDER_LISTING_AMOUNT: 5,
|
|
24212
24227
|
};
|
|
24228
|
+
const SORT_ORDER_LISTING_DEFAULT = [`${EReportColumnKey.ORDER_DATE} desc`];
|
|
24213
24229
|
|
|
24214
|
-
const
|
|
24215
|
-
|
|
24216
|
-
|
|
24217
|
-
|
|
24230
|
+
const ORDER_COLUMN_MAPPING = {
|
|
24231
|
+
[EReportColumnKey.ORDER_ID]: {
|
|
24232
|
+
label: 'Order ID',
|
|
24233
|
+
value: EReportColumnKey.ORDER_ID,
|
|
24234
|
+
},
|
|
24235
|
+
[EReportColumnKey.GEMX_ID]: {
|
|
24236
|
+
label: 'GemX ID',
|
|
24237
|
+
value: EReportColumnKey.GEMX_ID,
|
|
24238
|
+
},
|
|
24239
|
+
[EReportColumnKey.ORDER_DATE]: {
|
|
24240
|
+
label: 'Date',
|
|
24241
|
+
value: EReportColumnKey.ORDER_DATE,
|
|
24242
|
+
},
|
|
24243
|
+
[EReportColumnKey.TOTAL]: {
|
|
24244
|
+
label: 'Total',
|
|
24245
|
+
value: EReportColumnKey.TOTAL,
|
|
24246
|
+
},
|
|
24247
|
+
[EReportColumnKey.CAMPAIGNS]: {
|
|
24248
|
+
label: 'Experiment version',
|
|
24249
|
+
value: EReportColumnKey.CAMPAIGNS,
|
|
24250
|
+
},
|
|
24251
|
+
[EReportColumnKey.TRAFFIC_SOURCE]: {
|
|
24252
|
+
label: 'Traffic source',
|
|
24253
|
+
value: EReportColumnKey.TRAFFIC_SOURCE,
|
|
24254
|
+
},
|
|
24255
|
+
[EReportColumnKey.DEVICE]: {
|
|
24256
|
+
label: 'Device',
|
|
24257
|
+
value: EReportColumnKey.DEVICE,
|
|
24258
|
+
},
|
|
24259
|
+
[EReportColumnKey.VISITOR]: {
|
|
24260
|
+
label: 'Customer type',
|
|
24261
|
+
value: EReportColumnKey.VISITOR,
|
|
24262
|
+
},
|
|
24263
|
+
[EReportColumnKey.ITEMS]: {
|
|
24264
|
+
label: 'Items',
|
|
24265
|
+
value: EReportColumnKey.ITEMS,
|
|
24266
|
+
},
|
|
24218
24267
|
};
|
|
24268
|
+
const DEFAULT_SELECTED_COLUMNS_FOR_EXPERIMENT = [
|
|
24269
|
+
EReportColumnKey.ORDER_ID,
|
|
24270
|
+
EReportColumnKey.GEMX_ID,
|
|
24271
|
+
EReportColumnKey.ORDER_DATE,
|
|
24272
|
+
EReportColumnKey.TOTAL,
|
|
24273
|
+
EReportColumnKey.CAMPAIGNS,
|
|
24274
|
+
EReportColumnKey.TRAFFIC_SOURCE,
|
|
24275
|
+
EReportColumnKey.DEVICE,
|
|
24276
|
+
EReportColumnKey.VISITOR,
|
|
24277
|
+
];
|
|
24219
24278
|
|
|
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() }) }));
|
|
24279
|
+
const convertOrderItemsToReportTableRows = (orderItems) => {
|
|
24280
|
+
return orderItems.map((orderItem) => {
|
|
24281
|
+
const { events: _events, ...restOrderItem } = orderItem;
|
|
24282
|
+
return {
|
|
24283
|
+
...restOrderItem,
|
|
24284
|
+
items: typeof orderItem.items === 'string' ? JSON.parse(orderItem.items) : (orderItem.items ?? []),
|
|
24285
|
+
experiments: typeof orderItem.experiments === 'string' ? JSON.parse(orderItem.experiments) : (orderItem.experiments ?? []),
|
|
24286
|
+
};
|
|
24287
|
+
});
|
|
24240
24288
|
};
|
|
24241
|
-
|
|
24242
|
-
|
|
24243
|
-
|
|
24244
|
-
|
|
24245
|
-
|
|
24246
|
-
|
|
24247
|
-
|
|
24248
|
-
|
|
24249
|
-
isMergedWithPrev = allMatch;
|
|
24289
|
+
const applyTotalToSummaryRow = (rows) => {
|
|
24290
|
+
let totalPrice = 0;
|
|
24291
|
+
let totalItems = 0;
|
|
24292
|
+
rows.forEach((row) => {
|
|
24293
|
+
const rowTotal = row[EReportColumnKey.TOTAL];
|
|
24294
|
+
const rowItems = row[EReportColumnKey.ITEMS];
|
|
24295
|
+
if (typeof rowTotal === 'number') {
|
|
24296
|
+
totalPrice += rowTotal;
|
|
24250
24297
|
}
|
|
24251
|
-
|
|
24252
|
-
|
|
24253
|
-
const customOrderCellProps = orderCellProps
|
|
24254
|
-
? {
|
|
24255
|
-
...orderCellProps,
|
|
24256
|
-
onClickOrderCell: (data) => orderCellProps?.onClickOrderCell({ row, isPrevious: data.isPrevious }),
|
|
24298
|
+
if (Array.isArray(rowItems)) {
|
|
24299
|
+
totalItems += rowItems.reduce((acc, item) => acc + Number(item.quantity), 0);
|
|
24257
24300
|
}
|
|
24258
|
-
|
|
24259
|
-
return (
|
|
24260
|
-
|
|
24261
|
-
|
|
24262
|
-
|
|
24263
|
-
|
|
24301
|
+
});
|
|
24302
|
+
return rows.map((row, index) => {
|
|
24303
|
+
const totalItemsLabel = totalItems > 1 ? `${totalItems} items` : `${totalItems} item`;
|
|
24304
|
+
return {
|
|
24305
|
+
// Only add totals to first row (used by SummaryRow)
|
|
24306
|
+
...(index === 0 && {
|
|
24307
|
+
[getTotalColumnName(EReportColumnKey.TOTAL)]: totalPrice,
|
|
24308
|
+
[getTotalColumnName(EReportColumnKey.ITEMS)]: totalItemsLabel,
|
|
24309
|
+
}),
|
|
24310
|
+
...row,
|
|
24311
|
+
};
|
|
24312
|
+
});
|
|
24264
24313
|
};
|
|
24265
24314
|
|
|
24266
|
-
const
|
|
24267
|
-
|
|
24268
|
-
}
|
|
24315
|
+
const useOrderControlStore = create()((set) => ({
|
|
24316
|
+
orderBy: { field: EReportColumnKey.ORDER_DATE, direction: EOrderDirectionType.DESC },
|
|
24317
|
+
changeOrderBy: (newOrderBy) => set(() => ({ orderBy: newOrderBy })),
|
|
24318
|
+
}));
|
|
24269
24319
|
|
|
24270
|
-
const
|
|
24271
|
-
|
|
24272
|
-
|
|
24273
|
-
|
|
24274
|
-
|
|
24275
|
-
|
|
24276
|
-
|
|
24277
|
-
|
|
24278
|
-
|
|
24279
|
-
|
|
24280
|
-
|
|
24281
|
-
|
|
24282
|
-
|
|
24283
|
-
|
|
24284
|
-
|
|
24285
|
-
const
|
|
24286
|
-
const
|
|
24287
|
-
|
|
24288
|
-
|
|
24289
|
-
|
|
24320
|
+
const useOrderColumnsSelectorStore = create()(persist((set) => ({
|
|
24321
|
+
selectedColumns: DEFAULT_SELECTED_COLUMNS_FOR_EXPERIMENT,
|
|
24322
|
+
columnsOrder: Object.values(ORDER_COLUMN_MAPPING).map((column) => column.value),
|
|
24323
|
+
setColumnsOrder: (columnsOrder) => set({ columnsOrder }),
|
|
24324
|
+
setSelectedColumns: (selectedColumns) => set({ selectedColumns }),
|
|
24325
|
+
}), { name: 'order-listing-columns-config' }));
|
|
24326
|
+
|
|
24327
|
+
const useOrderListingData = ({ limitRowAmount, orderListing = [], fixedColumns, selectedColumns: externalSelectedColumns, columnsOrder: externalColumnsOrder, }) => {
|
|
24328
|
+
const storeSelectedColumns = useOrderColumnsSelectorStore((state) => state.selectedColumns);
|
|
24329
|
+
const storeColumnsOrder = useOrderColumnsSelectorStore((state) => state.columnsOrder);
|
|
24330
|
+
const selectedColumns = externalSelectedColumns ?? storeSelectedColumns;
|
|
24331
|
+
const columnsOrder = externalColumnsOrder ?? storeColumnsOrder;
|
|
24332
|
+
const showColumns = useMemo(() => ORDER_LISTING_COLUMNS.filter((column) => (fixedColumns ?? selectedColumns).includes(column.name)), [fixedColumns, selectedColumns]);
|
|
24333
|
+
const sortedMetrics = useMemo(() => sortByArrayOrder(ORDER_LISTING_METRICS ?? [], columnsOrder), [columnsOrder]);
|
|
24334
|
+
const tableData = useMemo(() => {
|
|
24335
|
+
const rows = convertOrderItemsToReportTableRows(orderListing);
|
|
24336
|
+
const showRows = limitRowAmount ? rows.slice(0, limitRowAmount) : rows;
|
|
24337
|
+
return {
|
|
24338
|
+
rows: showRows,
|
|
24339
|
+
columns: showColumns,
|
|
24340
|
+
};
|
|
24341
|
+
}, [limitRowAmount, orderListing, showColumns]);
|
|
24342
|
+
return {
|
|
24343
|
+
showColumns,
|
|
24344
|
+
tableData,
|
|
24345
|
+
sortedMetrics,
|
|
24290
24346
|
};
|
|
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
24347
|
};
|
|
24293
24348
|
|
|
24294
|
-
const
|
|
24295
|
-
|
|
24296
|
-
|
|
24297
|
-
|
|
24349
|
+
const SKELETON_METRICS = [
|
|
24350
|
+
EReportColumnKey.ORDER_DATE,
|
|
24351
|
+
EReportColumnKey.TOTAL,
|
|
24352
|
+
EReportColumnKey.CAMPAIGNS,
|
|
24353
|
+
EReportColumnKey.TRAFFIC_SOURCE,
|
|
24354
|
+
EReportColumnKey.DEVICE,
|
|
24355
|
+
EReportColumnKey.VISITOR,
|
|
24356
|
+
EReportColumnKey.ITEMS,
|
|
24357
|
+
];
|
|
24358
|
+
|
|
24359
|
+
const SkeletonSummaryRow = () => {
|
|
24360
|
+
const summaryColumns = [
|
|
24361
|
+
{ key: 'order_id', layout: ORDER_LISTING_DIMENSION_LAYOUT },
|
|
24362
|
+
...SKELETON_METRICS.map((metric) => ({
|
|
24363
|
+
key: metric,
|
|
24364
|
+
layout: ORDER_LISTING_METRIC_LAYOUTS[metric],
|
|
24365
|
+
})),
|
|
24366
|
+
];
|
|
24367
|
+
return (jsx("div", { className: "GReportTable__Summary-Row", children: summaryColumns.map((col, index) => (jsx("div", { className: "GReportTable__Summary-Cell", style: {
|
|
24368
|
+
minWidth: col.layout?.minWidth,
|
|
24369
|
+
maxWidth: col.layout?.maxWidth,
|
|
24370
|
+
justifyContent: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24371
|
+
['--column-cell-justify-content']: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24372
|
+
}, children: index === 0 && (jsx("div", { className: "w-20", children: jsx(SkeletonBodyText, { lines: 1 }) })) }, col.key))) }));
|
|
24298
24373
|
};
|
|
24299
24374
|
|
|
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
|
-
}
|
|
24375
|
+
const SkeletonHeader = () => {
|
|
24376
|
+
const headerColumns = [
|
|
24377
|
+
{ key: 'order_id', label: 'Order ID', layout: ORDER_LISTING_DIMENSION_LAYOUT },
|
|
24378
|
+
...SKELETON_METRICS.map((metric) => ({
|
|
24379
|
+
key: metric,
|
|
24380
|
+
label: metric,
|
|
24381
|
+
layout: ORDER_LISTING_METRIC_LAYOUTS[metric],
|
|
24382
|
+
})),
|
|
24383
|
+
];
|
|
24384
|
+
return (jsx("div", { className: "GReportTable__Header", children: headerColumns.map((col, index) => (jsx("div", { className: "GReportTable__Header-Cell", style: {
|
|
24385
|
+
minWidth: col.layout?.minWidth,
|
|
24386
|
+
maxWidth: col.layout?.maxWidth,
|
|
24387
|
+
justifyContent: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24388
|
+
['--column-cell-justify-content']: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24389
|
+
}, children: jsx("div", { className: index === 0 ? 'w-16' : 'w-12', children: jsx(SkeletonBodyText, { lines: 1 }) }) }, col.key))) }));
|
|
24320
24390
|
};
|
|
24321
24391
|
|
|
24322
|
-
const
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
|
|
24326
|
-
|
|
24327
|
-
|
|
24328
|
-
|
|
24329
|
-
|
|
24330
|
-
|
|
24331
|
-
|
|
24332
|
-
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
return
|
|
24336
|
-
|
|
24392
|
+
const SkeletonCellContent = ({ columnKey }) => {
|
|
24393
|
+
switch (columnKey) {
|
|
24394
|
+
case 'order_id':
|
|
24395
|
+
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-20", children: jsx(SkeletonDisplayText, { size: "small" }) }) }));
|
|
24396
|
+
case EReportColumnKey.ORDER_DATE:
|
|
24397
|
+
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-28", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
24398
|
+
case EReportColumnKey.TOTAL:
|
|
24399
|
+
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-16", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
24400
|
+
case EReportColumnKey.CAMPAIGNS:
|
|
24401
|
+
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 }) })] }) }));
|
|
24402
|
+
case EReportColumnKey.TRAFFIC_SOURCE:
|
|
24403
|
+
case EReportColumnKey.DEVICE:
|
|
24404
|
+
case EReportColumnKey.VISITOR:
|
|
24405
|
+
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-16", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
24406
|
+
case EReportColumnKey.ITEMS:
|
|
24407
|
+
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 }) })] }) }));
|
|
24408
|
+
default:
|
|
24409
|
+
return (jsx(Box, { paddingInline: "300", children: jsx("div", { className: "w-16", children: jsx(SkeletonBodyText, { lines: 1 }) }) }));
|
|
24337
24410
|
}
|
|
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
24411
|
};
|
|
24340
24412
|
|
|
24341
|
-
const
|
|
24342
|
-
const
|
|
24343
|
-
|
|
24344
|
-
|
|
24345
|
-
|
|
24346
|
-
|
|
24347
|
-
|
|
24348
|
-
|
|
24349
|
-
|
|
24413
|
+
const SkeletonRow = () => {
|
|
24414
|
+
const rowColumns = [
|
|
24415
|
+
{ key: 'order_id', layout: ORDER_LISTING_DIMENSION_LAYOUT, isDimension: true },
|
|
24416
|
+
...SKELETON_METRICS.map((metric) => ({
|
|
24417
|
+
key: metric,
|
|
24418
|
+
layout: ORDER_LISTING_METRIC_LAYOUTS[metric],
|
|
24419
|
+
isDimension: false,
|
|
24420
|
+
})),
|
|
24421
|
+
];
|
|
24422
|
+
return (jsx("div", { className: "GReportTable__Row", children: rowColumns.map((col) => (jsx("div", { className: `GReportTable__Cell ${col.isDimension ? 'GReportTable__Cell--dimension' : ''}`, style: {
|
|
24423
|
+
minWidth: col.layout?.minWidth,
|
|
24424
|
+
maxWidth: col.layout?.maxWidth,
|
|
24425
|
+
justifyContent: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24426
|
+
['--column-cell-justify-content']: col.layout?.align === 'end' ? 'flex-end' : 'flex-start',
|
|
24427
|
+
}, children: jsx("div", { className: "GReportTable__CellContent", children: jsx(SkeletonCellContent, { columnKey: col.key }) }) }, col.key))) }));
|
|
24350
24428
|
};
|
|
24351
24429
|
|
|
24352
|
-
const
|
|
24353
|
-
return (
|
|
24354
|
-
}
|
|
24355
|
-
WrapperHeader.displayName = 'WrapperHeader';
|
|
24430
|
+
const OrderListingTableSkeleton = ({ rowCount = 5 }) => {
|
|
24431
|
+
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 }) }) }) })] }));
|
|
24432
|
+
};
|
|
24356
24433
|
|
|
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
|
-
}
|
|
24434
|
+
const OrderListingTableEmpty = ({ title, description }) => {
|
|
24435
|
+
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
24436
|
};
|
|
24397
24437
|
|
|
24398
|
-
const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, paginationProps, tableOptions, isMockData, onViewAllStoreOrders, onViewOrderJourney, onViewOrderDetails, }) => {
|
|
24438
|
+
const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, paginationProps, tableOptions, isMockData, selectedColumns, columnsOrder, isFilteredByCampaign, isHasControlFilters, onViewAllStoreOrders, onViewOrderJourney, onViewOrderDetails, }) => {
|
|
24399
24439
|
const { hideSummary, limitRowAmount, hidePaginationRow, hideBorderTop, fixedColumns, isLatestTable } = tableOptions ?? {};
|
|
24400
24440
|
const { t } = useTranslation();
|
|
24401
24441
|
const orderBy = useOrderControlStore((state) => state.orderBy);
|
|
@@ -24404,9 +24444,11 @@ const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, pa
|
|
|
24404
24444
|
limitRowAmount,
|
|
24405
24445
|
orderListing: orders,
|
|
24406
24446
|
fixedColumns,
|
|
24447
|
+
selectedColumns,
|
|
24448
|
+
columnsOrder,
|
|
24407
24449
|
});
|
|
24408
24450
|
const isNoResultFoundForQuery = !!queryValue?.trim() && tableData.rows.length === 0;
|
|
24409
|
-
const showViewAllButton = isLatestTable || isNoResultFoundForQuery;
|
|
24451
|
+
const showViewAllButton = isLatestTable || isHasControlFilters || isNoResultFoundForQuery;
|
|
24410
24452
|
const reportTableData = useMemo(() => {
|
|
24411
24453
|
return {
|
|
24412
24454
|
rows: applyTotalToSummaryRow(tableData.rows),
|
|
@@ -24421,7 +24463,7 @@ const OrderListingTable = ({ orders, isLoading, totalStoreOrders, queryValue, pa
|
|
|
24421
24463
|
};
|
|
24422
24464
|
if (isLatestTable && isLoading)
|
|
24423
24465
|
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 }) }));
|
|
24466
|
+
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
24467
|
function renderEmptyState() {
|
|
24426
24468
|
const isNoOrderWithCurrentFilters = orders.length === 0;
|
|
24427
24469
|
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 +24763,18 @@ const JOURNEY_EVENT_COMPONENTS_MAP = {
|
|
|
24721
24763
|
[EJourneyEvent.SEARCH_SUBMITTED]: DefaultEventComponent,
|
|
24722
24764
|
};
|
|
24723
24765
|
|
|
24724
|
-
const
|
|
24725
|
-
|
|
24766
|
+
const GemxIdBadge = () => {
|
|
24767
|
+
const { t } = useTranslation();
|
|
24768
|
+
const { gxId } = useOrderJourneyContext();
|
|
24769
|
+
if (!gxId)
|
|
24770
|
+
return null;
|
|
24771
|
+
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: {
|
|
24772
|
+
1: (text) => (jsx(Text, { as: "span", variant: "bodyMd", fontWeight: "medium", tone: "base", children: text })),
|
|
24773
|
+
}, children: t('GemX ID: [1]{{gxId}}[]', { gxId }) }) }) }) }));
|
|
24726
24774
|
};
|
|
24727
24775
|
|
|
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') })] }) }) }));
|
|
24776
|
+
const JourneyDateBadge = ({ content }) => {
|
|
24777
|
+
return (jsx(Box, { background: "bg-surface-secondary", paddingBlock: "100", paddingInline: "200", borderRadius: "200", minWidth: "97px", children: jsx(GBlockCenter, { children: jsx(Text, { as: "p", variant: "bodyMd", fontWeight: "medium", children: content }) }) }));
|
|
24739
24778
|
};
|
|
24740
24779
|
|
|
24741
24780
|
const JourneyIdBadge = ({ id, type = 'order' }) => {
|
|
@@ -24757,13 +24796,26 @@ const JourneyIdBadge = ({ id, type = 'order' }) => {
|
|
|
24757
24796
|
}
|
|
24758
24797
|
};
|
|
24759
24798
|
|
|
24799
|
+
const BOX_BACKGROUND = {
|
|
24800
|
+
default: 'bg-surface-secondary-active',
|
|
24801
|
+
onHover: 'bg-surface-secondary',
|
|
24802
|
+
};
|
|
24803
|
+
const JourneyLoadMore = ({ isFetching, onLoadMode }) => {
|
|
24804
|
+
const [boxBackground, setBoxBackground] = useState(BOX_BACKGROUND.default);
|
|
24805
|
+
const { t } = useTranslation();
|
|
24806
|
+
if (isFetching) {
|
|
24807
|
+
return (jsx(Box, { paddingBlock: "100", paddingInline: "300", background: BOX_BACKGROUND.onHover, borderRadius: "200", children: jsx(GSpinner, { size: "small" }) }));
|
|
24808
|
+
}
|
|
24809
|
+
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') })] }) }) }));
|
|
24810
|
+
};
|
|
24811
|
+
|
|
24760
24812
|
const JourneyTitle = ({ content, id, hasMoreSteps, isFetching = false, onLoadMode }) => {
|
|
24761
24813
|
const isStickyHeader = !!id;
|
|
24762
24814
|
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, {})] }));
|
|
24815
|
+
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
24816
|
};
|
|
24765
24817
|
const JourneyTitleLine = () => {
|
|
24766
|
-
return jsx("div", { className: "absolute
|
|
24818
|
+
return jsx("div", { className: "bg-border absolute left-0 right-0 top-[50%] -z-[1] h-[1px] translate-y-[-50%]" });
|
|
24767
24819
|
};
|
|
24768
24820
|
|
|
24769
24821
|
const JourneyGroup = ({ eventsByDate, sectionRefs }) => {
|
|
@@ -24874,7 +24926,7 @@ const JourneyEventSkeleton = ({ isLast }) => {
|
|
|
24874
24926
|
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
24927
|
};
|
|
24876
24928
|
|
|
24877
|
-
const GModalOrderJourney = ({ open, onClose, title, orderId, journeyItems, isLoading = false, hasNextPage = false, isFetchingNextPage = false, fetchNextPage, reportCampaign, pageAnalytic, mode, journeySource, onViewOrderDetails, }) => {
|
|
24929
|
+
const GModalOrderJourney = ({ open, onClose, title, orderId, gxId, journeyItems, isLoading = false, hasNextPage = false, isFetchingNextPage = false, fetchNextPage, reportCampaign, pageAnalytic, mode, journeySource, onViewOrderDetails, }) => {
|
|
24878
24930
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
24879
24931
|
usePreventBodyScroll({ enable: open });
|
|
24880
24932
|
const source = useMemo(() => {
|
|
@@ -24928,7 +24980,7 @@ const GModalOrderJourney = ({ open, onClose, title, orderId, journeyItems, isLoa
|
|
|
24928
24980
|
}, [open]);
|
|
24929
24981
|
if (!orderId)
|
|
24930
24982
|
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 })) }) }));
|
|
24983
|
+
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
24984
|
};
|
|
24933
24985
|
|
|
24934
24986
|
function isBrowser() {
|
|
@@ -24974,4 +25026,4 @@ const useStickyFilterBoxProps = ({ id }) => {
|
|
|
24974
25026
|
};
|
|
24975
25027
|
};
|
|
24976
25028
|
|
|
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 };
|
|
25029
|
+
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, ReportTable, ReportTableSkeleton, 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, formatReportData, 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 };
|