Merge branch 'master' into beta

This commit is contained in:
Abdullah Atta
2025-10-10 15:53:32 +05:00
5 changed files with 36 additions and 19 deletions

View File

@@ -50,7 +50,6 @@ const TRIAL_PERIODS: Record<Period, number> = {
};
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
};

View File

@@ -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

View File

@@ -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 () => {

View File

@@ -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());
}
}
}

View File

@@ -69,10 +69,7 @@ export function TableComponent(props: ReactNodeViewProps) {
/>
</DesktopOnly>
<SimpleBar autoHide>
<Box
dir={textDirection}
sx={{ "& table": { width: "100% !important" } }}
>
<Box dir={textDirection}>
<table
ref={(ref) => {
forwardRef?.(ref);