@openpolicy/vite 0.0.12 → 0.0.13
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/dist/html-D0xZQ7Fi.js +39 -0
- package/dist/html-D0xZQ7Fi.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +448 -524
- package/dist/index.js.map +1 -1
- package/dist/markdown-8LgFTJSZ.js +35 -0
- package/dist/markdown-8LgFTJSZ.js.map +1 -0
- package/dist/pdf-CTsnJvZX.js +93 -0
- package/dist/pdf-CTsnJvZX.js.map +1 -0
- package/dist/rolldown-runtime-CiIaOW0V.js +13 -0
- package/package.json +2 -1
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,332 +1,294 @@
|
|
|
1
|
+
import "./pdf-CTsnJvZX.js";
|
|
1
2
|
import { access, mkdir, writeFile } from "node:fs/promises";
|
|
2
3
|
import { join, resolve } from "node:path";
|
|
3
|
-
import { marked } from "marked";
|
|
4
4
|
//#region ../core/dist/index.js
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function renderHTML(sections) {
|
|
9
|
-
return marked(renderMarkdown(sections));
|
|
10
|
-
}
|
|
11
|
-
function buildConsent(config) {
|
|
12
|
-
if (!config.consentMechanism) return null;
|
|
13
|
-
const mechanisms = [];
|
|
14
|
-
if (config.consentMechanism.hasBanner) mechanisms.push("A **cookie consent banner** displayed on your first visit, where you can accept or decline non-essential cookies");
|
|
15
|
-
if (config.consentMechanism.hasPreferencePanel) mechanisms.push("A **preference panel** where you can manage individual cookie categories");
|
|
16
|
-
if (config.consentMechanism.canWithdraw) mechanisms.push("The ability to **withdraw your consent** at any time by updating your cookie preferences");
|
|
17
|
-
return {
|
|
18
|
-
id: "consent",
|
|
19
|
-
title: "User Consent",
|
|
20
|
-
body: `Where required by law, we will request your consent before placing non-essential cookies on your device.${mechanisms.length > 0 ? `\n\nWe provide the following consent controls:\n\n${mechanisms.map((m) => `- ${m}`).join("\n")}` : ""}
|
|
21
|
-
|
|
22
|
-
Essential cookies do not require your consent as they are strictly necessary for the operation of our service.`
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function buildContact$2(config) {
|
|
26
|
-
return {
|
|
27
|
-
id: "contact",
|
|
28
|
-
title: "Contact Us",
|
|
29
|
-
body: `If you have any questions about our use of cookies or this Cookie Policy, please contact us:
|
|
30
|
-
|
|
31
|
-
**${config.company.legalName}**
|
|
32
|
-
${config.company.address}
|
|
33
|
-
${config.company.contact}`
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function buildCookieDuration(_config) {
|
|
37
|
-
return {
|
|
38
|
-
id: "cookie-duration",
|
|
39
|
-
title: "Cookie Duration",
|
|
40
|
-
body: `Cookies can be either **session cookies** or **persistent cookies**:
|
|
41
|
-
|
|
42
|
-
- **Session cookies** are temporary and are deleted from your device when you close your browser. They are used to carry information across pages of our website and avoid having to re-enter information.
|
|
43
|
-
- **Persistent cookies** remain on your device for a set period of time specified in the cookie. They are activated each time you visit the website that created that particular cookie.
|
|
44
|
-
|
|
45
|
-
The specific duration of each cookie depends on its purpose and is determined at the time it is set.`
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function buildCookieTypes(config) {
|
|
49
|
-
const types = [];
|
|
50
|
-
if (config.cookies.essential) types.push("**Essential Cookies** — These cookies are necessary for our website to function and cannot be switched off. They are usually set in response to actions you take, such as setting your privacy preferences, logging in, or filling in forms.");
|
|
51
|
-
if (config.cookies.analytics) types.push("**Analytics Cookies** — These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand which pages are most and least popular and see how visitors move around the site.");
|
|
52
|
-
if (config.cookies.functional) types.push("**Functional Cookies** — These cookies enable enhanced functionality and personalization, such as remembering your preferences and settings. They may be set by us or by third-party providers whose services we have added to our pages.");
|
|
53
|
-
if (config.cookies.marketing) types.push("**Marketing Cookies** — These cookies may be set through our site by our advertising partners. They may be used to build a profile of your interests and show you relevant advertisements on other sites.");
|
|
54
|
-
return {
|
|
55
|
-
id: "cookie-types",
|
|
56
|
-
title: "Types of Cookies We Use",
|
|
57
|
-
body: `We use the following categories of cookies:\n\n${types.map((t) => `- ${t}`).join("\n")}`
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function buildCookieUsage(config) {
|
|
61
|
-
const purposes = [];
|
|
62
|
-
if (config.cookies.essential) {
|
|
63
|
-
purposes.push("Providing core website functionality and security");
|
|
64
|
-
purposes.push("Remembering your session and authentication state");
|
|
65
|
-
}
|
|
66
|
-
if (config.cookies.analytics) {
|
|
67
|
-
purposes.push("Measuring website traffic and usage patterns");
|
|
68
|
-
purposes.push("Identifying which pages and features are most popular");
|
|
69
|
-
}
|
|
70
|
-
if (config.cookies.functional) {
|
|
71
|
-
purposes.push("Saving your preferences and settings");
|
|
72
|
-
purposes.push("Providing personalized content and features");
|
|
73
|
-
}
|
|
74
|
-
if (config.cookies.marketing) {
|
|
75
|
-
purposes.push("Delivering targeted advertising");
|
|
76
|
-
purposes.push("Tracking the effectiveness of our marketing campaigns");
|
|
77
|
-
}
|
|
78
|
-
const list = purposes.map((p) => `- ${p}`).join("\n");
|
|
5
|
+
const heading = (value, levelOrContext, context) => {
|
|
6
|
+
const level = typeof levelOrContext === "number" ? levelOrContext : void 0;
|
|
7
|
+
const ctx = typeof levelOrContext === "object" ? levelOrContext : context;
|
|
79
8
|
return {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
9
|
+
type: "heading",
|
|
10
|
+
...level !== void 0 && { level },
|
|
11
|
+
value,
|
|
12
|
+
...ctx && { context: ctx }
|
|
83
13
|
};
|
|
84
|
-
}
|
|
14
|
+
};
|
|
15
|
+
const text = (value, context) => ({
|
|
16
|
+
type: "text",
|
|
17
|
+
value,
|
|
18
|
+
...context && { context }
|
|
19
|
+
});
|
|
20
|
+
const bold = (value, context) => ({
|
|
21
|
+
type: "bold",
|
|
22
|
+
value,
|
|
23
|
+
...context && { context }
|
|
24
|
+
});
|
|
25
|
+
const link = (href, value, context) => ({
|
|
26
|
+
type: "link",
|
|
27
|
+
href,
|
|
28
|
+
value,
|
|
29
|
+
...context && { context }
|
|
30
|
+
});
|
|
31
|
+
const p = (children, context) => ({
|
|
32
|
+
type: "paragraph",
|
|
33
|
+
children: children.map((c) => typeof c === "string" ? text(c) : c),
|
|
34
|
+
...context && { context }
|
|
35
|
+
});
|
|
36
|
+
const li = (children, context) => ({
|
|
37
|
+
type: "listItem",
|
|
38
|
+
children: children.map((c) => typeof c === "string" ? text(c) : c),
|
|
39
|
+
...context && { context }
|
|
40
|
+
});
|
|
41
|
+
const ul = (items, context) => ({
|
|
42
|
+
type: "list",
|
|
43
|
+
items,
|
|
44
|
+
...context && { context }
|
|
45
|
+
});
|
|
46
|
+
const section = (id, content, context) => ({
|
|
47
|
+
type: "section",
|
|
48
|
+
id,
|
|
49
|
+
content,
|
|
50
|
+
...context && { context }
|
|
51
|
+
});
|
|
85
52
|
function buildIntroduction$2(config) {
|
|
86
|
-
return {
|
|
87
|
-
id: "introduction",
|
|
88
|
-
title: "Introduction",
|
|
89
|
-
body: `This Cookie Policy explains how ${config.company.name} ("we", "us", or "our") uses cookies and similar tracking technologies when you visit our website or use our services.
|
|
90
|
-
|
|
91
|
-
**Effective Date:** ${config.effectiveDate}
|
|
92
|
-
|
|
93
|
-
By using our services, you consent to the use of cookies as described in this policy. If you have questions, please contact us at ${config.company.contact}.`
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function buildJurisdiction(config) {
|
|
97
|
-
if (!config.jurisdictions || config.jurisdictions.length === 0) return null;
|
|
98
|
-
const requirements = [];
|
|
99
|
-
if (config.jurisdictions.includes("eu")) requirements.push("**European Union (GDPR/ePrivacy Directive):** We comply with EU cookie consent requirements. Non-essential cookies require your prior, informed, and freely given consent. You have the right to withdraw consent at any time.");
|
|
100
|
-
if (config.jurisdictions.includes("ca")) requirements.push("**California (CCPA):** California residents have the right to opt out of the sale of personal information collected through cookies. To exercise this right, please contact us.");
|
|
101
|
-
if (config.jurisdictions.includes("us")) requirements.push("**United States:** We comply with applicable U.S. federal and state privacy laws regarding cookie usage and disclosure.");
|
|
102
|
-
if (config.jurisdictions.includes("au")) requirements.push("**Australia (Privacy Act):** We comply with the Australian Privacy Principles regarding the collection of personal information through cookies.");
|
|
103
|
-
if (config.jurisdictions.includes("nz")) requirements.push("**New Zealand (Privacy Act 2020):** We comply with New Zealand privacy requirements for the collection of personal information through cookies.");
|
|
104
|
-
if (config.jurisdictions.includes("other")) requirements.push("**Other Jurisdictions:** We strive to comply with applicable cookie laws and regulations in all jurisdictions where we operate.");
|
|
105
|
-
return {
|
|
106
|
-
id: "jurisdiction",
|
|
107
|
-
title: "Legal Requirements",
|
|
108
|
-
body: `Our cookie practices are designed to comply with applicable laws across the jurisdictions in which we operate:\n\n${requirements.map((r) => `- ${r}`).join("\n")}`
|
|
109
|
-
};
|
|
53
|
+
return section("cookie-introduction", [heading("Cookie Policy"), p([`This Cookie Policy explains how ${config.company.name} ("we", "us", or "our") uses cookies and similar tracking technologies on our services. Effective Date: ${config.effectiveDate}.`])]);
|
|
110
54
|
}
|
|
111
|
-
function
|
|
112
|
-
return
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
**Browser settings:** Most browsers allow you to refuse cookies or delete existing ones. The process varies by browser:
|
|
118
|
-
- **Chrome:** Settings → Privacy and security → Cookies and other site data
|
|
119
|
-
- **Firefox:** Settings → Privacy & Security → Cookies and Site Data
|
|
120
|
-
- **Safari:** Preferences → Privacy → Manage Website Data
|
|
121
|
-
- **Edge:** Settings → Cookies and site permissions
|
|
122
|
-
|
|
123
|
-
**Opt-out tools:** For analytics and advertising cookies, you may use industry opt-out tools such as the [NAI opt-out](http://optout.networkadvertising.org/) or [DAA opt-out](http://optout.aboutads.info/).
|
|
124
|
-
|
|
125
|
-
Please note that blocking or deleting cookies may affect your experience on our website, and some features may not function correctly if cookies are disabled.`
|
|
126
|
-
};
|
|
55
|
+
function buildWhatAreCookies() {
|
|
56
|
+
return section("cookie-what-are-cookies", [
|
|
57
|
+
heading("What Are Cookies?"),
|
|
58
|
+
p(["Cookies are small text files placed on your device by websites you visit. They are widely used to make websites work more efficiently and to provide information to site owners."]),
|
|
59
|
+
p(["Cookies can be \"session cookies\" (deleted when you close your browser) or \"persistent cookies\" (remain on your device until they expire or you delete them)."])
|
|
60
|
+
]);
|
|
127
61
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
62
|
+
function buildTypes(config) {
|
|
63
|
+
const types = [];
|
|
64
|
+
if (config.cookies.essential) types.push({
|
|
65
|
+
label: "Essential Cookies",
|
|
66
|
+
description: "Required for the basic functioning of our services. These cannot be disabled."
|
|
67
|
+
});
|
|
68
|
+
if (config.cookies.analytics) types.push({
|
|
69
|
+
label: "Analytics Cookies",
|
|
70
|
+
description: "Help us understand how visitors interact with our services so we can improve them."
|
|
71
|
+
});
|
|
72
|
+
if (config.cookies.functional) types.push({
|
|
73
|
+
label: "Functional Cookies",
|
|
74
|
+
description: "Enable enhanced functionality and personalisation, such as remembering your preferences."
|
|
75
|
+
});
|
|
76
|
+
if (config.cookies.marketing) types.push({
|
|
77
|
+
label: "Marketing Cookies",
|
|
78
|
+
description: "Used to deliver advertisements more relevant to you and your interests."
|
|
79
|
+
});
|
|
80
|
+
if (types.length === 0) return section("cookie-types", [heading("Types of Cookies We Use"), p(["We do not currently use any cookies."])]);
|
|
81
|
+
return section("cookie-types", [heading("Types of Cookies We Use"), ul(types.map((t) => li([
|
|
82
|
+
bold(t.label),
|
|
83
|
+
" — ",
|
|
84
|
+
t.description
|
|
85
|
+
])))]);
|
|
140
86
|
}
|
|
141
87
|
function buildTrackingTechnologies(config) {
|
|
142
88
|
if (!config.trackingTechnologies || config.trackingTechnologies.length === 0) return null;
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
89
|
+
return section("cookie-tracking-technologies", [
|
|
90
|
+
heading("Other Tracking Technologies"),
|
|
91
|
+
p(["In addition to cookies, we may use the following tracking technologies:"]),
|
|
92
|
+
ul(config.trackingTechnologies.map((t) => li([t])))
|
|
93
|
+
]);
|
|
148
94
|
}
|
|
149
|
-
function
|
|
150
|
-
return
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
95
|
+
function buildThirdParties$1(config) {
|
|
96
|
+
if (!config.thirdParties || config.thirdParties.length === 0) return null;
|
|
97
|
+
return section("cookie-third-parties", [
|
|
98
|
+
heading("Third-Party Cookies"),
|
|
99
|
+
p(["The following third parties may set cookies through our services:"]),
|
|
100
|
+
ul(config.thirdParties.map((t) => li([
|
|
101
|
+
bold(t.name),
|
|
102
|
+
" — ",
|
|
103
|
+
t.purpose,
|
|
104
|
+
...t.policyUrl ? [
|
|
105
|
+
" (",
|
|
106
|
+
link(t.policyUrl, "Privacy Policy"),
|
|
107
|
+
")"
|
|
108
|
+
] : []
|
|
109
|
+
])))
|
|
110
|
+
]);
|
|
159
111
|
}
|
|
160
|
-
function
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
112
|
+
function buildConsent(config) {
|
|
113
|
+
if (!config.consentMechanism) return null;
|
|
114
|
+
const { hasBanner, hasPreferencePanel, canWithdraw } = config.consentMechanism;
|
|
115
|
+
const items = [];
|
|
116
|
+
if (hasBanner) items.push("We display a cookie consent banner when you first visit our services.");
|
|
117
|
+
if (hasPreferencePanel) items.push("You can manage your cookie preferences at any time via our preference panel.");
|
|
118
|
+
if (canWithdraw) items.push("You may withdraw your consent at any time; however, this will not affect the lawfulness of processing based on consent before its withdrawal.");
|
|
119
|
+
if (items.length === 0) return null;
|
|
120
|
+
return section("cookie-consent", [heading("Your Consent"), ul(items.map((i) => li([i])))]);
|
|
121
|
+
}
|
|
122
|
+
function buildManaging() {
|
|
123
|
+
return section("cookie-managing", [
|
|
124
|
+
heading("Managing Cookies"),
|
|
125
|
+
p(["Most web browsers allow you to control cookies through their settings. You can:"]),
|
|
126
|
+
ul([
|
|
127
|
+
li(["Delete cookies already stored on your device"]),
|
|
128
|
+
li(["Block cookies from being set on your device"]),
|
|
129
|
+
li(["Set your browser to notify you when a cookie is being set"])
|
|
130
|
+
]),
|
|
131
|
+
p(["Please note that restricting cookies may impact the functionality of our services. Consult your browser's help documentation for instructions on managing cookies."])
|
|
132
|
+
]);
|
|
133
|
+
}
|
|
134
|
+
function buildJurisdictionEu(config) {
|
|
135
|
+
if (!config.jurisdictions.includes("eu")) return null;
|
|
136
|
+
return section("cookie-jurisdiction-eu", [
|
|
137
|
+
heading("European Users (GDPR)", { reason: "Required under ePrivacy Directive and GDPR" }),
|
|
138
|
+
p(["If you are located in the European Economic Area, we rely on your consent as our legal basis for setting non-essential cookies. You have the right to withdraw consent at any time."]),
|
|
139
|
+
p(["Essential cookies are set on the basis of our legitimate interests to provide you with a functioning service."])
|
|
140
|
+
]);
|
|
141
|
+
}
|
|
142
|
+
function buildContact$2(config) {
|
|
143
|
+
return section("cookie-contact", [
|
|
144
|
+
heading("Contact Us"),
|
|
145
|
+
p(["If you have questions about this Cookie Policy, please contact us:"]),
|
|
146
|
+
ul([
|
|
147
|
+
li([bold("Legal Name: "), config.company.legalName]),
|
|
148
|
+
li([bold("Address: "), config.company.address]),
|
|
149
|
+
li([bold("Email: "), config.company.contact])
|
|
150
|
+
])
|
|
151
|
+
]);
|
|
168
152
|
}
|
|
169
153
|
const SECTION_BUILDERS$2 = [
|
|
170
154
|
buildIntroduction$2,
|
|
171
|
-
buildWhatAreCookies,
|
|
172
|
-
|
|
155
|
+
() => buildWhatAreCookies(),
|
|
156
|
+
buildTypes,
|
|
173
157
|
buildTrackingTechnologies,
|
|
174
|
-
|
|
175
|
-
buildCookieDuration,
|
|
158
|
+
buildThirdParties$1,
|
|
176
159
|
buildConsent,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
buildJurisdiction,
|
|
180
|
-
buildUpdates,
|
|
160
|
+
() => buildManaging(),
|
|
161
|
+
buildJurisdictionEu,
|
|
181
162
|
buildContact$2
|
|
182
163
|
];
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
return options.formats.map((format) => {
|
|
186
|
-
switch (format) {
|
|
187
|
-
case "markdown": return {
|
|
188
|
-
format,
|
|
189
|
-
content: renderMarkdown(sections),
|
|
190
|
-
sections
|
|
191
|
-
};
|
|
192
|
-
case "html": return {
|
|
193
|
-
format,
|
|
194
|
-
content: renderHTML(sections),
|
|
195
|
-
sections
|
|
196
|
-
};
|
|
197
|
-
case "pdf": throw new Error("pdf format is not yet implemented");
|
|
198
|
-
case "jsx": throw new Error("jsx format is not yet implemented");
|
|
199
|
-
default: throw new Error(`Unsupported format: ${format}`);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
164
|
+
function compileCookieDocument(config) {
|
|
165
|
+
return SECTION_BUILDERS$2.map((builder) => builder(config)).filter((s) => s !== null);
|
|
202
166
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
};
|
|
167
|
+
const RIGHTS_LABELS = {
|
|
168
|
+
access: "Right to access your personal data",
|
|
169
|
+
rectification: "Right to correct inaccurate data",
|
|
170
|
+
erasure: "Right to request deletion of your data",
|
|
171
|
+
portability: "Right to receive your data in a portable format",
|
|
172
|
+
restriction: "Right to restrict how we process your data",
|
|
173
|
+
objection: "Right to object to processing",
|
|
174
|
+
opt_out_sale: "Right to opt out of the sale of your personal information",
|
|
175
|
+
non_discrimination: "Right to non-discriminatory treatment for exercising your rights"
|
|
176
|
+
};
|
|
177
|
+
function buildIntroduction$1(config) {
|
|
178
|
+
return section("introduction", [
|
|
179
|
+
heading("Introduction"),
|
|
180
|
+
p([`This Privacy Policy describes how ${config.company.name} ("we", "us", or "our") collects, uses, and shares information about you when you use our services. Effective Date: ${config.effectiveDate}.`]),
|
|
181
|
+
p([`If you have questions about this policy, please contact us at ${config.company.contact}.`])
|
|
182
|
+
]);
|
|
220
183
|
}
|
|
221
184
|
function buildChildrenPrivacy(config) {
|
|
222
185
|
if (!config.children) return null;
|
|
223
186
|
const { underAge, noticeUrl } = config.children;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
187
|
+
return section("children-privacy", [
|
|
188
|
+
heading("Children's Privacy", { reason: "Required by COPPA" }),
|
|
189
|
+
p([`Our services are not directed to children under the age of ${underAge}. We do not knowingly collect personal information from children under ${underAge}. If you believe we have collected information from a child, please contact us immediately.`]),
|
|
190
|
+
...noticeUrl ? [p([
|
|
191
|
+
"For more information, see our ",
|
|
192
|
+
link(noticeUrl, "Children's Privacy Notice"),
|
|
193
|
+
"."
|
|
194
|
+
])] : []
|
|
195
|
+
]);
|
|
231
196
|
}
|
|
232
|
-
function
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
};
|
|
197
|
+
function buildDataCollected(config) {
|
|
198
|
+
const items = Object.entries(config.dataCollected).map(([category, fields]) => li([bold(category), ul(fields.map((f) => li([f])))]));
|
|
199
|
+
return section("data-collected", [
|
|
200
|
+
heading("Information We Collect"),
|
|
201
|
+
p(["We collect the following categories of information:"]),
|
|
202
|
+
ul(items)
|
|
203
|
+
]);
|
|
204
|
+
}
|
|
205
|
+
function buildLegalBasis(config) {
|
|
206
|
+
if (!config.jurisdictions.includes("eu")) return null;
|
|
207
|
+
return section("legal-basis", [heading("Legal Basis for Processing", { reason: "Required by GDPR Article 13" }), p([config.legalBasis])]);
|
|
208
|
+
}
|
|
209
|
+
function buildDataRetention(config) {
|
|
210
|
+
const items = Object.entries(config.retention).map(([category, period]) => li([
|
|
211
|
+
bold(category),
|
|
212
|
+
": ",
|
|
213
|
+
period
|
|
214
|
+
]));
|
|
215
|
+
return section("data-retention", [
|
|
216
|
+
heading("Data Retention"),
|
|
217
|
+
p(["We retain your data for the following periods:"]),
|
|
218
|
+
ul(items)
|
|
219
|
+
]);
|
|
243
220
|
}
|
|
244
221
|
function buildCookies(config) {
|
|
245
222
|
const enabled = [];
|
|
246
|
-
if (config.cookies.essential) enabled.push("
|
|
247
|
-
if (config.cookies.analytics) enabled.push("
|
|
248
|
-
if (config.cookies.marketing) enabled.push("
|
|
249
|
-
return
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
223
|
+
if (config.cookies.essential) enabled.push("Essential cookies — required for the service to function");
|
|
224
|
+
if (config.cookies.analytics) enabled.push("Analytics cookies — help us understand how the service is used");
|
|
225
|
+
if (config.cookies.marketing) enabled.push("Marketing cookies — used to deliver relevant advertisements");
|
|
226
|
+
if (enabled.length === 0) return section("cookies", [heading("Cookies and Tracking"), p(["We do not use cookies or similar tracking technologies."])]);
|
|
227
|
+
return section("cookies", [
|
|
228
|
+
heading("Cookies and Tracking"),
|
|
229
|
+
p(["We use the following types of cookies and tracking technologies:"]),
|
|
230
|
+
ul(enabled.map((e) => li([e])))
|
|
231
|
+
]);
|
|
254
232
|
}
|
|
255
|
-
function
|
|
256
|
-
return
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
233
|
+
function buildThirdParties(config) {
|
|
234
|
+
if (config.thirdParties.length === 0) return section("third-parties", [heading("Third-Party Services"), p(["We do not share your personal information with third parties except as required by law."])]);
|
|
235
|
+
return section("third-parties", [
|
|
236
|
+
heading("Third-Party Services"),
|
|
237
|
+
p(["We share data with the following third-party services:"]),
|
|
238
|
+
ul(config.thirdParties.map((t) => li([
|
|
239
|
+
bold(t.name),
|
|
240
|
+
" — ",
|
|
241
|
+
t.purpose
|
|
242
|
+
])))
|
|
243
|
+
]);
|
|
263
244
|
}
|
|
264
|
-
function
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
245
|
+
function buildUserRights(config) {
|
|
246
|
+
const items = config.userRights.map((right) => {
|
|
247
|
+
return li([RIGHTS_LABELS[right] ?? right]);
|
|
248
|
+
});
|
|
249
|
+
return section("user-rights", [
|
|
250
|
+
heading("Your Rights"),
|
|
251
|
+
p(["You have the following rights regarding your personal data:"]),
|
|
252
|
+
ul(items)
|
|
253
|
+
]);
|
|
270
254
|
}
|
|
271
255
|
function buildGdprSupplement(config) {
|
|
272
256
|
if (!config.jurisdictions.includes("eu")) return null;
|
|
273
|
-
return
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
257
|
+
return section("gdpr-supplement", [
|
|
258
|
+
heading("GDPR Supplemental Disclosures", { reason: "Required by GDPR Article 13" }),
|
|
259
|
+
p(["This section applies to individuals in the European Economic Area (EEA) under the General Data Protection Regulation (GDPR)."]),
|
|
260
|
+
p([
|
|
261
|
+
"Data Controller: ",
|
|
262
|
+
bold(config.company.legalName),
|
|
263
|
+
`, ${config.company.address}`
|
|
264
|
+
]),
|
|
265
|
+
p(["In addition to the rights listed above, you have the right to lodge a complaint with your local data protection authority if you believe we have not handled your data in accordance with applicable law."]),
|
|
266
|
+
p(["If we transfer your personal data outside the EEA, we ensure adequate safeguards are in place in accordance with GDPR requirements."])
|
|
267
|
+
]);
|
|
284
268
|
}
|
|
285
|
-
function
|
|
286
|
-
return
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
if (!config.jurisdictions.includes("eu")) return null;
|
|
298
|
-
return {
|
|
299
|
-
id: "legal-basis",
|
|
300
|
-
title: "Legal Basis for Processing",
|
|
301
|
-
body: `We process your personal data under the following legal basis:\n\n${config.legalBasis}`
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
function buildThirdParties(config) {
|
|
305
|
-
const lines = config.thirdParties.map((tp) => `- **${tp.name}** — ${tp.purpose}`);
|
|
306
|
-
return {
|
|
307
|
-
id: "third-parties",
|
|
308
|
-
title: "Third-Party Services",
|
|
309
|
-
body: lines.length > 0 ? `We share data with the following third-party services:\n\n${lines.join("\n")}` : "We do not share your data with third-party services."
|
|
310
|
-
};
|
|
269
|
+
function buildCcpaSupplement(config) {
|
|
270
|
+
if (!config.jurisdictions.includes("ca")) return null;
|
|
271
|
+
return section("ccpa-supplement", [
|
|
272
|
+
heading("California Privacy Rights (CCPA)", { reason: "Required by CCPA" }),
|
|
273
|
+
p(["If you are a California resident, you have the following additional rights:"]),
|
|
274
|
+
ul([
|
|
275
|
+
li(["Right to Know — You may request disclosure of the personal information we collect, use, and share about you."]),
|
|
276
|
+
li(["Right to Delete — You may request deletion of personal information we have collected about you."]),
|
|
277
|
+
li(["Right to Opt-Out — You may opt out of the sale of your personal information."]),
|
|
278
|
+
li(["Right to Non-Discrimination — We will not discriminate against you for exercising your CCPA rights."])
|
|
279
|
+
])
|
|
280
|
+
]);
|
|
311
281
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
function buildUserRights(config) {
|
|
323
|
-
return {
|
|
324
|
-
id: "user-rights",
|
|
325
|
-
title: "Your Rights",
|
|
326
|
-
body: `You have the following rights regarding your personal data:\n\n${config.userRights.map((right) => {
|
|
327
|
-
return `- ${RIGHTS_LABELS[right] ?? right}`;
|
|
328
|
-
}).join("\n")}`
|
|
329
|
-
};
|
|
282
|
+
function buildContact$1(config) {
|
|
283
|
+
return section("contact", [
|
|
284
|
+
heading("Contact Us"),
|
|
285
|
+
p(["Contact us:"]),
|
|
286
|
+
ul([
|
|
287
|
+
li([bold("Legal Name: "), config.company.legalName]),
|
|
288
|
+
li([bold("Address: "), config.company.address]),
|
|
289
|
+
li([bold("Email: "), config.company.contact])
|
|
290
|
+
])
|
|
291
|
+
]);
|
|
330
292
|
}
|
|
331
293
|
const SECTION_BUILDERS$1 = [
|
|
332
294
|
buildIntroduction$1,
|
|
@@ -341,231 +303,159 @@ const SECTION_BUILDERS$1 = [
|
|
|
341
303
|
buildCcpaSupplement,
|
|
342
304
|
buildContact$1
|
|
343
305
|
];
|
|
344
|
-
function
|
|
345
|
-
|
|
346
|
-
return options.formats.map((format) => {
|
|
347
|
-
switch (format) {
|
|
348
|
-
case "markdown": return {
|
|
349
|
-
format,
|
|
350
|
-
content: renderMarkdown(sections),
|
|
351
|
-
sections
|
|
352
|
-
};
|
|
353
|
-
case "html": return {
|
|
354
|
-
format,
|
|
355
|
-
content: renderHTML(sections),
|
|
356
|
-
sections
|
|
357
|
-
};
|
|
358
|
-
case "pdf": throw new Error("pdf format is not yet implemented");
|
|
359
|
-
case "jsx": throw new Error("jsx format is not yet implemented");
|
|
360
|
-
default: throw new Error(`Unsupported format: ${format}`);
|
|
361
|
-
}
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
function buildAcceptance(config) {
|
|
365
|
-
return {
|
|
366
|
-
id: "tos-acceptance",
|
|
367
|
-
title: "Acceptance of Terms",
|
|
368
|
-
body: `By accessing or using our services, you agree to be bound by these Terms. You accept these Terms by:\n\n${config.acceptance.methods.map((m) => `- ${m}`).join("\n")}\n\nIf you do not agree to these Terms, you may not use our services.`
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
function buildAccounts(config) {
|
|
372
|
-
if (!config.accounts) return null;
|
|
373
|
-
const { registrationRequired, userResponsibleForCredentials, companyCanTerminate } = config.accounts;
|
|
374
|
-
const lines = [];
|
|
375
|
-
if (registrationRequired) lines.push("You must create an account to access certain features of our services. You agree to provide accurate, current, and complete information during registration.");
|
|
376
|
-
if (userResponsibleForCredentials) lines.push("You are responsible for maintaining the confidentiality of your account credentials and for all activities that occur under your account. You must notify us immediately of any unauthorized use of your account.");
|
|
377
|
-
if (companyCanTerminate) lines.push(`${config.company.name} reserves the right to suspend or terminate your account at any time, with or without notice, for any reason including violation of these Terms.`);
|
|
378
|
-
return {
|
|
379
|
-
id: "tos-accounts",
|
|
380
|
-
title: "Accounts",
|
|
381
|
-
body: lines.join("\n\n")
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
function buildAvailability(config) {
|
|
385
|
-
if (!config.availability) return null;
|
|
386
|
-
const lines = [];
|
|
387
|
-
if (config.availability.noUptimeGuarantee) lines.push("We do not guarantee that our services will be available at all times. Our services may be subject to interruptions, delays, or errors.");
|
|
388
|
-
if (config.availability.maintenanceWindows) lines.push(`**Maintenance:** ${config.availability.maintenanceWindows}`);
|
|
389
|
-
return {
|
|
390
|
-
id: "tos-availability",
|
|
391
|
-
title: "Service Availability",
|
|
392
|
-
body: lines.join("\n\n")
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
function buildChangesToTerms(config) {
|
|
396
|
-
if (!config.changesPolicy) return null;
|
|
397
|
-
const { noticeMethod, noticePeriodDays } = config.changesPolicy;
|
|
398
|
-
return {
|
|
399
|
-
id: "tos-changes",
|
|
400
|
-
title: "Changes to These Terms",
|
|
401
|
-
body: `We may update these Terms from time to time. We will notify you of material changes via ${noticeMethod}${noticePeriodDays ? ` at least **${noticePeriodDays} days** before they take effect` : " before they take effect"}. Your continued use of our services after changes become effective constitutes your acceptance of the revised Terms.`
|
|
402
|
-
};
|
|
306
|
+
function compilePrivacyDocument(config) {
|
|
307
|
+
return SECTION_BUILDERS$1.map((builder) => builder(config)).filter((s) => s !== null);
|
|
403
308
|
}
|
|
404
|
-
function
|
|
405
|
-
return {
|
|
406
|
-
id: "tos-contact",
|
|
407
|
-
title: "Contact Us",
|
|
408
|
-
body: `If you have any questions about these Terms, please contact us at:
|
|
409
|
-
|
|
410
|
-
**${config.company.legalName}**
|
|
411
|
-
${config.company.address}
|
|
412
|
-
${config.company.contact}`
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
function buildDisclaimers(config) {
|
|
416
|
-
if (!config.disclaimers) return null;
|
|
417
|
-
const lines = [];
|
|
418
|
-
if (config.disclaimers.serviceProvidedAsIs) lines.push("OUR SERVICES ARE PROVIDED \"AS IS\" AND \"AS AVAILABLE\" WITHOUT WARRANTIES OF ANY KIND.");
|
|
419
|
-
if (config.disclaimers.noWarranties) lines.push(`${config.company.legalName} EXPRESSLY DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.`);
|
|
420
|
-
return {
|
|
421
|
-
id: "tos-disclaimers",
|
|
422
|
-
title: "Disclaimer of Warranties",
|
|
423
|
-
body: lines.join("\n\n")
|
|
424
|
-
};
|
|
309
|
+
function buildIntroduction(config) {
|
|
310
|
+
return section("tos-introduction", [heading("Terms of Service"), p([`These Terms of Service ("Terms") govern your use of services provided by ${config.company.name} ("we", "us", or "our"). By using our services, you agree to these Terms. Effective Date: ${config.effectiveDate}.`])]);
|
|
425
311
|
}
|
|
426
|
-
function
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
mediation: "Any disputes arising out of or relating to these Terms or our services shall first be submitted to non-binding mediation before pursuing other remedies."
|
|
433
|
-
}[method] ?? "Disputes arising out of or relating to these Terms shall be resolved as described below."];
|
|
434
|
-
if (venue) lines.push(`**Venue:** ${venue}`);
|
|
435
|
-
if (classActionWaiver) lines.push("**Class Action Waiver:** You agree that any dispute resolution proceedings will be conducted only on an individual basis and not in a class, consolidated, or representative action.");
|
|
436
|
-
return {
|
|
437
|
-
id: "tos-dispute-resolution",
|
|
438
|
-
title: "Dispute Resolution",
|
|
439
|
-
body: lines.join("\n\n")
|
|
440
|
-
};
|
|
312
|
+
function buildAcceptance(config) {
|
|
313
|
+
return section("tos-acceptance", [
|
|
314
|
+
heading("Acceptance of Terms"),
|
|
315
|
+
p(["You accept these Terms by:"]),
|
|
316
|
+
ul(config.acceptance.methods.map((m) => li([m])))
|
|
317
|
+
]);
|
|
441
318
|
}
|
|
442
319
|
function buildEligibility(config) {
|
|
443
320
|
if (!config.eligibility) return null;
|
|
444
321
|
const { minimumAge, jurisdictionRestrictions } = config.eligibility;
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
return {
|
|
451
|
-
id: "tos-eligibility",
|
|
452
|
-
title: "Eligibility",
|
|
453
|
-
body
|
|
454
|
-
};
|
|
322
|
+
return section("tos-eligibility", [
|
|
323
|
+
heading("Eligibility"),
|
|
324
|
+
p([`You must be at least ${minimumAge} years old to use our services. By using the services, you represent that you meet this age requirement.`]),
|
|
325
|
+
...jurisdictionRestrictions && jurisdictionRestrictions.length > 0 ? [p(["Our services are not available in the following jurisdictions:"]), ul(jurisdictionRestrictions.map((j) => li([j])))] : []
|
|
326
|
+
]);
|
|
455
327
|
}
|
|
456
|
-
function
|
|
457
|
-
return
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
328
|
+
function buildAccounts(config) {
|
|
329
|
+
if (!config.accounts) return null;
|
|
330
|
+
const { registrationRequired, userResponsibleForCredentials, companyCanTerminate } = config.accounts;
|
|
331
|
+
const items = [];
|
|
332
|
+
if (registrationRequired) items.push("Registration is required to access certain features of our services.");
|
|
333
|
+
if (userResponsibleForCredentials) items.push("You are responsible for maintaining the confidentiality of your account credentials and for all activity under your account.");
|
|
334
|
+
if (companyCanTerminate) items.push("We reserve the right to terminate or suspend accounts at our discretion.");
|
|
335
|
+
return section("tos-accounts", [heading("Accounts"), ul(items.map((i) => li([i])))]);
|
|
462
336
|
}
|
|
463
|
-
function
|
|
464
|
-
if (!config.
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
337
|
+
function buildProhibitedUses(config) {
|
|
338
|
+
if (!config.prohibitedUses || config.prohibitedUses.length === 0) return null;
|
|
339
|
+
return section("tos-prohibited-uses", [
|
|
340
|
+
heading("Prohibited Uses"),
|
|
341
|
+
p(["You may not use our services for the following purposes:"]),
|
|
342
|
+
ul(config.prohibitedUses.map((u) => li([u])))
|
|
343
|
+
]);
|
|
344
|
+
}
|
|
345
|
+
function buildUserContent(config) {
|
|
346
|
+
if (!config.userContent) return null;
|
|
347
|
+
const { usersOwnContent, licenseGrantedToCompany, licenseDescription, companyCanRemoveContent } = config.userContent;
|
|
348
|
+
const items = [];
|
|
349
|
+
if (usersOwnContent) items.push("You retain ownership of content you submit to our services.");
|
|
350
|
+
if (licenseGrantedToCompany) items.push(licenseDescription ?? "By submitting content, you grant us a license to use, reproduce, and display that content in connection with our services.");
|
|
351
|
+
if (companyCanRemoveContent) items.push("We reserve the right to remove content that violates these Terms or that we find objectionable.");
|
|
352
|
+
return section("tos-user-content", [heading("User Content"), ul(items.map((i) => li([i])))]);
|
|
473
353
|
}
|
|
474
354
|
function buildIntellectualProperty(config) {
|
|
475
355
|
if (!config.intellectualProperty) return null;
|
|
476
356
|
const { companyOwnsService, usersMayNotCopy } = config.intellectualProperty;
|
|
477
|
-
const
|
|
478
|
-
if (companyOwnsService)
|
|
479
|
-
if (usersMayNotCopy)
|
|
480
|
-
return
|
|
481
|
-
id: "tos-intellectual-property",
|
|
482
|
-
title: "Intellectual Property",
|
|
483
|
-
body: lines.join("\n\n")
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
function buildIntroduction(config) {
|
|
487
|
-
const privacyLine = config.privacyPolicyUrl ? `\n\nFor information about how we collect and use your data, please review our [Privacy Policy](${config.privacyPolicyUrl}).` : "";
|
|
488
|
-
return {
|
|
489
|
-
id: "tos-introduction",
|
|
490
|
-
title: "Terms of Service",
|
|
491
|
-
body: `These Terms of Service ("Terms") govern your access to and use of the services provided by ${config.company.name} ("${config.company.name}", "we", "us", or "our"). By using our services, you agree to these Terms.
|
|
492
|
-
|
|
493
|
-
**Effective Date:** ${config.effectiveDate}${privacyLine}`
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
function buildLimitationOfLiability(config) {
|
|
497
|
-
if (!config.limitationOfLiability) return null;
|
|
498
|
-
const lines = [];
|
|
499
|
-
if (config.limitationOfLiability.excludesIndirectDamages) lines.push(`TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, ${config.company.legalName.toUpperCase()} SHALL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS OR REVENUES, WHETHER INCURRED DIRECTLY OR INDIRECTLY, OR ANY LOSS OF DATA, USE, GOODWILL, OR OTHER INTANGIBLE LOSSES.`);
|
|
500
|
-
if (config.limitationOfLiability.liabilityCap) lines.push(`**Liability Cap:** ${config.limitationOfLiability.liabilityCap}`);
|
|
501
|
-
return {
|
|
502
|
-
id: "tos-limitation-of-liability",
|
|
503
|
-
title: "Limitation of Liability",
|
|
504
|
-
body: lines.join("\n\n")
|
|
505
|
-
};
|
|
357
|
+
const items = [];
|
|
358
|
+
if (companyOwnsService) items.push(`All content, features, and functionality of our services are owned by ${config.company.name} and are protected by intellectual property laws.`);
|
|
359
|
+
if (usersMayNotCopy) items.push("You may not copy, modify, distribute, sell, or lease any part of our services without our express written permission.");
|
|
360
|
+
return section("tos-intellectual-property", [heading("Intellectual Property"), ul(items.map((i) => li([i])))]);
|
|
506
361
|
}
|
|
507
362
|
function buildPayments(config) {
|
|
508
|
-
if (!config.payments
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
if (
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
};
|
|
363
|
+
if (!config.payments) return null;
|
|
364
|
+
const { hasPaidFeatures, refundPolicy, priceChangesNotice } = config.payments;
|
|
365
|
+
const items = [];
|
|
366
|
+
if (hasPaidFeatures) items.push("Some features of our services require payment.");
|
|
367
|
+
if (refundPolicy) items.push(refundPolicy);
|
|
368
|
+
if (priceChangesNotice) items.push(priceChangesNotice);
|
|
369
|
+
if (items.length === 0) return null;
|
|
370
|
+
return section("tos-payments", [heading("Payments"), ul(items.map((i) => li([i])))]);
|
|
517
371
|
}
|
|
518
|
-
function
|
|
519
|
-
if (!config.
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
372
|
+
function buildAvailability(config) {
|
|
373
|
+
if (!config.availability) return null;
|
|
374
|
+
const { noUptimeGuarantee, maintenanceWindows } = config.availability;
|
|
375
|
+
const items = [];
|
|
376
|
+
if (noUptimeGuarantee) items.push("We do not guarantee uninterrupted or error-free access to our services.");
|
|
377
|
+
if (maintenanceWindows) items.push(maintenanceWindows);
|
|
378
|
+
return section("tos-availability", [heading("Service Availability"), ul(items.map((i) => li([i])))]);
|
|
525
379
|
}
|
|
526
380
|
function buildTermination(config) {
|
|
527
381
|
if (!config.termination) return null;
|
|
528
382
|
const { companyCanTerminate, userCanTerminate, effectOfTermination } = config.termination;
|
|
529
|
-
const
|
|
530
|
-
if (companyCanTerminate)
|
|
531
|
-
if (userCanTerminate)
|
|
532
|
-
if (effectOfTermination)
|
|
533
|
-
return
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
};
|
|
383
|
+
const items = [];
|
|
384
|
+
if (companyCanTerminate) items.push("We may terminate or suspend your access to our services at any time, with or without cause or notice.");
|
|
385
|
+
if (userCanTerminate) items.push("You may terminate your use of our services at any time.");
|
|
386
|
+
if (effectOfTermination) items.push(effectOfTermination);
|
|
387
|
+
return section("tos-termination", [heading("Termination"), ul(items.map((i) => li([i])))]);
|
|
388
|
+
}
|
|
389
|
+
function buildDisclaimers(config) {
|
|
390
|
+
if (!config.disclaimers) return null;
|
|
391
|
+
const { serviceProvidedAsIs, noWarranties } = config.disclaimers;
|
|
392
|
+
const items = [];
|
|
393
|
+
if (serviceProvidedAsIs) items.push("Our services are provided on an \"as is\" and \"as available\" basis.");
|
|
394
|
+
if (noWarranties) items.push("We make no warranties, express or implied, regarding the reliability, accuracy, or fitness for a particular purpose of our services.");
|
|
395
|
+
return section("tos-disclaimers", [heading("Disclaimers"), ul(items.map((i) => li([i])))]);
|
|
396
|
+
}
|
|
397
|
+
function buildLimitationOfLiability(config) {
|
|
398
|
+
if (!config.limitationOfLiability) return null;
|
|
399
|
+
const { excludesIndirectDamages, liabilityCap } = config.limitationOfLiability;
|
|
400
|
+
const items = [];
|
|
401
|
+
if (excludesIndirectDamages) items.push("To the fullest extent permitted by law, we shall not be liable for any indirect, incidental, special, or consequential damages.");
|
|
402
|
+
if (liabilityCap) items.push(liabilityCap);
|
|
403
|
+
return section("tos-limitation-of-liability", [heading("Limitation of Liability"), ul(items.map((i) => li([i])))]);
|
|
404
|
+
}
|
|
405
|
+
function buildIndemnification(config) {
|
|
406
|
+
if (!config.indemnification) return null;
|
|
407
|
+
const { userIndemnifiesCompany, scope } = config.indemnification;
|
|
408
|
+
if (!userIndemnifiesCompany) return null;
|
|
409
|
+
return section("tos-indemnification", [heading("Indemnification"), p([scope ?? `You agree to indemnify and hold harmless ${config.company.name} and its officers, directors, employees, and agents from any claims arising out of your use of the services or violation of these Terms.`])]);
|
|
538
410
|
}
|
|
539
411
|
function buildThirdPartyServices(config) {
|
|
540
412
|
if (!config.thirdPartyServices || config.thirdPartyServices.length === 0) return null;
|
|
541
|
-
return
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
413
|
+
return section("tos-third-party-services", [
|
|
414
|
+
heading("Third-Party Services"),
|
|
415
|
+
p(["Our services may integrate with or link to third-party services:"]),
|
|
416
|
+
ul(config.thirdPartyServices.map((t) => li([
|
|
417
|
+
bold(t.name),
|
|
418
|
+
" — ",
|
|
419
|
+
t.purpose
|
|
420
|
+
])))
|
|
421
|
+
]);
|
|
546
422
|
}
|
|
547
|
-
function
|
|
548
|
-
if (!config.
|
|
549
|
-
const {
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
423
|
+
function buildDisputeResolution(config) {
|
|
424
|
+
if (!config.disputeResolution) return null;
|
|
425
|
+
const { method, venue, classActionWaiver } = config.disputeResolution;
|
|
426
|
+
const items = [];
|
|
427
|
+
const methodLabel = method === "arbitration" ? "binding arbitration" : method === "mediation" ? "mediation" : "litigation";
|
|
428
|
+
items.push(`Any disputes arising from these Terms or your use of our services shall be resolved through ${methodLabel}.`);
|
|
429
|
+
if (venue) items.push(`Venue: ${venue}.`);
|
|
430
|
+
if (classActionWaiver) items.push("You waive any right to participate in class action lawsuits or class-wide arbitration.");
|
|
431
|
+
return section("tos-dispute-resolution", [heading("Dispute Resolution"), ul(items.map((i) => li([i])))]);
|
|
432
|
+
}
|
|
433
|
+
function buildGoverningLaw(config) {
|
|
434
|
+
return section("tos-governing-law", [heading("Governing Law"), p([`These Terms are governed by the laws of ${config.governingLaw.jurisdiction}, without regard to conflict of law principles.`])]);
|
|
435
|
+
}
|
|
436
|
+
function buildChanges(config) {
|
|
437
|
+
if (!config.changesPolicy) return null;
|
|
438
|
+
const { noticeMethod, noticePeriodDays } = config.changesPolicy;
|
|
439
|
+
const notice = noticePeriodDays ? `at least ${noticePeriodDays} days' notice via ${noticeMethod}` : `notice via ${noticeMethod}`;
|
|
440
|
+
return section("tos-changes", [heading("Changes to These Terms"), p([`We may update these Terms from time to time. We will provide ${notice} before changes take effect. Continued use of our services after changes constitutes acceptance of the revised Terms.`])]);
|
|
441
|
+
}
|
|
442
|
+
function buildContact(config) {
|
|
443
|
+
return section("tos-contact", [
|
|
444
|
+
heading("Contact Us"),
|
|
445
|
+
p(["If you have questions about these Terms, please contact us:"]),
|
|
446
|
+
ul([
|
|
447
|
+
li([bold("Legal Name: "), config.company.legalName]),
|
|
448
|
+
li([bold("Address: "), config.company.address]),
|
|
449
|
+
li([bold("Email: "), config.company.contact])
|
|
450
|
+
])
|
|
451
|
+
]);
|
|
562
452
|
}
|
|
563
453
|
const SECTION_BUILDERS = [
|
|
564
454
|
buildIntroduction,
|
|
565
455
|
buildAcceptance,
|
|
566
456
|
buildEligibility,
|
|
567
457
|
buildAccounts,
|
|
568
|
-
|
|
458
|
+
buildProhibitedUses,
|
|
569
459
|
buildUserContent,
|
|
570
460
|
buildIntellectualProperty,
|
|
571
461
|
buildPayments,
|
|
@@ -577,28 +467,35 @@ const SECTION_BUILDERS = [
|
|
|
577
467
|
buildThirdPartyServices,
|
|
578
468
|
buildDisputeResolution,
|
|
579
469
|
buildGoverningLaw,
|
|
580
|
-
|
|
470
|
+
buildChanges,
|
|
581
471
|
buildContact
|
|
582
472
|
];
|
|
583
|
-
function
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
473
|
+
function compileTermsDocument(config) {
|
|
474
|
+
return SECTION_BUILDERS.map((builder) => builder(config)).filter((s) => s !== null);
|
|
475
|
+
}
|
|
476
|
+
function compile(input) {
|
|
477
|
+
if (input.type === "privacy") {
|
|
478
|
+
const { type: _, ...config } = input;
|
|
479
|
+
return {
|
|
480
|
+
type: "document",
|
|
481
|
+
policyType: "privacy",
|
|
482
|
+
sections: compilePrivacyDocument(config)
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
if (input.type === "terms") {
|
|
486
|
+
const { type: _, ...config } = input;
|
|
487
|
+
return {
|
|
488
|
+
type: "document",
|
|
489
|
+
policyType: "terms",
|
|
490
|
+
sections: compileTermsDocument(config)
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
const { type: _, ...config } = input;
|
|
494
|
+
return {
|
|
495
|
+
type: "document",
|
|
496
|
+
policyType: "cookie",
|
|
497
|
+
sections: compileCookieDocument(config)
|
|
498
|
+
};
|
|
602
499
|
}
|
|
603
500
|
function isOpenPolicyConfig(value) {
|
|
604
501
|
if (value === null || typeof value !== "object") return false;
|
|
@@ -767,22 +664,49 @@ function expandOpenPolicyConfig(config) {
|
|
|
767
664
|
});
|
|
768
665
|
return inputs;
|
|
769
666
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
case "
|
|
777
|
-
const { type: _, ...config } = input;
|
|
778
|
-
return compileTermsOfService(config, options);
|
|
779
|
-
}
|
|
780
|
-
case "cookie": {
|
|
781
|
-
const { type: _, ...config } = input;
|
|
782
|
-
return compileCookiePolicy(config, options);
|
|
783
|
-
}
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region ../renderers/src/index.ts
|
|
669
|
+
function filenameFor(type, ext) {
|
|
670
|
+
switch (type) {
|
|
671
|
+
case "privacy": return `privacy-policy.${ext}`;
|
|
672
|
+
case "terms": return `terms-of-service.${ext}`;
|
|
673
|
+
case "cookie": return `cookie-policy.${ext}`;
|
|
784
674
|
}
|
|
785
675
|
}
|
|
676
|
+
async function compilePolicy(input, options) {
|
|
677
|
+
const doc = compile(input);
|
|
678
|
+
const formats = options?.formats ?? ["markdown"];
|
|
679
|
+
return Promise.all(formats.map(async (format) => {
|
|
680
|
+
switch (format) {
|
|
681
|
+
case "markdown": {
|
|
682
|
+
const { renderMarkdown } = await import("./markdown-8LgFTJSZ.js").then((n) => n.t);
|
|
683
|
+
return {
|
|
684
|
+
format,
|
|
685
|
+
filename: filenameFor(input.type, "md"),
|
|
686
|
+
content: renderMarkdown(doc)
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
case "html": {
|
|
690
|
+
const { renderHTML } = await import("./html-D0xZQ7Fi.js").then((n) => n.t);
|
|
691
|
+
return {
|
|
692
|
+
format,
|
|
693
|
+
filename: filenameFor(input.type, "html"),
|
|
694
|
+
content: renderHTML(doc)
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
case "pdf": {
|
|
698
|
+
const { renderPDF } = await import("./pdf-CTsnJvZX.js").then((n) => n.t);
|
|
699
|
+
return {
|
|
700
|
+
format,
|
|
701
|
+
filename: filenameFor(input.type, "pdf"),
|
|
702
|
+
content: await renderPDF(doc)
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
case "jsx": throw new Error("jsx format is not yet implemented");
|
|
706
|
+
default: throw new Error(`Format not yet implemented: ${format}`);
|
|
707
|
+
}
|
|
708
|
+
}));
|
|
709
|
+
}
|
|
786
710
|
//#endregion
|
|
787
711
|
//#region src/index.ts
|
|
788
712
|
async function generatePolicies(configPath, outDir, formats) {
|
|
@@ -798,7 +722,7 @@ async function generatePolicies(configPath, outDir, formats) {
|
|
|
798
722
|
if (issue.level === "error") throw new Error(`[openpolicy] ${issue.message}`);
|
|
799
723
|
console.warn(`[openpolicy] Warning: ${issue.message}`);
|
|
800
724
|
}
|
|
801
|
-
const results = compilePolicy(input, { formats });
|
|
725
|
+
const results = await compilePolicy(input, { formats });
|
|
802
726
|
const outputFilename = input.type === "terms" ? "terms-of-service" : input.type === "cookie" ? "cookie-policy" : "privacy-policy";
|
|
803
727
|
for (const result of results) await writeFile(join(outDir, `${outputFilename}.${result.format === "markdown" ? "md" : result.format}`), result.content, "utf8");
|
|
804
728
|
}
|