@nextblock-cms/ecom 0.20.1 → 0.21.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/_virtual/_rolldown/runtime.cjs.js +1 -0
- package/index.cjs.js +1 -1
- package/index.es.js +38 -146
- package/lib/CurrencyProvider.cjs.js +1 -1
- package/lib/CurrencyProvider.d.ts +1 -1
- package/lib/CurrencyProvider.es.js +85 -95
- package/lib/PaymentReadinessProvider.cjs.js +1 -1
- package/lib/PaymentReadinessProvider.d.ts +1 -1
- package/lib/PaymentReadinessProvider.es.js +24 -27
- package/lib/cart-store.cjs.js +1 -1
- package/lib/cart-store.es.js +109 -121
- package/lib/components/AccountNavigationMenu.cjs.js +1 -1
- package/lib/components/AccountNavigationMenu.d.ts +1 -1
- package/lib/components/AccountNavigationMenu.es.js +36 -50
- package/lib/components/AddToCartButton.cjs.js +1 -1
- package/lib/components/AddToCartButton.d.ts +1 -1
- package/lib/components/AddToCartButton.es.js +94 -89
- package/lib/components/Cart.cjs.js +1 -1
- package/lib/components/Cart.d.ts +1 -1
- package/lib/components/Cart.es.js +261 -180
- package/lib/components/CartDrawer.cjs.js +1 -1
- package/lib/components/CartDrawer.d.ts +1 -1
- package/lib/components/CartDrawer.es.js +218 -148
- package/lib/components/CartIcon.cjs.js +1 -1
- package/lib/components/CartIcon.d.ts +1 -1
- package/lib/components/CartIcon.es.js +33 -35
- package/lib/components/Checkout.cjs.js +1 -1
- package/lib/components/Checkout.d.ts +1 -1
- package/lib/components/Checkout.es.js +1092 -1108
- package/lib/components/CouponForm.cjs.js +1 -1
- package/lib/components/CouponForm.d.ts +1 -1
- package/lib/components/CouponForm.es.js +136 -148
- package/lib/components/CurrencySwitcher.cjs.js +1 -1
- package/lib/components/CurrencySwitcher.d.ts +1 -1
- package/lib/components/CurrencySwitcher.es.js +22 -18
- package/lib/components/CustomerProfileForm.cjs.js +1 -1
- package/lib/components/CustomerProfileForm.es.js +454 -313
- package/lib/components/FeaturedProduct.cjs.js +1 -1
- package/lib/components/FeaturedProduct.d.ts +1 -1
- package/lib/components/FeaturedProduct.es.js +98 -83
- package/lib/components/FreemiusLicensePanel.cjs.js +1 -1
- package/lib/components/FreemiusLicensePanel.d.ts +1 -1
- package/lib/components/FreemiusLicensePanel.es.js +70 -65
- package/lib/components/InvoiceDocument.cjs.js +1 -1
- package/lib/components/InvoiceDocument.es.js +256 -192
- package/lib/components/InvoiceViewerShell.cjs.js +2 -2
- package/lib/components/InvoiceViewerShell.d.ts +1 -1
- package/lib/components/InvoiceViewerShell.es.js +75 -106
- package/lib/components/ProductCard.cjs.js +1 -1
- package/lib/components/ProductCard.d.ts +1 -1
- package/lib/components/ProductCard.es.js +186 -171
- package/lib/components/ProductDetailsLayout.cjs.js +1 -1
- package/lib/components/ProductDetailsLayout.es.js +405 -404
- package/lib/components/ProductGallery.cjs.js +1 -1
- package/lib/components/ProductGallery.d.ts +1 -1
- package/lib/components/ProductGallery.es.js +51 -54
- package/lib/components/ProductGrid.cjs.js +1 -1
- package/lib/components/ProductGrid.d.ts +1 -1
- package/lib/components/ProductGrid.es.js +23 -25
- package/lib/components/ShippingEstimator.cjs.js +1 -1
- package/lib/components/ShippingEstimator.d.ts +1 -1
- package/lib/components/ShippingEstimator.es.js +158 -153
- package/lib/components/ShortDescription.cjs.js +1 -1
- package/lib/components/ShortDescription.es.js +17 -17
- package/lib/components/SimpleTiptapRenderer.cjs.js +1 -1
- package/lib/components/SimpleTiptapRenderer.es.js +238 -211
- package/lib/components/SubscriptionSelector.cjs.js +1 -1
- package/lib/components/SubscriptionSelector.es.js +159 -154
- package/lib/countries.cjs.js +1 -1
- package/lib/countries.es.js +232 -75
- package/lib/coupon-server.cjs.js +1 -1
- package/lib/coupon-server.es.js +180 -224
- package/lib/coupons.cjs.js +1 -1
- package/lib/coupons.es.js +12 -14
- package/lib/currency-constants.cjs.js +1 -1
- package/lib/currency-constants.es.js +4 -4
- package/lib/currency-rest-client.cjs.js +1 -1
- package/lib/currency-rest-client.es.js +15 -22
- package/lib/currency-store.cjs.js +1 -1
- package/lib/currency-store.es.js +20 -27
- package/lib/currency-sync.cjs.js +1 -1
- package/lib/currency-sync.es.js +124 -170
- package/lib/currency.cjs.js +1 -1
- package/lib/currency.es.js +242 -310
- package/lib/customer-addresses.cjs.js +1 -1
- package/lib/customer-addresses.es.js +80 -109
- package/lib/customer-orders.cjs.js +1 -1
- package/lib/customer-orders.es.js +31 -43
- package/lib/customer.cjs.js +1 -1
- package/lib/customer.es.js +43 -52
- package/lib/export-helpers.cjs.js +1 -1
- package/lib/export-helpers.es.js +53 -52
- package/lib/factory.cjs.js +1 -1
- package/lib/factory.es.js +10 -7
- package/lib/freemius-coupons.cjs.js +1 -1
- package/lib/freemius-coupons.es.js +245 -262
- package/lib/freemius-license-claim.cjs.js +1 -1
- package/lib/freemius-license-claim.es.js +87 -71
- package/lib/freemius-license.cjs.js +1 -1
- package/lib/freemius-license.es.js +32 -39
- package/lib/freemius-order-sync.cjs.js +1 -1
- package/lib/freemius-order-sync.es.js +226 -290
- package/lib/freemius-trial-provision.cjs.js +1 -1
- package/lib/freemius-trial-provision.es.js +136 -130
- package/lib/inventory-settings.cjs.js +1 -1
- package/lib/inventory-settings.es.js +69 -77
- package/lib/invoice-server.cjs.js +3 -3
- package/lib/invoice-server.es.js +94 -141
- package/lib/invoice-ui.cjs.js +1 -1
- package/lib/invoice-ui.es.js +50 -66
- package/lib/invoice.cjs.js +1 -1
- package/lib/invoice.es.js +85 -94
- package/lib/order-inventory.cjs.js +25 -25
- package/lib/order-inventory.es.js +67 -79
- package/lib/order-tax-details.cjs.js +1 -1
- package/lib/order-tax-details.es.js +142 -153
- package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +1 -1
- package/lib/pages/cms/coupons/CouponEditorForm.d.ts +1 -1
- package/lib/pages/cms/coupons/CouponEditorForm.es.js +227 -185
- package/lib/pages/cms/coupons/CouponsPage.cjs.js +2 -2
- package/lib/pages/cms/coupons/CouponsPage.d.ts +1 -1
- package/lib/pages/cms/coupons/CouponsPage.es.js +235 -166
- package/lib/pages/cms/coupons/CreateCouponDialog.cjs.js +1 -1
- package/lib/pages/cms/coupons/CreateCouponDialog.d.ts +1 -1
- package/lib/pages/cms/coupons/CreateCouponDialog.es.js +35 -34
- package/lib/pages/cms/coupons/EditCouponPage.cjs.js +1 -1
- package/lib/pages/cms/coupons/EditCouponPage.d.ts +1 -1
- package/lib/pages/cms/coupons/EditCouponPage.es.js +47 -47
- package/lib/pages/cms/coupons/ProductScopePicker.cjs.js +1 -1
- package/lib/pages/cms/coupons/ProductScopePicker.d.ts +1 -1
- package/lib/pages/cms/coupons/ProductScopePicker.es.js +128 -117
- package/lib/pages/cms/coupons/actions.cjs.js +1 -1
- package/lib/pages/cms/coupons/actions.es.js +112 -115
- package/lib/pages/cms/coupons/index.cjs.js +1 -0
- package/lib/pages/cms/coupons/index.es.js +3 -0
- package/lib/pages/cms/coupons/product-options.cjs.js +1 -1
- package/lib/pages/cms/coupons/product-options.es.js +21 -23
- package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +1 -1
- package/lib/pages/cms/orders/ExportReportsDialog.es.js +135 -129
- package/lib/pages/cms/orders/MarkPaidButton.d.ts +1 -1
- package/lib/pages/cms/orders/OrderDetailPage.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderDetailPage.d.ts +1 -1
- package/lib/pages/cms/orders/OrderDetailPage.es.js +186 -134
- package/lib/pages/cms/orders/OrderPrintButton.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderPrintButton.d.ts +1 -1
- package/lib/pages/cms/orders/OrderPrintButton.es.js +15 -21
- package/lib/pages/cms/orders/OrderStatusForm.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderStatusForm.d.ts +1 -1
- package/lib/pages/cms/orders/OrderStatusForm.es.js +85 -69
- package/lib/pages/cms/orders/OrdersPage.cjs.js +1 -1
- package/lib/pages/cms/orders/OrdersPage.d.ts +1 -1
- package/lib/pages/cms/orders/OrdersPage.es.js +170 -102
- package/lib/pages/cms/orders/actions.cjs.js +3 -3
- package/lib/pages/cms/orders/actions.es.js +53 -69
- package/lib/pages/cms/orders/export-actions.cjs.js +1 -1
- package/lib/pages/cms/orders/export-actions.es.js +23 -26
- package/lib/pages/cms/orders/index.cjs.js +1 -0
- package/lib/pages/cms/orders/index.es.js +6 -0
- package/lib/pages/cms/orders/server-actions.cjs.js +1 -1
- package/lib/pages/cms/orders/server-actions.es.js +60 -51
- package/lib/pages/cms/payments/PaymentsClient.cjs.js +1 -1
- package/lib/pages/cms/payments/PaymentsClient.d.ts +1 -1
- package/lib/pages/cms/payments/PaymentsClient.es.js +316 -346
- package/lib/pages/cms/payments/PaymentsPage.cjs.js +1 -1
- package/lib/pages/cms/payments/PaymentsPage.d.ts +1 -1
- package/lib/pages/cms/payments/PaymentsPage.es.js +29 -32
- package/lib/pages/cms/payments/actions.cjs.js +1 -1
- package/lib/pages/cms/payments/actions.es.js +38 -48
- package/lib/pages/cms/payments/index.cjs.js +1 -0
- package/lib/pages/cms/payments/index.es.js +3 -0
- package/lib/pages/cms/payments/queries.cjs.js +1 -1
- package/lib/pages/cms/payments/queries.es.js +38 -48
- package/lib/pages/cms/products/ProductsPage.cjs.js +1 -1
- package/lib/pages/cms/products/ProductsPage.d.ts +1 -1
- package/lib/pages/cms/products/ProductsPage.es.js +63 -66
- package/lib/pages/cms/products/[id]/edit/EditProductPage.d.ts +1 -1
- package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +1 -1
- package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +138 -155
- package/lib/pages/cms/products/actions.cjs.js +4 -4
- package/lib/pages/cms/products/actions.es.js +121 -162
- package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +1 -1
- package/lib/pages/cms/products/attributes/AttributeManagementPage.d.ts +1 -1
- package/lib/pages/cms/products/attributes/AttributeManagementPage.es.js +55 -47
- package/lib/pages/cms/products/attributes/components/AttributeManager.cjs.js +1 -1
- package/lib/pages/cms/products/attributes/components/AttributeManager.d.ts +1 -1
- package/lib/pages/cms/products/attributes/components/AttributeManager.es.js +285 -290
- package/lib/pages/cms/products/categories/CategoryManagementPage.cjs.js +1 -1
- package/lib/pages/cms/products/categories/CategoryManagementPage.d.ts +1 -1
- package/lib/pages/cms/products/categories/CategoryManagementPage.es.js +43 -35
- package/lib/pages/cms/products/categories/components/CategoryManager.cjs.js +1 -1
- package/lib/pages/cms/products/categories/components/CategoryManager.es.js +315 -262
- package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +1 -1
- package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +115 -113
- package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +1 -1
- package/lib/pages/cms/products/components/CurrencyPriceFields.d.ts +1 -1
- package/lib/pages/cms/products/components/CurrencyPriceFields.es.js +136 -145
- package/lib/pages/cms/products/components/DeleteProductButton.cjs.js +1 -1
- package/lib/pages/cms/products/components/DeleteProductButton.d.ts +1 -1
- package/lib/pages/cms/products/components/DeleteProductButton.es.js +35 -47
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs.js +1 -1
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.d.ts +1 -1
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.es.js +106 -84
- package/lib/pages/cms/products/components/ProductCategorySelector.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductCategorySelector.es.js +156 -159
- package/lib/pages/cms/products/components/ProductForm.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductForm.es.js +872 -693
- package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductMediaManager.es.js +106 -103
- package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductsBulkTable.d.ts +1 -1
- package/lib/pages/cms/products/components/ProductsBulkTable.es.js +303 -294
- package/lib/pages/cms/products/components/SaleScheduleFields.cjs.js +1 -1
- package/lib/pages/cms/products/components/SaleScheduleFields.d.ts +1 -1
- package/lib/pages/cms/products/components/SaleScheduleFields.es.js +111 -134
- package/lib/pages/cms/products/components/SyncFreemiusButton.cjs.js +1 -1
- package/lib/pages/cms/products/components/SyncFreemiusButton.d.ts +1 -1
- package/lib/pages/cms/products/components/SyncFreemiusButton.es.js +29 -35
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs.js +2 -2
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.d.ts +1 -1
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.es.js +36 -48
- package/lib/pages/cms/products/components/SyncProductForm.d.ts +1 -1
- package/lib/pages/cms/products/components/VariationsEditor.cjs.js +1 -1
- package/lib/pages/cms/products/components/VariationsEditor.d.ts +1 -1
- package/lib/pages/cms/products/components/VariationsEditor.es.js +396 -405
- package/lib/pages/cms/products/index.cjs.js +1 -0
- package/lib/pages/cms/products/index.es.js +8 -0
- package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +1 -1
- package/lib/pages/cms/products/inventory/InventoryPage.d.ts +1 -1
- package/lib/pages/cms/products/inventory/InventoryPage.es.js +21 -15
- package/lib/pages/cms/products/inventory/InventoryTableClient.cjs.js +2 -2
- package/lib/pages/cms/products/inventory/InventoryTableClient.d.ts +1 -1
- package/lib/pages/cms/products/inventory/InventoryTableClient.es.js +230 -209
- package/lib/pages/cms/products/inventory/actions.cjs.js +3 -3
- package/lib/pages/cms/products/inventory/actions.es.js +83 -91
- package/lib/pages/cms/products/new/NewProductPage.cjs.js +1 -1
- package/lib/pages/cms/products/new/NewProductPage.d.ts +1 -1
- package/lib/pages/cms/products/new/NewProductPage.es.js +58 -74
- package/lib/pages/cms/products/product-price-sync.cjs.js +1 -1
- package/lib/pages/cms/products/product-price-sync.es.js +74 -89
- package/lib/pages/cms/products/server-actions.cjs.js +1 -1
- package/lib/pages/cms/products/server-actions.es.js +250 -233
- package/lib/pages/cms/shipping/ShippingPage.cjs.js +2 -2
- package/lib/pages/cms/shipping/ShippingPage.es.js +287 -209
- package/lib/pages/cms/shipping/components/RateForm.cjs.js +1 -1
- package/lib/pages/cms/shipping/components/RateForm.d.ts +1 -1
- package/lib/pages/cms/shipping/components/RateForm.es.js +439 -436
- package/lib/pages/cms/shipping/components/ZoneForm.cjs.js +1 -1
- package/lib/pages/cms/shipping/components/ZoneForm.es.js +245 -224
- package/lib/pages/cms/shipping/index.cjs.js +1 -0
- package/lib/pages/cms/shipping/index.es.js +3 -0
- package/lib/pages/cms/shipping/server-actions.cjs.js +1 -1
- package/lib/pages/cms/shipping/server-actions.es.js +131 -149
- package/lib/pages/cms/taxes/TaxesPage.cjs.js +1 -1
- package/lib/pages/cms/taxes/TaxesPage.d.ts +1 -1
- package/lib/pages/cms/taxes/TaxesPage.es.js +211 -169
- package/lib/pages/cms/taxes/actions.cjs.js +1 -1
- package/lib/pages/cms/taxes/actions.es.js +41 -53
- package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +1 -1
- package/lib/pages/cms/taxes/components/TaxRateForm.d.ts +1 -1
- package/lib/pages/cms/taxes/components/TaxRateForm.es.js +112 -99
- package/lib/pages/cms/taxes/index.cjs.js +1 -0
- package/lib/pages/cms/taxes/index.es.js +3 -0
- package/lib/payment-config.cjs.js +1 -1
- package/lib/payment-config.es.js +110 -126
- package/lib/product-actions.cjs.js +4 -4
- package/lib/product-actions.es.js +289 -544
- package/lib/product-context.cjs.js +1 -1
- package/lib/product-context.es.js +13 -15
- package/lib/product-schema.cjs.js +1 -1
- package/lib/product-schema.es.js +99 -134
- package/lib/providers/freemius.cjs.js +1 -5
- package/lib/providers/freemius.es.js +446 -530
- package/lib/providers/stripe.cjs.js +1 -1
- package/lib/providers/stripe.es.js +417 -477
- package/lib/server-actions/coupon-actions.cjs.js +1 -1
- package/lib/server-actions/coupon-actions.es.js +22 -22
- package/lib/server-actions/customer-actions.cjs.js +1 -1
- package/lib/server-actions/customer-actions.es.js +26 -28
- package/lib/server-actions/product-actions.cjs.js +1 -1
- package/lib/server-actions/product-actions.es.js +9 -15
- package/lib/server-actions/shipping-actions.cjs.js +1 -1
- package/lib/server-actions/shipping-actions.es.js +27 -24
- package/lib/server-actions/tax-actions.cjs.js +1 -1
- package/lib/server-actions/tax-actions.es.js +33 -39
- package/lib/shared-inventory.cjs.js +2 -2
- package/lib/shared-inventory.es.js +111 -160
- package/lib/shipping/resolver.cjs.js +2 -2
- package/lib/shipping/resolver.es.js +44 -61
- package/lib/shipping-rate-currency.cjs.js +1 -1
- package/lib/shipping-rate-currency.es.js +52 -67
- package/lib/states.cjs.js +1 -1
- package/lib/states.es.js +333 -154
- package/lib/stripe/checkout.cjs.js +1 -1
- package/lib/stripe/checkout.es.js +125 -181
- package/lib/stripe/client.cjs.js +1 -1
- package/lib/stripe/client.es.js +14 -19
- package/lib/stripe/order-sync.cjs.js +1 -1
- package/lib/stripe/order-sync.es.js +106 -126
- package/lib/stripe/webhooks.cjs.js +1 -1
- package/lib/stripe/webhooks.es.js +37 -31
- package/lib/tax-calculation.cjs.js +1 -1
- package/lib/tax-calculation.es.js +84 -98
- package/lib/trials.cjs.js +1 -1
- package/lib/trials.es.js +24 -30
- package/lib/types.cjs.js +1 -1
- package/lib/types.es.js +21 -27
- package/lib/use-cart.cjs.js +1 -1
- package/lib/use-cart.es.js +38 -40
- package/lib/use-price-formatter.cjs.js +1 -1
- package/lib/use-price-formatter.es.js +10 -11
- package/lib/variation-utils.cjs.js +1 -1
- package/lib/variation-utils.es.js +199 -261
- package/lib/zod-config.cjs.js +1 -1
- package/lib/zod-config.es.js +5 -6
- package/package.json +16 -16
- package/server.cjs.js +1 -1
- package/server.es.js +56 -211
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { toNoCookieEmbedSrc as e } from "./SimpleTiptapRenderer.es.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cn as t } from "@nextblock-cms/utils";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region libs/ecommerce/src/lib/components/ShortDescription.tsx
|
|
6
|
+
var r = /<\/?[a-z][^>]*>/i, i = (e) => r.test(e);
|
|
7
|
+
function a({ value: r, className: a }) {
|
|
8
|
+
let o = r?.trim();
|
|
9
|
+
return o ? i(o) ? /* @__PURE__ */ n("div", {
|
|
10
|
+
className: a,
|
|
11
|
+
dangerouslySetInnerHTML: { __html: e(o) ?? o }
|
|
12
|
+
}) : /* @__PURE__ */ n("p", {
|
|
13
|
+
className: t("whitespace-pre-line", a),
|
|
14
|
+
children: o
|
|
15
|
+
}) : null;
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
m as isHtmlShortDescription
|
|
18
|
-
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { a as ShortDescription, i as isHtmlShortDescription };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs.js");let t=require("react");t=e.__toESM(t,1);let n=require("react/jsx-runtime");var r=(e,t)=>t.reduce((e,t)=>{switch(t.type){case`bold`:return(0,n.jsx)(`strong`,{children:e});case`italic`:return(0,n.jsx)(`em`,{children:e});case`underline`:case`u`:return(0,n.jsx)(`u`,{children:e});case`strike`:return(0,n.jsx)(`s`,{children:e});case`code`:return(0,n.jsx)(`code`,{className:`bg-muted px-1.5 py-0.5 rounded text-[0.875em] font-mono`,children:e});case`link`:{let r=t.attrs?.href||`#`,i=t.attrs?.target||`_blank`;return(0,n.jsx)(`a`,{href:r,target:i,rel:`noopener noreferrer`,className:`underline text-primary hover:text-primary/80`,children:e})}case`highlight`:{let r=t.attrs?.color;return(0,n.jsx)(`mark`,{style:r?{backgroundColor:r}:{},className:r?void 0:`bg-yellow-200 dark:bg-yellow-800/50`,children:e})}case`subscript`:return(0,n.jsx)(`sub`,{children:e});case`superscript`:return(0,n.jsx)(`sup`,{children:e});case`textStyle`:{let r={};return t.attrs?.color&&(r.color=t.attrs.color),t.attrs?.fontSize&&(r.fontSize=t.attrs.fontSize),t.attrs?.fontFamily&&(r.fontFamily=t.attrs.fontFamily),Object.keys(r).length>0?(0,n.jsx)(`span`,{style:r,children:e}):(0,n.jsx)(n.Fragment,{children:e})}default:return e}},e),i=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],a=(e,n,r,a)=>{let o=i[Math.max(1,Math.min(6,e))-1],s=a?.id;return t.default.createElement(o,{key:r,className:`font-bold my-4`,id:s},n)},o=e=>{let t={},n={},r=e?.colspan,i=e?.rowspan,a=e?.colwidth;return r&&r>1&&(t.colSpan=r),i&&i>1&&(t.rowSpan=i),a&&Array.isArray(a)&&a[0]&&(n.minWidth=a[0]),Object.keys(n).length>0&&(t.style=n),t},s=(e,i)=>{if(e.type===`text`){let a=e.text??``;return(0,n.jsx)(t.default.Fragment,{children:e.marks?.length?r(a,e.marks):a},i)}let l=e.content?.map((e,t)=>s(e,t))??null;switch(e.type){case`doc`:return(0,n.jsx)(`div`,{children:l},i);case`paragraph`:{if(!e.content?.length||e.content.every(e=>e.type===`text`&&(!e.text||!e.text.trim())))return null;let t=e.attrs?.textAlign,r=t?{textAlign:t}:{};return(0,n.jsx)(`p`,{className:`mb-4`,style:Object.keys(r).length?r:void 0,children:l},i)}case`heading`:return a(e.attrs?.level||1,l,i,e.attrs??void 0);case`bulletList`:return(0,n.jsx)(`ul`,{className:`list-disc pl-5 mb-4`,children:l},i);case`orderedList`:{let t=e.attrs?.start??1;return(0,n.jsx)(`ol`,{className:`list-decimal pl-5 mb-4`,start:t===1?void 0:t,children:l},i)}case`listItem`:return(0,n.jsx)(`li`,{children:l},i);case`taskList`:return(0,n.jsx)(`ul`,{className:`list-none pl-0 mb-4 space-y-1`,children:l},i);case`taskItem`:{let t=!!e.attrs?.checked;return(0,n.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,n.jsx)(`input`,{type:`checkbox`,checked:t,readOnly:!0,className:`mt-1.5 rounded`}),(0,n.jsx)(`div`,{className:t?`line-through text-muted-foreground`:``,children:l})]},i)}case`blockquote`:return(0,n.jsx)(`blockquote`,{className:`border-l-4 border-border pl-4 italic my-4`,children:l},i);case`codeBlock`:{let t=e.attrs?.language;return(0,n.jsx)(`pre`,{className:`bg-muted rounded-lg p-4 mb-4 overflow-x-auto`,"data-language":t||void 0,children:(0,n.jsx)(`code`,{className:`text-sm font-mono`,children:l})},i)}case`horizontalRule`:return(0,n.jsx)(`hr`,{className:`my-6 border-border`},i);case`hardBreak`:return(0,n.jsx)(`br`,{},i);case`image`:{let t=e.attrs?.src,r=e.attrs?.alt||``,a=e.attrs?.title,o=e.attrs?.width,s=e.attrs?.height,c={};return o&&(c.width=typeof o==`number`?`${o}px`:o),s&&(c.height=typeof s==`number`?`${s}px`:s),(0,n.jsx)(`img`,{src:t,alt:r??``,title:a,width:typeof o==`number`?o:void 0,height:typeof s==`number`?s:void 0,loading:`lazy`,decoding:`async`,style:Object.keys(c).length?c:void 0,className:`max-w-full h-auto rounded my-4`},i)}case`table`:return(0,n.jsx)(`div`,{className:`overflow-x-auto my-4`,children:(0,n.jsx)(`table`,{className:`w-full border-collapse border border-gray-300 dark:border-gray-700`,style:{minWidth:500},children:(0,n.jsx)(`tbody`,{children:l})})},i);case`tableRow`:return(0,n.jsx)(`tr`,{className:`border-b border-gray-300 dark:border-gray-700`,children:l},i);case`tableHeader`:return(0,n.jsx)(`th`,{...o(e.attrs??void 0),className:`bg-gray-100 dark:bg-gray-800 font-bold p-3 text-left border border-gray-300 dark:border-gray-700`,children:l},i);case`tableCell`:return(0,n.jsx)(`td`,{...o(e.attrs??void 0),className:`p-3 border border-gray-300 dark:border-gray-700`,children:l},i);case`details`:return(0,n.jsx)(`details`,{className:`my-4 border rounded-lg overflow-hidden`,children:l},i);case`detailsSummary`:return(0,n.jsx)(`summary`,{className:`cursor-pointer p-3 font-semibold bg-muted/30 hover:bg-muted/50`,children:l},i);case`detailsContent`:return(0,n.jsx)(`div`,{className:`p-3 border-t`,children:l},i);case`youtube`:{let t=c(e.attrs?.src),r=e.attrs?.width||640,a=e.attrs?.height||480;return(0,n.jsx)(`div`,{className:`relative my-4 overflow-hidden rounded-lg`,style:{aspectRatio:`${r}/${a}`,maxWidth:r},children:(0,n.jsx)(`iframe`,{src:t,title:e.attrs?.title||`Embedded video`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,loading:`lazy`,className:`absolute inset-0 w-full h-full`})},i)}case`iframe`:{let t=c(e.attrs?.src);return(0,n.jsx)(`div`,{className:`my-4 overflow-hidden rounded-lg`,style:{aspectRatio:`16/9`},children:(0,n.jsx)(`iframe`,{src:t,title:e.attrs?.title||`Embedded content`,allowFullScreen:!0,loading:`lazy`,className:`w-full h-full border-0`})},i)}case`mention`:{let t=e.attrs?.label||e.attrs?.id||``;return(0,n.jsxs)(`span`,{className:`text-primary font-medium`,children:[`@`,t]},i)}default:return(0,n.jsx)(`div`,{children:l},i)}},c=e=>e?.replace(/(?:https?:)?\/\/(?:www\.|m\.|music\.)?youtube\.com\/embed\//gi,`https://www.youtube-nocookie.com/embed/`),l=({content:e,className:t})=>{if(!e)return null;if(typeof e==`string`){if(e.trim().startsWith(`{`)||e.trim().startsWith(`[`))try{let r=JSON.parse(e);return(0,n.jsx)(l,{content:r,className:t})}catch{}return(0,n.jsx)(`div`,{className:t,dangerouslySetInnerHTML:{__html:c(e)??e}})}let r=e;return!r.content||!Array.isArray(r.content)?null:(0,n.jsx)(`div`,{className:t,children:r.content.map((e,t)=>s(e,t))})};exports.SimpleTiptapRenderer=l,exports.toNoCookieEmbedSrc=c;
|
|
@@ -1,212 +1,239 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
1
|
+
import e from "react";
|
|
2
|
+
import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
//#region libs/ecommerce/src/lib/components/SimpleTiptapRenderer.tsx
|
|
4
|
+
var i = (e, r) => r.reduce((e, r) => {
|
|
5
|
+
switch (r.type) {
|
|
6
|
+
case "bold": return /* @__PURE__ */ n("strong", { children: e });
|
|
7
|
+
case "italic": return /* @__PURE__ */ n("em", { children: e });
|
|
8
|
+
case "underline":
|
|
9
|
+
case "u": return /* @__PURE__ */ n("u", { children: e });
|
|
10
|
+
case "strike": return /* @__PURE__ */ n("s", { children: e });
|
|
11
|
+
case "code": return /* @__PURE__ */ n("code", {
|
|
12
|
+
className: "bg-muted px-1.5 py-0.5 rounded text-[0.875em] font-mono",
|
|
13
|
+
children: e
|
|
14
|
+
});
|
|
15
|
+
case "link": {
|
|
16
|
+
let t = r.attrs?.href || "#", i = r.attrs?.target || "_blank";
|
|
17
|
+
return /* @__PURE__ */ n("a", {
|
|
18
|
+
href: t,
|
|
19
|
+
target: i,
|
|
20
|
+
rel: "noopener noreferrer",
|
|
21
|
+
className: "underline text-primary hover:text-primary/80",
|
|
22
|
+
children: e
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
case "highlight": {
|
|
26
|
+
let t = r.attrs?.color;
|
|
27
|
+
return /* @__PURE__ */ n("mark", {
|
|
28
|
+
style: t ? { backgroundColor: t } : {},
|
|
29
|
+
className: t ? void 0 : "bg-yellow-200 dark:bg-yellow-800/50",
|
|
30
|
+
children: e
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
case "subscript": return /* @__PURE__ */ n("sub", { children: e });
|
|
34
|
+
case "superscript": return /* @__PURE__ */ n("sup", { children: e });
|
|
35
|
+
case "textStyle": {
|
|
36
|
+
let i = {};
|
|
37
|
+
return r.attrs?.color && (i.color = r.attrs.color), r.attrs?.fontSize && (i.fontSize = r.attrs.fontSize), r.attrs?.fontFamily && (i.fontFamily = r.attrs.fontFamily), Object.keys(i).length > 0 ? /* @__PURE__ */ n("span", {
|
|
38
|
+
style: i,
|
|
39
|
+
children: e
|
|
40
|
+
}) : /* @__PURE__ */ n(t, { children: e });
|
|
41
|
+
}
|
|
42
|
+
default: return e;
|
|
43
|
+
}
|
|
44
|
+
}, e), a = [
|
|
45
|
+
"h1",
|
|
46
|
+
"h2",
|
|
47
|
+
"h3",
|
|
48
|
+
"h4",
|
|
49
|
+
"h5",
|
|
50
|
+
"h6"
|
|
51
|
+
], o = (t, n, r, i) => {
|
|
52
|
+
let o = a[Math.max(1, Math.min(6, t)) - 1], s = i?.id;
|
|
53
|
+
return e.createElement(o, {
|
|
54
|
+
key: r,
|
|
55
|
+
className: "font-bold my-4",
|
|
56
|
+
id: s
|
|
57
|
+
}, n);
|
|
58
|
+
}, s = (e) => {
|
|
59
|
+
let t = {}, n = {}, r = e?.colspan, i = e?.rowspan, a = e?.colwidth;
|
|
60
|
+
return r && r > 1 && (t.colSpan = r), i && i > 1 && (t.rowSpan = i), a && Array.isArray(a) && a[0] && (n.minWidth = a[0]), Object.keys(n).length > 0 && (t.style = n), t;
|
|
61
|
+
}, c = (t, a) => {
|
|
62
|
+
if (t.type === "text") {
|
|
63
|
+
let r = t.text ?? "";
|
|
64
|
+
return /* @__PURE__ */ n(e.Fragment, { children: t.marks?.length ? i(r, t.marks) : r }, a);
|
|
65
|
+
}
|
|
66
|
+
let u = t.content?.map((e, t) => c(e, t)) ?? null;
|
|
67
|
+
switch (t.type) {
|
|
68
|
+
case "doc": return /* @__PURE__ */ n("div", { children: u }, a);
|
|
69
|
+
case "paragraph": {
|
|
70
|
+
if (!t.content?.length || t.content.every((e) => e.type === "text" && (!e.text || !e.text.trim()))) return null;
|
|
71
|
+
let e = t.attrs?.textAlign, r = e ? { textAlign: e } : {};
|
|
72
|
+
return /* @__PURE__ */ n("p", {
|
|
73
|
+
className: "mb-4",
|
|
74
|
+
style: Object.keys(r).length ? r : void 0,
|
|
75
|
+
children: u
|
|
76
|
+
}, a);
|
|
77
|
+
}
|
|
78
|
+
case "heading": return o(t.attrs?.level || 1, u, a, t.attrs ?? void 0);
|
|
79
|
+
case "bulletList": return /* @__PURE__ */ n("ul", {
|
|
80
|
+
className: "list-disc pl-5 mb-4",
|
|
81
|
+
children: u
|
|
82
|
+
}, a);
|
|
83
|
+
case "orderedList": {
|
|
84
|
+
let e = t.attrs?.start ?? 1;
|
|
85
|
+
return /* @__PURE__ */ n("ol", {
|
|
86
|
+
className: "list-decimal pl-5 mb-4",
|
|
87
|
+
start: e === 1 ? void 0 : e,
|
|
88
|
+
children: u
|
|
89
|
+
}, a);
|
|
90
|
+
}
|
|
91
|
+
case "listItem": return /* @__PURE__ */ n("li", { children: u }, a);
|
|
92
|
+
case "taskList": return /* @__PURE__ */ n("ul", {
|
|
93
|
+
className: "list-none pl-0 mb-4 space-y-1",
|
|
94
|
+
children: u
|
|
95
|
+
}, a);
|
|
96
|
+
case "taskItem": {
|
|
97
|
+
let e = !!t.attrs?.checked;
|
|
98
|
+
return /* @__PURE__ */ r("li", {
|
|
99
|
+
className: "flex items-start gap-2",
|
|
100
|
+
children: [/* @__PURE__ */ n("input", {
|
|
101
|
+
type: "checkbox",
|
|
102
|
+
checked: e,
|
|
103
|
+
readOnly: !0,
|
|
104
|
+
className: "mt-1.5 rounded"
|
|
105
|
+
}), /* @__PURE__ */ n("div", {
|
|
106
|
+
className: e ? "line-through text-muted-foreground" : "",
|
|
107
|
+
children: u
|
|
108
|
+
})]
|
|
109
|
+
}, a);
|
|
110
|
+
}
|
|
111
|
+
case "blockquote": return /* @__PURE__ */ n("blockquote", {
|
|
112
|
+
className: "border-l-4 border-border pl-4 italic my-4",
|
|
113
|
+
children: u
|
|
114
|
+
}, a);
|
|
115
|
+
case "codeBlock": {
|
|
116
|
+
let e = t.attrs?.language;
|
|
117
|
+
return /* @__PURE__ */ n("pre", {
|
|
118
|
+
className: "bg-muted rounded-lg p-4 mb-4 overflow-x-auto",
|
|
119
|
+
"data-language": e || void 0,
|
|
120
|
+
children: /* @__PURE__ */ n("code", {
|
|
121
|
+
className: "text-sm font-mono",
|
|
122
|
+
children: u
|
|
123
|
+
})
|
|
124
|
+
}, a);
|
|
125
|
+
}
|
|
126
|
+
case "horizontalRule": return /* @__PURE__ */ n("hr", { className: "my-6 border-border" }, a);
|
|
127
|
+
case "hardBreak": return /* @__PURE__ */ n("br", {}, a);
|
|
128
|
+
case "image": {
|
|
129
|
+
let e = t.attrs?.src, r = t.attrs?.alt || "", i = t.attrs?.title, o = t.attrs?.width, s = t.attrs?.height, c = {};
|
|
130
|
+
return o && (c.width = typeof o == "number" ? `${o}px` : o), s && (c.height = typeof s == "number" ? `${s}px` : s), /* @__PURE__ */ n("img", {
|
|
131
|
+
src: e,
|
|
132
|
+
alt: r ?? "",
|
|
133
|
+
title: i,
|
|
134
|
+
width: typeof o == "number" ? o : void 0,
|
|
135
|
+
height: typeof s == "number" ? s : void 0,
|
|
136
|
+
loading: "lazy",
|
|
137
|
+
decoding: "async",
|
|
138
|
+
style: Object.keys(c).length ? c : void 0,
|
|
139
|
+
className: "max-w-full h-auto rounded my-4"
|
|
140
|
+
}, a);
|
|
141
|
+
}
|
|
142
|
+
case "table": return /* @__PURE__ */ n("div", {
|
|
143
|
+
className: "overflow-x-auto my-4",
|
|
144
|
+
children: /* @__PURE__ */ n("table", {
|
|
145
|
+
className: "w-full border-collapse border border-gray-300 dark:border-gray-700",
|
|
146
|
+
style: { minWidth: 500 },
|
|
147
|
+
children: /* @__PURE__ */ n("tbody", { children: u })
|
|
148
|
+
})
|
|
149
|
+
}, a);
|
|
150
|
+
case "tableRow": return /* @__PURE__ */ n("tr", {
|
|
151
|
+
className: "border-b border-gray-300 dark:border-gray-700",
|
|
152
|
+
children: u
|
|
153
|
+
}, a);
|
|
154
|
+
case "tableHeader": return /* @__PURE__ */ n("th", {
|
|
155
|
+
...s(t.attrs ?? void 0),
|
|
156
|
+
className: "bg-gray-100 dark:bg-gray-800 font-bold p-3 text-left border border-gray-300 dark:border-gray-700",
|
|
157
|
+
children: u
|
|
158
|
+
}, a);
|
|
159
|
+
case "tableCell": return /* @__PURE__ */ n("td", {
|
|
160
|
+
...s(t.attrs ?? void 0),
|
|
161
|
+
className: "p-3 border border-gray-300 dark:border-gray-700",
|
|
162
|
+
children: u
|
|
163
|
+
}, a);
|
|
164
|
+
case "details": return /* @__PURE__ */ n("details", {
|
|
165
|
+
className: "my-4 border rounded-lg overflow-hidden",
|
|
166
|
+
children: u
|
|
167
|
+
}, a);
|
|
168
|
+
case "detailsSummary": return /* @__PURE__ */ n("summary", {
|
|
169
|
+
className: "cursor-pointer p-3 font-semibold bg-muted/30 hover:bg-muted/50",
|
|
170
|
+
children: u
|
|
171
|
+
}, a);
|
|
172
|
+
case "detailsContent": return /* @__PURE__ */ n("div", {
|
|
173
|
+
className: "p-3 border-t",
|
|
174
|
+
children: u
|
|
175
|
+
}, a);
|
|
176
|
+
case "youtube": {
|
|
177
|
+
let e = l(t.attrs?.src), r = t.attrs?.width || 640, i = t.attrs?.height || 480;
|
|
178
|
+
return /* @__PURE__ */ n("div", {
|
|
179
|
+
className: "relative my-4 overflow-hidden rounded-lg",
|
|
180
|
+
style: {
|
|
181
|
+
aspectRatio: `${r}/${i}`,
|
|
182
|
+
maxWidth: r
|
|
183
|
+
},
|
|
184
|
+
children: /* @__PURE__ */ n("iframe", {
|
|
185
|
+
src: e,
|
|
186
|
+
title: t.attrs?.title || "Embedded video",
|
|
187
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
188
|
+
allowFullScreen: !0,
|
|
189
|
+
loading: "lazy",
|
|
190
|
+
className: "absolute inset-0 w-full h-full"
|
|
191
|
+
})
|
|
192
|
+
}, a);
|
|
193
|
+
}
|
|
194
|
+
case "iframe": {
|
|
195
|
+
let e = l(t.attrs?.src);
|
|
196
|
+
return /* @__PURE__ */ n("div", {
|
|
197
|
+
className: "my-4 overflow-hidden rounded-lg",
|
|
198
|
+
style: { aspectRatio: "16/9" },
|
|
199
|
+
children: /* @__PURE__ */ n("iframe", {
|
|
200
|
+
src: e,
|
|
201
|
+
title: t.attrs?.title || "Embedded content",
|
|
202
|
+
allowFullScreen: !0,
|
|
203
|
+
loading: "lazy",
|
|
204
|
+
className: "w-full h-full border-0"
|
|
205
|
+
})
|
|
206
|
+
}, a);
|
|
207
|
+
}
|
|
208
|
+
case "mention": {
|
|
209
|
+
let e = t.attrs?.label || t.attrs?.id || "";
|
|
210
|
+
return /* @__PURE__ */ r("span", {
|
|
211
|
+
className: "text-primary font-medium",
|
|
212
|
+
children: ["@", e]
|
|
213
|
+
}, a);
|
|
214
|
+
}
|
|
215
|
+
default: return /* @__PURE__ */ n("div", { children: u }, a);
|
|
216
|
+
}
|
|
217
|
+
}, l = (e) => e?.replace(/(?:https?:)?\/\/(?:www\.|m\.|music\.)?youtube\.com\/embed\//gi, "https://www.youtube-nocookie.com/embed/"), u = ({ content: e, className: t }) => {
|
|
218
|
+
if (!e) return null;
|
|
219
|
+
if (typeof e == "string") {
|
|
220
|
+
if (e.trim().startsWith("{") || e.trim().startsWith("[")) try {
|
|
221
|
+
let r = JSON.parse(e);
|
|
222
|
+
return /* @__PURE__ */ n(u, {
|
|
223
|
+
content: r,
|
|
224
|
+
className: t
|
|
225
|
+
});
|
|
226
|
+
} catch {}
|
|
227
|
+
return /* @__PURE__ */ n("div", {
|
|
228
|
+
className: t,
|
|
229
|
+
dangerouslySetInnerHTML: { __html: l(e) ?? e }
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
let r = e;
|
|
233
|
+
return !r.content || !Array.isArray(r.content) ? null : /* @__PURE__ */ n("div", {
|
|
234
|
+
className: t,
|
|
235
|
+
children: r.content.map((e, t) => c(e, t))
|
|
236
|
+
});
|
|
212
237
|
};
|
|
238
|
+
//#endregion
|
|
239
|
+
export { u as SimpleTiptapRenderer, l as toNoCookieEmbedSrc };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../currency.cjs.js"),n=require("../CurrencyProvider.cjs.js"),r=require("../use-cart.cjs.js"),i=require("../use-price-formatter.cjs.js"),a=require("../trials.cjs.js"),o=require("../pages/cms/products/actions.cjs.js");let s=require("@nextblock-cms/ui/button"),c=require("react");c=e.__toESM(c,1);let l=require("lucide-react"),u=require("@nextblock-cms/utils"),d=require("react/jsx-runtime"),f=require("sonner"),p=require("@nextblock-cms/ui/Skeleton");var m=({product:e})=>{let m=i.usePriceFormatter(),h=r.useCart(e=>e),{t:g}=(0,u.useTranslations)(),{activeCurrencyCode:_,currencies:v,defaultCurrency:y}=n.useCurrency(),[b,x]=(0,c.useState)([]),[S,C]=(0,c.useState)(!0),[w,T]=(0,c.useState)(`annual`);if((0,c.useEffect)(()=>{async function t(){try{if(!e.id)return;let t=await o.getPublicFreemiusPricing(e.id);x(t)}catch(e){console.error(`Failed to load pricing:`,e)}finally{C(!1)}}t()},[e.id]),!h)return(0,d.jsx)(p.Skeleton,{className:`h-14 w-full`});let{addItem:E}=h,D=b[0],O=D?.pricing?.[0],k=()=>{let n=e.price,r=e.freemius_plan_id;O&&(w===`monthly`&&O.monthly_price!=null&&(n=(0,u.majorUnitAmountToMinor)(O.monthly_price,y.code)),w===`annual`&&O.annual_price!=null&&(n=(0,u.majorUnitAmountToMinor)(O.annual_price,y.code)),w===`lifetime`&&O.lifetime_price!=null&&(n=(0,u.majorUnitAmountToMinor)(O.lifetime_price,y.code)));let i=v.reduce((e,r)=>(e[r.code]=t.convertMinorUnitAmount({amount:n,fromCurrencyCode:y.code,toCurrencyCode:r.code,currencies:v,applyRounding:!0}),e),{}),a=i[_]??n;D&&D.id&&(r=D.id);let{success:o,error:s}=E({id:e.id,product_id:e.id,title:e.title,price:a,prices:i,image_url:e.image_url,slug:e.slug,sku:e.sku,language_id:e.language_id,translation_group_id:e.translation_group_id,product_type:`digital`,payment_provider:`freemius`,provider:`freemius`,billing_cycle:w,freemius_product_id:e.freemius_product_id,freemius_plan_id:r,trial_period_days:e.trial_period_days??0,trial_requires_payment_method:e.trial_requires_payment_method??!1,is_taxable:e.is_taxable,currency_code:_});o?f.toast.success(g(`ecommerce.added_to_cart_success`,{item:e.title})):f.toast.error(s||g(`ecommerce.added_to_cart_error`))};if(S)return(0,d.jsx)(p.Skeleton,{className:`h-32 w-full`});if(!D||!O)return(0,d.jsx)(`div`,{className:`p-4 border border-dashed rounded-lg text-center text-muted-foreground`,children:g(`ecommerce.pricing_unavailable`)});let A=O.monthly_price!=null,j=O.annual_price!=null,M=O.lifetime_price!=null;w===`annual`&&!j&&(A?T(`monthly`):M&&T(`lifetime`));let N=a.getTrialSummary(e,g),P=e.price;return w===`monthly`&&O.monthly_price!=null&&(P=t.convertMinorUnitAmount({amount:(0,u.majorUnitAmountToMinor)(O.monthly_price,y.code),fromCurrencyCode:y.code,toCurrencyCode:_,currencies:v,applyRounding:!0})),w===`annual`&&O.annual_price!=null&&(P=t.convertMinorUnitAmount({amount:(0,u.majorUnitAmountToMinor)(O.annual_price,y.code),fromCurrencyCode:y.code,toCurrencyCode:_,currencies:v,applyRounding:!0})),w===`lifetime`&&O.lifetime_price!=null&&(P=t.convertMinorUnitAmount({amount:(0,u.majorUnitAmountToMinor)(O.lifetime_price,y.code),fromCurrencyCode:y.code,toCurrencyCode:_,currencies:v,applyRounding:!0})),(0,d.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,d.jsxs)(`div`,{role:`group`,"aria-label":g(`ecommerce.billing_cycle`)===`ecommerce.billing_cycle`?`Billing cycle`:g(`ecommerce.billing_cycle`),className:`flex bg-secondary/35 p-1 rounded-lg w-full max-w-sm mx-auto shadow-inner`,children:[A&&(0,d.jsx)(`button`,{type:`button`,"aria-pressed":w===`monthly`,onClick:()=>T(`monthly`),className:`flex-1 py-1.5 text-xs font-semibold rounded-md transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring ${w===`monthly`?`bg-background shadow-sm text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:g(`ecommerce.monthly`)}),j&&(0,d.jsx)(`button`,{type:`button`,"aria-pressed":w===`annual`,onClick:()=>T(`annual`),className:`flex-1 py-1.5 text-xs font-semibold rounded-md transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring ${w===`annual`?`bg-background shadow-sm text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:g(`ecommerce.annual`)}),M&&(0,d.jsx)(`button`,{type:`button`,"aria-pressed":w===`lifetime`,onClick:()=>T(`lifetime`),className:`flex-1 py-1.5 text-xs font-semibold rounded-md transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring ${w===`lifetime`?`bg-background shadow-sm text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:g(`ecommerce.lifetime`)})]}),(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`span`,{className:`text-3xl font-extrabold text-foreground tabular-nums`,children:m(P,_)}),w!==`lifetime`&&(0,d.jsxs)(`span`,{className:`text-muted-foreground text-sm ml-1.5`,children:[`/ `,g(w===`annual`?`ecommerce.year`:`ecommerce.month`)]}),N&&(0,d.jsxs)(`div`,{className:`mt-1 text-xs font-medium text-emerald-600 dark:text-emerald-400`,children:[N.label,(0,d.jsx)(`span`,{className:`mx-2 text-muted-foreground/50`,children:`|`}),(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:N.paymentRequirementLabel})]})]}),(0,d.jsxs)(s.Button,{onClick:k,className:`w-full h-12 text-base font-bold shadow-md transition-shadow hover:shadow-lg active:scale-[0.98]`,children:[(0,d.jsx)(l.ShoppingCart,{className:`mr-2 h-4 w-4`}),N?.label?g(`ecommerce.start_trial`,{trial:N.label})===`ecommerce.start_trial`?`Start ${N.label}`:g(`ecommerce.start_trial`,{trial:N.label}):g(`ecommerce.get_license`)]})]})};exports.SubscriptionSelector=m;
|