arky-sdk 0.7.134 → 0.9.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.
@@ -81,60 +81,100 @@ interface TrackParams {
81
81
  declare const COMMON_ACTIVITY_TYPES: readonly ["page_view", "product_view", "service_view", "provider_view", "cart_added", "cart_removed", "checkout_started", "purchase", "order_created", "signin", "signup", "verified_email", "search", "share", "wishlist_added"];
82
82
  type CommonActivityType = (typeof COMMON_ACTIVITY_TYPES)[number];
83
83
 
84
- type EntityKind = "product" | "service" | "provider" | "node" | "customer" | "audience" | "agent" | "workflow" | "promo_code" | "email_template" | "form" | "taxonomy" | "media" | "order";
85
- type Granularity = "hour" | "day" | "week" | "month" | {
86
- minutes: 5 | 10 | 15 | 30;
87
- };
88
- type Measure = "count" | "uniq_customers" | "orders_created" | "new_customers" | "form_submissions" | {
89
- entity_state: {
90
- entity: EntityKind;
91
- status: string;
92
- };
93
- };
94
- type Dimension = "country_code" | "city" | "device_type" | "browser" | "os" | "language" | "activity_type" | "entity" | "entity_status" | {
95
- time_bucket: {
96
- granularity: Granularity;
97
- };
98
- };
99
- type FilterField = "type" | "country_code" | "device_type" | "browser" | "os" | "language" | "entity" | "action" | "customer_id";
100
- type FilterOp = "eq" | "neq" | "in" | "not_in" | "contains";
101
- interface Filter {
102
- field: FilterField;
103
- op: FilterOp;
104
- values: string[];
105
- }
106
- type TimeUnit = "hour" | "day" | "week" | "month";
107
- type TimeRange = {
108
- from: number;
109
- unit: TimeUnit;
110
- to?: number;
111
- } | {
84
+ interface AnalyticsTimeRange {
112
85
  from: number;
113
86
  to: number;
114
- };
115
- interface OrderBy {
116
- field: string;
117
- dir: "asc" | "desc";
118
- }
119
- interface AnalyticsQuery {
120
- measures: Measure[];
121
- dimensions?: Dimension[];
122
- filters?: Filter[];
123
- time_range: TimeRange;
124
- granularity?: Granularity;
125
- order_by?: OrderBy[];
87
+ }
88
+ type AnalyticsReportKey = "orders_created" | "customers_created" | "form_submissions_created" | "carts_abandoned" | "media_count" | "products_by_status" | "services_by_status" | "providers_by_status" | "nodes_by_status" | "customers_by_status" | "audiences_by_status" | "agents_by_status" | "workflows_by_status" | "promo_codes_by_status" | "email_templates_by_status" | "forms_by_status" | "taxonomies_by_status" | "carts_by_status" | "orders_by_status" | "order_items_by_status" | "activity_by_country" | "recent_activity";
89
+ type ActivityFeedCategory = "orders" | "carts" | "promo_codes" | "submissions" | "customers" | "audiences" | "products" | "services" | "providers" | "cms" | "workflows" | "agents" | "activities";
90
+ interface AnalyticsReportRequest {
91
+ key: AnalyticsReportKey;
126
92
  limit?: number;
93
+ category?: ActivityFeedCategory;
94
+ cursor_created_at?: number;
95
+ cursor_id?: string;
96
+ }
97
+ interface AnalyticsRequest {
98
+ time: AnalyticsTimeRange;
99
+ reports: AnalyticsReportRequest[];
100
+ }
101
+ interface AnalyticsMetricData {
102
+ value: number;
103
+ execution_ms?: number;
104
+ }
105
+ interface AnalyticsBreakdownItem {
106
+ key: string;
107
+ label: string;
108
+ value: number;
109
+ unique_customers?: number;
127
110
  }
128
- interface AnalyticsRow {
129
- [key: string]: string | number | null;
111
+ interface AnalyticsBreakdownData {
112
+ items: AnalyticsBreakdownItem[];
130
113
  }
131
- interface AnalyticsQueryResponse {
132
- rows: AnalyticsRow[];
114
+ interface ActivityFeedItem {
115
+ id: string;
116
+ entity: string;
117
+ entity_id: string;
118
+ action: string;
119
+ event_type: string;
120
+ status: string;
121
+ customer_id: string;
122
+ category: string;
123
+ title: string;
124
+ description: string;
125
+ href?: string | null;
126
+ data: unknown;
127
+ payload: unknown;
128
+ created_at: number;
129
+ }
130
+ interface ActivityFeedSummary {
131
+ total: number;
132
+ orders: number;
133
+ submissions: number;
134
+ customers: number;
135
+ audiences: number;
136
+ abandoned_carts: number;
137
+ carts: number;
138
+ promo_codes: number;
139
+ products: number;
140
+ services: number;
141
+ providers: number;
142
+ cms: number;
143
+ workflows: number;
144
+ agents: number;
145
+ activities: number;
146
+ window_start: number;
147
+ }
148
+ interface ActivityFeedCursor {
149
+ created_at: number;
150
+ id: string;
151
+ }
152
+ interface ActivityFeedData {
153
+ items: ActivityFeedItem[];
154
+ summary: ActivityFeedSummary;
155
+ next_cursor?: ActivityFeedCursor | null;
133
156
  meta: {
134
157
  row_count: number;
135
158
  execution_ms: number;
136
159
  };
137
160
  }
161
+ type AnalyticsReport = {
162
+ key: AnalyticsReportKey;
163
+ type: "metric";
164
+ data: AnalyticsMetricData;
165
+ } | {
166
+ key: AnalyticsReportKey;
167
+ type: "breakdown";
168
+ data: AnalyticsBreakdownData;
169
+ } | {
170
+ key: AnalyticsReportKey;
171
+ type: "activity";
172
+ data: ActivityFeedData;
173
+ };
174
+ interface AnalyticsResponse {
175
+ time: AnalyticsTimeRange;
176
+ reports: AnalyticsReport[];
177
+ }
138
178
 
139
179
  interface Activity {
140
180
  id: string;
@@ -706,9 +746,9 @@ declare function createAdmin(config: CreateAdminConfig): {
706
746
  };
707
747
  };
708
748
  analytics: {
709
- query: (spec: AnalyticsQuery, options?: RequestOptions$1 & {
749
+ get(request: AnalyticsRequest, options?: RequestOptions$1 & {
710
750
  store_id?: string;
711
- }) => Promise<AnalyticsQueryResponse>;
751
+ }): Promise<AnalyticsResponse>;
712
752
  };
713
753
  setStoreId: (storeId: string) => void;
714
754
  getStoreId: () => string;
@@ -993,4 +1033,4 @@ declare function createStorefront(config: CreateStorefrontConfig): {
993
1033
  };
994
1034
  };
995
1035
 
996
- export { type AnalyticsQueryResponse as $, type AuthStateListener as A, type CartControllerListener as B, type CreateStorefrontConfig as C, type CartControllerQuoteParams as D, type CartControllerRefreshParams as E, type CartControllerRemoveItemParams as F, type CartControllerState as G, type CartControllerUpdateParams as H, type IdentifyResponse as I, type HttpClientConfig as J, type AuthStorage as K, SUPPORTED_FRAMEWORKS as L, type ApiConfig as M, type AdminSessionInternal as N, type CustomerSessionInternal as O, type AdminSession as P, type AdminSessionUpdater as Q, type CustomerSessionUpdater as R, SDK_VERSION as S, type TrackParams as T, type CreateAdminConfig as U, type VerifyResponse as V, createAdmin as W, type LocationState as X, type LocationCountry as Y, type GetCountriesResponse as Z, type AnalyticsQuery as _, type CustomerSession as a, type AnalyticsRow as a0, type Measure as a1, type Dimension as a2, type Filter as a3, type FilterField as a4, type FilterOp as a5, type Granularity as a6, type EntityKind as a7, type TimeRange as a8, type TimeUnit as a9, type OrderBy as aa, type TimelineParams as ab, type IntegrationOperation as ac, type IntegrationResource as ad, type IntegrationService as ae, type CustomerToken as b, type CartController as c, findTimeZone as d, extractBlockValues as e, formatBlockValue as f, getBlockLabel as g, humanize as h, categorify as i, formatDate as j, getSvgContentForAstro as k, fetchSvgContent as l, injectSvgIntoElement as m, type Activity$1 as n, COMMON_ACTIVITY_TYPES as o, prepareBlocksForSubmission as p, createStorefront as q, createCartController as r, slugify as s, type CommonActivityType as t, type CartApi as u, validatePhoneNumber as v, type CartControllerAddItemParams as w, type CartControllerCheckoutParams as x, type CartControllerClearParams as y, type CartControllerInitParams as z };
1036
+ export { type AnalyticsReportKey as $, type AuthStateListener as A, type CartControllerListener as B, type CreateStorefrontConfig as C, type CartControllerQuoteParams as D, type CartControllerRefreshParams as E, type CartControllerRemoveItemParams as F, type CartControllerState as G, type CartControllerUpdateParams as H, type IdentifyResponse as I, type HttpClientConfig as J, type AuthStorage as K, SUPPORTED_FRAMEWORKS as L, type ApiConfig as M, type AdminSessionInternal as N, type CustomerSessionInternal as O, type AdminSession as P, type AdminSessionUpdater as Q, type CustomerSessionUpdater as R, SDK_VERSION as S, type TrackParams as T, type CreateAdminConfig as U, type VerifyResponse as V, createAdmin as W, type LocationState as X, type LocationCountry as Y, type GetCountriesResponse as Z, type AnalyticsTimeRange as _, type CustomerSession as a, type AnalyticsReportRequest as a0, type AnalyticsRequest as a1, type AnalyticsMetricData as a2, type AnalyticsBreakdownItem as a3, type AnalyticsBreakdownData as a4, type AnalyticsReport as a5, type AnalyticsResponse as a6, type ActivityFeedCategory as a7, type ActivityFeedItem as a8, type ActivityFeedSummary as a9, type ActivityFeedCursor as aa, type ActivityFeedData as ab, type TimelineParams as ac, type IntegrationOperation as ad, type IntegrationResource as ae, type IntegrationService as af, type CustomerToken as b, type CartController as c, findTimeZone as d, extractBlockValues as e, formatBlockValue as f, getBlockLabel as g, humanize as h, categorify as i, formatDate as j, getSvgContentForAstro as k, fetchSvgContent as l, injectSvgIntoElement as m, type Activity$1 as n, COMMON_ACTIVITY_TYPES as o, prepareBlocksForSubmission as p, createStorefront as q, createCartController as r, slugify as s, type CommonActivityType as t, type CartApi as u, validatePhoneNumber as v, type CartControllerAddItemParams as w, type CartControllerCheckoutParams as x, type CartControllerClearParams as y, type CartControllerInitParams as z };
@@ -81,60 +81,100 @@ interface TrackParams {
81
81
  declare const COMMON_ACTIVITY_TYPES: readonly ["page_view", "product_view", "service_view", "provider_view", "cart_added", "cart_removed", "checkout_started", "purchase", "order_created", "signin", "signup", "verified_email", "search", "share", "wishlist_added"];
82
82
  type CommonActivityType = (typeof COMMON_ACTIVITY_TYPES)[number];
83
83
 
84
- type EntityKind = "product" | "service" | "provider" | "node" | "customer" | "audience" | "agent" | "workflow" | "promo_code" | "email_template" | "form" | "taxonomy" | "media" | "order";
85
- type Granularity = "hour" | "day" | "week" | "month" | {
86
- minutes: 5 | 10 | 15 | 30;
87
- };
88
- type Measure = "count" | "uniq_customers" | "orders_created" | "new_customers" | "form_submissions" | {
89
- entity_state: {
90
- entity: EntityKind;
91
- status: string;
92
- };
93
- };
94
- type Dimension = "country_code" | "city" | "device_type" | "browser" | "os" | "language" | "activity_type" | "entity" | "entity_status" | {
95
- time_bucket: {
96
- granularity: Granularity;
97
- };
98
- };
99
- type FilterField = "type" | "country_code" | "device_type" | "browser" | "os" | "language" | "entity" | "action" | "customer_id";
100
- type FilterOp = "eq" | "neq" | "in" | "not_in" | "contains";
101
- interface Filter {
102
- field: FilterField;
103
- op: FilterOp;
104
- values: string[];
105
- }
106
- type TimeUnit = "hour" | "day" | "week" | "month";
107
- type TimeRange = {
108
- from: number;
109
- unit: TimeUnit;
110
- to?: number;
111
- } | {
84
+ interface AnalyticsTimeRange {
112
85
  from: number;
113
86
  to: number;
114
- };
115
- interface OrderBy {
116
- field: string;
117
- dir: "asc" | "desc";
118
- }
119
- interface AnalyticsQuery {
120
- measures: Measure[];
121
- dimensions?: Dimension[];
122
- filters?: Filter[];
123
- time_range: TimeRange;
124
- granularity?: Granularity;
125
- order_by?: OrderBy[];
87
+ }
88
+ type AnalyticsReportKey = "orders_created" | "customers_created" | "form_submissions_created" | "carts_abandoned" | "media_count" | "products_by_status" | "services_by_status" | "providers_by_status" | "nodes_by_status" | "customers_by_status" | "audiences_by_status" | "agents_by_status" | "workflows_by_status" | "promo_codes_by_status" | "email_templates_by_status" | "forms_by_status" | "taxonomies_by_status" | "carts_by_status" | "orders_by_status" | "order_items_by_status" | "activity_by_country" | "recent_activity";
89
+ type ActivityFeedCategory = "orders" | "carts" | "promo_codes" | "submissions" | "customers" | "audiences" | "products" | "services" | "providers" | "cms" | "workflows" | "agents" | "activities";
90
+ interface AnalyticsReportRequest {
91
+ key: AnalyticsReportKey;
126
92
  limit?: number;
93
+ category?: ActivityFeedCategory;
94
+ cursor_created_at?: number;
95
+ cursor_id?: string;
96
+ }
97
+ interface AnalyticsRequest {
98
+ time: AnalyticsTimeRange;
99
+ reports: AnalyticsReportRequest[];
100
+ }
101
+ interface AnalyticsMetricData {
102
+ value: number;
103
+ execution_ms?: number;
104
+ }
105
+ interface AnalyticsBreakdownItem {
106
+ key: string;
107
+ label: string;
108
+ value: number;
109
+ unique_customers?: number;
127
110
  }
128
- interface AnalyticsRow {
129
- [key: string]: string | number | null;
111
+ interface AnalyticsBreakdownData {
112
+ items: AnalyticsBreakdownItem[];
130
113
  }
131
- interface AnalyticsQueryResponse {
132
- rows: AnalyticsRow[];
114
+ interface ActivityFeedItem {
115
+ id: string;
116
+ entity: string;
117
+ entity_id: string;
118
+ action: string;
119
+ event_type: string;
120
+ status: string;
121
+ customer_id: string;
122
+ category: string;
123
+ title: string;
124
+ description: string;
125
+ href?: string | null;
126
+ data: unknown;
127
+ payload: unknown;
128
+ created_at: number;
129
+ }
130
+ interface ActivityFeedSummary {
131
+ total: number;
132
+ orders: number;
133
+ submissions: number;
134
+ customers: number;
135
+ audiences: number;
136
+ abandoned_carts: number;
137
+ carts: number;
138
+ promo_codes: number;
139
+ products: number;
140
+ services: number;
141
+ providers: number;
142
+ cms: number;
143
+ workflows: number;
144
+ agents: number;
145
+ activities: number;
146
+ window_start: number;
147
+ }
148
+ interface ActivityFeedCursor {
149
+ created_at: number;
150
+ id: string;
151
+ }
152
+ interface ActivityFeedData {
153
+ items: ActivityFeedItem[];
154
+ summary: ActivityFeedSummary;
155
+ next_cursor?: ActivityFeedCursor | null;
133
156
  meta: {
134
157
  row_count: number;
135
158
  execution_ms: number;
136
159
  };
137
160
  }
161
+ type AnalyticsReport = {
162
+ key: AnalyticsReportKey;
163
+ type: "metric";
164
+ data: AnalyticsMetricData;
165
+ } | {
166
+ key: AnalyticsReportKey;
167
+ type: "breakdown";
168
+ data: AnalyticsBreakdownData;
169
+ } | {
170
+ key: AnalyticsReportKey;
171
+ type: "activity";
172
+ data: ActivityFeedData;
173
+ };
174
+ interface AnalyticsResponse {
175
+ time: AnalyticsTimeRange;
176
+ reports: AnalyticsReport[];
177
+ }
138
178
 
139
179
  interface Activity {
140
180
  id: string;
@@ -706,9 +746,9 @@ declare function createAdmin(config: CreateAdminConfig): {
706
746
  };
707
747
  };
708
748
  analytics: {
709
- query: (spec: AnalyticsQuery, options?: RequestOptions$1 & {
749
+ get(request: AnalyticsRequest, options?: RequestOptions$1 & {
710
750
  store_id?: string;
711
- }) => Promise<AnalyticsQueryResponse>;
751
+ }): Promise<AnalyticsResponse>;
712
752
  };
713
753
  setStoreId: (storeId: string) => void;
714
754
  getStoreId: () => string;
@@ -993,4 +1033,4 @@ declare function createStorefront(config: CreateStorefrontConfig): {
993
1033
  };
994
1034
  };
995
1035
 
996
- export { type AnalyticsQueryResponse as $, type AuthStateListener as A, type CartControllerListener as B, type CreateStorefrontConfig as C, type CartControllerQuoteParams as D, type CartControllerRefreshParams as E, type CartControllerRemoveItemParams as F, type CartControllerState as G, type CartControllerUpdateParams as H, type IdentifyResponse as I, type HttpClientConfig as J, type AuthStorage as K, SUPPORTED_FRAMEWORKS as L, type ApiConfig as M, type AdminSessionInternal as N, type CustomerSessionInternal as O, type AdminSession as P, type AdminSessionUpdater as Q, type CustomerSessionUpdater as R, SDK_VERSION as S, type TrackParams as T, type CreateAdminConfig as U, type VerifyResponse as V, createAdmin as W, type LocationState as X, type LocationCountry as Y, type GetCountriesResponse as Z, type AnalyticsQuery as _, type CustomerSession as a, type AnalyticsRow as a0, type Measure as a1, type Dimension as a2, type Filter as a3, type FilterField as a4, type FilterOp as a5, type Granularity as a6, type EntityKind as a7, type TimeRange as a8, type TimeUnit as a9, type OrderBy as aa, type TimelineParams as ab, type IntegrationOperation as ac, type IntegrationResource as ad, type IntegrationService as ae, type CustomerToken as b, type CartController as c, findTimeZone as d, extractBlockValues as e, formatBlockValue as f, getBlockLabel as g, humanize as h, categorify as i, formatDate as j, getSvgContentForAstro as k, fetchSvgContent as l, injectSvgIntoElement as m, type Activity$1 as n, COMMON_ACTIVITY_TYPES as o, prepareBlocksForSubmission as p, createStorefront as q, createCartController as r, slugify as s, type CommonActivityType as t, type CartApi as u, validatePhoneNumber as v, type CartControllerAddItemParams as w, type CartControllerCheckoutParams as x, type CartControllerClearParams as y, type CartControllerInitParams as z };
1036
+ export { type AnalyticsReportKey as $, type AuthStateListener as A, type CartControllerListener as B, type CreateStorefrontConfig as C, type CartControllerQuoteParams as D, type CartControllerRefreshParams as E, type CartControllerRemoveItemParams as F, type CartControllerState as G, type CartControllerUpdateParams as H, type IdentifyResponse as I, type HttpClientConfig as J, type AuthStorage as K, SUPPORTED_FRAMEWORKS as L, type ApiConfig as M, type AdminSessionInternal as N, type CustomerSessionInternal as O, type AdminSession as P, type AdminSessionUpdater as Q, type CustomerSessionUpdater as R, SDK_VERSION as S, type TrackParams as T, type CreateAdminConfig as U, type VerifyResponse as V, createAdmin as W, type LocationState as X, type LocationCountry as Y, type GetCountriesResponse as Z, type AnalyticsTimeRange as _, type CustomerSession as a, type AnalyticsReportRequest as a0, type AnalyticsRequest as a1, type AnalyticsMetricData as a2, type AnalyticsBreakdownItem as a3, type AnalyticsBreakdownData as a4, type AnalyticsReport as a5, type AnalyticsResponse as a6, type ActivityFeedCategory as a7, type ActivityFeedItem as a8, type ActivityFeedSummary as a9, type ActivityFeedCursor as aa, type ActivityFeedData as ab, type TimelineParams as ac, type IntegrationOperation as ad, type IntegrationResource as ae, type IntegrationService as af, type CustomerToken as b, type CartController as c, findTimeZone as d, extractBlockValues as e, formatBlockValue as f, getBlockLabel as g, humanize as h, categorify as i, formatDate as j, getSvgContentForAstro as k, fetchSvgContent as l, injectSvgIntoElement as m, type Activity$1 as n, COMMON_ACTIVITY_TYPES as o, prepareBlocksForSubmission as p, createStorefront as q, createCartController as r, slugify as s, type CommonActivityType as t, type CartApi as u, validatePhoneNumber as v, type CartControllerAddItemParams as w, type CartControllerCheckoutParams as x, type CartControllerClearParams as y, type CartControllerInitParams as z };
package/dist/admin.cjs CHANGED
@@ -1884,11 +1884,11 @@ var createTaxonomyApi = (apiConfig) => {
1884
1884
  // src/api/analytics.ts
1885
1885
  var createAnalyticsApi = (apiConfig) => {
1886
1886
  return {
1887
- async query(spec, options) {
1887
+ async get(request, options) {
1888
1888
  const store_id = options?.store_id || apiConfig.storeId;
1889
1889
  return apiConfig.httpClient.post(
1890
- `/v1/stores/${store_id}/analytics/query`,
1891
- spec,
1890
+ `/v1/stores/${store_id}/analytics`,
1891
+ request,
1892
1892
  options
1893
1893
  );
1894
1894
  }
@@ -2427,9 +2427,7 @@ function createAdmin(config) {
2427
2427
  getExecution: workflowApi.getWorkflowExecution
2428
2428
  }
2429
2429
  },
2430
- analytics: {
2431
- query: analyticsApi.query
2432
- },
2430
+ analytics: analyticsApi,
2433
2431
  setStoreId: (storeId) => {
2434
2432
  apiConfig.storeId = storeId;
2435
2433
  },