@levi-gemcommerce/analytics 0.0.1-dev.3 → 0.0.1-dev.5
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/core/gemxql/api/index.d.ts +2 -0
- package/dist/esm/core/gemxql/api/useCustomGemXQlQuery.d.ts +16 -0
- package/dist/esm/core/gemxql/api/useGemxQlNamedQuery.d.ts +14 -0
- package/dist/esm/core/gemxql/builder/build-gemxql-query.d.ts +15 -0
- package/dist/esm/core/gemxql/builder/clauses/condition-query.d.ts +12 -0
- package/dist/esm/core/gemxql/builder/clauses/from-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/clauses/group-query.d.ts +11 -0
- package/dist/esm/core/gemxql/builder/clauses/index.d.ts +11 -0
- package/dist/esm/core/gemxql/builder/clauses/limit-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/clauses/mode-query.d.ts +7 -0
- package/dist/esm/core/gemxql/builder/clauses/offset-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/clauses/order-by-query.d.ts +7 -0
- package/dist/esm/core/gemxql/builder/clauses/show-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/clauses/time-query.d.ts +16 -0
- package/dist/esm/core/gemxql/builder/clauses/time-series-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/clauses/timezone-query.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/configs/date-formats.d.ts +1 -0
- package/dist/esm/core/gemxql/builder/configs/index.d.ts +3 -0
- package/dist/esm/core/gemxql/builder/configs/keywords.d.ts +2 -0
- package/dist/esm/core/gemxql/builder/configs/query-defaults.d.ts +1 -0
- package/dist/esm/core/gemxql/builder/filters/build-extra-conditions.d.ts +3 -0
- package/dist/esm/core/gemxql/builder/filters/build-filter-conditions.d.ts +22 -0
- package/dist/esm/core/gemxql/builder/filters/index.d.ts +2 -0
- package/dist/esm/core/gemxql/builder/helpers/date-query-helpers.d.ts +5 -0
- package/dist/esm/core/gemxql/builder/helpers/index.d.ts +1 -0
- package/dist/esm/core/gemxql/builder/helpers/is-valid-query-input.d.ts +1 -0
- package/dist/esm/core/gemxql/builder/index.d.ts +6 -0
- package/dist/esm/core/gemxql/builder/parse-gemxql-query.d.ts +4 -0
- package/dist/esm/core/gemxql/constants/analytic-data.d.ts +2 -0
- package/dist/esm/core/gemxql/constants/column-keys.d.ts +4 -0
- package/dist/esm/core/gemxql/constants/index.d.ts +4 -0
- package/dist/esm/core/gemxql/constants/operators.d.ts +2 -0
- package/dist/esm/core/gemxql/constants/row-reader-mode.d.ts +5 -0
- package/dist/esm/core/gemxql/graphql/fragments/gemxql.generated.d.ts +23 -0
- package/dist/esm/core/gemxql/graphql/index.d.ts +2 -0
- package/dist/esm/core/gemxql/graphql/queries/gemxql.generated.d.ts +9 -0
- package/dist/esm/core/gemxql/helpers/columnKeys.d.ts +3 -0
- package/dist/esm/core/gemxql/helpers/extractQueryData.d.ts +5 -0
- package/dist/esm/core/gemxql/helpers/formatAnalyticData.d.ts +10 -0
- package/dist/esm/core/gemxql/helpers/formatAnalyticDate.d.ts +1 -0
- package/dist/esm/core/gemxql/helpers/getTimeDimension.d.ts +3 -0
- package/dist/esm/core/gemxql/helpers/hasMetricData.d.ts +1 -0
- package/dist/esm/core/gemxql/helpers/index.d.ts +8 -0
- package/dist/esm/core/gemxql/helpers/parseJsonFields.d.ts +9 -0
- package/dist/esm/core/gemxql/helpers/readNumeric.d.ts +3 -0
- package/dist/esm/core/gemxql/hooks/index.d.ts +2 -0
- package/dist/esm/core/gemxql/hooks/useAnalyticData.d.ts +24 -0
- package/dist/esm/core/gemxql/hooks/useGemXQlPagination.d.ts +25 -0
- package/dist/esm/core/gemxql/index.d.ts +10 -0
- package/dist/esm/core/gemxql/types/analytic-data.d.ts +24 -0
- package/dist/esm/core/gemxql/types/analytic-mode.d.ts +5 -0
- package/dist/esm/core/gemxql/types/analytic-source.d.ts +4 -0
- package/dist/esm/core/gemxql/types/breakdown-items.d.ts +19 -0
- package/dist/esm/core/gemxql/types/date-filter.d.ts +10 -0
- package/dist/esm/core/gemxql/types/extra-condition.d.ts +28 -0
- package/dist/esm/core/gemxql/types/field-filters.d.ts +18 -0
- package/dist/esm/core/gemxql/types/field-operators.d.ts +8 -0
- package/dist/esm/core/gemxql/types/filter-types.d.ts +28 -0
- package/dist/esm/core/gemxql/types/group-with-clause.d.ts +12 -0
- package/dist/esm/core/gemxql/types/index.d.ts +14 -0
- package/dist/esm/core/gemxql/types/order-by.d.ts +10 -0
- package/dist/esm/core/gemxql/types/page-fields.d.ts +22 -0
- package/dist/esm/core/gemxql/types/row-reader-mode.d.ts +6 -0
- package/dist/esm/core/gemxql/types/time-dimension.d.ts +8 -0
- package/dist/esm/core/gemxql/utils/analytics.d.ts +13 -0
- package/dist/esm/core/gemxql/utils/dayjs.d.ts +8 -0
- package/dist/umd/esm/core/gemxql/api/index.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/api/useCustomGemXQlQuery.d.ts +16 -0
- package/dist/umd/esm/core/gemxql/api/useGemxQlNamedQuery.d.ts +14 -0
- package/dist/umd/esm/core/gemxql/builder/build-gemxql-query.d.ts +15 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/condition-query.d.ts +12 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/from-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/group-query.d.ts +11 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/index.d.ts +11 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/limit-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/mode-query.d.ts +7 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/offset-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/order-by-query.d.ts +7 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/show-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/time-query.d.ts +16 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/time-series-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/clauses/timezone-query.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/configs/date-formats.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/builder/configs/index.d.ts +3 -0
- package/dist/umd/esm/core/gemxql/builder/configs/keywords.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/builder/configs/query-defaults.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/builder/filters/build-extra-conditions.d.ts +3 -0
- package/dist/umd/esm/core/gemxql/builder/filters/build-filter-conditions.d.ts +22 -0
- package/dist/umd/esm/core/gemxql/builder/filters/index.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/builder/helpers/date-query-helpers.d.ts +5 -0
- package/dist/umd/esm/core/gemxql/builder/helpers/index.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/builder/helpers/is-valid-query-input.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/builder/index.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/builder/parse-gemxql-query.d.ts +4 -0
- package/dist/umd/esm/core/gemxql/constants/analytic-data.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/constants/column-keys.d.ts +4 -0
- package/dist/umd/esm/core/gemxql/constants/index.d.ts +4 -0
- package/dist/umd/esm/core/gemxql/constants/operators.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/constants/row-reader-mode.d.ts +5 -0
- package/dist/umd/esm/core/gemxql/graphql/fragments/gemxql.generated.d.ts +23 -0
- package/dist/umd/esm/core/gemxql/graphql/index.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/graphql/queries/gemxql.generated.d.ts +9 -0
- package/dist/umd/esm/core/gemxql/helpers/columnKeys.d.ts +3 -0
- package/dist/umd/esm/core/gemxql/helpers/extractQueryData.d.ts +5 -0
- package/dist/umd/esm/core/gemxql/helpers/formatAnalyticData.d.ts +10 -0
- package/dist/umd/esm/core/gemxql/helpers/formatAnalyticDate.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/helpers/getTimeDimension.d.ts +3 -0
- package/dist/umd/esm/core/gemxql/helpers/hasMetricData.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/helpers/index.d.ts +8 -0
- package/dist/umd/esm/core/gemxql/helpers/parseJsonFields.d.ts +9 -0
- package/dist/umd/esm/core/gemxql/helpers/readNumeric.d.ts +3 -0
- package/dist/umd/esm/core/gemxql/hooks/index.d.ts +2 -0
- package/dist/umd/esm/core/gemxql/hooks/useAnalyticData.d.ts +24 -0
- package/dist/umd/esm/core/gemxql/hooks/useGemXQlPagination.d.ts +25 -0
- package/dist/umd/esm/core/gemxql/index.d.ts +10 -0
- package/dist/umd/esm/core/gemxql/types/analytic-data.d.ts +24 -0
- package/dist/umd/esm/core/gemxql/types/analytic-mode.d.ts +5 -0
- package/dist/umd/esm/core/gemxql/types/analytic-source.d.ts +4 -0
- package/dist/umd/esm/core/gemxql/types/breakdown-items.d.ts +19 -0
- package/dist/umd/esm/core/gemxql/types/date-filter.d.ts +10 -0
- package/dist/umd/esm/core/gemxql/types/extra-condition.d.ts +28 -0
- package/dist/umd/esm/core/gemxql/types/field-filters.d.ts +18 -0
- package/dist/umd/esm/core/gemxql/types/field-operators.d.ts +8 -0
- package/dist/umd/esm/core/gemxql/types/filter-types.d.ts +28 -0
- package/dist/umd/esm/core/gemxql/types/group-with-clause.d.ts +12 -0
- package/dist/umd/esm/core/gemxql/types/index.d.ts +14 -0
- package/dist/umd/esm/core/gemxql/types/order-by.d.ts +10 -0
- package/dist/umd/esm/core/gemxql/types/page-fields.d.ts +22 -0
- package/dist/umd/esm/core/gemxql/types/row-reader-mode.d.ts +6 -0
- package/dist/umd/esm/core/gemxql/types/time-dimension.d.ts +8 -0
- package/dist/umd/esm/core/gemxql/utils/analytics.d.ts +13 -0
- package/dist/umd/esm/core/gemxql/utils/dayjs.d.ts +8 -0
- package/package.json +21 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './analytic-data';
|
|
2
|
+
export * from './analytic-mode';
|
|
3
|
+
export * from './analytic-source';
|
|
4
|
+
export * from './breakdown-items';
|
|
5
|
+
export * from './date-filter';
|
|
6
|
+
export * from './extra-condition';
|
|
7
|
+
export * from './field-filters';
|
|
8
|
+
export * from './field-operators';
|
|
9
|
+
export * from './filter-types';
|
|
10
|
+
export * from './group-with-clause';
|
|
11
|
+
export * from './order-by';
|
|
12
|
+
export * from './page-fields';
|
|
13
|
+
export * from './row-reader-mode';
|
|
14
|
+
export * from './time-dimension';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum EOrderDirectionType {
|
|
2
|
+
ASC = "ASC",
|
|
3
|
+
DESC = "DESC"
|
|
4
|
+
}
|
|
5
|
+
export type OrderDirectionType = EOrderDirectionType.ASC | EOrderDirectionType.DESC;
|
|
6
|
+
export type OrderByType = {
|
|
7
|
+
field: string;
|
|
8
|
+
direction: OrderDirectionType;
|
|
9
|
+
};
|
|
10
|
+
export type OrderByFields = Record<string, OrderByType>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum EPageMetric {
|
|
2
|
+
PAGE_ITEMS = "page_items",
|
|
3
|
+
PAGE_PATHS = "page_paths"
|
|
4
|
+
}
|
|
5
|
+
export declare enum EPageDimension {
|
|
6
|
+
PAGE_PATH = "page_path"
|
|
7
|
+
}
|
|
8
|
+
export declare enum EPageField {
|
|
9
|
+
SHOPIFY_PAGE_ID = "shopify_page_id",
|
|
10
|
+
LOCATION_PATH = "location_path",
|
|
11
|
+
PAGE_TYPE = "page_type",
|
|
12
|
+
PAGE_TITLE = "page_title",
|
|
13
|
+
PAGE_PATH = "page_path",
|
|
14
|
+
TEMPLATE_SUFFIX = "template_suffix"
|
|
15
|
+
}
|
|
16
|
+
export interface IPageItemsPayload {
|
|
17
|
+
[EPageField.SHOPIFY_PAGE_ID]: string;
|
|
18
|
+
[EPageField.LOCATION_PATH]: string;
|
|
19
|
+
[EPageField.PAGE_TYPE]: string;
|
|
20
|
+
[EPageField.PAGE_TITLE]: string;
|
|
21
|
+
[EPageField.TEMPLATE_SUFFIX]: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum AnalyticInterval {
|
|
2
|
+
DAY = "DAY",
|
|
3
|
+
HOUR = "HOUR",
|
|
4
|
+
MONTH = "MONTH",
|
|
5
|
+
QUARTER = "QUARTER",
|
|
6
|
+
WEEK = "WEEK",
|
|
7
|
+
YEAR = "YEAR"
|
|
8
|
+
}
|
|
9
|
+
export declare function numberWithCommas(x: string): string;
|
|
10
|
+
export declare const getTimeDurationLabel: (valueInSeconds: number) => string;
|
|
11
|
+
export declare const getFormattedByInterval: (value: string | number | null, interval?: AnalyticInterval, options?: {
|
|
12
|
+
isExpandDetail?: boolean;
|
|
13
|
+
}) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ConfigType, Dayjs } from 'dayjs';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
export declare function getInitialTimezone(): string;
|
|
4
|
+
export declare function setTz(value: string): void;
|
|
5
|
+
export declare const dayjsTz: (date?: ConfigType) => Dayjs;
|
|
6
|
+
export declare const convertDateToTz: (date?: ConfigType) => Dayjs;
|
|
7
|
+
export { dayjs };
|
|
8
|
+
export type { Dayjs };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { QueryKey, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { GemxQlQueryResponse, GemxQlQueryVariables } from '../graphql';
|
|
3
|
+
type GemXQlCustomFetcher<TData, TVariables> = (document: string, variables: TVariables) => () => Promise<TData>;
|
|
4
|
+
export interface BaseHeaderResponse {
|
|
5
|
+
'x-cache'?: string;
|
|
6
|
+
'x-request-id'?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CustomGemXQlResponse extends GemxQlQueryResponse {
|
|
9
|
+
headers: BaseHeaderResponse;
|
|
10
|
+
}
|
|
11
|
+
type GemXQlQueryOptions<TData, TError> = Omit<UseQueryOptions<CustomGemXQlResponse, TError, TData, QueryKey>, 'queryKey' | 'queryFn'>;
|
|
12
|
+
export declare const useCustomGemXQlQuery: {
|
|
13
|
+
<TData = CustomGemXQlResponse, TError = unknown>(variables: GemxQlQueryVariables, fetcher: GemXQlCustomFetcher<CustomGemXQlResponse, GemxQlQueryVariables>, options?: GemXQlQueryOptions<TData, TError>): UseQueryResult<TData, TError>;
|
|
14
|
+
getKey(variables: GemxQlQueryVariables): (string | GemxQlQueryVariables)[];
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { QueryKey, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { GemxQlQueryResponse, GemxQlQueryVariables } from '../graphql';
|
|
3
|
+
type GemXQlFetcher<TData, TVariables> = (document: string, variables: TVariables) => () => Promise<TData>;
|
|
4
|
+
interface UseGemxQlNamedQueryParams {
|
|
5
|
+
name: string;
|
|
6
|
+
variables: GemxQlQueryVariables;
|
|
7
|
+
fetcher: GemXQlFetcher<GemxQlQueryResponse, GemxQlQueryVariables>;
|
|
8
|
+
}
|
|
9
|
+
type GemXQlNamedQueryOptions<TData, TError> = Omit<UseQueryOptions<GemxQlQueryResponse, TError, TData, QueryKey>, 'queryKey' | 'queryFn'>;
|
|
10
|
+
export declare const useGemxQlNamedQuery: {
|
|
11
|
+
<TData = GemxQlQueryResponse, TError = unknown>({ name, variables, fetcher }: UseGemxQlNamedQueryParams, options?: GemXQlNamedQueryOptions<TData, TError>): UseQueryResult<TData, TError>;
|
|
12
|
+
getKey(name: string, variables: GemxQlQueryVariables): (string | GemxQlQueryVariables)[];
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IBuildConditionQueryParams } from './clauses/condition-query';
|
|
2
|
+
import type { IBuildFromQueryParams } from './clauses/from-query';
|
|
3
|
+
import type { IBuildGroupQueryParams } from './clauses/group-query';
|
|
4
|
+
import type { IBuildLimitQueryParams } from './clauses/limit-query';
|
|
5
|
+
import type { IBuildModeQueryParams } from './clauses/mode-query';
|
|
6
|
+
import type { IBuildOffsetQueryParams } from './clauses/offset-query';
|
|
7
|
+
import type { IBuildOrderByQueryParams } from './clauses/order-by-query';
|
|
8
|
+
import type { IBuildShowQueryParams } from './clauses/show-query';
|
|
9
|
+
import type { IBuildTimeQueryParams } from './clauses/time-query';
|
|
10
|
+
import type { IBuildTimeSeriesQueryParams } from './clauses/time-series-query';
|
|
11
|
+
import type { IBuildTimezoneQueryParams } from './clauses/timezone-query';
|
|
12
|
+
export type IBuildGemXQlQueryParams = IBuildModeQueryParams & IBuildFromQueryParams & IBuildShowQueryParams & IBuildGroupQueryParams & IBuildTimeQueryParams & IBuildTimeSeriesQueryParams & IBuildTimezoneQueryParams & IBuildOrderByQueryParams & IBuildConditionQueryParams & IBuildLimitQueryParams & IBuildOffsetQueryParams & {
|
|
13
|
+
extraOrderByFields?: string[];
|
|
14
|
+
};
|
|
15
|
+
export declare const buildGemXQlQuery: (params: IBuildGemXQlQueryParams) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GemXQlFilters, GemXQlVersionIds, IExtraCondition } from '../../types';
|
|
2
|
+
import type { IBuildFilterConditionsParams, IBuildVersionIdConditionParams } from '../filters/build-filter-conditions';
|
|
3
|
+
export interface IBuildConditionQueryParams extends IBuildFilterConditionsParams, IBuildVersionIdConditionParams {
|
|
4
|
+
extraConditions?: IExtraCondition[];
|
|
5
|
+
}
|
|
6
|
+
export type IParseConditionQueryResult = {
|
|
7
|
+
filters: GemXQlFilters;
|
|
8
|
+
versionIds?: GemXQlVersionIds;
|
|
9
|
+
};
|
|
10
|
+
declare const build: ({ filters, overrideFilters, versionIds, extraConditions }: IBuildConditionQueryParams) => string;
|
|
11
|
+
declare const parse: (query: string) => IParseConditionQueryResult;
|
|
12
|
+
export { build as buildConditionQuery, parse as parseConditionQuery };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EGroupWithClause } from '../../types';
|
|
2
|
+
export interface IBuildGroupQueryParams {
|
|
3
|
+
dimensions: string[];
|
|
4
|
+
groupWithClause?: EGroupWithClause;
|
|
5
|
+
}
|
|
6
|
+
declare const build: (dimensions: string[], withClause?: EGroupWithClause) => string;
|
|
7
|
+
declare const parse: (query: string) => {
|
|
8
|
+
dimensions: string[];
|
|
9
|
+
groupWithClause?: EGroupWithClause;
|
|
10
|
+
};
|
|
11
|
+
export { build as buildGroupQuery, parse as parseGroupQuery };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './condition-query';
|
|
2
|
+
export * from './from-query';
|
|
3
|
+
export * from './group-query';
|
|
4
|
+
export * from './limit-query';
|
|
5
|
+
export * from './mode-query';
|
|
6
|
+
export * from './offset-query';
|
|
7
|
+
export * from './order-by-query';
|
|
8
|
+
export * from './show-query';
|
|
9
|
+
export * from './time-query';
|
|
10
|
+
export * from './time-series-query';
|
|
11
|
+
export * from './timezone-query';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EAnalyticMode } from '../../types';
|
|
2
|
+
export interface IBuildModeQueryParams {
|
|
3
|
+
mode: EAnalyticMode;
|
|
4
|
+
}
|
|
5
|
+
declare const build: (mode: EAnalyticMode) => string;
|
|
6
|
+
declare const parse: (query: string) => EAnalyticMode | undefined;
|
|
7
|
+
export { build as buildModeQuery, parse as parseModeQuery };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OrderByFields } from '../../types';
|
|
2
|
+
export interface IBuildOrderByQueryParams {
|
|
3
|
+
orderBy?: OrderByFields;
|
|
4
|
+
}
|
|
5
|
+
declare const build: (orderBy?: OrderByFields, columns?: string[]) => string;
|
|
6
|
+
declare const parse: (query: string) => OrderByFields | undefined;
|
|
7
|
+
export { build as buildOrderByQuery, parse as parseOrderByQuery };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AnalyticDateFilter, GemXQlFilters, GemXQlOverrideFilters } from '../../types';
|
|
2
|
+
export interface IBuildTimeQueryParams {
|
|
3
|
+
dateRange?: AnalyticDateFilter;
|
|
4
|
+
compareDateRange?: AnalyticDateFilter;
|
|
5
|
+
overrideFilters?: GemXQlOverrideFilters;
|
|
6
|
+
timeDimension?: string;
|
|
7
|
+
}
|
|
8
|
+
export type IParseTimeQueryResult = {
|
|
9
|
+
dateRange?: Pick<AnalyticDateFilter, 'startDate' | 'endDate'>;
|
|
10
|
+
compareDateRange?: Pick<AnalyticDateFilter, 'startDate' | 'endDate'>;
|
|
11
|
+
timeDimension?: string;
|
|
12
|
+
overrideFilters?: GemXQlFilters;
|
|
13
|
+
};
|
|
14
|
+
declare const build: (data: IBuildTimeQueryParams) => string;
|
|
15
|
+
declare const parse: (query: string) => IParseTimeQueryResult;
|
|
16
|
+
export { build as buildTimeQuery, parse as parseTimeQuery };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DATE_QUERY_FORMAT = "YYYY-MM-DDTHH:mm:ss";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_QUERY_LIMIT = 1000;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GemXQlFilters, GemXQlOverrideFilters, GemXQlVersionIds, OrderByFields } from '../../types';
|
|
2
|
+
import { EFilterField, EOperatorField } from '../../types';
|
|
3
|
+
export interface IBuildFilterConditionsParams {
|
|
4
|
+
filters: GemXQlFilters;
|
|
5
|
+
overrideFilters?: GemXQlOverrideFilters;
|
|
6
|
+
}
|
|
7
|
+
export interface IBuildVersionIdConditionParams {
|
|
8
|
+
versionIds?: GemXQlVersionIds;
|
|
9
|
+
}
|
|
10
|
+
interface FilterConfig {
|
|
11
|
+
operator?: EOperatorField;
|
|
12
|
+
operatorVal?: string;
|
|
13
|
+
singleField: EFilterField;
|
|
14
|
+
multiField: EFilterField;
|
|
15
|
+
condition?: EFilterField;
|
|
16
|
+
fieldName?: EFilterField;
|
|
17
|
+
}
|
|
18
|
+
export declare const filterConfigs: FilterConfig[];
|
|
19
|
+
export declare const generateFilterConditions: (filters: GemXQlFilters, overrideFilters?: GemXQlOverrideFilters) => string[];
|
|
20
|
+
export declare const buildVersionIdCondition: (versionIds?: GemXQlVersionIds) => string[];
|
|
21
|
+
export declare const getFirstMetricInOrderBy: (orderBy: OrderByFields | undefined, metrics: string[]) => string[];
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './is-valid-query-input';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isValidQueryInput(query: string): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type Maybe<T> = T | null | undefined;
|
|
2
|
+
export type TableDataType = 'ARRAY' | 'CURRENCY' | 'DATE' | 'DAY_TIMESTAMP' | 'DURATION' | 'HOUR_TIMESTAMP' | 'INTEGER' | 'MONTH_TIMESTAMP' | 'OBJECT' | 'PERCENT' | 'QUARTER_TIMESTAMP' | 'STRING' | 'WEEK_TIMESTAMP' | 'YEAR_TIMESTAMP';
|
|
3
|
+
export interface IColumn {
|
|
4
|
+
dataType: TableDataType;
|
|
5
|
+
displayName?: Maybe<string>;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ITableData {
|
|
9
|
+
rows: unknown;
|
|
10
|
+
columns?: Maybe<Array<Maybe<IColumn>>>;
|
|
11
|
+
}
|
|
12
|
+
export type ColumnSelectFragment = Pick<IColumn, 'dataType' | 'displayName' | 'name'>;
|
|
13
|
+
export type TableDataSelectFragment = Pick<ITableData, 'rows'> & {
|
|
14
|
+
columns?: Maybe<Array<Maybe<Pick<IColumn, 'dataType' | 'displayName' | 'name'>>>>;
|
|
15
|
+
};
|
|
16
|
+
export type GemXqlResultSelectFragment = {
|
|
17
|
+
tableData?: Maybe<Pick<ITableData, 'rows'> & {
|
|
18
|
+
columns?: Maybe<Array<Maybe<Pick<IColumn, 'dataType' | 'displayName' | 'name'>>>>;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export declare const ColumnSelectFragmentDoc = "\n fragment ColumnSelect on Column {\n dataType\n displayName\n name\n}\n ";
|
|
22
|
+
export declare const TableDataSelectFragmentDoc = "\n fragment TableDataSelect on TableData {\n columns {\n ...ColumnSelect\n }\n rows\n}\n ";
|
|
23
|
+
export declare const GemXqlResultSelectFragmentDoc = "\n fragment GemXQLResultSelect on GemxQLResult {\n tableData {\n ...TableDataSelect\n }\n}\n ";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Maybe } from '../fragments/gemxql.generated';
|
|
2
|
+
import { type GemXqlResultSelectFragment } from '../fragments/gemxql.generated';
|
|
3
|
+
export type GemxQlQueryVariables = {
|
|
4
|
+
input: string;
|
|
5
|
+
};
|
|
6
|
+
export type GemxQlQueryResponse = {
|
|
7
|
+
gemxQLQuery?: Maybe<GemXqlResultSelectFragment>;
|
|
8
|
+
};
|
|
9
|
+
export declare const GemxQlDocument = "\n query GemxQL($input: String!) {\n gemxQLQuery(query: $input) {\n ...GemXQLResultSelect\n }\n}\n \n fragment GemXQLResultSelect on GemxQLResult {\n tableData {\n ...TableDataSelect\n }\n}\n \n\n fragment TableDataSelect on TableData {\n columns {\n ...ColumnSelect\n }\n rows\n}\n \n\n fragment ColumnSelect on Column {\n dataType\n displayName\n name\n}\n ";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { GemxQlQueryResponse, TableDataType } from '../graphql';
|
|
2
|
+
export type ColumnTypesMap = Record<string, TableDataType>;
|
|
3
|
+
export declare const extractQueryRows: (response?: GemxQlQueryResponse) => Record<string, unknown>[];
|
|
4
|
+
export declare const extractQueryColumns: (response?: GemxQlQueryResponse) => import("../graphql").Maybe<Pick<import("../graphql").IColumn, "displayName" | "dataType" | "name">>[];
|
|
5
|
+
export declare const extractColumnTypes: (response?: GemxQlQueryResponse) => ColumnTypesMap;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AnalyticValueType } from '../types';
|
|
2
|
+
export type IGetTextPrice = (price?: number | string | null, hasCurrency?: boolean, options?: {
|
|
3
|
+
compact?: boolean;
|
|
4
|
+
}) => string;
|
|
5
|
+
export declare const formatAnalyticData: ({ value, formatter, getTextPrice, name, }: {
|
|
6
|
+
value: AnalyticValueType;
|
|
7
|
+
formatter?: string;
|
|
8
|
+
getTextPrice?: IGetTextPrice;
|
|
9
|
+
name?: string;
|
|
10
|
+
}) => AnalyticValueType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatAnalyticDate: (dateString: string | number | null) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hasMetricData: (metric?: Record<string, unknown>) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './columnKeys';
|
|
2
|
+
export * from './extractQueryData';
|
|
3
|
+
export * from './formatAnalyticData';
|
|
4
|
+
export * from './formatAnalyticDate';
|
|
5
|
+
export * from './getTimeDimension';
|
|
6
|
+
export * from './hasMetricData';
|
|
7
|
+
export * from './parseJsonFields';
|
|
8
|
+
export * from './readNumeric';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IPageItemsPayload } from '../types';
|
|
2
|
+
export interface IBreakdownItem<T extends string = string> {
|
|
3
|
+
type: T;
|
|
4
|
+
total: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const parseJsonObject: <T extends object>(value: unknown) => T | null;
|
|
7
|
+
export declare const parseJsonArray: <T>(raw: unknown) => T[] | undefined;
|
|
8
|
+
export declare const parseBreakdownItems: <T extends string = string>(raw: unknown) => IBreakdownItem<T>[] | undefined;
|
|
9
|
+
export declare const parsePageItems: (value: unknown) => IPageItemsPayload | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ERowReaderMode } from '../types';
|
|
2
|
+
export declare const readNumeric: (metric: Record<string, unknown> | undefined, key: string) => number;
|
|
3
|
+
export declare const createNumericRowReader: (row: Record<string, unknown>, mode?: ERowReaderMode) => (key: string) => number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IGetTextPrice } from '../helpers/formatAnalyticData';
|
|
2
|
+
import type { AnalyticValueType } from '../types';
|
|
3
|
+
interface IFormatDataParams {
|
|
4
|
+
value: AnalyticValueType;
|
|
5
|
+
formatter?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
}
|
|
8
|
+
type MetricRecord = Record<string, unknown>;
|
|
9
|
+
interface IComputeMetricParams {
|
|
10
|
+
metric?: MetricRecord;
|
|
11
|
+
previousMetric?: MetricRecord;
|
|
12
|
+
metricKey: string;
|
|
13
|
+
formatter?: string;
|
|
14
|
+
}
|
|
15
|
+
interface IComputeMetricResult {
|
|
16
|
+
value: AnalyticValueType;
|
|
17
|
+
change: number | string;
|
|
18
|
+
}
|
|
19
|
+
interface IUseAnalyticDataReturn {
|
|
20
|
+
formatData: (params: IFormatDataParams) => AnalyticValueType;
|
|
21
|
+
computeMetric: (params: IComputeMetricParams) => IComputeMetricResult;
|
|
22
|
+
}
|
|
23
|
+
export declare const useAnalyticData: (getTextPrice?: IGetTextPrice) => IUseAnalyticDataReturn;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare enum GPaginationDirection {
|
|
2
|
+
NEXT = "NEXT",
|
|
3
|
+
PREV = "PREV"
|
|
4
|
+
}
|
|
5
|
+
export interface GPaginationProps {
|
|
6
|
+
currentPage: number;
|
|
7
|
+
totalPages: number;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
handlePageChange: (direction: GPaginationDirection) => void;
|
|
10
|
+
}
|
|
11
|
+
interface IUseGemXQlPaginationProps {
|
|
12
|
+
resetKey: unknown;
|
|
13
|
+
itemsPerPage: number;
|
|
14
|
+
}
|
|
15
|
+
interface IBuildPaginationPropsParams {
|
|
16
|
+
totalRecords: number;
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface IUseGemXQlPaginationReturn {
|
|
20
|
+
currentPage: number;
|
|
21
|
+
offset: number;
|
|
22
|
+
buildPagination: (params: IBuildPaginationPropsParams) => GPaginationProps;
|
|
23
|
+
}
|
|
24
|
+
export declare const useGemXQlPagination: ({ resetKey, itemsPerPage, }: IUseGemXQlPaginationProps) => IUseGemXQlPaginationReturn;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './api';
|
|
2
|
+
export * from './builder';
|
|
3
|
+
export * from './constants';
|
|
4
|
+
export * from './graphql';
|
|
5
|
+
export * from './helpers';
|
|
6
|
+
export * from './hooks';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export { AnalyticInterval, getFormattedByInterval, getTimeDurationLabel, numberWithCommas } from './utils/analytics';
|
|
9
|
+
export { convertDateToTz, dayjsTz, getInitialTimezone, setTz } from './utils/dayjs';
|
|
10
|
+
export type { Dayjs } from './utils/dayjs';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare enum EAnalyticDataType {
|
|
2
|
+
DATE = "DATE",
|
|
3
|
+
ARRAY = "ARRAY",
|
|
4
|
+
OBJECT = "OBJECT",
|
|
5
|
+
STRING = "STRING",
|
|
6
|
+
INTEGER = "INTEGER",
|
|
7
|
+
CURRENCY = "CURRENCY",
|
|
8
|
+
PERCENT = "PERCENT",
|
|
9
|
+
DURATION = "DURATION",
|
|
10
|
+
MONTH = "MONTH_TIMESTAMP",
|
|
11
|
+
QUARTER = "QUARTER_TIMESTAMP",
|
|
12
|
+
DAY = "DAY_TIMESTAMP",
|
|
13
|
+
WEEK = "WEEK_TIMESTAMP",
|
|
14
|
+
YEAR = "YEAR_TIMESTAMP",
|
|
15
|
+
HOUR = "HOUR_TIMESTAMP"
|
|
16
|
+
}
|
|
17
|
+
export declare enum EAnalyticColumnKey {
|
|
18
|
+
CAMPAIGNS = "experiments",
|
|
19
|
+
VISITOR_ITEMS = "visitor_items",
|
|
20
|
+
DEVICE_ITEMS = "device_items",
|
|
21
|
+
TRAFFIC_SOURCE_ITEMS = "traffic_source_items"
|
|
22
|
+
}
|
|
23
|
+
export type AnalyticPrimitiveValueType = string | number | null;
|
|
24
|
+
export type AnalyticValueType = AnalyticPrimitiveValueType;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare enum EVisitorType {
|
|
2
|
+
NEW = "new",
|
|
3
|
+
RETURNING = "returning"
|
|
4
|
+
}
|
|
5
|
+
export declare enum EDeviceType {
|
|
6
|
+
DESKTOP = "desktop",
|
|
7
|
+
MOBILE = "mobile",
|
|
8
|
+
TABLET = "tablet"
|
|
9
|
+
}
|
|
10
|
+
export declare enum ETrafficSourceType {
|
|
11
|
+
DIRECT = "direct",
|
|
12
|
+
EMAIL = "email",
|
|
13
|
+
REFERRAL = "referral",
|
|
14
|
+
ORGANIC_SOCIAL = "organic-social",
|
|
15
|
+
ORGANIC_SEARCH = "organic-search",
|
|
16
|
+
PAID_SOCIAL = "paid-social",
|
|
17
|
+
PAID_SEARCH = "paid-search",
|
|
18
|
+
SMS = "sms"
|
|
19
|
+
}
|