@openpolicy/core 0.0.11 → 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/README.md +5 -4
- package/dist/index.d.ts +77 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +424 -615
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/dist/privacy.d.ts +0 -7
- package/dist/privacy.d.ts.map +0 -1
- package/dist/privacy.test.d.ts +0 -2
- package/dist/privacy.test.d.ts.map +0 -1
- package/dist/renderers/html.d.ts +0 -3
- package/dist/renderers/html.d.ts.map +0 -1
- package/dist/renderers/markdown.d.ts +0 -3
- package/dist/renderers/markdown.d.ts.map +0 -1
- package/dist/templates/privacy/ccpa-supplement.d.ts +0 -3
- package/dist/templates/privacy/ccpa-supplement.d.ts.map +0 -1
- package/dist/templates/privacy/contact.d.ts +0 -3
- package/dist/templates/privacy/contact.d.ts.map +0 -1
- package/dist/templates/privacy/cookies.d.ts +0 -3
- package/dist/templates/privacy/cookies.d.ts.map +0 -1
- package/dist/templates/privacy/data-collected.d.ts +0 -3
- package/dist/templates/privacy/data-collected.d.ts.map +0 -1
- package/dist/templates/privacy/data-retention.d.ts +0 -3
- package/dist/templates/privacy/data-retention.d.ts.map +0 -1
- package/dist/templates/privacy/gdpr-supplement.d.ts +0 -3
- package/dist/templates/privacy/gdpr-supplement.d.ts.map +0 -1
- package/dist/templates/privacy/introduction.d.ts +0 -3
- package/dist/templates/privacy/introduction.d.ts.map +0 -1
- package/dist/templates/privacy/legal-basis.d.ts +0 -3
- package/dist/templates/privacy/legal-basis.d.ts.map +0 -1
- package/dist/templates/privacy/third-parties.d.ts +0 -3
- package/dist/templates/privacy/third-parties.d.ts.map +0 -1
- package/dist/templates/privacy/user-rights.d.ts +0 -3
- package/dist/templates/privacy/user-rights.d.ts.map +0 -1
- package/dist/templates/terms/acceptance.d.ts +0 -3
- package/dist/templates/terms/acceptance.d.ts.map +0 -1
- package/dist/templates/terms/accounts.d.ts +0 -3
- package/dist/templates/terms/accounts.d.ts.map +0 -1
- package/dist/templates/terms/availability.d.ts +0 -3
- package/dist/templates/terms/availability.d.ts.map +0 -1
- package/dist/templates/terms/changes-to-terms.d.ts +0 -3
- package/dist/templates/terms/changes-to-terms.d.ts.map +0 -1
- package/dist/templates/terms/contact.d.ts +0 -3
- package/dist/templates/terms/contact.d.ts.map +0 -1
- package/dist/templates/terms/disclaimers.d.ts +0 -3
- package/dist/templates/terms/disclaimers.d.ts.map +0 -1
- package/dist/templates/terms/dispute-resolution.d.ts +0 -3
- package/dist/templates/terms/dispute-resolution.d.ts.map +0 -1
- package/dist/templates/terms/eligibility.d.ts +0 -3
- package/dist/templates/terms/eligibility.d.ts.map +0 -1
- package/dist/templates/terms/governing-law.d.ts +0 -3
- package/dist/templates/terms/governing-law.d.ts.map +0 -1
- package/dist/templates/terms/indemnification.d.ts +0 -3
- package/dist/templates/terms/indemnification.d.ts.map +0 -1
- package/dist/templates/terms/intellectual-property.d.ts +0 -3
- package/dist/templates/terms/intellectual-property.d.ts.map +0 -1
- package/dist/templates/terms/introduction.d.ts +0 -3
- package/dist/templates/terms/introduction.d.ts.map +0 -1
- package/dist/templates/terms/limitation-of-liability.d.ts +0 -3
- package/dist/templates/terms/limitation-of-liability.d.ts.map +0 -1
- package/dist/templates/terms/payments.d.ts +0 -3
- package/dist/templates/terms/payments.d.ts.map +0 -1
- package/dist/templates/terms/prohibited-use.d.ts +0 -3
- package/dist/templates/terms/prohibited-use.d.ts.map +0 -1
- package/dist/templates/terms/termination.d.ts +0 -3
- package/dist/templates/terms/termination.d.ts.map +0 -1
- package/dist/templates/terms/third-party-services.d.ts +0 -3
- package/dist/templates/terms/third-party-services.d.ts.map +0 -1
- package/dist/templates/terms/user-content.d.ts +0 -3
- package/dist/templates/terms/user-content.d.ts.map +0 -1
- package/dist/terms.d.ts +0 -7
- package/dist/terms.d.ts.map +0 -1
- package/dist/terms.test.d.ts +0 -2
- package/dist/terms.test.d.ts.map +0 -1
- package/dist/types.d.ts +0 -119
- package/dist/types.d.ts.map +0 -1
- package/dist/validate-terms.d.ts +0 -3
- package/dist/validate-terms.d.ts.map +0 -1
- package/dist/validate-terms.test.d.ts +0 -2
- package/dist/validate-terms.test.d.ts.map +0 -1
- package/dist/validate.d.ts +0 -3
- package/dist/validate.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,383 +1,307 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/renderers/html.ts
|
|
8
|
-
function renderHTML(sections) {
|
|
9
|
-
return marked(renderMarkdown(sections));
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/templates/cookie/consent.ts
|
|
13
|
-
function buildConsent(config) {
|
|
14
|
-
if (!config.consentMechanism) return null;
|
|
15
|
-
const mechanisms = [];
|
|
16
|
-
if (config.consentMechanism.hasBanner) mechanisms.push("A **cookie consent banner** displayed on your first visit, where you can accept or decline non-essential cookies");
|
|
17
|
-
if (config.consentMechanism.hasPreferencePanel) mechanisms.push("A **preference panel** where you can manage individual cookie categories");
|
|
18
|
-
if (config.consentMechanism.canWithdraw) mechanisms.push("The ability to **withdraw your consent** at any time by updating your cookie preferences");
|
|
1
|
+
//#region src/documents/helpers.ts
|
|
2
|
+
const heading = (value, levelOrContext, context) => {
|
|
3
|
+
const level = typeof levelOrContext === "number" ? levelOrContext : void 0;
|
|
4
|
+
const ctx = typeof levelOrContext === "object" ? levelOrContext : context;
|
|
19
5
|
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Essential cookies do not require your consent as they are strictly necessary for the operation of our service.`
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/templates/cookie/contact.ts
|
|
29
|
-
function buildContact$2(config) {
|
|
30
|
-
return {
|
|
31
|
-
id: "contact",
|
|
32
|
-
title: "Contact Us",
|
|
33
|
-
body: `If you have any questions about our use of cookies or this Cookie Policy, please contact us:
|
|
34
|
-
|
|
35
|
-
**${config.company.legalName}**
|
|
36
|
-
${config.company.address}
|
|
37
|
-
${config.company.contact}`
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/templates/cookie/cookie-duration.ts
|
|
42
|
-
function buildCookieDuration(_config) {
|
|
43
|
-
return {
|
|
44
|
-
id: "cookie-duration",
|
|
45
|
-
title: "Cookie Duration",
|
|
46
|
-
body: `Cookies can be either **session cookies** or **persistent cookies**:
|
|
47
|
-
|
|
48
|
-
- **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.
|
|
49
|
-
- **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.
|
|
50
|
-
|
|
51
|
-
The specific duration of each cookie depends on its purpose and is determined at the time it is set.`
|
|
6
|
+
type: "heading",
|
|
7
|
+
...level !== void 0 && { level },
|
|
8
|
+
value,
|
|
9
|
+
...ctx && { context: ctx }
|
|
52
10
|
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
11
|
+
};
|
|
12
|
+
const text = (value, context) => ({
|
|
13
|
+
type: "text",
|
|
14
|
+
value,
|
|
15
|
+
...context && { context }
|
|
16
|
+
});
|
|
17
|
+
const bold = (value, context) => ({
|
|
18
|
+
type: "bold",
|
|
19
|
+
value,
|
|
20
|
+
...context && { context }
|
|
21
|
+
});
|
|
22
|
+
const italic = (value, context) => ({
|
|
23
|
+
type: "italic",
|
|
24
|
+
value,
|
|
25
|
+
...context && { context }
|
|
26
|
+
});
|
|
27
|
+
const link = (href, value, context) => ({
|
|
28
|
+
type: "link",
|
|
29
|
+
href,
|
|
30
|
+
value,
|
|
31
|
+
...context && { context }
|
|
32
|
+
});
|
|
33
|
+
const p = (children, context) => ({
|
|
34
|
+
type: "paragraph",
|
|
35
|
+
children: children.map((c) => typeof c === "string" ? text(c) : c),
|
|
36
|
+
...context && { context }
|
|
37
|
+
});
|
|
38
|
+
const li = (children, context) => ({
|
|
39
|
+
type: "listItem",
|
|
40
|
+
children: children.map((c) => typeof c === "string" ? text(c) : c),
|
|
41
|
+
...context && { context }
|
|
42
|
+
});
|
|
43
|
+
const ul = (items, context) => ({
|
|
44
|
+
type: "list",
|
|
45
|
+
items,
|
|
46
|
+
...context && { context }
|
|
47
|
+
});
|
|
48
|
+
const ol = (items, context) => ({
|
|
49
|
+
type: "list",
|
|
50
|
+
ordered: true,
|
|
51
|
+
items,
|
|
52
|
+
...context && { context }
|
|
53
|
+
});
|
|
54
|
+
const section = (id, content, context) => ({
|
|
55
|
+
type: "section",
|
|
56
|
+
id,
|
|
57
|
+
content,
|
|
58
|
+
...context && { context }
|
|
59
|
+
});
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/documents/cookie.ts
|
|
97
62
|
function buildIntroduction$2(config) {
|
|
98
|
-
return {
|
|
99
|
-
id: "introduction",
|
|
100
|
-
title: "Introduction",
|
|
101
|
-
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.
|
|
102
|
-
|
|
103
|
-
**Effective Date:** ${config.effectiveDate}
|
|
104
|
-
|
|
105
|
-
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}.`
|
|
106
|
-
};
|
|
63
|
+
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}.`])]);
|
|
107
64
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
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.");
|
|
115
|
-
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.");
|
|
116
|
-
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.");
|
|
117
|
-
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.");
|
|
118
|
-
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.");
|
|
119
|
-
return {
|
|
120
|
-
id: "jurisdiction",
|
|
121
|
-
title: "Legal Requirements",
|
|
122
|
-
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")}`
|
|
123
|
-
};
|
|
65
|
+
function buildWhatAreCookies() {
|
|
66
|
+
return section("cookie-what-are-cookies", [
|
|
67
|
+
heading("What Are Cookies?"),
|
|
68
|
+
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."]),
|
|
69
|
+
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)."])
|
|
70
|
+
]);
|
|
124
71
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
id: "third-party-cookies",
|
|
150
|
-
title: "Third-Party Cookies",
|
|
151
|
-
body: `Some cookies on our site are placed by third-party services. These third parties may use cookies to collect information about your online activities across different websites. We do not control these third-party cookies.
|
|
152
|
-
|
|
153
|
-
The following third parties may set cookies through our service:\n\n${config.thirdParties.map((tp) => {
|
|
154
|
-
const policyLink = tp.policyUrl ? ` ([Privacy Policy](${tp.policyUrl}))` : "";
|
|
155
|
-
return `- **${tp.name}** — ${tp.purpose}${policyLink}`;
|
|
156
|
-
}).join("\n")}\n\nWe encourage you to review the privacy policies of these third parties to understand their data practices.`
|
|
157
|
-
};
|
|
72
|
+
function buildTypes(config) {
|
|
73
|
+
const types = [];
|
|
74
|
+
if (config.cookies.essential) types.push({
|
|
75
|
+
label: "Essential Cookies",
|
|
76
|
+
description: "Required for the basic functioning of our services. These cannot be disabled."
|
|
77
|
+
});
|
|
78
|
+
if (config.cookies.analytics) types.push({
|
|
79
|
+
label: "Analytics Cookies",
|
|
80
|
+
description: "Help us understand how visitors interact with our services so we can improve them."
|
|
81
|
+
});
|
|
82
|
+
if (config.cookies.functional) types.push({
|
|
83
|
+
label: "Functional Cookies",
|
|
84
|
+
description: "Enable enhanced functionality and personalisation, such as remembering your preferences."
|
|
85
|
+
});
|
|
86
|
+
if (config.cookies.marketing) types.push({
|
|
87
|
+
label: "Marketing Cookies",
|
|
88
|
+
description: "Used to deliver advertisements more relevant to you and your interests."
|
|
89
|
+
});
|
|
90
|
+
if (types.length === 0) return section("cookie-types", [heading("Types of Cookies We Use"), p(["We do not currently use any cookies."])]);
|
|
91
|
+
return section("cookie-types", [heading("Types of Cookies We Use"), ul(types.map((t) => li([
|
|
92
|
+
bold(t.label),
|
|
93
|
+
" — ",
|
|
94
|
+
t.description
|
|
95
|
+
])))]);
|
|
158
96
|
}
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region src/templates/cookie/tracking-technologies.ts
|
|
161
97
|
function buildTrackingTechnologies(config) {
|
|
162
98
|
if (!config.trackingTechnologies || config.trackingTechnologies.length === 0) return null;
|
|
163
|
-
return
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
99
|
+
return section("cookie-tracking-technologies", [
|
|
100
|
+
heading("Other Tracking Technologies"),
|
|
101
|
+
p(["In addition to cookies, we may use the following tracking technologies:"]),
|
|
102
|
+
ul(config.trackingTechnologies.map((t) => li([t])))
|
|
103
|
+
]);
|
|
168
104
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
105
|
+
function buildThirdParties$1(config) {
|
|
106
|
+
if (!config.thirdParties || config.thirdParties.length === 0) return null;
|
|
107
|
+
return section("cookie-third-parties", [
|
|
108
|
+
heading("Third-Party Cookies"),
|
|
109
|
+
p(["The following third parties may set cookies through our services:"]),
|
|
110
|
+
ul(config.thirdParties.map((t) => li([
|
|
111
|
+
bold(t.name),
|
|
112
|
+
" — ",
|
|
113
|
+
t.purpose,
|
|
114
|
+
...t.policyUrl ? [
|
|
115
|
+
" (",
|
|
116
|
+
link(t.policyUrl, "Privacy Policy"),
|
|
117
|
+
")"
|
|
118
|
+
] : []
|
|
119
|
+
])))
|
|
120
|
+
]);
|
|
181
121
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
122
|
+
function buildConsent(config) {
|
|
123
|
+
if (!config.consentMechanism) return null;
|
|
124
|
+
const { hasBanner, hasPreferencePanel, canWithdraw } = config.consentMechanism;
|
|
125
|
+
const items = [];
|
|
126
|
+
if (hasBanner) items.push("We display a cookie consent banner when you first visit our services.");
|
|
127
|
+
if (hasPreferencePanel) items.push("You can manage your cookie preferences at any time via our preference panel.");
|
|
128
|
+
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.");
|
|
129
|
+
if (items.length === 0) return null;
|
|
130
|
+
return section("cookie-consent", [heading("Your Consent"), ul(items.map((i) => li([i])))]);
|
|
131
|
+
}
|
|
132
|
+
function buildManaging() {
|
|
133
|
+
return section("cookie-managing", [
|
|
134
|
+
heading("Managing Cookies"),
|
|
135
|
+
p(["Most web browsers allow you to control cookies through their settings. You can:"]),
|
|
136
|
+
ul([
|
|
137
|
+
li(["Delete cookies already stored on your device"]),
|
|
138
|
+
li(["Block cookies from being set on your device"]),
|
|
139
|
+
li(["Set your browser to notify you when a cookie is being set"])
|
|
140
|
+
]),
|
|
141
|
+
p(["Please note that restricting cookies may impact the functionality of our services. Consult your browser's help documentation for instructions on managing cookies."])
|
|
142
|
+
]);
|
|
143
|
+
}
|
|
144
|
+
function buildJurisdictionEu(config) {
|
|
145
|
+
if (!config.jurisdictions.includes("eu")) return null;
|
|
146
|
+
return section("cookie-jurisdiction-eu", [
|
|
147
|
+
heading("European Users (GDPR)", { reason: "Required under ePrivacy Directive and GDPR" }),
|
|
148
|
+
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."]),
|
|
149
|
+
p(["Essential cookies are set on the basis of our legitimate interests to provide you with a functioning service."])
|
|
150
|
+
]);
|
|
151
|
+
}
|
|
152
|
+
function buildContact$2(config) {
|
|
153
|
+
return section("cookie-contact", [
|
|
154
|
+
heading("Contact Us"),
|
|
155
|
+
p(["If you have questions about this Cookie Policy, please contact us:"]),
|
|
156
|
+
ul([
|
|
157
|
+
li([bold("Legal Name: "), config.company.legalName]),
|
|
158
|
+
li([bold("Address: "), config.company.address]),
|
|
159
|
+
li([bold("Email: "), config.company.contact])
|
|
160
|
+
])
|
|
161
|
+
]);
|
|
192
162
|
}
|
|
193
|
-
//#endregion
|
|
194
|
-
//#region src/cookie.ts
|
|
195
163
|
const SECTION_BUILDERS$2 = [
|
|
196
164
|
buildIntroduction$2,
|
|
197
|
-
buildWhatAreCookies,
|
|
198
|
-
|
|
165
|
+
() => buildWhatAreCookies(),
|
|
166
|
+
buildTypes,
|
|
199
167
|
buildTrackingTechnologies,
|
|
200
|
-
|
|
201
|
-
buildCookieDuration,
|
|
168
|
+
buildThirdParties$1,
|
|
202
169
|
buildConsent,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
buildJurisdiction,
|
|
206
|
-
buildUpdates,
|
|
170
|
+
() => buildManaging(),
|
|
171
|
+
buildJurisdictionEu,
|
|
207
172
|
buildContact$2
|
|
208
173
|
];
|
|
209
|
-
function
|
|
210
|
-
|
|
211
|
-
return options.formats.map((format) => {
|
|
212
|
-
switch (format) {
|
|
213
|
-
case "markdown": return {
|
|
214
|
-
format,
|
|
215
|
-
content: renderMarkdown(sections),
|
|
216
|
-
sections
|
|
217
|
-
};
|
|
218
|
-
case "html": return {
|
|
219
|
-
format,
|
|
220
|
-
content: renderHTML(sections),
|
|
221
|
-
sections
|
|
222
|
-
};
|
|
223
|
-
case "pdf": throw new Error("pdf format is not yet implemented");
|
|
224
|
-
case "jsx": throw new Error("jsx format is not yet implemented");
|
|
225
|
-
default: throw new Error(`Unsupported format: ${format}`);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
174
|
+
function compileCookieDocument(config) {
|
|
175
|
+
return SECTION_BUILDERS$2.map((builder) => builder(config)).filter((s) => s !== null);
|
|
228
176
|
}
|
|
229
177
|
//#endregion
|
|
230
|
-
//#region src/
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
};
|
|
178
|
+
//#region src/documents/privacy.ts
|
|
179
|
+
const RIGHTS_LABELS = {
|
|
180
|
+
access: "Right to access your personal data",
|
|
181
|
+
rectification: "Right to correct inaccurate data",
|
|
182
|
+
erasure: "Right to request deletion of your data",
|
|
183
|
+
portability: "Right to receive your data in a portable format",
|
|
184
|
+
restriction: "Right to restrict how we process your data",
|
|
185
|
+
objection: "Right to object to processing",
|
|
186
|
+
opt_out_sale: "Right to opt out of the sale of your personal information",
|
|
187
|
+
non_discrimination: "Right to non-discriminatory treatment for exercising your rights"
|
|
188
|
+
};
|
|
189
|
+
function buildIntroduction$1(config) {
|
|
190
|
+
return section("introduction", [
|
|
191
|
+
heading("Introduction"),
|
|
192
|
+
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}.`]),
|
|
193
|
+
p([`If you have questions about this policy, please contact us at ${config.company.contact}.`])
|
|
194
|
+
]);
|
|
248
195
|
}
|
|
249
|
-
//#endregion
|
|
250
|
-
//#region src/templates/privacy/children-privacy.ts
|
|
251
196
|
function buildChildrenPrivacy(config) {
|
|
252
197
|
if (!config.children) return null;
|
|
253
198
|
const { underAge, noticeUrl } = config.children;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
199
|
+
return section("children-privacy", [
|
|
200
|
+
heading("Children's Privacy", { reason: "Required by COPPA" }),
|
|
201
|
+
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.`]),
|
|
202
|
+
...noticeUrl ? [p([
|
|
203
|
+
"For more information, see our ",
|
|
204
|
+
link(noticeUrl, "Children's Privacy Notice"),
|
|
205
|
+
"."
|
|
206
|
+
])] : []
|
|
207
|
+
]);
|
|
261
208
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
209
|
+
function buildDataCollected(config) {
|
|
210
|
+
const items = Object.entries(config.dataCollected).map(([category, fields]) => li([bold(category), ul(fields.map((f) => li([f])))]));
|
|
211
|
+
return section("data-collected", [
|
|
212
|
+
heading("Information We Collect"),
|
|
213
|
+
p(["We collect the following categories of information:"]),
|
|
214
|
+
ul(items)
|
|
215
|
+
]);
|
|
216
|
+
}
|
|
217
|
+
function buildLegalBasis(config) {
|
|
218
|
+
if (!config.jurisdictions.includes("eu")) return null;
|
|
219
|
+
return section("legal-basis", [heading("Legal Basis for Processing", { reason: "Required by GDPR Article 13" }), p([config.legalBasis])]);
|
|
220
|
+
}
|
|
221
|
+
function buildDataRetention(config) {
|
|
222
|
+
const items = Object.entries(config.retention).map(([category, period]) => li([
|
|
223
|
+
bold(category),
|
|
224
|
+
": ",
|
|
225
|
+
period
|
|
226
|
+
]));
|
|
227
|
+
return section("data-retention", [
|
|
228
|
+
heading("Data Retention"),
|
|
229
|
+
p(["We retain your data for the following periods:"]),
|
|
230
|
+
ul(items)
|
|
231
|
+
]);
|
|
275
232
|
}
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region src/templates/privacy/cookies.ts
|
|
278
233
|
function buildCookies(config) {
|
|
279
234
|
const enabled = [];
|
|
280
|
-
if (config.cookies.essential) enabled.push("
|
|
281
|
-
if (config.cookies.analytics) enabled.push("
|
|
282
|
-
if (config.cookies.marketing) enabled.push("
|
|
283
|
-
return
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
235
|
+
if (config.cookies.essential) enabled.push("Essential cookies — required for the service to function");
|
|
236
|
+
if (config.cookies.analytics) enabled.push("Analytics cookies — help us understand how the service is used");
|
|
237
|
+
if (config.cookies.marketing) enabled.push("Marketing cookies — used to deliver relevant advertisements");
|
|
238
|
+
if (enabled.length === 0) return section("cookies", [heading("Cookies and Tracking"), p(["We do not use cookies or similar tracking technologies."])]);
|
|
239
|
+
return section("cookies", [
|
|
240
|
+
heading("Cookies and Tracking"),
|
|
241
|
+
p(["We use the following types of cookies and tracking technologies:"]),
|
|
242
|
+
ul(enabled.map((e) => li([e])))
|
|
243
|
+
]);
|
|
288
244
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
245
|
+
function buildThirdParties(config) {
|
|
246
|
+
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."])]);
|
|
247
|
+
return section("third-parties", [
|
|
248
|
+
heading("Third-Party Services"),
|
|
249
|
+
p(["We share data with the following third-party services:"]),
|
|
250
|
+
ul(config.thirdParties.map((t) => li([
|
|
251
|
+
bold(t.name),
|
|
252
|
+
" — ",
|
|
253
|
+
t.purpose
|
|
254
|
+
])))
|
|
255
|
+
]);
|
|
299
256
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
257
|
+
function buildUserRights(config) {
|
|
258
|
+
const items = config.userRights.map((right) => {
|
|
259
|
+
return li([RIGHTS_LABELS[right] ?? right]);
|
|
260
|
+
});
|
|
261
|
+
return section("user-rights", [
|
|
262
|
+
heading("Your Rights"),
|
|
263
|
+
p(["You have the following rights regarding your personal data:"]),
|
|
264
|
+
ul(items)
|
|
265
|
+
]);
|
|
308
266
|
}
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/templates/privacy/gdpr-supplement.ts
|
|
311
267
|
function buildGdprSupplement(config) {
|
|
312
268
|
if (!config.jurisdictions.includes("eu")) return null;
|
|
313
|
-
return
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
//#endregion
|
|
326
|
-
//#region src/templates/privacy/introduction.ts
|
|
327
|
-
function buildIntroduction$1(config) {
|
|
328
|
-
return {
|
|
329
|
-
id: "introduction",
|
|
330
|
-
title: "Introduction",
|
|
331
|
-
body: `This Privacy Policy describes how ${config.company.name} ("we", "us", or "our") collects, uses, and shares information about you when you use our services.
|
|
332
|
-
|
|
333
|
-
**Effective Date:** ${config.effectiveDate}
|
|
334
|
-
|
|
335
|
-
If you have questions about this policy, please contact us at ${config.company.contact}.`
|
|
336
|
-
};
|
|
269
|
+
return section("gdpr-supplement", [
|
|
270
|
+
heading("GDPR Supplemental Disclosures", { reason: "Required by GDPR Article 13" }),
|
|
271
|
+
p(["This section applies to individuals in the European Economic Area (EEA) under the General Data Protection Regulation (GDPR)."]),
|
|
272
|
+
p([
|
|
273
|
+
"Data Controller: ",
|
|
274
|
+
bold(config.company.legalName),
|
|
275
|
+
`, ${config.company.address}`
|
|
276
|
+
]),
|
|
277
|
+
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."]),
|
|
278
|
+
p(["If we transfer your personal data outside the EEA, we ensure adequate safeguards are in place in accordance with GDPR requirements."])
|
|
279
|
+
]);
|
|
337
280
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
function buildThirdParties(config) {
|
|
351
|
-
const lines = config.thirdParties.map((tp) => `- **${tp.name}** — ${tp.purpose}`);
|
|
352
|
-
return {
|
|
353
|
-
id: "third-parties",
|
|
354
|
-
title: "Third-Party Services",
|
|
355
|
-
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."
|
|
356
|
-
};
|
|
281
|
+
function buildCcpaSupplement(config) {
|
|
282
|
+
if (!config.jurisdictions.includes("ca")) return null;
|
|
283
|
+
return section("ccpa-supplement", [
|
|
284
|
+
heading("California Privacy Rights (CCPA)", { reason: "Required by CCPA" }),
|
|
285
|
+
p(["If you are a California resident, you have the following additional rights:"]),
|
|
286
|
+
ul([
|
|
287
|
+
li(["Right to Know — You may request disclosure of the personal information we collect, use, and share about you."]),
|
|
288
|
+
li(["Right to Delete — You may request deletion of personal information we have collected about you."]),
|
|
289
|
+
li(["Right to Opt-Out — You may opt out of the sale of your personal information."]),
|
|
290
|
+
li(["Right to Non-Discrimination — We will not discriminate against you for exercising your CCPA rights."])
|
|
291
|
+
])
|
|
292
|
+
]);
|
|
357
293
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
non_discrimination: "Right to non-discriminatory treatment for exercising your rights"
|
|
369
|
-
};
|
|
370
|
-
function buildUserRights(config) {
|
|
371
|
-
return {
|
|
372
|
-
id: "user-rights",
|
|
373
|
-
title: "Your Rights",
|
|
374
|
-
body: `You have the following rights regarding your personal data:\n\n${config.userRights.map((right) => {
|
|
375
|
-
return `- ${RIGHTS_LABELS[right] ?? right}`;
|
|
376
|
-
}).join("\n")}`
|
|
377
|
-
};
|
|
294
|
+
function buildContact$1(config) {
|
|
295
|
+
return section("contact", [
|
|
296
|
+
heading("Contact Us"),
|
|
297
|
+
p(["Contact us:"]),
|
|
298
|
+
ul([
|
|
299
|
+
li([bold("Legal Name: "), config.company.legalName]),
|
|
300
|
+
li([bold("Address: "), config.company.address]),
|
|
301
|
+
li([bold("Email: "), config.company.contact])
|
|
302
|
+
])
|
|
303
|
+
]);
|
|
378
304
|
}
|
|
379
|
-
//#endregion
|
|
380
|
-
//#region src/privacy.ts
|
|
381
305
|
const SECTION_BUILDERS$1 = [
|
|
382
306
|
buildIntroduction$1,
|
|
383
307
|
buildChildrenPrivacy,
|
|
@@ -391,269 +315,161 @@ const SECTION_BUILDERS$1 = [
|
|
|
391
315
|
buildCcpaSupplement,
|
|
392
316
|
buildContact$1
|
|
393
317
|
];
|
|
394
|
-
function
|
|
395
|
-
|
|
396
|
-
return options.formats.map((format) => {
|
|
397
|
-
switch (format) {
|
|
398
|
-
case "markdown": return {
|
|
399
|
-
format,
|
|
400
|
-
content: renderMarkdown(sections),
|
|
401
|
-
sections
|
|
402
|
-
};
|
|
403
|
-
case "html": return {
|
|
404
|
-
format,
|
|
405
|
-
content: renderHTML(sections),
|
|
406
|
-
sections
|
|
407
|
-
};
|
|
408
|
-
case "pdf": throw new Error("pdf format is not yet implemented");
|
|
409
|
-
case "jsx": throw new Error("jsx format is not yet implemented");
|
|
410
|
-
default: throw new Error(`Unsupported format: ${format}`);
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
//#endregion
|
|
415
|
-
//#region src/templates/terms/acceptance.ts
|
|
416
|
-
function buildAcceptance(config) {
|
|
417
|
-
return {
|
|
418
|
-
id: "tos-acceptance",
|
|
419
|
-
title: "Acceptance of Terms",
|
|
420
|
-
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.`
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
//#endregion
|
|
424
|
-
//#region src/templates/terms/accounts.ts
|
|
425
|
-
function buildAccounts(config) {
|
|
426
|
-
if (!config.accounts) return null;
|
|
427
|
-
const { registrationRequired, userResponsibleForCredentials, companyCanTerminate } = config.accounts;
|
|
428
|
-
const lines = [];
|
|
429
|
-
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.");
|
|
430
|
-
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.");
|
|
431
|
-
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.`);
|
|
432
|
-
return {
|
|
433
|
-
id: "tos-accounts",
|
|
434
|
-
title: "Accounts",
|
|
435
|
-
body: lines.join("\n\n")
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
//#endregion
|
|
439
|
-
//#region src/templates/terms/availability.ts
|
|
440
|
-
function buildAvailability(config) {
|
|
441
|
-
if (!config.availability) return null;
|
|
442
|
-
const lines = [];
|
|
443
|
-
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.");
|
|
444
|
-
if (config.availability.maintenanceWindows) lines.push(`**Maintenance:** ${config.availability.maintenanceWindows}`);
|
|
445
|
-
return {
|
|
446
|
-
id: "tos-availability",
|
|
447
|
-
title: "Service Availability",
|
|
448
|
-
body: lines.join("\n\n")
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
//#endregion
|
|
452
|
-
//#region src/templates/terms/changes-to-terms.ts
|
|
453
|
-
function buildChangesToTerms(config) {
|
|
454
|
-
if (!config.changesPolicy) return null;
|
|
455
|
-
const { noticeMethod, noticePeriodDays } = config.changesPolicy;
|
|
456
|
-
return {
|
|
457
|
-
id: "tos-changes",
|
|
458
|
-
title: "Changes to These Terms",
|
|
459
|
-
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.`
|
|
460
|
-
};
|
|
318
|
+
function compilePrivacyDocument(config) {
|
|
319
|
+
return SECTION_BUILDERS$1.map((builder) => builder(config)).filter((s) => s !== null);
|
|
461
320
|
}
|
|
462
321
|
//#endregion
|
|
463
|
-
//#region src/
|
|
464
|
-
function
|
|
465
|
-
return {
|
|
466
|
-
id: "tos-contact",
|
|
467
|
-
title: "Contact Us",
|
|
468
|
-
body: `If you have any questions about these Terms, please contact us at:
|
|
469
|
-
|
|
470
|
-
**${config.company.legalName}**
|
|
471
|
-
${config.company.address}
|
|
472
|
-
${config.company.contact}`
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
//#endregion
|
|
476
|
-
//#region src/templates/terms/disclaimers.ts
|
|
477
|
-
function buildDisclaimers(config) {
|
|
478
|
-
if (!config.disclaimers) return null;
|
|
479
|
-
const lines = [];
|
|
480
|
-
if (config.disclaimers.serviceProvidedAsIs) lines.push("OUR SERVICES ARE PROVIDED \"AS IS\" AND \"AS AVAILABLE\" WITHOUT WARRANTIES OF ANY KIND.");
|
|
481
|
-
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.`);
|
|
482
|
-
return {
|
|
483
|
-
id: "tos-disclaimers",
|
|
484
|
-
title: "Disclaimer of Warranties",
|
|
485
|
-
body: lines.join("\n\n")
|
|
486
|
-
};
|
|
322
|
+
//#region src/documents/terms.ts
|
|
323
|
+
function buildIntroduction(config) {
|
|
324
|
+
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}.`])]);
|
|
487
325
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
arbitration: "Any disputes arising out of or relating to these Terms or our services shall be resolved by binding arbitration rather than in court.",
|
|
495
|
-
litigation: "Any disputes arising out of or relating to these Terms or our services shall be resolved through litigation in a court of competent jurisdiction.",
|
|
496
|
-
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."
|
|
497
|
-
}[method] ?? "Disputes arising out of or relating to these Terms shall be resolved as described below."];
|
|
498
|
-
if (venue) lines.push(`**Venue:** ${venue}`);
|
|
499
|
-
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.");
|
|
500
|
-
return {
|
|
501
|
-
id: "tos-dispute-resolution",
|
|
502
|
-
title: "Dispute Resolution",
|
|
503
|
-
body: lines.join("\n\n")
|
|
504
|
-
};
|
|
326
|
+
function buildAcceptance(config) {
|
|
327
|
+
return section("tos-acceptance", [
|
|
328
|
+
heading("Acceptance of Terms"),
|
|
329
|
+
p(["You accept these Terms by:"]),
|
|
330
|
+
ul(config.acceptance.methods.map((m) => li([m])))
|
|
331
|
+
]);
|
|
505
332
|
}
|
|
506
|
-
//#endregion
|
|
507
|
-
//#region src/templates/terms/eligibility.ts
|
|
508
333
|
function buildEligibility(config) {
|
|
509
334
|
if (!config.eligibility) return null;
|
|
510
335
|
const { minimumAge, jurisdictionRestrictions } = config.eligibility;
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
return {
|
|
517
|
-
id: "tos-eligibility",
|
|
518
|
-
title: "Eligibility",
|
|
519
|
-
body
|
|
520
|
-
};
|
|
336
|
+
return section("tos-eligibility", [
|
|
337
|
+
heading("Eligibility"),
|
|
338
|
+
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.`]),
|
|
339
|
+
...jurisdictionRestrictions && jurisdictionRestrictions.length > 0 ? [p(["Our services are not available in the following jurisdictions:"]), ul(jurisdictionRestrictions.map((j) => li([j])))] : []
|
|
340
|
+
]);
|
|
521
341
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
342
|
+
function buildAccounts(config) {
|
|
343
|
+
if (!config.accounts) return null;
|
|
344
|
+
const { registrationRequired, userResponsibleForCredentials, companyCanTerminate } = config.accounts;
|
|
345
|
+
const items = [];
|
|
346
|
+
if (registrationRequired) items.push("Registration is required to access certain features of our services.");
|
|
347
|
+
if (userResponsibleForCredentials) items.push("You are responsible for maintaining the confidentiality of your account credentials and for all activity under your account.");
|
|
348
|
+
if (companyCanTerminate) items.push("We reserve the right to terminate or suspend accounts at our discretion.");
|
|
349
|
+
return section("tos-accounts", [heading("Accounts"), ul(items.map((i) => li([i])))]);
|
|
530
350
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
351
|
+
function buildProhibitedUses(config) {
|
|
352
|
+
if (!config.prohibitedUses || config.prohibitedUses.length === 0) return null;
|
|
353
|
+
return section("tos-prohibited-uses", [
|
|
354
|
+
heading("Prohibited Uses"),
|
|
355
|
+
p(["You may not use our services for the following purposes:"]),
|
|
356
|
+
ul(config.prohibitedUses.map((u) => li([u])))
|
|
357
|
+
]);
|
|
358
|
+
}
|
|
359
|
+
function buildUserContent(config) {
|
|
360
|
+
if (!config.userContent) return null;
|
|
361
|
+
const { usersOwnContent, licenseGrantedToCompany, licenseDescription, companyCanRemoveContent } = config.userContent;
|
|
362
|
+
const items = [];
|
|
363
|
+
if (usersOwnContent) items.push("You retain ownership of content you submit to our services.");
|
|
364
|
+
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.");
|
|
365
|
+
if (companyCanRemoveContent) items.push("We reserve the right to remove content that violates these Terms or that we find objectionable.");
|
|
366
|
+
return section("tos-user-content", [heading("User Content"), ul(items.map((i) => li([i])))]);
|
|
543
367
|
}
|
|
544
|
-
//#endregion
|
|
545
|
-
//#region src/templates/terms/intellectual-property.ts
|
|
546
368
|
function buildIntellectualProperty(config) {
|
|
547
369
|
if (!config.intellectualProperty) return null;
|
|
548
370
|
const { companyOwnsService, usersMayNotCopy } = config.intellectualProperty;
|
|
549
|
-
const
|
|
550
|
-
if (companyOwnsService)
|
|
551
|
-
if (usersMayNotCopy)
|
|
552
|
-
return
|
|
553
|
-
id: "tos-intellectual-property",
|
|
554
|
-
title: "Intellectual Property",
|
|
555
|
-
body: lines.join("\n\n")
|
|
556
|
-
};
|
|
371
|
+
const items = [];
|
|
372
|
+
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.`);
|
|
373
|
+
if (usersMayNotCopy) items.push("You may not copy, modify, distribute, sell, or lease any part of our services without our express written permission.");
|
|
374
|
+
return section("tos-intellectual-property", [heading("Intellectual Property"), ul(items.map((i) => li([i])))]);
|
|
557
375
|
}
|
|
558
|
-
//#endregion
|
|
559
|
-
//#region src/templates/terms/introduction.ts
|
|
560
|
-
function buildIntroduction(config) {
|
|
561
|
-
const privacyLine = config.privacyPolicyUrl ? `\n\nFor information about how we collect and use your data, please review our [Privacy Policy](${config.privacyPolicyUrl}).` : "";
|
|
562
|
-
return {
|
|
563
|
-
id: "tos-introduction",
|
|
564
|
-
title: "Terms of Service",
|
|
565
|
-
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.
|
|
566
|
-
|
|
567
|
-
**Effective Date:** ${config.effectiveDate}${privacyLine}`
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
//#endregion
|
|
571
|
-
//#region src/templates/terms/limitation-of-liability.ts
|
|
572
|
-
function buildLimitationOfLiability(config) {
|
|
573
|
-
if (!config.limitationOfLiability) return null;
|
|
574
|
-
const lines = [];
|
|
575
|
-
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.`);
|
|
576
|
-
if (config.limitationOfLiability.liabilityCap) lines.push(`**Liability Cap:** ${config.limitationOfLiability.liabilityCap}`);
|
|
577
|
-
return {
|
|
578
|
-
id: "tos-limitation-of-liability",
|
|
579
|
-
title: "Limitation of Liability",
|
|
580
|
-
body: lines.join("\n\n")
|
|
581
|
-
};
|
|
582
|
-
}
|
|
583
|
-
//#endregion
|
|
584
|
-
//#region src/templates/terms/payments.ts
|
|
585
376
|
function buildPayments(config) {
|
|
586
|
-
if (!config.payments
|
|
587
|
-
const
|
|
588
|
-
|
|
589
|
-
if (
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
};
|
|
377
|
+
if (!config.payments) return null;
|
|
378
|
+
const { hasPaidFeatures, refundPolicy, priceChangesNotice } = config.payments;
|
|
379
|
+
const items = [];
|
|
380
|
+
if (hasPaidFeatures) items.push("Some features of our services require payment.");
|
|
381
|
+
if (refundPolicy) items.push(refundPolicy);
|
|
382
|
+
if (priceChangesNotice) items.push(priceChangesNotice);
|
|
383
|
+
if (items.length === 0) return null;
|
|
384
|
+
return section("tos-payments", [heading("Payments"), ul(items.map((i) => li([i])))]);
|
|
595
385
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
body: `You agree not to use our services for any of the following purposes:\n\n${config.prohibitedUses.map((u) => `- ${u}`).join("\n")}`
|
|
604
|
-
};
|
|
386
|
+
function buildAvailability(config) {
|
|
387
|
+
if (!config.availability) return null;
|
|
388
|
+
const { noUptimeGuarantee, maintenanceWindows } = config.availability;
|
|
389
|
+
const items = [];
|
|
390
|
+
if (noUptimeGuarantee) items.push("We do not guarantee uninterrupted or error-free access to our services.");
|
|
391
|
+
if (maintenanceWindows) items.push(maintenanceWindows);
|
|
392
|
+
return section("tos-availability", [heading("Service Availability"), ul(items.map((i) => li([i])))]);
|
|
605
393
|
}
|
|
606
|
-
//#endregion
|
|
607
|
-
//#region src/templates/terms/termination.ts
|
|
608
394
|
function buildTermination(config) {
|
|
609
395
|
if (!config.termination) return null;
|
|
610
396
|
const { companyCanTerminate, userCanTerminate, effectOfTermination } = config.termination;
|
|
611
|
-
const
|
|
612
|
-
if (companyCanTerminate)
|
|
613
|
-
if (userCanTerminate)
|
|
614
|
-
if (effectOfTermination)
|
|
615
|
-
return
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
};
|
|
397
|
+
const items = [];
|
|
398
|
+
if (companyCanTerminate) items.push("We may terminate or suspend your access to our services at any time, with or without cause or notice.");
|
|
399
|
+
if (userCanTerminate) items.push("You may terminate your use of our services at any time.");
|
|
400
|
+
if (effectOfTermination) items.push(effectOfTermination);
|
|
401
|
+
return section("tos-termination", [heading("Termination"), ul(items.map((i) => li([i])))]);
|
|
402
|
+
}
|
|
403
|
+
function buildDisclaimers(config) {
|
|
404
|
+
if (!config.disclaimers) return null;
|
|
405
|
+
const { serviceProvidedAsIs, noWarranties } = config.disclaimers;
|
|
406
|
+
const items = [];
|
|
407
|
+
if (serviceProvidedAsIs) items.push("Our services are provided on an \"as is\" and \"as available\" basis.");
|
|
408
|
+
if (noWarranties) items.push("We make no warranties, express or implied, regarding the reliability, accuracy, or fitness for a particular purpose of our services.");
|
|
409
|
+
return section("tos-disclaimers", [heading("Disclaimers"), ul(items.map((i) => li([i])))]);
|
|
410
|
+
}
|
|
411
|
+
function buildLimitationOfLiability(config) {
|
|
412
|
+
if (!config.limitationOfLiability) return null;
|
|
413
|
+
const { excludesIndirectDamages, liabilityCap } = config.limitationOfLiability;
|
|
414
|
+
const items = [];
|
|
415
|
+
if (excludesIndirectDamages) items.push("To the fullest extent permitted by law, we shall not be liable for any indirect, incidental, special, or consequential damages.");
|
|
416
|
+
if (liabilityCap) items.push(liabilityCap);
|
|
417
|
+
return section("tos-limitation-of-liability", [heading("Limitation of Liability"), ul(items.map((i) => li([i])))]);
|
|
418
|
+
}
|
|
419
|
+
function buildIndemnification(config) {
|
|
420
|
+
if (!config.indemnification) return null;
|
|
421
|
+
const { userIndemnifiesCompany, scope } = config.indemnification;
|
|
422
|
+
if (!userIndemnifiesCompany) return null;
|
|
423
|
+
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.`])]);
|
|
620
424
|
}
|
|
621
|
-
//#endregion
|
|
622
|
-
//#region src/templates/terms/third-party-services.ts
|
|
623
425
|
function buildThirdPartyServices(config) {
|
|
624
426
|
if (!config.thirdPartyServices || config.thirdPartyServices.length === 0) return null;
|
|
625
|
-
return
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
427
|
+
return section("tos-third-party-services", [
|
|
428
|
+
heading("Third-Party Services"),
|
|
429
|
+
p(["Our services may integrate with or link to third-party services:"]),
|
|
430
|
+
ul(config.thirdPartyServices.map((t) => li([
|
|
431
|
+
bold(t.name),
|
|
432
|
+
" — ",
|
|
433
|
+
t.purpose
|
|
434
|
+
])))
|
|
435
|
+
]);
|
|
630
436
|
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
const
|
|
636
|
-
|
|
637
|
-
if (
|
|
638
|
-
if (
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}
|
|
437
|
+
function buildDisputeResolution(config) {
|
|
438
|
+
if (!config.disputeResolution) return null;
|
|
439
|
+
const { method, venue, classActionWaiver } = config.disputeResolution;
|
|
440
|
+
const items = [];
|
|
441
|
+
const methodLabel = method === "arbitration" ? "binding arbitration" : method === "mediation" ? "mediation" : "litigation";
|
|
442
|
+
items.push(`Any disputes arising from these Terms or your use of our services shall be resolved through ${methodLabel}.`);
|
|
443
|
+
if (venue) items.push(`Venue: ${venue}.`);
|
|
444
|
+
if (classActionWaiver) items.push("You waive any right to participate in class action lawsuits or class-wide arbitration.");
|
|
445
|
+
return section("tos-dispute-resolution", [heading("Dispute Resolution"), ul(items.map((i) => li([i])))]);
|
|
446
|
+
}
|
|
447
|
+
function buildGoverningLaw(config) {
|
|
448
|
+
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.`])]);
|
|
449
|
+
}
|
|
450
|
+
function buildChanges(config) {
|
|
451
|
+
if (!config.changesPolicy) return null;
|
|
452
|
+
const { noticeMethod, noticePeriodDays } = config.changesPolicy;
|
|
453
|
+
const notice = noticePeriodDays ? `at least ${noticePeriodDays} days' notice via ${noticeMethod}` : `notice via ${noticeMethod}`;
|
|
454
|
+
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.`])]);
|
|
455
|
+
}
|
|
456
|
+
function buildContact(config) {
|
|
457
|
+
return section("tos-contact", [
|
|
458
|
+
heading("Contact Us"),
|
|
459
|
+
p(["If you have questions about these Terms, please contact us:"]),
|
|
460
|
+
ul([
|
|
461
|
+
li([bold("Legal Name: "), config.company.legalName]),
|
|
462
|
+
li([bold("Address: "), config.company.address]),
|
|
463
|
+
li([bold("Email: "), config.company.contact])
|
|
464
|
+
])
|
|
465
|
+
]);
|
|
648
466
|
}
|
|
649
|
-
//#endregion
|
|
650
|
-
//#region src/terms.ts
|
|
651
467
|
const SECTION_BUILDERS = [
|
|
652
468
|
buildIntroduction,
|
|
653
469
|
buildAcceptance,
|
|
654
470
|
buildEligibility,
|
|
655
471
|
buildAccounts,
|
|
656
|
-
|
|
472
|
+
buildProhibitedUses,
|
|
657
473
|
buildUserContent,
|
|
658
474
|
buildIntellectualProperty,
|
|
659
475
|
buildPayments,
|
|
@@ -665,28 +481,37 @@ const SECTION_BUILDERS = [
|
|
|
665
481
|
buildThirdPartyServices,
|
|
666
482
|
buildDisputeResolution,
|
|
667
483
|
buildGoverningLaw,
|
|
668
|
-
|
|
484
|
+
buildChanges,
|
|
669
485
|
buildContact
|
|
670
486
|
];
|
|
671
|
-
function
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
487
|
+
function compileTermsDocument(config) {
|
|
488
|
+
return SECTION_BUILDERS.map((builder) => builder(config)).filter((s) => s !== null);
|
|
489
|
+
}
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region src/documents/index.ts
|
|
492
|
+
function compile(input) {
|
|
493
|
+
if (input.type === "privacy") {
|
|
494
|
+
const { type: _, ...config } = input;
|
|
495
|
+
return {
|
|
496
|
+
type: "document",
|
|
497
|
+
policyType: "privacy",
|
|
498
|
+
sections: compilePrivacyDocument(config)
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
if (input.type === "terms") {
|
|
502
|
+
const { type: _, ...config } = input;
|
|
503
|
+
return {
|
|
504
|
+
type: "document",
|
|
505
|
+
policyType: "terms",
|
|
506
|
+
sections: compileTermsDocument(config)
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
const { type: _, ...config } = input;
|
|
510
|
+
return {
|
|
511
|
+
type: "document",
|
|
512
|
+
policyType: "cookie",
|
|
513
|
+
sections: compileCookieDocument(config)
|
|
514
|
+
};
|
|
690
515
|
}
|
|
691
516
|
//#endregion
|
|
692
517
|
//#region src/types.ts
|
|
@@ -865,23 +690,7 @@ function expandOpenPolicyConfig(config) {
|
|
|
865
690
|
});
|
|
866
691
|
return inputs;
|
|
867
692
|
}
|
|
868
|
-
function compilePolicy(input, options) {
|
|
869
|
-
switch (input.type) {
|
|
870
|
-
case "privacy": {
|
|
871
|
-
const { type: _, ...config } = input;
|
|
872
|
-
return compilePrivacyPolicy(config, options);
|
|
873
|
-
}
|
|
874
|
-
case "terms": {
|
|
875
|
-
const { type: _, ...config } = input;
|
|
876
|
-
return compileTermsOfService(config, options);
|
|
877
|
-
}
|
|
878
|
-
case "cookie": {
|
|
879
|
-
const { type: _, ...config } = input;
|
|
880
|
-
return compileCookiePolicy(config, options);
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
693
|
//#endregion
|
|
885
|
-
export {
|
|
694
|
+
export { bold, compile, expandOpenPolicyConfig, heading, isOpenPolicyConfig, italic, li, link, ol, p, section, text, ul, validateCookiePolicy, validatePrivacyPolicy, validateTermsOfService };
|
|
886
695
|
|
|
887
696
|
//# sourceMappingURL=index.js.map
|