@delopay/sdk 0.8.0 → 0.10.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/dist/index.cjs CHANGED
@@ -1789,6 +1789,36 @@ var Shops = class {
1789
1789
  async list(merchantId) {
1790
1790
  return this.request("GET", `/shops/${encodeURIComponent(merchantId)}`);
1791
1791
  }
1792
+ /**
1793
+ * Upload a logo file for a shop. The file is stored in Delopay's configured
1794
+ * object store and a public HTTPS URL is returned. This method does NOT write
1795
+ * the URL into the shop's `payment_link_config.default_config.logo` — call
1796
+ * `shops.update` afterwards with the returned `logo_url` to persist the change.
1797
+ *
1798
+ * Accepts PNG, JPEG, WebP or SVG. The file must be ≤ 1 MiB.
1799
+ *
1800
+ * @param merchantId - The merchant account ID.
1801
+ * @param shopId - The shop (business profile) ID.
1802
+ * @param file - The logo file (Blob / File in browsers).
1803
+ * @returns The publicly-reachable URL of the uploaded logo.
1804
+ *
1805
+ * @example
1806
+ * ```typescript
1807
+ * const { logo_url } = await delopay.shops.uploadLogo('merch_1', 'pro_1', file);
1808
+ * await delopay.shops.update('merch_1', 'pro_1', {
1809
+ * payment_link_config: { default_config: { logo: logo_url } },
1810
+ * });
1811
+ * ```
1812
+ */
1813
+ async uploadLogo(merchantId, shopId, file) {
1814
+ const form = new FormData();
1815
+ form.append("file", file);
1816
+ return this.request(
1817
+ "POST",
1818
+ `/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/logo`,
1819
+ { body: form }
1820
+ );
1821
+ }
1792
1822
  };
1793
1823
 
1794
1824
  // src/resources/stripeConnect.ts
@@ -2638,12 +2668,18 @@ var Delopay = class {
2638
2668
  ...this.jwtToken ? { Authorization: `Bearer ${this.jwtToken}` } : this.apiKey ? { "api-key": this.apiKey } : {},
2639
2669
  ...options?.headers
2640
2670
  };
2641
- if (options?.body) {
2671
+ const isRawBody = options?.body !== void 0 && options?.body !== null && (options.body instanceof FormData || options.body instanceof Blob || options.body instanceof ArrayBuffer || options.body instanceof URLSearchParams);
2672
+ if (options?.body && !isRawBody) {
2642
2673
  headers["Content-Type"] = "application/json";
2643
2674
  }
2644
2675
  const idempotencyKey = findIdempotencyKey(headers)?.trim();
2645
2676
  const isRetryable = method === "GET" || method === "DELETE" || idempotencyKey !== void 0 && idempotencyKey !== "";
2646
- const serializedBody = options?.body ? JSON.stringify(options.body) : void 0;
2677
+ let serializedBody;
2678
+ if (isRawBody) {
2679
+ serializedBody = options?.body;
2680
+ } else if (options?.body) {
2681
+ serializedBody = JSON.stringify(options.body);
2682
+ }
2647
2683
  const callerSignal = options?.signal;
2648
2684
  if (callerSignal?.aborted) {
2649
2685
  throw new DelopayError("Request aborted", {