@behio/storefront-sdk 0.31.1 → 0.33.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.
@@ -147,6 +147,7 @@ var BehioStorefront = class {
147
147
  this.addresses = new AddressModule(this);
148
148
  this.shipping = new ShippingModule(this);
149
149
  this.newsletter = new NewsletterModule(this);
150
+ this.subscriptions = new SubscriptionsModule(this);
150
151
  }
151
152
  // --- Public methods ---
152
153
  /**
@@ -620,6 +621,14 @@ var CatalogModule = class {
620
621
  async checkGiftCard(code) {
621
622
  return this.client.request("GET", `/catalog/gift-cards/${encodeURIComponent(code)}/check`);
622
623
  }
624
+ /**
625
+ * Buy a gift card (GAP-39): creates a cart-independent order for the chosen
626
+ * amount. Redirect the customer to `paymentRedirectUrl` when present; the
627
+ * code is generated and emailed to the recipient once the order is paid.
628
+ */
629
+ async purchaseGiftCard(input) {
630
+ return this.client.request("POST", "/gift-cards/purchase", { body: input });
631
+ }
623
632
  /** List configured payment methods (filtered by currency). */
624
633
  async listPaymentMethods(opts) {
625
634
  const query = {};
@@ -924,6 +933,17 @@ var OrdersModule = class {
924
933
  headers: { "X-Order-Access": accessToken }
925
934
  });
926
935
  }
936
+ /**
937
+ * Guest digital download (GAP-07): mint a short-lived signed URL for a
938
+ * download grant on a guest-accessed order, using the order-access token from
939
+ * {@link verifyAccessCode}. Scoped to that one order.
940
+ */
941
+ async getAccessDownloadUrl(accessToken, downloadId) {
942
+ return this.client.request("POST", `/orders/access/downloads/${downloadId}/url`, {
943
+ auth: false,
944
+ headers: { "X-Order-Access": accessToken }
945
+ });
946
+ }
927
947
  };
