vviinn-widgets 2.1.0 → 2.2.2

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 (307) hide show
  1. package/dist/cjs/Handler-d1a8a86a.js +329 -0
  2. package/dist/{vviinn-widgets/app-globals-e0943e34.js → cjs/app-globals-30781f30.js} +15 -925
  3. package/{www/build/cropper-handler.entry.js → dist/cjs/cropper-handler.cjs.entry.js} +11 -7
  4. package/dist/{vviinn-widgets/customized-slots-f3449695.js → cjs/customized-slots-5d904d8e.js} +6 -3
  5. package/dist/cjs/highlight-box_22.cjs.entry.js +737 -0
  6. package/{www/build/imageSearch.store-407f49f0.js → dist/cjs/imageSearch.store-128957a4.js} +11573 -11902
  7. package/dist/cjs/index-741a970d.js +1354 -0
  8. package/dist/cjs/index-c493804d.js +41 -0
  9. package/dist/cjs/index.cjs.js +2 -0
  10. package/dist/cjs/loader.cjs.js +23 -0
  11. package/dist/cjs/vviinn-carousel_5.cjs.entry.js +1232 -0
  12. package/dist/{vviinn-widgets/vviinn-error.entry.js → cjs/vviinn-error.cjs.entry.js} +8 -4
  13. package/{www/build/vviinn-preloader.entry.js → dist/cjs/vviinn-preloader.cjs.entry.js} +11 -10
  14. package/dist/cjs/vviinn-vps-button.cjs.entry.js +43 -0
  15. package/{www/build/vviinn-vps-widget.entry.js → dist/cjs/vviinn-vps-widget.cjs.entry.js} +31 -30
  16. package/dist/cjs/vviinn-widgets.cjs.js +21 -0
  17. package/dist/collection/Image/error.js +14 -0
  18. package/dist/collection/Image/form.js +5 -0
  19. package/dist/collection/Image/fromFile.js +18 -0
  20. package/dist/collection/Image/imageToB64.js +9 -0
  21. package/dist/collection/Image/index.js +0 -0
  22. package/dist/collection/Image/renderPromise.js +6 -0
  23. package/dist/collection/Image/resizeImage.js +28 -0
  24. package/dist/collection/Image/sizing.js +39 -0
  25. package/dist/collection/Image/toFile.js +17 -0
  26. package/dist/collection/analytics/GAnalytics.js +32 -0
  27. package/dist/collection/analytics/GeneralAnalytics.js +9 -0
  28. package/dist/collection/analytics/GtagAnalytics.js +35 -0
  29. package/dist/collection/analytics/ProductAnalytics.js +1 -0
  30. package/dist/collection/campaign/Campaign.js +8 -0
  31. package/dist/collection/campaign/CampaignService.js +5 -0
  32. package/dist/collection/campaign/VCSCampaign.js +1 -0
  33. package/dist/collection/campaign/VCSCampaignResponse.js +1 -0
  34. package/dist/collection/campaign/VCSCampaignService.js +5 -0
  35. package/dist/collection/campaign/VPRCampaignResponse.js +1 -0
  36. package/dist/collection/campaign/VPRCampaignService.js +5 -0
  37. package/dist/collection/collection-manifest.json +43 -0
  38. package/dist/collection/components/customized-slots.js +47 -0
  39. package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.css +71 -0
  40. package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.js +25 -0
  41. package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.css +49 -0
  42. package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.js +64 -0
  43. package/dist/collection/components/image-search/image-view/image-cropper/image-cropper.css +33 -0
  44. package/dist/{vviinn-widgets/image-cropper.entry.js → collection/components/image-search/image-view/image-cropper/image-cropper.js} +54 -32
  45. package/dist/collection/components/image-search/search-filters/search-filters.css +120 -0
  46. package/dist/collection/components/image-search/search-filters/search-filters.js +102 -0
  47. package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +138 -0
  48. package/{www/build/vviinn-carousel.entry.js → dist/collection/components/vviinn-carousel/vviinn-carousel.js} +115 -18
  49. package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.css +7 -0
  50. package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.js +36 -0
  51. package/dist/collection/components/vviinn-error/vviinn-error.css +38 -0
  52. package/dist/collection/components/vviinn-error/vviinn-error.js +18 -0
  53. package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.css +3 -0
  54. package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.js +34 -0
  55. package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.css +3 -0
  56. package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.js +34 -0
  57. package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.css +34 -0
  58. package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.js +129 -0
  59. package/dist/collection/components/vviinn-example-images/vviinn-example-images.css +19 -0
  60. package/dist/collection/components/vviinn-example-images/vviinn-example-images.js +80 -0
  61. package/dist/{vviinn-widgets/index-c9483145.js → collection/components/vviinn-icons/index.js} +13 -12
  62. package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.css +25 -0
  63. package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.js +64 -0
  64. package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.css +47 -0
  65. package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.js +83 -0
  66. package/dist/collection/components/vviinn-image-view/vviinn-image-view.css +31 -0
  67. package/dist/collection/components/vviinn-image-view/vviinn-image-view.js +61 -0
  68. package/dist/collection/components/vviinn-modal/vviinn-modal.css +105 -0
  69. package/dist/collection/components/vviinn-modal/vviinn-modal.js +98 -0
  70. package/dist/collection/components/vviinn-onboarding/onboarding-cards/onboarding-card.css +41 -0
  71. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-1/vviinn-onboarding-card-1.js +26 -0
  72. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-2/vviinn-onboarding-card-2.js +26 -0
  73. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-3/vviinn-onboarding-card-3.js +26 -0
  74. package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.css +58 -0
  75. package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.js +28 -0
  76. package/dist/collection/components/vviinn-overlay/vviinn-overlay.css +33 -0
  77. package/dist/collection/components/vviinn-overlay/vviinn-overlay.js +15 -0
  78. package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.css +29 -0
  79. package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.js +71 -0
  80. package/dist/collection/components/vviinn-preloader/vviinn-preloader.css +37 -0
  81. package/dist/collection/components/vviinn-preloader/vviinn-preloader.js +20 -0
  82. package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.css +19 -0
  83. package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.js +27 -0
  84. package/dist/collection/components/vviinn-product-card/render-helpers.js +32 -0
  85. package/dist/collection/components/vviinn-product-card/vviinn-product-card.css +95 -0
  86. package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +425 -0
  87. package/dist/collection/components/vviinn-slider/arrow.js +11 -0
  88. package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.css +4 -0
  89. package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.js +15 -0
  90. package/dist/collection/components/vviinn-slider/vviinn-slider.css +109 -0
  91. package/dist/collection/components/vviinn-slider/vviinn-slider.js +181 -0
  92. package/dist/collection/components/vviinn-teaser/vviinn-teaser.css +14 -0
  93. package/dist/collection/components/vviinn-teaser/vviinn-teaser.js +29 -0
  94. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.css +238 -0
  95. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +200 -0
  96. package/dist/collection/components/vviinn-vpr-button/stories/kek.stories.js +18 -0
  97. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +35 -0
  98. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +149 -0
  99. package/dist/collection/components/vviinn-vpr-widget/GridMode.js +1 -0
  100. package/dist/collection/components/vviinn-vpr-widget/token-helpers.js +11 -0
  101. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +441 -0
  102. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +74 -0
  103. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.css +0 -0
  104. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +177 -0
  105. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.css +350 -0
  106. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +247 -0
  107. package/dist/collection/cropper/Cropper.js +1 -0
  108. package/dist/collection/cropper/Handler.js +61 -0
  109. package/dist/collection/dom/index.js +3 -0
  110. package/dist/collection/error.js +14 -0
  111. package/dist/collection/file/index.js +4 -0
  112. package/dist/collection/geometry/Clip.js +14 -0
  113. package/dist/collection/geometry/Point.js +32 -0
  114. package/dist/collection/geometry/Rectangle.js +95 -0
  115. package/dist/collection/geometry/RectangleAlt.js +1 -0
  116. package/dist/collection/geometry/Sized.js +8 -0
  117. package/dist/collection/global.js +19 -0
  118. package/dist/collection/index.js +1 -0
  119. package/dist/collection/interfaces/generated.js +5 -0
  120. package/dist/collection/interfaces/recommendation.js +1 -0
  121. package/dist/collection/network/apiClient.js +9 -0
  122. package/dist/collection/network/ion/File.js +14 -0
  123. package/dist/collection/network/ion/Form.js +64 -0
  124. package/dist/collection/network/ion/Link.js +8 -0
  125. package/dist/collection/network/ion/ValueObject.js +23 -0
  126. package/dist/collection/network/request.js +19 -0
  127. package/dist/collection/network/utils.js +37 -0
  128. package/dist/collection/recommendation/recommendation.js +1 -0
  129. package/dist/collection/searchSession/searchSession.js +26 -0
  130. package/dist/collection/sentry.js +14 -0
  131. package/dist/collection/slider/GridMode.js +1 -0
  132. package/dist/collection/store/file-processing.js +13 -0
  133. package/dist/collection/store/imageSearch.store.js +138 -0
  134. package/dist/collection/store/store.js +11 -0
  135. package/dist/collection/stories/Button.js +21 -0
  136. package/dist/collection/stories/Button.stories.js +42 -0
  137. package/dist/collection/stories/Header.js +45 -0
  138. package/dist/collection/stories/Header.stories.js +15 -0
  139. package/dist/collection/stories/Page.js +61 -0
  140. package/dist/collection/stories/Page.stories.js +19 -0
  141. package/dist/collection/stories/assets/code-brackets.svg +1 -0
  142. package/dist/collection/stories/assets/colors.svg +1 -0
  143. package/dist/collection/stories/assets/comments.svg +1 -0
  144. package/dist/collection/stories/assets/direction.svg +1 -0
  145. package/dist/collection/stories/assets/flow.svg +1 -0
  146. package/dist/collection/stories/assets/plugin.svg +1 -0
  147. package/dist/collection/stories/assets/repo.svg +1 -0
  148. package/dist/collection/stories/assets/stackalt.svg +1 -0
  149. package/dist/collection/stories/image-selector.stories.js +6 -0
  150. package/dist/collection/stories/image-view.stories.js +6 -0
  151. package/dist/collection/stories/modal.stories.js +12 -0
  152. package/dist/collection/stories/onboarding.stories.js +11 -0
  153. package/dist/collection/stories/overlay.stories.js +5 -0
  154. package/dist/collection/stories/overlayedModal.stories.js +8 -0
  155. package/dist/collection/stories/privacy-badge.stories.js +11 -0
  156. package/dist/collection/stories/slider.stories.js +17 -0
  157. package/dist/collection/stories/teaser.stories.js +5 -0
  158. package/dist/collection/stories/vps-widget.stories.js +47 -0
  159. package/dist/collection/stories/vviinn-product.stories.js +19 -0
  160. package/dist/collection/utils/collections/collectionsUtils.js +5 -0
  161. package/dist/collection/utils/either.js +3 -0
  162. package/dist/collection/utils/enum/enumUtils.js +3 -0
  163. package/dist/collection/utils/event/Events.js +1 -0
  164. package/dist/collection/utils/number/index.js +4 -0
  165. package/dist/collection/utils/option/option.js +4 -0
  166. package/dist/collection/utils/semigroup/semigroupDiff.js +6 -0
  167. package/dist/collection/utils/token/tokenUtils.js +9 -0
  168. package/dist/esm/Handler-639a4cb3.js +308 -0
  169. package/{www/build/app-globals-e0943e34.js → dist/esm/app-globals-345e497d.js} +10 -922
  170. package/dist/{vviinn-widgets → esm}/cropper-handler.entry.js +2 -2
  171. package/{www/build/customized-slots-f3449695.js → dist/esm/customized-slots-a76a8d41.js} +1 -1
  172. package/dist/esm/highlight-box_22.entry.js +712 -0
  173. package/dist/{vviinn-widgets/imageSearch.store-407f49f0.js → esm/imageSearch.store-8eab0da1.js} +11510 -11872
  174. package/dist/esm/index-6fa21e24.js +1323 -0
  175. package/{www/build/index-c9483145.js → dist/esm/index-8cb063df.js} +6 -4
  176. package/dist/esm/index.js +1 -0
  177. package/dist/esm/loader.js +19 -0
  178. package/dist/esm/polyfills/core-js.js +11 -0
  179. package/dist/esm/polyfills/css-shim.js +1 -0
  180. package/dist/esm/polyfills/dom.js +79 -0
  181. package/dist/esm/polyfills/es5-html-element.js +1 -0
  182. package/dist/esm/polyfills/index.js +34 -0
  183. package/dist/esm/polyfills/system.js +6 -0
  184. package/dist/esm/vviinn-carousel_5.entry.js +1224 -0
  185. package/{www/build → dist/esm}/vviinn-error.entry.js +1 -1
  186. package/dist/{vviinn-widgets → esm}/vviinn-preloader.entry.js +3 -6
  187. package/dist/{vviinn-widgets → esm}/vviinn-vps-button.entry.js +3 -3
  188. package/dist/{vviinn-widgets → esm}/vviinn-vps-widget.entry.js +4 -7
  189. package/dist/esm/vviinn-widgets.js +19 -0
  190. package/dist/index.cjs.js +1 -0
  191. package/dist/index.js +1 -0
  192. package/dist/loader/cdn.js +3 -0
  193. package/dist/loader/index.cjs.js +3 -0
  194. package/dist/loader/index.d.ts +12 -0
  195. package/dist/loader/index.es2017.js +3 -0
  196. package/dist/loader/index.js +4 -0
  197. package/dist/loader/package.json +10 -0
  198. package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +1 -0
  199. package/dist/types/components/vviinn-icons/index.d.ts +2 -0
  200. package/dist/types/components/vviinn-product-card/render-helpers.d.ts +3 -2
  201. package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +2 -0
  202. package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +25 -0
  203. package/dist/types/components/vviinn-vpr-button/stories/kek.stories.d.ts +7 -0
  204. package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +14 -0
  205. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +13 -3
  206. package/dist/types/components.d.ts +54 -0
  207. package/dist/vviinn-widgets/index.esm.js +0 -1
  208. package/dist/vviinn-widgets/p-04b06ea9.entry.js +1 -0
  209. package/dist/vviinn-widgets/p-400eb62f.entry.js +1 -0
  210. package/dist/vviinn-widgets/p-56fc949a.js +1 -0
  211. package/dist/vviinn-widgets/p-59edfbe2.js +1 -0
  212. package/dist/vviinn-widgets/p-78ccc9eb.js +15 -0
  213. package/dist/vviinn-widgets/p-9d24f51e.entry.js +1 -0
  214. package/dist/vviinn-widgets/p-d085199d.entry.js +1 -0
  215. package/dist/vviinn-widgets/p-e1ba8626.js +1 -0
  216. package/dist/vviinn-widgets/p-e38f4aa2.entry.js +1 -0
  217. package/dist/vviinn-widgets/p-e67cae57.js +1 -0
  218. package/dist/vviinn-widgets/p-f47e82b2.entry.js +1 -0
  219. package/dist/vviinn-widgets/p-f582db5c.js +1 -0
  220. package/dist/vviinn-widgets/p-fb14e3cc.entry.js +1 -0
  221. package/dist/vviinn-widgets/vviinn-widgets.css +1 -6
  222. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -125
  223. package/package.json +3 -1
  224. package/www/build/index.esm.js +0 -1
  225. package/www/build/p-04b06ea9.entry.js +1 -0
  226. package/www/build/p-400eb62f.entry.js +1 -0
  227. package/www/build/p-56fc949a.js +1 -0
  228. package/www/build/p-59edfbe2.js +1 -0
  229. package/www/build/p-78ccc9eb.js +15 -0
  230. package/www/build/p-7e4978d5.js +1 -0
  231. package/www/build/p-9d24f51e.entry.js +1 -0
  232. package/www/build/p-a67898be.css +1 -0
  233. package/www/build/p-d085199d.entry.js +1 -0
  234. package/www/build/p-e1ba8626.js +1 -0
  235. package/www/build/p-e38f4aa2.entry.js +1 -0
  236. package/www/build/p-e67cae57.js +1 -0
  237. package/www/build/p-f47e82b2.entry.js +1 -0
  238. package/www/build/p-f582db5c.js +1 -0
  239. package/www/build/p-fb14e3cc.entry.js +1 -0
  240. package/www/build/vviinn-widgets.css +1 -6
  241. package/www/build/vviinn-widgets.esm.js +1 -125
  242. package/www/index.html +6 -13
  243. package/dist/vviinn-widgets/Array-4b9f84cf.js +0 -4295
  244. package/dist/vviinn-widgets/Handler-47db9890.js +0 -1428
  245. package/dist/vviinn-widgets/NonEmptyArray-6ef0d207.js +0 -4370
  246. package/dist/vviinn-widgets/css-shim-f0027935.js +0 -4
  247. package/dist/vviinn-widgets/dom-db0073f0.js +0 -73
  248. package/dist/vviinn-widgets/highlight-box.entry.js +0 -41
  249. package/dist/vviinn-widgets/index-b6d739a9.js +0 -3010
  250. package/dist/vviinn-widgets/number-98d54dd6.js +0 -1533
  251. package/dist/vviinn-widgets/search-filters.entry.js +0 -73
  252. package/dist/vviinn-widgets/shadow-css-c1fdfa9f.js +0 -389
  253. package/dist/vviinn-widgets/vviinn-carousel.entry.js +0 -205
  254. package/dist/vviinn-widgets/vviinn-detected-object.entry.js +0 -52
  255. package/dist/vviinn-widgets/vviinn-empty-results.entry.js +0 -16
  256. package/dist/vviinn-widgets/vviinn-example-image.entry.js +0 -38
  257. package/dist/vviinn-widgets/vviinn-example-images.entry.js +0 -28
  258. package/dist/vviinn-widgets/vviinn-image-selector.entry.js +0 -31
  259. package/dist/vviinn-widgets/vviinn-image-view.entry.js +0 -55
  260. package/dist/vviinn-widgets/vviinn-modal.entry.js +0 -30
  261. package/dist/vviinn-widgets/vviinn-onboarding-card-1.entry.js +0 -21
  262. package/dist/vviinn-widgets/vviinn-onboarding-card-2.entry.js +0 -21
  263. package/dist/vviinn-widgets/vviinn-onboarding-card-3.entry.js +0 -21
  264. package/dist/vviinn-widgets/vviinn-onboarding.entry.js +0 -20
  265. package/dist/vviinn-widgets/vviinn-overlay.entry.js +0 -15
  266. package/dist/vviinn-widgets/vviinn-overlayed-modal.entry.js +0 -18
  267. package/dist/vviinn-widgets/vviinn-privacy-badge.entry.js +0 -20
  268. package/dist/vviinn-widgets/vviinn-product-card.entry.js +0 -176
  269. package/dist/vviinn-widgets/vviinn-server-error.entry.js +0 -16
  270. package/dist/vviinn-widgets/vviinn-slide.entry.js +0 -15
  271. package/dist/vviinn-widgets/vviinn-slider.entry.js +0 -120
  272. package/dist/vviinn-widgets/vviinn-teaser.entry.js +0 -20
  273. package/dist/vviinn-widgets/vviinn-vpr-widget.entry.js +0 -128
  274. package/dist/vviinn-widgets/vviinn-wrong-format.entry.js +0 -16
  275. package/www/build/Array-4b9f84cf.js +0 -4295
  276. package/www/build/Handler-47db9890.js +0 -1428
  277. package/www/build/NonEmptyArray-6ef0d207.js +0 -4370
  278. package/www/build/css-shim-f0027935.js +0 -4
  279. package/www/build/dom-db0073f0.js +0 -73
  280. package/www/build/highlight-box.entry.js +0 -41
  281. package/www/build/image-cropper.entry.js +0 -113
  282. package/www/build/index-b6d739a9.js +0 -3010
  283. package/www/build/number-98d54dd6.js +0 -1533
  284. package/www/build/search-filters.entry.js +0 -73
  285. package/www/build/shadow-css-c1fdfa9f.js +0 -389
  286. package/www/build/vviinn-detected-object.entry.js +0 -52
  287. package/www/build/vviinn-empty-results.entry.js +0 -16
  288. package/www/build/vviinn-example-image.entry.js +0 -38
  289. package/www/build/vviinn-example-images.entry.js +0 -28
  290. package/www/build/vviinn-image-selector.entry.js +0 -31
  291. package/www/build/vviinn-image-view.entry.js +0 -55
  292. package/www/build/vviinn-modal.entry.js +0 -30
  293. package/www/build/vviinn-onboarding-card-1.entry.js +0 -21
  294. package/www/build/vviinn-onboarding-card-2.entry.js +0 -21
  295. package/www/build/vviinn-onboarding-card-3.entry.js +0 -21
  296. package/www/build/vviinn-onboarding.entry.js +0 -20
  297. package/www/build/vviinn-overlay.entry.js +0 -15
  298. package/www/build/vviinn-overlayed-modal.entry.js +0 -18
  299. package/www/build/vviinn-privacy-badge.entry.js +0 -20
  300. package/www/build/vviinn-product-card.entry.js +0 -176
  301. package/www/build/vviinn-server-error.entry.js +0 -16
  302. package/www/build/vviinn-slide.entry.js +0 -15
  303. package/www/build/vviinn-slider.entry.js +0 -120
  304. package/www/build/vviinn-teaser.entry.js +0 -20
  305. package/www/build/vviinn-vpr-widget.entry.js +0 -128
  306. package/www/build/vviinn-vps-button.entry.js +0 -39
  307. package/www/build/vviinn-wrong-format.entry.js +0 -16
