@linktr.ee/linkapp 0.0.48 → 0.0.49
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.
- package/README.md +1 -1
- package/dev-server/components/form/array-field.tsx +115 -0
- package/dev-server/components/form/file-field.tsx +48 -0
- package/dev-server/components/form/form-element.tsx +304 -0
- package/dev-server/components/form/link-behavior-field.tsx +68 -0
- package/dev-server/components/form/location-field.tsx +60 -0
- package/dev-server/components/settings-preview.tsx +138 -302
- package/dev-server/components/ui/checkbox.tsx +29 -0
- package/dev-server/components/ui/dialog.tsx +2 -10
- package/dev-server/components/ui/field.tsx +24 -49
- package/dev-server/components/ui/input.tsx +20 -21
- package/dev-server/components/ui/label.tsx +4 -4
- package/dev-server/components/ui/radio-group.tsx +37 -0
- package/dev-server/components/ui/select.tsx +153 -0
- package/dev-server/components/ui/switch.tsx +31 -0
- package/dev-server/components/ui/tabs.tsx +1 -1
- package/dev-server/components/ui/textarea.tsx +18 -19
- package/dev-server/env.d.ts +4 -1
- package/dev-server/expanded/main.tsx +20 -22
- package/dev-server/expanded.html +0 -1
- package/dev-server/featured/main.tsx +29 -36
- package/dev-server/featured-carousel.html +0 -1
- package/dev-server/featured.html +0 -1
- package/dev-server/index.html +1 -7
- package/dev-server/lib/utils.ts +3 -3
- package/dev-server/package.json +3 -3
- package/dev-server/postcss/tailwind-source-fallback.js +2 -7
- package/dev-server/postcss.config.mjs +2 -2
- package/dev-server/preview/Preview.tsx +310 -350
- package/dev-server/preview/main.tsx +8 -8
- package/dev-server/preview/preview.css +0 -1
- package/dev-server/public/site.webmanifest +1 -1
- package/dev-server/rsbuild.config.ts +1 -1
- package/dev-server/shared/dev-parent-simulator.ts +219 -0
- package/dev-server/shared/theme-presets.ts +71 -75
- package/dev-server/shared/theme-utils.ts +11 -11
- package/dist/cli.js +18 -12
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +27 -42
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +26 -16
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/deploy.d.ts +1 -11
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +3 -13
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +132 -388
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +17 -29
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts.map +1 -1
- package/dist/commands/logout.js +6 -11
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/rollback.d.ts +10 -0
- package/dist/commands/rollback.d.ts.map +1 -0
- package/dist/commands/rollback.js +148 -0
- package/dist/commands/rollback.js.map +1 -0
- package/dist/commands/status.d.ts +8 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +96 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/test-url-match-rules.d.ts.map +1 -1
- package/dist/commands/test-url-match-rules.js +20 -26
- package/dist/commands/test-url-match-rules.js.map +1 -1
- package/dist/lib/auth/device-flow.d.ts +1 -1
- package/dist/lib/auth/device-flow.d.ts.map +1 -1
- package/dist/lib/auth/device-flow.js +3 -3
- package/dist/lib/auth/device-flow.js.map +1 -1
- package/dist/lib/auth/token-storage.d.ts.map +1 -1
- package/dist/lib/auth/token-storage.js +14 -37
- package/dist/lib/auth/token-storage.js.map +1 -1
- package/dist/lib/build/detect-layouts.d.ts.map +1 -1
- package/dist/lib/build/detect-layouts.js +27 -13
- package/dist/lib/build/detect-layouts.js.map +1 -1
- package/dist/lib/config/load-config.d.ts.map +1 -1
- package/dist/lib/config/load-config.js +0 -2
- package/dist/lib/config/load-config.js.map +1 -1
- package/dist/lib/deploy/deploy-output.d.ts +2 -1
- package/dist/lib/deploy/deploy-output.d.ts.map +1 -1
- package/dist/lib/deploy/deploy-output.js +9 -1
- package/dist/lib/deploy/deploy-output.js.map +1 -1
- package/dist/lib/deploy/deploy-phases.d.ts +2 -0
- package/dist/lib/deploy/deploy-phases.d.ts.map +1 -1
- package/dist/lib/deploy/deploy-phases.js +9 -23
- package/dist/lib/deploy/deploy-phases.js.map +1 -1
- package/dist/lib/deploy/deploy-utils.d.ts +15 -7
- package/dist/lib/deploy/deploy-utils.d.ts.map +1 -1
- package/dist/lib/deploy/deploy-utils.js +49 -36
- package/dist/lib/deploy/deploy-utils.js.map +1 -1
- package/dist/lib/deploy/generate-manifest-files.d.ts.map +1 -1
- package/dist/lib/deploy/generate-manifest-files.js +13 -39
- package/dist/lib/deploy/generate-manifest-files.js.map +1 -1
- package/dist/lib/deploy/pack-project.d.ts.map +1 -1
- package/dist/lib/deploy/pack-project.js +34 -20
- package/dist/lib/deploy/pack-project.js.map +1 -1
- package/dist/lib/deploy/slot-manager.d.ts +54 -0
- package/dist/lib/deploy/slot-manager.d.ts.map +1 -0
- package/dist/lib/deploy/slot-manager.js +72 -0
- package/dist/lib/deploy/slot-manager.js.map +1 -0
- package/dist/lib/deploy/test-url-match-rules.d.ts +10 -2
- package/dist/lib/deploy/test-url-match-rules.d.ts.map +1 -1
- package/dist/lib/deploy/test-url-match-rules.js +1 -1
- package/dist/lib/deploy/test-url-match-rules.js.map +1 -1
- package/dist/lib/deploy/upload.d.ts +1 -0
- package/dist/lib/deploy/upload.d.ts.map +1 -1
- package/dist/lib/deploy/upload.js +15 -24
- package/dist/lib/deploy/upload.js.map +1 -1
- package/dist/lib/deploy/validation.d.ts.map +1 -1
- package/dist/lib/deploy/validation.js +43 -48
- package/dist/lib/deploy/validation.js.map +1 -1
- package/dist/lib/rsbuild/config-factory.d.ts.map +1 -1
- package/dist/lib/rsbuild/config-factory.js +10 -17
- package/dist/lib/rsbuild/config-factory.js.map +1 -1
- package/dist/lib/rsbuild/plugins/asset-versioning.d.ts.map +1 -1
- package/dist/lib/rsbuild/plugins/asset-versioning.js +4 -14
- package/dist/lib/rsbuild/plugins/asset-versioning.js.map +1 -1
- package/dist/lib/rsbuild/plugins/brotli-compression.d.ts.map +1 -1
- package/dist/lib/rsbuild/plugins/brotli-compression.js +4 -4
- package/dist/lib/rsbuild/plugins/brotli-compression.js.map +1 -1
- package/dist/lib/rsbuild/plugins/copy-public.d.ts.map +1 -1
- package/dist/lib/rsbuild/plugins/copy-public.js.map +1 -1
- package/dist/lib/rsbuild/postcss/tailwind-source-fallback.d.ts.map +1 -1
- package/dist/lib/rsbuild/postcss/tailwind-source-fallback.js +1 -3
- package/dist/lib/rsbuild/postcss/tailwind-source-fallback.js.map +1 -1
- package/dist/lib/utils/console.d.ts +8 -0
- package/dist/lib/utils/console.d.ts.map +1 -0
- package/dist/lib/utils/console.js +10 -0
- package/dist/lib/utils/console.js.map +1 -0
- package/dist/lib/utils/filesystem.d.ts +9 -0
- package/dist/lib/utils/filesystem.d.ts.map +1 -0
- package/dist/lib/utils/filesystem.js +30 -0
- package/dist/lib/utils/filesystem.js.map +1 -0
- package/dist/lib/utils/formatters.d.ts +8 -0
- package/dist/lib/utils/formatters.d.ts.map +1 -0
- package/dist/lib/utils/formatters.js +22 -0
- package/dist/lib/utils/formatters.js.map +1 -0
- package/dist/lib/utils/index.d.ts +7 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +7 -0
- package/dist/lib/utils/index.js.map +1 -0
- package/dist/lib/utils/setup-runtime.d.ts.map +1 -1
- package/dist/lib/utils/setup-runtime.js +22 -63
- package/dist/lib/utils/setup-runtime.js.map +1 -1
- package/dist/schema/config.schema.d.ts +9 -48
- package/dist/schema/config.schema.d.ts.map +1 -1
- package/dist/schema/config.schema.js +119 -120
- package/dist/schema/config.schema.js.map +1 -1
- package/dist/sdk/hooks/mocks.d.ts +9 -0
- package/dist/sdk/hooks/mocks.d.ts.map +1 -0
- package/dist/sdk/hooks/mocks.js +17 -0
- package/dist/sdk/hooks/mocks.js.map +1 -0
- package/dist/sdk/hooks/use-audience-manager.d.ts +44 -0
- package/dist/sdk/hooks/use-audience-manager.d.ts.map +1 -0
- package/dist/sdk/hooks/use-audience-manager.js +109 -0
- package/dist/sdk/hooks/use-audience-manager.js.map +1 -0
- package/dist/sdk/hooks/use-ip.d.ts +45 -0
- package/dist/sdk/hooks/use-ip.d.ts.map +1 -0
- package/dist/sdk/hooks/use-ip.js +46 -0
- package/dist/sdk/hooks/use-ip.js.map +1 -0
- package/dist/sdk/hooks/use-sdk-request.d.ts +46 -0
- package/dist/sdk/hooks/use-sdk-request.d.ts.map +1 -0
- package/dist/sdk/hooks/use-sdk-request.js +65 -0
- package/dist/sdk/hooks/use-sdk-request.js.map +1 -0
- package/dist/sdk/hooks/use-theme.d.ts +45 -0
- package/dist/sdk/hooks/use-theme.d.ts.map +1 -0
- package/dist/sdk/hooks/use-theme.js +97 -0
- package/dist/sdk/hooks/use-theme.js.map +1 -0
- package/dist/sdk/hooks/use-visitor.d.ts +41 -0
- package/dist/sdk/hooks/use-visitor.d.ts.map +1 -0
- package/dist/sdk/hooks/use-visitor.js +42 -0
- package/dist/sdk/hooks/use-visitor.js.map +1 -0
- package/dist/sdk/hooks/validation.d.ts +8 -0
- package/dist/sdk/hooks/validation.d.ts.map +1 -0
- package/dist/sdk/hooks/validation.js +13 -0
- package/dist/sdk/hooks/validation.js.map +1 -0
- package/dist/sdk/index.d.ts +17 -5
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +16 -5
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/message-bus.d.ts +59 -0
- package/dist/sdk/message-bus.d.ts.map +1 -0
- package/dist/sdk/message-bus.js +152 -0
- package/dist/sdk/message-bus.js.map +1 -0
- package/dist/sdk/messages.d.ts +121 -0
- package/dist/sdk/messages.d.ts.map +1 -0
- package/dist/sdk/messages.js +9 -0
- package/dist/sdk/messages.js.map +1 -0
- package/dist/sdk/send-message.d.ts +1 -1
- package/dist/sdk/send-message.js +18 -18
- package/dist/sdk/send-message.js.map +1 -1
- package/dist/sdk/use-expand-link-app.d.ts +3 -3
- package/dist/sdk/use-expand-link-app.d.ts.map +1 -1
- package/dist/sdk/use-expand-link-app.js +9 -5
- package/dist/sdk/use-expand-link-app.js.map +1 -1
- package/dist/types.d.ts +235 -55
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -3
- package/dist/types.js.map +1 -1
- package/package.json +3 -9
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filesystem utilities
|
|
3
|
+
*/
|
|
4
|
+
import { readdirSync, statSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
/**
|
|
7
|
+
* Recursively calculates the total size of a directory in bytes.
|
|
8
|
+
* Returns 0 if the directory cannot be read.
|
|
9
|
+
*/
|
|
10
|
+
export function getDirSize(dirPath) {
|
|
11
|
+
let totalSize = 0;
|
|
12
|
+
try {
|
|
13
|
+
const files = readdirSync(dirPath);
|
|
14
|
+
for (const file of files) {
|
|
15
|
+
const filePath = join(dirPath, file);
|
|
16
|
+
const stats = statSync(filePath);
|
|
17
|
+
if (stats.isDirectory()) {
|
|
18
|
+
totalSize += getDirSize(filePath);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
totalSize += stats.size;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Return 0 if directory cannot be read
|
|
27
|
+
}
|
|
28
|
+
return totalSize;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=filesystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../../src/lib/utils/filesystem.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,IAAI,SAAS,GAAG,CAAC,CAAA;IAEjB,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;QAElC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;YACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;YAEhC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,SAAS,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAA;YACnC,CAAC;iBAAM,CAAC;gBACN,SAAS,IAAI,KAAK,CAAC,IAAI,CAAA;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,uCAAuC;IACzC,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/formatters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAY3D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting utilities for CLI output
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Formats a timestamp as relative time (e.g., "5m ago", "2h ago", "3d ago")
|
|
6
|
+
*/
|
|
7
|
+
export function formatVersionAge(deployedAt) {
|
|
8
|
+
const deployed = new Date(deployedAt);
|
|
9
|
+
const now = new Date();
|
|
10
|
+
const diffMs = now.getTime() - deployed.getTime();
|
|
11
|
+
const diffMins = Math.floor(diffMs / 60000);
|
|
12
|
+
const diffHours = Math.floor(diffMins / 60);
|
|
13
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
14
|
+
if (diffMins < 1)
|
|
15
|
+
return 'just now';
|
|
16
|
+
if (diffMins < 60)
|
|
17
|
+
return `${diffMins}m ago`;
|
|
18
|
+
if (diffHours < 24)
|
|
19
|
+
return `${diffHours}h ago`;
|
|
20
|
+
return `${diffDays}d ago`;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../src/lib/utils/formatters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IACjD,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAA;IACrC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAA;IACtB,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAA;IACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAA;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAA;IAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC,CAAA;IAE3C,IAAI,QAAQ,GAAG,CAAC;QAAE,OAAO,UAAU,CAAA;IACnC,IAAI,QAAQ,GAAG,EAAE;QAAE,OAAO,GAAG,QAAQ,OAAO,CAAA;IAC5C,IAAI,SAAS,GAAG,EAAE;QAAE,OAAO,GAAG,SAAS,OAAO,CAAA;IAC9C,OAAO,GAAG,QAAQ,OAAO,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-runtime.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/setup-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-runtime.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/setup-runtime.ts"],"names":[],"mappings":"AA8NA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAsBtD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from
|
|
2
|
-
import { dirname, join } from
|
|
3
|
-
import { fileURLToPath } from
|
|
4
|
-
import { detectLayouts } from
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { detectLayouts } from '../build/detect-layouts.js';
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = dirname(__filename);
|
|
7
7
|
/**
|
|
@@ -11,67 +11,38 @@ function generateMainTsx(projectPath) {
|
|
|
11
11
|
const detection = detectLayouts(projectPath);
|
|
12
12
|
const layouts = detection.layouts;
|
|
13
13
|
const hasLayout = detection.hasLayout;
|
|
14
|
-
const expandedLayout = layouts.find((layout) => layout.name ===
|
|
15
|
-
|
|
16
|
-
const imports = layouts
|
|
17
|
-
.map((layout) => `import ${layout.displayName} from '../app/${layout.fileName}'`)
|
|
18
|
-
.join("\n");
|
|
14
|
+
const expandedLayout = layouts.find((layout) => layout.name === 'expanded');
|
|
15
|
+
const imports = layouts.map((layout) => `import ${layout.displayName} from '../app/${layout.fileName}'`).join('\n');
|
|
19
16
|
// Legacy alias: keep sheet for backwards compatibility with older layout keys
|
|
20
17
|
const layoutAliases = [];
|
|
21
18
|
if (expandedLayout) {
|
|
22
19
|
layoutAliases.push(` sheet: ${expandedLayout.displayName},`);
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
const layoutImport = hasLayout
|
|
26
|
-
? `import Layout from '../app/layout.tsx'`
|
|
27
|
-
: "";
|
|
28
|
-
// Generate layouts object
|
|
21
|
+
const layoutImport = hasLayout ? `import Layout from '../app/layout.tsx'` : '';
|
|
29
22
|
const layoutsObj = [
|
|
30
23
|
...layouts.map((layout) => {
|
|
31
24
|
// Quote keys that contain hyphens
|
|
32
|
-
const key = layout.name.includes(
|
|
25
|
+
const key = layout.name.includes('-') ? `'${layout.name}'` : layout.name;
|
|
33
26
|
return ` ${key}: ${layout.displayName},`;
|
|
34
27
|
}),
|
|
35
28
|
...layoutAliases,
|
|
36
|
-
].join(
|
|
37
|
-
// Generate the wrapper logic - use Layout if it exists, otherwise render directly
|
|
29
|
+
].join('\n');
|
|
38
30
|
const renderLogic = hasLayout
|
|
39
31
|
? ` <Layout>
|
|
40
32
|
<LayoutComponent {...data} />
|
|
41
33
|
</Layout>`
|
|
42
|
-
:
|
|
34
|
+
: ' <LayoutComponent {...data} />';
|
|
43
35
|
return `import { StrictMode } from 'react'
|
|
44
36
|
import { createRoot } from 'react-dom/client'
|
|
37
|
+
import type { ExtensionData } from '@linktr.ee/linkapp/types'
|
|
45
38
|
${layoutImport}
|
|
46
39
|
${imports}
|
|
47
40
|
import '../app/globals.css'
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
const layouts: Record<string, React.ComponentType<any>> = {
|
|
42
|
+
const layouts: Record<string, React.ComponentType<ExtensionData>> = {
|
|
51
43
|
${layoutsObj}
|
|
52
44
|
}
|
|
53
45
|
|
|
54
|
-
// Type for extension data from parent iframe
|
|
55
|
-
type ExtensionData = {
|
|
56
|
-
__linkUrl?: string
|
|
57
|
-
__thumbnail?: string
|
|
58
|
-
__linkParams?: any
|
|
59
|
-
__environment?: any
|
|
60
|
-
__layout?: string
|
|
61
|
-
groupLayoutOption?: string
|
|
62
|
-
__theme?: {
|
|
63
|
-
cssVariables: Record<string, string>
|
|
64
|
-
font?: {
|
|
65
|
-
fontFamily: string
|
|
66
|
-
fontStyle?: string
|
|
67
|
-
cssUrl?: string
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
displayType?: string
|
|
71
|
-
[key: string]: any
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Declare global window properties for theme and font application
|
|
75
46
|
declare global {
|
|
76
47
|
interface Window {
|
|
77
48
|
__linkapp_applyTheme?: (variables: Record<string, string>) => void
|
|
@@ -120,12 +91,10 @@ const mockContext: ExtensionData = {
|
|
|
120
91
|
}
|
|
121
92
|
|
|
122
93
|
function App({ data }: { data: ExtensionData }) {
|
|
123
|
-
// Get layout and groupLayoutOption from extension data (production), query parameters (dev), or defaults
|
|
124
94
|
const params = new URLSearchParams(window.location.search)
|
|
125
95
|
const baseLayout = data.__layout || params.get('layout') || 'classic'
|
|
126
96
|
const groupLayoutOption = data.groupLayoutOption || params.get('groupLayoutOption')
|
|
127
97
|
|
|
128
|
-
// Simple layout selection with context-aware fallbacks
|
|
129
98
|
let LayoutComponent
|
|
130
99
|
|
|
131
100
|
if (baseLayout === 'featured' && groupLayoutOption === 'carousel') {
|
|
@@ -139,17 +108,14 @@ function App({ data }: { data: ExtensionData }) {
|
|
|
139
108
|
LayoutComponent = layouts.expanded || layouts.sheet
|
|
140
109
|
}
|
|
141
110
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
console.
|
|
111
|
+
if (!LayoutComponent) {
|
|
112
|
+
// Only log when there's an actual error (missing layout)
|
|
113
|
+
console.error('[LinkApp] Layout not found:', {
|
|
145
114
|
__layout: data.__layout,
|
|
146
115
|
groupLayoutOption: data.groupLayoutOption,
|
|
147
116
|
baseLayout,
|
|
148
117
|
availableLayouts: Object.keys(layouts),
|
|
149
118
|
})
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (!LayoutComponent) {
|
|
153
119
|
return (
|
|
154
120
|
<div style={{ padding: '20px', fontFamily: 'system-ui' }}>
|
|
155
121
|
<h1>Error: Layout not found</h1>
|
|
@@ -195,12 +161,10 @@ const root =
|
|
|
195
161
|
linkappWindow.__linkappRoot = root
|
|
196
162
|
|
|
197
163
|
const renderApp = (data: ExtensionData) => {
|
|
198
|
-
// Apply theme CSS variables if provided
|
|
199
164
|
if (data.__theme?.cssVariables && window.__linkapp_applyTheme) {
|
|
200
165
|
window.__linkapp_applyTheme(data.__theme.cssVariables)
|
|
201
166
|
}
|
|
202
167
|
|
|
203
|
-
// Apply font if provided
|
|
204
168
|
if (data.__theme?.font && window.__linkapp_applyFont) {
|
|
205
169
|
window.__linkapp_applyFont(data.__theme.font)
|
|
206
170
|
}
|
|
@@ -227,12 +191,10 @@ if (isInIframe) {
|
|
|
227
191
|
return
|
|
228
192
|
}
|
|
229
193
|
|
|
230
|
-
// Render app with data from parent
|
|
231
194
|
renderApp(event.data.data ?? {})
|
|
232
195
|
window.removeEventListener('message', handler)
|
|
233
196
|
})
|
|
234
197
|
|
|
235
|
-
// Send extension-loaded message to parent
|
|
236
198
|
window.parent.postMessage({ type: 'extension-loaded' }, '*')
|
|
237
199
|
|
|
238
200
|
// Forward interaction events to parent for analytics
|
|
@@ -255,25 +217,22 @@ if (isInIframe) {
|
|
|
255
217
|
*/
|
|
256
218
|
export function setupRuntime(projectPath) {
|
|
257
219
|
try {
|
|
258
|
-
const linkappDir = join(projectPath,
|
|
259
|
-
const runtimeSourceDir = join(__dirname,
|
|
260
|
-
// Create .linkapp directory if it doesn't exist
|
|
220
|
+
const linkappDir = join(projectPath, '.linkapp');
|
|
221
|
+
const runtimeSourceDir = join(__dirname, '..', '..', '..', 'runtime');
|
|
261
222
|
if (!existsSync(linkappDir)) {
|
|
262
223
|
mkdirSync(linkappDir, { recursive: true });
|
|
263
224
|
}
|
|
264
|
-
|
|
265
|
-
const indexHtmlPath = join(runtimeSourceDir, "index.html");
|
|
225
|
+
const indexHtmlPath = join(runtimeSourceDir, 'index.html');
|
|
266
226
|
if (!existsSync(indexHtmlPath)) {
|
|
267
227
|
throw new Error(`Runtime file not found: ${indexHtmlPath}`);
|
|
268
228
|
}
|
|
269
|
-
const indexHtml = readFileSync(indexHtmlPath,
|
|
270
|
-
writeFileSync(join(linkappDir,
|
|
271
|
-
// Generate and write main.tsx dynamically based on detected layouts
|
|
229
|
+
const indexHtml = readFileSync(indexHtmlPath, 'utf-8');
|
|
230
|
+
writeFileSync(join(linkappDir, 'index.html'), indexHtml, 'utf-8');
|
|
272
231
|
const mainTsx = generateMainTsx(projectPath);
|
|
273
|
-
writeFileSync(join(linkappDir,
|
|
232
|
+
writeFileSync(join(linkappDir, 'main.tsx'), mainTsx, 'utf-8');
|
|
274
233
|
}
|
|
275
234
|
catch (error) {
|
|
276
|
-
console.error(
|
|
235
|
+
console.error('Failed to setup runtime files:', error);
|
|
277
236
|
throw error;
|
|
278
237
|
}
|
|
279
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-runtime.js","sourceRoot":"","sources":["../../../src/lib/utils/setup-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"setup-runtime.js","sourceRoot":"","sources":["../../../src/lib/utils/setup-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,E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AG,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;QACtD,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAEjE,MAAM,OAAO,GAAG,eAAe,CAAC,WAAW,CAAC,CAAA;QAC5C,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAC/D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAA;QACtD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
declare const linkTypeCategoryV2Schema: z.ZodEnum<{
|
|
3
3
|
"tours-and-shows": "tours-and-shows";
|
|
4
4
|
"social-media": "social-media";
|
|
@@ -15,26 +15,6 @@ declare const linkTypeCategoryV2Schema: z.ZodEnum<{
|
|
|
15
15
|
forms: "forms";
|
|
16
16
|
scheduling: "scheduling";
|
|
17
17
|
}>;
|
|
18
|
-
declare const featuredChinPositionSchema: z.ZodEnum<{
|
|
19
|
-
minimal: "minimal";
|
|
20
|
-
above: "above";
|
|
21
|
-
below: "below";
|
|
22
|
-
overlayBelow: "overlayBelow";
|
|
23
|
-
overlayAbove: "overlayAbove";
|
|
24
|
-
}>;
|
|
25
|
-
declare const sheetBehaviorSchema: z.ZodEnum<{
|
|
26
|
-
default: "default";
|
|
27
|
-
none: "none";
|
|
28
|
-
expandGeneric: "expandGeneric";
|
|
29
|
-
expandVideo: "expandVideo";
|
|
30
|
-
}>;
|
|
31
|
-
declare const featuredHeadClickBehaviorSchema: z.ZodEnum<{
|
|
32
|
-
default: "default";
|
|
33
|
-
custom: "custom";
|
|
34
|
-
linkOff: "linkOff";
|
|
35
|
-
expand: "expand";
|
|
36
|
-
inlineVideoPlayer: "inlineVideoPlayer";
|
|
37
|
-
}>;
|
|
38
18
|
declare const themeSchema: z.ZodObject<{
|
|
39
19
|
isOutlineStyle: z.ZodOptional<z.ZodBoolean>;
|
|
40
20
|
cssVariables: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
@@ -75,7 +55,7 @@ declare const preview_props_schema: z.ZodObject<{
|
|
|
75
55
|
accordion: "accordion";
|
|
76
56
|
dialog: "dialog";
|
|
77
57
|
}>>;
|
|
78
|
-
linkTitle: z.
|
|
58
|
+
linkTitle: z.ZodString;
|
|
79
59
|
__environment: z.ZodOptional<z.ZodObject<{
|
|
80
60
|
GRAPH_ENDPOINT: z.ZodOptional<z.ZodString>;
|
|
81
61
|
RECAPTCHA_SITE_KEY: z.ZodOptional<z.ZodString>;
|
|
@@ -104,6 +84,7 @@ declare const preview_props_schema: z.ZodObject<{
|
|
|
104
84
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
105
85
|
declare const linkAppConfigSchema: z.ZodObject<{
|
|
106
86
|
manifest: z.ZodObject<{
|
|
87
|
+
id: z.ZodOptional<z.ZodString>;
|
|
107
88
|
name: z.ZodString;
|
|
108
89
|
tagline: z.ZodString;
|
|
109
90
|
description: z.ZodArray<z.ZodString>;
|
|
@@ -152,9 +133,12 @@ declare const linkAppConfigSchema: z.ZodObject<{
|
|
|
152
133
|
title: z.ZodString;
|
|
153
134
|
icon: z.ZodOptional<z.ZodEnum<{
|
|
154
135
|
file: "file";
|
|
136
|
+
text: "text";
|
|
155
137
|
settings: "settings";
|
|
156
138
|
text_and_media: "text_and_media";
|
|
157
|
-
|
|
139
|
+
coupon: "coupon";
|
|
140
|
+
"question-mark": "question-mark";
|
|
141
|
+
reviews: "reviews";
|
|
158
142
|
}>>;
|
|
159
143
|
uses_url: z.ZodOptional<z.ZodBoolean>;
|
|
160
144
|
has_url: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -162,6 +146,7 @@ declare const linkAppConfigSchema: z.ZodObject<{
|
|
|
162
146
|
overview: z.ZodOptional<z.ZodObject<{
|
|
163
147
|
title: z.ZodOptional<z.ZodString>;
|
|
164
148
|
description: z.ZodString;
|
|
149
|
+
supportLink: z.ZodOptional<z.ZodString>;
|
|
165
150
|
}, z.core.$strip>>;
|
|
166
151
|
setup_instructions: z.ZodOptional<z.ZodObject<{
|
|
167
152
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -170,27 +155,6 @@ declare const linkAppConfigSchema: z.ZodObject<{
|
|
|
170
155
|
elements: z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>;
|
|
171
156
|
has_settings: z.ZodOptional<z.ZodBoolean>;
|
|
172
157
|
supports_featured_layout: z.ZodOptional<z.ZodBoolean>;
|
|
173
|
-
featured_chin_position: z.ZodOptional<z.ZodEnum<{
|
|
174
|
-
minimal: "minimal";
|
|
175
|
-
above: "above";
|
|
176
|
-
below: "below";
|
|
177
|
-
overlayBelow: "overlayBelow";
|
|
178
|
-
overlayAbove: "overlayAbove";
|
|
179
|
-
}>>;
|
|
180
|
-
featured_head_allow_unlocked_aspect_ratio: z.ZodOptional<z.ZodBoolean>;
|
|
181
|
-
sheet_behavior: z.ZodOptional<z.ZodEnum<{
|
|
182
|
-
default: "default";
|
|
183
|
-
none: "none";
|
|
184
|
-
expandGeneric: "expandGeneric";
|
|
185
|
-
expandVideo: "expandVideo";
|
|
186
|
-
}>>;
|
|
187
|
-
featured_head_click_behavior: z.ZodOptional<z.ZodEnum<{
|
|
188
|
-
default: "default";
|
|
189
|
-
custom: "custom";
|
|
190
|
-
linkOff: "linkOff";
|
|
191
|
-
expand: "expand";
|
|
192
|
-
inlineVideoPlayer: "inlineVideoPlayer";
|
|
193
|
-
}>>;
|
|
194
158
|
}, z.core.$strip>;
|
|
195
159
|
url_match_rules: z.ZodOptional<z.ZodObject<{
|
|
196
160
|
hostnames: z.ZodArray<z.ZodString>;
|
|
@@ -222,7 +186,7 @@ declare const linkAppConfigSchema: z.ZodObject<{
|
|
|
222
186
|
accordion: "accordion";
|
|
223
187
|
dialog: "dialog";
|
|
224
188
|
}>>;
|
|
225
|
-
linkTitle: z.
|
|
189
|
+
linkTitle: z.ZodString;
|
|
226
190
|
__environment: z.ZodOptional<z.ZodObject<{
|
|
227
191
|
GRAPH_ENDPOINT: z.ZodOptional<z.ZodString>;
|
|
228
192
|
RECAPTCHA_SITE_KEY: z.ZodOptional<z.ZodString>;
|
|
@@ -255,9 +219,6 @@ export type PreviewProps = z.infer<typeof preview_props_schema>;
|
|
|
255
219
|
export type LinkAppTheme = z.infer<typeof themeSchema>;
|
|
256
220
|
export type Viewport = z.infer<typeof viewportSchema>;
|
|
257
221
|
export type Position = z.infer<typeof positionSchema>;
|
|
258
|
-
export type FeaturedChinPosition = z.infer<typeof featuredChinPositionSchema>;
|
|
259
|
-
export type SheetBehavior = z.infer<typeof sheetBehaviorSchema>;
|
|
260
|
-
export type FeaturedHeadClickBehavior = z.infer<typeof featuredHeadClickBehaviorSchema>;
|
|
261
222
|
export type LinkTypeCategoryV2 = z.infer<typeof linkTypeCategoryV2Schema>;
|
|
262
223
|
export {};
|
|
263
224
|
//# sourceMappingURL=config.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.schema.d.ts","sourceRoot":"","sources":["../../src/schema/config.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"config.schema.d.ts","sourceRoot":"","sources":["../../src/schema/config.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAuCvB,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;EAe5B,CAAA;AAwNF,QAAA,MAAM,WAAW;;;;;;;;;;iBAWf,CAAA;AAEF,QAAA,MAAM,cAAc;;;iBAGlB,CAAA;AAEF,QAAA,MAAM,cAAc;;;iBAGlB,CAAA;AAGF,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAyBF,CAAA;AAGxB,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKvB,CAAA;AAGF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAC/D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AACtD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AACrD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AACrD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
|