@contractspec/bundle.marketing 1.12.0 → 1.13.0

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 (262) hide show
  1. package/.turbo/turbo-build.log +146 -175
  2. package/.turbo/turbo-prebuild.log +1 -0
  3. package/CHANGELOG.md +29 -0
  4. package/dist/browser/components/marketing/ChangelogPage.js +92 -0
  5. package/dist/browser/components/marketing/CofounderPage.js +581 -0
  6. package/dist/browser/components/marketing/ContactClient.js +1379 -0
  7. package/dist/browser/components/marketing/ContributePage.js +487 -0
  8. package/dist/browser/components/marketing/DesignPartnerPage.js +272 -0
  9. package/dist/browser/components/marketing/LandingPage.js +629 -0
  10. package/dist/browser/components/marketing/PricingClient.js +1972 -0
  11. package/dist/browser/components/marketing/ProductClientPage.js +563 -0
  12. package/dist/browser/components/marketing/index.js +4818 -0
  13. package/dist/browser/components/marketing/pricing-thinking-modal.js +258 -0
  14. package/dist/browser/components/marketing/sections/AudienceSection.js +90 -0
  15. package/dist/browser/components/marketing/sections/CorePositioningSection.js +72 -0
  16. package/dist/browser/components/marketing/sections/CtaSection.js +67 -0
  17. package/dist/browser/components/marketing/sections/DevelopersSection.js +50 -0
  18. package/dist/browser/components/marketing/sections/FearsSection.js +105 -0
  19. package/dist/browser/components/marketing/sections/HeroMarketingSection.js +93 -0
  20. package/dist/browser/components/marketing/sections/IconGridSection.js +63 -0
  21. package/dist/browser/components/marketing/sections/OutputsSection.js +116 -0
  22. package/dist/browser/components/marketing/sections/ProblemSection.js +103 -0
  23. package/dist/browser/components/marketing/sections/SolutionSection.js +103 -0
  24. package/dist/browser/components/marketing/sections/StepsSection.js +109 -0
  25. package/dist/browser/components/marketing/waitlist-section.js +1104 -0
  26. package/dist/browser/components/templates/TemplatesClientPage.js +5662 -0
  27. package/dist/browser/components/templates/TemplatesPage.js +177 -0
  28. package/dist/browser/components/templates/TemplatesPreviewModal.js +124 -0
  29. package/dist/browser/components/templates/index.js +5831 -0
  30. package/dist/browser/index.js +6485 -0
  31. package/dist/browser/libs/email/client.js +122 -0
  32. package/dist/browser/libs/email/contact.js +190 -0
  33. package/dist/browser/libs/email/newsletter.js +215 -0
  34. package/dist/browser/libs/email/types.js +2 -0
  35. package/dist/browser/libs/email/utils.js +16 -0
  36. package/dist/browser/libs/email/waitlist-application.js +295 -0
  37. package/dist/browser/libs/email/waitlist.js +225 -0
  38. package/dist/browser/libs/pricing-examples.js +26 -0
  39. package/dist/browser/registry/engine.js +5293 -0
  40. package/dist/browser/registry/factory.js +52 -0
  41. package/dist/browser/registry/index.js +5358 -0
  42. package/dist/browser/registry/registry-docs.js +343 -0
  43. package/dist/browser/registry/registry-landing.js +4937 -0
  44. package/dist/browser/registry/registry.js +5279 -0
  45. package/dist/browser/registry/types.js +0 -0
  46. package/dist/browser/registry/utils.js +5340 -0
  47. package/dist/components/marketing/ChangelogPage.d.ts +11 -17
  48. package/dist/components/marketing/ChangelogPage.d.ts.map +1 -1
  49. package/dist/components/marketing/ChangelogPage.js +84 -62
  50. package/dist/components/marketing/CofounderPage.d.ts +1 -6
  51. package/dist/components/marketing/CofounderPage.d.ts.map +1 -1
  52. package/dist/components/marketing/CofounderPage.js +544 -436
  53. package/dist/components/marketing/ContactClient.d.ts +1 -6
  54. package/dist/components/marketing/ContactClient.d.ts.map +1 -1
  55. package/dist/components/marketing/ContactClient.js +1371 -155
  56. package/dist/components/marketing/ContributePage.d.ts +3 -8
  57. package/dist/components/marketing/ContributePage.d.ts.map +1 -1
  58. package/dist/components/marketing/ContributePage.js +478 -358
  59. package/dist/components/marketing/DesignPartnerPage.d.ts +3 -8
  60. package/dist/components/marketing/DesignPartnerPage.d.ts.map +1 -1
  61. package/dist/components/marketing/DesignPartnerPage.js +263 -211
  62. package/dist/components/marketing/LandingPage.d.ts +1 -6
  63. package/dist/components/marketing/LandingPage.d.ts.map +1 -1
  64. package/dist/components/marketing/LandingPage.js +623 -37
  65. package/dist/components/marketing/PricingClient.d.ts +1 -6
  66. package/dist/components/marketing/PricingClient.d.ts.map +1 -1
  67. package/dist/components/marketing/PricingClient.js +1962 -516
  68. package/dist/components/marketing/ProductClientPage.d.ts +1 -6
  69. package/dist/components/marketing/ProductClientPage.d.ts.map +1 -1
  70. package/dist/components/marketing/ProductClientPage.js +556 -458
  71. package/dist/components/marketing/index.d.ts +11 -11
  72. package/dist/components/marketing/index.d.ts.map +1 -0
  73. package/dist/components/marketing/index.js +4813 -12
  74. package/dist/components/marketing/pricing-thinking-modal.d.ts +5 -13
  75. package/dist/components/marketing/pricing-thinking-modal.d.ts.map +1 -1
  76. package/dist/components/marketing/pricing-thinking-modal.js +248 -197
  77. package/dist/components/marketing/sections/AudienceSection.d.ts +1 -6
  78. package/dist/components/marketing/sections/AudienceSection.d.ts.map +1 -1
  79. package/dist/components/marketing/sections/AudienceSection.js +80 -63
  80. package/dist/components/marketing/sections/CorePositioningSection.d.ts +1 -6
  81. package/dist/components/marketing/sections/CorePositioningSection.d.ts.map +1 -1
  82. package/dist/components/marketing/sections/CorePositioningSection.js +62 -54
  83. package/dist/components/marketing/sections/CtaSection.d.ts +1 -6
  84. package/dist/components/marketing/sections/CtaSection.d.ts.map +1 -1
  85. package/dist/components/marketing/sections/CtaSection.js +58 -50
  86. package/dist/components/marketing/sections/DevelopersSection.d.ts +1 -6
  87. package/dist/components/marketing/sections/DevelopersSection.d.ts.map +1 -1
  88. package/dist/components/marketing/sections/DevelopersSection.js +40 -40
  89. package/dist/components/marketing/sections/FearsSection.d.ts +1 -6
  90. package/dist/components/marketing/sections/FearsSection.d.ts.map +1 -1
  91. package/dist/components/marketing/sections/FearsSection.js +96 -44
  92. package/dist/components/marketing/sections/HeroMarketingSection.d.ts +1 -6
  93. package/dist/components/marketing/sections/HeroMarketingSection.d.ts.map +1 -1
  94. package/dist/components/marketing/sections/HeroMarketingSection.js +82 -71
  95. package/dist/components/marketing/sections/IconGridSection.d.ts +25 -39
  96. package/dist/components/marketing/sections/IconGridSection.d.ts.map +1 -1
  97. package/dist/components/marketing/sections/IconGridSection.js +55 -41
  98. package/dist/components/marketing/sections/OutputsSection.d.ts +1 -6
  99. package/dist/components/marketing/sections/OutputsSection.d.ts.map +1 -1
  100. package/dist/components/marketing/sections/OutputsSection.js +107 -55
  101. package/dist/components/marketing/sections/ProblemSection.d.ts +1 -6
  102. package/dist/components/marketing/sections/ProblemSection.d.ts.map +1 -1
  103. package/dist/components/marketing/sections/ProblemSection.js +94 -42
  104. package/dist/components/marketing/sections/SolutionSection.d.ts +1 -6
  105. package/dist/components/marketing/sections/SolutionSection.d.ts.map +1 -1
  106. package/dist/components/marketing/sections/SolutionSection.js +94 -42
  107. package/dist/components/marketing/sections/StepsSection.d.ts +1 -6
  108. package/dist/components/marketing/sections/StepsSection.d.ts.map +1 -1
  109. package/dist/components/marketing/sections/StepsSection.js +100 -48
  110. package/dist/components/marketing/waitlist-section.d.ts +5 -12
  111. package/dist/components/marketing/waitlist-section.d.ts.map +1 -1
  112. package/dist/components/marketing/waitlist-section.js +1089 -568
  113. package/dist/components/templates/TemplatesClientPage.d.ts +1 -6
  114. package/dist/components/templates/TemplatesClientPage.d.ts.map +1 -1
  115. package/dist/components/templates/TemplatesClientPage.js +5649 -617
  116. package/dist/components/templates/TemplatesPage.d.ts +1 -6
  117. package/dist/components/templates/TemplatesPage.d.ts.map +1 -1
  118. package/dist/components/templates/TemplatesPage.js +163 -116
  119. package/dist/components/templates/TemplatesPreviewModal.d.ts +5 -12
  120. package/dist/components/templates/TemplatesPreviewModal.d.ts.map +1 -1
  121. package/dist/components/templates/TemplatesPreviewModal.js +113 -131
  122. package/dist/components/templates/index.d.ts +4 -4
  123. package/dist/components/templates/index.d.ts.map +1 -0
  124. package/dist/components/templates/index.js +5825 -4
  125. package/dist/index.d.ts +9 -29
  126. package/dist/index.d.ts.map +1 -0
  127. package/dist/index.js +6480 -28
  128. package/dist/libs/email/client.d.ts +9 -12
  129. package/dist/libs/email/client.d.ts.map +1 -1
  130. package/dist/libs/email/client.js +109 -105
  131. package/dist/libs/email/client.test.d.ts +2 -0
  132. package/dist/libs/email/client.test.d.ts.map +1 -0
  133. package/dist/libs/email/contact.d.ts +2 -6
  134. package/dist/libs/email/contact.d.ts.map +1 -1
  135. package/dist/libs/email/contact.js +155 -41
  136. package/dist/libs/email/newsletter.d.ts +2 -6
  137. package/dist/libs/email/newsletter.d.ts.map +1 -1
  138. package/dist/libs/email/newsletter.js +169 -54
  139. package/dist/libs/email/types.d.ts +48 -52
  140. package/dist/libs/email/types.d.ts.map +1 -1
  141. package/dist/libs/email/types.js +3 -1
  142. package/dist/libs/email/utils.d.ts +2 -5
  143. package/dist/libs/email/utils.d.ts.map +1 -1
  144. package/dist/libs/email/utils.js +10 -6
  145. package/dist/libs/email/waitlist-application.d.ts +2 -6
  146. package/dist/libs/email/waitlist-application.d.ts.map +1 -1
  147. package/dist/libs/email/waitlist-application.js +191 -71
  148. package/dist/libs/email/waitlist.d.ts +2 -6
  149. package/dist/libs/email/waitlist.d.ts.map +1 -1
  150. package/dist/libs/email/waitlist.js +171 -56
  151. package/dist/libs/pricing-examples.d.ts +13 -16
  152. package/dist/libs/pricing-examples.d.ts.map +1 -1
  153. package/dist/libs/pricing-examples.js +20 -20
  154. package/dist/node/components/marketing/ChangelogPage.js +87 -0
  155. package/dist/node/components/marketing/CofounderPage.js +576 -0
  156. package/dist/node/components/marketing/ContactClient.js +1374 -0
  157. package/dist/node/components/marketing/ContributePage.js +482 -0
  158. package/dist/node/components/marketing/DesignPartnerPage.js +267 -0
  159. package/dist/node/components/marketing/LandingPage.js +624 -0
  160. package/dist/node/components/marketing/PricingClient.js +1967 -0
  161. package/dist/node/components/marketing/ProductClientPage.js +558 -0
  162. package/dist/node/components/marketing/index.js +4813 -0
  163. package/dist/node/components/marketing/pricing-thinking-modal.js +253 -0
  164. package/dist/node/components/marketing/sections/AudienceSection.js +85 -0
  165. package/dist/node/components/marketing/sections/CorePositioningSection.js +67 -0
  166. package/dist/node/components/marketing/sections/CtaSection.js +62 -0
  167. package/dist/node/components/marketing/sections/DevelopersSection.js +45 -0
  168. package/dist/node/components/marketing/sections/FearsSection.js +100 -0
  169. package/dist/node/components/marketing/sections/HeroMarketingSection.js +88 -0
  170. package/dist/node/components/marketing/sections/IconGridSection.js +58 -0
  171. package/dist/node/components/marketing/sections/OutputsSection.js +111 -0
  172. package/dist/node/components/marketing/sections/ProblemSection.js +98 -0
  173. package/dist/node/components/marketing/sections/SolutionSection.js +98 -0
  174. package/dist/node/components/marketing/sections/StepsSection.js +104 -0
  175. package/dist/node/components/marketing/waitlist-section.js +1099 -0
  176. package/dist/node/components/templates/TemplatesClientPage.js +5657 -0
  177. package/dist/node/components/templates/TemplatesPage.js +172 -0
  178. package/dist/node/components/templates/TemplatesPreviewModal.js +119 -0
  179. package/dist/node/components/templates/index.js +5826 -0
  180. package/dist/node/index.js +6480 -0
  181. package/dist/node/libs/email/client.js +117 -0
  182. package/dist/node/libs/email/contact.js +185 -0
  183. package/dist/node/libs/email/newsletter.js +210 -0
  184. package/dist/node/libs/email/types.js +2 -0
  185. package/dist/node/libs/email/utils.js +11 -0
  186. package/dist/node/libs/email/waitlist-application.js +290 -0
  187. package/dist/node/libs/email/waitlist.js +220 -0
  188. package/dist/node/libs/pricing-examples.js +21 -0
  189. package/dist/node/registry/engine.js +5288 -0
  190. package/dist/node/registry/factory.js +47 -0
  191. package/dist/node/registry/index.js +5353 -0
  192. package/dist/node/registry/registry-docs.js +338 -0
  193. package/dist/node/registry/registry-landing.js +4932 -0
  194. package/dist/node/registry/registry.js +5274 -0
  195. package/dist/node/registry/types.js +0 -0
  196. package/dist/node/registry/utils.js +5335 -0
  197. package/dist/registry/engine.d.ts +4 -8
  198. package/dist/registry/engine.d.ts.map +1 -1
  199. package/dist/registry/engine.js +5287 -23
  200. package/dist/registry/factory.d.ts +30 -34
  201. package/dist/registry/factory.d.ts.map +1 -1
  202. package/dist/registry/factory.js +42 -56
  203. package/dist/registry/index.d.ts +8 -8
  204. package/dist/registry/index.d.ts.map +1 -0
  205. package/dist/registry/index.js +5353 -8
  206. package/dist/registry/registry-docs.d.ts +4 -8
  207. package/dist/registry/registry-docs.d.ts.map +1 -1
  208. package/dist/registry/registry-docs.js +242 -209
  209. package/dist/registry/registry-landing.d.ts +5 -9
  210. package/dist/registry/registry-landing.d.ts.map +1 -1
  211. package/dist/registry/registry-landing.js +4930 -93
  212. package/dist/registry/registry.d.ts +7 -11
  213. package/dist/registry/registry.d.ts.map +1 -1
  214. package/dist/registry/registry.js +5262 -49
  215. package/dist/registry/types.d.ts +6 -10
  216. package/dist/registry/types.d.ts.map +1 -1
  217. package/dist/registry/types.js +1 -0
  218. package/dist/registry/utils.d.ts +10 -14
  219. package/dist/registry/utils.d.ts.map +1 -1
  220. package/dist/registry/utils.js +5330 -49
  221. package/package.json +355 -73
  222. package/tsdown.config.js +1 -2
  223. package/.turbo/turbo-build$colon$types.log +0 -1
  224. package/.turbo/turbo-lint.log +0 -3
  225. package/dist/components/marketing/ChangelogPage.js.map +0 -1
  226. package/dist/components/marketing/CofounderPage.js.map +0 -1
  227. package/dist/components/marketing/ContactClient.js.map +0 -1
  228. package/dist/components/marketing/ContributePage.js.map +0 -1
  229. package/dist/components/marketing/DesignPartnerPage.js.map +0 -1
  230. package/dist/components/marketing/LandingPage.js.map +0 -1
  231. package/dist/components/marketing/PricingClient.js.map +0 -1
  232. package/dist/components/marketing/ProductClientPage.js.map +0 -1
  233. package/dist/components/marketing/pricing-thinking-modal.js.map +0 -1
  234. package/dist/components/marketing/sections/AudienceSection.js.map +0 -1
  235. package/dist/components/marketing/sections/CorePositioningSection.js.map +0 -1
  236. package/dist/components/marketing/sections/CtaSection.js.map +0 -1
  237. package/dist/components/marketing/sections/DevelopersSection.js.map +0 -1
  238. package/dist/components/marketing/sections/FearsSection.js.map +0 -1
  239. package/dist/components/marketing/sections/HeroMarketingSection.js.map +0 -1
  240. package/dist/components/marketing/sections/IconGridSection.js.map +0 -1
  241. package/dist/components/marketing/sections/OutputsSection.js.map +0 -1
  242. package/dist/components/marketing/sections/ProblemSection.js.map +0 -1
  243. package/dist/components/marketing/sections/SolutionSection.js.map +0 -1
  244. package/dist/components/marketing/sections/StepsSection.js.map +0 -1
  245. package/dist/components/marketing/waitlist-section.js.map +0 -1
  246. package/dist/components/templates/TemplatesClientPage.js.map +0 -1
  247. package/dist/components/templates/TemplatesPage.js.map +0 -1
  248. package/dist/components/templates/TemplatesPreviewModal.js.map +0 -1
  249. package/dist/libs/email/client.js.map +0 -1
  250. package/dist/libs/email/contact.js.map +0 -1
  251. package/dist/libs/email/newsletter.js.map +0 -1
  252. package/dist/libs/email/utils.js.map +0 -1
  253. package/dist/libs/email/waitlist-application.js.map +0 -1
  254. package/dist/libs/email/waitlist.js.map +0 -1
  255. package/dist/libs/pricing-examples.js.map +0 -1
  256. package/dist/registry/engine.js.map +0 -1
  257. package/dist/registry/factory.js.map +0 -1
  258. package/dist/registry/registry-docs.js.map +0 -1
  259. package/dist/registry/registry-landing.js.map +0 -1
  260. package/dist/registry/registry.js.map +0 -1
  261. package/dist/registry/utils.js.map +0 -1
  262. package/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,122 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ // src/libs/email/client.ts
