@mrfylke/contact-form 0.1.4 → 0.1.7

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 (344) hide show
  1. package/README.md +17 -0
  2. package/lib/ContactFormRoot.d.ts.map +1 -1
  3. package/lib/ContactFormRoot.js +3 -1
  4. package/lib/commoneEvents.d.ts.map +1 -1
  5. package/lib/components/button/button.d.ts.map +1 -1
  6. package/lib/components/button/button.module.css +151 -139
  7. package/lib/components/button/index.d.ts.map +1 -1
  8. package/lib/components/button/link.d.ts.map +1 -1
  9. package/lib/components/button/utils.d.ts.map +1 -1
  10. package/lib/components/checkbox/checkbox.d.ts.map +1 -1
  11. package/lib/components/checkbox/checkbox.module.css +40 -37
  12. package/lib/components/checkbox/index.d.ts.map +1 -1
  13. package/lib/components/error-message/error-message.d.ts.map +1 -1
  14. package/lib/components/error-message/error-message.module.css +2 -2
  15. package/lib/components/error-message/index.d.ts.map +1 -1
  16. package/lib/components/external-link-page.d.ts +1 -1
  17. package/lib/components/external-link-page.d.ts.map +1 -1
  18. package/lib/components/external-link-page.js +7 -6
  19. package/lib/components/external-link-page.module.css +15 -15
  20. package/lib/components/form/date-selector.d.ts +1 -1
  21. package/lib/components/form/date-selector.d.ts.map +1 -1
  22. package/lib/components/form/description-modal.d.ts.map +1 -1
  23. package/lib/components/form/field-wrapper-with-error/index.d.ts +1 -1
  24. package/lib/components/form/field-wrapper-with-error/index.d.ts.map +1 -1
  25. package/lib/components/form/fieldset/fieldset.module.css +15 -15
  26. package/lib/components/form/fieldset/index.d.ts.map +1 -1
  27. package/lib/components/form/file-input.d.ts.map +1 -1
  28. package/lib/components/form/file-input.js +1 -1
  29. package/lib/components/form/form-component-label/form-component-label.module.css +4 -4
  30. package/lib/components/form/form-component-label/index.d.ts.map +1 -1
  31. package/lib/components/form/form.module.css +324 -308
  32. package/lib/components/form/index.d.ts.map +1 -1
  33. package/lib/components/form/input.d.ts +1 -1
  34. package/lib/components/form/input.d.ts.map +1 -1
  35. package/lib/components/form/input.js +1 -1
  36. package/lib/components/form/radio.d.ts.map +1 -1
  37. package/lib/components/form/searchable-select/index.d.ts.map +1 -1
  38. package/lib/components/form/searchable-select/searchable-select.d.ts.map +1 -1
  39. package/lib/components/form/searchable-select/searchable-select.js +1 -1
  40. package/lib/components/form/searchable-select/utils.d.ts +1 -1
  41. package/lib/components/form/searchable-select/utils.d.ts.map +1 -1
  42. package/lib/components/form/select.d.ts.map +1 -1
  43. package/lib/components/form/textarea.d.ts.map +1 -1
  44. package/lib/components/form/time-selector.d.ts +1 -1
  45. package/lib/components/form/time-selector.d.ts.map +1 -1
  46. package/lib/components/icon/checkbox-icon.d.ts +1 -1
  47. package/lib/components/icon/checkbox-icon.d.ts.map +1 -1
  48. package/lib/components/icon/checkbox-icon.js +1 -1
  49. package/lib/components/icon/color-icon.d.ts.map +1 -1
  50. package/lib/components/icon/color-icon.js +0 -2
  51. package/lib/components/icon/generated-icons.d.ts +233 -233
  52. package/lib/components/icon/generated-icons.d.ts.map +1 -1
  53. package/lib/components/icon/generated-icons.js +1771 -1771
  54. package/lib/components/icon/icon-wrapper.d.ts +1 -1
  55. package/lib/components/icon/icon-wrapper.d.ts.map +1 -1
  56. package/lib/components/icon/illustration.d.ts.map +1 -1
  57. package/lib/components/icon/illustration.js +0 -2
  58. package/lib/components/icon/image.d.ts.map +1 -1
  59. package/lib/components/icon/image.js +0 -2
  60. package/lib/components/icon/mono-icon-new.d.ts +2 -2
  61. package/lib/components/icon/mono-icon-new.d.ts.map +1 -1
  62. package/lib/components/icon/mono-icon.d.ts +1 -1
  63. package/lib/components/icon/mono-icon.d.ts.map +1 -1
  64. package/lib/components/icon/mono-icon.js +1 -3
  65. package/lib/components/index.d.ts.map +1 -1
  66. package/lib/components/loading/index.d.ts +1 -1
  67. package/lib/components/loading/index.d.ts.map +1 -1
  68. package/lib/components/loading/loading.module.css +9 -9
  69. package/lib/components/section-card/index.d.ts.map +1 -1
  70. package/lib/components/section-card/section-card.d.ts.map +1 -1
  71. package/lib/components/section-card/section-card.module.css +10 -10
  72. package/lib/components/typography/index.d.ts +6 -5
  73. package/lib/components/typography/index.d.ts.map +1 -1
  74. package/lib/components/typography/index.js +0 -1
  75. package/lib/contact.module.css +37 -36
  76. package/lib/error-content/error-content.module.css +7 -7
  77. package/lib/index.d.ts +2 -2
  78. package/lib/index.d.ts.map +1 -1
  79. package/lib/journey-info/events.d.ts +6 -6
  80. package/lib/journey-info/events.d.ts.map +1 -1
  81. package/lib/journey-info/events.js +0 -1
  82. package/lib/journey-info/index.d.ts.map +1 -1
  83. package/lib/journey-info/index.js +4 -2
  84. package/lib/journey-info/journeyInfoStateMachine.d.ts.map +1 -1
  85. package/lib/layouts/contact-form-container.d.ts.map +1 -1
  86. package/lib/layouts/contact-page-layout.d.ts +2 -2
  87. package/lib/layouts/contact-page-layout.d.ts.map +1 -1
  88. package/lib/layouts/contact-page-layout.js +1 -5
  89. package/lib/layouts/container.module.css +10 -10
  90. package/lib/layouts/index.d.ts.map +1 -1
  91. package/lib/layouts/layout.module.css +46 -45
  92. package/lib/lines/use-lines.d.ts.map +1 -1
  93. package/lib/means-of-transport/events.d.ts +7 -7
  94. package/lib/means-of-transport/events.d.ts.map +1 -1
  95. package/lib/means-of-transport/events.js +0 -1
  96. package/lib/means-of-transport/forms/delayForm.d.ts.map +1 -1
  97. package/lib/means-of-transport/forms/driverForm.d.ts.map +1 -1
  98. package/lib/means-of-transport/forms/index.d.ts.map +1 -1
  99. package/lib/means-of-transport/forms/injuryForm.d.ts.map +1 -1
  100. package/lib/means-of-transport/forms/serviceOfferingForm.d.ts.map +1 -1
  101. package/lib/means-of-transport/forms/stopForm.d.ts.map +1 -1
  102. package/lib/means-of-transport/forms/transportationForm.d.ts.map +1 -1
  103. package/lib/means-of-transport/index.d.ts.map +1 -1
  104. package/lib/means-of-transport/index.js +4 -2
  105. package/lib/means-of-transport/means-of-transport-form-machine.d.ts.map +1 -1
  106. package/lib/means-of-transport/means-of-transport-form-machine.js +5 -1
  107. package/lib/modules/api-browser/index.d.ts.map +1 -1
  108. package/lib/modules/config/context.d.ts.map +1 -1
  109. package/lib/modules/config/theme-adapter.d.ts.map +1 -1
  110. package/lib/modules/config/types.d.ts +4 -34
  111. package/lib/modules/config/types.d.ts.map +1 -1
  112. package/lib/modules/graphql-types/index.d.ts.map +1 -1
  113. package/lib/modules/graphql-types/journeyplanner-types_v3.generated.d.ts.map +1 -1
  114. package/lib/modules/theme/index.d.ts.map +1 -1
  115. package/lib/modules/theme/theme-context.d.ts +1 -1
  116. package/lib/modules/theme/theme-context.d.ts.map +1 -1
  117. package/lib/modules/theme/theme-context.js +9 -6
  118. package/lib/modules/transport-mode/filter/filter.d.ts.map +1 -1
  119. package/lib/modules/transport-mode/filter/filter.module.css +51 -49
  120. package/lib/modules/transport-mode/filter/index.d.ts.map +1 -1
  121. package/lib/modules/transport-mode/filter/types.d.ts.map +1 -1
  122. package/lib/modules/transport-mode/filter/utils.d.ts.map +1 -1
  123. package/lib/modules/transport-mode/icon/icon.module.css +14 -14
  124. package/lib/modules/transport-mode/icon/index.d.ts.map +1 -1
  125. package/lib/modules/transport-mode/icon/index.js +1 -1
  126. package/lib/modules/transport-mode/index.d.ts.map +1 -1
  127. package/lib/modules/transport-mode/types.d.ts.map +1 -1
  128. package/lib/modules/transport-mode/utils.d.ts.map +1 -1
  129. package/lib/refund/events.d.ts +12 -12
  130. package/lib/refund/events.d.ts.map +1 -1
  131. package/lib/refund/events.js +0 -1
  132. package/lib/refund/forms/refund-and-travel-guarantee/index.d.ts.map +1 -1
  133. package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.d.ts.map +1 -1
  134. package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.d.ts.map +1 -1
  135. package/lib/refund/forms/refund-ticket/appTicketRefund.d.ts.map +1 -1
  136. package/lib/refund/forms/refund-ticket/index.d.ts.map +1 -1
  137. package/lib/refund/forms/refund-ticket/otherTicketRefund.d.ts.map +1 -1
  138. package/lib/refund/index.d.ts.map +1 -1
  139. package/lib/refund/index.js +4 -2
  140. package/lib/refund/refundFormMachine.d.ts.map +1 -1
  141. package/lib/refund/refundFormMachine.js +9 -3
  142. package/lib/server/index.d.ts +1 -1
  143. package/lib/server/index.d.ts.map +1 -1
  144. package/lib/server/journey-planner/authority.d.ts.map +1 -1
  145. package/lib/server/journey-planner/entur-client.d.ts.map +1 -1
  146. package/lib/server/journey-planner/index.d.ts.map +1 -1
  147. package/lib/server/journey-planner/journey-gql/lines.generated.d.ts +1 -1
  148. package/lib/server/journey-planner/journey-gql/lines.generated.d.ts.map +1 -1
  149. package/lib/server/journey-planner/journey-gql/lines.generated.js +11 -11
  150. package/lib/server/journey-planner/validators.d.ts.map +1 -1
  151. package/lib/server/types.d.ts.map +1 -1
  152. package/lib/success-content/success-content.module.css +7 -7
  153. package/lib/ticket-control/events.d.ts +6 -6
  154. package/lib/ticket-control/events.d.ts.map +1 -1
  155. package/lib/ticket-control/events.js +0 -1
  156. package/lib/ticket-control/forms/feeComplaintForm.d.ts.map +1 -1
  157. package/lib/ticket-control/forms/feedbackForm.d.ts.map +1 -1
  158. package/lib/ticket-control/forms/postponePayment.d.ts.map +1 -1
  159. package/lib/ticket-control/index.d.ts.map +1 -1
  160. package/lib/ticket-control/index.js +4 -2
  161. package/lib/ticket-control/ticket-control-form-machine.d.ts.map +1 -1
  162. package/lib/ticket-control/ticket-control-form-machine.js +7 -2
  163. package/lib/ticketing/events.d.ts +10 -10
  164. package/lib/ticketing/events.d.ts.map +1 -1
  165. package/lib/ticketing/events.js +0 -1
  166. package/lib/ticketing/forms/app/appAccountForm.d.ts.map +1 -1
  167. package/lib/ticketing/forms/app/appTicketingForm.d.ts.map +1 -1
  168. package/lib/ticketing/forms/app/appTravelSuggestionForm.d.ts.map +1 -1
  169. package/lib/ticketing/forms/app/index.d.ts.map +1 -1
  170. package/lib/ticketing/forms/app/index.js +1 -1
  171. package/lib/ticketing/forms/priceAndTicketTypesForm.d.ts.map +1 -1
  172. package/lib/ticketing/forms/travel-card/index.d.ts.map +1 -1
  173. package/lib/ticketing/forms/travel-card/index.js +1 -1
  174. package/lib/ticketing/forms/travel-card/orderTravelCard.d.ts.map +1 -1
  175. package/lib/ticketing/forms/travel-card/travelCardQuestionForm.d.ts.map +1 -1
  176. package/lib/ticketing/forms/webshop/index.d.ts.map +1 -1
  177. package/lib/ticketing/forms/webshop/index.js +1 -1
  178. package/lib/ticketing/forms/webshop/webshopAccountForm.d.ts.map +1 -1
  179. package/lib/ticketing/forms/webshop/webshopTicketingForm.d.ts.map +1 -1
  180. package/lib/ticketing/index.d.ts.map +1 -1
  181. package/lib/ticketing/index.js +4 -2
  182. package/lib/ticketing/ticketingStateMachine.d.ts.map +1 -1
  183. package/lib/ticketing/ticketingStateMachine.js +2 -1
  184. package/lib/translations/common/index.d.ts.map +1 -1
  185. package/lib/translations/common/layout.d.ts.map +1 -1
  186. package/lib/translations/commons.d.ts.map +1 -1
  187. package/lib/translations/components/index.d.ts.map +1 -1
  188. package/lib/translations/components/map.d.ts.map +1 -1
  189. package/lib/translations/components/search.d.ts.map +1 -1
  190. package/lib/translations/components/transport-mode.d.ts.map +1 -1
  191. package/lib/translations/dictionary.d.ts.map +1 -1
  192. package/lib/translations/index.d.ts +2 -2
  193. package/lib/translations/index.d.ts.map +1 -1
  194. package/lib/translations/json-to-override.d.ts.map +1 -1
  195. package/lib/translations/json-to-override.js +15 -5
  196. package/lib/translations/language-context.d.ts.map +1 -1
  197. package/lib/translations/language-context.js +5 -9
  198. package/lib/translations/load-org-translations.d.ts.map +1 -1
  199. package/lib/translations/merge-overrides.d.ts.map +1 -1
  200. package/lib/translations/merge-overrides.js +3 -1
  201. package/lib/translations/modules/index.d.ts +0 -1
  202. package/lib/translations/modules/index.d.ts.map +1 -1
  203. package/lib/translations/modules/index.js +1 -3
  204. package/lib/translations/modules/situation.d.ts.map +1 -1
  205. package/lib/translations/pages/contact.d.ts +1 -1
  206. package/lib/translations/pages/contact.d.ts.map +1 -1
  207. package/lib/translations/pages/departures.d.ts.map +1 -1
  208. package/lib/translations/pages/index.d.ts.map +1 -1
  209. package/lib/translations/server/endpoints.d.ts.map +1 -1
  210. package/lib/translations/server/index.d.ts.map +1 -1
  211. package/lib/translations/translations-context.d.ts.map +1 -1
  212. package/lib/translations/types.d.ts.map +1 -1
  213. package/lib/translations/utils.d.ts.map +1 -1
  214. package/lib/translations/utils.js +3 -1
  215. package/lib/types/submit-payloads.d.ts.map +1 -1
  216. package/lib/types.d.ts +1 -1
  217. package/lib/types.d.ts.map +1 -1
  218. package/lib/utils/color.js +1 -1
  219. package/lib/utils/date.d.ts.map +1 -1
  220. package/lib/utils/date.js +1 -1
  221. package/lib/utils/env.d.ts.map +1 -1
  222. package/lib/utils/presence.d.ts.map +1 -1
  223. package/lib/utils.d.ts +1 -1
  224. package/lib/utils.d.ts.map +1 -1
  225. package/lib/validation/commonInputValidator.d.ts.map +1 -1
  226. package/lib/validation/index.d.ts.map +1 -1
  227. package/lib/validation/validationRules.d.ts.map +1 -1
  228. package/package.json +2 -3
  229. package/lib/layouts/contact-form-footer.d.ts +0 -5
  230. package/lib/layouts/contact-form-footer.d.ts.map +0 -1
  231. package/lib/layouts/contact-form-footer.js +0 -59
  232. package/lib/layouts/contact-form-header.d.ts +0 -9
  233. package/lib/layouts/contact-form-header.d.ts.map +0 -1
  234. package/lib/layouts/contact-form-header.js +0 -45
  235. package/lib/layouts/footer.module.css +0 -109
  236. package/lib/layouts/header.module.css +0 -39
  237. package/lib/modules/api-server/external-client.d.ts +0 -22
  238. package/lib/modules/api-server/external-client.d.ts.map +0 -1
  239. package/lib/modules/api-server/external-client.js +0 -86
  240. package/lib/modules/api-server/index.d.ts +0 -9
  241. package/lib/modules/api-server/index.d.ts.map +0 -1
  242. package/lib/modules/api-server/index.js +0 -24
  243. package/lib/modules/api-server/requesters/graphql-requester.d.ts +0 -6
  244. package/lib/modules/api-server/requesters/graphql-requester.d.ts.map +0 -1
  245. package/lib/modules/api-server/requesters/graphql-requester.js +0 -63
  246. package/lib/modules/api-server/requesters/http-requester.d.ts +0 -3
  247. package/lib/modules/api-server/requesters/http-requester.d.ts.map +0 -1
  248. package/lib/modules/api-server/requesters/http-requester.js +0 -110
  249. package/lib/modules/api-server/requesters/types.d.ts +0 -37
  250. package/lib/modules/api-server/requesters/types.d.ts.map +0 -1
  251. package/lib/modules/api-server/requesters/types.js +0 -34
  252. package/lib/modules/api-server/requesters/utils.d.ts +0 -17
  253. package/lib/modules/api-server/requesters/utils.d.ts.map +0 -1
  254. package/lib/modules/api-server/requesters/utils.js +0 -75
  255. package/lib/modules/cookies/constants.d.ts +0 -4
  256. package/lib/modules/cookies/constants.d.ts.map +0 -1
  257. package/lib/modules/cookies/constants.js +0 -6
  258. package/lib/modules/cookies/cookies-context.d.ts +0 -17
  259. package/lib/modules/cookies/cookies-context.d.ts.map +0 -1
  260. package/lib/modules/cookies/cookies-context.js +0 -61
  261. package/lib/modules/cookies/index.d.ts +0 -15
  262. package/lib/modules/cookies/index.d.ts.map +0 -1
  263. package/lib/modules/cookies/index.js +0 -22
  264. package/lib/modules/firebase/analytics.d.ts +0 -3
  265. package/lib/modules/firebase/analytics.d.ts.map +0 -1
  266. package/lib/modules/firebase/analytics.js +0 -40
  267. package/lib/modules/firebase/firebase.d.ts +0 -4
  268. package/lib/modules/firebase/firebase.d.ts.map +0 -1
  269. package/lib/modules/firebase/firebase.js +0 -19
  270. package/lib/modules/firebase/index.d.ts +0 -5
  271. package/lib/modules/firebase/index.d.ts.map +0 -1
  272. package/lib/modules/firebase/index.js +0 -25
  273. package/lib/modules/firebase/preassigned-fare-products.d.ts +0 -8
  274. package/lib/modules/firebase/preassigned-fare-products.d.ts.map +0 -1
  275. package/lib/modules/firebase/preassigned-fare-products.js +0 -35
  276. package/lib/modules/firebase/tariff-zones.d.ts +0 -17
  277. package/lib/modules/firebase/tariff-zones.d.ts.map +0 -1
  278. package/lib/modules/firebase/tariff-zones.js +0 -32
  279. package/lib/modules/firebase/transport-mode-filter.d.ts +0 -27
  280. package/lib/modules/firebase/transport-mode-filter.d.ts.map +0 -1
  281. package/lib/modules/firebase/transport-mode-filter.js +0 -27
  282. package/lib/modules/firebase/types.d.ts +0 -19
  283. package/lib/modules/firebase/types.d.ts.map +0 -1
  284. package/lib/modules/firebase/types.js +0 -15
  285. package/lib/modules/logging/index.d.ts +0 -6
  286. package/lib/modules/logging/index.d.ts.map +0 -1
  287. package/lib/modules/logging/index.js +0 -13
  288. package/lib/modules/logging/log-api-response.d.ts +0 -15
  289. package/lib/modules/logging/log-api-response.d.ts.map +0 -1
  290. package/lib/modules/logging/log-api-response.js +0 -52
  291. package/lib/modules/logging/log-page-access.d.ts +0 -20
  292. package/lib/modules/logging/log-page-access.d.ts.map +0 -1
  293. package/lib/modules/logging/log-page-access.js +0 -60
  294. package/lib/modules/logging/logger.d.ts +0 -3
  295. package/lib/modules/logging/logger.d.ts.map +0 -1
  296. package/lib/modules/logging/logger.js +0 -32
  297. package/lib/modules/logging/timer.d.ts +0 -6
  298. package/lib/modules/logging/timer.d.ts.map +0 -1
  299. package/lib/modules/logging/timer.js +0 -13
  300. package/lib/modules/logging/with-access-logging.d.ts +0 -5
  301. package/lib/modules/logging/with-access-logging.d.ts.map +0 -1
  302. package/lib/modules/logging/with-access-logging.js +0 -20
  303. package/lib/modules/transport-mode/icon/transport-icon-new.d.ts +0 -28
  304. package/lib/modules/transport-mode/icon/transport-icon-new.d.ts.map +0 -1
  305. package/lib/modules/transport-mode/icon/transport-icon-new.js +0 -114
  306. package/lib/server/contact/index.d.ts +0 -11
  307. package/lib/server/contact/index.d.ts.map +0 -1
  308. package/lib/server/contact/index.js +0 -47
  309. package/lib/translations/__tests__/utils.test.d.ts +0 -2
  310. package/lib/translations/__tests__/utils.test.d.ts.map +0 -1
  311. package/lib/translations/__tests__/utils.test.js +0 -35
  312. package/lib/translations/modules/layout.d.ts +0 -73
  313. package/lib/translations/modules/layout.d.ts.map +0 -1
  314. package/lib/translations/modules/layout.js +0 -106
  315. package/lib/translations/pages/assistant.d.ts +0 -2
  316. package/lib/translations/pages/assistant.d.ts.map +0 -1
  317. package/lib/translations/pages/assistant.js +0 -303
  318. package/lib/utils/enum-from-string.d.ts +0 -4
  319. package/lib/utils/enum-from-string.d.ts.map +0 -1
  320. package/lib/utils/enum-from-string.js +0 -9
  321. package/lib/utils/only-uniques.d.ts +0 -3
  322. package/lib/utils/only-uniques.d.ts.map +0 -1
  323. package/lib/utils/only-uniques.js +0 -7
  324. package/lib/utils/org-theme-definitions.d.ts +0 -5
  325. package/lib/utils/org-theme-definitions.d.ts.map +0 -1
  326. package/lib/utils/org-theme-definitions.js +0 -13
  327. package/lib/utils/reference-data.d.ts +0 -15
  328. package/lib/utils/reference-data.d.ts.map +0 -1
  329. package/lib/utils/reference-data.js +0 -15
  330. package/lib/utils/use-client-width.d.ts +0 -2
  331. package/lib/utils/use-client-width.d.ts.map +0 -1
  332. package/lib/utils/use-client-width.js +0 -18
  333. package/lib/utils/use-interval.d.ts +0 -2
  334. package/lib/utils/use-interval.d.ts.map +0 -1
  335. package/lib/utils/use-interval.js +0 -22
  336. package/lib/utils/use-localstorage.d.ts +0 -2
  337. package/lib/utils/use-localstorage.d.ts.map +0 -1
  338. package/lib/utils/use-localstorage.js +0 -40
  339. package/lib/utils/use-now.d.ts +0 -2
  340. package/lib/utils/use-now.d.ts.map +0 -1
  341. package/lib/utils/use-now.js +0 -13
  342. package/lib/utils/user-media-query.d.ts +0 -2
  343. package/lib/utils/user-media-query.d.ts.map +0 -1
  344. package/lib/utils/user-media-query.js +0 -36
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ContactFormFooter = ContactFormFooter;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = __importDefault(require("react"));
9
- const translations_1 = require("../translations");
10
- const language_context_1 = require("../translations/language-context");
11
- const theme_1 = require("../modules/theme");
12
- const config_1 = require("../modules/config");
13
- const footer_module_css_1 = __importDefault(require("./footer.module.css"));
14
- function getAccentColor(theme) {
15
- const accent = theme?.color?.background?.accent;
16
- const accent4 = accent?.[4];
17
- if (accent4?.foreground?.primary)
18
- return accent4.foreground.primary;
19
- const neutral = theme?.color?.background?.neutral;
20
- return neutral?.[0]?.foreground?.primary ?? 'inherit';
21
- }
22
- function ContactFormFooter({ withoutSettings = false }) {
23
- const { t, language } = (0, translations_1.useTranslation)();
24
- const { isDarkMode, toggleDarkmode, theme, isThemeForced } = (0, theme_1.useTheme)();
25
- const { org, layout } = (0, config_1.useContactFormConfig)();
26
- const { setLanguage } = (0, language_context_1.useLanguageSettings)();
27
- const footerUrls = layout?.footerUrls;
28
- const footerLinksOverride = layout?.footerLinksOverride;
29
- const buttonStyle = { color: getAccentColor(theme), borderColor: getAccentColor(theme) };
30
- const basePath = layout?.basePath ?? '/contact';
31
- const supportHref = footerUrls?.help ?? basePath;
32
- // Group override links by section if section is provided
33
- const groupedOverrideLinks = footerLinksOverride ? footerLinksOverride.reduce((acc, link) => {
34
- const section = link.section || 'default';
35
- if (!acc[section])
36
- acc[section] = [];
37
- acc[section].push(link);
38
- return acc;
39
- }, {}) : null;
40
- return ((0, jsx_runtime_1.jsx)("footer", { className: footer_module_css_1.default.footer, children: (0, jsx_runtime_1.jsxs)("div", { className: footer_module_css_1.default.footer__content, children: [(0, jsx_runtime_1.jsxs)("div", { className: footer_module_css_1.default.footer__top, children: [footerLinksOverride ? (
41
- // Render override links, grouped by section
42
- Object.entries(groupedOverrideLinks).map(([sectionKey, links]) => ((0, jsx_runtime_1.jsxs)("section", { className: footer_module_css_1.default.footer__section, children: [sectionKey !== 'default' && ((0, jsx_runtime_1.jsx)("h3", { className: footer_module_css_1.default.footer__title, children: sectionKey })), (0, jsx_runtime_1.jsx)("ul", { className: footer_module_css_1.default.footer__linkList, children: links.map((link, index) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("a", { href: link.href, target: "_blank", rel: "noreferrer", children: t(link.label) }) }, index))) })] }, sectionKey)))) : (
43
- // Standard behavior: fixed sections
44
- (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("section", { className: footer_module_css_1.default.footer__section, children: [(0, jsx_runtime_1.jsx)("h3", { className: footer_module_css_1.default.footer__title, children: t(translations_1.ModuleText.Layout.base.footer.sections.general.header) }), (0, jsx_runtime_1.jsx)("ul", { className: footer_module_css_1.default.footer__linkList, children: footerUrls?.tickets && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("a", { href: footerUrls.tickets, target: "_blank", rel: "noreferrer", children: t(translations_1.ModuleText.Layout.base.footer.sections.general.ticketPricesPageLink) }) })) })] }), (0, jsx_runtime_1.jsxs)("section", { className: footer_module_css_1.default.footer__section, children: [(0, jsx_runtime_1.jsx)("h3", { className: footer_module_css_1.default.footer__title, children: t(translations_1.ModuleText.Layout.base.footer.sections.contact.header) }), (0, jsx_runtime_1.jsx)("ul", { className: footer_module_css_1.default.footer__linkList, children: (0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("a", { href: supportHref, children: t(translations_1.ModuleText.Layout.base.footer.sections.general.supportPageLink) }) }) })] })] })), !withoutSettings && ((0, jsx_runtime_1.jsxs)("section", { className: footer_module_css_1.default.footer__section, children: [(0, jsx_runtime_1.jsx)("h3", { className: footer_module_css_1.default.footer__title, children: t(!isThemeForced
45
- ? translations_1.ModuleText.Layout.base.footer.sections.settings.header
46
- : translations_1.ModuleText.Layout.base.footer.sections.settings.forcedThemeHeader) }), (0, jsx_runtime_1.jsxs)("ul", { className: footer_module_css_1.default.footer__linkList, children: [language !== translations_1.Language.Norwegian && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { className: footer_module_css_1.default.buttonLink, onClick: () => setLanguage(translations_1.Language.Norwegian), style: buttonStyle, children: t(translations_1.ModuleText.Layout.base.footer.sections.settings.setLanguage.norsk) }) })), language !== translations_1.Language.English && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { className: footer_module_css_1.default.buttonLink, onClick: () => setLanguage(translations_1.Language.English), style: buttonStyle, children: t(translations_1.ModuleText.Layout.base.footer.sections.settings.setLanguage.english) }) })), language !== translations_1.Language.Nynorsk && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { className: footer_module_css_1.default.buttonLink, onClick: () => setLanguage(translations_1.Language.Nynorsk), style: buttonStyle, children: t(translations_1.ModuleText.Layout.base.footer.sections.settings.setLanguage.nynorsk) }) })), !isThemeForced && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { className: footer_module_css_1.default.buttonLink, style: buttonStyle, onClick: () => toggleDarkmode(!isDarkMode), children: isDarkMode
47
- ? t(translations_1.ModuleText.Layout.base.footer.sections.settings.toggleLightMode)
48
- : t(translations_1.ModuleText.Layout.base.footer.sections.settings.toggleDarkMode) }) }))] }), (0, jsx_runtime_1.jsx)("p", { className: footer_module_css_1.default.footer__cookieWarning, children: t(!isThemeForced
49
- ? translations_1.ModuleText.Layout.base.footer.sections.settings.cookiesWarning
50
- : translations_1.ModuleText.Layout.base.footer.sections.settings.languageCookiesWarning) })] }))] }), (0, jsx_runtime_1.jsx)("hr", {}), (0, jsx_runtime_1.jsxs)("section", { className: footer_module_css_1.default.footer__bottomLinks, children: [footerLinksOverride ? (
51
- // When override is set, bottom links come from override (filter by section if needed)
52
- // For now, render all override links that don't have a section or have section='bottom'
53
- (() => {
54
- const bottomLinks = footerLinksOverride.filter(link => !link.section || link.section === 'bottom');
55
- return bottomLinks.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: footer_module_css_1.default.footer__bottomLinks__mid, children: bottomLinks.map((link, index) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [index > 0 && (0, jsx_runtime_1.jsx)("span", { "aria-hidden": "true", children: "\u2022" }), (0, jsx_runtime_1.jsx)("a", { href: link.href, target: "_blank", rel: "noreferrer", children: t(link.label) })] }, index))) }));
56
- })()) : (
57
- // Standard behavior: privacy and accessibility from footerUrls
58
- (footerUrls?.privacy || footerUrls?.accessibility) && ((0, jsx_runtime_1.jsxs)("div", { className: footer_module_css_1.default.footer__bottomLinks__mid, children: [footerUrls?.privacy && ((0, jsx_runtime_1.jsx)("a", { href: footerUrls.privacy, target: "_blank", rel: "noreferrer", children: t(translations_1.ModuleText.Layout.base.footer.bottomLinks.privacy) })), footerUrls?.privacy && footerUrls?.accessibility && ((0, jsx_runtime_1.jsx)("span", { "aria-hidden": "true", children: "\u2022" })), footerUrls?.accessibility && ((0, jsx_runtime_1.jsx)("a", { href: footerUrls.accessibility, target: "_blank", rel: "noreferrer", children: t(translations_1.ModuleText.Layout.base.footer.bottomLinks.accessibilityStatement) }))] }))), org.logo && ((0, jsx_runtime_1.jsx)("img", { className: footer_module_css_1.default.footer__orgLogo, src: org.logo.accentBar ?? org.logo.srcDark ?? org.logo.src, alt: org.logo.alt }))] })] }) }));
59
- }
@@ -1,9 +0,0 @@
1
- export type ContactFormHeaderProps = {
2
- /** Override home page URL for the "Go to X" button. Uses layout.footerUrls.homePage when not set. */
3
- homeUrl?: {
4
- href: string;
5
- name: string;
6
- };
7
- };
8
- export declare function ContactFormHeader({ homeUrl }: ContactFormHeaderProps): import("react/jsx-runtime").JSX.Element;
9
- //# sourceMappingURL=contact-form-header.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contact-form-header.d.ts","sourceRoot":"","sources":["../../src/layouts/contact-form-header.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,sBAAsB,GAAG;IACjC,qGAAqG;IACrG,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC;AAoBF,wBAAgB,iBAAiB,CAAC,EAAE,OAAO,EAAE,EAAE,sBAAsB,2CA6DpE"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ContactFormHeader = ContactFormHeader;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const link_1 = __importDefault(require("next/link"));
9
- const translations_1 = require("../translations");
10
- const config_1 = require("../modules/config");
11
- const theme_1 = require("../modules/theme");
12
- const button_1 = require("../components/button");
13
- const translations_2 = require("../translations");
14
- const header_module_css_1 = __importDefault(require("./header.module.css"));
15
- function getAccentContrastColor(theme) {
16
- const accent = theme?.color?.background?.accent;
17
- const accent4 = accent?.[4];
18
- if (accent4 && typeof accent4 === 'object' && 'foreground' in accent4) {
19
- const fg = accent4.foreground?.primary;
20
- if (fg) {
21
- return {
22
- background: accent4.background ?? 'transparent',
23
- foreground: { primary: fg, secondary: fg, disabled: fg },
24
- };
25
- }
26
- }
27
- return {
28
- background: 'transparent',
29
- foreground: { primary: 'currentColor', secondary: 'currentColor', disabled: 'currentColor' },
30
- };
31
- }
32
- function ContactFormHeader({ homeUrl }) {
33
- const { t } = (0, translations_1.useTranslation)();
34
- const { org, layout } = (0, config_1.useContactFormConfig)();
35
- const { theme } = (0, theme_1.useTheme)();
36
- const accentColor = getAccentContrastColor(theme);
37
- // Use override links if provided, otherwise fall back to standard behavior
38
- const headerLinks = layout?.headerLinksOverride;
39
- const standardHome = homeUrl ?? layout?.footerUrls?.homePage;
40
- return ((0, jsx_runtime_1.jsx)("header", { className: header_module_css_1.default.pageHeader, children: (0, jsx_runtime_1.jsxs)("div", { className: header_module_css_1.default.pageHeader__content, children: [(0, jsx_runtime_1.jsx)("h1", { className: header_module_css_1.default.pageHeader__logo, children: (0, jsx_runtime_1.jsx)(link_1.default, { href: layout?.basePath ?? '/contact', className: header_module_css_1.default.pageHeader__logoLink, "data-testid": "homeButton", children: org.logo ? ((0, jsx_runtime_1.jsx)("img", { className: header_module_css_1.default.pageHeader__logoImg, src: org.logo.accentBar ?? org.logo.srcDark ?? org.logo.src, alt: org.logo.alt })) : ((0, jsx_runtime_1.jsx)("span", { children: org.name })) }) }), headerLinks ? (
41
- // Render override links
42
- headerLinks.map((link, index) => ((0, jsx_runtime_1.jsx)(button_1.ButtonLink, { href: link.href, title: t(link.label), mode: "secondary", backgroundColor: accentColor, radiusSize: "circular", size: "pill", aProps: { target: '_blank', rel: 'noreferrer' } }, index)))) : (
43
- // Standard behavior: single optional home link
44
- standardHome && ((0, jsx_runtime_1.jsx)(button_1.ButtonLink, { href: standardHome.href, title: t(translations_2.CommonText.Layout.homeLink(standardHome.name)), mode: "secondary", backgroundColor: accentColor, radiusSize: "circular", size: "pill", aProps: { target: '_blank', rel: 'noreferrer' } })))] }) }));
45
- }
@@ -1,109 +0,0 @@
1
- .footer {
2
- background-color: token('color.background.accent.4.background');
3
- color: token('color.background.accent.4.foreground.primary');
4
- }
5
-
6
- .footer__content {
7
- margin: 0 auto;
8
- padding: token('spacing.large');
9
- max-width: var(--maxPageWidth, 976px);
10
- box-sizing: border-box;
11
- }
12
-
13
- .footer__top {
14
- display: grid;
15
- gap: token('spacing.xLarge');
16
- grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
17
- }
18
-
19
- .footer__content hr {
20
- border: 0;
21
- border-bottom: token('border.width.slim') solid token('color.background.accent.4.foreground.primary');
22
- margin: token('spacing.xLarge') 0;
23
- }
24
-
25
- .footer__title {
26
- margin-bottom: token('spacing.small');
27
- font-size: 1rem;
28
- font-weight: 600;
29
- }
30
-
31
- .footer__section {
32
- padding: token('spacing.medium') 0;
33
- }
34
-
35
- .footer__linkList {
36
- list-style-type: none;
37
- margin: 0;
38
- padding: 0;
39
- }
40
-
41
- .footer__linkList li {
42
- margin-bottom: token('spacing.small');
43
- }
44
-
45
- .footer a {
46
- text-decoration: none;
47
- }
48
-
49
- .footer a,
50
- .footer a:visited {
51
- transition: opacity 100ms ease-in;
52
- color: token('color.background.accent.4.foreground.primary');
53
- }
54
-
55
- .footer a:hover {
56
- opacity: 0.75;
57
- }
58
-
59
- .footer__bottomLinks {
60
- width: 100%;
61
- display: flex;
62
- justify-content: space-between;
63
- align-items: center;
64
- gap: token('spacing.medium');
65
- flex-wrap: wrap;
66
- }
67
-
68
- .footer__bottomLinks > div:only-child {
69
- margin: 0 auto;
70
- }
71
-
72
- .footer__bottomLinks__mid {
73
- text-align: center;
74
- display: flex;
75
- gap: token('spacing.medium');
76
- }
77
-
78
- .footer__cookieWarning {
79
- margin-top: token('spacing.medium');
80
- font-size: 0.875rem;
81
- color: token('color.background.accent.4.foreground.primary');
82
- }
83
-
84
- .buttonLink {
85
- color: token('color.background.accent.4.foreground.primary');
86
- font-size: 1rem;
87
- background-color: transparent;
88
- border: 0;
89
- cursor: pointer;
90
- transition: opacity 100ms ease-in;
91
- }
92
-
93
- .buttonLink:hover {
94
- opacity: 0.75;
95
- }
96
-
97
- .footer__orgLogo {
98
- height: 2.5rem;
99
- width: auto;
100
- }
101
-
102
- @media (max-width: 650px) {
103
- .footer__bottomLinks {
104
- justify-content: center;
105
- align-items: center;
106
- flex-direction: column;
107
- gap: token('spacing.xLarge');
108
- }
109
- }
@@ -1,39 +0,0 @@
1
- .pageHeader {
2
- background-color: token('color.background.accent.4.background');
3
- }
4
-
5
- .pageHeader__content {
6
- width: 100%;
7
- max-width: var(--maxPageWidth, 976px);
8
- margin: 0 auto;
9
- padding: token('spacing.medium');
10
- display: flex;
11
- align-items: center;
12
- justify-content: space-between;
13
- box-sizing: border-box;
14
- }
15
-
16
- .pageHeader__logo {
17
- margin: 0;
18
- }
19
-
20
- .pageHeader__logoLink {
21
- display: flex;
22
- align-items: center;
23
- gap: token('spacing.medium');
24
- padding: token('spacing.medium');
25
- padding-left: 0;
26
- color: token('color.background.accent.4.foreground.primary');
27
- text-decoration: none;
28
- transition: opacity 200ms ease-in-out;
29
- }
30
-
31
- .pageHeader__logoLink:hover,
32
- .pageHeader__logoLink:active {
33
- opacity: 0.8;
34
- }
35
-
36
- .pageHeader__logoImg {
37
- height: 2rem;
38
- width: auto;
39
- }
@@ -1,22 +0,0 @@
1
- import type { IncomingMessage } from 'http';
2
- import type { GetServerSidePropsContext, GetServerSidePropsResult, NextApiRequest, NextApiResponse } from 'next';
3
- import { type AllEndpoints, type ConditionalRequester } from './requesters/types';
4
- import { ParsedUrlQuery } from 'node:querystring';
5
- type HttpPropGetter<U extends AllEndpoints, T, P extends {} = {}, Params extends ParsedUrlQuery = ParsedUrlQuery> = (context: GetServerSidePropsContext<Params> & {
6
- client: ExternalClient<U, T>;
7
- }) => Promise<GetServerSidePropsResult<P>>;
8
- export type ExternalClient<U extends AllEndpoints, T> = T & {
9
- client: ConditionalRequester<U>;
10
- };
11
- export type ExternalClientFactory<U extends AllEndpoints, T> = (req?: IncomingMessage) => ExternalClient<U, T>;
12
- export declare function createExternalClient<U extends AllEndpoints, T>(baseUrlType: U, apiFn: (request: ConditionalRequester<U>) => T): ExternalClientFactory<U, T>;
13
- export declare function createWithExternalClientDecorator<U extends AllEndpoints, T>(clientCreate: ExternalClientFactory<U, T>): <P extends {} = {}, Params extends ParsedUrlQuery = ParsedUrlQuery>(propGetter: HttpPropGetter<U, T, P, Params>) => (ctx: GetServerSidePropsContext<Params>) => Promise<GetServerSidePropsResult<P>>;
14
- export type NextApiClientHandler<U extends AllEndpoints, T, P = any> = (req: NextApiRequest, res: NextApiResponse<P>, extra: {
15
- client: ExternalClient<U, T>;
16
- ok: (a: P) => void;
17
- }) => unknown | Promise<unknown>;
18
- type EndpointMapping<U extends AllEndpoints, T, P = any> = Partial<Record<'GET' | 'POST' | 'DELETE' | 'PUT', NextApiClientHandler<U, T, P>>>;
19
- type ApiHandler<U extends AllEndpoints, T, P = any> = NextApiClientHandler<U, T, P> | EndpointMapping<U, T, P>;
20
- export declare function createWithExternalClientDecoratorForHttpHandlers<U extends AllEndpoints, T>(createClient: ExternalClientFactory<U, T>): <P>(handler: ApiHandler<U, T, P>, corsOrigin?: (string | RegExp)[]) => (req: NextApiRequest, res: NextApiResponse<P>) => Promise<unknown>;
21
- export {};
22
- //# sourceMappingURL=external-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"external-client.d.ts","sourceRoot":"","sources":["../../../src/modules/api-server/external-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAC,yBAAyB,EAAE,wBAAwB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAGhH,OAAO,EAAC,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAqB,MAAM,oBAAoB,CAAC;AAEpG,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAGhD,KAAK,cAAc,CACf,CAAC,SAAS,YAAY,EACtB,CAAC,EACD,CAAC,SAAS,EAAE,GAAG,EAAE,EACjB,MAAM,SAAS,cAAc,GAAG,cAAc,IAC9C,CACA,OAAO,EAAE,yBAAyB,CAAC,MAAM,CAAC,GAAG;IAAE,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;CAAE,KAC5E,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE1C,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,IAAI,CAAC,GAAG;IACxD,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,IAAI,CAC3D,GAAG,CAAC,EAAE,eAAe,KACpB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE1B,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,EAC1D,WAAW,EAAE,CAAC,EACd,KAAK,EAAE,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,GAC/C,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAkB7B;AAED,wBAAgB,iCAAiC,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,EACvE,YAAY,EAAE,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,IAGrC,CAAC,SAAS,EAAE,GAAG,EAAE,EACjB,MAAM,SAAS,cAAc,GAAG,cAAc,EAChD,YAAY,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,MAErC,KAAK,yBAAyB,CAAC,MAAM,CAAC,KACvC,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAO9C;AAED,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,EAAE,CAAC,GAAG,GAAG,IAAI,CACnE,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC,EACvB,KAAK,EAAE;IACH,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7B,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;CACtB,KACA,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhC,KAAK,eAAe,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,EAAE,CAAC,GAAG,GAAG,IAAI,OAAO,CAC9D,MAAM,CAAC,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAC3E,CAAC;AAEF,KAAK,UAAU,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,EAAE,CAAC,GAAG,GAAG,IAC5C,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC7B,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,wBAAgB,gDAAgD,CAC5D,CAAC,SAAS,YAAY,EACtB,CAAC,EACH,YAAY,EAAE,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,IAChB,CAAC,EACpB,SAAS,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC5B,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,MAElB,KAAK,cAAc,EAAE,KAAK,eAAe,CAAC,CAAC,CAAC,sBAiCjE"}
@@ -1,86 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createExternalClient = createExternalClient;
7
- exports.createWithExternalClientDecorator = createWithExternalClientDecorator;
8
- exports.createWithExternalClientDecoratorForHttpHandlers = createWithExternalClientDecoratorForHttpHandlers;
9
- const translations_1 = require("../..//translations");
10
- const http2_1 = require("http2");
11
- const graphql_requester_1 = require("./requesters/graphql-requester");
12
- const http_requester_1 = require("./requesters/http-requester");
13
- const types_1 = require("./requesters/types");
14
- const utils_1 = require("./requesters/utils");
15
- const cors_1 = __importDefault(require("cors"));
16
- function createExternalClient(baseUrlType, apiFn) {
17
- return function (req) {
18
- if ((0, types_1.isGraphQlEndpoint)(baseUrlType)) {
19
- let client = (0, graphql_requester_1.createGraphQlRequester)(baseUrlType, req);
20
- return {
21
- ...apiFn(client),
22
- client: client,
23
- };
24
- }
25
- else {
26
- let client = (0, http_requester_1.createRequester)(baseUrlType, req);
27
- return {
28
- ...apiFn(client),
29
- client: client,
30
- };
31
- }
32
- };
33
- }
34
- function createWithExternalClientDecorator(clientCreate) {
35
- return function handler(propGetter) {
36
- return async function inside(ctx) {
37
- return propGetter({
38
- client: clientCreate(ctx.req),
39
- ...ctx,
40
- });
41
- };
42
- };
43
- }
44
- function createWithExternalClientDecoratorForHttpHandlers(createClient) {
45
- return function inside(handler, corsOrigin) {
46
- return async (req, res) => {
47
- function ok(val) {
48
- res.status(200).json(val);
49
- }
50
- if (corsOrigin) {
51
- const cors = (0, cors_1.default)({
52
- methods: ['POST', 'GET', 'HEAD'],
53
- origin: corsOrigin,
54
- });
55
- await runMiddleware(req, res, cors);
56
- }
57
- if (isRecordHandler(handler)) {
58
- const potential = Object.entries(handler).find(([method]) => req.method === method);
59
- if (potential) {
60
- const [, properHandle] = potential;
61
- return properHandle(req, res, { client: createClient(req), ok });
62
- }
63
- }
64
- else if (isFunction(handler)) {
65
- return handler(req, res, { client: createClient(req), ok });
66
- }
67
- return (0, utils_1.errorResultAsJson)(res, http2_1.constants.HTTP_STATUS_METHOD_NOT_ALLOWED, translations_1.ServerText.Endpoints.invalidMethod);
68
- };
69
- };
70
- }
71
- function isRecordHandler(handlers) {
72
- return Object.keys(handlers).some((m) => ['GET', 'POST', 'DELETE', 'PUT'].includes(m));
73
- }
74
- function runMiddleware(req, res, fn) {
75
- return new Promise((resolve, reject) => {
76
- fn(req, res, (result) => {
77
- if (result instanceof Error) {
78
- return reject(result);
79
- }
80
- return resolve(result);
81
- });
82
- });
83
- }
84
- function isFunction(fn) {
85
- return fn && {}.toString.call(fn) === '[object Function]';
86
- }
@@ -1,9 +0,0 @@
1
- import { HttpRequester, ApplicationError, AllEndpoints, GraphQlRequester } from './requesters/types';
2
- export { genericError, tryResult, errorResultAsJson } from './requesters/utils';
3
- import { ExternalClient, ExternalClientFactory } from './external-client';
4
- export type { AllEndpoints, HttpRequester, ExternalClient, ExternalClientFactory, };
5
- export { GraphQlRequester, ApplicationError };
6
- export { createExternalClient, createWithExternalClientDecorator, createWithExternalClientDecoratorForHttpHandlers, } from './external-client';
7
- export declare function composeClientFactories<U1 extends AllEndpoints, T1, U2 extends AllEndpoints, T2>(client1: ExternalClientFactory<U1, T1>, client2: ExternalClientFactory<U2, T2>): ExternalClientFactory<U1 | U2, T2 & T1>;
8
- export declare function composeClientFactories<U1 extends AllEndpoints, T1, U2 extends AllEndpoints, T2, U3 extends AllEndpoints, T3>(client1: ExternalClientFactory<U1, T1>, client2: ExternalClientFactory<U2, T2>, client3: ExternalClientFactory<U3, T3>): ExternalClientFactory<U1 | U2 | U3, T3 & T2 & T1>;
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/api-server/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAE9E,OAAO,EAAC,cAAc,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAExE,YAAY,EACR,YAAY,EACZ,aAAa,EACb,cAAc,EACd,qBAAqB,GACxB,CAAC;AAEF,OAAO,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,CAAC;AAE5C,OAAO,EACH,oBAAoB,EACpB,iCAAiC,EACjC,gDAAgD,GACnD,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,sBAAsB,CAClC,EAAE,SAAS,YAAY,EACvB,EAAE,EACF,EAAE,SAAS,YAAY,EACvB,EAAE,EAEF,OAAO,EAAE,qBAAqB,CAAC,EAAE,EAAE,EAAE,CAAC,EACtC,OAAO,EAAE,qBAAqB,CAAC,EAAE,EAAE,EAAE,CAAC,GACvC,qBAAqB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AAE3C,wBAAgB,sBAAsB,CAClC,EAAE,SAAS,YAAY,EACvB,EAAE,EACF,EAAE,SAAS,YAAY,EACvB,EAAE,EACF,EAAE,SAAS,YAAY,EACvB,EAAE,EAEF,OAAO,EAAE,qBAAqB,CAAC,EAAE,EAAE,EAAE,CAAC,EACtC,OAAO,EAAE,qBAAqB,CAAC,EAAE,EAAE,EAAE,CAAC,EACtC,OAAO,EAAE,qBAAqB,CAAC,EAAE,EAAE,EAAE,CAAC,GACvC,qBAAqB,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createWithExternalClientDecoratorForHttpHandlers = exports.createWithExternalClientDecorator = exports.createExternalClient = exports.ApplicationError = exports.GraphQlRequester = exports.errorResultAsJson = exports.tryResult = exports.genericError = void 0;
4
- exports.composeClientFactories = composeClientFactories;
5
- const types_1 = require("./requesters/types");
6
- Object.defineProperty(exports, "ApplicationError", { enumerable: true, get: function () { return types_1.ApplicationError; } });
7
- Object.defineProperty(exports, "GraphQlRequester", { enumerable: true, get: function () { return types_1.GraphQlRequester; } });
8
- var utils_1 = require("./requesters/utils");
9
- Object.defineProperty(exports, "genericError", { enumerable: true, get: function () { return utils_1.genericError; } });
10
- Object.defineProperty(exports, "tryResult", { enumerable: true, get: function () { return utils_1.tryResult; } });
11
- Object.defineProperty(exports, "errorResultAsJson", { enumerable: true, get: function () { return utils_1.errorResultAsJson; } });
12
- var external_client_1 = require("./external-client");
13
- Object.defineProperty(exports, "createExternalClient", { enumerable: true, get: function () { return external_client_1.createExternalClient; } });
14
- Object.defineProperty(exports, "createWithExternalClientDecorator", { enumerable: true, get: function () { return external_client_1.createWithExternalClientDecorator; } });
15
- Object.defineProperty(exports, "createWithExternalClientDecoratorForHttpHandlers", { enumerable: true, get: function () { return external_client_1.createWithExternalClientDecoratorForHttpHandlers; } });
16
- function composeClientFactories(client1, client2, client3) {
17
- return function (req) {
18
- return {
19
- ...client1(req),
20
- ...client2(req),
21
- ...(client3 ? client3(req) : {}),
22
- };
23
- };
24
- }
@@ -1,6 +0,0 @@
1
- import { GraphQlEndpoints, GraphQlRequester, ReqWithHeaders } from './types';
2
- export declare const externalHttpUrls: {
3
- readonly entur: "https://api.entur.io";
4
- };
5
- export declare function createGraphQlRequester<T extends GraphQlEndpoints>(baseUrlKey: T, req?: ReqWithHeaders): GraphQlRequester<T>;
6
- //# sourceMappingURL=graphql-requester.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql-requester.d.ts","sourceRoot":"","sources":["../../../../src/modules/api-server/requesters/graphql-requester.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2B,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AActG,eAAO,MAAM,gBAAgB;;CAEnB,CAAC;AAIX,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,gBAAgB,EAC7D,UAAU,EAAE,CAAC,EACb,GAAG,CAAC,EAAE,cAAc,GACrB,gBAAgB,CAAC,CAAC,CAAC,CA+CrB"}
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.externalHttpUrls = void 0;
4
- exports.createGraphQlRequester = createGraphQlRequester;
5
- const cache_1 = require("@apollo/client/cache");
6
- const core_1 = require("@apollo/client/core");
7
- const error_1 = require("@apollo/client/link/error");
8
- const uuid_1 = require("uuid");
9
- const logging_1 = require("../../logging");
10
- const types_1 = require("./types");
11
- const utils_1 = require("./utils");
12
- const defaultOptions = {
13
- watchQuery: {
14
- fetchPolicy: 'no-cache',
15
- errorPolicy: 'ignore',
16
- },
17
- query: {
18
- fetchPolicy: 'no-cache',
19
- errorPolicy: 'all',
20
- },
21
- };
22
- exports.externalHttpUrls = {
23
- entur: 'https://api.entur.io',
24
- };
25
- const cache = new cache_1.InMemoryCache();
26
- function createGraphQlRequester(baseUrlKey, req) {
27
- // Pass on from the potentially incoming request.
28
- const headers = (0, utils_1.passOnHeadersFromRequest)(req, {
29
- 'X-Correlation-Id': (0, uuid_1.v4)(),
30
- });
31
- const uri = types_1.externalGraphQlEndpoints[baseUrlKey];
32
- const httpLink = new core_1.HttpLink({
33
- uri,
34
- headers: {
35
- ...(0, utils_1.getEtNameHeaders)(),
36
- ...headers,
37
- },
38
- });
39
- const errorLink = (0, error_1.onError)((error) => console.log('Apollo Error:', JSON.stringify(error)));
40
- const loggingLink = new core_1.ApolloLink((operation, forward) => {
41
- operation.setContext({ start: new Date() });
42
- return forward(operation).map((response) => {
43
- const context = operation.getContext();
44
- const timer = new logging_1.Timer(operation.getContext().start);
45
- (0, logging_1.logApiResponse)({
46
- operationName: operation.operationName,
47
- message: 'graphql call',
48
- url: context.response.url,
49
- statusCode: context.response.status,
50
- requestHeaders: headers,
51
- responseHeaders: context.response.headers,
52
- duration: timer.getElapsedMs(),
53
- });
54
- return response;
55
- });
56
- });
57
- const link = core_1.ApolloLink.from([loggingLink, errorLink, httpLink]);
58
- return new types_1.GraphQlRequester(baseUrlKey, {
59
- link,
60
- cache,
61
- defaultOptions,
62
- });
63
- }
@@ -1,3 +0,0 @@
1
- import { HttpEndpoints, HttpRequester, ReqWithHeaders } from './types';
2
- export declare function createRequester<T extends HttpEndpoints>(baseUrlKey: T, req?: ReqWithHeaders): HttpRequester<T>;
3
- //# sourceMappingURL=http-requester.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http-requester.d.ts","sourceRoot":"","sources":["../../../../src/modules/api-server/requesters/http-requester.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,aAAa,EACb,aAAa,EACb,cAAc,EAEjB,MAAM,SAAS,CAAC;AAKjB,wBAAgB,eAAe,CAAC,CAAC,SAAS,aAAa,EACnD,UAAU,EAAE,CAAC,EACb,GAAG,CAAC,EAAE,cAAc,GACrB,aAAa,CAAC,CAAC,CAAC,CAuDlB"}
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRequester = createRequester;
4
- const uuid_1 = require("uuid");
5
- const types_1 = require("./types");
6
- const utils_1 = require("./utils");
7
- const translations_1 = require("../../../translations");
8
- const logging_1 = require("../../logging");
9
- function createRequester(baseUrlKey, req) {
10
- return async function request(url, init) {
11
- const baseUrl = types_1.externalHttpUrls[baseUrlKey];
12
- const actualUrl = `${baseUrl}${url}`;
13
- // Pass on from the potentially incoming request.
14
- const headers = (0, utils_1.passOnHeadersFromRequest)(req, {
15
- 'X-Correlation-Id': (0, uuid_1.v4)(),
16
- });
17
- try {
18
- const timer = new logging_1.Timer();
19
- const data = await fetch(actualUrl, {
20
- ...init,
21
- headers: {
22
- ...init?.headers,
23
- ...(0, utils_1.getEtNameHeaders)(),
24
- ...headers,
25
- Accept: 'application/json',
26
- 'Content-Type': 'application/json',
27
- },
28
- });
29
- (0, logging_1.logApiResponse)({
30
- message: 'http call',
31
- method: init?.method,
32
- url: data.url,
33
- statusCode: data.status,
34
- responseHeaders: data.headers,
35
- requestHeaders: headers,
36
- duration: timer.getElapsedMs(),
37
- });
38
- if (!data.ok) {
39
- throw await errorFromResponse(data);
40
- }
41
- return data;
42
- }
43
- catch (e) {
44
- console.error(e);
45
- if (e instanceof types_1.ApplicationError) {
46
- throw e;
47
- }
48
- else {
49
- throw new types_1.ApplicationError(mapServerToMessage(e), 500, headers['X-Correlation-Id']);
50
- }
51
- }
52
- };
53
- }
54
- async function errorFromResponse(result) {
55
- if (result.headers.get('content-type')?.includes('application/json')) {
56
- const data = await result.json();
57
- return new types_1.ApplicationError(mapServerToMessage(data), result.status, undefined, result);
58
- }
59
- else if (result.headers.get('content-type')?.includes('text/html')) {
60
- return new types_1.ApplicationError(mapServerToMessage(result.statusText), result.status, undefined, result);
61
- }
62
- else {
63
- const data = await result.text();
64
- if (result.status === 401) {
65
- return new types_1.ApplicationError({
66
- message: translations_1.ServerText.Endpoints.accessError,
67
- }, result.status, undefined, result);
68
- }
69
- return new types_1.ApplicationError(mapServerToMessage(data), result.status, undefined, result);
70
- }
71
- }
72
- function mapServerToMessage(e) {
73
- if (typeof e === 'string') {
74
- return { message: (0, translations_1.translation)(e, e, e) };
75
- }
76
- if (!isInternalServerError(e)) {
77
- return { message: translations_1.ServerText.Endpoints.serverError };
78
- }
79
- if (isMessagedError(e)) {
80
- return { message: (0, translations_1.translation)(e.message, e.message, e.message) };
81
- }
82
- const defaultError = { message: (0, translations_1.translation)(e.error, e.error, e.error) };
83
- if (!isInternalServerErrorWithUpstream(e)) {
84
- return defaultError;
85
- }
86
- try {
87
- const upstreamError = JSON.parse(e.upstreamError);
88
- if (!isInternalUpstreamServerError(upstreamError)) {
89
- return defaultError;
90
- }
91
- return {
92
- message: (0, translations_1.translation)(upstreamError.shortNorwegian, upstreamError.shortEnglish, upstreamError.shortNorwegian),
93
- };
94
- }
95
- catch (_err) {
96
- return defaultError;
97
- }
98
- }
99
- function isMessagedError(e) {
100
- return 'message' in e;
101
- }
102
- function isInternalServerError(e) {
103
- return 'error' in e;
104
- }
105
- function isInternalServerErrorWithUpstream(e) {
106
- return 'upstreamError' in e;
107
- }
108
- function isInternalUpstreamServerError(e) {
109
- return 'errorCode' in e && 'shortNorwegian' in e;
110
- }