arky-sdk 0.8.0 → 0.9.6

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.cjs CHANGED
@@ -156,6 +156,12 @@ function normalizeOrderCheckoutItems(items) {
156
156
  return { type: "service", ...item };
157
157
  });
158
158
  }
159
+ function normalizePublicCheckoutItems(items) {
160
+ return normalizeOrderCheckoutItems(items).map((item) => {
161
+ const { price: _price, ...publicItem } = item;
162
+ return publicItem;
163
+ });
164
+ }
159
165
 
160
166
  // src/api/storefront.ts
161
167
  var COMMON_ACTIVITY_TYPES = [
@@ -187,7 +193,7 @@ var createActivityApi = (apiConfig) => ({
187
193
  }
188
194
  }
189
195
  });
190
- var createStorefrontApi = (apiConfig, updateCustomerSession) => {
196
+ var createStorefrontApi = (apiConfig, updateProfileSession) => {
191
197
  const base = (storeId = apiConfig.storeId) => `/v1/storefront/${storeId}`;
192
198
  return {
193
199
  store: {
@@ -371,7 +377,7 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
371
377
  {
372
378
  ...payload,
373
379
  store_id: target,
374
- ...items ? { items: normalizeOrderCheckoutItems(items) } : {}
380
+ ...items ? { items: normalizePublicCheckoutItems(items) } : {}
375
381
  },
376
382
  options
377
383
  );
@@ -384,7 +390,7 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
384
390
  {
385
391
  ...payload,
386
392
  store_id: target,
387
- item: normalizeOrderCheckoutItems([item])[0]
393
+ item: normalizePublicCheckoutItems([item])[0]
388
394
  },
389
395
  options
390
396
  );
@@ -508,11 +514,11 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
508
514
  }
509
515
  },
