@voilabs/plugins 0.0.1-beta.0 → 0.0.1-beta.1
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 +107 -30
- package/dist/client.d.ts +10 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +19 -0
- package/dist/client.js.map +1 -1
- package/dist/http.js +19 -3
- package/dist/http.js.map +1 -1
- package/dist/injection.d.ts +1 -1
- package/dist/injection.d.ts.map +1 -1
- package/dist/injection.js +66 -22
- package/dist/injection.js.map +1 -1
- package/dist/manager.d.ts +12 -13
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +310 -14
- package/dist/manager.js.map +1 -1
- package/dist/react.d.ts +35 -3
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +165 -1
- package/dist/react.js.map +1 -1
- package/dist/types.d.ts +13 -1
- package/dist/types.d.ts.map +1 -1
- package/github-examples/README.md +23 -0
- package/github-examples/google-tag-manager/assets/admin.css +27 -0
- package/github-examples/google-tag-manager/components/dashboard-card.js +10 -0
- package/github-examples/google-tag-manager/components/settings.js +21 -0
- package/github-examples/google-tag-manager/schema.json +139 -0
- package/package.json +2 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.voilabs-gtm-panel {
|
|
2
|
+
display: grid;
|
|
3
|
+
gap: 8px;
|
|
4
|
+
color: #17202a;
|
|
5
|
+
font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.voilabs-gtm-panel h3 {
|
|
9
|
+
margin: 0;
|
|
10
|
+
font-size: 16px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.voilabs-gtm-panel p,
|
|
14
|
+
.voilabs-gtm-panel ul {
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.voilabs-gtm-card {
|
|
19
|
+
display: grid;
|
|
20
|
+
gap: 6px;
|
|
21
|
+
color: #17202a;
|
|
22
|
+
font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.voilabs-gtm-card strong {
|
|
26
|
+
font-size: 15px;
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default function GoogleTagManagerDashboardCard(props) {
|
|
2
|
+
const h = props.React.createElement;
|
|
3
|
+
|
|
4
|
+
return h(
|
|
5
|
+
"article",
|
|
6
|
+
{ className: "voilabs-gtm-card" },
|
|
7
|
+
h("strong", null, props.plugin.name),
|
|
8
|
+
h("span", null, "Public analytics injection is managed by this plugin."),
|
|
9
|
+
);
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default function GoogleTagManagerSettings(props) {
|
|
2
|
+
const h = props.React.createElement;
|
|
3
|
+
|
|
4
|
+
return h(
|
|
5
|
+
"section",
|
|
6
|
+
{ className: "voilabs-gtm-panel" },
|
|
7
|
+
h("h3", null, "Google Tag Manager"),
|
|
8
|
+
h(
|
|
9
|
+
"p",
|
|
10
|
+
null,
|
|
11
|
+
"Enter a GTM container ID such as GTM-ABC123. The plugin injects the head script and body noscript tag after it is installed and enabled.",
|
|
12
|
+
),
|
|
13
|
+
h(
|
|
14
|
+
"ul",
|
|
15
|
+
null,
|
|
16
|
+
h("li", null, "Container ID is validated with the GTM- prefix."),
|
|
17
|
+
h("li", null, "dataLayer is used by default."),
|
|
18
|
+
h("li", null, "The public injections run only on public pages."),
|
|
19
|
+
),
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "google-tag-manager",
|
|
3
|
+
"name": "Google Tag Manager",
|
|
4
|
+
"summary": "Inject a Google Tag Manager container into public pages.",
|
|
5
|
+
"description": "Adds the GTM bootstrap script to the document head and the noscript iframe to the start of the body.",
|
|
6
|
+
"version": "1.0.0",
|
|
7
|
+
"category": "analytics",
|
|
8
|
+
"badge": "GTM",
|
|
9
|
+
"docsUrl": "https://developers.google.com/tag-platform/tag-manager",
|
|
10
|
+
"tags": ["analytics", "marketing", "tracking", "google"],
|
|
11
|
+
"needEncryption": false,
|
|
12
|
+
"fields": [
|
|
13
|
+
{
|
|
14
|
+
"key": "containerId",
|
|
15
|
+
"label": "Container ID",
|
|
16
|
+
"description": "Your GTM container identifier, for example GTM-ABC123.",
|
|
17
|
+
"type": "text",
|
|
18
|
+
"placeholder": "GTM-ABC123",
|
|
19
|
+
"required": true,
|
|
20
|
+
"pattern": "^GTM-[A-Z0-9]+$"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"key": "dataLayerName",
|
|
24
|
+
"label": "Data Layer Name",
|
|
25
|
+
"description": "Use dataLayer unless your GTM container was configured with a custom data layer name.",
|
|
26
|
+
"type": "text",
|
|
27
|
+
"placeholder": "dataLayer",
|
|
28
|
+
"required": true,
|
|
29
|
+
"defaultValue": "dataLayer",
|
|
30
|
+
"pattern": "^[a-zA-Z_$][a-zA-Z0-9_$]*$"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"frontend": {
|
|
34
|
+
"components": [
|
|
35
|
+
{
|
|
36
|
+
"key": "gtm-settings-panel",
|
|
37
|
+
"slot": "settings-panel",
|
|
38
|
+
"label": "Google Tag Manager settings",
|
|
39
|
+
"description": "Shows guidance for the GTM configuration form.",
|
|
40
|
+
"component": {
|
|
41
|
+
"type": "remote",
|
|
42
|
+
"path": "components/settings.js"
|
|
43
|
+
},
|
|
44
|
+
"order": 20
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"key": "gtm-dashboard-card",
|
|
48
|
+
"slot": "dashboard-card",
|
|
49
|
+
"label": "Google Tag Manager",
|
|
50
|
+
"component": {
|
|
51
|
+
"type": "remote",
|
|
52
|
+
"path": "components/dashboard-card.js"
|
|
53
|
+
},
|
|
54
|
+
"order": 30
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"routes": [
|
|
59
|
+
{
|
|
60
|
+
"id": "gtm-status",
|
|
61
|
+
"method": "GET",
|
|
62
|
+
"path": "/status",
|
|
63
|
+
"summary": "Returns the configured GTM container.",
|
|
64
|
+
"requiresInstallation": true,
|
|
65
|
+
"requiresEnabled": true,
|
|
66
|
+
"response": {
|
|
67
|
+
"status": 200,
|
|
68
|
+
"body": {
|
|
69
|
+
"ok": true,
|
|
70
|
+
"containerId": "{{config.containerId}}",
|
|
71
|
+
"dataLayerName": "{{config.dataLayerName}}"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"additionalMetaTags": [
|
|
77
|
+
{
|
|
78
|
+
"key": "voilabs-plugin-gtm",
|
|
79
|
+
"name": "voilabs-plugin",
|
|
80
|
+
"content": "google-tag-manager"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"injections": [
|
|
84
|
+
{
|
|
85
|
+
"key": "gtm-admin-style",
|
|
86
|
+
"type": "style",
|
|
87
|
+
"placement": "admin:head",
|
|
88
|
+
"src": "assets/admin.css",
|
|
89
|
+
"condition": {
|
|
90
|
+
"area": "admin"
|
|
91
|
+
},
|
|
92
|
+
"order": 5
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"key": "gtm-head-bootstrap",
|
|
96
|
+
"type": "script",
|
|
97
|
+
"placement": "public:head",
|
|
98
|
+
"condition": {
|
|
99
|
+
"area": "public"
|
|
100
|
+
},
|
|
101
|
+
"order": 10,
|
|
102
|
+
"content": "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':Date.now(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s);j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+encodeURIComponent(i)+(l==='dataLayer'?'':'&l='+encodeURIComponent(l));f.parentNode.insertBefore(j,f);})(window,document,'script','{{config.dataLayerName}}','{{config.containerId}}');"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"key": "gtm-body-noscript",
|
|
106
|
+
"type": "noscript",
|
|
107
|
+
"placement": "body:start",
|
|
108
|
+
"condition": {
|
|
109
|
+
"area": "public"
|
|
110
|
+
},
|
|
111
|
+
"order": 11,
|
|
112
|
+
"content": "<iframe src=\"https://www.googletagmanager.com/ns.html?id={{config.containerId}}\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"assets": [
|
|
116
|
+
{
|
|
117
|
+
"key": "gtm-admin-css",
|
|
118
|
+
"type": "style",
|
|
119
|
+
"url": "assets/admin.css"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"permissions": [
|
|
123
|
+
{
|
|
124
|
+
"key": "inject-public-html",
|
|
125
|
+
"label": "Inject public HTML",
|
|
126
|
+
"description": "Allows this plugin to add GTM tags to public pages.",
|
|
127
|
+
"default": true
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"compatibility": {
|
|
131
|
+
"node": ">=18",
|
|
132
|
+
"next": ">=13",
|
|
133
|
+
"react": ">=18",
|
|
134
|
+
"elysia": ">=1"
|
|
135
|
+
},
|
|
136
|
+
"support": {
|
|
137
|
+
"docs": "https://developers.google.com/tag-platform/tag-manager"
|
|
138
|
+
}
|
|
139
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voilabs/plugins",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.1",
|
|
4
4
|
"description": "Framework-agnostic plugin registry and runtime for Node.js, Next.js, Elysia and React apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"dist",
|
|
41
|
+
"github-examples",
|
|
41
42
|
"README.md"
|
|
42
43
|
],
|
|
43
44
|
"sideEffects": false,
|