arky-sdk 0.7.78 → 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;
46
80
  }
47
- interface StatusBreakdown {
48
- status: string;
49
- count: number;
81
+ interface AnalyticsRow {
82
+ [key: string]: string | number | null;
83
+ }
84
+ interface AnalyticsQueryResponse {
85
+ rows: AnalyticsRow[];
86
+ meta: {
87
+ rowCount: number;
88
+ executionMs: number;
89
+ };
50
90
  }
51
91
 
52
92
  interface Activity {
@@ -71,28 +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
- interface CountryBreakdownItem {
88
- countryCode: string;
89
- eventCount: number;
90
- distinctCustomers: number;
91
- }
92
- interface CountryBreakdownParams {
93
- businessId?: string;
94
- windowSeconds?: number;
95
- }
96
114
 
97
115
  interface LocationState {
98
116
  code: string;
@@ -146,7 +164,7 @@ declare global {
146
164
  }
147
165
  declare function track(eventName: string, params?: Record<string, any>): void;
148
166
 
149
- declare const SDK_VERSION = "0.7.74";
167
+ declare const SDK_VERSION = "0.7.80";
150
168
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
151
169
  interface ApiConfig {
152
170
  httpClient: any;
@@ -381,20 +399,6 @@ declare function createAdmin(config: HttpClientConfig & {
381
399
  items: Activity[];
382
400
  cursor: string | null;
383
401
  }>;
384
- count(params: CountParams, options?: RequestOptions): Promise<{
385
- total: number;
386
- distinctCustomers: number;
387
- }>;
388
- types(params?: {
389
- businessId?: string;
390
- }, options?: RequestOptions): Promise<{
391
- items: ActivityTypeInfo[];
392
- uniqueCount: number;
393
- }>;
394
- countryBreakdown(params?: CountryBreakdownParams, options?: RequestOptions): Promise<{
395
- items: CountryBreakdownItem[];
396
- unknownCount: number;
397
- }>;
398
402
  };
399
403
  };
400
404
  automation: {
@@ -427,12 +431,9 @@ declare function createAdmin(config: HttpClientConfig & {
427
431
  };
428
432
  analytics: {
429
433
  track: typeof track;
430
- getSummary: (params?: {
431
- period?: string;
432
- }, options?: RequestOptions) => Promise<AnalyticsSummary>;
433
- getStatusBreakdown: (params: {
434
- entity: string;
435
- }, options?: RequestOptions) => Promise<StatusBreakdown[]>;
434
+ query: (spec: AnalyticsQuery, options?: RequestOptions & {
435
+ businessId?: string;
436
+ }) => Promise<AnalyticsQueryResponse>;
436
437
  };
437
438
  setBusinessId: (businessId: string) => void;
438
439
  getBusinessId: () => string;
@@ -689,4 +690,4 @@ declare function createStorefront(config: HttpClientConfig & {
689
690
  };
690
691
  }>;
691
692
 
692
- 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;
46
80
  }
47
- interface StatusBreakdown {
48
- status: string;
49
- count: number;
81
+ interface AnalyticsRow {
82
+ [key: string]: string | number | null;
83
+ }
84
+ interface AnalyticsQueryResponse {
85
+ rows: AnalyticsRow[];
86
+ meta: {
87
+ rowCount: number;
88
+ executionMs: number;
89
+ };
50
90
  }
51
91
 
52
92
  interface Activity {
@@ -71,28 +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
- interface CountryBreakdownItem {
88
- countryCode: string;
89
- eventCount: number;
90
- distinctCustomers: number;
91
- }
92
- interface CountryBreakdownParams {
93
- businessId?: string;
94
- windowSeconds?: number;
95
- }
96
114
 
97
115
  interface LocationState {
98
116
  code: string;
@@ -146,7 +164,7 @@ declare global {
146
164
  }
147
165
  declare function track(eventName: string, params?: Record<string, any>): void;
148
166
 
149
- declare const SDK_VERSION = "0.7.74";
167
+ declare const SDK_VERSION = "0.7.80";
150
168
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
151
169
  interface ApiConfig {
152
170
  httpClient: any;
@@ -381,20 +399,6 @@ declare function createAdmin(config: HttpClientConfig & {
381
399
  items: Activity[];
382
400
  cursor: string | null;
383
401
  }>;
384
- count(params: CountParams, options?: RequestOptions): Promise<{
385
- total: number;
386
- distinctCustomers: number;
387
- }>;
388
- types(params?: {
389
- businessId?: string;
390
- }, options?: RequestOptions): Promise<{
391
- items: ActivityTypeInfo[];
392
- uniqueCount: number;
393
- }>;
394
- countryBreakdown(params?: CountryBreakdownParams, options?: RequestOptions): Promise<{
395
- items: CountryBreakdownItem[];
396
- unknownCount: number;
397
- }>;
398
402
  };
399
403
  };
400
404
  automation: {
@@ -427,12 +431,9 @@ declare function createAdmin(config: HttpClientConfig & {
427
431
  };
428
432
  analytics: {
429
433
  track: typeof track;
430
- getSummary: (params?: {
431
- period?: string;
432
- }, options?: RequestOptions) => Promise<AnalyticsSummary>;
433
- getStatusBreakdown: (params: {
434
- entity: string;
435
- }, options?: RequestOptions) => Promise<StatusBreakdown[]>;
434
+ query: (spec: AnalyticsQuery, options?: RequestOptions & {
435
+ businessId?: string;
436
+ }) => Promise<AnalyticsQueryResponse>;
436
437
  };
437
438
  setBusinessId: (businessId: string) => void;
438
439
  getBusinessId: () => string;
@@ -689,4 +690,4 @@ declare function createStorefront(config: HttpClientConfig & {
689
690
  };
690
691
  }>;
691
692
 
692
- 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,34 +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
- },
1805
- async countryBreakdown(params, options) {
1806
- const businessId = params?.businessId || apiConfig.businessId;
1807
- const queryParams = {};
1808
- if (params?.windowSeconds !== void 0) queryParams.windowSeconds = params.windowSeconds;
1809
- return apiConfig.httpClient.get(
1810
- `/v1/businesses/${businessId}/activities/country-breakdown`,
1811
- { ...options, params: queryParams }
1812
- );
1813
1785
  }
1814
1786
  });
1815
1787
  var createCustomerApi = (apiConfig) => {
@@ -2357,22 +2329,12 @@ var createTaxonomyApi = (apiConfig) => {
2357
2329
  // src/api/analytics.ts
2358
2330
  var createAnalyticsApi = (apiConfig) => {
2359
2331
  return {
2360
- async getSummary(params, options) {
2361
- return apiConfig.httpClient.get(
2362
- `/v1/businesses/${apiConfig.businessId}/analytics/summary`,
2363
- {
2364
- ...options,
2365
- params: params || {}
2366
- }
2367
- );
2368
- },
2369
- async getStatusBreakdown(params, options) {
2370
- return apiConfig.httpClient.get(
2371
- `/v1/businesses/${apiConfig.businessId}/analytics/status`,
2372
- {
2373
- ...options,
2374
- params
2375
- }
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
2376
2338
  );
2377
2339
  }
2378
2340
  };
@@ -2648,7 +2610,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
2648
2610
  }
2649
2611
 
2650
2612
  // src/index.ts
2651
- var SDK_VERSION = "0.7.74";
2613
+ var SDK_VERSION = "0.7.80";
2652
2614
  var SUPPORTED_FRAMEWORKS = [
2653
2615
  "astro",
2654
2616
  "react",
@@ -2886,8 +2848,7 @@ async function createAdmin(config) {
2886
2848
  },
2887
2849
  analytics: {
2888
2850
  track,
2889
- getSummary: analyticsApi.getSummary,
2890
- getStatusBreakdown: analyticsApi.getStatusBreakdown
2851
+ query: analyticsApi.query
2891
2852
  },
2892
2853
  setBusinessId: (businessId) => {
2893
2854
  apiConfig.businessId = businessId;