@23blocks/block-sales 8.0.1 → 8.0.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 8.0.2 (2026-03-14)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **@23blocks/block-sales:** use JSON:API codec for vendor payment and provider report list endpoints ([d90e5f7](https://github.com/23blocks-OS/frontend-sdk/commit/d90e5f7))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Claude Opus 4.6 (1M context)
10
+ - Juan Pelaez
11
+
1
12
  ## 8.0.1 (2026-03-03)
2
13
 
3
14
  ### 🧱 Updated Dependencies
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { decodePageResult, decodeOne, decodeMany } from '@23blocks/jsonapi-codec';
1
+ import { decodePageResult, decodeOne, decodeMany, extractPageMeta } from '@23blocks/jsonapi-codec';
2
2
 
3
3
  /**
4
4
  * Parse a string value, returning undefined for empty/undefined
@@ -1853,33 +1853,39 @@ function createVendorPaymentsService(transport, _config) {
1853
1853
  page: params.page,
1854
1854
  per_page: params.perPage
1855
1855
  });
1856
+ const decoded = decodeMany(response, vendorPaymentMapper);
1857
+ const pageMeta = extractPageMeta(response);
1858
+ const doc = response;
1859
+ const metaObj = doc['meta'] || {};
1860
+ const summaryObj = metaObj['summary'] || {};
1861
+ const periodObj = summaryObj['period'] || {};
1856
1862
  return {
1857
- payments: (response.payments || []).map((p)=>({
1858
- uniqueId: p.unique_id,
1859
- orderUniqueId: p.order_unique_id,
1860
- vendorName: p.vendor_name,
1861
- amount: p.amount,
1862
- status: p.status,
1863
- paidAt: p.paid_at ? new Date(p.paid_at) : undefined,
1864
- createdAt: new Date(p.created_at)
1863
+ payments: decoded.map((vp)=>({
1864
+ uniqueId: vp.uniqueId,
1865
+ orderUniqueId: vp.vendorUniqueId || '',
1866
+ vendorName: vp.vendorName,
1867
+ amount: vp.price || 0,
1868
+ status: vp.status || '',
1869
+ paidAt: vp.paidAt,
1870
+ createdAt: vp.createdAt
1865
1871
  })),
1866
1872
  summary: {
1867
- totalPayments: response.summary.total_payments,
1868
- totalAmount: response.summary.total_amount,
1869
- totalPending: response.summary.total_pending,
1870
- totalPaid: response.summary.total_paid,
1871
- paymentsByStatus: response.summary.payments_by_status,
1872
- currency: response.summary.currency,
1873
+ totalPayments: Number(summaryObj['total_payments'] || 0),
1874
+ totalAmount: Number(summaryObj['total_amount'] || 0),
1875
+ totalPending: Number(summaryObj['total_pending'] || 0),
1876
+ totalPaid: Number(summaryObj['total_paid'] || 0),
1877
+ paymentsByStatus: summaryObj['payments_by_status'] || {},
1878
+ currency: String(summaryObj['currency'] || ''),
1873
1879
  period: {
1874
- startDate: new Date(response.summary.period.start_date),
1875
- endDate: new Date(response.summary.period.end_date)
1880
+ startDate: periodObj['start_date'] ? new Date(periodObj['start_date']) : new Date(),
1881
+ endDate: periodObj['end_date'] ? new Date(periodObj['end_date']) : new Date()
1876
1882
  }
1877
1883
  },
1878
1884
  meta: {
1879
- totalCount: response.meta.total_count,
1880
- page: response.meta.current_page,
1881
- perPage: response.meta.per_page,
1882
- totalPages: response.meta.total_pages
1885
+ totalCount: pageMeta.totalCount,
1886
+ page: pageMeta.currentPage,
1887
+ perPage: pageMeta.perPage,
1888
+ totalPages: pageMeta.totalPages
1883
1889
  }
1884
1890
  };
1885
1891
  },
@@ -1913,30 +1919,36 @@ function createVendorPaymentsService(transport, _config) {
1913
1919
  page: params.page,
1914
1920
  per_page: params.perPage
1915
1921
  });
1922
+ const decoded = decodeMany(response, orderDetailVendorMapper);
1923
+ const pageMeta = extractPageMeta(response);
1924
+ const doc = response;
1925
+ const metaObj = doc['meta'] || {};
1926
+ const summaryObj = metaObj['summary'] || {};
1927
+ const periodObj = summaryObj['period'] || {};
1916
1928
  return {
1917
- providers: (response.providers || []).map((p)=>({
1918
- uniqueId: p.unique_id,
1919
- vendorName: p.vendor_name,
1920
- amount: p.amount,
1921
- commission: p.commission,
1922
- status: p.status,
1923
- createdAt: new Date(p.created_at)
1929
+ providers: decoded.map((odv)=>({
1930
+ uniqueId: odv.uniqueId,
1931
+ vendorName: odv.vendorName,
1932
+ amount: 0,
1933
+ commission: undefined,
1934
+ status: odv.status || '',
1935
+ createdAt: odv.createdAt
1924
1936
  })),
1925
1937
  summary: {
1926
- totalProviders: response.summary.total_providers,
1927
- totalAmount: response.summary.total_amount,
1928
- totalCommission: response.summary.total_commission,
1929
- providersByStatus: response.summary.providers_by_status,
1938
+ totalProviders: Number(summaryObj['total_providers'] || 0),
1939
+ totalAmount: Number(summaryObj['total_amount'] || 0),
1940
+ totalCommission: Number(summaryObj['total_commission'] || 0),
1941
+ providersByStatus: summaryObj['providers_by_status'] || {},
1930
1942
  period: {
1931
- startDate: new Date(response.summary.period.start_date),
1932
- endDate: new Date(response.summary.period.end_date)
1943
+ startDate: periodObj['start_date'] ? new Date(periodObj['start_date']) : new Date(),
1944
+ endDate: periodObj['end_date'] ? new Date(periodObj['end_date']) : new Date()
1933
1945
  }
1934
1946
  },
1935
1947
  meta: {
1936
- totalCount: response.meta.total_count,
1937
- page: response.meta.current_page,
1938
- perPage: response.meta.per_page,
1939
- totalPages: response.meta.total_pages
1948
+ totalCount: pageMeta.totalCount,
1949
+ page: pageMeta.currentPage,
1950
+ perPage: pageMeta.perPage,
1951
+ totalPages: pageMeta.totalPages
1940
1952
  }
1941
1953
  };
1942
1954
  },
@@ -1 +1 @@
1
- {"version":3,"file":"vendor-payments.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/vendor-payments.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,aAAa,EACb,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,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MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACtF,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9E,qBAAqB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACrF;AAED,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,CAqKpH"}
1
+ {"version":3,"file":"vendor-payments.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/vendor-payments.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,aAAa,EACb,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAuE5B,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACrD,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACxI,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACjK,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5J,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtH,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrI,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC/J,UAAU,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAChF,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACtF,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9E,qBAAqB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACrF;AAED,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,CAiLpH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@23blocks/block-sales",
3
- "version": "8.0.1",
3
+ "version": "8.0.2",
4
4
  "description": "Sales block for 23blocks SDK - orders, payments, subscriptions, transactions",
5
5
  "license": "MIT",
6
6
  "author": "23blocks <hello@23blocks.com>",