diff --git a/apps/web/src/dialogs/buy-dialog/helpers.ts b/apps/web/src/dialogs/buy-dialog/helpers.ts index e58451abe..e124cb9fd 100644 --- a/apps/web/src/dialogs/buy-dialog/helpers.ts +++ b/apps/web/src/dialogs/buy-dialog/helpers.ts @@ -50,7 +50,6 @@ const TRIAL_PERIODS: Record = { }; export function toPricingInfo(plan: Plan, user: User | undefined): PricingInfo { - console.log("TO PRICING INFO", plan); return { country: plan.country, period: plan.period, @@ -58,9 +57,9 @@ export function toPricingInfo(plan: Plan, user: User | undefined): PricingInfo { currency: plan.currency, id: plan.id, period: plan.period, - subtotal: formatPrice(plan.price.gross, plan.currency), + subtotal: formatPrice(plan.price.net, plan.currency), tax: formatPrice(plan.price.tax, plan.currency), - total: formatPrice(plan.price.net, plan.currency), + total: formatPrice(plan.price.gross, plan.currency), trial_period: isTrialAvailableForPlan(plan.plan, user) ? { frequency: TRIAL_PERIODS[plan.period] @@ -74,9 +73,9 @@ export function toPricingInfo(plan: Plan, user: User | undefined): PricingInfo { currency: plan.currency, id: plan.id, period: plan.period, - subtotal: formatPrice(plan.price.gross, plan.currency), + subtotal: formatPrice(plan.price.net, plan.currency), tax: formatPrice(plan.price.tax, plan.currency), - total: formatPrice(plan.price.net, plan.currency) + total: formatPrice(plan.price.gross, plan.currency) } : undefined }; diff --git a/apps/web/src/dialogs/buy-dialog/paddle.tsx b/apps/web/src/dialogs/buy-dialog/paddle.tsx index 8962454e2..6ede7a03b 100644 --- a/apps/web/src/dialogs/buy-dialog/paddle.tsx +++ b/apps/web/src/dialogs/buy-dialog/paddle.tsx @@ -245,7 +245,7 @@ function getPricingInfo( id: price.price_id, period: options.period, subtotal: formatPrice( - data.recurring_totals.subtotal, + data.recurring_totals.subtotal - data.recurring_totals.discount, data.currency_code ), total: formatPrice(data.recurring_totals.total, data.currency_code), @@ -256,7 +256,10 @@ function getPricingInfo( currency: data.currency_code, id: price.price_id, period: options.period, - subtotal: formatPrice(totals.subtotal, data.currency_code), + subtotal: formatPrice( + totals.subtotal - totals.discount, + data.currency_code + ), total: formatPrice(totals.total, data.currency_code), tax: formatPrice(totals.tax, data.currency_code), trial_period: price.trial_period diff --git a/apps/web/src/views/checkout.tsx b/apps/web/src/views/checkout.tsx index d6c29afd2..d1afb2f09 100644 --- a/apps/web/src/views/checkout.tsx +++ b/apps/web/src/views/checkout.tsx @@ -119,7 +119,7 @@ function Checkout() { useEffect(() => { if (currentStep === 2) { - var event = EV.subscribe(EVENTS.userSubscriptionUpdated, () => { + const event = EV.subscribe(EVENTS.userSubscriptionUpdated, () => { hardNavigate("/notes#/welcome"); }); return () => { diff --git a/packages/editor/src/extensions/clipboard/clipboard-dom-parser.ts b/packages/editor/src/extensions/clipboard/clipboard-dom-parser.ts index cd4b48230..8eededd5e 100644 --- a/packages/editor/src/extensions/clipboard/clipboard-dom-parser.ts +++ b/packages/editor/src/extensions/clipboard/clipboard-dom-parser.ts @@ -42,7 +42,7 @@ export class ClipboardDOMParser extends ProsemirrorDOMParser { convertGoogleDocsChecklist(dom); formatCodeblocks(dom); convertBrToSingleSpacedParagraphs(dom); - removeImages(dom); + removePremiumFeatures(dom); removeBlockId(dom); } return super.parseSlice(dom, options); @@ -53,7 +53,7 @@ export class ClipboardDOMParser extends ProsemirrorDOMParser { convertGoogleDocsChecklist(dom); formatCodeblocks(dom); convertBrToSingleSpacedParagraphs(dom); - removeImages(dom); + removePremiumFeatures(dom); removeBlockId(dom); } return super.parse(dom, options); @@ -154,11 +154,29 @@ export function convertGoogleDocsChecklist(dom: HTMLElement | Document) { } } -export function removeImages(dom: HTMLElement | Document) { - let canInsertImages: boolean | null = null; - for (const img of dom.querySelectorAll(`img`)) { - canInsertImages = canInsertImages ?? hasPermission("insertImage"); - if (!canInsertImages) img.remove(); +const premiumFeatures = [ + { + selector: "div.callout", + permission: "setCallout" + }, + { + selector: 'ul[data-type="outlineList"]', + permission: "toggleOutlineList" + }, + { + selector: "ul.checklist", + permission: "toggleTaskList" + } +] as const; + +function removePremiumFeatures(dom: HTMLElement | Document) { + for (const feature of premiumFeatures) { + const elements = dom.querySelectorAll(feature.selector); + if (elements.length === 0) continue; + + if (!hasPermission(feature.permission)) { + elements.forEach((element) => element.remove()); + } } } diff --git a/packages/editor/src/extensions/table/component.tsx b/packages/editor/src/extensions/table/component.tsx index 36b2bd856..dec310723 100644 --- a/packages/editor/src/extensions/table/component.tsx +++ b/packages/editor/src/extensions/table/component.tsx @@ -69,10 +69,7 @@ export function TableComponent(props: ReactNodeViewProps) { /> - + { forwardRef?.(ref);