@ucptools/validator 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/.claude/settings.local.json +60 -0
  2. package/.vercel/README.txt +11 -0
  3. package/.vercel/project.json +1 -0
  4. package/dist/cli/index.d.ts +6 -0
  5. package/dist/cli/index.d.ts.map +1 -0
  6. package/dist/cli/index.js +279 -0
  7. package/dist/cli/index.js.map +1 -0
  8. package/dist/compliance/compliance-generator.d.ts +34 -0
  9. package/dist/compliance/compliance-generator.d.ts.map +1 -0
  10. package/dist/compliance/compliance-generator.js +320 -0
  11. package/dist/compliance/compliance-generator.js.map +1 -0
  12. package/dist/compliance/index.d.ts +8 -0
  13. package/dist/compliance/index.d.ts.map +1 -0
  14. package/dist/compliance/index.js +17 -0
  15. package/dist/compliance/index.js.map +1 -0
  16. package/dist/compliance/templates.d.ts +34 -0
  17. package/dist/compliance/templates.d.ts.map +1 -0
  18. package/{src/compliance/templates.ts → dist/compliance/templates.js} +117 -155
  19. package/dist/compliance/templates.js.map +1 -0
  20. package/dist/compliance/types.d.ts +64 -0
  21. package/dist/compliance/types.d.ts.map +1 -0
  22. package/dist/compliance/types.js +64 -0
  23. package/dist/compliance/types.js.map +1 -0
  24. package/dist/db/index.d.ts +11 -0
  25. package/dist/db/index.d.ts.map +1 -0
  26. package/dist/db/index.js +63 -0
  27. package/dist/db/index.js.map +1 -0
  28. package/dist/db/schema.d.ts +444 -0
  29. package/dist/db/schema.d.ts.map +1 -0
  30. package/dist/db/schema.js +65 -0
  31. package/dist/db/schema.js.map +1 -0
  32. package/dist/feed-analyzer/feed-analyzer.d.ts +26 -0
  33. package/dist/feed-analyzer/feed-analyzer.d.ts.map +1 -0
  34. package/{src/feed-analyzer/feed-analyzer.ts → dist/feed-analyzer/feed-analyzer.js} +642 -726
  35. package/dist/feed-analyzer/feed-analyzer.js.map +1 -0
  36. package/dist/feed-analyzer/index.d.ts +8 -0
  37. package/dist/feed-analyzer/index.d.ts.map +1 -0
  38. package/dist/feed-analyzer/index.js +19 -0
  39. package/dist/feed-analyzer/index.js.map +1 -0
  40. package/dist/feed-analyzer/types.d.ts +204 -0
  41. package/dist/feed-analyzer/types.d.ts.map +1 -0
  42. package/dist/feed-analyzer/types.js +162 -0
  43. package/dist/feed-analyzer/types.js.map +1 -0
  44. package/{src/generator/index.ts → dist/generator/index.d.ts} +1 -1
  45. package/dist/generator/index.d.ts.map +1 -0
  46. package/dist/generator/index.js +13 -0
  47. package/dist/generator/index.js.map +1 -0
  48. package/dist/generator/key-generator.d.ts +24 -0
  49. package/dist/generator/key-generator.d.ts.map +1 -0
  50. package/dist/generator/key-generator.js +144 -0
  51. package/dist/generator/key-generator.js.map +1 -0
  52. package/dist/generator/profile-builder.d.ts +15 -0
  53. package/dist/generator/profile-builder.d.ts.map +1 -0
  54. package/dist/generator/profile-builder.js +338 -0
  55. package/dist/generator/profile-builder.js.map +1 -0
  56. package/dist/hosting/artifacts-generator.d.ts +10 -0
  57. package/dist/hosting/artifacts-generator.d.ts.map +1 -0
  58. package/{src/hosting/artifacts-generator.ts → dist/hosting/artifacts-generator.js} +191 -241
  59. package/dist/hosting/artifacts-generator.js.map +1 -0
  60. package/{src/hosting/index.ts → dist/hosting/index.d.ts} +1 -1
  61. package/dist/hosting/index.d.ts.map +1 -0
  62. package/dist/hosting/index.js +10 -0
  63. package/dist/hosting/index.js.map +1 -0
  64. package/dist/index.d.ts +18 -0
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js +78 -0
  67. package/dist/index.js.map +1 -0
  68. package/{src/security/index.ts → dist/security/index.d.ts} +8 -15
  69. package/dist/security/index.d.ts.map +1 -0
  70. package/dist/security/index.js +12 -0
  71. package/dist/security/index.js.map +1 -0
  72. package/dist/security/security-scanner.d.ts +10 -0
  73. package/dist/security/security-scanner.d.ts.map +1 -0
  74. package/dist/security/security-scanner.js +541 -0
  75. package/dist/security/security-scanner.js.map +1 -0
  76. package/dist/security/types.d.ts +48 -0
  77. package/dist/security/types.d.ts.map +1 -0
  78. package/dist/security/types.js +21 -0
  79. package/dist/security/types.js.map +1 -0
  80. package/dist/services/directory.d.ts +104 -0
  81. package/dist/services/directory.d.ts.map +1 -0
  82. package/dist/services/directory.js +333 -0
  83. package/dist/services/directory.js.map +1 -0
  84. package/dist/simulator/agent-simulator.d.ts +69 -0
  85. package/dist/simulator/agent-simulator.d.ts.map +1 -0
  86. package/{src/simulator/agent-simulator.ts → dist/simulator/agent-simulator.js} +650 -941
  87. package/dist/simulator/agent-simulator.js.map +1 -0
  88. package/{src/simulator/index.ts → dist/simulator/index.d.ts} +7 -7
  89. package/dist/simulator/index.d.ts.map +1 -0
  90. package/dist/simulator/index.js +23 -0
  91. package/dist/simulator/index.js.map +1 -0
  92. package/{src/simulator/types.ts → dist/simulator/types.d.ts} +145 -170
  93. package/dist/simulator/types.d.ts.map +1 -0
  94. package/dist/simulator/types.js +18 -0
  95. package/dist/simulator/types.js.map +1 -0
  96. package/dist/types/generator.d.ts +106 -0
  97. package/dist/types/generator.d.ts.map +1 -0
  98. package/dist/types/generator.js +6 -0
  99. package/dist/types/generator.js.map +1 -0
  100. package/{src/types/index.ts → dist/types/index.d.ts} +1 -1
  101. package/dist/types/index.d.ts.map +1 -0
  102. package/dist/types/index.js +23 -0
  103. package/dist/types/index.js.map +1 -0
  104. package/dist/types/ucp-profile.d.ts +103 -0
  105. package/dist/types/ucp-profile.d.ts.map +1 -0
  106. package/dist/types/ucp-profile.js +45 -0
  107. package/dist/types/ucp-profile.js.map +1 -0
  108. package/dist/types/validation.d.ts +68 -0
  109. package/dist/types/validation.d.ts.map +1 -0
  110. package/dist/types/validation.js +32 -0
  111. package/dist/types/validation.js.map +1 -0
  112. package/dist/validator/index.d.ts +26 -0
  113. package/dist/validator/index.d.ts.map +1 -0
  114. package/dist/validator/index.js +161 -0
  115. package/dist/validator/index.js.map +1 -0
  116. package/dist/validator/network-validator.d.ts +28 -0
  117. package/dist/validator/network-validator.d.ts.map +1 -0
  118. package/dist/validator/network-validator.js +319 -0
  119. package/dist/validator/network-validator.js.map +1 -0
  120. package/dist/validator/rules-validator.d.ts +11 -0
  121. package/dist/validator/rules-validator.d.ts.map +1 -0
  122. package/dist/validator/rules-validator.js +257 -0
  123. package/dist/validator/rules-validator.js.map +1 -0
  124. package/dist/validator/sdk-validator.d.ts +58 -0
  125. package/dist/validator/sdk-validator.d.ts.map +1 -0
  126. package/{src/validator/sdk-validator.ts → dist/validator/sdk-validator.js} +273 -330
  127. package/dist/validator/sdk-validator.js.map +1 -0
  128. package/dist/validator/structural-validator.d.ts +11 -0
  129. package/dist/validator/structural-validator.d.ts.map +1 -0
  130. package/dist/validator/structural-validator.js +415 -0
  131. package/dist/validator/structural-validator.js.map +1 -0
  132. package/package.json +1 -1
  133. package/publish-output.txt +0 -0
  134. package/CLAUDE.md +0 -109
  135. package/api/analyze-feed.js +0 -140
  136. package/api/badge.js +0 -185
  137. package/api/benchmark.js +0 -177
  138. package/api/directory-stats.ts +0 -29
  139. package/api/directory.ts +0 -73
  140. package/api/generate-compliance.js +0 -143
  141. package/api/generate-schema.js +0 -457
  142. package/api/generate.js +0 -132
  143. package/api/security-scan.js +0 -133
  144. package/api/simulate.js +0 -187
  145. package/api/tsconfig.json +0 -10
  146. package/api/validate.js +0 -1351
  147. package/apify-actor/.actor/actor.json +0 -68
  148. package/apify-actor/.actor/input_schema.json +0 -32
  149. package/apify-actor/APIFY-STORE-LISTING.md +0 -412
  150. package/apify-actor/Dockerfile +0 -8
  151. package/apify-actor/README.md +0 -166
  152. package/apify-actor/main.ts +0 -111
  153. package/apify-actor/package.json +0 -17
  154. package/apify-actor/src/main.js +0 -199
  155. package/docs/BRAND-IDENTITY.md +0 -238
  156. package/docs/BRAND-STYLE-GUIDE.md +0 -356
  157. package/drizzle/0000_black_king_cobra.sql +0 -39
  158. package/drizzle/meta/0000_snapshot.json +0 -309
  159. package/drizzle/meta/_journal.json +0 -13
  160. package/drizzle.config.ts +0 -10
  161. package/public/.well-known/ucp +0 -25
  162. package/public/android-chrome-192x192.png +0 -0
  163. package/public/android-chrome-512x512.png +0 -0
  164. package/public/apple-touch-icon.png +0 -0
  165. package/public/brand.css +0 -321
  166. package/public/directory.html +0 -701
  167. package/public/favicon-16x16.png +0 -0
  168. package/public/favicon-32x32.png +0 -0
  169. package/public/favicon.ico +0 -0
  170. package/public/guides/bigcommerce.html +0 -743
  171. package/public/guides/fastucp.html +0 -838
  172. package/public/guides/magento.html +0 -779
  173. package/public/guides/shopify.html +0 -726
  174. package/public/guides/squarespace.html +0 -749
  175. package/public/guides/wix.html +0 -747
  176. package/public/guides/woocommerce.html +0 -733
  177. package/public/index.html +0 -3835
  178. package/public/learn.html +0 -396
  179. package/public/logo.jpeg +0 -0
  180. package/public/og-image-icon.png +0 -0
  181. package/public/og-image.png +0 -0
  182. package/public/robots.txt +0 -6
  183. package/public/site.webmanifest +0 -31
  184. package/public/sitemap.xml +0 -69
  185. package/public/social/linkedin-banner-1128x191.png +0 -0
  186. package/public/social/temp.PNG +0 -0
  187. package/public/social/x-header-1500x500.png +0 -0
  188. package/public/verify.html +0 -410
  189. package/scripts/generate-favicons.js +0 -44
  190. package/scripts/generate-ico.js +0 -23
  191. package/scripts/generate-og-image.js +0 -45
  192. package/scripts/reset-db.ts +0 -77
  193. package/scripts/seed-db.ts +0 -71
  194. package/scripts/setup-benchmark-db.js +0 -70
  195. package/src/api/server.ts +0 -266
  196. package/src/cli/index.ts +0 -302
  197. package/src/compliance/compliance-generator.ts +0 -452
  198. package/src/compliance/index.ts +0 -28
  199. package/src/compliance/types.ts +0 -170
  200. package/src/db/index.ts +0 -28
  201. package/src/db/schema.ts +0 -84
  202. package/src/feed-analyzer/index.ts +0 -34
  203. package/src/feed-analyzer/types.ts +0 -354
  204. package/src/generator/key-generator.ts +0 -124
  205. package/src/generator/profile-builder.ts +0 -402
  206. package/src/index.ts +0 -105
  207. package/src/security/security-scanner.ts +0 -604
  208. package/src/security/types.ts +0 -55
  209. package/src/services/directory.ts +0 -434
  210. package/src/types/generator.ts +0 -140
  211. package/src/types/ucp-profile.ts +0 -140
  212. package/src/types/validation.ts +0 -89
  213. package/src/validator/index.ts +0 -194
  214. package/src/validator/network-validator.ts +0 -417
  215. package/src/validator/rules-validator.ts +0 -297
  216. package/src/validator/structural-validator.ts +0 -476
  217. package/tests/fixtures/non-compliant-profile.json +0 -25
  218. package/tests/fixtures/official-sample-profile.json +0 -75
  219. package/tests/integration/benchmark.test.ts +0 -207
  220. package/tests/integration/database.test.ts +0 -163
  221. package/tests/integration/directory-api.test.ts +0 -268
  222. package/tests/integration/simulate-api.test.ts +0 -230
  223. package/tests/integration/validate-api.test.ts +0 -269
  224. package/tests/setup.ts +0 -15
  225. package/tests/unit/agent-simulator.test.ts +0 -575
  226. package/tests/unit/compliance-generator.test.ts +0 -374
  227. package/tests/unit/directory-service.test.ts +0 -272
  228. package/tests/unit/feed-analyzer.test.ts +0 -517
  229. package/tests/unit/lint-suggestions.test.ts +0 -423
  230. package/tests/unit/official-samples.test.ts +0 -211
  231. package/tests/unit/pdf-report.test.ts +0 -390
  232. package/tests/unit/sdk-validator.test.ts +0 -531
  233. package/tests/unit/security-scanner.test.ts +0 -410
  234. package/tests/unit/validation.test.ts +0 -390
  235. package/vercel.json +0 -34
  236. package/vitest.config.ts +0 -22