10
+ import { createClient, Temv1alpha1 } from "@scaleway/sdk";
11
+ import { Logger } from "@contractspec/lib.logger";
12
+ var DEFAULT_FROM = {
13
+ email: "noreply@transactional.contractspec.io",
14
+ name: "ContractSpec"
15
+ };
16
+ var DEFAULT_TEAM_INBOX = {
17
+ email: "contact@contractspec.io",
18
+ name: "ContractSpec Team"
19
+ };
20
+ var DEFAULT_REGION = "fr-par";
21
+ var cachedConfig = null;
22
+ var cachedClient = null;
23
+ var apiFactory = (client) => new Temv1alpha1.API(client);
24
+ var mapRegion = (value) => {
25
+ const normalized = value?.trim().toLowerCase();
26
+ if (normalized === "par" || normalized === "fr-par")
27
+ return "fr-par";
28
+ if (normalized === "ams" || normalized === "nl-ams")
29
+ return "nl-ams";
30
+ if (normalized === "waw" || normalized === "pl-waw")
31
+ return "pl-waw";
32
+ return DEFAULT_REGION;
33
+ };
34
+ var getEmailConfig = () => {
35
+ if (cachedConfig) {
36
+ return { ok: true, config: cachedConfig };
37
+ }
38
+ const accessKey = process.env.SCALEWAY_ACCESS_KEY || process.env.SCALEWAY_ACCESS_KEY_QUEUE;
39
+ const secretKey = process.env.SCALEWAY_SECRET_KEY || process.env.SCALEWAY_SECRET_KEY_QUEUE;
40
+ const projectId = process.env.SCALEWAY_PROJECT_ID;
41
+ if (!accessKey || !secretKey || !projectId) {
42
+ return {
43
+ ok: false,
44
+ errorMessage: "Email service is not configured. Please contact us directly at contact@contractspec.io."
45
+ };
46
+ }
47
+ const region = mapRegion(process.env.SCALEWAY_REGION);
48
+ cachedConfig = {
49
+ accessKey,
50
+ secretKey,
51
+ projectId,
52
+ region,
53
+ defaultZone: `${region}-1`,
54
+ from: {
55
+ email: process.env.SCALEWAY_EMAIL_FROM_EMAIL ?? DEFAULT_FROM.email,
56
+ name: process.env.SCALEWAY_EMAIL_FROM_NAME ?? DEFAULT_FROM.name
57
+ },
58
+ teamInbox: {
59
+ email: process.env.SCALEWAY_EMAIL_TEAM_EMAIL ?? DEFAULT_TEAM_INBOX.email,
60
+ name: process.env.SCALEWAY_EMAIL_TEAM_NAME ?? DEFAULT_TEAM_INBOX.name
61
+ }
62
+ };
63
+ return { ok: true, config: cachedConfig };
64
+ };
65
+ var getTemClient = (config) => {
66
+ if (cachedClient) {
67
+ return cachedClient;
68
+ }
69
+ const client = createClient({
70
+ accessKey: config.accessKey,
71
+ secretKey: config.secretKey,
72
+ defaultProjectId: config.projectId,
73
+ defaultRegion: config.region,
74
+ defaultZone: config.defaultZone
75
+ });
76
+ cachedClient = apiFactory(client);
77
+ return cachedClient;
78
+ };
79
+ var sendEmail = async (config, request) => {
80
+ try {
81
+ const client = getTemClient(config);
82
+ await client.createEmail({
83
+ region: config.region,
84
+ projectId: config.projectId,
85
+ from: config.from,
86
+ to: request.to,
87
+ subject: request.subject,
88
+ text: request.text,
89
+ html: request.html || request.text,
90
+ additionalHeaders: request.replyTo ? [{ key: "Reply-To", value: request.replyTo }] : undefined
91
+ });
92
+ return { success: true };
93
+ } catch (error) {
94
+ new Logger().error("scaleway_tem_email_send_failed", {
95
+ context: request.context ?? "email",
96
+ error: error instanceof Error ? error.message : error
97
+ });
98
+ return {
99
+ success: false,
100
+ error,
101
+ errorMessage: "Failed to send email via Scaleway."
102
+ };
103
+ }
104
+ };
105
+ var __internal = {
106
+ resetCaches() {
107
+ cachedClient = null;
108
+ cachedConfig = null;
109
+ apiFactory = (client) => new Temv1alpha1.API(client);
110
+ },
111
+ setApiFactory(factory) {
112
+ apiFactory = factory;
113
+ },
114
+ setClient(client) {
115
+ cachedClient = client;
116
+ }
117
+ };
118
+ export {
119
+ sendEmail,
120
+ getEmailConfig,
121
+ __internal
122
+ };
@@ -0,0 +1,190 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ // src/libs/email/client.ts
10
+ import { createClient, Temv1alpha1 } from "@scaleway/sdk";
11
+ import { Logger } from "@contractspec/lib.logger";
12
+ var DEFAULT_FROM = {
13
+ email: "noreply@transactional.contractspec.io",
14
+ name: "ContractSpec"
15
+ };
16
+ var DEFAULT_TEAM_INBOX = {
17
+ email: "contact@contractspec.io",
18
+ name: "ContractSpec Team"
19
+ };
20
+ var DEFAULT_REGION = "fr-par";
21
+ var cachedConfig = null;
22
+ var cachedClient = null;
23
+ var apiFactory = (client) => new Temv1alpha1.API(client);
24
+ var mapRegion = (value) => {
25
+ const normalized = value?.trim().toLowerCase();
26
+ if (normalized === "par" || normalized === "fr-par")
27
+ return "fr-par";
28
+ if (normalized === "ams" || normalized === "nl-ams")
29
+ return "nl-ams";
30
+ if (normalized === "waw" || normalized === "pl-waw")
31
+ return "pl-waw";
32
+ return DEFAULT_REGION;
33
+ };
34
+ var getEmailConfig = () => {
35
+ if (cachedConfig) {
36
+ return { ok: true, config: cachedConfig };
37
+ }
38
+ const accessKey = process.env.SCALEWAY_ACCESS_KEY || process.env.SCALEWAY_ACCESS_KEY_QUEUE;
39
+ const secretKey = process.env.SCALEWAY_SECRET_KEY || process.env.SCALEWAY_SECRET_KEY_QUEUE;
40
+ const projectId = process.env.SCALEWAY_PROJECT_ID;
41
+ if (!accessKey || !secretKey || !projectId) {
42
+ return {
43
+ ok: false,
44
+ errorMessage: "Email service is not configured. Please contact us directly at contact@contractspec.io."
45
+ };
46
+ }
47
+ const region = mapRegion(process.env.SCALEWAY_REGION);
48
+ cachedConfig = {
49
+ accessKey,
50
+ secretKey,
51
+ projectId,
52
+ region,
53
+ defaultZone: `${region}-1`,
54
+ from: {
55
+ email: process.env.SCALEWAY_EMAIL_FROM_EMAIL ?? DEFAULT_FROM.email,
56
+ name: process.env.SCALEWAY_EMAIL_FROM_NAME ?? DEFAULT_FROM.name
57
+ },
58
+ teamInbox: {
59
+ email: process.env.SCALEWAY_EMAIL_TEAM_EMAIL ?? DEFAULT_TEAM_INBOX.email,
60
+ name: process.env.SCALEWAY_EMAIL_TEAM_NAME ?? DEFAULT_TEAM_INBOX.name
61
+ }
62
+ };
63
+ return { ok: true, config: cachedConfig };
64
+ };
65
+ var getTemClient = (config) => {
66
+ if (cachedClient) {
67
+ return cachedClient;
68
+ }
69
+ const client = createClient({
70
+ accessKey: config.accessKey,
71
+ secretKey: config.secretKey,
72
+ defaultProjectId: config.projectId,
73
+ defaultRegion: config.region,
74
+ defaultZone: config.defaultZone
75
+ });
76
+ cachedClient = apiFactory(client);
77
+ return cachedClient;
78
+ };
79
+ var sendEmail = async (config, request) => {
80
+ try {
81
+ const client = getTemClient(config);
82
+ await client.createEmail({
83
+ region: config.region,
84
+ projectId: config.projectId,
85
+ from: config.from,
86
+ to: request.to,
87
+ subject: request.subject,
88
+ text: request.text,
89
+ html: request.html || request.text,
90
+ additionalHeaders: request.replyTo ? [{ key: "Reply-To", value: request.replyTo }] : undefined
91
+ });
92
+ return { success: true };
93
+ } catch (error) {
94
+ new Logger().error("scaleway_tem_email_send_failed", {
95
+ context: request.context ?? "email",
96
+ error: error instanceof Error ? error.message : error
97
+ });
98
+ return {
99
+ success: false,
100
+ error,
101
+ errorMessage: "Failed to send email via Scaleway."
102
+ };
103
+ }
104
+ };
105
+ var __internal = {
106
+ resetCaches() {
107
+ cachedClient = null;
108
+ cachedConfig = null;
109
+ apiFactory = (client) => new Temv1alpha1.API(client);
110
+ },
111
+ setApiFactory(factory) {
112
+ apiFactory = factory;
113
+ },
114
+ setClient(client) {
115
+ cachedClient = client;
116
+ }
117
+ };
118
+
119
+ // src/libs/email/utils.ts
120
+ var escapeHtml = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
121
+ var formatMultilineHtml = (value) => escapeHtml(value).replaceAll(`
122
+ `, "<br />");
123
+
124
+ // src/libs/email/contact.ts
125
+ "use server";
126
+ var CONTACT_MISSING_CONFIG = "Email service is not configured. Please contact us directly at contact@contractspec.io.";
127
+ var CONTACT_SEND_ERROR = "Failed to send message. Please contact us directly at contact@contractspec.io.";
128
+ var submitContactForm = async (formData) => {
129
+ const name = (formData.get("name") ?? "").toString().trim();
130
+ const email = (formData.get("email") ?? "").toString().trim();
131
+ const message = (formData.get("message") ?? "").toString().trim();
132
+ if (!email) {
133
+ return {
134
+ success: false,
135
+ text: "Please fill in all required fields."
136
+ };
137
+ }
138
+ const configResult = getEmailConfig();
139
+ if (!configResult.ok || !configResult.config) {
140
+ return {
141
+ success: false,
142
+ text: configResult.errorMessage ?? CONTACT_MISSING_CONFIG
143
+ };
144
+ }
145
+ const senderName = name || email;
146
+ const emailContentText = `
147
+ New contact form submission from ${senderName}
148
+
149
+ Contact Information:
150
+ - Name: ${name || "Not provided"}
151
+ - Email: ${email}
152
+
153
+ Message:
154
+ ${message || "No message provided"}
155
+
156
+ ---
157
+ Submitted via ContractSpec contact form
158
+ `.trim();
159
+ const emailContentHtml = `
160
+ <div style="font-family: sans-serif; max-width: 640px; margin: 0 auto;">
161
+ <h1 style="color: #8b5cf6; margin-bottom: 12px;">New contact form submission</h1>
162
+ <p style="margin: 0 0 12px;">From ${escapeHtml(senderName)}</p>
163
+ <h2 style="color: #8b5cf6; margin: 16px 0 8px;">Contact Information</h2>
164
+ <ul style="padding-left: 16px; line-height: 1.6; margin: 0 0 16px;">
165
+ <li>Name: ${escapeHtml(name || "Not provided")}</li>
166
+ <li>Email: ${escapeHtml(email)}</li>
167
+ </ul>
168
+ <h2 style="color: #8b5cf6; margin: 16px 0 8px;">Message</h2>
169
+ <div style="border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; background: #f9fafb; white-space: pre-wrap; line-height: 1.6;">
170
+ ${message ? formatMultilineHtml(message) : "No message provided"}
171
+ </div>
172
+ <p style="color: #6b7280; font-size: 12px; margin-top: 20px;">Submitted via ContractSpec contact form</p>
173
+ </div>
174
+ `;
175
+ const sendResult = await sendEmail(configResult.config, {
176
+ to: [configResult.config.teamInbox],
177
+ subject: `New Contact Form Message from ${senderName}`,
178
+ text: emailContentText,
179
+ html: emailContentHtml,
180
+ replyTo: email,
181
+ context: "contact-form"
182
+ });
183
+ if (!sendResult.success) {
184
+ return { success: false, text: CONTACT_SEND_ERROR };
185
+ }
186
+ return { success: true, text: "Message sent successfully!" };
187
+ };
188
+ export {
189
+ submitContactForm
190
+ };
@@ -0,0 +1,215 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ // src/libs/email/client.ts
10
+ import { createClient, Temv1alpha1 } from "@scaleway/sdk";
11
+ import { Logger } from "@contractspec/lib.logger";
12
+ var DEFAULT_FROM = {
13
+ email: "noreply@transactional.contractspec.io",
14
+ name: "ContractSpec"
15
+ };
16
+ var DEFAULT_TEAM_INBOX = {
17
+ email: "contact@contractspec.io",
18
+ name: "ContractSpec Team"
19
+ };
20
+ var DEFAULT_REGION = "fr-par";
21
+ var cachedConfig = null;
22
+ var cachedClient = null;
23
+ var apiFactory = (client) => new Temv1alpha1.API(client);
24
+ var mapRegion = (value) => {
25
+ const normalized = value?.trim().toLowerCase();
26
+ if (normalized === "par" || normalized === "fr-par")
27
+ return "fr-par";
28
+ if (normalized === "ams" || normalized === "nl-ams")
29
+ return "nl-ams";
30
+ if (normalized === "waw" || normalized === "pl-waw")
31
+ return "pl-waw";
32
+ return DEFAULT_REGION;
33
+ };
34
+ var getEmailConfig = () => {
35
+ if (cachedConfig) {
36
+ return { ok: true, config: cachedConfig };
37
+ }
38
+ const accessKey = process.env.SCALEWAY_ACCESS_KEY || process.env.SCALEWAY_ACCESS_KEY_QUEUE;
39
+ const secretKey = process.env.SCALEWAY_SECRET_KEY || process.env.SCALEWAY_SECRET_KEY_QUEUE;
40
+ const projectId = process.env.SCALEWAY_PROJECT_ID;
41
+ if (!accessKey || !secretKey || !projectId) {
42
+ return {
43
+ ok: false,
44
+ errorMessage: "Email service is not configured. Please contact us directly at contact@contractspec.io."
45
+ };
46
+ }
47
+ const region = mapRegion(process.env.SCALEWAY_REGION);
48
+ cachedConfig = {
49
+ accessKey,
50
+ secretKey,
51
+ projectId,
52
+ region,
53
+ defaultZone: `${region}-1`,
54
+ from: {
55
+ email: process.env.SCALEWAY_EMAIL_FROM_EMAIL ?? DEFAULT_FROM.email,
56
+ name: process.env.SCALEWAY_EMAIL_FROM_NAME ?? DEFAULT_FROM.name
57
+ },
58
+ teamInbox: {
59
+ email: process.env.SCALEWAY_EMAIL_TEAM_EMAIL ?? DEFAULT_TEAM_INBOX.email,
60
+ name: process.env.SCALEWAY_EMAIL_TEAM_NAME ?? DEFAULT_TEAM_INBOX.name
61
+ }
62
+ };
63
+ return { ok: true, config: cachedConfig };
64
+ };
65
+ var getTemClient = (config) => {
66
+ if (cachedClient) {
67
+ return cachedClient;
68
+ }
69
+ const client = createClient({
70
+ accessKey: config.accessKey,
71
+ secretKey: config.secretKey,
72
+ defaultProjectId: config.projectId,
73
+ defaultRegion: config.region,
74
+ defaultZone: config.defaultZone
75
+ });
76
+ cachedClient = apiFactory(client);
77
+ return cachedClient;
78
+ };
79
+ var sendEmail = async (config, request) => {
80
+ try {
81
+ const client = getTemClient(config);
82
+ await client.createEmail({
83
+ region: config.region,
84
+ projectId: config.projectId,
85
+ from: config.from,
86
+ to: request.to,
87
+ subject: request.subject,
88
+ text: request.text,
89
+ html: request.html || request.text,
90
+ additionalHeaders: request.replyTo ? [{ key: "Reply-To", value: request.replyTo }] : undefined
91
+ });
92
+ return { success: true };
93
+ } catch (error) {
94
+ new Logger().error("scaleway_tem_email_send_failed", {
95
+ context: request.context ?? "email",
96
+ error: error instanceof Error ? error.message : error
97
+ });
98
+ return {
99
+ success: false,
100
+ error,
101
+ errorMessage: "Failed to send email via Scaleway."
102
+ };
103
+ }
104
+ };
105
+ var __internal = {
106
+ resetCaches() {
107
+ cachedClient = null;
108
+ cachedConfig = null;
109
+ apiFactory = (client) => new Temv1alpha1.API(client);
110
+ },
111
+ setApiFactory(factory) {
112
+ apiFactory = factory;
113
+ },
114
+ setClient(client) {
115
+ cachedClient = client;
116
+ }
117
+ };
118
+
119
+ // src/libs/email/utils.ts
120
+ var escapeHtml = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
121
+ var formatMultilineHtml = (value) => escapeHtml(value).replaceAll(`
122
+ `, "<br />");
123
+
124
+ // src/libs/email/newsletter.ts
125
+ "use server";
126
+ var NEWSLETTER_MISSING_CONFIG = "Newsletter service is not configured. Please try again later.";
127
+ var NEWSLETTER_SEND_ERROR = "Failed to subscribe. Please try again later or contact us directly.";
128
+ var subscribeToNewsletter = async (formData) => {
129
+ const email = (formData.get("email") ?? "").toString().trim();
130
+ if (!email || !email.includes("@")) {
131
+ return {
132
+ success: false,
133
+ text: "Please enter a valid email address."
134
+ };
135
+ }
136
+ const configResult = getEmailConfig();
137
+ if (!configResult.ok || !configResult.config) {
138
+ return {
139
+ success: false,
140
+ text: configResult.errorMessage ?? NEWSLETTER_MISSING_CONFIG
141
+ };
142
+ }
143
+ const welcomeText = `
144
+ Welcome to ContractSpec!
145
+
146
+ Thanks for subscribing to our newsletter. You'll receive updates on:
147
+
148
+ • New integrations (Stripe, OpenAI, Qdrant, and more)
149
+ • Product features and improvements
150
+ • New templates and examples
151
+ • Architecture insights and best practices
152
+ • Documentation updates
153
+
154
+ Stay tuned for exciting updates!
155
+
156
+ ---
157
+ ContractSpec Team
158
+ https://contractspec.io
159
+
160
+ Unsubscribe: Reply to this email with "unsubscribe"
161
+ `.trim();
162
+ const welcomeHtml = `
163
+ <div style="font-family: sans-serif; max-width: 640px; margin: 0 auto;">
164
+ <h1 style="color: #8b5cf6;">Welcome to ContractSpec!</h1>
165
+ <p>Thanks for subscribing to our newsletter. You'll receive updates on:</p>
166
+ <ul style="line-height: 1.8;">
167
+ <li>New integrations (Stripe, OpenAI, Qdrant, and more)</li>
168
+ <li>Product features and improvements</li>
169
+ <li>New templates and examples</li>
170
+ <li>Architecture insights and best practices</li>
171
+ <li>Documentation updates</li>
172
+ </ul>
173
+ <p>Stay tuned for exciting updates!</p>
174
+ <hr style="margin: 30px 0; border: none; border-top: 1px solid #e5e7eb;" />
175
+ <p style="color: #6b7280; font-size: 14px;">
176
+ ContractSpec Team<br />
177
+ <a href="https://contractspec.io" style="color: #8b5cf6;">contractspec.io</a>
178
+ </p>
179
+ <p style="color: #9ca3af; font-size: 12px;">
180
+ To unsubscribe, reply to this email with "unsubscribe"
181
+ </p>
182
+ </div>
183
+ `;
184
+ const userSend = await sendEmail(configResult.config, {
185
+ to: [{ email }],
186
+ subject: "Welcome to ContractSpec Newsletter",
187
+ text: welcomeText,
188
+ html: welcomeHtml,
189
+ context: "newsletter-welcome"
190
+ });
191
+ if (!userSend.success) {
192
+ return { success: false, text: NEWSLETTER_SEND_ERROR };
193
+ }
194
+ const teamNotificationText = `New newsletter subscription from: ${email}`;
195
+ const teamNotificationHtml = `
196
+ <div style="font-family: sans-serif; max-width: 640px; margin: 0 auto;">
197
+ <p style="margin: 0 0 8px;">New newsletter subscription</p>
198
+ <p style="margin: 0;"><strong>Email:</strong> ${formatMultilineHtml(email)}</p>
199
+ </div>
200
+ `;
201
+ const teamSend = await sendEmail(configResult.config, {
202
+ to: [configResult.config.teamInbox],
203
+ subject: `New Newsletter Subscription: ${email}`,
204
+ text: teamNotificationText,
205
+ html: teamNotificationHtml,
206
+ context: "newsletter-team-notification"
207
+ });
208
+ if (!teamSend.success) {
209
+ return { success: false, text: NEWSLETTER_SEND_ERROR };
210
+ }
211
+ return { success: true, text: "Successfully subscribed!" };
212
+ };
213
+ export {
214
+ subscribeToNewsletter
215
+ };
@@ -0,0 +1,2 @@
1
+ // src/libs/email/types.ts
2
+ "use server";
@@ -0,0 +1,16 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ // src/libs/email/utils.ts
10
+ var escapeHtml = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
11
+ var formatMultilineHtml = (value) => escapeHtml(value).replaceAll(`
12
+ `, "<br />");
13
+ export {
14
+ formatMultilineHtml,
15
+ escapeHtml
16
+ };