@linktr.ee/linkapp 0.0.9 → 0.0.11
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/dev-server/classic/main.tsx +46 -8
- package/dev-server/classic.html +58 -0
- package/dev-server/components/ui/dialog.tsx +19 -42
- package/dev-server/components/ui/tabs.tsx +6 -6
- package/dev-server/featured/main.tsx +46 -8
- package/dev-server/featured.html +58 -0
- package/dev-server/lib/utils.ts +2 -2
- package/dev-server/preview/Preview.tsx +428 -15
- package/dev-server/vite.config.ts +11 -11
- package/dist/cli.js +5 -7
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +3 -3
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +10 -4
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +15 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/components/ThemeStyle.d.ts +30 -0
- package/dist/components/ThemeStyle.d.ts.map +1 -0
- package/dist/components/ThemeStyle.js +33 -0
- package/dist/components/ThemeStyle.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -0
- package/dist/lib/build/detect-layouts.d.ts +2 -2
- package/dist/lib/build/detect-layouts.d.ts.map +1 -1
- package/dist/lib/build/detect-layouts.js +14 -25
- package/dist/lib/build/detect-layouts.js.map +1 -1
- package/dist/lib/config/load-config.d.ts +9 -0
- package/dist/lib/config/load-config.d.ts.map +1 -0
- package/dist/lib/config/load-config.js +31 -0
- package/dist/lib/config/load-config.js.map +1 -0
- package/dist/lib/deploy/generate-manifest-files.d.ts.map +1 -1
- package/dist/lib/deploy/generate-manifest-files.js +20 -35
- 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 +32 -5
- package/dist/lib/deploy/pack-project.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 +17 -7
- 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 +4 -61
- package/dist/lib/deploy/validation.js.map +1 -1
- package/dist/lib/utils/setup-runtime.d.ts.map +1 -1
- package/dist/lib/utils/setup-runtime.js +46 -19
- package/dist/lib/utils/setup-runtime.js.map +1 -1
- package/dist/lib/vite/config-factory.d.ts.map +1 -1
- package/dist/lib/vite/config-factory.js +2 -2
- package/dist/lib/vite/config-factory.js.map +1 -1
- package/dist/lib/vite/plugins/asset-versioning.d.ts.map +1 -1
- package/dist/lib/vite/plugins/asset-versioning.js +4 -2
- package/dist/lib/vite/plugins/asset-versioning.js.map +1 -1
- package/dist/schema/config.schema.d.ts +126 -99
- package/dist/schema/config.schema.d.ts.map +1 -1
- package/dist/schema/config.schema.js +140 -20
- package/dist/schema/config.schema.js.map +1 -1
- package/dist/sdk/index.d.ts +21 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +21 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/send-message.d.ts +16 -0
- package/dist/sdk/send-message.d.ts.map +1 -0
- package/dist/sdk/send-message.js +34 -0
- package/dist/sdk/send-message.js.map +1 -0
- package/dist/sdk/use-open-popup.d.ts +23 -0
- package/dist/sdk/use-open-popup.d.ts.map +1 -0
- package/dist/sdk/use-open-popup.js +29 -0
- package/dist/sdk/use-open-popup.js.map +1 -0
- package/dist/types.d.ts +162 -30
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +41 -1
- package/dist/types.js.map +1 -1
- package/package.json +11 -3
- package/runtime/index.html +58 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to open a popup/modal in the parent Linktree window
|
|
3
|
+
*
|
|
4
|
+
* @returns A callback function to trigger the popup with optional data
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* function FeaturedLayout() {
|
|
9
|
+
* const openPopup = useOpenPopup()
|
|
10
|
+
*
|
|
11
|
+
* return (
|
|
12
|
+
* <button onClick={() => openPopup({ itemId: '123', view: 'details' })}>
|
|
13
|
+
* View More
|
|
14
|
+
* </button>
|
|
15
|
+
* )
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Note: This only works when the LinkApp is embedded in Linktree.
|
|
20
|
+
* The parent window identifies the LinkApp from the iframe's event.source.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useOpenPopup(): (data?: Record<string, unknown>) => void;
|
|
23
|
+
//# sourceMappingURL=use-open-popup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-open-popup.d.ts","sourceRoot":"","sources":["../../src/sdk/use-open-popup.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,YACC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAGnD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { sendMessage } from './send-message.js';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to open a popup/modal in the parent Linktree window
|
|
5
|
+
*
|
|
6
|
+
* @returns A callback function to trigger the popup with optional data
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* function FeaturedLayout() {
|
|
11
|
+
* const openPopup = useOpenPopup()
|
|
12
|
+
*
|
|
13
|
+
* return (
|
|
14
|
+
* <button onClick={() => openPopup({ itemId: '123', view: 'details' })}>
|
|
15
|
+
* View More
|
|
16
|
+
* </button>
|
|
17
|
+
* )
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Note: This only works when the LinkApp is embedded in Linktree.
|
|
22
|
+
* The parent window identifies the LinkApp from the iframe's event.source.
|
|
23
|
+
*/
|
|
24
|
+
export function useOpenPopup() {
|
|
25
|
+
return useCallback((data) => {
|
|
26
|
+
sendMessage('OPEN_POPUP', { data });
|
|
27
|
+
}, []);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=use-open-popup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-open-popup.js","sourceRoot":"","sources":["../../src/sdk/use-open-popup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,WAAW,CAAC,CAAC,IAA8B,EAAE,EAAE;QACpD,WAAW,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IACrC,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
export type Environment = 'production' | 'qa';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* Type definitions for LinkApp
|
|
3
|
+
* Note: Uses snake_case for API-facing types to match API requirements
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type Environment = "production" | "qa";
|
|
6
|
+
/**
|
|
7
|
+
* Theme configuration passed to link app iframes via postMessage
|
|
8
|
+
*/
|
|
9
|
+
export interface LinkAppTheme {
|
|
10
|
+
cssVariables: Record<string, string>;
|
|
11
|
+
/** @deprecated Use cssVariables['--button-style-text'] instead */
|
|
6
12
|
textColor: string;
|
|
13
|
+
/** @deprecated Use cssVariables['--button-style-background'] instead */
|
|
7
14
|
backgroundColor: string;
|
|
15
|
+
/** @deprecated Use cssVariables['--button-style-inner-radius'] instead */
|
|
8
16
|
borderRadius: string;
|
|
17
|
+
/** @deprecated Use cssVariables['--button-style-border-color'] instead */
|
|
9
18
|
borderColor: string;
|
|
10
|
-
|
|
19
|
+
/** @deprecated Use cssVariables['--button-style-background-hover'] instead */
|
|
20
|
+
backgroundHover: string;
|
|
21
|
+
/** @deprecated Use cssVariables['--button-style-contrast-color'] instead */
|
|
11
22
|
contrastColor: string;
|
|
23
|
+
/** @deprecated Use cssVariables instead */
|
|
12
24
|
textHoverColor: string;
|
|
13
25
|
}
|
|
14
26
|
/**
|
|
@@ -29,35 +41,29 @@ export interface Position {
|
|
|
29
41
|
* Core Linktree context available to all LinkApps
|
|
30
42
|
*/
|
|
31
43
|
export interface LinktreeContext {
|
|
32
|
-
linkUrl
|
|
33
|
-
layout?:
|
|
34
|
-
theme
|
|
35
|
-
locale: string;
|
|
36
|
-
currency: string;
|
|
37
|
-
username: string;
|
|
38
|
-
viewport: Viewport;
|
|
39
|
-
position?: Position;
|
|
44
|
+
linkUrl?: string;
|
|
45
|
+
layout?: "stack" | "grid" | "carousel" | "featured";
|
|
46
|
+
theme?: LinkAppTheme;
|
|
40
47
|
}
|
|
41
48
|
/**
|
|
42
49
|
* Props available to layout components
|
|
43
50
|
* Extend with custom settings from your config
|
|
44
51
|
*/
|
|
45
52
|
export type AppProps<TSettings = Record<string, unknown>> = LinktreeContext & TSettings;
|
|
46
|
-
export type LinktreeTheme = Theme;
|
|
47
53
|
export interface LinkAppManifest {
|
|
48
54
|
name: string;
|
|
49
55
|
tagline: string;
|
|
50
56
|
description: string[];
|
|
51
|
-
|
|
57
|
+
manifest_version: string;
|
|
52
58
|
version: string;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
supporting_links: {
|
|
60
|
+
terms_of_service: string;
|
|
61
|
+
privacy_policy: string;
|
|
56
62
|
documentation?: string;
|
|
57
63
|
website?: string;
|
|
58
64
|
};
|
|
59
|
-
category:
|
|
60
|
-
|
|
65
|
+
category: "grow" | "sell" | "share" | "learn";
|
|
66
|
+
search_terms: string[];
|
|
61
67
|
author: {
|
|
62
68
|
name: string;
|
|
63
69
|
accounts: string[];
|
|
@@ -67,23 +73,115 @@ export interface LinkAppManifest {
|
|
|
67
73
|
};
|
|
68
74
|
};
|
|
69
75
|
}
|
|
76
|
+
export declare enum SettingsIcon {
|
|
77
|
+
file = "file",
|
|
78
|
+
settings = "settings",
|
|
79
|
+
text_and_media = "text_and_media",
|
|
80
|
+
question = "question"
|
|
81
|
+
}
|
|
82
|
+
export declare enum SettingsElementInput {
|
|
83
|
+
button = "button",
|
|
84
|
+
text = "text",
|
|
85
|
+
textarea = "textarea",
|
|
86
|
+
number = "number",
|
|
87
|
+
radio = "radio",
|
|
88
|
+
checkbox = "checkbox",
|
|
89
|
+
select = "select",
|
|
90
|
+
password = "password",
|
|
91
|
+
switch = "switch",
|
|
92
|
+
linkBehavior = "linkBehavior",
|
|
93
|
+
file = "file",
|
|
94
|
+
url = "url",
|
|
95
|
+
integration = "integration",
|
|
96
|
+
embedOption = "embedOption",
|
|
97
|
+
array = "array"
|
|
98
|
+
}
|
|
99
|
+
export declare enum IntegrationCapability {
|
|
100
|
+
MANAGE_EMAIL_SUBSCRIBERS = "MANAGE_EMAIL_SUBSCRIBERS"
|
|
101
|
+
}
|
|
102
|
+
export declare enum InteractionEvent {
|
|
103
|
+
click = "click"
|
|
104
|
+
}
|
|
105
|
+
export declare enum ActionType {
|
|
106
|
+
"update-link" = "update-link"
|
|
107
|
+
}
|
|
108
|
+
export interface SettingsElementAction {
|
|
109
|
+
on: InteractionEvent;
|
|
110
|
+
type: ActionType;
|
|
111
|
+
data: {
|
|
112
|
+
link_type: string;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export interface SettingsElementValidation {
|
|
116
|
+
required?: boolean;
|
|
117
|
+
pattern?: string;
|
|
118
|
+
minLength?: number;
|
|
119
|
+
maxLength?: number;
|
|
120
|
+
min?: number;
|
|
121
|
+
max?: number;
|
|
122
|
+
maxSize?: number;
|
|
123
|
+
}
|
|
124
|
+
export interface SettingsOverview {
|
|
125
|
+
title?: string;
|
|
126
|
+
description: string;
|
|
127
|
+
}
|
|
128
|
+
export interface SetupInstructions {
|
|
129
|
+
title?: string;
|
|
130
|
+
description: string;
|
|
131
|
+
}
|
|
132
|
+
export interface SettingsElementOption {
|
|
133
|
+
value: string;
|
|
134
|
+
label: string;
|
|
135
|
+
}
|
|
136
|
+
export interface SettingsElementLinkBehaviorLabel {
|
|
137
|
+
linkOffLabel: string;
|
|
138
|
+
embedLabel: string;
|
|
139
|
+
}
|
|
140
|
+
export interface ConditionalDisplay {
|
|
141
|
+
dependsOn: string;
|
|
142
|
+
value: string | boolean;
|
|
143
|
+
operator?: "equals" | "notEquals" | "contains";
|
|
144
|
+
}
|
|
145
|
+
export interface ArrayOptions {
|
|
146
|
+
add_item_button_text?: string;
|
|
147
|
+
add_item_title?: string;
|
|
148
|
+
add_second_item_button_text?: string;
|
|
149
|
+
edit_item_title?: string;
|
|
150
|
+
item_format?: string;
|
|
151
|
+
min?: number;
|
|
152
|
+
max?: number;
|
|
153
|
+
}
|
|
70
154
|
export interface LinkAppSettings {
|
|
71
155
|
title: string;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
156
|
+
icon?: SettingsIcon;
|
|
157
|
+
uses_url?: boolean;
|
|
158
|
+
has_url?: boolean;
|
|
159
|
+
settings_tab_title?: string;
|
|
160
|
+
overview?: SettingsOverview;
|
|
161
|
+
setup_instructions?: SetupInstructions;
|
|
77
162
|
elements: SettingsElement[];
|
|
78
|
-
|
|
163
|
+
has_settings?: boolean;
|
|
164
|
+
supports_featured_layout?: boolean;
|
|
79
165
|
}
|
|
80
166
|
export interface SettingsElement {
|
|
81
167
|
id: string;
|
|
82
|
-
inputType:
|
|
83
|
-
title
|
|
168
|
+
inputType: SettingsElementInput;
|
|
169
|
+
title?: string;
|
|
84
170
|
description?: string;
|
|
85
|
-
defaultValue?:
|
|
171
|
+
defaultValue?: string | string[] | boolean;
|
|
86
172
|
label?: string;
|
|
173
|
+
placeholder?: string;
|
|
174
|
+
validation?: SettingsElementValidation;
|
|
175
|
+
options?: SettingsElementOption[];
|
|
176
|
+
linkBehaviorLabels?: SettingsElementLinkBehaviorLabel;
|
|
177
|
+
accept?: string[];
|
|
178
|
+
multiple?: boolean;
|
|
179
|
+
action?: SettingsElementAction;
|
|
180
|
+
capability?: IntegrationCapability;
|
|
181
|
+
vendor?: string;
|
|
182
|
+
array_options?: ArrayOptions;
|
|
183
|
+
array_elements?: SettingsElement[];
|
|
184
|
+
conditionalDisplay?: ConditionalDisplay;
|
|
87
185
|
}
|
|
88
186
|
export interface UrlMatchRules {
|
|
89
187
|
hostnames: string[];
|
|
@@ -101,8 +199,8 @@ export interface LinkAppConfig {
|
|
|
101
199
|
id: string;
|
|
102
200
|
manifest: LinkAppManifest;
|
|
103
201
|
settings: LinkAppSettings;
|
|
104
|
-
|
|
105
|
-
|
|
202
|
+
url_match_rules?: UrlMatchRules;
|
|
203
|
+
preview_props?: PreviewProps;
|
|
106
204
|
}
|
|
107
205
|
export interface AppConfig {
|
|
108
206
|
auth: {
|
|
@@ -137,4 +235,38 @@ export interface ComponentRegistryItem {
|
|
|
137
235
|
export interface ComponentRegistry {
|
|
138
236
|
[key: string]: ComponentRegistryItem;
|
|
139
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* PostMessage communication between LinkApp iframe and parent
|
|
240
|
+
*/
|
|
241
|
+
/**
|
|
242
|
+
* Message sent to open a popup/modal in the parent window
|
|
243
|
+
* Parent identifies the LinkApp from event.source
|
|
244
|
+
*/
|
|
245
|
+
export interface OpenPopupMessage {
|
|
246
|
+
source: "linkapp";
|
|
247
|
+
type: "OPEN_POPUP";
|
|
248
|
+
payload: {
|
|
249
|
+
data?: Record<string, unknown>;
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Union of all messages sent FROM LinkApp iframe TO parent window
|
|
254
|
+
* Extensible for future message types (navigation, analytics, etc.)
|
|
255
|
+
*/
|
|
256
|
+
export type LinkAppMessage = OpenPopupMessage;
|
|
257
|
+
/**
|
|
258
|
+
* Message sent from parent window TO LinkApp iframe to update theme
|
|
259
|
+
* Uses CSS-native approach inspired by Figma's iframe theming
|
|
260
|
+
*/
|
|
261
|
+
export interface ThemeUpdateMessage {
|
|
262
|
+
type: "THEME_UPDATE";
|
|
263
|
+
payload: {
|
|
264
|
+
name: string;
|
|
265
|
+
variables: Record<string, string>;
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Union of all messages sent FROM parent window TO LinkApp iframe
|
|
270
|
+
*/
|
|
271
|
+
export type ParentToLinkAppMessage = ThemeUpdateMessage;
|
|
140
272
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,IAAI,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,YAAY;IAK3B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGrC,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,eAAe,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,eAAe,EAAE,MAAM,CAA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MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,KAAK,CAAC,EAAE;QACN,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAC;CACtC;AAED;;GAEG;AAEH;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE;QAEP,IAAI,EAAE,MAAM,CAAC;QAEb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for LinkApp
|
|
3
|
+
* Note: Uses snake_case for API-facing types to match API requirements
|
|
4
|
+
*/
|
|
5
|
+
export var SettingsIcon;
|
|
6
|
+
(function (SettingsIcon) {
|
|
7
|
+
SettingsIcon["file"] = "file";
|
|
8
|
+
SettingsIcon["settings"] = "settings";
|
|
9
|
+
SettingsIcon["text_and_media"] = "text_and_media";
|
|
10
|
+
SettingsIcon["question"] = "question";
|
|
11
|
+
})(SettingsIcon || (SettingsIcon = {}));
|
|
12
|
+
export var SettingsElementInput;
|
|
13
|
+
(function (SettingsElementInput) {
|
|
14
|
+
SettingsElementInput["button"] = "button";
|
|
15
|
+
SettingsElementInput["text"] = "text";
|
|
16
|
+
SettingsElementInput["textarea"] = "textarea";
|
|
17
|
+
SettingsElementInput["number"] = "number";
|
|
18
|
+
SettingsElementInput["radio"] = "radio";
|
|
19
|
+
SettingsElementInput["checkbox"] = "checkbox";
|
|
20
|
+
SettingsElementInput["select"] = "select";
|
|
21
|
+
SettingsElementInput["password"] = "password";
|
|
22
|
+
SettingsElementInput["switch"] = "switch";
|
|
23
|
+
SettingsElementInput["linkBehavior"] = "linkBehavior";
|
|
24
|
+
SettingsElementInput["file"] = "file";
|
|
25
|
+
SettingsElementInput["url"] = "url";
|
|
26
|
+
SettingsElementInput["integration"] = "integration";
|
|
27
|
+
SettingsElementInput["embedOption"] = "embedOption";
|
|
28
|
+
SettingsElementInput["array"] = "array";
|
|
29
|
+
})(SettingsElementInput || (SettingsElementInput = {}));
|
|
30
|
+
export var IntegrationCapability;
|
|
31
|
+
(function (IntegrationCapability) {
|
|
32
|
+
IntegrationCapability["MANAGE_EMAIL_SUBSCRIBERS"] = "MANAGE_EMAIL_SUBSCRIBERS";
|
|
33
|
+
})(IntegrationCapability || (IntegrationCapability = {}));
|
|
34
|
+
export var InteractionEvent;
|
|
35
|
+
(function (InteractionEvent) {
|
|
36
|
+
InteractionEvent["click"] = "click";
|
|
37
|
+
})(InteractionEvent || (InteractionEvent = {}));
|
|
38
|
+
export var ActionType;
|
|
39
|
+
(function (ActionType) {
|
|
40
|
+
ActionType["update-link"] = "update-link";
|
|
41
|
+
})(ActionType || (ActionType = {}));
|
|
2
42
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuFH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,qCAAqB,CAAA;IACrB,iDAAiC,CAAA;IACjC,qCAAqB,CAAA;AACvB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,MAAM,CAAN,IAAY,oBAgBX;AAhBD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,6CAAqB,CAAA;IACrB,yCAAiB,CAAA;IACjB,uCAAe,CAAA;IACf,6CAAqB,CAAA;IACrB,yCAAiB,CAAA;IACjB,6CAAqB,CAAA;IACrB,yCAAiB,CAAA;IACjB,qDAA6B,CAAA;IAC7B,qCAAa,CAAA;IACb,mCAAW,CAAA;IACX,mDAA2B,CAAA;IAC3B,mDAA2B,CAAA;IAC3B,uCAAe,CAAA;AACjB,CAAC,EAhBW,oBAAoB,KAApB,oBAAoB,QAgB/B;AAED,MAAM,CAAN,IAAY,qBAEX;AAFD,WAAY,qBAAqB;IAC/B,8EAAqD,CAAA;AACvD,CAAC,EAFW,qBAAqB,KAArB,qBAAqB,QAEhC;AAED,MAAM,CAAN,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;AACjB,CAAC,EAFW,gBAAgB,KAAhB,gBAAgB,QAE3B;AAED,MAAM,CAAN,IAAY,UAEX;AAFD,WAAY,UAAU;IACpB,yCAA6B,CAAA;AAC/B,CAAC,EAFW,UAAU,KAAV,UAAU,QAErB"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/linkapp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "Development, build, and deployment tooling for LinkApps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"linkapp": "
|
|
8
|
-
"create-linktree-link-run": "
|
|
7
|
+
"linkapp": "bin/cli.js",
|
|
8
|
+
"create-linktree-link-run": "bin/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
},
|
|
22
22
|
"./types": {
|
|
23
23
|
"types": "./dist/types.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./components": {
|
|
26
|
+
"types": "./dist/components/index.d.ts",
|
|
27
|
+
"import": "./dist/components/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./sdk": {
|
|
30
|
+
"types": "./dist/sdk/index.d.ts",
|
|
31
|
+
"import": "./dist/sdk/index.js"
|
|
24
32
|
}
|
|
25
33
|
},
|
|
26
34
|
"scripts": {
|
package/runtime/index.html
CHANGED
|
@@ -4,6 +4,64 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>LinkApp</title>
|
|
7
|
+
|
|
8
|
+
<!-- Linktree theme variables will be injected here -->
|
|
9
|
+
<style id="linktree-theme"></style>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
/**
|
|
13
|
+
* Helper function to convert CSS variables object to CSS string
|
|
14
|
+
* @param {Record<string, string>} vars - Object with CSS variable names as keys
|
|
15
|
+
* @returns {string} CSS string like "--var1: value1; --var2: value2;"
|
|
16
|
+
*/
|
|
17
|
+
function renderCssVariables(vars) {
|
|
18
|
+
return Object.entries(vars)
|
|
19
|
+
.map((entry) => entry.join(': '))
|
|
20
|
+
.join('; ') + ';'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Listen for theme updates from parent window
|
|
25
|
+
* Applies CSS variables to the document root
|
|
26
|
+
*/
|
|
27
|
+
window.addEventListener('message', function(event) {
|
|
28
|
+
// Only process messages with the correct structure
|
|
29
|
+
if (
|
|
30
|
+
event.data &&
|
|
31
|
+
typeof event.data === 'object' &&
|
|
32
|
+
event.data.type === 'THEME_UPDATE'
|
|
33
|
+
) {
|
|
34
|
+
const themeUpdate = event.data
|
|
35
|
+
|
|
36
|
+
// Get the style element where theme variables are injected
|
|
37
|
+
const themeStyle = document.getElementById('linktree-theme')
|
|
38
|
+
|
|
39
|
+
if (!themeStyle) {
|
|
40
|
+
console.warn('linktree-theme style element not found')
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Inject CSS variables into :root
|
|
45
|
+
themeStyle.textContent = ':root { ' + renderCssVariables(themeUpdate.payload.variables) + ' }'
|
|
46
|
+
|
|
47
|
+
// Remove any existing theme classes
|
|
48
|
+
const classesToRemove = []
|
|
49
|
+
document.documentElement.classList.forEach((className) => {
|
|
50
|
+
if (className.startsWith('linktree-theme-')) {
|
|
51
|
+
classesToRemove.push(className)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
classesToRemove.forEach((className) => {
|
|
55
|
+
document.documentElement.classList.remove(className)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
// Add theme class for additional styling hooks
|
|
59
|
+
if (themeUpdate.payload.name && themeUpdate.payload.name !== 'legacy') {
|
|
60
|
+
document.documentElement.classList.add('linktree-theme-' + themeUpdate.payload.name)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, false)
|
|
64
|
+
</script>
|
|
7
65
|
</head>
|
|
8
66
|
<body>
|
|
9
67
|
<div id="root"></div>
|