928
948
  var CustomerModule = class {
929
949
  constructor(client) {
@@ -967,6 +987,22 @@ var CustomerModule = class {
967
987
  async getLoyalty() {
968
988
  return this.client.request("GET", "/customer/loyalty");
969
989
  }
990
+ /**
991
+ * Digital product delivery (GAP-07): list the logged-in customer's download
992
+ * grants across all their orders (file name, product, remaining downloads,
993
+ * expiry). Requires an authenticated customer session.
994
+ */
995
+ async getDownloads() {
996
+ return this.client.request("GET", "/customer/downloads");
997
+ }
998
+ /**
999
+ * Mint a short-lived signed URL for one download grant. Counts against the
1000
+ * grant's download budget and enforces the max-download + expiry limits
1001
+ * server-side. Requires an authenticated customer session.
1002
+ */
1003
+ async getDownloadUrl(downloadId) {
1004
+ return this.client.request("POST", `/customer/downloads/${downloadId}/url`);
1005
+ }
970
1006
  };
971
1007
  var PagesModule = class {
972
1008
  constructor(client) {
@@ -998,6 +1034,40 @@ var WishlistModule = class {
998
1034
  return this.client.request("GET", `/customer/wishlist/${productId}/check`);
999
1035
  }
1000
1036
  };
1037
+ var SubscriptionsModule = class {
1038
+ constructor(client) {
1039
+ this.client = client;
1040
+ }
1041
+ /**
1042
+ * List the logged-in customer's recurring-order subscriptions (products,
1043
+ * cadence, next order date, status). Requires an authenticated customer
1044
+ * session. Subscriptions are created by the merchant in v1.
1045
+ */
1046
+ async list() {
1047
+ return this.client.request("GET", "/customer/subscriptions");
1048
+ }
1049
+ /** Pause an active subscription (no orders are generated while paused). */
1050
+ async pause(subscriptionId) {
1051
+ return this.client.request(
1052
+ "POST",
1053
+ `/customer/subscriptions/${subscriptionId}/pause`
1054
+ );
1055
+ }
1056
+ /** Resume a paused subscription (re-schedules the next order). */
1057
+ async resume(subscriptionId) {
1058
+ return this.client.request(
1059
+ "POST",
1060
+ `/customer/subscriptions/${subscriptionId}/resume`
1061
+ );
1062
+ }
1063
+ /** Cancel a subscription permanently (no more orders). */
1064
+ async cancel(subscriptionId) {
1065
+ return this.client.request(
1066
+ "POST",
1067
+ `/customer/subscriptions/${subscriptionId}/cancel`
1068
+ );
1069
+ }
1070
+ };
1001
1071
  var ReviewsModule = class {
1002
1072
  constructor(client) {
1003
1073
  this.client = client;
@@ -1069,6 +1139,14 @@ var QuotesModule = class {
1069
1139
  async getStatus(quoteId, email) {
1070
1140
  return this.client.request("POST", `/quotes/${quoteId}/status`, { body: { email } });
1071
1141
  }
1142
+ /**
1143
+ * The logged-in customer's own quote requests ("Moje poptávky", GAP-18).
1144
+ * Requires an authenticated session; ownership is the auth token (customer id
1145
+ * + verified email), never a payload. Newest first.
1146
+ */
1147
+ async listMine() {
1148
+ return this.client.request("GET", "/customer/quotes");
1149
+ }
1072
1150
  };
1073
1151
  var AddressModule = class {
1074
1152
  constructor(client) {
@@ -147,6 +147,7 @@ var BehioStorefront = class {
147
147
  this.addresses = new AddressModule(this);
148
148
  this.shipping = new ShippingModule(this);
149
149
  this.newsletter = new NewsletterModule(this);
150
+ this.subscriptions = new SubscriptionsModule(this);
150
151
  }
151
152
  // --- Public methods ---
152
153
  /**
@@ -620,6 +621,14 @@ var CatalogModule = class {
620
621
  async checkGiftCard(code) {
621
622
  return this.client.request("GET", `/catalog/gift-cards/${encodeURIComponent(code)}/check`);
622
623
  }
624
+ /**
625
+ * Buy a gift card (GAP-39): creates a cart-independent order for the chosen
626
+ * amount. Redirect the customer to `paymentRedirectUrl` when present; the
627
+ * code is generated and emailed to the recipient once the order is paid.
628
+ */
629
+ async purchaseGiftCard(input) {
630
+ return this.client.request("POST", "/gift-cards/purchase", { body: input });
631
+ }
623
632
  /** List configured payment methods (filtered by currency). */
624
633
  async listPaymentMethods(opts) {
625
634
  const query = {};
@@ -924,6 +933,17 @@ var OrdersModule = class {
924
933
  headers: { "X-Order-Access": accessToken }
925
934
  });
926
935
  }
936
+ /**
937
+ * Guest digital download (GAP-07): mint a short-lived signed URL for a
938
+ * download grant on a guest-accessed order, using the order-access token from
939
+ * {@link verifyAccessCode}. Scoped to that one order.
940
+ */
941
+ async getAccessDownloadUrl(accessToken, downloadId) {
942
+ return this.client.request("POST", `/orders/access/downloads/${downloadId}/url`, {
943
+ auth: false,
944
+ headers: { "X-Order-Access": accessToken }
945
+ });
946
+ }
927
947
  };
928
948
  var CustomerModule = class {
929
949
  constructor(client) {
@@ -967,6 +987,22 @@ var CustomerModule = class {
967
987
  async getLoyalty() {
968
988
  return this.client.request("GET", "/customer/loyalty");
969
989
  }
990
+ /**
991
+ * Digital product delivery (GAP-07): list the logged-in customer's download
992
+ * grants across all their orders (file name, product, remaining downloads,
993
+ * expiry). Requires an authenticated customer session.
994
+ */
995
+ async getDownloads() {
996
+ return this.client.request("GET", "/customer/downloads");
997
+ }
998
+ /**
999
+ * Mint a short-lived signed URL for one download grant. Counts against the
1000
+ * grant's download budget and enforces the max-download + expiry limits
1001
+ * server-side. Requires an authenticated customer session.
1002
+ */
1003
+ async getDownloadUrl(downloadId) {
1004
+ return this.client.request("POST", `/customer/downloads/${downloadId}/url`);
1005
+ }
970
1006
  };
971
1007
  var PagesModule = class {
972
1008
  constructor(client) {
@@ -998,6 +1034,40 @@ var WishlistModule = class {
998
1034
  return this.client.request("GET", `/customer/wishlist/${productId}/check`);
999
1035
  }
1000
1036
  };
1037
+ var SubscriptionsModule = class {
1038
+ constructor(client) {
1039
+ this.client = client;
1040
+ }
1041
+ /**
1042
+ * List the logged-in customer's recurring-order subscriptions (products,
1043
+ * cadence, next order date, status). Requires an authenticated customer
1044
+ * session. Subscriptions are created by the merchant in v1.
1045
+ */
1046
+ async list() {
1047
+ return this.client.request("GET", "/customer/subscriptions");
1048
+ }
1049
+ /** Pause an active subscription (no orders are generated while paused). */
1050
+ async pause(subscriptionId) {
1051
+ return this.client.request(
1052
+ "POST",
1053
+ `/customer/subscriptions/${subscriptionId}/pause`
1054
+ );
1055
+ }
1056
+ /** Resume a paused subscription (re-schedules the next order). */
1057
+ async resume(subscriptionId) {
1058
+ return this.client.request(
1059
+ "POST",
1060
+ `/customer/subscriptions/${subscriptionId}/resume`
1061
+ );
1062
+ }
1063
+ /** Cancel a subscription permanently (no more orders). */
1064
+ async cancel(subscriptionId) {
1065
+ return this.client.request(
1066
+ "POST",
1067
+ `/customer/subscriptions/${subscriptionId}/cancel`
1068
+ );
1069
+ }
1070
+ };
1001
1071
  var ReviewsModule = class {
1002
1072
  constructor(client) {
1003
1073
  this.client = client;
@@ -1069,6 +1139,14 @@ var QuotesModule = class {
1069
1139
  async getStatus(quoteId, email) {
1070
1140
  return this.client.request("POST", `/quotes/${quoteId}/status`, { body: { email } });
1071
1141
  }
1142
+ /**
1143
+ * The logged-in customer's own quote requests ("Moje poptávky", GAP-18).
1144
+ * Requires an authenticated session; ownership is the auth token (customer id
1145
+ * + verified email), never a payload. Newest first.
1146
+ */
1147
+ async listMine() {
1148
+ return this.client.request("GET", "/customer/quotes");
1149
+ }
1072
1150
  };
1073
1151
  var AddressModule = class {
1074
1152
  constructor(client) {