@@ -1,24 +1,24 @@
1
- /**
2
- * GDPR/Privacy Compliance Templates
3
- * Template content for privacy policy addendums and consent language
4
- */
5
-
6
- import type { ComplianceRegion, LawfulBasis, DataProcessor } from './types.js';
7
- import { LAWFUL_BASIS_DESCRIPTIONS, AI_PLATFORM_PROCESSORS } from './types.js';
8
-
9
- /**
10
- * Generate the AI Commerce privacy policy section
11
- */
12
- export function generateAiCommerceSection(
13
- companyName: string,
14
- platforms: DataProcessor[],
15
- lawfulBasis: LawfulBasis,
16
- regions: ComplianceRegion[]
17
- ): string {
18
- const basisInfo = LAWFUL_BASIS_DESCRIPTIONS[lawfulBasis];
19
- const platformList = platforms.map(p => p.name).join(', ');
20
-
21
- let section = `## AI-Powered Shopping and Agentic Commerce
1
+ "use strict";
2
+ /**
3
+ * GDPR/Privacy Compliance Templates
4
+ * Template content for privacy policy addendums and consent language
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.generateAiCommerceSection = generateAiCommerceSection;
8
+ exports.generateProcessorDisclosures = generateProcessorDisclosures;
9
+ exports.generateConsentLanguage = generateConsentLanguage;
10
+ exports.generateMarketingOptIn = generateMarketingOptIn;
11
+ exports.generateDataSubjectRights = generateDataSubjectRights;
12
+ exports.generateTrackingNotice = generateTrackingNotice;
13
+ exports.generateDisclaimer = generateDisclaimer;
14
+ const types_js_1 = require("./types.js");
15
+ /**
16
+ * Generate the AI Commerce privacy policy section
17
+ */
18
+ function generateAiCommerceSection(companyName, platforms, lawfulBasis, regions) {
19
+ const basisInfo = types_js_1.LAWFUL_BASIS_DESCRIPTIONS[lawfulBasis];
20
+ const platformList = platforms.map(p => p.name).join(', ');
21
+ let section = `## AI-Powered Shopping and Agentic Commerce
22
22
 
23
23
  ### How We Use AI Shopping Agents
24
24
 
@@ -43,21 +43,19 @@ When you make a purchase through an AI shopping agent, we may collect:
43
43
  - Payment confirmation (we do not receive full payment card details)
44
44
  - Transaction identifiers for order tracking
45
45
  - Communication preferences
46
- `;
47
-
48
- if (regions.includes('eu') || regions.includes('uk')) {
49
- section += `
46
+ `;
47
+ if (regions.includes('eu') || regions.includes('uk')) {
48
+ section += `
50
49
  ### International Data Transfers
51
50
 
52
51
  Some AI agent providers are based outside the European Economic Area (EEA) or United Kingdom. When your data is transferred to these providers, it is protected by:
53
52
  - Standard Contractual Clauses (SCCs) approved by the European Commission
54
53
  - The provider's certification under applicable data protection frameworks
55
54
  - Additional technical and organizational security measures
56
- `;
57
- }
58
-
59
- if (regions.includes('california')) {
60
- section += `
55
+ `;
56
+ }
57
+ if (regions.includes('california')) {
58
+ section += `
61
59
  ### California Privacy Rights (CCPA/CPRA)
62
60
 
63
61
  California residents have additional rights regarding personal information collected through AI shopping agents:
@@ -67,60 +65,46 @@ California residents have additional rights regarding personal information colle
67
65
  - **Right to Non-Discrimination**: We will not discriminate against you for exercising your privacy rights
68
66
 
69
67
  To exercise these rights, contact us at the email address provided below.
70
- `;
71
- }
72
-
73
- return section;
74
- }
75
-
76
- /**
77
- * Generate data processor disclosures
78
- */
79
- export function generateProcessorDisclosures(
80
- processors: DataProcessor[],
81
- regions: ComplianceRegion[]
82
- ): string {
83
- let disclosure = `## Third-Party Data Processors (AI Commerce)
68
+ `;
69
+ }
70
+ return section;
71
+ }
72
+ /**
73
+ * Generate data processor disclosures
74
+ */
75
+ function generateProcessorDisclosures(processors, regions) {
76
+ let disclosure = `## Third-Party Data Processors (AI Commerce)
84
77
 
85
78
  We work with the following third-party service providers to enable AI-powered shopping:
86
79
 
87
80
  | Provider | Purpose | Location | Privacy Policy |
88
81
  |----------|---------|----------|----------------|
89
- `;
90
-
91
- for (const processor of processors) {
92
- const privacyLink = processor.privacyPolicyUrl
93
- ? `[View Policy](${processor.privacyPolicyUrl})`
94
- : 'Contact provider';
95
- disclosure += `| ${processor.name} | ${processor.purpose} | ${processor.country || 'Various'} | ${privacyLink} |\n`;
96
- }
97
-
98
- disclosure += `
82
+ `;
83
+ for (const processor of processors) {
84
+ const privacyLink = processor.privacyPolicyUrl
85
+ ? `[View Policy](${processor.privacyPolicyUrl})`
86
+ : 'Contact provider';
87
+ disclosure += `| ${processor.name} | ${processor.purpose} | ${processor.country || 'Various'} | ${privacyLink} |\n`;
88
+ }
89
+ disclosure += `
99
90
  These processors are contractually bound to:
100
91
  - Process data only on our documented instructions
101
92
  - Ensure appropriate security measures are in place
102
93
  - Assist us in responding to data subject requests
103
94
  - Delete or return all personal data at the end of the service relationship
104
- `;
105
-
106
- if (regions.includes('eu') || regions.includes('uk')) {
107
- disclosure += `
95
+ `;
96
+ if (regions.includes('eu') || regions.includes('uk')) {
97
+ disclosure += `
108
98
  All processors have entered into Data Processing Agreements (DPAs) that comply with Article 28 of the GDPR.
109
- `;
110
- }
111
-
112
- return disclosure;
113
- }
114
-
115
- /**
116
- * Generate consent language for checkout
117
- */
118
- export function generateConsentLanguage(
119
- companyName: string,
120
- lawfulBasis: LawfulBasis,
121
- includeMarketing: boolean
122
- ): string {
123
- let consent = `## Consent Language for AI-Assisted Checkout
99
+ `;
100
+ }
101
+ return disclosure;
102
+ }
103
+ /**
104
+ * Generate consent language for checkout
105
+ */
106
+ function generateConsentLanguage(companyName, lawfulBasis, includeMarketing) {
107
+ let consent = `## Consent Language for AI-Assisted Checkout
124
108
 
125
109
  Use the following language at checkout or in order confirmations:
126
110
 
@@ -130,18 +114,16 @@ Use the following language at checkout or in order confirmations:
130
114
  > - Your order information will be processed by ${companyName} and the AI platform provider
131
115
  > - We will use your data to fulfill your order, process payment, and provide customer support
132
116
  > - Your data will be handled in accordance with our Privacy Policy
133
- `;
134
-
135
- if (lawfulBasis === 'consent') {
136
- consent += `
117
+ `;
118
+ if (lawfulBasis === 'consent') {
119
+ consent += `
137
120
  ### Explicit Consent (for consent-based processing)
138
121
 
139
122
  > [ ] I consent to ${companyName} processing my personal data for the purpose of completing this purchase and providing related services. I understand I can withdraw my consent at any time.
140
- `;
141
- }
142
-
143
- if (includeMarketing) {
144
- consent += `
123
+ `;
124
+ }
125
+ if (includeMarketing) {
126
+ consent += `
145
127
  ### Marketing Consent (Optional)
146
128
 
147
129
  > [ ] I would like to receive marketing communications from ${companyName} about products, offers, and updates. I understand I can unsubscribe at any time.
@@ -150,23 +132,20 @@ Use the following language at checkout or in order confirmations:
150
132
  - Freely given (not a condition of purchase)
151
133
  - Specific and informed
152
134
  - Indicated by clear affirmative action (pre-ticked boxes are not valid consent)
153
- `;
154
- }
155
-
156
- consent += `
135
+ `;
136
+ }
137
+ consent += `
157
138
  ### Agent-Originated Orders Notice
158
139
 
159
140
  > This order was initiated through an AI shopping assistant. The AI platform may retain conversation history in accordance with their privacy policy. Your transaction data with ${companyName} is subject to our Privacy Policy.
160
- `;
161
-
162
- return consent;
163
- }
164
-
165
- /**
166
- * Generate marketing opt-in text
167
- */
168
- export function generateMarketingOptIn(companyName: string): string {
169
- return `## Marketing Opt-In for Agent-Acquired Customers
141
+ `;
142
+ return consent;
143
+ }
144
+ /**
145
+ * Generate marketing opt-in text
146
+ */
147
+ function generateMarketingOptIn(companyName) {
148
+ return `## Marketing Opt-In for Agent-Acquired Customers
170
149
 
171
150
  For customers acquired through AI shopping agents, use the following opt-in language:
172
151
 
@@ -187,19 +166,13 @@ For customers who made purchases via AI agents without opting in, you may send O
187
166
  > [Subscribe to Updates] [No Thanks]
188
167
 
189
168
  **Important**: Do not add customers to marketing lists without explicit consent. Agent-originated orders do not imply marketing permission.
190
- `;
191
- }
192
-
193
- /**
194
- * Generate data subject rights notice
195
- */
196
- export function generateDataSubjectRights(
197
- companyName: string,
198
- contactEmail: string,
199
- dpoEmail: string | undefined,
200
- regions: ComplianceRegion[]
201
- ): string {
202
- let rights = `## Your Data Rights (AI Commerce Transactions)
169
+ `;
170
+ }
171
+ /**
172
+ * Generate data subject rights notice
173
+ */
174
+ function generateDataSubjectRights(companyName, contactEmail, dpoEmail, regions) {
175
+ let rights = `## Your Data Rights (AI Commerce Transactions)
203
176
 
204
177
  You have the following rights regarding personal data collected through AI-assisted purchases:
205
178
 
@@ -214,31 +187,28 @@ You have the following rights regarding personal data collected through AI-assis
214
187
  ### Objection and Restriction
215
188
  - Object to processing based on legitimate interests
216
189
  - Request restriction of processing in certain circumstances
217
- `;
218
-
219
- if (regions.includes('eu') || regions.includes('uk')) {
220
- rights += `
190
+ `;
191
+ if (regions.includes('eu') || regions.includes('uk')) {
192
+ rights += `
221
193
  ### GDPR-Specific Rights
222
194
  - **Right to be Forgotten**: Request erasure under Article 17
223
195
  - **Right to Restrict Processing**: Under Article 18
224
196
  - **Right to Data Portability**: Under Article 20
225
197
  - **Right to Object**: Under Article 21
226
198
  - **Lodge a Complaint**: With your local data protection authority
227
- `;
228
- }
229
-
230
- if (regions.includes('california')) {
231
- rights += `
199
+ `;
200
+ }
201
+ if (regions.includes('california')) {
202
+ rights += `
232
203
  ### CCPA/CPRA Rights
233
204
  - **Right to Know**: Categories and specific pieces of personal information collected
234
205
  - **Right to Delete**: Request deletion of personal information
235
206
  - **Right to Correct**: Request correction of inaccurate information
236
207
  - **Right to Opt-Out**: Of sale or sharing of personal information
237
208
  - **Right to Limit Use**: Of sensitive personal information
238
- `;
239
- }
240
-
241
- rights += `
209
+ `;
210
+ }
211
+ rights += `
242
212
  ### How to Exercise Your Rights
243
213
 
244
214
  To exercise any of these rights, contact us:
@@ -255,19 +225,14 @@ To protect your privacy, we may need to verify your identity before processing y
255
225
  - Order number or transaction ID
256
226
  - Email address used for the order
257
227
  - Delivery address associated with the order
258
- `;
259
-
260
- return rights;
261
- }
262
-
263
- /**
264
- * Generate tracking/cookie notice for agent transactions
265
- */
266
- export function generateTrackingNotice(
267
- companyName: string,
268
- regions: ComplianceRegion[]
269
- ): string {
270
- let notice = `## Tracking and Cookies for AI Agent Transactions
228
+ `;
229
+ return rights;
230
+ }
231
+ /**
232
+ * Generate tracking/cookie notice for agent transactions
233
+ */
234
+ function generateTrackingNotice(companyName, regions) {
235
+ let notice = `## Tracking and Cookies for AI Agent Transactions
271
236
 
272
237
  ### How Tracking Works with AI Agents
273
238
 
@@ -288,10 +253,9 @@ For AI agent transactions, we collect data through:
288
253
  - We do **not** place cookies on your device through AI agent transactions
289
254
  - We do **not** build behavioral profiles based solely on AI agent purchases
290
255
  - We **do** collect necessary transaction data to fulfill your order
291
- `;
292
-
293
- if (regions.includes('eu') || regions.includes('uk')) {
294
- notice += `
256
+ `;
257
+ if (regions.includes('eu') || regions.includes('uk')) {
258
+ notice += `
295
259
  ### ePrivacy Compliance
296
260
 
297
261
  AI agent transactions are processed under:
@@ -299,10 +263,9 @@ AI agent transactions are processed under:
299
263
  - **Contract Performance**: Data processing necessary to deliver your order
300
264
 
301
265
  No consent is required for strictly necessary processing of transaction data.
302
- `;
303
- }
304
-
305
- notice += `
266
+ `;
267
+ }
268
+ notice += `
306
269
  ### AI Platform Tracking
307
270
 
308
271
  The AI shopping agent (ChatGPT, Google AI, Copilot) may have its own data collection practices. Please review their privacy policies:
@@ -311,16 +274,14 @@ The AI shopping agent (ChatGPT, Google AI, Copilot) may have its own data collec
311
274
  - Account information you've provided to the AI service
312
275
 
313
276
  ${companyName} is not responsible for data collected directly by AI platform providers.
314
- `;
315
-
316
- return notice;
317
- }
318
-
319
- /**
320
- * Generate the legal disclaimer
321
- */
322
- export function generateDisclaimer(): string {
323
- return `---
277
+ `;
278
+ return notice;
279
+ }
280
+ /**
281
+ * Generate the legal disclaimer
282
+ */
283
+ function generateDisclaimer() {
284
+ return `---
324
285
 
325
286
  **IMPORTANT DISCLAIMER**
326
287
 
@@ -334,5 +295,6 @@ This document was generated by an automated tool and is provided for information
334
295
  We recommend consulting with a privacy lawyer or data protection specialist to ensure your privacy policy fully complies with applicable laws.
335
296
 
336
297
  Generated by [UCP.tools](https://ucptools.dev) - AI Commerce Readiness Platform
337
- `;
338
- }
298
+ `;
299
+ }
300
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/compliance/templates.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAQH,8DA8DC;AAKD,oEAkCC;AAKD,0DA6CC;AAKD,wDAuBC;AAKD,8DAiEC;AAKD,wDAmDC;AAKD,gDAgBC;AA3UD,yCAA+E;AAE/E;;GAEG;AACH,SAAgB,yBAAyB,CACvC,WAAmB,EACnB,SAA0B,EAC1B,WAAwB,EACxB,OAA2B;IAE3B,MAAM,SAAS,GAAG,oCAAyB,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,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C;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CACpC,WAAmB,EACnB,OAA2B;IAE3B,IAAI,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBd,CAAC;IAEA,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI;;;;;;;;CAQb,CAAC;IACA,CAAC;IAED,MAAM,IAAI;;;;;;;;EAQV,WAAW;CACZ,CAAC;IAEA,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB;IAChC,OAAO;;;;;;;;;IASL,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;;;;;CAK3B,CAAC;AACF,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * GDPR/Privacy Compliance Generator Types
3
+ * Types for generating privacy policy addendums and consent language
4
+ */
5
+ export type ComplianceRegion = 'eu' | 'uk' | 'california' | 'global';
6
+ export type LawfulBasis = 'contract' | 'consent' | 'legitimate' | 'legal';
7
+ export type AgentPlatform = 'openai' | 'google' | 'microsoft' | 'other';
8
+ export interface ComplianceGeneratorInput {
9
+ companyName: string;
10
+ companyEmail?: string;
11
+ companyAddress?: string;
12
+ dpoEmail?: string;
13
+ regions: ComplianceRegion[];
14
+ platforms: AgentPlatform[];
15
+ lawfulBasis: LawfulBasis;
16
+ includeMarketingConsent?: boolean;
17
+ includeDataRetention?: boolean;
18
+ retentionPeriodYears?: number;
19
+ additionalProcessors?: DataProcessor[];
20
+ }
21
+ export interface DataProcessor {
22
+ name: string;
23
+ purpose: string;
24
+ country?: string;
25
+ privacyPolicyUrl?: string;
26
+ }
27
+ export interface ComplianceDocument {
28
+ title: string;
29
+ sections: ComplianceSection[];
30
+ disclaimer: string;
31
+ generatedAt: string;
32
+ regions: ComplianceRegion[];
33
+ }
34
+ export interface ComplianceSection {
35
+ id: string;
36
+ title: string;
37
+ content: string;
38
+ required: boolean;
39
+ applicableRegions: ComplianceRegion[];
40
+ }
41
+ export interface ComplianceGeneratorOutput {
42
+ privacyAddendum: ComplianceDocument;
43
+ snippets: {
44
+ aiCommerceSection: string;
45
+ processorDisclosures: string;
46
+ consentLanguage: string;
47
+ marketingOptIn?: string;
48
+ dataSubjectRights: string;
49
+ trackingNotice: string;
50
+ };
51
+ embedHtml: string;
52
+ plainText: string;
53
+ generatedAt: string;
54
+ lawfulBasis: LawfulBasis;
55
+ regions: ComplianceRegion[];
56
+ }
57
+ export declare const AI_PLATFORM_PROCESSORS: Record<AgentPlatform, DataProcessor>;
58
+ export declare const REGION_NAMES: Record<ComplianceRegion, string>;
59
+ export declare const LAWFUL_BASIS_DESCRIPTIONS: Record<LawfulBasis, {
60
+ title: string;
61
+ description: string;
62
+ gdprArticle: string;
63
+ }>;
64
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compliance/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,YAAY,GAAG,QAAQ,CAAC;AAGrE,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,SAAS,GACT,YAAY,GACZ,OAAO,CAAC;AAGZ,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,OAAO,CAAC;AAGZ,MAAM,WAAW,wBAAwB;IAEvC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAG5B,SAAS,EAAE,aAAa,EAAE,CAAC;IAG3B,WAAW,EAAE,WAAW,CAAC;IAGzB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,oBAAoB,CA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,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAKzD,CAAC;AAGF,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,WAAW,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAqBtH,CAAC"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /**
3
+ * GDPR/Privacy Compliance Generator Types
4
+ * Types for generating privacy policy addendums and consent language
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.LAWFUL_BASIS_DESCRIPTIONS = exports.REGION_NAMES = exports.AI_PLATFORM_PROCESSORS = void 0;
8
+ // Predefined data processors for AI platforms
9
+ exports.AI_PLATFORM_PROCESSORS = {
10
+ openai: {
11
+ name: 'OpenAI, LLC',
12
+ purpose: 'AI-powered shopping assistant and checkout processing',
13
+ country: 'United States',
14
+ privacyPolicyUrl: 'https://openai.com/privacy/',
15
+ },
16
+ google: {
17
+ name: 'Google LLC',
18
+ purpose: 'AI shopping agent (Google AI Mode, Gemini) and checkout processing',
19
+ country: 'United States',
20
+ privacyPolicyUrl: 'https://policies.google.com/privacy',
21
+ },
22
+ microsoft: {
23
+ name: 'Microsoft Corporation',
24
+ purpose: 'AI shopping assistant (Copilot) and checkout processing',
25
+ country: 'United States',
26
+ privacyPolicyUrl: 'https://privacy.microsoft.com/privacystatement',
27
+ },
28
+ other: {
29
+ name: 'Third-party AI Agent Provider',
30
+ purpose: 'AI-powered shopping and checkout assistance',
31
+ country: 'Various',
32
+ },
33
+ };
34
+ // Region display names
35
+ exports.REGION_NAMES = {
36
+ eu: 'European Union (GDPR)',
37
+ uk: 'United Kingdom (UK GDPR)',
38
+ california: 'California (CCPA/CPRA)',
39
+ global: 'Global (General Best Practices)',
40
+ };
41
+ // Lawful basis descriptions
42
+ exports.LAWFUL_BASIS_DESCRIPTIONS = {
43
+ contract: {
44
+ title: 'Performance of a Contract',
45
+ description: 'Processing is necessary for the performance of a contract with the data subject or to take steps at their request prior to entering into a contract.',
46
+ gdprArticle: 'Article 6(1)(b)',
47
+ },
48
+ consent: {
49
+ title: 'Consent',
50
+ description: 'The data subject has given consent to the processing of their personal data for one or more specific purposes.',
51
+ gdprArticle: 'Article 6(1)(a)',
52
+ },
53
+ legitimate: {
54
+ title: 'Legitimate Interests',
55
+ description: 'Processing is necessary for the purposes of the legitimate interests pursued by the controller or by a third party.',
56
+ gdprArticle: 'Article 6(1)(f)',
57
+ },
58
+ legal: {
59
+ title: 'Legal Obligation',
60
+ description: 'Processing is necessary for compliance with a legal obligation to which the controller is subject.',
61
+ gdprArticle: 'Article 6(1)(c)',
62
+ },
63
+ };
64
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/compliance/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA6GH,8CAA8C;AACjC,QAAA,sBAAsB,GAAyC;IAC1E,MAAM,EAAE;QACN,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,uDAAuD;QAChE,OAAO,EAAE,eAAe;QACxB,gBAAgB,EAAE,6BAA6B;KAChD;IACD,MAAM,EAAE;QACN,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,oEAAoE;QAC7E,OAAO,EAAE,eAAe;QACxB,gBAAgB,EAAE,qCAAqC;KACxD;IACD,SAAS,EAAE;QACT,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,yDAAyD;QAClE,OAAO,EAAE,eAAe;QACxB,gBAAgB,EAAE,gDAAgD;KACnE;IACD,KAAK,EAAE;QACL,IAAI,EAAE,+BAA+B;QACrC,OAAO,EAAE,6CAA6C;QACtD,OAAO,EAAE,SAAS;KACnB;CACF,CAAC;AAEF,uBAAuB;AACV,QAAA,YAAY,GAAqC;IAC5D,EAAE,EAAE,uBAAuB;IAC3B,EAAE,EAAE,0BAA0B;IAC9B,UAAU,EAAE,wBAAwB;IACpC,MAAM,EAAE,iCAAiC;CAC1C,CAAC;AAEF,4BAA4B;AACf,QAAA,yBAAyB,GAAqF;IACzH,QAAQ,EAAE;QACR,KAAK,EAAE,2BAA2B;QAClC,WAAW,EAAE,sJAAsJ;QACnK,WAAW,EAAE,iBAAiB;KAC/B;IACD,OAAO,EAAE;QACP,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,gHAAgH;QAC7H,WAAW,EAAE,iBAAiB;KAC/B;IACD,UAAU,EAAE;QACV,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,qHAAqH;QAClI,WAAW,EAAE,iBAAiB;KAC/B;IACD,KAAK,EAAE;QACL,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,oGAAoG;QACjH,WAAW,EAAE,iBAAiB;KAC/B;CACF,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { NeonHttpDatabase } from 'drizzle-orm/neon-http';
2
+ import * as schema from './schema.js';
3
+ type Database = NeonHttpDatabase<typeof schema>;
4
+ /**
5
+ * Get the Drizzle database instance.
6
+ * Lazily creates the connection on first use.
7
+ */
8
+ export declare function getDb(): Database;
9
+ export * from './schema.js';
10
+ export { schema };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAGtC,KAAK,QAAQ,GAAG,gBAAgB,CAAC,OAAO,MAAM,CAAC,CAAC;AAKhD;;;GAGG;AACH,wBAAgB,KAAK,IAAI,QAAQ,CAShC;AAGD,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.schema = void 0;
40
+ exports.getDb = getDb;
41
+ const neon_http_1 = require("drizzle-orm/neon-http");
42
+ const serverless_1 = require("@neondatabase/serverless");
43
+ const schema = __importStar(require("./schema.js"));
44
+ exports.schema = schema;
45
+ // Lazy-loaded database instance (for serverless cold starts)
46
+ let dbInstance = null;
47
+ /**
48
+ * Get the Drizzle database instance.
49
+ * Lazily creates the connection on first use.
50
+ */
51
+ function getDb() {
52
+ if (!dbInstance) {
53
+ if (!process.env.DATABASE_URL) {
54
+ throw new Error('DATABASE_URL environment variable is not set');
55
+ }
56
+ const sql = (0, serverless_1.neon)(process.env.DATABASE_URL);
57
+ dbInstance = (0, neon_http_1.drizzle)(sql, { schema });
58
+ }
59
+ return dbInstance;
60
+ }
61
+ // Re-export schema for convenience
62
+ __exportStar(require("./schema.js"), exports);
63
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,sBASC;AAvBD,qDAAkE;AAClE,yDAAgD;AAChD,oDAAsC;AAyB7B,wBAAM;AApBf,6DAA6D;AAC7D,IAAI,UAAU,GAAoB,IAAI,CAAC;AAEvC;;;GAGG;AACH,SAAgB,KAAK;IACnB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,GAAG,GAAG,IAAA,iBAAI,EAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC3C,UAAU,GAAG,IAAA,mBAAO,EAAC,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,mCAAmC;AACnC,8CAA4B"}