autumn-js
Version:
Autumn JS Library
81 lines (78 loc) • 2.84 kB
JavaScript
"use client";
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/libraries/react/components/paywall-dialog/lib/paywall-content.tsx
var paywall_content_exports = {};
__export(paywall_content_exports, {
getPaywallContent: () => getPaywallContent
});
module.exports = __toCommonJS(paywall_content_exports);
var getPaywallContent = (preview) => {
if (!preview) {
return {
title: "Feature Unavailable",
message: "This feature is not available for your account."
};
}
const { scenario, products, feature_name } = preview;
if (products.length == 0) {
switch (scenario) {
case "usage_limit":
return {
title: `Feature Unavailable`,
message: `You have reached the usage limit for ${feature_name}. Please contact us to increase your limit.`
};
default:
return {
title: "Feature Unavailable",
message: "This feature is not available for your account. Please contact us to enable it."
};
}
}
const nextProduct = products[0];
const isAddOn = nextProduct && nextProduct.is_add_on;
const title = nextProduct.free_trial ? `Start trial for ${nextProduct.name}` : nextProduct.is_add_on ? `Purchase ${nextProduct.name}` : `Upgrade to ${nextProduct.name}`;
let message = "";
if (isAddOn) {
message = `Please purchase the ${nextProduct.name} add-on to continue using ${feature_name}.`;
} else {
message = `Please upgrade to the ${nextProduct.name} plan to continue using ${feature_name}.`;
}
switch (scenario) {
case "usage_limit":
return {
title,
message: `You have reached the usage limit for ${feature_name}. ${message}`
};
case "feature_flag":
return {
title,
message: `This feature is not available for your account. ${message}`
};
default:
return {
title: "Feature Unavailable",
message: "This feature is not available for your account."
};
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getPaywallContent
});