arky-sdk 0.7.77 → 0.7.80

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/index.d.cts CHANGED
@@ -34,19 +34,59 @@ interface HttpClientConfig {
34
34
  isAuthenticated?: () => boolean;
35
35
  }
36
36
 
37
- interface AnalyticsSummary {
38
- orders: number;
39
- ordersChange: number;
40
- bookings: number;
41
- bookingsChange: number;
42
- newCustomers: number;
43
- newCustomersChange: number;
44
- formSubmissions: number;
45
- formSubmissionsChange: number;
37
+ type EntityKind = "product" | "service" | "provider" | "node" | "customer" | "audience" | "agent" | "workflow" | "promoCode" | "emailTemplate" | "form" | "taxonomy" | "media" | "order" | "booking";
38
+ type Granularity = "hour" | "day" | "week" | "month" | {
39
+ minutes: 5 | 10 | 15 | 30;
40
+ };
41
+ type Measure = "count" | "uniqCustomers" | "ordersCreated" | "bookingsCreated" | "newCustomers" | "formSubmissions" | {
42
+ entityState: {
43
+ entity: EntityKind;
44
+ status: string;
45
+ };
46
+ };
47
+ type Dimension = "countryCode" | "city" | "deviceType" | "browser" | "os" | "language" | "activityType" | "entity" | "entityStatus" | {
48
+ timeBucket: {
49
+ granularity: Granularity;
50
+ };
51
+ };
52
+ type FilterField = "type" | "countryCode" | "deviceType" | "browser" | "os" | "language" | "entity" | "action" | "customerId";
53
+ type FilterOp = "eq" | "neq" | "in" | "notIn" | "contains";
54
+ interface Filter {
55
+ field: FilterField;
56
+ op: FilterOp;
57
+ values: string[];
58
+ }
59
+ type TimeUnit = "hour" | "day" | "week" | "month";
60
+ type TimeRange = {
61
+ from: number;
62
+ unit: TimeUnit;
63
+ to?: number;
64
+ } | {
65
+ from: number;
66
+ to: number;
67
+ };
68
+ interface OrderBy {
69
+ field: string;
70
+ dir: "asc" | "desc";
71
+ }
72
+ interface AnalyticsQuery {
73
+ measures: Measure[];
74
+ dimensions?: Dimension[];
75
+ filters?: Filter[];
76
+ timeRange: TimeRange;
77
+ granularity?: Granularity;
78
+ orderBy?: OrderBy[];
79
+ limit?: number;
80
+ }
81
+ interface AnalyticsRow {
82
+ [key: string]: string | number | null;
46
83
  }
47
- interface StatusBreakdown {
48
- status: string;
49
- count: number;
84
+ interface AnalyticsQueryResponse {
85
+ rows: AnalyticsRow[];
86
+ meta: {
87
+ rowCount: number;
88
+ executionMs: number;
89
+ };
50
90
  }
51
91
 
52
92
  interface Activity {
@@ -71,19 +111,6 @@ interface TimelineParams {
71
111
  limit?: number;
72
112
  cursor?: string;
73
113
  }
74
- interface CountParams {
75
- businessId?: string;
76
- type?: string;
77
- payloadKey?: string;
78
- payloadValue?: string;
79
- windowSeconds?: number;
80
- }
81
- interface ActivityTypeInfo {
82
- type: string;
83
- eventCount: number;
84
- firstSeenAt: number;
85
- lastSeenAt: number;
86
- }
87
114
 
88
115
  interface LocationState {
89
116
  code: string;
@@ -137,7 +164,7 @@ declare global {
137
164
  }
138
165
  declare function track(eventName: string, params?: Record<string, any>): void;
139
166
 
140
- declare const SDK_VERSION = "0.7.74";
167
+ declare const SDK_VERSION = "0.7.80";
141
168
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
142
169
  interface ApiConfig {
143
170
  httpClient: any;
@@ -372,16 +399,6 @@ declare function createAdmin(config: HttpClientConfig & {
372
399
  items: Activity[];
373
400
  cursor: string | null;
374
401
  }>;
375
- count(params: CountParams, options?: RequestOptions): Promise<{
376
- total: number;
377
- distinctCustomers: number;
378
- }>;
379
- types(params?: {
380
- businessId?: string;
381
- }, options?: RequestOptions): Promise<{
382
- items: ActivityTypeInfo[];
383
- uniqueCount: number;
384
- }>;
385
402
  };
386
403
  };
387
404
  automation: {
@@ -414,12 +431,9 @@ declare function createAdmin(config: HttpClientConfig & {
414
431
  };
415
432
  analytics: {
416
433
  track: typeof track;
417
- getSummary: (params?: {
418
- period?: string;
419
- }, options?: RequestOptions) => Promise<AnalyticsSummary>;
420
- getStatusBreakdown: (params: {
421
- entity: string;
422
- }, options?: RequestOptions) => Promise<StatusBreakdown[]>;
434
+ query: (spec: AnalyticsQuery, options?: RequestOptions & {
435
+ businessId?: string;
436
+ }) => Promise<AnalyticsQueryResponse>;
423
437
  };
424
438
  setBusinessId: (businessId: string) => void;
425
439
  getBusinessId: () => string;
@@ -676,4 +690,4 @@ declare function createStorefront(config: HttpClientConfig & {
676
690
  };
677
691
  }>;
678
692
 
679
- export { type Activity$1 as Activity, type ActivityTypeInfo, type AnalyticsSummary, type ApiConfig, AvailabilityResponse, COMMON_ACTIVITY_TYPES, type CommonActivityType, type CountParams, CreateAgentParams, CreateLocationParams, DeleteLocationParams, GetAgentParams, GetAgentsParams, GetAvailabilityParams, type GetCountriesResponse, GetShippingRatesParams, type HttpClientConfig, Location, type LocationCountry, type LocationState, Market, SDK_VERSION, SUPPORTED_FRAMEWORKS, ShipParams, ShipResult, ShippingRate, Slot, type StatusBreakdown, type TimelineParams, type TrackParams, UpdateAgentParams, UpdateLocationParams, createAdmin, createStorefront };
693
+ export { type Activity$1 as Activity, type AnalyticsQuery, type AnalyticsQueryResponse, type AnalyticsRow, type ApiConfig, AvailabilityResponse, COMMON_ACTIVITY_TYPES, type CommonActivityType, CreateAgentParams, CreateLocationParams, DeleteLocationParams, type Dimension, type EntityKind, type Filter, type FilterField, type FilterOp, GetAgentParams, GetAgentsParams, GetAvailabilityParams, type GetCountriesResponse, GetShippingRatesParams, type Granularity, type HttpClientConfig, Location, type LocationCountry, type LocationState, Market, type Measure, type OrderBy, SDK_VERSION, SUPPORTED_FRAMEWORKS, ShipParams, ShipResult, ShippingRate, Slot, type TimeRange, type TimeUnit, type TimelineParams, type TrackParams, UpdateAgentParams, UpdateLocationParams, createAdmin, createStorefront };
package/dist/index.d.ts CHANGED
@@ -34,19 +34,59 @@ interface HttpClientConfig {
34
34
  isAuthenticated?: () => boolean;
35
35
  }
36
36
 
37
- interface AnalyticsSummary {
38
- orders: number;
39
- ordersChange: number;
40
- bookings: number;
41
- bookingsChange: number;
42
- newCustomers: number;
43
- newCustomersChange: number;
44
- formSubmissions: number;
45
- formSubmissionsChange: number;
37
+ type EntityKind = "product" | "service" | "provider" | "node" | "customer" | "audience" | "agent" | "workflow" | "promoCode" | "emailTemplate" | "form" | "taxonomy" | "media" | "order" | "booking";
38
+ type Granularity = "hour" | "day" | "week" | "month" | {
39
+ minutes: 5 | 10 | 15 | 30;
40
+ };
41
+ type Measure = "count" | "uniqCustomers" | "ordersCreated" | "bookingsCreated" | "newCustomers" | "formSubmissions" | {
42
+ entityState: {
43
+ entity: EntityKind;
44
+ status: string;
45
+ };
46
+ };
47
+ type Dimension = "countryCode" | "city" | "deviceType" | "browser" | "os" | "language" | "activityType" | "entity" | "entityStatus" | {
48
+ timeBucket: {
49
+ granularity: Granularity;
50
+ };
51
+ };
52
+ type FilterField = "type" | "countryCode" | "deviceType" | "browser" | "os" | "language" | "entity" | "action" | "customerId";
53
+ type FilterOp = "eq" | "neq" | "in" | "notIn" | "contains";
54
+ interface Filter {
55
+ field: FilterField;
56
+ op: FilterOp;
57
+ values: string[];
58
+ }
59
+ type TimeUnit = "hour" | "day" | "week" | "month";
60
+ type TimeRange = {
61
+ from: number;
62
+ unit: TimeUnit;
63
+ to?: number;
64
+ } | {
65
+ from: number;
66
+ to: number;
67
+ };
68
+ interface OrderBy {
69
+ field: string;
70
+ dir: "asc" | "desc";
71
+ }
72
+ interface AnalyticsQuery {
73
+ measures: Measure[];
74
+ dimensions?: Dimension[];
75
+ filters?: Filter[];
76
+ timeRange: TimeRange;
77
+ granularity?: Granularity;
78
+ orderBy?: OrderBy[];
79
+ limit?: number;
80
+ }
81
+ interface AnalyticsRow {
82
+ [key: string]: string | number | null;
46
83
  }
47
- interface StatusBreakdown {
48
- status: string;
49
- count: number;
84
+ interface AnalyticsQueryResponse {
85
+ rows: AnalyticsRow[];
86
+ meta: {
87
+ rowCount: number;
88
+ executionMs: number;
89
+ };
50
90
  }
51
91
 
52
92
  interface Activity {
@@ -71,19 +111,6 @@ interface TimelineParams {
71
111
  limit?: number;
72
112
  cursor?: string;
73
113
  }
74
- interface CountParams {
75
- businessId?: string;
76
- type?: string;
77
- payloadKey?: string;
78
- payloadValue?: string;
79
- windowSeconds?: number;
80
- }
81
- interface ActivityTypeInfo {
82
- type: string;
83
- eventCount: number;
84
- firstSeenAt: number;
85
- lastSeenAt: number;
86
- }
87
114
 
88
115
  interface LocationState {
89
116
  code: string;
@@ -137,7 +164,7 @@ declare global {
137
164
  }
138
165
  declare function track(eventName: string, params?: Record<string, any>): void;
139
166
 
140
- declare const SDK_VERSION = "0.7.74";
167
+ declare const SDK_VERSION = "0.7.80";
141
168
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
142
169
  interface ApiConfig {
143
170
  httpClient: any;
@@ -372,16 +399,6 @@ declare function createAdmin(config: HttpClientConfig & {
372
399
  items: Activity[];
373
400
  cursor: string | null;
374
401
  }>;
375
- count(params: CountParams, options?: RequestOptions): Promise<{
376
- total: number;
377
- distinctCustomers: number;
378
- }>;
379
- types(params?: {
380
- businessId?: string;
381
- }, options?: RequestOptions): Promise<{
382
- items: ActivityTypeInfo[];
383
- uniqueCount: number;
384
- }>;
385
402
  };
386
403
  };
387
404
  automation: {
@@ -414,12 +431,9 @@ declare function createAdmin(config: HttpClientConfig & {
414
431
  };
415
432
  analytics: {
416
433
  track: typeof track;
417
- getSummary: (params?: {
418
- period?: string;
419
- }, options?: RequestOptions) => Promise<AnalyticsSummary>;
420
- getStatusBreakdown: (params: {
421
- entity: string;
422
- }, options?: RequestOptions) => Promise<StatusBreakdown[]>;
434
+ query: (spec: AnalyticsQuery, options?: RequestOptions & {
435
+ businessId?: string;
436
+ }) => Promise<AnalyticsQueryResponse>;
423
437
  };
424
438
  setBusinessId: (businessId: string) => void;
425
439
  getBusinessId: () => string;
@@ -676,4 +690,4 @@ declare function createStorefront(config: HttpClientConfig & {
676
690
  };
677
691
  }>;
678
692
 
679
- export { type Activity$1 as Activity, type ActivityTypeInfo, type AnalyticsSummary, type ApiConfig, AvailabilityResponse, COMMON_ACTIVITY_TYPES, type CommonActivityType, type CountParams, CreateAgentParams, CreateLocationParams, DeleteLocationParams, GetAgentParams, GetAgentsParams, GetAvailabilityParams, type GetCountriesResponse, GetShippingRatesParams, type HttpClientConfig, Location, type LocationCountry, type LocationState, Market, SDK_VERSION, SUPPORTED_FRAMEWORKS, ShipParams, ShipResult, ShippingRate, Slot, type StatusBreakdown, type TimelineParams, type TrackParams, UpdateAgentParams, UpdateLocationParams, createAdmin, createStorefront };
693
+ export { type Activity$1 as Activity, type AnalyticsQuery, type AnalyticsQueryResponse, type AnalyticsRow, type ApiConfig, AvailabilityResponse, COMMON_ACTIVITY_TYPES, type CommonActivityType, CreateAgentParams, CreateLocationParams, DeleteLocationParams, type Dimension, type EntityKind, type Filter, type FilterField, type FilterOp, GetAgentParams, GetAgentsParams, GetAvailabilityParams, type GetCountriesResponse, GetShippingRatesParams, type Granularity, type HttpClientConfig, Location, type LocationCountry, type LocationState, Market, type Measure, type OrderBy, SDK_VERSION, SUPPORTED_FRAMEWORKS, ShipParams, ShipResult, ShippingRate, Slot, type TimeRange, type TimeUnit, type TimelineParams, type TrackParams, UpdateAgentParams, UpdateLocationParams, createAdmin, createStorefront };
package/dist/index.js CHANGED
@@ -1782,25 +1782,6 @@ var createActivityAdminApi = (apiConfig) => ({
1782
1782
  `/v1/businesses/${businessId}/activities/timeline`,
1783
1783
  { ...options, params: queryParams }
1784
1784
  );
1785
- },
1786
- async count(params, options) {
1787
- const businessId = params.businessId || apiConfig.businessId;
1788
- const queryParams = {};
1789
- if (params.type) queryParams.type = params.type;
1790
- if (params.payloadKey) queryParams.payloadKey = params.payloadKey;
1791
- if (params.payloadValue) queryParams.payloadValue = params.payloadValue;
1792
- if (params.windowSeconds !== void 0) queryParams.windowSeconds = params.windowSeconds;
1793
- return apiConfig.httpClient.get(
1794
- `/v1/businesses/${businessId}/activities/count`,
1795
- { ...options, params: queryParams }
1796
- );
1797
- },
1798
- async types(params, options) {
1799
- const businessId = params?.businessId || apiConfig.businessId;
1800
- return apiConfig.httpClient.get(
1801
- `/v1/businesses/${businessId}/activities/types`,
1802
- options
1803
- );
1804
1785
  }
1805
1786
  });
1806
1787
  var createCustomerApi = (apiConfig) => {
@@ -2348,22 +2329,12 @@ var createTaxonomyApi = (apiConfig) => {
2348
2329
  // src/api/analytics.ts
2349
2330
  var createAnalyticsApi = (apiConfig) => {
2350
2331
  return {
2351
- async getSummary(params, options) {
2352
- return apiConfig.httpClient.get(
2353
- `/v1/businesses/${apiConfig.businessId}/analytics/summary`,
2354
- {
2355
- ...options,
2356
- params: params || {}
2357
- }
2358
- );
2359
- },
2360
- async getStatusBreakdown(params, options) {
2361
- return apiConfig.httpClient.get(
2362
- `/v1/businesses/${apiConfig.businessId}/analytics/status`,
2363
- {
2364
- ...options,
2365
- params
2366
- }
2332
+ async query(spec, options) {
2333
+ const businessId = options?.businessId || apiConfig.businessId;
2334
+ return apiConfig.httpClient.post(
2335
+ `/v1/businesses/${businessId}/analytics/query`,
2336
+ spec,
2337
+ options
2367
2338
  );
2368
2339
  }
2369
2340
  };
@@ -2639,7 +2610,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
2639
2610
  }
2640
2611
 
2641
2612
  // src/index.ts
2642
- var SDK_VERSION = "0.7.74";
2613
+ var SDK_VERSION = "0.7.80";
2643
2614
  var SUPPORTED_FRAMEWORKS = [
2644
2615
  "astro",
2645
2616
  "react",
@@ -2877,8 +2848,7 @@ async function createAdmin(config) {
2877
2848
  },
2878
2849
  analytics: {
2879
2850
  track,
2880
- getSummary: analyticsApi.getSummary,
2881
- getStatusBreakdown: analyticsApi.getStatusBreakdown
2851
+ query: analyticsApi.query
2882
2852
  },
2883
2853
  setBusinessId: (businessId) => {
2884
2854
  apiConfig.businessId = businessId;