@bigbinary/neeto-molecules 5.3.18 → 5.3.20

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.
@@ -0,0 +1,16 @@
1
+ import { isPresent } from '@bigbinary/neeto-cist';
2
+ import { toLower } from 'ramda';
3
+
4
+ var getNeetoUrl = function getNeetoUrl(subdomain) {
5
+ var _globalProps;
6
+ return "https://".concat(subdomain, ".").concat(toLower(((_globalProps = globalProps) === null || _globalProps === void 0 ? void 0 : _globalProps.appName) || ""), ".com");
7
+ };
8
+ var getProductBillingUrl = function getProductBillingUrl() {
9
+ var _globalProps$organiza;
10
+ var billingOverviewUrl = "".concat((_globalProps$organiza = globalProps.organization) === null || _globalProps$organiza === void 0 ? void 0 : _globalProps$organiza.authAppUrl, "/admin/billing/overview");
11
+ var productSlug = toLower(globalProps.appName || "");
12
+ return isPresent(productSlug) ? "".concat(billingOverviewUrl, "/products/").concat(productSlug) : billingOverviewUrl;
13
+ };
14
+
15
+ export { getProductBillingUrl as a, getNeetoUrl as g };
16
+ //# sourceMappingURL=urls-DC61u0b2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urls-DC61u0b2.js","sources":["../src/utils/urls.js"],"sourcesContent":["import { isPresent } from \"neetocist\";\nimport { toLower } from \"ramda\";\n\nexport const getNeetoUrl = subdomain =>\n `https://${subdomain}.${toLower(globalProps?.appName || \"\")}.com`;\n\nexport const getProductBillingUrl = () => {\n const billingOverviewUrl = `${globalProps.organization?.authAppUrl}/admin/billing/overview`;\n const productSlug = toLower(globalProps.appName || \"\");\n\n return isPresent(productSlug)\n ? `${billingOverviewUrl}/products/${productSlug}`\n : billingOverviewUrl;\n};\n"],"names":["getNeetoUrl","subdomain","_globalProps","concat","toLower","globalProps","appName","getProductBillingUrl","_globalProps$organiza","billingOverviewUrl","organization","authAppUrl","productSlug","isPresent"],"mappings":";;;IAGaA,WAAW,GAAG,SAAdA,WAAWA,CAAGC,SAAS,EAAA;AAAA,EAAA,IAAAC,YAAA;EAAA,OAAA,UAAA,CAAAC,MAAA,CACvBF,SAAS,EAAA,GAAA,CAAA,CAAAE,MAAA,CAAIC,OAAO,CAAC,CAAA,CAAAF,YAAA,GAAAG,WAAW,MAAA,IAAA,IAAAH,YAAA,KAAA,MAAA,GAAA,MAAA,GAAXA,YAAA,CAAaI,OAAO,KAAI,EAAE,CAAC,EAAA,MAAA,CAAA;AAAA;IAEhDC,oBAAoB,GAAG,SAAvBA,oBAAoBA,GAAS;AAAA,EAAA,IAAAC,qBAAA;AACxC,EAAA,IAAMC,kBAAkB,GAAA,EAAA,CAAAN,MAAA,CAAA,CAAAK,qBAAA,GAAMH,WAAW,CAACK,YAAY,cAAAF,qBAAA,KAAA,MAAA,GAAA,MAAA,GAAxBA,qBAAA,CAA0BG,UAAU,EAAA,yBAAA,CAAyB;EAC3F,IAAMC,WAAW,GAAGR,OAAO,CAACC,WAAW,CAACC,OAAO,IAAI,EAAE,CAAC;AAEtD,EAAA,OAAOO,SAAS,CAACD,WAAW,CAAC,GAAA,EAAA,CAAAT,MAAA,CACtBM,kBAAkB,EAAA,YAAA,CAAA,CAAAN,MAAA,CAAaS,WAAW,IAC7CH,kBAAkB;AACxB;;;;"}
@@ -21,8 +21,8 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
21
21
  import { useQuery } from '@tanstack/react-query';
22
22
  import axios from 'axios';
23
23
  import { S as Search } from '../search-H0uYy0W-.js';
24
+ import { g as getNeetoUrl, a as getProductBillingUrl } from '../urls-DC61u0b2.js';
24
25
  import useBreakpoints from '@bigbinary/neeto-commons-frontend/v2/react-utils/useBreakpoints';
25
- import { g as getNeetoUrl } from '../urls-CN1MpSwF.js';
26
26
  import { t } from 'i18next';
27
27
  import { c as createLucideIcon } from '../createLucideIcon--oLqczpc.js';
28
28
  import { C as CircleQuestionMark } from '../circle-question-mark-B807GLZf.js';
@@ -1333,29 +1333,30 @@ var ProfileMenu = function ProfileMenu(_ref) {
1333
1333
  var isAuthenticated = profileInfo.isAuthenticated;
1334
1334
  var _useTranslation = useTranslation(),
1335
1335
  t = _useTranslation.t;
1336
- var normalizedPlan = (((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.subscriptionPlan) || "").toLowerCase();
1337
- var isFreePlan = normalizedPlan === "free";
1336
+
1337
+ // A paid plan can be named more than one thing, so the badge follows the
1338
+ // isPro flag the backend sends alongside the plan; the plan name is display
1339
+ // text only.
1340
+ var isPro = Boolean((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.isPro);
1338
1341
  var isOwner = (_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.isOwner;
1339
- var showUpgradeModal = isFreePlan && enableSubscriptionUpgradeRequest && !isOwner;
1342
+ var showUpgradeModal = !isPro && enableSubscriptionUpgradeRequest && !isOwner;
1340
1343
  var getSubscriptionPlanAction = function getSubscriptionPlanAction() {
1341
1344
  if (showUpgradeModal) return {
1342
1345
  onClick: openUpgradeModal
1343
1346
  };
1344
- if (isFreePlan && isOwner && enableSubscriptionUpgradeRequest) {
1345
- var _globalProps$organiza;
1347
+ if (!isPro && isOwner && enableSubscriptionUpgradeRequest) {
1346
1348
  return {
1347
- href: "".concat((_globalProps$organiza = globalProps.organization) === null || _globalProps$organiza === void 0 ? void 0 : _globalProps$organiza.authAppUrl, "/admin/billing/overview")
1349
+ href: getProductBillingUrl()
1348
1350
  };
1349
1351
  }
1350
1352
  return {
1351
1353
  href: NEETO_AUTH_BILLING_INFO_URL
1352
1354
  };
1353
1355
  };
1354
- var isProPlan = normalizedPlan === "pro";
1355
1356
  var subscriptionPlanLink = _objectSpread$2({
1356
1357
  label: /*#__PURE__*/jsxs("span", {
1357
1358
  className: "flex items-center gap-2",
1358
- children: [globalProps.appName, isProPlan ? /*#__PURE__*/jsx(Badge, {
1359
+ children: [globalProps.appName, isPro ? /*#__PURE__*/jsx(Badge, {
1359
1360
  label: humanize((_globalProps$user3 = globalProps.user) === null || _globalProps$user3 === void 0 ? void 0 : _globalProps$user3.subscriptionPlan),
1360
1361
  style: {
1361
1362
  "--accent-foreground": "var(--color-amber-950)"