arky-sdk 0.7.133 → 0.8.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/README.md CHANGED
@@ -42,21 +42,30 @@ const arkyStore = createArkyStore({
42
42
  storeId: 'your-store-id',
43
43
  market: 'us',
44
44
  locale: 'en',
45
+ marketForLocale: (locale) => locale === 'it' ? 'ita' : 'us',
45
46
  })
46
47
 
47
- await arkyStore.initialize({ hydrate_cart: true, load_website: true })
48
+ const { cart } = await arkyStore.setup({
49
+ locale: 'en',
50
+ hydrateCart: true,
51
+ })
52
+
53
+ const websiteNode = await arkyStore.cms.node.get({
54
+ key: 'website',
55
+ locale: 'en',
56
+ })
48
57
  ```
49
58
 
50
59
  ### 2. Browse Products
51
60
 
52
61
  ```typescript
53
62
  // List products (like on arky.io/products)
54
- const { items: products } = await arkyStore.eshop.product.find({
63
+ const { items: products } = await arkyStore.eshop.product.list({
55
64
  limit: 20
56
65
  });
57
66
 
58
67
  // Get product details (like arky.io/products/guitar)
59
- const product = await arkyStore.eshop.product.get({ id: 'prod_123' });
68
+ const product = await arkyStore.eshop.product.loadDetail({ id: 'prod_123' });
60
69
 
61
70
  // Format price (uses currency from price object)
62
71
  const formatted = arkyStore.utils.formatPrice(product.variants[0].prices); // "$29.99"
@@ -65,272 +74,143 @@ const formatted = arkyStore.utils.formatPrice(product.variants[0].prices); // "$
65
74
  ### 3. Shop & Checkout
66
75
 
67
76
  ```typescript
68
- const product = await arkyStore.eshop.product.get({ id: 'prod_123' })
77
+ const product = await arkyStore.eshop.product.loadDetail({ id: 'prod_123' })
69
78
  const variant = product.variants[0]
70
79
 
71
- await arkyStore.eshop.cart.actions.addProduct(product, variant, 2)
80
+ await arkyStore.eshop.cart.addProduct(product, variant, 2)
72
81
 
73
- const quote = await arkyStore.eshop.cart.actions.quote()
82
+ const quote = await arkyStore.eshop.cart.quote()
74
83
 
75
- const order = await arkyStore.eshop.cart.actions.checkout({
84
+ const order = await arkyStore.eshop.cart.checkout({
76
85
  payment_method_id: 'credit_card',
77
86
  })
78
87
  ```
79
88
 
80
89
  ### Framework-Agnostic Store
81
90
 
82
- The storefront store is framework-agnostic and built on Nano Stores. UI frameworks can subscribe to atoms directly, while app code calls actions:
91
+ The storefront store is framework-agnostic and built on Nano Stores. UI frameworks can subscribe to atoms directly, while app code calls direct store methods:
83
92
 
84
93
  ```typescript
94
+ await arkyStore.setup({
95
+ locale: 'en',
96
+ hydrateCart: true,
97
+ track: {
98
+ type: 'page_view',
99
+ payload: { url: location.pathname },
100
+ },
101
+ })
102
+
85
103
  const unsubscribe = arkyStore.eshop.cart.snapshot.subscribe((snapshot) => {
86
104
  console.log(snapshot.item_count, snapshot.cart?.id)
87
105
  });
88
106
 
89
- await arkyStore.eshop.cart.actions.ensure();
90
- await arkyStore.eshop.cart.actions.clear();
107
+ await arkyStore.eshop.cart.ensure();
108
+ await arkyStore.eshop.cart.clear();
91
109
 
92
110
  unsubscribe();
93
111
  ```
94
112
 
113
+ For content-heavy pages, a website node load can be a single context-aware call:
114
+
115
+ ```typescript
116
+ const website = await arkyStore.cms.node.get({ key: "website", locale: 'en' })
117
+ const info = website.blocks.find((block) => block.key === 'info')
118
+ ```
119
+
95
120
  The low-level SDK client is still available as `arkyStore.client` for unusual cases, but normal storefronts should use the store-shaped modules: `cms`, `eshop`, `crm`, `activity`, `automation`, `store`, and `utils`.
96
121
 
97
122
  ### 4. Sell Scheduled Services
98
123
 
99
124
  ```typescript
100
125
  // Browse services (like arky.io/services)
101
- const { items: services } = await arkyStore.eshop.service.find({});
126
+ const { items: services } = await arkyStore.eshop.service.list({});
102
127
  const service = services[0];
103
128
 
104
- await arkyStore.eshop.serviceOrder.actions.initialize();
105
- await arkyStore.eshop.serviceOrder.actions.setService(service);
106
- arkyStore.eshop.serviceOrder.actions.findFirstAvailable();
129
+ await arkyStore.eshop.service.initialize();
130
+ await arkyStore.eshop.service.select(service);
131
+ arkyStore.eshop.service.findFirstAvailable();
107
132
 
108
- const state = arkyStore.eshop.serviceOrder.state.get();
133
+ const state = arkyStore.eshop.service.state.get();
109
134
  if (state.slots[0]) {
110
- arkyStore.eshop.serviceOrder.actions.selectTimeSlot(state.slots[0]);
111
- arkyStore.eshop.serviceOrder.actions.nextStep();
112
- await arkyStore.eshop.serviceOrder.actions.addToCart();
135
+ arkyStore.eshop.service.selectTimeSlot(state.slots[0]);
136
+ arkyStore.eshop.service.nextStep();
137
+ await arkyStore.eshop.service.addToCart();
113
138
  }
114
139
 
115
- const order = await arkyStore.eshop.serviceOrder.actions.checkout('cash');
116
- ```
117
-
118
- ### 5. Subscribe to Newsletter
119
-
120
- ```typescript
121
- // Subscribe to updates (like arky.io/newsletters)
122
- await arky.cms.subscribeToCollection({
123
- collectionId: 'newsletter_weekly',
124
- email: 'user@example.com',
125
- planId: 'plan_free'
126
- });
127
- ```
128
-
129
- ### 6. Read Content
130
-
131
- ```typescript
132
- // Fetch blog posts or content
133
- const { items: posts } = await arky.cms.getCollectionEntries({
134
- collectionId: 'blog',
135
- limit: 10
140
+ const order = await arkyStore.eshop.cart.checkout({
141
+ payment_method_id: 'cash',
136
142
  });
137
-
138
- // Extract content from blocks
139
- const title = arky.utils.getBlockTextValue(
140
- posts[0].blocks.find(b => b.key === 'title'),
141
- 'en'
142
- );
143
- const imageUrl = arky.utils.getImageUrl(
144
- posts[0].blocks.find(b => b.key === 'featured_image')
145
- );
146
- ```
147
-
148
- ## API Methods
149
-
150
- The SDK provides the following API modules:
151
-
152
- ### User Management
153
- ```typescript
154
- // Authentication
155
- await arky.user.loginUser({ email, password })
156
- await arky.user.registerUser({ email, password, name })
157
- await arky.user.getMe()
158
- await arky.user.logout()
159
-
160
- // Profile
161
- await arky.user.updateUser({ name, phoneNumber, addresses })
162
- await arky.user.resetPassword({ oldPassword, newPassword })
163
143
  ```
164
144
 
165
- ### Store
166
- ```typescript
167
- // Store CRUD
168
- await arky.store.createStore({ name, slug })
169
- await arky.store.getStore()
170
- await arky.store.updateStore({ id, name })
171
- await arky.store.deleteStore({ id })
172
-
173
- // Subscriptions
174
- await arky.store.createSubscription({ planId })
175
- await arky.store.getSubscription()
176
- await arky.store.cancelSubscription({ immediately: true })
177
- ```
145
+ ### 5. Read Content And Submit Forms
178
146
 
179
- ### CMS & Newsletters
180
147
  ```typescript
181
- // Collections
182
- await arky.cms.createCollection({ name, slug, type: 'NEWSLETTER' })
183
- await arky.cms.getCollections({ type: 'NEWSLETTER' })
184
- await arky.cms.getCollection({ id })
185
- await arky.cms.updateCollection({ id, name })
186
- await arky.cms.deleteCollection({ id })
187
-
188
- // Entries (Content)
189
- await arky.cms.createCollectionEntry({ collectionId, blocks })
190
- await arky.cms.getCollectionEntries({ collectionId })
191
- await arky.cms.updateCollectionEntry({ id, blocks })
192
- await arky.cms.sendEntry({ entryId, scheduledAt })
193
-
194
- // Newsletter Subscriptions
195
- await arky.cms.subscribeToCollection({
196
- collectionId: 'newsletter_id',
197
- email: 'user@example.com',
198
- planId: 'plan_free', // Required
148
+ const website = await arkyStore.cms.node.get({ key: "website", locale: 'en' })
149
+ const titleBlock = website.blocks.find((block) => block.key === 'title')
150
+ const title = arkyStore.utils.getBlockTextValue(titleBlock, 'en')
151
+
152
+ await arkyStore.cms.form.submitByKey({
153
+ key: 'contact',
154
+ entries: [
155
+ { key: 'email', value: 'customer@example.com' },
156
+ { key: 'message', value: 'Hello from the storefront' },
157
+ ],
199
158
  })
200
- await arky.cms.getCollectionSubscribers({ id: 'newsletter_id' })
201
159
  ```
202
160
 
203
- ### E-shop
204
- ```typescript
205
- // Products
206
- await arkyStore.eshop.product.find({ limit: 20, cursor: null })
207
- await arkyStore.eshop.product.get({ id })
208
-
209
- // Carts and orders
210
- const cart = await arkyStore.eshop.cart.actions.ensure()
211
- await arkyStore.eshop.cart.actions.sync({ product_items, shipping_method_id })
212
- await arkyStore.eshop.cart.actions.checkout({ payment_method_id })
213
- await arkyStore.eshop.order.find({})
214
- await arkyStore.eshop.order.get({ id })
215
-
216
- // Quote
217
- await arkyStore.eshop.cart.actions.quote()
218
- ```
161
+ ## Storefront Modules
219
162
 
220
- ### Services
221
- ```typescript
222
- // Services
223
- await arky.eshop.service.create({ name, duration, price })
224
- await arky.eshop.service.find({})
225
- await arky.eshop.service.getAvailability({ service_id, provider_id, from, to })
226
-
227
- // Providers
228
- await arky.eshop.provider.create({ name })
229
- await arky.eshop.provider.find({})
230
-
231
- // Service cart checkout
232
- await arky.eshop.order.getQuote({ items, payment_method })
233
- await arky.eshop.cart.checkout({ id: cart.id, payment_method_id })
234
- await arky.eshop.order.find({})
235
- ```
163
+ The store-shaped API is the preferred surface for websites:
236
164
 
237
- ### Media
238
165
  ```typescript
239
- // Upload files
240
- const media = await arky.media.uploadStoreMedia({
241
- files: [file1, file2],
242
- urls: ['https://example.com/image.jpg'],
243
- })
166
+ await arkyStore.setup({ hydrateCart: true })
244
167
 
245
- // List media
246
- const { items } = await arky.media.getStoreMedia({ limit: 20 })
168
+ await arkyStore.cms.node.get({ key: "website", locale: 'en' })
169
+ await arkyStore.cms.form.submitByKey({ key: 'contact', entries: [] })
247
170
 
248
- // Delete media
249
- await arky.media.deleteStoreMedia({ id: storeId, mediaId })
250
- ```
251
-
252
- ### Notifications
253
- ```typescript
254
- // Get notifications
255
- const notifications = await arky.notification.getNotifications({
256
- limit: 20,
257
- previous_id: null,
258
- })
171
+ await arkyStore.eshop.product.list({ limit: 20 })
172
+ await arkyStore.eshop.cart.ensure()
173
+ await arkyStore.eshop.cart.quote()
174
+ await arkyStore.eshop.cart.checkout({ payment_method_id: 'cash' })
259
175
 
260
- // Mark as seen
261
- await arky.notification.updateNotifications({})
176
+ await arkyStore.eshop.service.list({ limit: 20 })
177
+ await arkyStore.eshop.service.initialize()
262
178
 
263
- // Delivery stats
264
- const stats = await arky.notification.getDeliveryStats({})
179
+ await arkyStore.activity.pageView({ path: location.pathname })
265
180
  ```
266
181
 
267
- ### Roles & Permissions
268
- ```typescript
269
- await arky.role.createRole({ name, permissions })
270
- await arky.role.getRoles({ action: 'READ' })
271
- await arky.role.updateRole({ id, permissions })
272
- await arky.user.setRole({ userId, roleId })
273
- ```
182
+ ## Low-Level Client
274
183
 
275
- ## Utility Functions
184
+ The underlying SDK remains available for admin tools or uncommon integrations:
276
185
 
277
- The SDK includes helpful utilities accessible via `arky.utils`:
278
-
279
- ### Block Utilities
280
186
  ```typescript
281
- // Get image URL from block
282
- const url = arky.utils.getImageUrl(imageBlock)
283
-
284
- // Get block value
285
- const value = arky.utils.getBlockValue(entry, 'title')
187
+ const sdk = arkyStore.client
286
188
 
287
- // Format blocks
288
- const formatted = arky.utils.formatBlockValue(block)
289
- const forSubmit = arky.utils.prepareBlocksForSubmission(blocks)
189
+ await sdk.eshop.product.find({ limit: 20 })
190
+ await sdk.eshop.cart.current({ market: arkyStore.getMarket() })
191
+ await sdk.eshop.order.find({})
192
+ await sdk.cms.node.get({ key: 'website' })
290
193
  ```
291
194
 
292
- ### Price Utilities
293
- ```typescript
294
- // Format prices
295
- const formatted = arky.utils.formatMinor(999, 'usd') // "$9.99"
296
- const payment = arky.utils.formatPayment(paymentObject)
297
-
298
- // Format prices from array
299
- const formatted = arky.utils.formatPrice(prices) // "$9.99"
300
- const amount = arky.utils.getPriceAmount(prices, 'US')
301
- ```
302
-
303
- ### Text Utilities
304
- ```typescript
305
- const slug = arky.utils.slugify('Hello World') // "hello-world"
306
- const title = arky.utils.humanize('hello-world') // "Hello World"
307
- const category = arky.utils.categorify('hello-world') // "HELLO WORLD"
308
- const date = arky.utils.formatDate(timestamp, 'en')
309
- ```
195
+ ## Utility Functions
310
196
 
311
- ### Validation
312
- ```typescript
313
- const result = arky.utils.validatePhoneNumber('+1234567890')
314
- // { isValid: true } or { isValid: false, error: "..." }
315
- ```
197
+ The SDK includes helpful utilities accessible through `arkyStore.utils`:
316
198
 
317
- ### SVG Utilities
318
199
  ```typescript
319
- // Fetch SVG content
320
- const svgString = await arky.utils.fetchSvgContent(mediaBlock)
321
-
322
- // For Astro
323
- const svg = await arky.utils.getSvgContentForAstro(mediaBlock)
324
-
325
- // Inject into element
326
- await arky.utils.injectSvgIntoElement(mediaBlock, element, 'custom-class')
200
+ const title = arkyStore.utils.getBlockTextValue(block, 'en')
201
+ const imageUrl = arkyStore.utils.getImageUrl(imageBlock)
202
+ const price = arkyStore.utils.formatPrice(prices)
203
+ const payment = arkyStore.utils.formatPayment(paymentObject)
204
+ const slug = arkyStore.utils.slugify('Hello World')
205
+ const date = arkyStore.utils.formatDate(Date.now(), 'en')
206
+ const phone = arkyStore.utils.validatePhoneNumber('+1234567890')
327
207
  ```
328
208
 
329
209
  ## What Can You Build?
330
210
 
331
211
  - 🏪 **E-commerce shops** - Product catalogs, shopping carts, checkout
332
212
  - 📰 **Content websites** - Blogs, documentation, marketing sites
333
- - 📅 **Service businesses** - Appointment scheduling, service orders
213
+ - 📅 **Service businesses** - Appointment scheduling, service scheduling
334
214
  - 📬 **Newsletter platforms** - Subscriber management, email campaigns
335
215
  - 🏢 **SaaS products** - Multi-tenant apps with user auth and billing
336
216
  - 🛍️ **Marketplaces** - Multi-vendor platforms with payments
@@ -342,16 +222,14 @@ createArkyStore({
342
222
  // Required
343
223
  baseUrl: string, // API URL
344
224
  storeId: string, // Your store ID
345
- market: string, // Market code (e.g., 'us', 'eu')
346
225
 
347
226
  // Optional
227
+ market?: string, // Market key (e.g., 'us', 'eu')
348
228
  locale?: string, // Storefront locale (default: SDK/client locale)
349
- storageUrl?: string, // Storage URL (default: https://storage.arky.io/dev)
350
- autoGuest?: boolean, // Auto-create guest token (default: true)
351
- logout?: () => void, // Logout callback
352
- isAuthenticated?: () => boolean,
229
+ apiToken?: string, // Trusted server-side API token
230
+ marketForLocale?: (locale: string) => string | null,
353
231
  navigate?: (path: string) => void,
354
- notify?: (notification: { message: string; type: string }) => void,
232
+ loginFallbackPath?: string,
355
233
  })
356
234
  ```
357
235
 
@@ -135,6 +135,62 @@ interface AnalyticsQueryResponse {
135
135
  execution_ms: number;
136
136
  };
137
137
  }
138
+ type ActivityFeedCategory = "orders" | "carts" | "promo_codes" | "submissions" | "customers" | "audiences" | "products" | "services" | "providers" | "cms" | "workflows" | "agents" | "activities";
139
+ interface ActivityFeedQuery {
140
+ limit?: number;
141
+ since?: number;
142
+ cursor_created_at?: number;
143
+ cursor_id?: string;
144
+ category?: ActivityFeedCategory;
145
+ }
146
+ interface ActivityFeedItem {
147
+ id: string;
148
+ entity: string;
149
+ entity_id: string;
150
+ action: string;
151
+ event_type: string;
152
+ status: string;
153
+ customer_id: string;
154
+ category: string;
155
+ title: string;
156
+ description: string;
157
+ href?: string | null;
158
+ booking_count: number;
159
+ data: unknown;
160
+ payload: unknown;
161
+ created_at: number;
162
+ }
163
+ interface ActivityFeedSummary {
164
+ total: number;
165
+ orders: number;
166
+ submissions: number;
167
+ customers: number;
168
+ audiences: number;
169
+ abandoned_carts: number;
170
+ carts: number;
171
+ promo_codes: number;
172
+ products: number;
173
+ services: number;
174
+ providers: number;
175
+ cms: number;
176
+ workflows: number;
177
+ agents: number;
178
+ activities: number;
179
+ window_start: number;
180
+ }
181
+ interface ActivityFeedCursor {
182
+ created_at: number;
183
+ id: string;
184
+ }
185
+ interface ActivityFeedResponse {
186
+ items: ActivityFeedItem[];
187
+ summary: ActivityFeedSummary;
188
+ next_cursor?: ActivityFeedCursor | null;
189
+ meta: {
190
+ row_count: number;
191
+ execution_ms: number;
192
+ };
193
+ }
138
194
 
139
195
  interface Activity {
140
196
  id: string;
@@ -709,6 +765,9 @@ declare function createAdmin(config: CreateAdminConfig): {
709
765
  query: (spec: AnalyticsQuery, options?: RequestOptions$1 & {
710
766
  store_id?: string;
711
767
  }) => Promise<AnalyticsQueryResponse>;
768
+ activityFeed: (query?: ActivityFeedQuery, options?: RequestOptions$1 & {
769
+ store_id?: string;
770
+ }) => Promise<ActivityFeedResponse>;
712
771
  };
713
772
  setStoreId: (storeId: string) => void;
714
773
  getStoreId: () => string;
@@ -993,4 +1052,4 @@ declare function createStorefront(config: CreateStorefrontConfig): {
993
1052
  };
994
1053
  };
995
1054
 
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 };
1055
+ 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 ActivityFeedCategory as ab, type ActivityFeedQuery as ac, type ActivityFeedItem as ad, type ActivityFeedSummary as ae, type ActivityFeedCursor as af, type ActivityFeedResponse as ag, type TimelineParams as ah, type IntegrationOperation as ai, type IntegrationResource as aj, type IntegrationService as ak, 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 };
@@ -135,6 +135,62 @@ interface AnalyticsQueryResponse {
135
135
  execution_ms: number;
136
136
  };
137
137
  }
138
+ type ActivityFeedCategory = "orders" | "carts" | "promo_codes" | "submissions" | "customers" | "audiences" | "products" | "services" | "providers" | "cms" | "workflows" | "agents" | "activities";
139
+ interface ActivityFeedQuery {
140
+ limit?: number;
141
+ since?: number;
142
+ cursor_created_at?: number;
143
+ cursor_id?: string;
144
+ category?: ActivityFeedCategory;
145
+ }
146
+ interface ActivityFeedItem {
147
+ id: string;
148
+ entity: string;
149
+ entity_id: string;
150
+ action: string;
151
+ event_type: string;
152
+ status: string;
153
+ customer_id: string;
154
+ category: string;
155
+ title: string;
156
+ description: string;
157
+ href?: string | null;
158
+ booking_count: number;
159
+ data: unknown;
160
+ payload: unknown;
161
+ created_at: number;
162
+ }
163
+ interface ActivityFeedSummary {
164
+ total: number;
165
+ orders: number;
166
+ submissions: number;
167
+ customers: number;
168
+ audiences: number;
169
+ abandoned_carts: number;
170
+ carts: number;
171
+ promo_codes: number;
172
+ products: number;
173
+ services: number;
174
+ providers: number;
175
+ cms: number;
176
+ workflows: number;
177
+ agents: number;
178
+ activities: number;
179
+ window_start: number;
180
+ }
181
+ interface ActivityFeedCursor {
182
+ created_at: number;
183
+ id: string;
184
+ }
185
+ interface ActivityFeedResponse {
186
+ items: ActivityFeedItem[];
187
+ summary: ActivityFeedSummary;
188
+ next_cursor?: ActivityFeedCursor | null;
189
+ meta: {
190
+ row_count: number;
191
+ execution_ms: number;
192
+ };
193
+ }
138
194
 
139
195
  interface Activity {
140
196
  id: string;
@@ -709,6 +765,9 @@ declare function createAdmin(config: CreateAdminConfig): {
709
765
  query: (spec: AnalyticsQuery, options?: RequestOptions$1 & {
710
766
  store_id?: string;
711
767
  }) => Promise<AnalyticsQueryResponse>;
768
+ activityFeed: (query?: ActivityFeedQuery, options?: RequestOptions$1 & {
769
+ store_id?: string;
770
+ }) => Promise<ActivityFeedResponse>;
712
771
  };
713
772
  setStoreId: (storeId: string) => void;
714
773
  getStoreId: () => string;
@@ -993,4 +1052,4 @@ declare function createStorefront(config: CreateStorefrontConfig): {
993
1052
  };
994
1053
  };
995
1054
 
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 };
1055
+ 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 ActivityFeedCategory as ab, type ActivityFeedQuery as ac, type ActivityFeedItem as ad, type ActivityFeedSummary as ae, type ActivityFeedCursor as af, type ActivityFeedResponse as ag, type TimelineParams as ah, type IntegrationOperation as ai, type IntegrationResource as aj, type IntegrationService as ak, 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
@@ -1891,6 +1891,13 @@ var createAnalyticsApi = (apiConfig) => {
1891
1891
  spec,
1892
1892
  options
1893
1893
  );
1894
+ },
1895
+ async activityFeed(query = {}, options) {
1896
+ const store_id = options?.store_id || apiConfig.storeId;
1897
+ return apiConfig.httpClient.get(
1898
+ `/v1/stores/${store_id}/analytics/activity-feed`,
1899
+ { ...options, params: query }
1900
+ );
1894
1901
  }
1895
1902
  };
1896
1903
  };
@@ -2428,7 +2435,8 @@ function createAdmin(config) {
2428
2435
  }
2429
2436
  },
2430
2437
  analytics: {
2431
- query: analyticsApi.query
2438
+ query: analyticsApi.query,
2439
+ activityFeed: analyticsApi.activityFeed
2432
2440
  },
2433
2441
  setStoreId: (storeId) => {
2434
2442
  apiConfig.storeId = storeId;