@delopay/sdk 0.64.0 → 0.66.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/{chunk-UQ47CRAI.js → chunk-2DNFEA5T.js} +46 -5
- package/dist/chunk-2DNFEA5T.js.map +1 -0
- package/dist/index.cjs +45 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +111 -3
- package/dist/index.d.ts +111 -3
- package/dist/index.js +1 -1
- package/dist/internal.cjs +45 -4
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-UQ47CRAI.js.map +0 -1
|
@@ -1670,13 +1670,26 @@ var Projects = class {
|
|
|
1670
1670
|
/**
|
|
1671
1671
|
* Get aggregate payment statistics across all projects for a merchant.
|
|
1672
1672
|
*
|
|
1673
|
+
* The response's flat `shops[]` array holds every shop, including shops that
|
|
1674
|
+
* belong to no project — those are absent from `projects[].shops[]`, so look
|
|
1675
|
+
* a single shop up in `shops[]`. Requires `MerchantAccountRead`; a
|
|
1676
|
+
* shop-scoped user should call {@link Shops.stats} instead.
|
|
1677
|
+
*
|
|
1673
1678
|
* @param merchantId - The merchant account ID.
|
|
1679
|
+
* @param period - Window in days, or `'all'` for an all-time total.
|
|
1680
|
+
* Omitted means the server default of 30 days.
|
|
1674
1681
|
* @returns Project statistics.
|
|
1682
|
+
*
|
|
1683
|
+
* @example
|
|
1684
|
+
* ```typescript
|
|
1685
|
+
* const stats = await delopay.projects.stats('merch_123', 'all');
|
|
1686
|
+
* const shop = stats.shops.find((s) => s.shop_id === 'pro_1');
|
|
1687
|
+
* ```
|
|
1675
1688
|
*/
|
|
1676
|
-
async stats(merchantId) {
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
});
|
|
1689
|
+
async stats(merchantId, period) {
|
|
1690
|
+
const query = { merchant_id: merchantId };
|
|
1691
|
+
if (period !== void 0) query["period"] = String(period);
|
|
1692
|
+
return this.request("GET", "/projects/stats", { query });
|
|
1680
1693
|
}
|
|
1681
1694
|
/**
|
|
1682
1695
|
* Get a high-level overview (volume, counts, top connectors) for a merchant.
|
|
@@ -2160,6 +2173,34 @@ var Shops = class {
|
|
|
2160
2173
|
async list(merchantId) {
|
|
2161
2174
|
return this.request("GET", `/shops/${encodeURIComponent(merchantId)}`);
|
|
2162
2175
|
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Successful-order count and revenue for one shop.
|
|
2178
|
+
*
|
|
2179
|
+
* Unlike `projects.stats()` this needs only `ProfileAccountRead`, so a
|
|
2180
|
+
* shop-scoped user can load it for their own shop; merchant-level users can
|
|
2181
|
+
* load any shop of their merchant.
|
|
2182
|
+
*
|
|
2183
|
+
* Revenue comes back FX-converted as `revenue_usd` (USD major units) plus a
|
|
2184
|
+
* `revenue_by_currency` breakdown. The legacy `revenue` field is a raw
|
|
2185
|
+
* cross-currency minor-unit sum and should not be displayed.
|
|
2186
|
+
*
|
|
2187
|
+
* @param merchantId - The merchant account ID.
|
|
2188
|
+
* @param shopId - The shop (business profile) ID.
|
|
2189
|
+
* @param period - Window in days, or `'all'` for an all-time total.
|
|
2190
|
+
* Omitted means the server default of 30 days.
|
|
2191
|
+
* @returns The shop's stats over the requested window.
|
|
2192
|
+
*
|
|
2193
|
+
* @example
|
|
2194
|
+
* ```typescript
|
|
2195
|
+
* const stats = await delopay.shops.stats('merch_123', 'pro_1', 'all');
|
|
2196
|
+
* console.log(stats.orders, stats.revenue_usd);
|
|
2197
|
+
* ```
|
|
2198
|
+
*/
|
|
2199
|
+
async stats(merchantId, shopId, period) {
|
|
2200
|
+
const path = `/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/stats`;
|
|
2201
|
+
if (period === void 0) return this.request("GET", path);
|
|
2202
|
+
return this.request("GET", path, { query: { period: String(period) } });
|
|
2203
|
+
}
|
|
2163
2204
|
/**
|
|
2164
2205
|
* Upload a logo file for a shop. The file is stored in Delopay's configured
|
|
2165
2206
|
* object store and a public HTTPS URL is returned. This method does NOT write
|
|
@@ -4295,4 +4336,4 @@ export {
|
|
|
4295
4336
|
applyBrandingVariables,
|
|
4296
4337
|
shadowFor
|
|
4297
4338
|
};
|
|
4298
|
-
//# sourceMappingURL=chunk-
|
|
4339
|
+
//# sourceMappingURL=chunk-2DNFEA5T.js.map
|