wiki-plugin-shoppe 0.0.11 → 0.0.13

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 +8 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-plugin-shoppe",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
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
@@ -681,11 +681,15 @@ async function getShoppeGoods(tenant) {
681
681
  image: product.image ? `${getSanoraUrl()}/images/${product.image}` : null,
682
682
  url: isPost
683
683
  ? `/plugin/shoppe/${tenant.uuid}/post/${encodeURIComponent(title)}`
684
- : `${getSanoraUrl()}/products/${tenant.uuid}/${encodeURIComponent(title)}`
684
+ : (product.category === 'book' || (product.category === 'product' && !(product.shipping > 0)))
685
+ ? `${getSanoraUrl()}/products/${tenant.uuid}/${encodeURIComponent(title)}/generic-recover-stripe`
686
+ : product.category === 'product'
687
+ ? `${getSanoraUrl()}/products/${tenant.uuid}/${encodeURIComponent(title)}/generic-address-stripe`
688
+ : `${getSanoraUrl()}/products/${tenant.uuid}/${encodeURIComponent(title)}`
685
689
  };
686
- const bucket = goods[product.category];
690
+ const CATEGORY_BUCKET = { book: 'books', music: 'music', post: 'posts', 'post-series': 'posts', album: 'albums', product: 'products' };
691
+ const bucket = goods[CATEGORY_BUCKET[product.category]];
687
692
  if (bucket) bucket.push(item);
688
- else goods.products.push(item);
689
693
  }
690
694
 
691
695
  return goods;
@@ -702,7 +706,7 @@ function renderCards(items, category) {
702
706
  ? `<div class="card-img"><img src="${item.image}" alt="" loading="lazy"></div>`
703
707
  : `<div class="card-img-placeholder">${CATEGORY_EMOJI[category] || '🎁'}</div>`;
704
708
  const priceHtml = (item.price > 0 || category === 'product')
705
- ? `<div class="price">$${item.price}${item.shipping ? ` <span class="shipping">+ $${item.shipping} shipping</span>` : ''}</div>`
709
+ ? `<div class="price">$${(item.price / 100).toFixed(2)}${item.shipping ? ` <span class="shipping">+ $${(item.shipping / 100).toFixed(2)} shipping</span>` : ''}</div>`
706
710
  : '';
707
711
  return `
708
712
  <div class="card" onclick="window.open('${item.url}','_blank')">