wiki-plugin-shoppe 0.0.41 → 0.0.42

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/server.js +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-plugin-shoppe",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
4
4
  "description": "Multi-tenant digital goods shoppe for federated wiki, powered by Sanora",
5
5
  "keywords": [
6
6
  "wiki",
package/server/server.js CHANGED
@@ -3780,7 +3780,15 @@ async function startServer(params) {
3780
3780
  body: JSON.stringify({ timestamp: ts, signature: sig, order })
3781
3781
  });
3782
3782
  triggerTransfer();
3783
- return res.json({ success: true });
3783
+ // Return a download URL for digital goods so the Shoppere app can open the content
3784
+ const sanoraUrl = getSanoraUrl();
3785
+ const products = await fetchWithRetry(`${sanoraUrl}/products/${tenant.uuid}`).then(r => r.ok ? r.json() : {});
3786
+ const product = Object.values(products).find(p => p.uuid === productId || p.title === title);
3787
+ let downloadUrl = null;
3788
+ if (product && ['book', 'post', 'video'].includes(product.category)) {
3789
+ downloadUrl = `https://${req.get('host')}/plugin/shoppe/${tenant.uuid}/download/${encodeURIComponent(product.title)}`;
3790
+ }
3791
+ return res.json({ success: true, downloadUrl });
3784
3792
  }
3785
3793
 
3786
3794
  // ── Legacy recovery key paths ─────────────────────────────────────────