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.
- package/package.json +1 -1
- package/server/server.js +8 -4
package/package.json
CHANGED
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
|
-
:
|
|
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
|
|
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')">
|