arky-sdk 0.3.20 → 0.3.23

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
@@ -206,7 +206,7 @@ var createUserApi = (apiConfig) => {
206
206
  }
207
207
  });
208
208
  },
209
- async setUserRole(params, options) {
209
+ async setRole(params, options) {
210
210
  return apiConfig.httpClient.put("/v1/users/set-role", params, options);
211
211
  },
212
212
  // ===== AUTHENTICATION =====
@@ -404,7 +404,11 @@ var createRoleApi = (apiConfig) => {
404
404
  return apiConfig.httpClient.post(`/v1/roles`, params, options);
405
405
  },
406
406
  async updateRole(params, options) {
407
- return apiConfig.httpClient.put(`/v1/roles/${params.id}`, params, options);
407
+ return apiConfig.httpClient.put(
408
+ `/v1/roles/${params.id}`,
409
+ params,
410
+ options
411
+ );
408
412
  },
409
413
  async deleteRole(params, options) {
410
414
  return apiConfig.httpClient.delete(`/v1/roles/${params.id}`, options);
@@ -416,7 +420,7 @@ var createRoleApi = (apiConfig) => {
416
420
  return apiConfig.httpClient.get(`/v1/roles`, {
417
421
  ...options,
418
422
  params: {
419
- ...params,
423
+ action: params.action,
420
424
  businessId: apiConfig.businessId
421
425
  }
422
426
  });
@@ -612,7 +616,7 @@ var createCmsApi = (apiConfig) => {
612
616
  {
613
617
  businessId: apiConfig.businessId,
614
618
  entryId,
615
- scheduledAt: scheduledAt || Date.now()
619
+ scheduledAt: scheduledAt ?? Math.floor(Date.now() / 1e3)
616
620
  },
617
621
  options
618
622
  );
@@ -623,6 +627,30 @@ var createCmsApi = (apiConfig) => {
623
627
  `/v1/collections/entry-types/${params.entryType}/variables`,
624
628
  options
625
629
  );
630
+ },
631
+ // ===== COLLECTION SUBSCRIPTIONS =====
632
+ async getCollectionSubscribers(params, options) {
633
+ return apiConfig.httpClient.get(
634
+ `/v1/businesses/${apiConfig.businessId}/collections/${params.id}/subscribers`,
635
+ options
636
+ );
637
+ },
638
+ async subscribeToCollection(params, options) {
639
+ return apiConfig.httpClient.post(
640
+ `/v1/businesses/${apiConfig.businessId}/collections/${params.collectionId}/subscribe`,
641
+ {
642
+ email: params.email,
643
+ market: apiConfig.market,
644
+ planId: params.planId
645
+ },
646
+ options
647
+ );
648
+ },
649
+ async unsubscribeFromCollection(params, options) {
650
+ return apiConfig.httpClient.get(`/v1/businesses/${apiConfig.businessId}/collections/unsubscribe`, {
651
+ ...options,
652
+ params
653
+ });
626
654
  }
627
655
  };
628
656
  };
@@ -917,55 +945,6 @@ var createReservationApi = (apiConfig) => {
917
945
  };
918
946
  };
919
947
 
920
- // src/api/newsletter.ts
921
- var createNewsletterApi = (apiConfig) => {
922
- return {
923
- // ===== NEWSLETTERS =====
924
- async find(params, options) {
925
- return apiConfig.httpClient.get(`/v1/newsletters`, {
926
- ...options,
927
- params: { businessId: apiConfig.businessId }
928
- });
929
- },
930
- async get(params, options) {
931
- return apiConfig.httpClient.get(`/v1/newsletters/${params.id}`, options);
932
- },
933
- async create(params, options) {
934
- return apiConfig.httpClient.post(`/v1/newsletters`, params, options);
935
- },
936
- async update(params, options) {
937
- return apiConfig.httpClient.put(`/v1/newsletters/${params.id}`, params, options);
938
- },
939
- async delete(params, options) {
940
- return apiConfig.httpClient.delete(`/v1/newsletters/${params.id}`, options);
941
- },
942
- // ===== SUBSCRIBERS =====
943
- async getSubscribers(params, options) {
944
- return apiConfig.httpClient.get(`/v1/newsletters/${params.id}/subscribers`, options);
945
- },
946
- async subscribe(params, options) {
947
- const payload = {
948
- ...params,
949
- market: apiConfig.market
950
- };
951
- return apiConfig.httpClient.post(
952
- `/v1/newsletters/${params.newsletterId}/subscribe`,
953
- payload,
954
- options
955
- );
956
- },
957
- async unsubscribe(params, options) {
958
- return apiConfig.httpClient.post(`/v1/newsletters/unsubscribe`, params, options);
959
- },
960
- async unsubscribeWithToken(params, options) {
961
- return apiConfig.httpClient.get(`/v1/newsletters/unsubscribe`, {
962
- ...options,
963
- params
964
- });
965
- }
966
- };
967
- };
968
-
969
948
  // src/api/payment.ts
970
949
  var createPaymentApi = (apiConfig) => {
971
950
  return {
@@ -1517,7 +1496,7 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
1517
1496
  }
1518
1497
 
1519
1498
  // src/index.ts
1520
- var SDK_VERSION = "0.3.18";
1499
+ var SDK_VERSION = "0.3.21";
1521
1500
  var SUPPORTED_FRAMEWORKS = [
1522
1501
  "astro",
1523
1502
  "react",
@@ -1553,7 +1532,6 @@ function createArkySDK(config) {
1553
1532
  cms: createCmsApi(apiConfig),
1554
1533
  eshop: createEshopApi(apiConfig),
1555
1534
  reservation: createReservationApi(apiConfig),
1556
- newsletter: createNewsletterApi(apiConfig),
1557
1535
  payment: createPaymentApi(apiConfig),
1558
1536
  setBusinessId: (businessId) => {
1559
1537
  apiConfig.businessId = businessId;