@@ -0,0 +1,247 @@
1
+ import { Component, Host, h, State, Prop, Element, Watch } from "@stencil/core";
2
+ import state from "../../store/store";
3
+ import { imageSearchState } from "../../store/imageSearch.store";
4
+ import * as O from "fp-ts/lib/Option";
5
+ import { slotChangeListener } from "../customized-slots";
6
+ /**
7
+ * @prop --color-primary: color used for action button, slider bullets and selected detected object;
8
+ *
9
+ * @part close-button - close button on modal header.
10
+ * @part secondary-action - back button on modal header.
11
+ * @part title - modal window title.
12
+ *
13
+ * @part select-image_button
14
+ *
15
+ * @part product-card - product card.
16
+ * @part product-card_brand - product card brand.
17
+ * @part product-card_currency - currency sign. Renders after price-amount inside product card.
18
+ * @part product-card_deeplink - anchor element for title. Rendered only if "deeplink" property filled.
19
+ * @part product-card_image - product image inside product card.
20
+ * @part product-card_image-link - anchor element for image. Rendered only if "deeplink" property filled.
21
+ * @part product-card_price-amount - numeric part of price inside product card.
22
+ * @part product-card_price-container - block contains all prices inside product card.
23
+ * @part product-card_price-outdated - renders inside price-container when "sale-price" property filled. Contains regular price.
24
+ * @part product-card_price-prefix - renders before price-amount. Can be set with "price-prefix" property or inherited from parent component.
25
+ * @part product-card_price-regular - renders inside price-container when "sale-price" property is empty.
26
+ * @part product-card_price-sale - renders inside price-container when "sale-price" property filled. Contains sale price.
27
+ * @part product-card_title - product title
28
+ */
29
+ export class VviinnVpsWidget {
30
+ constructor() {
31
+ /** When true modal window with widget will be shown */
32
+ this.active = false;
33
+ /** Currency sign will shown after price */
34
+ this.currencySign = "€";
35
+ /** Locale for currency formatting */
36
+ this.locale = "de-DE";
37
+ this.slidePosition = 0;
38
+ this.width = 0;
39
+ this.wrongImageFormat = false;
40
+ }
41
+ activeWatcher(value) {
42
+ if (value) {
43
+ this.overflow = document.body.style.overflow;
44
+ document.body.style.overflow = "hidden";
45
+ }
46
+ else {
47
+ document.body.style.overflow = this.overflow;
48
+ }
49
+ }
50
+ componentWillLoad() {
51
+ slotChangeListener(this, this.el);
52
+ }
53
+ connectedCallback() {
54
+ state.apiPath = this.apiPath;
55
+ state.currencySign = this.currencySign;
56
+ state.locale = this.locale;
57
+ imageSearchState.token = this.token;
58
+ }
59
+ handleImageSelection() {
60
+ this.slidePosition = 1;
61
+ const root = this.el.shadowRoot.querySelector("vviinn-overlayed-modal");
62
+ const overlay = root.shadowRoot.querySelector("vviinn-overlay");
63
+ const modal = overlay.querySelector("vviinn-modal");
64
+ const modalBody = modal.shadowRoot.querySelector(".body");
65
+ modalBody.scrollTop = 0;
66
+ }
67
+ resetState() {
68
+ this.resetScroll("onboarding-block");
69
+ this.slidePosition = 0;
70
+ imageSearchState.image = O.none;
71
+ imageSearchState.imageUrl = O.none;
72
+ imageSearchState.imageBounds = O.none;
73
+ imageSearchState.searchArea = O.none;
74
+ imageSearchState.results = [];
75
+ imageSearchState.filters = [];
76
+ imageSearchState.detectedObjects = [];
77
+ imageSearchState.activeIonLink = undefined;
78
+ imageSearchState.rectangleSearchForm = undefined;
79
+ this.resetScroll("results-block");
80
+ }
81
+ haveErrors() {
82
+ return this.wrongImageFormat || imageSearchState.serverError;
83
+ }
84
+ resetScroll(elementId, behavior = "auto") {
85
+ const element = this.el.shadowRoot.getElementById(elementId);
86
+ element.scroll({ top: 0, left: 0, behavior });
87
+ }
88
+ handleModalClose() {
89
+ this.active = false;
90
+ this.resetState();
91
+ const elementsToReset = ["onboarding-block", "results-block"];
92
+ elementsToReset.forEach((name) => this.resetScroll(name));
93
+ }
94
+ render() {
95
+ return (h(Host, null,
96
+ h("vviinn-overlayed-modal", { class: { "first-screen": this.slidePosition === 0 }, active: this.active, onSecondaryActionClicked: () => this.resetState(), onModalClosed: () => this.handleModalClose(), exportparts: "secondary-action, title, close-button" },
97
+ h("vviinn-slider", { showBullets: false, position: this.slidePosition },
98
+ h("vviinn-slide", { class: { "start-page": true } },
99
+ h("div", { class: {
100
+ error: this.haveErrors(),
101
+ "start-page_block": true,
102
+ } },
103
+ h("vviinn-wrong-format", { class: { hidden: !this.wrongImageFormat }, onActionClick: () => (this.wrongImageFormat = false) }),
104
+ h("vviinn-server-error", { class: { hidden: !imageSearchState.serverError }, onActionClick: () => (imageSearchState.serverError = false) }),
105
+ h("vviinn-teaser", { class: { hidden: this.haveErrors() } }),
106
+ h("vviinn-image-selector", { class: { hidden: this.haveErrors() }, onImageSelected: () => this.handleImageSelection(), onImageSelectedError: () => (this.wrongImageFormat = true), part: "select-image_button" },
107
+ h("span", { slot: "upload-button-text", class: "upload-button-content" },
108
+ h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "29", height: "28", fill: "none" },
109
+ h("defs", null),
110
+ h("path", { fill: "#fff", "fill-rule": "evenodd", d: "M10.271 3.89A.875.875 0 0111 3.5h7c.293 0 .566.146.728.39l1.49 2.235h3.033a2.625 2.625 0 012.625 2.625V21a2.625 2.625 0 01-2.625 2.625H5.75A2.625 2.625 0 013.125 21V8.75A2.625 2.625 0 015.75 6.125h3.031l1.49-2.235zm1.197 1.36l-1.49 2.235a.875.875 0 01-.729.39H5.75a.875.875 0 00-.875.875V21a.875.875 0 00.875.875h17.5a.875.875 0 00.875-.875V8.75a.875.875 0 00-.875-.875h-3.5a.875.875 0 01-.729-.39l-1.49-2.235h-6.063z", "clip-rule": "evenodd" }),
111
+ h("path", { fill: "#fff", "fill-rule": "evenodd", d: "M14.5 11.375a3.062 3.062 0 100 6.125 3.062 3.062 0 000-6.125zm-4.813 3.063a4.812 4.812 0 119.625 0 4.812 4.812 0 01-9.625 0z", "clip-rule": "evenodd" })),
112
+ h("slot", { name: "vviinn-image-upload-button-text" },
113
+ h("span", null, "Kamera oder Bild ausw\u00E4hlen")))),
114
+ h("vviinn-privacy-badge", { class: { hidden: this.haveErrors() } })),
115
+ h("div", { id: "onboarding-block", class: "start-page_block" },
116
+ h("div", { class: "onboarding-wrapper" },
117
+ h("vviinn-onboarding", null),
118
+ h("vviinn-example-images", { onImageSelected: () => this.handleImageSelection(), onImageSelectedError: () => this.resetScroll("onboarding-block", "smooth") })))),
119
+ h("vviinn-slide", { class: { "results-page": true, active: this.slidePosition == 1 } },
120
+ h("div", { class: "image-wrapper" },
121
+ h("vviinn-image-view", null),
122
+ h("div", { class: "filters-wrapper" },
123
+ h("div", { class: "filters" }, imageSearchState.filters.map((filter) => (h("search-filters", { filter: filter })))))),
124
+ h("div", { id: "results-block", class: "products-wrapper" },
125
+ h("div", { class: { "nothing-found": true, hidden: imageSearchState.results.length > 0 } },
126
+ h("vviinn-empty-results", null),
127
+ h("vviinn-onboarding", null)),
128
+ h("div", { class: {
129
+ hidden: imageSearchState.results.length <= 0,
130
+ products: true,
131
+ } }, imageSearchState.results.map((p) => {
132
+ var _a;
133
+ return (h("vviinn-product-card", { hidden: true, productTitle: p.title, productId: p.productId, brand: p.brand, deeplink: p.deeplink, price: p.price.actual, salePrice: p.price.sale, imageWidth: 160, image: (_a = p.image.thumbnail) !== null && _a !== void 0 ? _a : p.image.original, part: "product-card" }));
134
+ }))))))));
135
+ }
136
+ static get is() { return "vviinn-vps-widget"; }
137
+ static get encapsulation() { return "shadow"; }
138
+ static get originalStyleUrls() { return {
139
+ "$": ["vviinn-vps-widget.css"]
140
+ }; }
141
+ static get styleUrls() { return {
142
+ "$": ["vviinn-vps-widget.css"]
143
+ }; }
144
+ static get properties() { return {
145
+ "token": {
146
+ "type": "string",
147
+ "mutable": false,
148
+ "complexType": {
149
+ "original": "string | undefined",
150
+ "resolved": "string",
151
+ "references": {}
152
+ },
153
+ "required": false,
154
+ "optional": false,
155
+ "docs": {
156
+ "tags": [],
157
+ "text": "vviinn customer token"
158
+ },
159
+ "attribute": "token",
160
+ "reflect": false
161
+ },
162
+ "apiPath": {
163
+ "type": "string",
164
+ "mutable": false,
165
+ "complexType": {
166
+ "original": "string | undefined",
167
+ "resolved": "string",
168
+ "references": {}
169
+ },
170
+ "required": false,
171
+ "optional": false,
172
+ "docs": {
173
+ "tags": [{
174
+ "text": undefined,
175
+ "name": "internal"
176
+ }],
177
+ "text": ""
178
+ },
179
+ "attribute": "api-path",
180
+ "reflect": false
181
+ },
182
+ "active": {
183
+ "type": "boolean",
184
+ "mutable": true,
185
+ "complexType": {
186
+ "original": "boolean",
187
+ "resolved": "boolean",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": "When true modal window with widget will be shown"
195
+ },
196
+ "attribute": "active",
197
+ "reflect": false,
198
+ "defaultValue": "false"
199
+ },
200
+ "currencySign": {
201
+ "type": "string",
202
+ "mutable": false,
203
+ "complexType": {
204
+ "original": "string",
205
+ "resolved": "string",
206
+ "references": {}
207
+ },
208
+ "required": false,
209
+ "optional": false,
210
+ "docs": {
211
+ "tags": [],
212
+ "text": "Currency sign will shown after price"
213
+ },
214
+ "attribute": "currency-sign",
215
+ "reflect": false,
216
+ "defaultValue": "\"\u20AC\""
217
+ },
218
+ "locale": {
219
+ "type": "string",
220
+ "mutable": false,
221
+ "complexType": {
222
+ "original": "string",
223
+ "resolved": "string",
224
+ "references": {}
225
+ },
226
+ "required": false,
227
+ "optional": false,
228
+ "docs": {
229
+ "tags": [],
230
+ "text": "Locale for currency formatting"
231
+ },
232
+ "attribute": "locale",
233
+ "reflect": false,
234
+ "defaultValue": "\"de-DE\""
235
+ }
236
+ }; }
237
+ static get states() { return {
238
+ "slidePosition": {},
239
+ "width": {},
240
+ "wrongImageFormat": {}
241
+ }; }
242
+ static get elementRef() { return "el"; }
243
+ static get watchers() { return [{
244
+ "propName": "active",
245
+ "methodName": "activeWatcher"
246
+ }]; }
247
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,61 @@
1
+ import * as Point from "../geometry/Point";
2
+ export var HandlerDirection;
3
+ (function (HandlerDirection) {
4
+ HandlerDirection[HandlerDirection["East"] = 0] = "East";
5
+ HandlerDirection[HandlerDirection["North"] = 1] = "North";
6
+ HandlerDirection[HandlerDirection["NorthEast"] = 2] = "NorthEast";
7
+ HandlerDirection[HandlerDirection["NorthWest"] = 3] = "NorthWest";
8
+ HandlerDirection[HandlerDirection["South"] = 4] = "South";
9
+ HandlerDirection[HandlerDirection["SouthEast"] = 5] = "SouthEast";
10
+ HandlerDirection[HandlerDirection["SouthWest"] = 6] = "SouthWest";
11
+ HandlerDirection[HandlerDirection["West"] = 7] = "West";
12
+ })(HandlerDirection || (HandlerDirection = {}));
13
+ export const getCursorValue = (direction) => {
14
+ switch (direction) {
15
+ case HandlerDirection.East:
16
+ return "e-resize";
17
+ case HandlerDirection.North:
18
+ return "n-resize";
19
+ case HandlerDirection.NorthEast:
20
+ return "ne-resize";
21
+ case HandlerDirection.NorthWest:
22
+ return "nw-resize";
23
+ case HandlerDirection.South:
24
+ return "s-resize";
25
+ case HandlerDirection.SouthEast:
26
+ return "se-resize";
27
+ case HandlerDirection.SouthWest:
28
+ return "sw-resize";
29
+ case HandlerDirection.West:
30
+ return "w-resize";
31
+ default:
32
+ return "pointer";
33
+ }
34
+ };
35
+ export const fromRectangle = (r) => [
36
+ {
37
+ position: Point.fromRectangle(r),
38
+ direction: HandlerDirection.NorthWest,
39
+ },
40
+ {
41
+ position: Point.pointSumSemigroup.concat(Point.fromRectangle(r), {
42
+ x: r.width,
43
+ y: 0,
44
+ }),
45
+ direction: HandlerDirection.NorthEast,
46
+ },
47
+ {
48
+ position: Point.pointSumSemigroup.concat(Point.fromRectangle(r), {
49
+ x: 0,
50
+ y: r.height,
51
+ }),
52
+ direction: HandlerDirection.SouthWest,
53
+ },
54
+ {
55
+ position: Point.pointSumSemigroup.concat(Point.fromRectangle(r), {
56
+ x: r.width,
57
+ y: r.height,
58
+ }),
59
+ direction: HandlerDirection.SouthEast,
60
+ },
61
+ ];
@@ -0,0 +1,3 @@
1
+ export const findTarget = (ev) => {
2
+ return ev.target;
3
+ };
@@ -0,0 +1,14 @@
1
+ export const basicErrorFromResponse = (error) => {
2
+ return {
3
+ kind: "server",
4
+ inner: error,
5
+ };
6
+ };
7
+ export const invalidTokenError = {
8
+ kind: "client",
9
+ inner: "Token not exist or empty",
10
+ };
11
+ export const emptyApiPathError = {
12
+ kind: "client",
13
+ inner: "Api path empty or missing",
14
+ };
@@ -0,0 +1,4 @@
1
+ export const fileDoesntExistError = {
2
+ kind: "app",
3
+ inner: "File doesnt exist",
4
+ };
@@ -0,0 +1,14 @@
1
+ const fromRectangle = (shape, target) => {
2
+ const top = `${shape.y}px`;
3
+ const left = `${shape.x}px`;
4
+ const right = `${target.width - (shape.x + shape.width)}px`;
5
+ const bottom = `${target.height - (shape.y + shape.height)}px`;
6
+ return {
7
+ top,
8
+ right,
9
+ bottom,
10
+ left,
11
+ };
12
+ };
13
+ const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
14
+ export const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
@@ -0,0 +1,32 @@
1
+ import { semigroupSum, semigroupProduct, struct } from "fp-ts/Semigroup";
2
+ import { semigroupDiff } from "../utils/semigroup/semigroupDiff";
3
+ export const fromRectangle = ({ x, y }) => {
4
+ return {
5
+ x,
6
+ y,
7
+ };
8
+ };
9
+ export const fromMouseEvent = ({ clientX, clientY }) => {
10
+ return {
11
+ x: clientX,
12
+ y: clientY,
13
+ };
14
+ };
15
+ export const fromTouchEvent = ({ touches }) => {
16
+ return {
17
+ x: touches[0].clientX,
18
+ y: touches[0].clientY,
19
+ };
20
+ };
21
+ export const pointDiffSemigroup = struct({
22
+ x: semigroupDiff,
23
+ y: semigroupDiff,
24
+ });
25
+ export const pointSumSemigroup = struct({
26
+ x: semigroupSum,
27
+ y: semigroupSum,
28
+ });
29
+ export const pointProductSemigroup = struct({
30
+ x: semigroupProduct,
31
+ y: semigroupProduct,
32
+ });
@@ -0,0 +1,95 @@
1
+ import { fromRectangle, pointSumSemigroup, pointProductSemigroup, } from "./Point";
2
+ import { HandlerDirection } from "../cropper/Handler";
3
+ import { sizedDivSemigroup } from "./Sized";
4
+ export const move = (origin, position) => {
5
+ const originPosition = fromRectangle(origin);
6
+ const newPosition = pointSumSemigroup.concat(originPosition, position);
7
+ return Object.assign(Object.assign({}, newPosition), { width: origin.width, height: origin.height });
8
+ };
9
+ const transformNorthEast = (origin, handler) => {
10
+ const newPosition = pointSumSemigroup.concat(fromRectangle(origin), {
11
+ x: 0,
12
+ y: handler.position.y,
13
+ });
14
+ return Object.assign(Object.assign({}, newPosition), { width: origin.width + handler.position.x, height: origin.height - handler.position.y });
15
+ };
16
+ export const transformNorthWest = (origin, handler) => {
17
+ const newPosition = pointSumSemigroup.concat(fromRectangle(origin), handler.position);
18
+ return Object.assign(Object.assign({}, newPosition), { width: origin.width - handler.position.x, height: origin.height - handler.position.y });
19
+ };
20
+ const transformSouthEast = (origin, handler) => {
21
+ return Object.assign(Object.assign({}, origin), { width: origin.width + handler.position.x, height: origin.height + handler.position.y });
22
+ };
23
+ const transformSouthWest = (origin, handler) => {
24
+ const newPosition = pointSumSemigroup.concat(fromRectangle(origin), {
25
+ x: handler.position.x,
26
+ y: 0,
27
+ });
28
+ return Object.assign(Object.assign({}, newPosition), { width: origin.width - handler.position.x, height: origin.height + handler.position.y });
29
+ };
30
+ export const transform = (origin, handler) => {
31
+ switch (handler.direction) {
32
+ case HandlerDirection.NorthEast:
33
+ return transformNorthEast(origin, handler);
34
+ case HandlerDirection.NorthWest:
35
+ return transformNorthWest(origin, handler);
36
+ case HandlerDirection.SouthEast:
37
+ return transformSouthEast(origin, handler);
38
+ case HandlerDirection.SouthWest:
39
+ return transformSouthWest(origin, handler);
40
+ }
41
+ };
42
+ export const fromImage = (image) => {
43
+ return {
44
+ x: 0,
45
+ y: 0,
46
+ width: image.width,
47
+ height: image.height,
48
+ };
49
+ };
50
+ export const fromNaturalImage = (image) => {
51
+ return {
52
+ x: 0,
53
+ y: 0,
54
+ width: image.naturalWidth,
55
+ height: image.naturalHeight,
56
+ };
57
+ };
58
+ export const getScaleRange = (source, target) => {
59
+ const difference = sizedDivSemigroup.concat(target, source);
60
+ return {
61
+ x: difference.width,
62
+ y: difference.height,
63
+ };
64
+ };
65
+ export const scaleSelection = (source, sourceSelection, target) => {
66
+ const sourcePosition = fromRectangle(source);
67
+ const scale = getScaleRange(source, target);
68
+ const newPosition = pointProductSemigroup.concat(sourcePosition, scale);
69
+ return Object.assign(Object.assign({}, newPosition), { width: sourceSelection.width * scale.x, height: sourceSelection.height * scale.y });
70
+ };
71
+ export const fromAlt = (r) => {
72
+ return Object.assign({ x: r.left, y: r.top }, r);
73
+ };
74
+ export const scaleWithSized = (s) => (r) => {
75
+ return {
76
+ x: r.x * s.width,
77
+ y: r.y * s.height,
78
+ width: r.width * s.width,
79
+ height: r.height * s.height,
80
+ };
81
+ };
82
+ export const divideOnSized = (s) => (r) => {
83
+ return {
84
+ x: r.x / s.width,
85
+ y: r.y / s.height,
86
+ width: r.width / s.width,
87
+ height: r.height / s.height,
88
+ };
89
+ };
90
+ export const center = (r) => {
91
+ return {
92
+ x: r.x + r.width * 0.5,
93
+ y: r.y + r.height * 0.5,
94
+ };
95
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { semigroupDiv } from "../utils/semigroup/semigroupDiff";
2
+ import { getStructSemigroup } from "fp-ts/Semigroup";
3
+ import * as Ord from "fp-ts/Ord";
4
+ export const sizedDivSemigroup = getStructSemigroup({
5
+ width: semigroupDiv,
6
+ height: semigroupDiv,
7
+ });
8
+ export const ordSized = Ord.contramap((s) => s.width * s.height)(Ord.ordNumber);
@@ -0,0 +1,19 @@
1
+ import * as Sentry from "@sentry/browser";
2
+ import { Env } from "@stencil/core";
3
+ import { filterInternalExeptions } from "./sentry";
4
+ const setupSentry = () => {
5
+ Sentry.init({
6
+ dsn: "https://70bcf561598b44148bd3cabc7c142a6c@o1015876.ingest.sentry.io/5983034",
7
+ release: `${Env.packageName}@${Env.packageVersion}`,
8
+ environment: Env.environment,
9
+ tracesSampleRate: 0.0,
10
+ maxBreadcrumbs: 4,
11
+ beforeSend: filterInternalExeptions,
12
+ allowUrls: [
13
+ /https?:\/\/cdn\.jsdelivr\.net\/npm\/vviinn-widgets.+/
14
+ ]
15
+ });
16
+ };
17
+ export default function () {
18
+ setupSentry();
19
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import * as E from "fp-ts/Either";
2
+ import * as TE from "fp-ts/TaskEither";
3
+ import { pipe } from "fp-ts/function";
4
+ import { sequenceT } from "fp-ts/Apply";
5
+ import { createInitGetRequest, createInitPostRequest, getApiPath, } from "./utils";
6
+ import { makeRequest } from "./request";
7
+ const sequenceToEither = sequenceT(E.Apply);
8
+ export const apiGet = (path, data = {}) => pipe(sequenceToEither(getApiPath(), createInitGetRequest), TE.fromEither, TE.chainW(makeRequest(path, data)));
9
+ export const apiPost = (path, data = {}) => pipe(sequenceToEither(getApiPath(), createInitPostRequest), TE.fromEither, TE.chainW(makeRequest(path, data)));
@@ -0,0 +1,14 @@
1
+ export const fileToB64 = async (f) => new Promise((resolve) => {
2
+ const reader = new FileReader();
3
+ reader.addEventListener("load", () => {
4
+ resolve(reader.result);
5
+ });
6
+ reader.readAsDataURL(f);
7
+ });
8
+ export const fromFile = async (f) => {
9
+ return {
10
+ name: f.name,
11
+ mediaType: f.type,
12
+ value: await fileToB64(f),
13
+ };
14
+ };
@@ -0,0 +1,64 @@
1
+ import * as E from "fp-ts/Either";
2
+ import * as TE from "fp-ts/TaskEither";
3
+ import { pipe } from "fp-ts/lib/function";
4
+ import { getApiPath } from "../utils";
5
+ import { makeRequest } from "../request";
6
+ import { sequenceToEither } from "../../utils/either";
7
+ var FormMemberName;
8
+ (function (FormMemberName) {
9
+ FormMemberName["desc"] = "desc";
10
+ FormMemberName["eform"] = "eform";
11
+ FormMemberName["enabled"] = "enabled";
12
+ FormMemberName["etype"] = "etype";
13
+ FormMemberName["form"] = "form";
14
+ FormMemberName["label"] = "label";
15
+ FormMemberName["max"] = "max";
16
+ FormMemberName["maxlength"] = "maxlength";
17
+ FormMemberName["maxsize"] = "maxsize";
18
+ FormMemberName["min"] = "min";
19
+ FormMemberName["minlength"] = "minlength";
20
+ FormMemberName["minsize"] = "minsize";
21
+ FormMemberName["mutable"] = "mutable";
22
+ FormMemberName["name"] = "name";
23
+ FormMemberName["options"] = "options";
24
+ FormMemberName["pattern"] = "pattern";
25
+ FormMemberName["placeholder"] = "placeholder";
26
+ FormMemberName["required"] = "required";
27
+ FormMemberName["secret"] = "secret";
28
+ FormMemberName["type"] = "type";
29
+ FormMemberName["value"] = "value";
30
+ FormMemberName["visible"] = "visible";
31
+ })(FormMemberName || (FormMemberName = {}));
32
+ export const checkFormFields = (f, data) => {
33
+ const fields = f.map((x) => x.name);
34
+ const keys = Object.keys(data);
35
+ const diff = fields.filter((x) => !keys.includes(x));
36
+ return diff.length === 0
37
+ ? E.right(data)
38
+ : E.left(`Data should contains fields: ${diff.join(", ")}`);
39
+ };
40
+ export const requestFromForm = (form, data) => pipe(checkFormFields(form.value, data), E.map((checkedData) => form.rel.includes("query-form")
41
+ ? transformGetForm(form, checkedData)
42
+ : transformSendForm(form, checkedData)));
43
+ const transformGetForm = (form, data) => {
44
+ const params = new URLSearchParams(Object.entries(data));
45
+ const url = `${form.href}?${params.toString()}`;
46
+ return [url, { method: "GET" }];
47
+ };
48
+ const transformSendForm = (form, data) => [
49
+ form.href,
50
+ {
51
+ body: JSON.stringify(data),
52
+ method: form.method,
53
+ headers: new Headers({
54
+ "Content-Type": "application/ion+json",
55
+ }),
56
+ },
57
+ ];
58
+ export const formRequest = (form, data = {}) => (payload) => pipe(sequenceToEither(getApiPath(), pipe(requestFromForm(form, data), E.mapLeft((error) => {
59
+ return { kind: "app", inner: error };
60
+ }))), TE.fromEither, TE.chainW((initialData) => {
61
+ const apiPath = initialData[0];
62
+ const [formUrl, initObject] = initialData[1];
63
+ return makeRequest(formUrl, initObject)([apiPath, payload]);
64
+ }));
@@ -0,0 +1,8 @@
1
+ import * as O from "fp-ts/Option";
2
+ import * as TE from "fp-ts/TaskEither";
3
+ import { pipe } from "fp-ts/function";
4
+ import { getApiPath, createRequestFromMethod } from "../utils";
5
+ import { makeRequest } from "../request";
6
+ import { sequenceToEither } from "../../utils/either";
7
+ export const getLink = (item, path) => pipe(item.links, O.fromNullable, O.chain((linksObject) => O.fromNullable(linksObject[path])));
8
+ export const linkRequest = (link) => (data) => pipe(sequenceToEither(getApiPath(), createRequestFromMethod(link.method)), TE.fromEither, TE.chainW(makeRequest(link.href, data)));
@@ -0,0 +1,23 @@
1
+ var ObjectMemberName;
2
+ (function (ObjectMemberName) {
3
+ ObjectMemberName["eform"] = "eform";
4
+ ObjectMemberName["etype"] = "etype";
5
+ ObjectMemberName["form"] = "form";
6
+ ObjectMemberName["href"] = "href";
7
+ ObjectMemberName["method"] = "method";
8
+ ObjectMemberName["accepts"] = "accepts";
9
+ ObjectMemberName["produces"] = "produces";
10
+ ObjectMemberName["rel"] = "rel";
11
+ ObjectMemberName["type"] = "type";
12
+ ObjectMemberName["value"] = "value";
13
+ })(ObjectMemberName || (ObjectMemberName = {}));
14
+ export const foldValueObject = (i) => {
15
+ switch (i.type) {
16
+ case "array": {
17
+ return i.value.map(foldValueObject);
18
+ }
19
+ default: {
20
+ return i.value;
21
+ }
22
+ }
23
+ };