@gem-sdk/analytics 2.0.0-dev.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/CardPathAnalysis/components/PathAnalysisChart.d.ts +0 -1
- package/dist/esm/components/CardPathAnalysis/contexts/PathAnalysisConfigProvider.d.ts +8 -1
- package/dist/esm/components/CardPathAnalysis/hooks/usePathAnalysisChart.d.ts +1 -0
- package/dist/esm/components/CardPathAnalysis/hooks/usePathAnalysisFunnel.d.ts +2 -1
- package/dist/esm/components/GModalOrderJourney/GModalOrderJourney.d.ts +20 -0
- package/dist/esm/components/GModalOrderJourney/components/OrderJourneySkeleton.d.ts +1 -0
- package/dist/esm/components/GModalOrderJourney/components/index.d.ts +1 -0
- package/dist/esm/components/GModalOrderJourney/context/OrderJourneyContext.d.ts +6 -0
- package/dist/esm/components/GModalOrderJourney/context/index.d.ts +1 -0
- package/dist/esm/components/GModalOrderJourney/hooks/index.d.ts +1 -0
- package/dist/esm/components/GModalOrderJourney/hooks/useGModalOrderJourney.d.ts +7 -0
- package/dist/esm/components/GModalOrderJourney/index.d.ts +4 -0
- package/dist/esm/components/GModalOrderJourney/types/index.d.ts +4 -0
- package/dist/esm/components/GModalOrderJourney/utils/index.d.ts +28 -0
- package/dist/esm/components/GSelectableMetricChartCard/GSelectableMetricChartCard.d.ts +2 -1
- package/dist/esm/components/GSelectableMetricChartCard/MetricChartTab.d.ts +2 -1
- package/dist/esm/components/MetricDonutChartCard/MetricDonutChartCard.d.ts +2 -1
- package/dist/esm/components/OrderAnalytic/OrderListingLatestTable.d.ts +2 -1
- package/dist/esm/components/OrderAnalytic/components/OrderListing/OrderListingTable.d.ts +2 -1
- package/dist/esm/components/OrderAnalytic/stores/order-columns-selector.d.ts +0 -2
- package/dist/esm/components/OrderAnalytic/types/order.d.ts +32 -0
- package/dist/esm/components/SingleMetricChartCard/SingleMetricChartCard.d.ts +2 -1
- package/dist/esm/components/common/chart/MetricInfoBlock.d.ts +2 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/gemxql.js +67 -32
- package/dist/esm/gemxql.mjs +67 -32
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/useFetchCurrencyRates.d.ts +4 -1
- package/dist/esm/hooks/usePreventBodyScroll.d.ts +3 -0
- package/dist/esm/index.js +1080 -1941
- package/dist/esm/index.mjs +1080 -1941
- package/dist/esm/providers/TimezoneProvider.d.ts +11 -0
- package/dist/esm/providers/index.d.ts +2 -0
- package/dist/esm/shared/charts/components/GFunnelChart/components/types.d.ts +1 -0
- package/dist/esm/shared/charts/contexts/GChartProvider.d.ts +1 -1
- package/dist/esm/shared/components/GDotInline/GDotInline.d.ts +5 -0
- package/dist/esm/shared/components/GDotInline/index.d.ts +1 -0
- package/dist/esm/shared/components/GInlineCenter/GInlineCenter.d.ts +1 -1
- package/dist/esm/shared/components/GMockDataTooltip/GMockDataTooltip.d.ts +12 -0
- package/dist/esm/shared/components/GMockDataTooltip/index.d.ts +1 -0
- package/dist/esm/shared/components/GModal/GModal.d.ts +14 -0
- package/dist/esm/shared/components/GModal/index.d.ts +1 -0
- package/dist/esm/shared/components/GSpinner/GSpinner.d.ts +5 -0
- package/dist/esm/shared/components/GSpinner/index.d.ts +1 -0
- package/dist/esm/shared/components/index.d.ts +4 -0
- package/dist/esm/shared/journey/common/JourneyContainer/components/JourneyContainer.d.ts +10 -0
- package/dist/esm/shared/journey/common/JourneyContainer/components/JourneyTimeline.d.ts +1 -0
- package/dist/esm/shared/journey/common/JourneyContainer/components/index.d.ts +2 -0
- package/dist/esm/shared/journey/common/JourneyContainer/index.d.ts +1 -0
- package/dist/esm/shared/journey/common/index.d.ts +1 -0
- package/dist/esm/shared/journey/index.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/AcceptedPostPurchaseOffer/AcceptedPostPurchaseOffer.d.ts +10 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/AcceptedPostPurchaseOffer/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutCompleted/CheckoutCompleted.d.ts +9 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutCompleted/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutItems.d.ts +6 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/CheckoutStarted.d.ts +10 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/CheckoutStartedDetail.d.ts +8 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/index.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/PageViewed/PageViewed.d.ts +9 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/PageViewed/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductAddedToCart/ProductAddedToCart.d.ts +10 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductAddedToCart/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductQuantity/ProductQuantity.d.ts +6 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductQuantity/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductRemovedFromCart/ProductRemovedFromCart.d.ts +10 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/ProductRemovedFromCart/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/components/index.d.ts +6 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/constants/event.d.ts +13 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/constants/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/index.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyEvents/types.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyGroup/JourneyGroup.d.ts +7 -0
- package/dist/esm/shared/journey/ui/JourneyGroup/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/EventMarkerIcon.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/JourneyDetail.d.ts +5 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/JourneyItem.d.ts +9 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/JourneyTime.d.ts +9 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/QuantityWrapper.d.ts +5 -0
- package/dist/esm/shared/journey/ui/JourneyItem/components/index.d.ts +3 -0
- package/dist/esm/shared/journey/ui/JourneyItem/index.d.ts +2 -0
- package/dist/esm/shared/journey/ui/JourneyItem/types/events.d.ts +18 -0
- package/dist/esm/shared/journey/ui/JourneyItem/types/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/JourneyDateBadge.d.ts +5 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/JourneyIdBadge.d.ts +6 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/JourneyLoadMore.d.ts +6 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/JourneyTitle.d.ts +9 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/components/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/JourneyTitle/index.d.ts +1 -0
- package/dist/esm/shared/journey/ui/index.d.ts +3 -0
- package/dist/esm/shared/journey/ui/type.d.ts +2 -0
- package/dist/esm/shared/reports/ui/ReportTable/ReportTable.d.ts +2 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/Cell.d.ts +2 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/OrderCellContainer.d.ts +1 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/OrderIdCell.d.ts +1 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Cell/type.d.ts +1 -0
- package/dist/esm/shared/reports/ui/ReportTable/components/Body/Row.d.ts +2 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Footer/Pagination.d.ts +2 -1
- package/dist/esm/shared/reports/ui/ReportTable/components/Footer/WrapperFooter.d.ts +2 -1
- package/dist/esm/types/campaign.d.ts +4 -0
- package/dist/esm/types.js +6 -1
- package/dist/esm/types.mjs +6 -1
- package/dist/esm/utils/array.d.ts +1 -0
- package/dist/esm/utils/date-time.d.ts +1 -0
- package/dist/esm/utils/index.d.ts +3 -0
- package/dist/esm/utils/is-browser.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/umd/esm/components/CardPathAnalysis/components/PathAnalysisChart.d.ts +0 -1
- package/dist/umd/esm/components/CardPathAnalysis/contexts/PathAnalysisConfigProvider.d.ts +8 -1
- package/dist/umd/esm/components/CardPathAnalysis/hooks/usePathAnalysisChart.d.ts +1 -0
- package/dist/umd/esm/components/CardPathAnalysis/hooks/usePathAnalysisFunnel.d.ts +2 -1
- package/dist/umd/esm/components/GModalOrderJourney/GModalOrderJourney.d.ts +20 -0
- package/dist/umd/esm/components/GModalOrderJourney/components/OrderJourneySkeleton.d.ts +1 -0
- package/dist/umd/esm/components/GModalOrderJourney/components/index.d.ts +1 -0
- package/dist/umd/esm/components/GModalOrderJourney/context/OrderJourneyContext.d.ts +6 -0
- package/dist/umd/esm/components/GModalOrderJourney/context/index.d.ts +1 -0
- package/dist/umd/esm/components/GModalOrderJourney/hooks/index.d.ts +1 -0
- package/dist/umd/esm/components/GModalOrderJourney/hooks/useGModalOrderJourney.d.ts +7 -0
- package/dist/umd/esm/components/GModalOrderJourney/index.d.ts +4 -0
- package/dist/umd/esm/components/GModalOrderJourney/types/index.d.ts +4 -0
- package/dist/umd/esm/components/GModalOrderJourney/utils/index.d.ts +28 -0
- package/dist/umd/esm/components/GSelectableMetricChartCard/GSelectableMetricChartCard.d.ts +2 -1
- package/dist/umd/esm/components/GSelectableMetricChartCard/MetricChartTab.d.ts +2 -1
- package/dist/umd/esm/components/MetricDonutChartCard/MetricDonutChartCard.d.ts +2 -1
- package/dist/umd/esm/components/OrderAnalytic/OrderListingLatestTable.d.ts +2 -1
- package/dist/umd/esm/components/OrderAnalytic/components/OrderListing/OrderListingTable.d.ts +2 -1
- package/dist/umd/esm/components/OrderAnalytic/stores/order-columns-selector.d.ts +0 -2
- package/dist/umd/esm/components/OrderAnalytic/types/order.d.ts +32 -0
- package/dist/umd/esm/components/SingleMetricChartCard/SingleMetricChartCard.d.ts +2 -1
- package/dist/umd/esm/components/common/chart/MetricInfoBlock.d.ts +2 -1
- package/dist/umd/esm/components/index.d.ts +1 -0
- package/dist/umd/esm/hooks/index.d.ts +1 -0
- package/dist/umd/esm/hooks/useFetchCurrencyRates.d.ts +4 -1
- package/dist/umd/esm/hooks/usePreventBodyScroll.d.ts +3 -0
- package/dist/umd/esm/providers/TimezoneProvider.d.ts +11 -0
- package/dist/umd/esm/providers/index.d.ts +2 -0
- package/dist/umd/esm/shared/charts/components/GFunnelChart/components/types.d.ts +1 -0
- package/dist/umd/esm/shared/charts/contexts/GChartProvider.d.ts +1 -1
- package/dist/umd/esm/shared/components/GDotInline/GDotInline.d.ts +5 -0
- package/dist/umd/esm/shared/components/GDotInline/index.d.ts +1 -0
- package/dist/umd/esm/shared/components/GInlineCenter/GInlineCenter.d.ts +1 -1
- package/dist/umd/esm/shared/components/GMockDataTooltip/GMockDataTooltip.d.ts +12 -0
- package/dist/umd/esm/shared/components/GMockDataTooltip/index.d.ts +1 -0
- package/dist/umd/esm/shared/components/GModal/GModal.d.ts +14 -0
- package/dist/umd/esm/shared/components/GModal/index.d.ts +1 -0
- package/dist/umd/esm/shared/components/GSpinner/GSpinner.d.ts +5 -0
- package/dist/umd/esm/shared/components/GSpinner/index.d.ts +1 -0
- package/dist/umd/esm/shared/components/index.d.ts +4 -0
- package/dist/umd/esm/shared/journey/common/JourneyContainer/components/JourneyContainer.d.ts +10 -0
- package/dist/umd/esm/shared/journey/common/JourneyContainer/components/JourneyTimeline.d.ts +1 -0
- package/dist/umd/esm/shared/journey/common/JourneyContainer/components/index.d.ts +2 -0
- package/dist/umd/esm/shared/journey/common/JourneyContainer/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/common/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/index.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/AcceptedPostPurchaseOffer/AcceptedPostPurchaseOffer.d.ts +10 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/AcceptedPostPurchaseOffer/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutCompleted/CheckoutCompleted.d.ts +9 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutCompleted/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutItems.d.ts +6 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/CheckoutStarted.d.ts +10 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/CheckoutStartedDetail.d.ts +8 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/CheckoutStarted/index.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/PageViewed/PageViewed.d.ts +9 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/PageViewed/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductAddedToCart/ProductAddedToCart.d.ts +10 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductAddedToCart/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductQuantity/ProductQuantity.d.ts +6 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductQuantity/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductRemovedFromCart/ProductRemovedFromCart.d.ts +10 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/ProductRemovedFromCart/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/components/index.d.ts +6 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/constants/event.d.ts +13 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/constants/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/index.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyEvents/types.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyGroup/JourneyGroup.d.ts +7 -0
- package/dist/umd/esm/shared/journey/ui/JourneyGroup/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/EventMarkerIcon.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/JourneyDetail.d.ts +5 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/JourneyItem.d.ts +9 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/JourneyTime.d.ts +9 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/QuantityWrapper.d.ts +5 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/components/index.d.ts +3 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/index.d.ts +2 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/types/events.d.ts +18 -0
- package/dist/umd/esm/shared/journey/ui/JourneyItem/types/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/JourneyDateBadge.d.ts +5 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/JourneyIdBadge.d.ts +6 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/JourneyLoadMore.d.ts +6 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/JourneyTitle.d.ts +9 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/components/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/JourneyTitle/index.d.ts +1 -0
- package/dist/umd/esm/shared/journey/ui/index.d.ts +3 -0
- package/dist/umd/esm/shared/journey/ui/type.d.ts +2 -0
- package/dist/umd/esm/shared/reports/ui/ReportTable/ReportTable.d.ts +2 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/Cell.d.ts +2 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/OrderCellContainer.d.ts +1 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/OrderIdCell.d.ts +1 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Cell/type.d.ts +1 -0
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Body/Row.d.ts +2 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Footer/Pagination.d.ts +2 -1
- package/dist/umd/esm/shared/reports/ui/ReportTable/components/Footer/WrapperFooter.d.ts +2 -1
- package/dist/umd/esm/types/campaign.d.ts +4 -0
- package/dist/umd/esm/utils/array.d.ts +1 -0
- package/dist/umd/esm/utils/date-time.d.ts +1 -0
- package/dist/umd/esm/utils/index.d.ts +3 -0
- package/dist/umd/esm/utils/is-browser.d.ts +1 -0
- package/dist/umd/gemxql.js +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/types.js +1 -1
- package/package.json +6 -1
package/dist/esm/gemxql.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import timezone from 'dayjs/plugin/timezone.js';
|
|
|
4
4
|
import utc from 'dayjs/plugin/utc.js';
|
|
5
5
|
import { useQuery } from '@tanstack/react-query';
|
|
6
6
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
7
|
-
import { createContext, useContext, useState, useRef, useCallback, useEffect } from 'react';
|
|
7
|
+
import { createContext, useContext, useState, useMemo, useRef, useCallback, useEffect } from 'react';
|
|
8
8
|
import { create } from 'zustand';
|
|
9
9
|
import '@shopify/polaris';
|
|
10
10
|
|
|
@@ -177,6 +177,8 @@ const CLAUSE_KEYWORD_BOUNDARY = CLAUSE_KEYWORDS.join('|');
|
|
|
177
177
|
const DEFAULT_QUERY_LIMIT = 1000;
|
|
178
178
|
|
|
179
179
|
const DEFAULT_GROUP_OPERATOR = EGroupOperator.OR;
|
|
180
|
+
// Serializes a value as a single-quoted DSL string literal. Numbers are passed through unquoted.
|
|
181
|
+
const quoteValue = (v) => typeof v === 'number' ? String(v) : `'${String(v).replace(/'/g, "''")}'`;
|
|
180
182
|
const joinFieldClauses = (parts, groupOperator = DEFAULT_GROUP_OPERATOR) => {
|
|
181
183
|
if (!parts.length)
|
|
182
184
|
return '';
|
|
@@ -187,18 +189,18 @@ const joinFieldClauses = (parts, groupOperator = DEFAULT_GROUP_OPERATOR) => {
|
|
|
187
189
|
const buildEq = ({ fields, value, groupOperator }) => {
|
|
188
190
|
if (!fields.length)
|
|
189
191
|
return '';
|
|
190
|
-
return joinFieldClauses(fields.map((field) => `${field} = ${value}`), groupOperator);
|
|
192
|
+
return joinFieldClauses(fields.map((field) => `${field} = ${quoteValue(value)}`), groupOperator);
|
|
191
193
|
};
|
|
192
194
|
const buildIn = ({ fields, values, groupOperator }) => {
|
|
193
195
|
if (!fields.length || !values.length)
|
|
194
196
|
return '';
|
|
195
|
-
return joinFieldClauses(fields.map((field) => `${field} IN (${values.join(', ')})`), groupOperator);
|
|
197
|
+
return joinFieldClauses(fields.map((field) => `${field} IN (${values.map(quoteValue).join(', ')})`), groupOperator);
|
|
196
198
|
};
|
|
197
199
|
const buildLike = ({ fields, value, groupOperator }) => {
|
|
198
200
|
const trimmed = value.trim();
|
|
199
201
|
if (!trimmed || !fields.length)
|
|
200
202
|
return '';
|
|
201
|
-
return joinFieldClauses(fields.map((field) => `${field} LIKE '%${trimmed}%'`), groupOperator);
|
|
203
|
+
return joinFieldClauses(fields.map((field) => `${field} LIKE '%${trimmed.replace(/'/g, "''")}%'`), groupOperator);
|
|
202
204
|
};
|
|
203
205
|
const buildExtraCondition = (condition) => {
|
|
204
206
|
switch (condition.operator) {
|
|
@@ -260,13 +262,14 @@ const filterConfigs = [
|
|
|
260
262
|
multiField: EFilterField.GROUP_CAMPAIGN,
|
|
261
263
|
},
|
|
262
264
|
];
|
|
265
|
+
const quoteStr = (v) => `'${v.replace(/'/g, "''")}'`;
|
|
263
266
|
const buildCondition = (data) => {
|
|
264
267
|
const { operatorValue, singleValue, multiValue, fieldName } = data;
|
|
265
268
|
if (operatorValue === OPERATOR_IS && singleValue) {
|
|
266
|
-
return `${fieldName} = ${singleValue}`;
|
|
269
|
+
return `${fieldName} = ${quoteStr(singleValue)}`;
|
|
267
270
|
}
|
|
268
271
|
else if (operatorValue === OPERATOR_IS_ONE_OF && Array.isArray(multiValue) && multiValue.length > 0) {
|
|
269
|
-
return `${fieldName} IN (${multiValue.join(', ')})`;
|
|
272
|
+
return `${fieldName} IN (${multiValue.map(quoteStr).join(', ')})`;
|
|
270
273
|
}
|
|
271
274
|
return '';
|
|
272
275
|
};
|
|
@@ -276,7 +279,9 @@ const buildOverrideFilterConditions = (overrideFilters) => {
|
|
|
276
279
|
return Object.fromEntries(Object.entries(overrideFilters)
|
|
277
280
|
.filter(([, value]) => value !== undefined)
|
|
278
281
|
.map(([key, value]) => {
|
|
279
|
-
const condition = Array.isArray(value)
|
|
282
|
+
const condition = Array.isArray(value)
|
|
283
|
+
? `${key} IN (${value.map(quoteStr).join(', ')})`
|
|
284
|
+
: `${key} = ${quoteStr(String(value))}`;
|
|
280
285
|
return [key, condition];
|
|
281
286
|
}));
|
|
282
287
|
};
|
|
@@ -321,7 +326,7 @@ const buildVersionIdCondition = (versionIds) => {
|
|
|
321
326
|
Object.entries(versionIds).forEach(([key, value]) => {
|
|
322
327
|
if (!value)
|
|
323
328
|
return;
|
|
324
|
-
conditions.push(`${key} = ${value}`);
|
|
329
|
+
conditions.push(`${key} = ${quoteStr(value)}`);
|
|
325
330
|
});
|
|
326
331
|
return conditions;
|
|
327
332
|
};
|
|
@@ -346,13 +351,14 @@ const parse$b = (query) => {
|
|
|
346
351
|
const conditions = (match[1] ?? '').trim().split(/\s+AND\s+/i);
|
|
347
352
|
const filters = {};
|
|
348
353
|
const versionIds = {};
|
|
354
|
+
const unquoteStr = (v) => v.replace(/^'(.*)'$/s, '$1').replace(/''/g, "'");
|
|
349
355
|
conditions.forEach((condition) => {
|
|
350
356
|
const trimmed = condition.trim();
|
|
351
357
|
const inMatch = trimmed.match(/^(\S+)\s+IN\s+\((.+)\)$/i);
|
|
352
358
|
if (inMatch) {
|
|
353
359
|
const field = inMatch[1] ?? '';
|
|
354
360
|
const valuesStr = inMatch[2] ?? '';
|
|
355
|
-
const values = valuesStr.split(',').map((v) => v.trim());
|
|
361
|
+
const values = valuesStr.split(',').map((v) => unquoteStr(v.trim()));
|
|
356
362
|
const config = filterConfigs.find((c) => c.fieldName === field || c.multiField === field);
|
|
357
363
|
if (config?.operator) {
|
|
358
364
|
filters[config.multiField] = values;
|
|
@@ -363,7 +369,7 @@ const parse$b = (query) => {
|
|
|
363
369
|
const eqMatch = trimmed.match(/^(\S+)\s+=\s+(.+)$/);
|
|
364
370
|
if (eqMatch) {
|
|
365
371
|
const field = eqMatch[1] ?? '';
|
|
366
|
-
const value = eqMatch[2] ?? '';
|
|
372
|
+
const value = unquoteStr(eqMatch[2] ?? '');
|
|
367
373
|
const config = filterConfigs.find((c) => c.fieldName === field || c.singleField === field);
|
|
368
374
|
if (config) {
|
|
369
375
|
filters[config.singleField] = value;
|
|
@@ -383,7 +389,7 @@ const parse$b = (query) => {
|
|
|
383
389
|
|
|
384
390
|
const build$9 = (sources) => `FROM ${sources.join(', ')}`;
|
|
385
391
|
const parse$a = (query) => {
|
|
386
|
-
const match = query.match(new RegExp(`\\bFROM\\s+([\\s\\S]+?)(?=\\s+(?:${CLAUSE_KEYWORD_BOUNDARY})\\b)`, 'i'));
|
|
392
|
+
const match = query.match(new RegExp(`\\bFROM\\s+([\\s\\S]+?)(?=\\s+(?:${CLAUSE_KEYWORD_BOUNDARY})\\b|$)`, 'i'));
|
|
387
393
|
if (!match)
|
|
388
394
|
return [];
|
|
389
395
|
return (match[1] ?? '')
|
|
@@ -394,27 +400,30 @@ const parse$a = (query) => {
|
|
|
394
400
|
|
|
395
401
|
const build$8 = (dimensions, withClause = EGroupWithClause.ALL) => dimensions.length === 0 ? '' : `GROUP BY ${dimensions.join(', ')} ${withClause}`;
|
|
396
402
|
const parse$9 = (query) => {
|
|
397
|
-
const match = query.match(new RegExp(`\\bGROUP BY\\s+([\\s\\S]+?)(?=\\s+(?:${CLAUSE_KEYWORD_BOUNDARY})\\b)`, 'i'));
|
|
403
|
+
const match = query.match(new RegExp(`\\bGROUP BY\\s+([\\s\\S]+?)(?=\\s+(?:${CLAUSE_KEYWORD_BOUNDARY})\\b|$)`, 'i'));
|
|
398
404
|
if (!match)
|
|
399
405
|
return { dimensions: [] };
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
let content = (match[1] ?? '').trim();
|
|
407
|
+
// Detect the trailing with-clause token (e.g. `WITH GROUP_TOTALS, TOTALS` or `TOTALS`).
|
|
408
|
+
// Derive tokens from the enum and check longest-first so `ALL` is not mistaken for `TOTALS`.
|
|
409
|
+
const clauseTokens = Object.values(EGroupWithClause)
|
|
410
|
+
.filter((token) => token !== EGroupWithClause.NONE)
|
|
411
|
+
.sort((a, b) => b.length - a.length);
|
|
412
|
+
let groupWithClause = EGroupWithClause.NONE;
|
|
413
|
+
const upperContent = content.toUpperCase();
|
|
414
|
+
for (const token of clauseTokens) {
|
|
415
|
+
if (upperContent.endsWith(token)) {
|
|
416
|
+
groupWithClause = token;
|
|
417
|
+
content = content.slice(0, content.length - token.length).trim();
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
410
420
|
}
|
|
411
421
|
return {
|
|
412
422
|
dimensions: content
|
|
413
|
-
.slice(0, withIdx)
|
|
414
423
|
.split(',')
|
|
415
424
|
.map((s) => s.trim())
|
|
416
425
|
.filter(Boolean),
|
|
417
|
-
groupWithClause
|
|
426
|
+
groupWithClause,
|
|
418
427
|
};
|
|
419
428
|
};
|
|
420
429
|
|
|
@@ -472,7 +481,7 @@ const parse$5 = (query) => {
|
|
|
472
481
|
|
|
473
482
|
const build$3 = (metrics) => `SHOW ${metrics.join(', ')}`;
|
|
474
483
|
const parse$4 = (query) => {
|
|
475
|
-
const match = query.match(new RegExp(`\\bSHOW\\s+([\\s\\S]+?)(?=\\s+(?:${CLAUSE_KEYWORD_BOUNDARY})\\b)`, 'i'));
|
|
484
|
+
const match = query.match(new RegExp(`\\bSHOW\\s+([\\s\\S]+?)(?=\\s+(?:${CLAUSE_KEYWORD_BOUNDARY})\\b|$)`, 'i'));
|
|
476
485
|
if (!match)
|
|
477
486
|
return [];
|
|
478
487
|
return (match[1] ?? '')
|
|
@@ -524,11 +533,15 @@ const calcPercentageString = (part, total, decimals = 2) => {
|
|
|
524
533
|
dayjs.extend(utc);
|
|
525
534
|
dayjs.extend(timezone);
|
|
526
535
|
dayjs.extend(quarterOfYear);
|
|
527
|
-
let
|
|
536
|
+
// Stored on `globalThis` (not a module-local `let`): each entry-point bundle gets its
|
|
537
|
+
// own copy of this module, so a local var would let `setTz` and the query builder read
|
|
538
|
+
// different copies. A shared global slot keeps every bundle in sync.
|
|
539
|
+
const TZ_GLOBAL_KEY = '__GEM_SDK_ANALYTICS_TZ__';
|
|
528
540
|
function getInitialTimezone() {
|
|
529
|
-
return
|
|
541
|
+
return globalThis[TZ_GLOBAL_KEY] ?? 'UTC';
|
|
530
542
|
}
|
|
531
543
|
const dayjsTz = (date) => {
|
|
544
|
+
const tz = getInitialTimezone();
|
|
532
545
|
if (!date)
|
|
533
546
|
return dayjs().tz(tz);
|
|
534
547
|
return dayjs(date).tz(tz);
|
|
@@ -904,7 +917,13 @@ const parsePageItems = (value) => parseJsonObject(value);
|
|
|
904
917
|
|
|
905
918
|
const readNumeric = (metric, key) => {
|
|
906
919
|
const raw = metric?.[key];
|
|
907
|
-
|
|
920
|
+
if (typeof raw === 'number')
|
|
921
|
+
return raw;
|
|
922
|
+
if (typeof raw === 'string') {
|
|
923
|
+
const n = parseFloat(raw);
|
|
924
|
+
return isNaN(n) ? 0 : n;
|
|
925
|
+
}
|
|
926
|
+
return 0;
|
|
908
927
|
};
|
|
909
928
|
const createNumericRowReader = (row, mode = ERowReaderMode.DEFAULT) => (key) => {
|
|
910
929
|
const { prefix, suffix } = ROW_READER_MODE_CONFIG[mode];
|
|
@@ -1165,6 +1184,11 @@ var ICampaignType;
|
|
|
1165
1184
|
ICampaignType["TEMPLATE_BUNDLE"] = "TEMPLATE_BUNDLE";
|
|
1166
1185
|
// THEME = 'THEME',
|
|
1167
1186
|
})(ICampaignType || (ICampaignType = {}));
|
|
1187
|
+
var IVariantType;
|
|
1188
|
+
(function (IVariantType) {
|
|
1189
|
+
IVariantType["VARIANT_A"] = "A";
|
|
1190
|
+
IVariantType["VARIANT_B"] = "B";
|
|
1191
|
+
})(IVariantType || (IVariantType = {}));
|
|
1168
1192
|
|
|
1169
1193
|
[
|
|
1170
1194
|
{ value: EVisitorType.NEW, label: 'New' },
|
|
@@ -1230,8 +1254,19 @@ var GPaginationDirection;
|
|
|
1230
1254
|
|
|
1231
1255
|
const useGemXQlPagination = ({ resetKey, itemsPerPage, }) => {
|
|
1232
1256
|
const [currentPage, setCurrentPage] = useState(1);
|
|
1257
|
+
// Serialize so object/array reset keys compare by value, not by reference.
|
|
1258
|
+
const serializedResetKey = useMemo(() => {
|
|
1259
|
+
if (resetKey === undefined)
|
|
1260
|
+
return undefined;
|
|
1261
|
+
try {
|
|
1262
|
+
return JSON.stringify(resetKey);
|
|
1263
|
+
}
|
|
1264
|
+
catch {
|
|
1265
|
+
return String(resetKey);
|
|
1266
|
+
}
|
|
1267
|
+
}, [resetKey]);
|
|
1233
1268
|
const previousResetKeyRef = useRef();
|
|
1234
|
-
const shouldResetPagination = currentPage > 1 && previousResetKeyRef.current !== undefined && previousResetKeyRef.current !==
|
|
1269
|
+
const shouldResetPagination = currentPage > 1 && previousResetKeyRef.current !== undefined && previousResetKeyRef.current !== serializedResetKey;
|
|
1235
1270
|
const effectivePage = shouldResetPagination ? 1 : currentPage;
|
|
1236
1271
|
const offset = (effectivePage - 1) * itemsPerPage;
|
|
1237
1272
|
const handlePageChange = useCallback((totalPages) => (direction) => {
|
|
@@ -1242,11 +1277,11 @@ const useGemXQlPagination = ({ resetKey, itemsPerPage, }) => {
|
|
|
1242
1277
|
});
|
|
1243
1278
|
}, []);
|
|
1244
1279
|
useEffect(() => {
|
|
1245
|
-
if (previousResetKeyRef.current !==
|
|
1246
|
-
previousResetKeyRef.current =
|
|
1280
|
+
if (previousResetKeyRef.current !== serializedResetKey) {
|
|
1281
|
+
previousResetKeyRef.current = serializedResetKey;
|
|
1247
1282
|
setCurrentPage(1);
|
|
1248
1283
|
}
|
|
1249
|
-
}, [
|
|
1284
|
+
}, [serializedResetKey]);
|
|
1250
1285
|
const buildPagination = useCallback(({ totalRecords, isLoading }) => {
|
|
1251
1286
|
const totalPages = Math.max(1, Math.ceil(totalRecords / itemsPerPage));
|
|
1252
1287
|
return {
|
|
@@ -4,3 +4,4 @@ export { useFormatLineChartData } from './useFormatLineChartData';
|
|
|
4
4
|
export { usePopoverResizeObserver } from './usePopoverResizeObserver';
|
|
5
5
|
export { useToggle } from './useToggle';
|
|
6
6
|
export { useWindowSize } from './publish/useWindowSize';
|
|
7
|
+
export { usePreventBodyScroll } from './usePreventBodyScroll';
|