510
516
  crm: {
511
- customer: {
517
+ profile: {
512
518
  async identify(params, options) {
513
519
  const store_id = apiConfig.storeId;
514
520
  const result = await apiConfig.httpClient.post(
515
- `${base(store_id)}/customers/identify`,
521
+ `${base(store_id)}/profiles/identify`,
516
522
  {
517
523
  store_id,
518
524
  market: params?.market || apiConfig.market || null,
@@ -522,9 +528,9 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
522
528
  options
523
529
  );
524
530
  if (result?.token?.token) {
525
- updateCustomerSession(() => ({
531
+ updateProfileSession(() => ({
526
532
  access_token: result.token.token,
527
- customer: result.customer,
533
+ profile: result.profile,
528
534
  store: result.store,
529
535
  market: result.market
530
536
  }));
@@ -534,12 +540,12 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
534
540
  async verify(params, options) {
535
541
  const store_id = apiConfig.storeId;
536
542
  const result = await apiConfig.httpClient.post(
537
- `${base(store_id)}/customers/verify`,
543
+ `${base(store_id)}/profiles/verify`,
538
544
  { store_id, code: params.code },
539
545
  options
540
546
  );
541
547
  if (result?.token) {
542
- updateCustomerSession(
548
+ updateProfileSession(
543
549
  (prev) => prev ? { ...prev, access_token: result.token } : null
544
550
  );
545
551
  }
@@ -549,132 +555,63 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
549
555
  const store_id = apiConfig.storeId;
550
556
  try {
551
557
  await apiConfig.httpClient.post(
552
- `${base(store_id)}/customers/logout`,
558
+ `${base(store_id)}/profiles/logout`,
553
559
  {},
554
560
  options
555
561
  );
556
562
  } finally {
557
- updateCustomerSession(() => null);
563
+ updateProfileSession(() => null);
558
564
  }
559
565
  },
560
566
  getMe(options) {
561
- return apiConfig.httpClient.get(`${base()}/customers/me`, options);
567
+ return apiConfig.httpClient.get(`${base()}/profiles/me`, options);
562
568
  }
563
569
  },
564
- audience: {
570
+ profileList: {
565
571
  get(params, options) {
566
- let identifier;
567
- if (params.id) {
568
- identifier = params.id;
569
- } else if (params.key) {
570
- identifier = `${apiConfig.storeId}:${params.key}`;
571
- } else {
572
- throw new Error("GetAudienceParams requires id or key");
573
- }
572
+ const store_id = params.store_id || apiConfig.storeId;
574
573
  return apiConfig.httpClient.get(
575
- `${base(apiConfig.storeId)}/audiences/${identifier}`,
574
+ `${base(store_id)}/profile-lists/${params.id}`,
576
575
  options
577
576
  );
578
577
  },
579
578
  find(params, options) {
580
- return apiConfig.httpClient.get(`${base()}/audiences`, {
579
+ const { store_id, ...queryParams } = params || {};
580
+ return apiConfig.httpClient.get(`${base(store_id)}/profile-lists`, {
581
581
  ...options,
582
- params
582
+ params: queryParams
583
583
  });
584
584
  },
585
585
  subscribe(params, options) {
586
+ const { store_id, id, ...payload } = params;
586
587
  return apiConfig.httpClient.post(
587
- `${base()}/audiences/${params.id}/subscribe`,
588
- {
589
- customer_id: params.customer_id,
590
- price_id: params.price_id,
591
- success_url: params.success_url,
592
- cancel_url: params.cancel_url,
593
- confirm_url: params.confirm_url
594
- },
588
+ `${base(store_id)}/profile-lists/${id}/subscribe`,
589
+ payload,
595
590
  options
596
591
  );
597
592
  },
598
593
  checkAccess(params, options) {
594
+ const store_id = params.store_id || apiConfig.storeId;
599
595
  return apiConfig.httpClient.get(
600
- `${base()}/audiences/${params.id}/access`,
596
+ `${base(store_id)}/profile-lists/${params.id}/access`,
601
597
  options
602
598
  );
603
599
  },
604
600
  unsubscribe(token, options) {
605
- return apiConfig.httpClient.get(`${base()}/audiences/unsubscribe`, {
601
+ return apiConfig.httpClient.get(`${base()}/profile-lists/unsubscribe`, {
606
602
  ...options,
607
603
  params: { token }
608
604
  });
609
605
  },
610
606
  confirm(token, options) {
611
- return apiConfig.httpClient.get(`${base()}/audiences/confirm`, {
607
+ return apiConfig.httpClient.get(`${base()}/profile-lists/confirm`, {
612
608
  ...options,
613
609
  params: { token }
614
610
  });
615
611
  }
616
612
  }
617
613
  },
618
- activity: createActivityApi(apiConfig),
619
- automation: {
620
- agent: {
621
- getAgents(params, options) {
622
- const store_id = params?.store_id || apiConfig.storeId;
623
- const queryParams = { ...params || {} };
624
- delete queryParams.store_id;
625
- return apiConfig.httpClient.get(`${base(store_id)}/agents`, {
626
- ...options,
627
- params: Object.keys(queryParams).length > 0 ? queryParams : void 0
628
- });
629
- },
630
- getAgent(params, options) {
631
- const store_id = params.store_id || apiConfig.storeId;
632
- return apiConfig.httpClient.get(
633
- `${base(store_id)}/agents/${params.id}`,
634
- options
635
- );
636
- },
637
- sendMessage(params, options) {
638
- const store_id = params.store_id || apiConfig.storeId;
639
- const body = { message: params.message };
640
- if (params.chat_id) body.chat_id = params.chat_id;
641
- return apiConfig.httpClient.post(
642
- `${base(store_id)}/agents/${params.id}/chats/messages`,
643
- body,
644
- options
645
- );
646
- },
647
- getChat(params, options) {
648
- const store_id = params.store_id || apiConfig.storeId;
649
- return apiConfig.httpClient.get(
650
- `${base(store_id)}/agents/${params.id}/chats/${params.chat_id}`,
651
- options
652
- );
653
- },
654
- getChatMessages(params, options) {
655
- const store_id = params.store_id || apiConfig.storeId;
656
- const queryParams = {};
657
- if (params.limit) queryParams.limit = String(params.limit);
658
- return apiConfig.httpClient.get(
659
- `${base(store_id)}/agents/${params.id}/chats/${params.chat_id}/messages`,
660
- {
661
- ...options,
662
- params: Object.keys(queryParams).length > 0 ? queryParams : void 0
663
- }
664
- );
665
- },
666
- rateChat(params, options) {
667
- const store_id = params.store_id || apiConfig.storeId;
668
- const body = { rating: params.rating };
669
- if (params.comment) body.comment = params.comment;
670
- return apiConfig.httpClient.post(
671
- `${base(store_id)}/agents/${params.id}/chats/${params.chat_id}/rate`,
672
- body,
673
- options
674
- );
675
- }
676
- }
677
- }
614
+ activity: createActivityApi(apiConfig)
678
615
  };
679
616
  };
680
617
 
@@ -1087,7 +1024,7 @@ var createAuthApi = (apiConfig, updateSession) => {
1087
1024
  };
1088
1025
 
1089
1026
  // src/api/store.ts
1090
- var createStoreApi = (apiConfig, updateSession) => {
1027
+ var createStoreApi = (apiConfig, _updateSession) => {
1091
1028
  return {
1092
1029
  async createStore(params, options) {
1093
1030
  return apiConfig.httpClient.post(`/v1/stores`, params, options);
@@ -1137,10 +1074,19 @@ var createStoreApi = (apiConfig, updateSession) => {
1137
1074
  options
1138
1075
  );
1139
1076
  },
1077
+ async addMember(params, options) {
1078
+ const { store_id, ...payload } = params;
1079
+ return apiConfig.httpClient.post(
1080
+ `/v1/stores/${store_id || apiConfig.storeId}/members`,
1081
+ payload,
1082
+ options
1083
+ );
1084
+ },
1140
1085
  async inviteUser(params, options) {
1086
+ const { store_id, ...payload } = params;
1141
1087
  return apiConfig.httpClient.post(
1142
- `/v1/stores/${apiConfig.storeId}/invitation`,
1143
- params,
1088
+ `/v1/stores/${store_id || apiConfig.storeId}/members`,
1089
+ payload,
1144
1090
  options
1145
1091
  );
1146
1092
  },
@@ -1150,22 +1096,6 @@ var createStoreApi = (apiConfig, updateSession) => {
1150
1096
  options
1151
1097
  );
1152
1098
  },
1153
- async handleInvitation(params, options) {
1154
- const { store_id, ...payload } = params;
1155
- const result = await apiConfig.httpClient.put(
1156
- `/v1/stores/${store_id || apiConfig.storeId}/invitation`,
1157
- payload,
1158
- options
1159
- );
1160
- if (params.action === "accept" && result?.auth?.access_token) {
1161
- updateSession(() => ({
1162
- access_token: result.auth.access_token,
1163
- refresh_token: result.auth.refresh_token,
1164
- access_expires_at: result.auth.access_expires_at
1165
- }));
1166
- }
1167
- return result;
1168
- },
1169
1099
  async testWebhook(params, options) {
1170
1100
  return apiConfig.httpClient.post(
1171
1101
  `/v1/stores/${apiConfig.storeId}/webhooks/test`,
@@ -1178,7 +1108,7 @@ var createStoreApi = (apiConfig, updateSession) => {
1178
1108
  limit: params.limit
1179
1109
  };
1180
1110
  if (params.cursor) queryParams.cursor = params.cursor;
1181
- if (params.ids && params.ids.length > 0) queryParams.ids = params.ids.join(",");
1111
+ if (params.ids && params.ids.length > 0) queryParams.ids = JSON.stringify(params.ids);
1182
1112
  if (params.query) queryParams.query = params.query;
1183
1113
  if (params.mime_type) queryParams.mime_type = params.mime_type;
1184
1114
  if (params.sort_field) queryParams.sort_field = params.sort_field;
@@ -1310,7 +1240,7 @@ var createMediaApi = (apiConfig) => {
1310
1240
  const url = `${apiConfig.baseUrl}/v1/stores/${target_store_id}/media`;
1311
1241
  const queryParams = { limit: String(limit) };
1312
1242
  if (cursor) queryParams.cursor = cursor;
1313
- if (ids && ids.length > 0) queryParams.ids = ids.join(",");
1243
+ if (ids && ids.length > 0) queryParams.ids = JSON.stringify(ids);
1314
1244
  if (query) queryParams.query = query;
1315
1245
  if (mime_type) queryParams.mime_type = mime_type;
1316
1246
  if (sort_field) queryParams.sort_field = sort_field;
@@ -1930,7 +1860,7 @@ var createMarketApi = (apiConfig) => {
1930
1860
  var createActivityAdminApi = (apiConfig) => ({
1931
1861
  async timeline(params, options) {
1932
1862
  const store_id = params.store_id || apiConfig.storeId;
1933
- const queryParams = { customer_id: params.customer_id };
1863
+ const queryParams = { profile_id: params.profile_id };
1934
1864
  if (params.limit !== void 0) queryParams.limit = params.limit;
1935
1865
  if (params.cursor) queryParams.cursor = params.cursor;
1936
1866
  return apiConfig.httpClient.get(
@@ -1941,7 +1871,7 @@ var createActivityAdminApi = (apiConfig) => ({
1941
1871
  async find(params, options) {
1942
1872
  const store_id = params.store_id || apiConfig.storeId;
1943
1873
  const queryParams = {};
1944
- if (params.customer_id) queryParams.customer_id = params.customer_id;
1874
+ if (params.profile_id) queryParams.profile_id = params.profile_id;
1945
1875
  if (params.types && params.types.length > 0) queryParams.types = params.types;
1946
1876
  if (params.from !== void 0) queryParams.from = params.from;
1947
1877
  if (params.to !== void 0) queryParams.to = params.to;
@@ -1953,25 +1883,26 @@ var createActivityAdminApi = (apiConfig) => ({
1953
1883
  );
1954
1884
  }
1955
1885
  });
1956
- var createCustomerApi = (apiConfig) => {
1886
+ var createProfileApi = (apiConfig) => {
1957
1887
  return {
1958
1888
  async create(params, options) {
1959
1889
  const { store_id, ...payload } = params;
1960
1890
  return apiConfig.httpClient.post(
1961
- `/v1/stores/${store_id || apiConfig.storeId}/customers`,
1891
+ `/v1/stores/${store_id || apiConfig.storeId}/profiles`,
1962
1892
  payload,
1963
1893
  options
1964
1894
  );
1965
1895
  },
1966
1896
  async get(params, options) {
1967
1897
  return apiConfig.httpClient.get(
1968
- `/v1/stores/${params.store_id || apiConfig.storeId}/customers/${params.id}`,
1898
+ `/v1/stores/${params.store_id || apiConfig.storeId}/profiles/${params.id}`,
1969
1899
  options
1970
1900
  );
1971
1901
  },
1972
1902
  async find(params, options) {
1973
1903
  const store_id = params?.store_id || apiConfig.storeId;
1974
1904
  const queryParams = {};
1905
+ if (params?.ids && params.ids.length > 0) queryParams.ids = JSON.stringify(params.ids);
1975
1906
  if (params?.limit !== void 0) queryParams.limit = params.limit;
1976
1907
  if (params?.cursor) queryParams.cursor = params.cursor;
1977
1908
  if (params?.query) queryParams.query = params.query;
@@ -1982,7 +1913,7 @@ var createCustomerApi = (apiConfig) => {
1982
1913
  if (params?.sort_field) queryParams.sort_field = params.sort_field;
1983
1914
  if (params?.sort_direction) queryParams.sort_direction = params.sort_direction;
1984
1915
  return apiConfig.httpClient.get(
1985
- `/v1/stores/${store_id}/customers`,
1916
+ `/v1/stores/${store_id}/profiles`,
1986
1917
  {
1987
1918
  ...options,
1988
1919
  params: queryParams
@@ -1992,7 +1923,7 @@ var createCustomerApi = (apiConfig) => {
1992
1923
  async update(params, options) {
1993
1924
  const { id, store_id, ...body } = params;
1994
1925
  return apiConfig.httpClient.put(
1995
- `/v1/stores/${store_id || apiConfig.storeId}/customers/${id}`,
1926
+ `/v1/stores/${store_id || apiConfig.storeId}/profiles/${id}`,
1996
1927
  body,
1997
1928
  options
1998
1929
  );
@@ -2000,87 +1931,600 @@ var createCustomerApi = (apiConfig) => {
2000
1931
  async merge(params, options) {
2001
1932
  const store_id = params.store_id || apiConfig.storeId;
2002
1933
  return apiConfig.httpClient.post(
2003
- `/v1/stores/${store_id}/customers/${params.target_id}/merge`,
1934
+ `/v1/stores/${store_id}/profiles/${params.target_id}/merge`,
2004
1935
  { source_id: params.source_id, store_id },
2005
1936
  options
2006
1937
  );
2007
1938
  },
1939
+ "import": async (params, options) => {
1940
+ const { store_id, ...payload } = params;
1941
+ const target_store_id = store_id || apiConfig.storeId;
1942
+ return apiConfig.httpClient.post(
1943
+ `/v1/stores/${target_store_id}/profiles/import`,
1944
+ payload,
1945
+ options
1946
+ );
1947
+ },
1948
+ previewImport: async (params, options) => {
1949
+ const { store_id, ...payload } = params;
1950
+ const target_store_id = store_id || apiConfig.storeId;
1951
+ return apiConfig.httpClient.post(
1952
+ `/v1/stores/${target_store_id}/profiles/import/preview`,
1953
+ payload,
1954
+ options
1955
+ );
1956
+ },
2008
1957
  async revokeToken(params, options) {
2009
1958
  const store_id = params.store_id || apiConfig.storeId;
2010
1959
  return apiConfig.httpClient.delete(
2011
- `/v1/stores/${store_id}/customers/${params.id}/sessions/${params.token_id}`,
1960
+ `/v1/stores/${store_id}/profiles/${params.id}/sessions/${params.token_id}`,
2012
1961
  options
2013
1962
  );
2014
1963
  },
2015
1964
  async revokeAllTokens(params, options) {
2016
1965
  const store_id = params.store_id || apiConfig.storeId;
2017
1966
  return apiConfig.httpClient.delete(
2018
- `/v1/stores/${store_id}/customers/${params.id}/sessions`,
1967
+ `/v1/stores/${store_id}/profiles/${params.id}/sessions`,
2019
1968
  options
2020
1969
  );
2021
1970
  },
2022
- audiences: {
1971
+ profileList: {
2023
1972
  async create(params, options) {
1973
+ const { store_id, ...payload } = params;
1974
+ const target_store_id = store_id || apiConfig.storeId;
2024
1975
  return apiConfig.httpClient.post(
2025
- `/v1/stores/${apiConfig.storeId}/audiences`,
2026
- params,
1976
+ `/v1/stores/${target_store_id}/profile-lists`,
1977
+ payload,
2027
1978
  options
2028
1979
  );
2029
1980
  },
2030
1981
  async update(params, options) {
1982
+ const { id, store_id, ...payload } = params;
1983
+ const target_store_id = store_id || apiConfig.storeId;
2031
1984
  return apiConfig.httpClient.put(
2032
- `/v1/stores/${apiConfig.storeId}/audiences/${params.id}`,
2033
- params,
1985
+ `/v1/stores/${target_store_id}/profile-lists/${id}`,
1986
+ payload,
2034
1987
  options
2035
1988
  );
2036
1989
  },
2037
1990
  async get(params, options) {
2038
- let identifier;
2039
- if (params.id) {
2040
- identifier = params.id;
2041
- } else if (params.key) {
2042
- identifier = `${apiConfig.storeId}:${params.key}`;
2043
- } else {
2044
- throw new Error("GetAudienceParams requires id or key");
1991
+ const target_store_id = params.store_id || apiConfig.storeId;
1992
+ return apiConfig.httpClient.get(
1993
+ `/v1/stores/${target_store_id}/profile-lists/${params.id}`,
1994
+ options
1995
+ );
1996
+ },
1997
+ async find(params, options) {
1998
+ const { store_id, ...queryParams } = params || {};
1999
+ const target_store_id = store_id || apiConfig.storeId;
2000
+ return apiConfig.httpClient.get(
2001
+ `/v1/stores/${target_store_id}/profile-lists`,
2002
+ { ...options, params: queryParams }
2003
+ );
2004
+ },
2005
+ async importProfiles(params, options) {
2006
+ const { store_id, profile_list_id, ...payload } = params;
2007
+ const target_store_id = store_id || apiConfig.storeId;
2008
+ return apiConfig.httpClient.post(
2009
+ `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/profiles/import`,
2010
+ payload,
2011
+ options
2012
+ );
2013
+ },
2014
+ async previewImportProfiles(params, options) {
2015
+ const { store_id, profile_list_id, ...payload } = params;
2016
+ const target_store_id = store_id || apiConfig.storeId;
2017
+ return apiConfig.httpClient.post(
2018
+ `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/profiles/import/preview`,
2019
+ payload,
2020
+ options
2021
+ );
2022
+ },
2023
+ members: {
2024
+ async add(params, options) {
2025
+ const { store_id, profile_list_id, profile_id, fields, lead_description } = params;
2026
+ const target_store_id = store_id || apiConfig.storeId;
2027
+ return apiConfig.httpClient.post(
2028
+ `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
2029
+ { fields, lead_description },
2030
+ options
2031
+ );
2032
+ },
2033
+ async update(params, options) {
2034
+ const { store_id, profile_list_id, profile_id, status, fields, lead_description } = params;
2035
+ const target_store_id = store_id || apiConfig.storeId;
2036
+ return apiConfig.httpClient.patch(
2037
+ `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
2038
+ { status, fields, lead_description },
2039
+ options
2040
+ );
2041
+ },
2042
+ async remove(params, options) {
2043
+ const target_store_id = params.store_id || apiConfig.storeId;
2044
+ return apiConfig.httpClient.delete(
2045
+ `/v1/stores/${target_store_id}/profile-lists/${params.profile_list_id}/members/${params.profile_id}`,
2046
+ options
2047
+ );
2048
+ },
2049
+ async find(params, options) {
2050
+ const { store_id, profile_list_id, ...queryParams } = params;
2051
+ const target_store_id = store_id || apiConfig.storeId;
2052
+ const path = profile_list_id ? `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members` : `/v1/stores/${target_store_id}/profile-list-members`;
2053
+ return apiConfig.httpClient.get(
2054
+ path,
2055
+ { ...options, params: queryParams }
2056
+ );
2045
2057
  }
2058
+ },
2059
+ profiles: {
2060
+ async add(params, options) {
2061
+ const { store_id, profile_list_id, profile_id, fields, lead_description } = params;
2062
+ const target_store_id = store_id || apiConfig.storeId;
2063
+ return apiConfig.httpClient.post(
2064
+ `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
2065
+ { fields, lead_description },
2066
+ options
2067
+ );
2068
+ },
2069
+ async update(params, options) {
2070
+ const { store_id, profile_list_id, profile_id, status, fields, lead_description } = params;
2071
+ const target_store_id = store_id || apiConfig.storeId;
2072
+ return apiConfig.httpClient.patch(
2073
+ `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
2074
+ { status, fields, lead_description },
2075
+ options
2076
+ );
2077
+ },
2078
+ async remove(params, options) {
2079
+ const target_store_id = params.store_id || apiConfig.storeId;
2080
+ return apiConfig.httpClient.delete(
2081
+ `/v1/stores/${target_store_id}/profile-lists/${params.profile_list_id}/members/${params.profile_id}`,
2082
+ options
2083
+ );
2084
+ },
2085
+ async find(params, options) {
2086
+ const { store_id, profile_list_id, ...queryParams } = params;
2087
+ const target_store_id = store_id || apiConfig.storeId;
2088
+ const path = profile_list_id ? `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members` : `/v1/stores/${target_store_id}/profile-list-members`;
2089
+ return apiConfig.httpClient.get(
2090
+ path,
2091
+ { ...options, params: queryParams }
2092
+ );
2093
+ }
2094
+ }
2095
+ },
2096
+ mailbox: {
2097
+ async create(params, options) {
2098
+ const { store_id, ...payload } = params;
2099
+ const target_store_id = store_id || apiConfig.storeId;
2100
+ return apiConfig.httpClient.post(
2101
+ `/v1/stores/${target_store_id}/mailboxes`,
2102
+ payload,
2103
+ options
2104
+ );
2105
+ },
2106
+ async update(params, options) {
2107
+ const { id, store_id, ...payload } = params;
2108
+ const target_store_id = store_id || apiConfig.storeId;
2109
+ return apiConfig.httpClient.put(
2110
+ `/v1/stores/${target_store_id}/mailboxes/${id}`,
2111
+ payload,
2112
+ options
2113
+ );
2114
+ },
2115
+ async get(params, options) {
2116
+ const target_store_id = params.store_id || apiConfig.storeId;
2046
2117
  return apiConfig.httpClient.get(
2047
- `/v1/stores/${apiConfig.storeId}/audiences/${identifier}`,
2118
+ `/v1/stores/${target_store_id}/mailboxes/${params.id}`,
2119
+ options
2120
+ );
2121
+ },
2122
+ async test(params, options) {
2123
+ const target_store_id = params.store_id || apiConfig.storeId;
2124
+ return apiConfig.httpClient.post(
2125
+ `/v1/stores/${target_store_id}/mailboxes/${params.id}/test`,
2126
+ {},
2127
+ options
2128
+ );
2129
+ },
2130
+ async prepare(params, options) {
2131
+ const target_store_id = params.store_id || apiConfig.storeId;
2132
+ return apiConfig.httpClient.post(
2133
+ `/v1/stores/${target_store_id}/mailboxes/${params.id}/prepare`,
2134
+ {},
2048
2135
  options
2049
2136
  );
2050
2137
  },
2051
2138
  async find(params, options) {
2139
+ const { store_id, ...queryParams } = params || {};
2140
+ const target_store_id = store_id || apiConfig.storeId;
2052
2141
  return apiConfig.httpClient.get(
2053
- `/v1/stores/${apiConfig.storeId}/audiences`,
2054
- { ...options, params }
2142
+ `/v1/stores/${target_store_id}/mailboxes`,
2143
+ { ...options, params: queryParams }
2144
+ );
2145
+ }
2146
+ },
2147
+ campaign: {
2148
+ async create(params, options) {
2149
+ const { store_id, ...payload } = params;
2150
+ const target_store_id = store_id || apiConfig.storeId;
2151
+ return apiConfig.httpClient.post(
2152
+ `/v1/stores/${target_store_id}/campaigns`,
2153
+ payload,
2154
+ options
2155
+ );
2156
+ },
2157
+ async update(params, options) {
2158
+ const { id, store_id, ...payload } = params;
2159
+ const target_store_id = store_id || apiConfig.storeId;
2160
+ return apiConfig.httpClient.put(
2161
+ `/v1/stores/${target_store_id}/campaigns/${id}`,
2162
+ payload,
2163
+ options
2055
2164
  );
2056
2165
  },
2057
- async getSubscribers(params, options) {
2166
+ async get(params, options) {
2167
+ const target_store_id = params.store_id || apiConfig.storeId;
2058
2168
  return apiConfig.httpClient.get(
2059
- `/v1/stores/${apiConfig.storeId}/audiences/${params.id}/subscribers`,
2060
- {
2061
- ...options,
2062
- params: { limit: params.limit, cursor: params.cursor }
2063
- }
2169
+ `/v1/stores/${target_store_id}/campaigns/${params.id}`,
2170
+ options
2171
+ );
2172
+ },
2173
+ async find(params, options) {
2174
+ const { store_id, ...queryParams } = params || {};
2175
+ const target_store_id = store_id || apiConfig.storeId;
2176
+ return apiConfig.httpClient.get(
2177
+ `/v1/stores/${target_store_id}/campaigns`,
2178
+ { ...options, params: queryParams }
2179
+ );
2180
+ },
2181
+ async launch(params, options) {
2182
+ const target_store_id = params.store_id || apiConfig.storeId;
2183
+ return apiConfig.httpClient.post(
2184
+ `/v1/stores/${target_store_id}/campaigns/${params.id}/launch`,
2185
+ {},
2186
+ options
2187
+ );
2188
+ },
2189
+ async duplicate(params, options) {
2190
+ const { id, store_id, ...payload } = params;
2191
+ const target_store_id = store_id || apiConfig.storeId;
2192
+ return apiConfig.httpClient.post(
2193
+ `/v1/stores/${target_store_id}/campaigns/${id}/duplicate`,
2194
+ payload,
2195
+ options
2196
+ );
2197
+ },
2198
+ async launchReadiness(params, options) {
2199
+ const target_store_id = params.store_id || apiConfig.storeId;
2200
+ return apiConfig.httpClient.get(
2201
+ `/v1/stores/${target_store_id}/campaigns/${params.id}/launch-readiness`,
2202
+ options
2203
+ );
2204
+ },
2205
+ async importRecipients(params, options) {
2206
+ const { id, store_id, ...payload } = params;
2207
+ const target_store_id = store_id || apiConfig.storeId;
2208
+ return apiConfig.httpClient.post(
2209
+ `/v1/stores/${target_store_id}/campaigns/${id}/recipients/import`,
2210
+ payload,
2211
+ options
2212
+ );
2213
+ },
2214
+ async generatePersonalizedDrafts(params, options) {
2215
+ const { id, store_id, ...payload } = params;
2216
+ const target_store_id = store_id || apiConfig.storeId;
2217
+ return apiConfig.httpClient.post(
2218
+ `/v1/stores/${target_store_id}/campaigns/${id}/personalized-drafts`,
2219
+ payload,
2220
+ options
2221
+ );
2222
+ }
2223
+ },
2224
+ campaignRecipient: {
2225
+ async find(params, options) {
2226
+ const { store_id, ...queryParams } = params || {};
2227
+ const target_store_id = store_id || apiConfig.storeId;
2228
+ return apiConfig.httpClient.get(
2229
+ `/v1/stores/${target_store_id}/campaign-recipients`,
2230
+ { ...options, params: queryParams }
2231
+ );
2232
+ },
2233
+ async get(params, options) {
2234
+ const { store_id, id, ...queryParams } = params;
2235
+ const target_store_id = store_id || apiConfig.storeId;
2236
+ return apiConfig.httpClient.get(
2237
+ `/v1/stores/${target_store_id}/campaign-recipients/${id}`,
2238
+ { ...options, params: { ...queryParams, store_id: target_store_id } }
2239
+ );
2240
+ },
2241
+ async update(params, options) {
2242
+ const { store_id, id, ...payload } = params;
2243
+ const target_store_id = store_id || apiConfig.storeId;
2244
+ return apiConfig.httpClient.put(
2245
+ `/v1/stores/${target_store_id}/campaign-recipients/${id}`,
2246
+ payload,
2247
+ options
2248
+ );
2249
+ },
2250
+ async updateDraft(params, options) {
2251
+ const { store_id, id, draft_id, ...payload } = params;
2252
+ const target_store_id = store_id || apiConfig.storeId;
2253
+ return apiConfig.httpClient.put(
2254
+ `/v1/stores/${target_store_id}/campaign-recipients/${id}/drafts/${draft_id}`,
2255
+ payload,
2256
+ options
2257
+ );
2258
+ },
2259
+ async reply(params, options) {
2260
+ const { store_id, id, ...payload } = params;
2261
+ const target_store_id = store_id || apiConfig.storeId;
2262
+ return apiConfig.httpClient.post(
2263
+ `/v1/stores/${target_store_id}/campaign-recipients/${id}/reply`,
2264
+ payload,
2265
+ options
2266
+ );
2267
+ },
2268
+ async stop(params, options) {
2269
+ const { store_id, id, ...payload } = params;
2270
+ const target_store_id = store_id || apiConfig.storeId;
2271
+ return apiConfig.httpClient.post(
2272
+ `/v1/stores/${target_store_id}/campaign-recipients/${id}/stop`,
2273
+ payload,
2274
+ options
2275
+ );
2276
+ }
2277
+ },
2278
+ campaignMessage: {
2279
+ async find(params, options) {
2280
+ const { store_id, ...queryParams } = params || {};
2281
+ const target_store_id = store_id || apiConfig.storeId;
2282
+ return apiConfig.httpClient.get(
2283
+ `/v1/stores/${target_store_id}/campaign-messages`,
2284
+ { ...options, params: queryParams }
2064
2285
  );
2065
2286
  },
2066
- async addSubscriber(params, options) {
2287
+ async update(params, options) {
2288
+ const { id, store_id, ...payload } = params;
2289
+ const target_store_id = store_id || apiConfig.storeId;
2290
+ return apiConfig.httpClient.put(
2291
+ `/v1/stores/${target_store_id}/campaign-messages/${id}`,
2292
+ payload,
2293
+ options
2294
+ );
2295
+ }
2296
+ },
2297
+ suppression: {
2298
+ async create(params, options) {
2299
+ const { store_id, ...payload } = params;
2300
+ const target_store_id = store_id || apiConfig.storeId;
2067
2301
  return apiConfig.httpClient.post(
2068
- `/v1/stores/${apiConfig.storeId}/audiences/${params.id}/subscribers`,
2069
- { customer_id: params.customer_id },
2302
+ `/v1/stores/${target_store_id}/suppressions`,
2303
+ payload,
2070
2304
  options
2071
2305
  );
2072
2306
  },
2073
- async removeSubscriber(params, options) {
2074
- return apiConfig.httpClient.delete(
2075
- `/v1/stores/${apiConfig.storeId}/audiences/${params.id}/subscribers/${params.customer_id}`,
2307
+ async update(params, options) {
2308
+ const { id, store_id, ...payload } = params;
2309
+ const target_store_id = store_id || apiConfig.storeId;
2310
+ return apiConfig.httpClient.put(
2311
+ `/v1/stores/${target_store_id}/suppressions/${id}`,
2312
+ payload,
2313
+ options
2314
+ );
2315
+ },
2316
+ async get(params, options) {
2317
+ const target_store_id = params.store_id || apiConfig.storeId;
2318
+ return apiConfig.httpClient.get(
2319
+ `/v1/stores/${target_store_id}/suppressions/${params.id}`,
2076
2320
  options
2077
2321
  );
2322
+ },
2323
+ async find(params, options) {
2324
+ const { store_id, ...queryParams } = params || {};
2325
+ const target_store_id = store_id || apiConfig.storeId;
2326
+ return apiConfig.httpClient.get(
2327
+ `/v1/stores/${target_store_id}/suppressions`,
2328
+ { ...options, params: queryParams }
2329
+ );
2078
2330
  }
2079
2331
  },
2080
2332
  activity: createActivityAdminApi(apiConfig)
2081
2333
  };
2082
2334
  };
2083
2335
 
2336
+ // src/api/support.ts
2337
+ function supportConversationQuery(params) {
2338
+ const qs = new URLSearchParams({ store_id: params.store_id });
2339
+ if (params.message_limit) qs.set("message_limit", String(params.message_limit));
2340
+ if (typeof params.after_created_at === "number") qs.set("after_created_at", String(params.after_created_at));
2341
+ if (params.after_id) qs.set("after_id", params.after_id);
2342
+ return qs.toString();
2343
+ }
2344
+ function createStorefrontSupportApi(config) {
2345
+ const { httpClient, storeId } = config;
2346
+ return {
2347
+ async startConversation(params = {}, opts) {
2348
+ return httpClient.post(
2349
+ `/v1/storefront/${storeId}/support/conversations`,
2350
+ { store_id: storeId, ...params },
2351
+ opts
2352
+ );
2353
+ },
2354
+ async sendMessage(params, opts) {
2355
+ return httpClient.post(
2356
+ `/v1/storefront/${storeId}/support/conversations/${params.conversation_id}/messages`,
2357
+ { store_id: storeId, ...params },
2358
+ opts
2359
+ );
2360
+ },
2361
+ async getConversation(params, opts) {
2362
+ const qs = supportConversationQuery({ store_id: storeId, ...params });
2363
+ return httpClient.get(
2364
+ `/v1/storefront/${storeId}/support/conversations/${params.conversation_id}?${qs}`,
2365
+ opts
2366
+ );
2367
+ }
2368
+ };
2369
+ }
2370
+ function createAdminSupportApi(config) {
2371
+ const { httpClient } = config;
2372
+ return {
2373
+ agent: {
2374
+ async create(params, opts) {
2375
+ return httpClient.post(
2376
+ `/v1/stores/${params.store_id}/support/agents`,
2377
+ params,
2378
+ opts
2379
+ );
2380
+ },
2381
+ async get(params, opts) {
2382
+ return httpClient.get(
2383
+ `/v1/stores/${params.store_id}/support/agents/${params.id}?store_id=${params.store_id}`,
2384
+ opts
2385
+ );
2386
+ },
2387
+ async find(params, opts) {
2388
+ const qs = new URLSearchParams({ store_id: params.store_id });
2389
+ if (params.status) qs.set("status", params.status);
2390
+ if (params.limit) qs.set("limit", String(params.limit));
2391
+ if (params.cursor) qs.set("cursor", params.cursor);
2392
+ return httpClient.get(
2393
+ `/v1/stores/${params.store_id}/support/agents?${qs}`,
2394
+ opts
2395
+ );
2396
+ },
2397
+ async update(params, opts) {
2398
+ return httpClient.put(
2399
+ `/v1/stores/${params.store_id}/support/agents/${params.id}`,
2400
+ params,
2401
+ opts
2402
+ );
2403
+ },
2404
+ async delete(params, opts) {
2405
+ return httpClient.delete(
2406
+ `/v1/stores/${params.store_id}/support/agents/${params.id}?store_id=${params.store_id}`,
2407
+ opts
2408
+ );
2409
+ }
2410
+ },
2411
+ conversation: {
2412
+ async find(params, opts) {
2413
+ const qs = new URLSearchParams({ store_id: params.store_id });
2414
+ if (params.status) qs.set("status", params.status);
2415
+ if (params.agent_id) qs.set("agent_id", params.agent_id);
2416
+ if (params.limit) qs.set("limit", String(params.limit));
2417
+ if (params.cursor) qs.set("cursor", params.cursor);
2418
+ return httpClient.get(
2419
+ `/v1/stores/${params.store_id}/support/conversations?${qs}`,
2420
+ opts
2421
+ );
2422
+ },
2423
+ async get(params, opts) {
2424
+ const qs = supportConversationQuery(params);
2425
+ return httpClient.get(
2426
+ `/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}?${qs}`,
2427
+ opts
2428
+ );
2429
+ },
2430
+ async sendMessage(params, opts) {
2431
+ return httpClient.post(
2432
+ `/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/messages`,
2433
+ params,
2434
+ opts
2435
+ );
2436
+ },
2437
+ async reply(params, opts) {
2438
+ return httpClient.post(
2439
+ `/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/reply`,
2440
+ params,
2441
+ opts
2442
+ );
2443
+ },
2444
+ async resolve(params, opts) {
2445
+ return httpClient.post(
2446
+ `/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/resolve`,
2447
+ params,
2448
+ opts
2449
+ );
2450
+ },
2451
+ async assign(params, opts) {
2452
+ return httpClient.post(
2453
+ `/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/assign`,
2454
+ params,
2455
+ opts
2456
+ );
2457
+ }
2458
+ }
2459
+ };
2460
+ }
2461
+
2462
+ // src/api/leadResearch.ts
2463
+ var createLeadResearchApi = (apiConfig) => {
2464
+ const storeId = (store_id) => store_id || apiConfig.storeId;
2465
+ return {
2466
+ async createRun(params, options) {
2467
+ const { store_id, ...payload } = params;
2468
+ return apiConfig.httpClient.post(
2469
+ `/v1/stores/${storeId(store_id)}/lead-research/runs`,
2470
+ payload,
2471
+ options
2472
+ );
2473
+ },
2474
+ async findRuns(params, options) {
2475
+ const { store_id, ...queryParams } = params || {};
2476
+ return apiConfig.httpClient.get(
2477
+ `/v1/stores/${storeId(store_id)}/lead-research/runs`,
2478
+ { ...options, params: queryParams }
2479
+ );
2480
+ },
2481
+ async getRun(params, options) {
2482
+ return apiConfig.httpClient.get(
2483
+ `/v1/stores/${storeId(params.store_id)}/lead-research/runs/${params.id}`,
2484
+ options
2485
+ );
2486
+ },
2487
+ async updateRun(params, options) {
2488
+ const { store_id, id, ...payload } = params;
2489
+ return apiConfig.httpClient.patch(
2490
+ `/v1/stores/${storeId(store_id)}/lead-research/runs/${id}`,
2491
+ payload,
2492
+ options
2493
+ );
2494
+ },
2495
+ async cancelRun(params, options) {
2496
+ return apiConfig.httpClient.post(
2497
+ `/v1/stores/${storeId(params.store_id)}/lead-research/runs/${params.id}/cancel`,
2498
+ {},
2499
+ options
2500
+ );
2501
+ },
2502
+ async sendMessage(params, options) {
2503
+ const { store_id, run_id, ...payload } = params;
2504
+ return apiConfig.httpClient.post(
2505
+ `/v1/stores/${storeId(store_id)}/lead-research/runs/${run_id}/messages`,
2506
+ payload,
2507
+ options
2508
+ );
2509
+ },
2510
+ async findMessages(params, options) {
2511
+ const { store_id, run_id, ...queryParams } = params;
2512
+ return apiConfig.httpClient.get(
2513
+ `/v1/stores/${storeId(store_id)}/lead-research/runs/${run_id}/messages`,
2514
+ { ...options, params: queryParams }
2515
+ );
2516
+ },
2517
+ async validateEmail(params, options) {
2518
+ const { store_id, ...payload } = params;
2519
+ return apiConfig.httpClient.post(
2520
+ `/v1/stores/${storeId(store_id)}/lead-research/validate-email`,
2521
+ payload,
2522
+ options
2523
+ );
2524
+ }
2525
+ };
2526
+ };
2527
+
2084
2528
  // src/api/workflow.ts
2085
2529
  var createWorkflowApi = (apiConfig) => {
2086
2530
  return {
@@ -2206,121 +2650,6 @@ var createShippingApi = (apiConfig) => {
2206
2650
  };
2207
2651
  };
2208
2652
 
2209
- // src/api/agent.ts
2210
- var createAgentApi = (apiConfig) => {
2211
- return {
2212
- async createAgent(params, options) {
2213
- const { store_id, ...payload } = params;
2214
- const target_store_id = store_id || apiConfig.storeId;
2215
- return apiConfig.httpClient.post(
2216
- `/v1/stores/${target_store_id}/agents`,
2217
- { ...payload, store_id: target_store_id },
2218
- options
2219
- );
2220
- },
2221
- async updateAgent(params, options) {
2222
- const { store_id, id, ...payload } = params;
2223
- const target_store_id = store_id || apiConfig.storeId;
2224
- return apiConfig.httpClient.put(
2225
- `/v1/stores/${target_store_id}/agents/${id}`,
2226
- payload,
2227
- options
2228
- );
2229
- },
2230
- async deleteAgent(params, options) {
2231
- const store_id = params.store_id || apiConfig.storeId;
2232
- return apiConfig.httpClient.delete(
2233
- `/v1/stores/${store_id}/agents/${params.id}`,
2234
- options
2235
- );
2236
- },
2237
- async getAgent(params, options) {
2238
- const store_id = params.store_id || apiConfig.storeId;
2239
- return apiConfig.httpClient.get(
2240
- `/v1/stores/${store_id}/agents/${params.id}`,
2241
- options
2242
- );
2243
- },
2244
- async getAgents(params, options) {
2245
- const store_id = params?.store_id || apiConfig.storeId;
2246
- const { store_id: _, ...queryParams } = params || {};
2247
- return apiConfig.httpClient.get(`/v1/stores/${store_id}/agents`, {
2248
- ...options,
2249
- params: Object.keys(queryParams).length > 0 ? queryParams : void 0
2250
- });
2251
- },
2252
- async sendMessage(params, options) {
2253
- const store_id = params.store_id || apiConfig.storeId;
2254
- const body = { message: params.message };
2255
- if (params.chat_id) body.chat_id = params.chat_id;
2256
- if (params.direct) body.direct = params.direct;
2257
- return apiConfig.httpClient.post(
2258
- `/v1/stores/${store_id}/agents/${params.id}/chats/messages`,
2259
- body,
2260
- options
2261
- );
2262
- },
2263
- async getChats(params, options) {
2264
- const store_id = params.store_id || apiConfig.storeId;
2265
- const queryParams = {};
2266
- if (params.limit) queryParams.limit = String(params.limit);
2267
- if (params.cursor) queryParams.cursor = params.cursor;
2268
- return apiConfig.httpClient.get(
2269
- `/v1/stores/${store_id}/agents/${params.id}/chats`,
2270
- {
2271
- ...options,
2272
- params: Object.keys(queryParams).length > 0 ? queryParams : void 0
2273
- }
2274
- );
2275
- },
2276
- async getChat(params, options) {
2277
- const store_id = params.store_id || apiConfig.storeId;
2278
- return apiConfig.httpClient.get(
2279
- `/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}`,
2280
- options
2281
- );
2282
- },
2283
- async updateChat(params, options) {
2284
- const store_id = params.store_id || apiConfig.storeId;
2285
- return apiConfig.httpClient.put(
2286
- `/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}`,
2287
- { status: params.status },
2288
- options
2289
- );
2290
- },
2291
- async rateChat(params, options) {
2292
- const store_id = params.store_id || apiConfig.storeId;
2293
- const body = { rating: params.rating };
2294
- if (params.comment) body.comment = params.comment;
2295
- return apiConfig.httpClient.post(
2296
- `/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}/rate`,
2297
- body,
2298
- options
2299
- );
2300
- },
2301
- async getStoreChats(params, options) {
2302
- const store_id = params.store_id || apiConfig.storeId;
2303
- const { store_id: _, ...queryParams } = params;
2304
- return apiConfig.httpClient.get(`/v1/stores/${store_id}/chats`, {
2305
- ...options,
2306
- params: Object.keys(queryParams).length > 0 ? queryParams : void 0
2307
- });
2308
- },
2309
- async getChatMessages(params, options) {
2310
- const store_id = params.store_id || apiConfig.storeId;
2311
- const queryParams = {};
2312
- if (params.limit) queryParams.limit = String(params.limit);
2313
- return apiConfig.httpClient.get(
2314
- `/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}/messages`,
2315
- {
2316
- ...options,
2317
- params: Object.keys(queryParams).length > 0 ? queryParams : void 0
2318
- }
2319
- );
2320
- }
2321
- };
2322
- };
2323
-
2324
2653
  // src/api/emailTemplate.ts
2325
2654
  var createEmailTemplateApi = (apiConfig) => {
2326
2655
  return {
@@ -2374,6 +2703,15 @@ var createEmailTemplateApi = (apiConfig) => {
2374
2703
  params: queryParams
2375
2704
  }
2376
2705
  );
2706
+ },
2707
+ async previewEmailTemplate(params, options) {
2708
+ const { store_id, id, ...payload } = params;
2709
+ const target_store_id = store_id || apiConfig.storeId;
2710
+ return apiConfig.httpClient.post(
2711
+ `/v1/stores/${target_store_id}/email-templates/${id}/preview`,
2712
+ payload,
2713
+ options
2714
+ );
2377
2715
  }
2378
2716
  };
2379
2717
  };
@@ -2536,20 +2874,13 @@ var createTaxonomyApi = (apiConfig) => {
2536
2874
  // src/api/analytics.ts
2537
2875
  var createAnalyticsApi = (apiConfig) => {
2538
2876
  return {
2539
- async query(spec, options) {
2877
+ async get(request, options) {
2540
2878
  const store_id = options?.store_id || apiConfig.storeId;
2541
2879
  return apiConfig.httpClient.post(
2542
- `/v1/stores/${store_id}/analytics/query`,
2543
- spec,
2880
+ `/v1/stores/${store_id}/analytics`,
2881
+ request,
2544
2882
  options
2545
2883
  );
2546
- },
2547
- async activityFeed(query = {}, options) {
2548
- const store_id = options?.store_id || apiConfig.storeId;
2549
- return apiConfig.httpClient.get(
2550
- `/v1/stores/${store_id}/analytics/activity-feed`,
2551
- { ...options, params: query }
2552
- );
2553
2884
  }
2554
2885
  };
2555
2886
  };
@@ -2804,7 +3135,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
2804
3135
  }
2805
3136
 
2806
3137
  // src/index.ts
2807
- var SDK_VERSION = "0.7.133";
3138
+ var SDK_VERSION = "0.9.2";
2808
3139
  var SUPPORTED_FRAMEWORKS = [
2809
3140
  "astro",
2810
3141
  "react",
@@ -2937,15 +3268,42 @@ function createAdmin(config) {
2937
3268
  };
2938
3269
  const accountApi = createAccountApi(apiConfig);
2939
3270
  const authApi = createAuthApi(apiConfig, updateSession);
2940
- const storeApi = createStoreApi(apiConfig, updateSession);
3271
+ const storeApi = createStoreApi(apiConfig);
2941
3272
  const platformApi = createPlatformApi(apiConfig);
2942
3273
  const cmsApi = createCmsApi(apiConfig);
2943
3274
  const eshopApi = createEshopApi(apiConfig);
2944
3275
  const promoCodeApi = createPromoCodeApi(apiConfig);
2945
- const crmApi = createCustomerApi(apiConfig);
3276
+ const crmApi = createProfileApi(apiConfig);
3277
+ const supportApi = createAdminSupportApi(apiConfig);
3278
+ const leadResearchApi = createLeadResearchApi(apiConfig);
3279
+ const leadResearch = {
3280
+ run: {
3281
+ create: leadResearchApi.createRun,
3282
+ find: leadResearchApi.findRuns,
3283
+ get: leadResearchApi.getRun,
3284
+ update: leadResearchApi.updateRun,
3285
+ cancel: leadResearchApi.cancelRun,
3286
+ sendMessage: leadResearchApi.sendMessage,
3287
+ findMessages: leadResearchApi.findMessages
3288
+ },
3289
+ message: {
3290
+ send: leadResearchApi.sendMessage,
3291
+ find: leadResearchApi.findMessages
3292
+ },
3293
+ email: {
3294
+ validate: leadResearchApi.validateEmail
3295
+ },
3296
+ createRun: leadResearchApi.createRun,
3297
+ findRuns: leadResearchApi.findRuns,
3298
+ getRun: leadResearchApi.getRun,
3299
+ updateRun: leadResearchApi.updateRun,
3300
+ cancelRun: leadResearchApi.cancelRun,
3301
+ sendMessage: leadResearchApi.sendMessage,
3302
+ findMessages: leadResearchApi.findMessages,
3303
+ validateEmail: leadResearchApi.validateEmail
3304
+ };
2946
3305
  const locationApi = createLocationApi(apiConfig);
2947
3306
  const marketApi = createMarketApi(apiConfig);
2948
- const agentApi = createAgentApi(apiConfig);
2949
3307
  const workflowApi = createWorkflowApi(apiConfig);
2950
3308
  const formApi = createFormApi(apiConfig);
2951
3309
  const taxonomyApi = createTaxonomyApi(apiConfig);
@@ -2997,7 +3355,8 @@ function createAdmin(config) {
2997
3355
  update: emailTemplateApi.updateEmailTemplate,
2998
3356
  delete: emailTemplateApi.deleteEmailTemplate,
2999
3357
  get: emailTemplateApi.getEmailTemplate,
3000
- find: emailTemplateApi.getEmailTemplates
3358
+ find: emailTemplateApi.getEmailTemplates,
3359
+ preview: emailTemplateApi.previewEmailTemplate
3001
3360
  }
3002
3361
  },
3003
3362
  eshop: {
@@ -3048,41 +3407,27 @@ function createAdmin(config) {
3048
3407
  promoCode: promoCodeApi
3049
3408
  },
3050
3409
  crm: {
3051
- customer: {
3410
+ profile: {
3052
3411
  create: crmApi.create,
3053
3412
  get: crmApi.get,
3054
3413
  find: crmApi.find,
3055
3414
  update: crmApi.update,
3056
3415
  merge: crmApi.merge,
3416
+ import: crmApi.import,
3057
3417
  revokeToken: crmApi.revokeToken,
3058
3418
  revokeAllTokens: crmApi.revokeAllTokens
3059
3419
  },
3060
- audience: {
3061
- create: crmApi.audiences.create,
3062
- update: crmApi.audiences.update,
3063
- get: crmApi.audiences.get,
3064
- find: crmApi.audiences.find,
3065
- getSubscribers: crmApi.audiences.getSubscribers,
3066
- addSubscriber: crmApi.audiences.addSubscriber,
3067
- removeSubscriber: crmApi.audiences.removeSubscriber
3068
- },
3420
+ profileList: crmApi.profileList,
3421
+ mailbox: crmApi.mailbox,
3422
+ campaign: crmApi.campaign,
3423
+ campaignRecipient: crmApi.campaignRecipient,
3424
+ campaignMessage: crmApi.campaignMessage,
3425
+ suppression: crmApi.suppression,
3426
+ leadResearch,
3069
3427
  activity: crmApi.activity
3070
3428
  },
3429
+ leadResearch,
3071
3430
  automation: {
3072
- agent: {
3073
- create: agentApi.createAgent,
3074
- update: agentApi.updateAgent,
3075
- delete: agentApi.deleteAgent,
3076
- get: agentApi.getAgent,
3077
- find: agentApi.getAgents,
3078
- sendMessage: agentApi.sendMessage,
3079
- getChats: agentApi.getChats,
3080
- getChat: agentApi.getChat,
3081
- updateChat: agentApi.updateChat,
3082
- rateChat: agentApi.rateChat,
3083
- getStoreChats: agentApi.getStoreChats,
3084
- getChatMessages: agentApi.getChatMessages
3085
- },
3086
3431
  workflow: {
3087
3432
  create: workflowApi.createWorkflow,
3088
3433
  update: workflowApi.updateWorkflow,
@@ -3092,12 +3437,10 @@ function createAdmin(config) {
3092
3437
  trigger: workflowApi.triggerWorkflow,
3093
3438
  getExecutions: workflowApi.getWorkflowExecutions,
3094
3439
  getExecution: workflowApi.getWorkflowExecution
3095
- }
3096
- },
3097
- analytics: {
3098
- query: analyticsApi.query,
3099
- activityFeed: analyticsApi.activityFeed
3440
+ },
3441
+ support: supportApi
3100
3442
  },
3443
+ analytics: analyticsApi,
3101
3444
  setStoreId: (storeId) => {
3102
3445
  apiConfig.storeId = storeId;
3103
3446
  },
@@ -3138,22 +3481,22 @@ function createAdmin(config) {
3138
3481
  };
3139
3482
  return sdk;
3140
3483
  }
3141
- var CUSTOMER_STORAGE_KEY = "arky_customer_session";
3142
- function readCustomerSession() {
3484
+ var PROFILE_STORAGE_KEY = "arky_profile_session";
3485
+ function readProfileSession() {
3143
3486
  if (typeof window === "undefined") return null;
3144
3487
  try {
3145
- const raw = localStorage.getItem(CUSTOMER_STORAGE_KEY);
3488
+ const raw = localStorage.getItem(PROFILE_STORAGE_KEY);
3146
3489
  return raw ? JSON.parse(raw) : null;
3147
3490
  } catch {
3148
3491
  return null;
3149
3492
  }
3150
3493
  }
3151
- function writeCustomerSession(s) {
3494
+ function writeProfileSession(s) {
3152
3495
  if (typeof window === "undefined") return;
3153
3496
  if (s) {
3154
- localStorage.setItem(CUSTOMER_STORAGE_KEY, JSON.stringify(s));
3497
+ localStorage.setItem(PROFILE_STORAGE_KEY, JSON.stringify(s));
3155
3498
  } else {
3156
- localStorage.removeItem(CUSTOMER_STORAGE_KEY);
3499
+ localStorage.removeItem(PROFILE_STORAGE_KEY);
3157
3500
  }
3158
3501
  }
3159
3502
  function createStorefront(config) {
@@ -3162,10 +3505,10 @@ function createStorefront(config) {
3162
3505
  const listeners = /* @__PURE__ */ new Set();
3163
3506
  let bareIdentifyPromise = null;
3164
3507
  function toPublic(s) {
3165
- return s ? { customer: s.customer, store: s.store, market: s.market } : null;
3508
+ return s ? { profile: s.profile, store: s.store, market: s.market } : null;
3166
3509
  }
3167
3510
  function emit() {
3168
- const pub = toPublic(readCustomerSession());
3511
+ const pub = toPublic(readProfileSession());
3169
3512
  for (const l of listeners) {
3170
3513
  Promise.resolve().then(() => l(pub)).catch(() => {
3171
3514
  });
@@ -3173,9 +3516,9 @@ function createStorefront(config) {
3173
3516
  }
3174
3517
  const updateSession = (updater) => {
3175
3518
  if (config.apiToken) return;
3176
- const prev = readCustomerSession();
3519
+ const prev = readProfileSession();
3177
3520
  const next = updater(prev);
3178
- writeCustomerSession(next);
3521
+ writeProfileSession(next);
3179
3522
  emit();
3180
3523
  };
3181
3524
  const authStorage = config.apiToken ? {
@@ -3186,7 +3529,7 @@ function createStorefront(config) {
3186
3529
  }
3187
3530
  } : {
3188
3531
  getTokens() {
3189
- const s = readCustomerSession();
3532
+ const s = readProfileSession();
3190
3533
  return s ? { access_token: s.access_token } : null;
3191
3534
  },
3192
3535
  onTokensRefreshed() {
@@ -3213,20 +3556,20 @@ function createStorefront(config) {
3213
3556
  authStorage
3214
3557
  };
3215
3558
  const storefrontApi = createStorefrontApi(apiConfig, updateSession);
3216
- const customerApi = storefrontApi.crm.customer;
3559
+ const profileApi = storefrontApi.crm.profile;
3217
3560
  function identify(params) {
3218
3561
  if (params?.market !== void 0) apiConfig.market = params.market;
3219
3562
  const isBareCall = !params?.email && !params?.verify;
3220
3563
  if (isBareCall && bareIdentifyPromise) return bareIdentifyPromise;
3221
3564
  const promise = (async () => {
3222
3565
  try {
3223
- const result = await customerApi.identify({
3566
+ const result = await profileApi.identify({
3224
3567
  market: apiConfig.market,
3225
3568
  email: params?.email,
3226
3569
  verify: params?.verify
3227
3570
  });
3228
3571
  return {
3229
- customer: result.customer,
3572
+ profile: result.profile,
3230
3573
  store: result.store,
3231
3574
  market: result.market
3232
3575
  };
@@ -3235,9 +3578,9 @@ function createStorefront(config) {
3235
3578
  const status = e?.statusCode || e?.status || e?.response?.status;
3236
3579
  if (isBareCall && status === 401) {
3237
3580
  updateSession(() => null);
3238
- const result = await customerApi.identify({ market: apiConfig.market });
3581
+ const result = await profileApi.identify({ market: apiConfig.market });
3239
3582
  return {
3240
- customer: result.customer,
3583
+ profile: result.profile,
3241
3584
  store: result.store,
3242
3585
  market: result.market
3243
3586
  };
@@ -3252,7 +3595,7 @@ function createStorefront(config) {
3252
3595
  return promise;
3253
3596
  }
3254
3597
  async function verify(params) {
3255
- const result = await customerApi.verify(params);
3598
+ const result = await profileApi.verify(params);
3256
3599
  bareIdentifyPromise = null;
3257
3600
  return result;
3258
3601
  }
@@ -3260,7 +3603,7 @@ function createStorefront(config) {
3260
3603
  if (config.apiToken) return;
3261
3604
  bareIdentifyPromise = null;
3262
3605
  try {
3263
- await customerApi.logout();
3606
+ await profileApi.logout();
3264
3607
  } catch {
3265
3608
  updateSession(() => null);
3266
3609
  }
@@ -3269,19 +3612,19 @@ function createStorefront(config) {
3269
3612
  identify,
3270
3613
  verify,
3271
3614
  logout,
3272
- me: () => customerApi.getMe(),
3615
+ me: () => profileApi.getMe(),
3273
3616
  get session() {
3274
3617
  if (config.apiToken) return null;
3275
- return toPublic(readCustomerSession());
3618
+ return toPublic(readProfileSession());
3276
3619
  },
3277
3620
  get isAuthenticated() {
3278
3621
  if (config.apiToken) return true;
3279
- const s = readCustomerSession();
3622
+ const s = readProfileSession();
3280
3623
  return s !== null && !!s.access_token;
3281
3624
  },
3282
3625
  onAuthStateChanged(listener) {
3283
3626
  listeners.add(listener);
3284
- const current = toPublic(readCustomerSession());
3627
+ const current = toPublic(readProfileSession());
3285
3628
  if (current) {
3286
3629
  Promise.resolve().then(() => listener(current)).catch(() => {
3287
3630
  });
@@ -3296,7 +3639,7 @@ function createStorefront(config) {
3296
3639
  eshop: storefrontApi.eshop,
3297
3640
  crm: storefrontApi.crm,
3298
3641
  activity: storefrontApi.activity,
3299
- automation: storefrontApi.automation,
3642
+ support: createStorefrontSupportApi(apiConfig),
3300
3643
  setStoreId: (storeId) => {
3301
3644
  apiConfig.storeId = storeId;
3302
3645
  bareIdentifyPromise = null;