@mintlify/common 1.0.618 → 1.0.620

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,7 @@
1
+ export type DisplayDomainDeployment = {
2
+ subdomain: string;
3
+ basePath: string;
4
+ customDomains?: string[];
5
+ auth?: unknown;
6
+ };
7
+ export declare function getDisplayDomain(deployment: DisplayDomainDeployment, isDev?: boolean): string;
@@ -0,0 +1,63 @@
1
+ const CUSTOM_DEPLOYMENT_SUBDOMAINS = ['auth0', 'docs-dev', 'docs-staging'];
2
+ const CUSTOM_DEPLOYMENT_DOMAINS = {
3
+ auth0: 'auth0-mintlify.app',
4
+ 'docs-dev': 'auth0-mintlify.app',
5
+ 'docs-staging': 'auth0-mintlify.app',
6
+ };
7
+ function isCustomDeployment(subdomain) {
8
+ return CUSTOM_DEPLOYMENT_SUBDOMAINS.some((validSubdomain) => validSubdomain === subdomain);
9
+ }
10
+ function getCustomDeploymentDomain(subdomain) {
11
+ return CUSTOM_DEPLOYMENT_DOMAINS[subdomain];
12
+ }
13
+ function getSubdomain(deployment) {
14
+ if (deployment.auth) {
15
+ switch (deployment.basePath) {
16
+ case '/docs':
17
+ return 'mintlify-auth-docs.com';
18
+ default: {
19
+ return 'mintlify.io';
20
+ }
21
+ }
22
+ }
23
+ if (isCustomDeployment(deployment.subdomain)) {
24
+ return getCustomDeploymentDomain(deployment.subdomain);
25
+ }
26
+ switch (deployment.basePath) {
27
+ case '/docs':
28
+ return 'mintlify.dev';
29
+ case '/help':
30
+ return 'mintlify.help';
31
+ case '/wiki':
32
+ return 'mintlify.wiki';
33
+ case '/developers':
34
+ return 'mintlify.de';
35
+ case '/academy':
36
+ return 'mintlify.academy';
37
+ case '/connect':
38
+ return 'mintlify-connect.com';
39
+ case '/go':
40
+ return 'mintlify-go.com';
41
+ case '/cloud':
42
+ return 'mintlify.cloud';
43
+ case '/handbook':
44
+ return 'mintlify-handbook.com';
45
+ case '/blog':
46
+ return 'mintlify.blog';
47
+ case '/ai/docs':
48
+ return 'mintlify-ai-docs.com';
49
+ case '/doc':
50
+ return 'mintlify-doc.com';
51
+ default:
52
+ return 'mintlify.app';
53
+ }
54
+ }
55
+ export function getDisplayDomain(deployment, isDev = false) {
56
+ var _a, _b, _c;
57
+ const { subdomain } = deployment;
58
+ if (isDev && !((_a = deployment.customDomains) === null || _a === void 0 ? void 0 : _a[0])) {
59
+ return `${subdomain}.mintlifytest.com`;
60
+ }
61
+ const displayDomainBase = (_c = (_b = deployment.customDomains) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : `${subdomain}.${getSubdomain(deployment)}`;
62
+ return displayDomainBase + deployment.basePath;
63
+ }
package/dist/index.d.ts CHANGED
@@ -25,3 +25,4 @@ export * from './services/aws.js';
25
25
  export * from './truncateAtWordBoundary.js';
26
26
  export * from './api-reference/parseApiTargetFromMetadata.js';
27
27
  export * from './mintIgnore.js';
28
+ export * from './getDisplayDomain.js';
package/dist/index.js CHANGED
@@ -25,3 +25,4 @@ export * from './services/aws.js';
25
25
  export * from './truncateAtWordBoundary.js';
26
26
  export * from './api-reference/parseApiTargetFromMetadata.js';
27
27
  export * from './mintIgnore.js';
28
+ export * from './getDisplayDomain.js';
@@ -1,5 +1,11 @@
1
1
  import { u } from 'unist-builder';
2
2
  import { visit } from 'unist-util-visit';
3
+ const isInsideTile = (parent) => {
4
+ if (parent && 'name' in parent && parent.name === 'Tile') {
5
+ return true;
6
+ }
7
+ return false;
8
+ };
3
9
  export const rehypeZoomImages = () => (tree) => {
4
10
  visit(tree, 'mdxJsxFlowElement', (node, index, parent) => {
5
11
  if (node.name === 'img' ||
@@ -7,16 +13,17 @@ export const rehypeZoomImages = () => (tree) => {
7
13
  node.name === 'figure' ||
8
14
  node.name === 'iframe') {
9
15
  const noZoom = node.attributes.find((attr) => attr.type === 'mdxJsxAttribute' && attr.name === 'noZoom');
16
+ const shouldSkipZoom = noZoom || isInsideTile(parent);
10
17
  if (parent && index != null) {
11
18
  // For img elements, replace with OptimizedImage (it applies Zoom internally)
12
- if (node.name === 'img') {
19
+ if (node.name === 'img' && !shouldSkipZoom) {
13
20
  const optimizedImg = u('mdxJsxFlowElement', {
14
21
  name: 'OptimizedImage',
15
22
  attributes: node.attributes,
16
23
  }, []);
17
24
  parent.children.splice(index, 1, optimizedImg);
18
25
  }
19
- else if (!noZoom) {
26
+ else if (!shouldSkipZoom) {
20
27
  parent.children.splice(index, 1, u('element', {
21
28
  tagName: 'ZoomImage',
22
29
  properties: {},
package/dist/mdx/utils.js CHANGED
@@ -62,6 +62,7 @@ export const allowedComponents = [
62
62
  'CustomComponent',
63
63
  'DynamicCustomComponent',
64
64
  'Danger',
65
+ 'Tile',
65
66
  'SnippetGroup',
66
67
  'Panel',
67
68
  'RequestExample',