@openpolicy/vue 0.0.16
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 +70 -0
- package/dist/index.d.ts +401 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +841 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
- package/styles.css +30 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,841 @@
|
|
|
1
|
+
import { Fragment, defineComponent, h, inject, provide, toRef } from "vue";
|
|
2
|
+
//#region ../core/dist/index.js
|
|
3
|
+
const heading = (value, levelOrContext, context) => {
|
|
4
|
+
const level = typeof levelOrContext === "number" ? levelOrContext : void 0;
|
|
5
|
+
const ctx = typeof levelOrContext === "object" ? levelOrContext : context;
|
|
6
|
+
return {
|
|
7
|
+
type: "heading",
|
|
8
|
+
...level !== void 0 && { level },
|
|
9
|
+
value,
|
|
10
|
+
...ctx && { context: ctx }
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const text = (value, context) => ({
|
|
14
|
+
type: "text",
|
|
15
|
+
value,
|
|
16
|
+
...context && { context }
|
|
17
|
+
});
|
|
18
|
+
const bold = (value, context) => ({
|
|
19
|
+
type: "bold",
|
|
20
|
+
value,
|
|
21
|
+
...context && { context }
|
|
22
|
+
});
|
|
23
|
+
const link = (href, value, context) => ({
|
|
24
|
+
type: "link",
|
|
25
|
+
href,
|
|
26
|
+
value,
|
|
27
|
+
...context && { context }
|
|
28
|
+
});
|
|
29
|
+
const p = (children, context) => ({
|
|
30
|
+
type: "paragraph",
|
|
31
|
+
children: children.map((c) => typeof c === "string" ? text(c) : c),
|
|
32
|
+
...context && { context }
|
|
33
|
+
});
|
|
34
|
+
const li = (children, context) => ({
|
|
35
|
+
type: "listItem",
|
|
36
|
+
children: children.map((c) => typeof c === "string" ? text(c) : c),
|
|
37
|
+
...context && { context }
|
|
38
|
+
});
|
|
39
|
+
const ul = (items, context) => ({
|
|
40
|
+
type: "list",
|
|
41
|
+
items,
|
|
42
|
+
...context && { context }
|
|
43
|
+
});
|
|
44
|
+
const section = (id, content, context) => ({
|
|
45
|
+
type: "section",
|
|
46
|
+
id,
|
|
47
|
+
content,
|
|
48
|
+
...context && { context }
|
|
49
|
+
});
|
|
50
|
+
function buildIntroduction$2(config) {
|
|
51
|
+
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}.`])]);
|
|
52
|
+
}
|
|
53
|
+
function buildWhatAreCookies() {
|
|
54
|
+
return section("cookie-what-are-cookies", [
|
|
55
|
+
heading("What Are Cookies?"),
|
|
56
|
+
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."]),
|
|
57
|
+
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)."])
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
function buildTypes(config) {
|
|
61
|
+
const types = [];
|
|
62
|
+
if (config.cookies.essential) types.push({
|
|
63
|
+
label: "Essential Cookies",
|
|
64
|
+
description: "Required for the basic functioning of our services. These cannot be disabled."
|
|
65
|
+
});
|
|
66
|
+
if (config.cookies.analytics) types.push({
|
|
67
|
+
label: "Analytics Cookies",
|
|
68
|
+
description: "Help us understand how visitors interact with our services so we can improve them."
|
|
69
|
+
});
|
|
70
|
+
if (config.cookies.functional) types.push({
|
|
71
|
+
label: "Functional Cookies",
|
|
72
|
+
description: "Enable enhanced functionality and personalisation, such as remembering your preferences."
|
|
73
|
+
});
|
|
74
|
+
if (config.cookies.marketing) types.push({
|
|
75
|
+
label: "Marketing Cookies",
|
|
76
|
+
description: "Used to deliver advertisements more relevant to you and your interests."
|
|
77
|
+
});
|
|
78
|
+
if (types.length === 0) return section("cookie-types", [heading("Types of Cookies We Use"), p(["We do not currently use any cookies."])]);
|
|
79
|
+
return section("cookie-types", [heading("Types of Cookies We Use"), ul(types.map((t) => li([
|
|
80
|
+
bold(t.label),
|
|
81
|
+
" — ",
|
|
82
|
+
t.description
|
|
83
|
+
])))]);
|
|
84
|
+
}
|
|
85
|
+
function buildTrackingTechnologies(config) {
|
|
86
|
+
if (!config.trackingTechnologies || config.trackingTechnologies.length === 0) return null;
|
|
87
|
+
return section("cookie-tracking-technologies", [
|
|
88
|
+
heading("Other Tracking Technologies"),
|
|
89
|
+
p(["In addition to cookies, we may use the following tracking technologies:"]),
|
|
90
|
+
ul(config.trackingTechnologies.map((t) => li([t])))
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
function buildThirdParties$1(config) {
|
|
94
|
+
if (!config.thirdParties || config.thirdParties.length === 0) return null;
|
|
95
|
+
return section("cookie-third-parties", [
|
|
96
|
+
heading("Third-Party Cookies"),
|
|
97
|
+
p(["The following third parties may set cookies through our services:"]),
|
|
98
|
+
ul(config.thirdParties.map((t) => li([
|
|
99
|
+
bold(t.name),
|
|
100
|
+
" — ",
|
|
101
|
+
t.purpose,
|
|
102
|
+
...t.policyUrl ? [
|
|
103
|
+
" (",
|
|
104
|
+
link(t.policyUrl, "Privacy Policy"),
|
|
105
|
+
")"
|
|
106
|
+
] : []
|
|
107
|
+
])))
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
function buildConsent(config) {
|
|
111
|
+
if (!config.consentMechanism) return null;
|
|
112
|
+
const { hasBanner, hasPreferencePanel, canWithdraw } = config.consentMechanism;
|
|
113
|
+
const items = [];
|
|
114
|
+
if (hasBanner) items.push("We display a cookie consent banner when you first visit our services.");
|
|
115
|
+
if (hasPreferencePanel) items.push("You can manage your cookie preferences at any time via our preference panel.");
|
|
116
|
+
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.");
|
|
117
|
+
if (items.length === 0) return null;
|
|
118
|
+
return section("cookie-consent", [heading("Your Consent"), ul(items.map((i) => li([i])))]);
|
|
119
|
+
}
|
|
120
|
+
function buildManaging() {
|
|
121
|
+
return section("cookie-managing", [
|
|
122
|
+
heading("Managing Cookies"),
|
|
123
|
+
p(["Most web browsers allow you to control cookies through their settings. You can:"]),
|
|
124
|
+
ul([
|
|
125
|
+
li(["Delete cookies already stored on your device"]),
|
|
126
|
+
li(["Block cookies from being set on your device"]),
|
|
127
|
+
li(["Set your browser to notify you when a cookie is being set"])
|
|
128
|
+
]),
|
|
129
|
+
p(["Please note that restricting cookies may impact the functionality of our services. Consult your browser's help documentation for instructions on managing cookies."])
|
|
130
|
+
]);
|
|
131
|
+
}
|
|
132
|
+
function buildJurisdictionEu(config) {
|
|
133
|
+
if (!config.jurisdictions.includes("eu")) return null;
|
|
134
|
+
return section("cookie-jurisdiction-eu", [
|
|
135
|
+
heading("European Users (GDPR)", { reason: "Required under ePrivacy Directive and GDPR" }),
|
|
136
|
+
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."]),
|
|
137
|
+
p(["Essential cookies are set on the basis of our legitimate interests to provide you with a functioning service."])
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
function buildContact$2(config) {
|
|
141
|
+
return section("cookie-contact", [
|
|
142
|
+
heading("Contact Us"),
|
|
143
|
+
p(["If you have questions about this Cookie Policy, please contact us:"]),
|
|
144
|
+
ul([
|
|
145
|
+
li([bold("Legal Name: "), config.company.legalName]),
|
|
146
|
+
li([bold("Address: "), config.company.address]),
|
|
147
|
+
li([bold("Email: "), config.company.contact])
|
|
148
|
+
])
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
const SECTION_BUILDERS$2 = [
|
|
152
|
+
buildIntroduction$2,
|
|
153
|
+
() => buildWhatAreCookies(),
|
|
154
|
+
buildTypes,
|
|
155
|
+
buildTrackingTechnologies,
|
|
156
|
+
buildThirdParties$1,
|
|
157
|
+
buildConsent,
|
|
158
|
+
() => buildManaging(),
|
|
159
|
+
buildJurisdictionEu,
|
|
160
|
+
buildContact$2
|
|
161
|
+
];
|
|
162
|
+
function compileCookieDocument(config) {
|
|
163
|
+
return SECTION_BUILDERS$2.map((builder) => builder(config)).filter((s) => s !== null);
|
|
164
|
+
}
|
|
165
|
+
const RIGHTS_LABELS = {
|
|
166
|
+
access: "Right to access your personal data",
|
|
167
|
+
rectification: "Right to correct inaccurate data",
|
|
168
|
+
erasure: "Right to request deletion of your data",
|
|
169
|
+
portability: "Right to receive your data in a portable format",
|
|
170
|
+
restriction: "Right to restrict how we process your data",
|
|
171
|
+
objection: "Right to object to processing",
|
|
172
|
+
opt_out_sale: "Right to opt out of the sale of your personal information",
|
|
173
|
+
non_discrimination: "Right to non-discriminatory treatment for exercising your rights"
|
|
174
|
+
};
|
|
175
|
+
function buildIntroduction$1(config) {
|
|
176
|
+
return section("introduction", [
|
|
177
|
+
heading("Introduction"),
|
|
178
|
+
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}.`]),
|
|
179
|
+
p([`If you have questions about this policy, please contact us at ${config.company.contact}.`])
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
function buildChildrenPrivacy(config) {
|
|
183
|
+
if (!config.children) return null;
|
|
184
|
+
const { underAge, noticeUrl } = config.children;
|
|
185
|
+
return section("children-privacy", [
|
|
186
|
+
heading("Children's Privacy", { reason: "Required by COPPA" }),
|
|
187
|
+
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.`]),
|
|
188
|
+
...noticeUrl ? [p([
|
|
189
|
+
"For more information, see our ",
|
|
190
|
+
link(noticeUrl, "Children's Privacy Notice"),
|
|
191
|
+
"."
|
|
192
|
+
])] : []
|
|
193
|
+
]);
|
|
194
|
+
}
|
|
195
|
+
function buildDataCollected(config) {
|
|
196
|
+
const items = Object.entries(config.dataCollected).map(([category, fields]) => li([bold(category), ul(fields.map((f) => li([f])))]));
|
|
197
|
+
return section("data-collected", [
|
|
198
|
+
heading("Information We Collect"),
|
|
199
|
+
p(["We collect the following categories of information:"]),
|
|
200
|
+
ul(items)
|
|
201
|
+
]);
|
|
202
|
+
}
|
|
203
|
+
function buildLegalBasis(config) {
|
|
204
|
+
if (!config.jurisdictions.includes("eu")) return null;
|
|
205
|
+
return section("legal-basis", [heading("Legal Basis for Processing", { reason: "Required by GDPR Article 13" }), p([config.legalBasis])]);
|
|
206
|
+
}
|
|
207
|
+
function buildDataRetention(config) {
|
|
208
|
+
const items = Object.entries(config.retention).map(([category, period]) => li([
|
|
209
|
+
bold(category),
|
|
210
|
+
": ",
|
|
211
|
+
period
|
|
212
|
+
]));
|
|
213
|
+
return section("data-retention", [
|
|
214
|
+
heading("Data Retention"),
|
|
215
|
+
p(["We retain your data for the following periods:"]),
|
|
216
|
+
ul(items)
|
|
217
|
+
]);
|
|
218
|
+
}
|
|
219
|
+
function buildCookies(config) {
|
|
220
|
+
const enabled = [];
|
|
221
|
+
if (config.cookies.essential) enabled.push("Essential cookies — required for the service to function");
|
|
222
|
+
if (config.cookies.analytics) enabled.push("Analytics cookies — help us understand how the service is used");
|
|
223
|
+
if (config.cookies.marketing) enabled.push("Marketing cookies — used to deliver relevant advertisements");
|
|
224
|
+
if (enabled.length === 0) return section("cookies", [heading("Cookies and Tracking"), p(["We do not use cookies or similar tracking technologies."])]);
|
|
225
|
+
return section("cookies", [
|
|
226
|
+
heading("Cookies and Tracking"),
|
|
227
|
+
p(["We use the following types of cookies and tracking technologies:"]),
|
|
228
|
+
ul(enabled.map((e) => li([e])))
|
|
229
|
+
]);
|
|
230
|
+
}
|
|
231
|
+
function buildThirdParties(config) {
|
|
232
|
+
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."])]);
|
|
233
|
+
return section("third-parties", [
|
|
234
|
+
heading("Third-Party Services"),
|
|
235
|
+
p(["We share data with the following third-party services:"]),
|
|
236
|
+
ul(config.thirdParties.map((t) => li([
|
|
237
|
+
bold(t.name),
|
|
238
|
+
" — ",
|
|
239
|
+
t.purpose
|
|
240
|
+
])))
|
|
241
|
+
]);
|
|
242
|
+
}
|
|
243
|
+
function buildUserRights(config) {
|
|
244
|
+
const items = config.userRights.map((right) => {
|
|
245
|
+
return li([RIGHTS_LABELS[right] ?? right]);
|
|
246
|
+
});
|
|
247
|
+
return section("user-rights", [
|
|
248
|
+
heading("Your Rights"),
|
|
249
|
+
p(["You have the following rights regarding your personal data:"]),
|
|
250
|
+
ul(items)
|
|
251
|
+
]);
|
|
252
|
+
}
|
|
253
|
+
function buildGdprSupplement(config) {
|
|
254
|
+
if (!config.jurisdictions.includes("eu")) return null;
|
|
255
|
+
return section("gdpr-supplement", [
|
|
256
|
+
heading("GDPR Supplemental Disclosures", { reason: "Required by GDPR Article 13" }),
|
|
257
|
+
p(["This section applies to individuals in the European Economic Area (EEA) under the General Data Protection Regulation (GDPR)."]),
|
|
258
|
+
p([
|
|
259
|
+
"Data Controller: ",
|
|
260
|
+
bold(config.company.legalName),
|
|
261
|
+
`, ${config.company.address}`
|
|
262
|
+
]),
|
|
263
|
+
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."]),
|
|
264
|
+
p(["If we transfer your personal data outside the EEA, we ensure adequate safeguards are in place in accordance with GDPR requirements."])
|
|
265
|
+
]);
|
|
266
|
+
}
|
|
267
|
+
function buildCcpaSupplement(config) {
|
|
268
|
+
if (!config.jurisdictions.includes("ca")) return null;
|
|
269
|
+
return section("ccpa-supplement", [
|
|
270
|
+
heading("California Privacy Rights (CCPA)", { reason: "Required by CCPA" }),
|
|
271
|
+
p(["If you are a California resident, you have the following additional rights:"]),
|
|
272
|
+
ul([
|
|
273
|
+
li(["Right to Know — You may request disclosure of the personal information we collect, use, and share about you."]),
|
|
274
|
+
li(["Right to Delete — You may request deletion of personal information we have collected about you."]),
|
|
275
|
+
li(["Right to Opt-Out — You may opt out of the sale of your personal information."]),
|
|
276
|
+
li(["Right to Non-Discrimination — We will not discriminate against you for exercising your CCPA rights."])
|
|
277
|
+
])
|
|
278
|
+
]);
|
|
279
|
+
}
|
|
280
|
+
function buildContact$1(config) {
|
|
281
|
+
return section("contact", [
|
|
282
|
+
heading("Contact Us"),
|
|
283
|
+
p(["Contact us:"]),
|
|
284
|
+
ul([
|
|
285
|
+
li([bold("Legal Name: "), config.company.legalName]),
|
|
286
|
+
li([bold("Address: "), config.company.address]),
|
|
287
|
+
li([bold("Email: "), config.company.contact])
|
|
288
|
+
])
|
|
289
|
+
]);
|
|
290
|
+
}
|
|
291
|
+
const SECTION_BUILDERS$1 = [
|
|
292
|
+
buildIntroduction$1,
|
|
293
|
+
buildChildrenPrivacy,
|
|
294
|
+
buildDataCollected,
|
|
295
|
+
buildLegalBasis,
|
|
296
|
+
buildDataRetention,
|
|
297
|
+
buildCookies,
|
|
298
|
+
buildThirdParties,
|
|
299
|
+
buildUserRights,
|
|
300
|
+
buildGdprSupplement,
|
|
301
|
+
buildCcpaSupplement,
|
|
302
|
+
buildContact$1
|
|
303
|
+
];
|
|
304
|
+
function compilePrivacyDocument(config) {
|
|
305
|
+
return SECTION_BUILDERS$1.map((builder) => builder(config)).filter((s) => s !== null);
|
|
306
|
+
}
|
|
307
|
+
function buildIntroduction(config) {
|
|
308
|
+
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}.`])]);
|
|
309
|
+
}
|
|
310
|
+
function buildAcceptance(config) {
|
|
311
|
+
return section("tos-acceptance", [
|
|
312
|
+
heading("Acceptance of Terms"),
|
|
313
|
+
p(["You accept these Terms by:"]),
|
|
314
|
+
ul(config.acceptance.methods.map((m) => li([m])))
|
|
315
|
+
]);
|
|
316
|
+
}
|
|
317
|
+
function buildEligibility(config) {
|
|
318
|
+
if (!config.eligibility) return null;
|
|
319
|
+
const { minimumAge, jurisdictionRestrictions } = config.eligibility;
|
|
320
|
+
return section("tos-eligibility", [
|
|
321
|
+
heading("Eligibility"),
|
|
322
|
+
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.`]),
|
|
323
|
+
...jurisdictionRestrictions && jurisdictionRestrictions.length > 0 ? [p(["Our services are not available in the following jurisdictions:"]), ul(jurisdictionRestrictions.map((j) => li([j])))] : []
|
|
324
|
+
]);
|
|
325
|
+
}
|
|
326
|
+
function buildAccounts(config) {
|
|
327
|
+
if (!config.accounts) return null;
|
|
328
|
+
const { registrationRequired, userResponsibleForCredentials, companyCanTerminate } = config.accounts;
|
|
329
|
+
const items = [];
|
|
330
|
+
if (registrationRequired) items.push("Registration is required to access certain features of our services.");
|
|
331
|
+
if (userResponsibleForCredentials) items.push("You are responsible for maintaining the confidentiality of your account credentials and for all activity under your account.");
|
|
332
|
+
if (companyCanTerminate) items.push("We reserve the right to terminate or suspend accounts at our discretion.");
|
|
333
|
+
return section("tos-accounts", [heading("Accounts"), ul(items.map((i) => li([i])))]);
|
|
334
|
+
}
|
|
335
|
+
function buildProhibitedUses(config) {
|
|
336
|
+
if (!config.prohibitedUses || config.prohibitedUses.length === 0) return null;
|
|
337
|
+
return section("tos-prohibited-uses", [
|
|
338
|
+
heading("Prohibited Uses"),
|
|
339
|
+
p(["You may not use our services for the following purposes:"]),
|
|
340
|
+
ul(config.prohibitedUses.map((u) => li([u])))
|
|
341
|
+
]);
|
|
342
|
+
}
|
|
343
|
+
function buildUserContent(config) {
|
|
344
|
+
if (!config.userContent) return null;
|
|
345
|
+
const { usersOwnContent, licenseGrantedToCompany, licenseDescription, companyCanRemoveContent } = config.userContent;
|
|
346
|
+
const items = [];
|
|
347
|
+
if (usersOwnContent) items.push("You retain ownership of content you submit to our services.");
|
|
348
|
+
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.");
|
|
349
|
+
if (companyCanRemoveContent) items.push("We reserve the right to remove content that violates these Terms or that we find objectionable.");
|
|
350
|
+
return section("tos-user-content", [heading("User Content"), ul(items.map((i) => li([i])))]);
|
|
351
|
+
}
|
|
352
|
+
function buildIntellectualProperty(config) {
|
|
353
|
+
if (!config.intellectualProperty) return null;
|
|
354
|
+
const { companyOwnsService, usersMayNotCopy } = config.intellectualProperty;
|
|
355
|
+
const items = [];
|
|
356
|
+
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.`);
|
|
357
|
+
if (usersMayNotCopy) items.push("You may not copy, modify, distribute, sell, or lease any part of our services without our express written permission.");
|
|
358
|
+
return section("tos-intellectual-property", [heading("Intellectual Property"), ul(items.map((i) => li([i])))]);
|
|
359
|
+
}
|
|
360
|
+
function buildPayments(config) {
|
|
361
|
+
if (!config.payments) return null;
|
|
362
|
+
const { hasPaidFeatures, refundPolicy, priceChangesNotice } = config.payments;
|
|
363
|
+
const items = [];
|
|
364
|
+
if (hasPaidFeatures) items.push("Some features of our services require payment.");
|
|
365
|
+
if (refundPolicy) items.push(refundPolicy);
|
|
366
|
+
if (priceChangesNotice) items.push(priceChangesNotice);
|
|
367
|
+
if (items.length === 0) return null;
|
|
368
|
+
return section("tos-payments", [heading("Payments"), ul(items.map((i) => li([i])))]);
|
|
369
|
+
}
|
|
370
|
+
function buildAvailability(config) {
|
|
371
|
+
if (!config.availability) return null;
|
|
372
|
+
const { noUptimeGuarantee, maintenanceWindows } = config.availability;
|
|
373
|
+
const items = [];
|
|
374
|
+
if (noUptimeGuarantee) items.push("We do not guarantee uninterrupted or error-free access to our services.");
|
|
375
|
+
if (maintenanceWindows) items.push(maintenanceWindows);
|
|
376
|
+
return section("tos-availability", [heading("Service Availability"), ul(items.map((i) => li([i])))]);
|
|
377
|
+
}
|
|
378
|
+
function buildTermination(config) {
|
|
379
|
+
if (!config.termination) return null;
|
|
380
|
+
const { companyCanTerminate, userCanTerminate, effectOfTermination } = config.termination;
|
|
381
|
+
const items = [];
|
|
382
|
+
if (companyCanTerminate) items.push("We may terminate or suspend your access to our services at any time, with or without cause or notice.");
|
|
383
|
+
if (userCanTerminate) items.push("You may terminate your use of our services at any time.");
|
|
384
|
+
if (effectOfTermination) items.push(effectOfTermination);
|
|
385
|
+
return section("tos-termination", [heading("Termination"), ul(items.map((i) => li([i])))]);
|
|
386
|
+
}
|
|
387
|
+
function buildDisclaimers(config) {
|
|
388
|
+
if (!config.disclaimers) return null;
|
|
389
|
+
const { serviceProvidedAsIs, noWarranties } = config.disclaimers;
|
|
390
|
+
const items = [];
|
|
391
|
+
if (serviceProvidedAsIs) items.push("Our services are provided on an \"as is\" and \"as available\" basis.");
|
|
392
|
+
if (noWarranties) items.push("We make no warranties, express or implied, regarding the reliability, accuracy, or fitness for a particular purpose of our services.");
|
|
393
|
+
return section("tos-disclaimers", [heading("Disclaimers"), ul(items.map((i) => li([i])))]);
|
|
394
|
+
}
|
|
395
|
+
function buildLimitationOfLiability(config) {
|
|
396
|
+
if (!config.limitationOfLiability) return null;
|
|
397
|
+
const { excludesIndirectDamages, liabilityCap } = config.limitationOfLiability;
|
|
398
|
+
const items = [];
|
|
399
|
+
if (excludesIndirectDamages) items.push("To the fullest extent permitted by law, we shall not be liable for any indirect, incidental, special, or consequential damages.");
|
|
400
|
+
if (liabilityCap) items.push(liabilityCap);
|
|
401
|
+
return section("tos-limitation-of-liability", [heading("Limitation of Liability"), ul(items.map((i) => li([i])))]);
|
|
402
|
+
}
|
|
403
|
+
function buildIndemnification(config) {
|
|
404
|
+
if (!config.indemnification) return null;
|
|
405
|
+
const { userIndemnifiesCompany, scope } = config.indemnification;
|
|
406
|
+
if (!userIndemnifiesCompany) return null;
|
|
407
|
+
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.`])]);
|
|
408
|
+
}
|
|
409
|
+
function buildThirdPartyServices(config) {
|
|
410
|
+
if (!config.thirdPartyServices || config.thirdPartyServices.length === 0) return null;
|
|
411
|
+
return section("tos-third-party-services", [
|
|
412
|
+
heading("Third-Party Services"),
|
|
413
|
+
p(["Our services may integrate with or link to third-party services:"]),
|
|
414
|
+
ul(config.thirdPartyServices.map((t) => li([
|
|
415
|
+
bold(t.name),
|
|
416
|
+
" — ",
|
|
417
|
+
t.purpose
|
|
418
|
+
])))
|
|
419
|
+
]);
|
|
420
|
+
}
|
|
421
|
+
function buildDisputeResolution(config) {
|
|
422
|
+
if (!config.disputeResolution) return null;
|
|
423
|
+
const { method, venue, classActionWaiver } = config.disputeResolution;
|
|
424
|
+
const items = [];
|
|
425
|
+
const methodLabel = method === "arbitration" ? "binding arbitration" : method === "mediation" ? "mediation" : "litigation";
|
|
426
|
+
items.push(`Any disputes arising from these Terms or your use of our services shall be resolved through ${methodLabel}.`);
|
|
427
|
+
if (venue) items.push(`Venue: ${venue}.`);
|
|
428
|
+
if (classActionWaiver) items.push("You waive any right to participate in class action lawsuits or class-wide arbitration.");
|
|
429
|
+
return section("tos-dispute-resolution", [heading("Dispute Resolution"), ul(items.map((i) => li([i])))]);
|
|
430
|
+
}
|
|
431
|
+
function buildGoverningLaw(config) {
|
|
432
|
+
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.`])]);
|
|
433
|
+
}
|
|
434
|
+
function buildChanges(config) {
|
|
435
|
+
if (!config.changesPolicy) return null;
|
|
436
|
+
const { noticeMethod, noticePeriodDays } = config.changesPolicy;
|
|
437
|
+
const notice = noticePeriodDays ? `at least ${noticePeriodDays} days' notice via ${noticeMethod}` : `notice via ${noticeMethod}`;
|
|
438
|
+
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.`])]);
|
|
439
|
+
}
|
|
440
|
+
function buildContact(config) {
|
|
441
|
+
return section("tos-contact", [
|
|
442
|
+
heading("Contact Us"),
|
|
443
|
+
p(["If you have questions about these Terms, please contact us:"]),
|
|
444
|
+
ul([
|
|
445
|
+
li([bold("Legal Name: "), config.company.legalName]),
|
|
446
|
+
li([bold("Address: "), config.company.address]),
|
|
447
|
+
li([bold("Email: "), config.company.contact])
|
|
448
|
+
])
|
|
449
|
+
]);
|
|
450
|
+
}
|
|
451
|
+
const SECTION_BUILDERS = [
|
|
452
|
+
buildIntroduction,
|
|
453
|
+
buildAcceptance,
|
|
454
|
+
buildEligibility,
|
|
455
|
+
buildAccounts,
|
|
456
|
+
buildProhibitedUses,
|
|
457
|
+
buildUserContent,
|
|
458
|
+
buildIntellectualProperty,
|
|
459
|
+
buildPayments,
|
|
460
|
+
buildAvailability,
|
|
461
|
+
buildTermination,
|
|
462
|
+
buildDisclaimers,
|
|
463
|
+
buildLimitationOfLiability,
|
|
464
|
+
buildIndemnification,
|
|
465
|
+
buildThirdPartyServices,
|
|
466
|
+
buildDisputeResolution,
|
|
467
|
+
buildGoverningLaw,
|
|
468
|
+
buildChanges,
|
|
469
|
+
buildContact
|
|
470
|
+
];
|
|
471
|
+
function compileTermsDocument(config) {
|
|
472
|
+
return SECTION_BUILDERS.map((builder) => builder(config)).filter((s) => s !== null);
|
|
473
|
+
}
|
|
474
|
+
function compile(input) {
|
|
475
|
+
if (input.type === "privacy") {
|
|
476
|
+
const { type: _, ...config } = input;
|
|
477
|
+
return {
|
|
478
|
+
type: "document",
|
|
479
|
+
policyType: "privacy",
|
|
480
|
+
sections: compilePrivacyDocument(config)
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
if (input.type === "terms") {
|
|
484
|
+
const { type: _, ...config } = input;
|
|
485
|
+
return {
|
|
486
|
+
type: "document",
|
|
487
|
+
policyType: "terms",
|
|
488
|
+
sections: compileTermsDocument(config)
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
const { type: _, ...config } = input;
|
|
492
|
+
return {
|
|
493
|
+
type: "document",
|
|
494
|
+
policyType: "cookie",
|
|
495
|
+
sections: compileCookieDocument(config)
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
function isOpenPolicyConfig(value) {
|
|
499
|
+
if (value === null || typeof value !== "object") return false;
|
|
500
|
+
const obj = value;
|
|
501
|
+
return "company" in obj && !("effectiveDate" in obj) && ("privacy" in obj || "terms" in obj || "cookie" in obj);
|
|
502
|
+
}
|
|
503
|
+
function expandOpenPolicyConfig(config) {
|
|
504
|
+
const inputs = [];
|
|
505
|
+
if (config.privacy) inputs.push({
|
|
506
|
+
type: "privacy",
|
|
507
|
+
company: config.company,
|
|
508
|
+
...config.privacy
|
|
509
|
+
});
|
|
510
|
+
if (config.terms) inputs.push({
|
|
511
|
+
type: "terms",
|
|
512
|
+
company: config.company,
|
|
513
|
+
...config.terms
|
|
514
|
+
});
|
|
515
|
+
if (config.cookie) inputs.push({
|
|
516
|
+
type: "cookie",
|
|
517
|
+
company: config.company,
|
|
518
|
+
...config.cookie
|
|
519
|
+
});
|
|
520
|
+
return inputs;
|
|
521
|
+
}
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region src/styles.ts
|
|
524
|
+
const defaultStyles = `
|
|
525
|
+
.op-policy {
|
|
526
|
+
--op-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
527
|
+
--op-font-size-body: 1rem;
|
|
528
|
+
--op-font-size-heading: 1.125rem;
|
|
529
|
+
--op-font-weight-heading: 600;
|
|
530
|
+
--op-line-height: 1.7;
|
|
531
|
+
--op-body-color: #374151;
|
|
532
|
+
--op-heading-color: #111827;
|
|
533
|
+
--op-link-color: #2563eb;
|
|
534
|
+
--op-link-color-hover: #1d4ed8;
|
|
535
|
+
--op-section-gap: 2rem;
|
|
536
|
+
--op-border-color: #e5e7eb;
|
|
537
|
+
--op-border-radius: 0.375rem;
|
|
538
|
+
|
|
539
|
+
font-family: var(--op-font-family);
|
|
540
|
+
font-size: var(--op-font-size-body);
|
|
541
|
+
color: var(--op-body-color);
|
|
542
|
+
line-height: var(--op-line-height);
|
|
543
|
+
max-width: 65ch;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.op-section {
|
|
547
|
+
margin-bottom: var(--op-section-gap);
|
|
548
|
+
padding-bottom: var(--op-section-gap);
|
|
549
|
+
border-bottom: 1px solid var(--op-border-color);
|
|
550
|
+
}
|
|
551
|
+
.op-section:last-child {
|
|
552
|
+
border-bottom: none;
|
|
553
|
+
margin-bottom: 0;
|
|
554
|
+
padding-bottom: 0;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.op-heading {
|
|
558
|
+
font-size: var(--op-font-size-heading);
|
|
559
|
+
font-weight: var(--op-font-weight-heading);
|
|
560
|
+
color: var(--op-heading-color);
|
|
561
|
+
line-height: 1.3;
|
|
562
|
+
margin: 0 0 0.75rem;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.op-paragraph {
|
|
566
|
+
margin: 0 0 0.75rem;
|
|
567
|
+
}
|
|
568
|
+
.op-paragraph:last-child { margin-bottom: 0; }
|
|
569
|
+
|
|
570
|
+
.op-list {
|
|
571
|
+
margin: 0 0 0.75rem;
|
|
572
|
+
padding-left: 1.5rem;
|
|
573
|
+
list-style-type: disc;
|
|
574
|
+
}
|
|
575
|
+
.op-list:last-child { margin-bottom: 0; }
|
|
576
|
+
.op-list .op-list {
|
|
577
|
+
margin-top: 0.375rem;
|
|
578
|
+
margin-bottom: 0;
|
|
579
|
+
list-style-type: circle;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.op-list-item {
|
|
583
|
+
margin-bottom: 0.375rem;
|
|
584
|
+
}
|
|
585
|
+
.op-list-item:last-child { margin-bottom: 0; }
|
|
586
|
+
|
|
587
|
+
.op-bold {
|
|
588
|
+
font-weight: 600;
|
|
589
|
+
color: var(--op-heading-color);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.op-link {
|
|
593
|
+
color: var(--op-link-color);
|
|
594
|
+
text-decoration: underline;
|
|
595
|
+
text-underline-offset: 2px;
|
|
596
|
+
transition: color 0.15s ease;
|
|
597
|
+
}
|
|
598
|
+
.op-link:hover { color: var(--op-link-color-hover); }
|
|
599
|
+
`;
|
|
600
|
+
//#endregion
|
|
601
|
+
//#region src/context.ts
|
|
602
|
+
const OpenPolicyContextKey = Symbol("OpenPolicyContext");
|
|
603
|
+
const OpenPolicyProvider = defineComponent({
|
|
604
|
+
name: "OpenPolicyProvider",
|
|
605
|
+
props: { config: {
|
|
606
|
+
type: Object,
|
|
607
|
+
required: true
|
|
608
|
+
} },
|
|
609
|
+
setup(props, { slots }) {
|
|
610
|
+
provide(OpenPolicyContextKey, { config: toRef(props, "config") });
|
|
611
|
+
return () => h(Fragment, [h("style", { "data-openpolicy-vue": "" }, defaultStyles), slots.default?.()]);
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region src/components/defaults.ts
|
|
616
|
+
function DefaultHeading({ node }) {
|
|
617
|
+
return h(`h${node.level ?? 2}`, {
|
|
618
|
+
"data-op-heading": "",
|
|
619
|
+
class: "op-heading"
|
|
620
|
+
}, node.value);
|
|
621
|
+
}
|
|
622
|
+
function DefaultText({ node }) {
|
|
623
|
+
return node.value;
|
|
624
|
+
}
|
|
625
|
+
function DefaultBold({ node }) {
|
|
626
|
+
return h("strong", { class: "op-bold" }, node.value);
|
|
627
|
+
}
|
|
628
|
+
function DefaultItalic({ node }) {
|
|
629
|
+
return h("em", { class: "op-italic" }, node.value);
|
|
630
|
+
}
|
|
631
|
+
function DefaultLink({ node }) {
|
|
632
|
+
return h("a", {
|
|
633
|
+
href: node.href,
|
|
634
|
+
class: "op-link"
|
|
635
|
+
}, node.value);
|
|
636
|
+
}
|
|
637
|
+
function DefaultSection({ section, children }) {
|
|
638
|
+
return h("section", {
|
|
639
|
+
"data-op-section": "",
|
|
640
|
+
class: "op-section",
|
|
641
|
+
id: section.id,
|
|
642
|
+
...section.context?.reason && { "data-op-reason": section.context.reason }
|
|
643
|
+
}, children ?? void 0);
|
|
644
|
+
}
|
|
645
|
+
function DefaultParagraph({ children }) {
|
|
646
|
+
return h("p", {
|
|
647
|
+
"data-op-paragraph": "",
|
|
648
|
+
class: "op-paragraph"
|
|
649
|
+
}, children ?? void 0);
|
|
650
|
+
}
|
|
651
|
+
function DefaultList({ node, children }) {
|
|
652
|
+
return h(node.ordered ? "ol" : "ul", {
|
|
653
|
+
"data-op-list": "",
|
|
654
|
+
class: "op-list"
|
|
655
|
+
}, children ?? void 0);
|
|
656
|
+
}
|
|
657
|
+
function renderNode(node, components, key) {
|
|
658
|
+
switch (node.type) {
|
|
659
|
+
case "document": return node.sections.map((section, i) => renderNode(section, components, i));
|
|
660
|
+
case "section": {
|
|
661
|
+
const SectionComp = components.Section ?? DefaultSection;
|
|
662
|
+
const children = node.content.map((n, i) => renderNode(n, components, i));
|
|
663
|
+
return h(SectionComp, {
|
|
664
|
+
key,
|
|
665
|
+
section: node,
|
|
666
|
+
children
|
|
667
|
+
}, { default: () => children });
|
|
668
|
+
}
|
|
669
|
+
case "heading": return h(components.Heading ?? DefaultHeading, {
|
|
670
|
+
key,
|
|
671
|
+
node
|
|
672
|
+
});
|
|
673
|
+
case "paragraph": {
|
|
674
|
+
const children = node.children.map((n, i) => renderNode(n, components, i));
|
|
675
|
+
if (components.Paragraph) return h(components.Paragraph, {
|
|
676
|
+
key,
|
|
677
|
+
node,
|
|
678
|
+
children
|
|
679
|
+
}, { default: () => children });
|
|
680
|
+
return h("p", {
|
|
681
|
+
key,
|
|
682
|
+
"data-op-paragraph": "",
|
|
683
|
+
class: "op-paragraph"
|
|
684
|
+
}, children);
|
|
685
|
+
}
|
|
686
|
+
case "list": {
|
|
687
|
+
const children = node.items.map((item, i) => renderNode(item, components, i));
|
|
688
|
+
if (components.List) return h(components.List, {
|
|
689
|
+
key,
|
|
690
|
+
node,
|
|
691
|
+
children
|
|
692
|
+
}, { default: () => children });
|
|
693
|
+
return h(node.ordered ? "ol" : "ul", {
|
|
694
|
+
key,
|
|
695
|
+
"data-op-list": "",
|
|
696
|
+
class: "op-list"
|
|
697
|
+
}, children);
|
|
698
|
+
}
|
|
699
|
+
case "listItem": return h("li", {
|
|
700
|
+
key,
|
|
701
|
+
"data-op-list-item": "",
|
|
702
|
+
class: "op-list-item"
|
|
703
|
+
}, node.children.map((n, i) => renderNode(n, components, i)));
|
|
704
|
+
case "text": return h(components.Text ?? DefaultText, {
|
|
705
|
+
key,
|
|
706
|
+
node
|
|
707
|
+
});
|
|
708
|
+
case "bold": return h(components.Bold ?? DefaultBold, {
|
|
709
|
+
key,
|
|
710
|
+
node
|
|
711
|
+
});
|
|
712
|
+
case "italic": return h(components.Italic ?? DefaultItalic, {
|
|
713
|
+
key,
|
|
714
|
+
node
|
|
715
|
+
});
|
|
716
|
+
case "link": return h(components.Link ?? DefaultLink, {
|
|
717
|
+
key,
|
|
718
|
+
node
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
//#endregion
|
|
723
|
+
//#region src/render.ts
|
|
724
|
+
function renderDocument(doc, components = {}) {
|
|
725
|
+
return renderNode(doc, components);
|
|
726
|
+
}
|
|
727
|
+
//#endregion
|
|
728
|
+
//#region src/components/CookiePolicy.ts
|
|
729
|
+
const CookiePolicy = defineComponent({
|
|
730
|
+
name: "CookiePolicy",
|
|
731
|
+
props: {
|
|
732
|
+
config: {
|
|
733
|
+
type: Object,
|
|
734
|
+
required: false
|
|
735
|
+
},
|
|
736
|
+
components: {
|
|
737
|
+
type: Object,
|
|
738
|
+
required: false
|
|
739
|
+
},
|
|
740
|
+
style: {
|
|
741
|
+
type: Object,
|
|
742
|
+
required: false
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
setup(props) {
|
|
746
|
+
const context = inject(OpenPolicyContextKey, null);
|
|
747
|
+
return () => {
|
|
748
|
+
const config = props.config ?? context?.config.value ?? void 0;
|
|
749
|
+
if (!config) return null;
|
|
750
|
+
const input = isOpenPolicyConfig(config) ? expandOpenPolicyConfig(config).find((i) => i.type === "cookie") : {
|
|
751
|
+
type: "cookie",
|
|
752
|
+
...config
|
|
753
|
+
};
|
|
754
|
+
if (!input) return null;
|
|
755
|
+
const doc = compile(input);
|
|
756
|
+
return h("div", {
|
|
757
|
+
"data-op-policy": "",
|
|
758
|
+
class: "op-policy",
|
|
759
|
+
style: props.style
|
|
760
|
+
}, renderDocument(doc, props.components) ?? void 0);
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region src/components/PrivacyPolicy.ts
|
|
766
|
+
const PrivacyPolicy = defineComponent({
|
|
767
|
+
name: "PrivacyPolicy",
|
|
768
|
+
props: {
|
|
769
|
+
config: {
|
|
770
|
+
type: Object,
|
|
771
|
+
required: false
|
|
772
|
+
},
|
|
773
|
+
components: {
|
|
774
|
+
type: Object,
|
|
775
|
+
required: false
|
|
776
|
+
},
|
|
777
|
+
style: {
|
|
778
|
+
type: Object,
|
|
779
|
+
required: false
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
setup(props) {
|
|
783
|
+
const context = inject(OpenPolicyContextKey, null);
|
|
784
|
+
return () => {
|
|
785
|
+
const config = props.config ?? context?.config.value ?? void 0;
|
|
786
|
+
if (!config) return null;
|
|
787
|
+
const input = isOpenPolicyConfig(config) ? expandOpenPolicyConfig(config).find((i) => i.type === "privacy") : {
|
|
788
|
+
type: "privacy",
|
|
789
|
+
...config
|
|
790
|
+
};
|
|
791
|
+
if (!input) return null;
|
|
792
|
+
const doc = compile(input);
|
|
793
|
+
return h("div", {
|
|
794
|
+
"data-op-policy": "",
|
|
795
|
+
class: "op-policy",
|
|
796
|
+
style: props.style
|
|
797
|
+
}, renderDocument(doc, props.components) ?? void 0);
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
//#endregion
|
|
802
|
+
//#region src/components/TermsOfService.ts
|
|
803
|
+
const TermsOfService = defineComponent({
|
|
804
|
+
name: "TermsOfService",
|
|
805
|
+
props: {
|
|
806
|
+
config: {
|
|
807
|
+
type: Object,
|
|
808
|
+
required: false
|
|
809
|
+
},
|
|
810
|
+
components: {
|
|
811
|
+
type: Object,
|
|
812
|
+
required: false
|
|
813
|
+
},
|
|
814
|
+
style: {
|
|
815
|
+
type: Object,
|
|
816
|
+
required: false
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
setup(props) {
|
|
820
|
+
const context = inject(OpenPolicyContextKey, null);
|
|
821
|
+
return () => {
|
|
822
|
+
const config = props.config ?? context?.config.value ?? void 0;
|
|
823
|
+
if (!config) return null;
|
|
824
|
+
const input = isOpenPolicyConfig(config) ? expandOpenPolicyConfig(config).find((i) => i.type === "terms") : {
|
|
825
|
+
type: "terms",
|
|
826
|
+
...config
|
|
827
|
+
};
|
|
828
|
+
if (!input) return null;
|
|
829
|
+
const doc = compile(input);
|
|
830
|
+
return h("div", {
|
|
831
|
+
"data-op-policy": "",
|
|
832
|
+
class: "op-policy",
|
|
833
|
+
style: props.style
|
|
834
|
+
}, renderDocument(doc, props.components) ?? void 0);
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
});
|
|
838
|
+
//#endregion
|
|
839
|
+
export { CookiePolicy, DefaultBold, DefaultHeading, DefaultLink, DefaultList, DefaultParagraph, DefaultSection, DefaultText, OpenPolicyProvider as OpenPolicy, PrivacyPolicy, TermsOfService, defaultStyles, renderDocument, renderNode };
|
|
840
|
+
|
|
841
|
+
//# sourceMappingURL=index.js.map
|