magic-pill 6.1.16 → 6.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/LICENSE.md +21 -0
- package/NOTICE.md +10 -0
- package/README.md +2 -5
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [6.1.18]
|
|
4
|
+
### Fixed
|
|
5
|
+
- Reworked the logic regarding animation pausing on hover (still a work in progress)
|
|
6
|
+
|
|
7
|
+
## [6.1.17]
|
|
8
|
+
### Added
|
|
9
|
+
- Added logic to prevent exit animation when the mouse enters Magic Pill. Once the mouse leaves, a five seconds timer starts, if the mouse hasn't entered, it triggers the exit animation, if it enters again, the timer is reset to five seconds.
|
|
10
|
+
- Added a LICENSE file
|
|
11
|
+
- Added a NOTICE file
|
|
12
|
+
- LICENSE and NOTICE files will be added to the package
|
|
13
|
+
|
|
14
|
+
### Updated
|
|
15
|
+
- README file
|
|
16
|
+
|
|
3
17
|
## [6.1.16]
|
|
4
18
|
### Fixed
|
|
5
19
|
- Fixed various display issues
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
***Copyright (c) 2024 Cédric Theveneau***
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Notice
|
|
2
|
+
## Original code
|
|
3
|
+
### Magic Pill
|
|
4
|
+
**_Copyright (c) 2024 Cédric Theveneau_**
|
|
5
|
+
|
|
6
|
+
This product includes software from https://github.com/CedricTheveneau/Lightning_UI
|
|
7
|
+
|
|
8
|
+
- The use of the [Magic Pill](https://github.com/CedricTheveneau/Magic-Pill) logos and brand name are forbidden except for the owner.
|
|
9
|
+
- Copyright (c) 2024 [Cédric Theveneau](https://github.com/CedricTheveneau)
|
|
10
|
+
- Licensed under the [MIT License](https://www.tldrlegal.com/license/mit-license);
|
package/README.md
CHANGED
|
@@ -116,9 +116,6 @@ As stated before, Magic Pill is distributed under the MIT License.
|
|
|
116
116
|
## What's next ?
|
|
117
117
|
| TODO | DOING |
|
|
118
118
|
|-----------|-----------|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
| Proper testing | |
|
|
122
|
-
| License file | |
|
|
123
|
-
| Changelog file | |
|
|
119
|
+
| Implementation with APIs | Better conditioning of displays depending on props |
|
|
120
|
+
| Proper testing | Animation fixes |
|
|
124
121
|
| Full documentation | |
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{useState as t,useEffect as n}from"react";function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=Array(t);n<t;n++)l[n]=e[n];return l}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var l,r,a,i,o=[],c=!0,C=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(l=a.call(n)).done)&&(o.push(l.value),o.length!==t);c=!0);}catch(e){C=!0,r=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(C)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var a=function(){return e.createElement("svg",{width:"31",height:"20",viewBox:"0 0 31 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.813004 10.2755C0.813004 9.69059 1.28715 9.21645 1.87204 9.21645L26.8501 9.21645L20.1858 2.55207C19.7722 2.1385 19.7722 1.46795 20.1858 1.05438C20.5993 0.640799 21.2699 0.640799 21.6835 1.05438L30.1557 9.52663C30.5693 9.94021 30.5693 10.6107 30.1557 11.0243L21.6835 19.4966C21.2699 19.9102 20.5993 19.9102 20.1858 19.4966C19.7722 19.083 19.7722 18.4125 20.1858 17.9989L26.8501 11.3345L1.87204 11.3345C1.28715 11.3345 0.813004 10.8604 0.813004 10.2755Z",fill:"black"}))},i=function(){return e.createElement("svg",{width:"27",height:"26",viewBox:"0 0 27 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M25.5226 4.8102C25.9834 4.99448 26.2855 5.4407 26.2855 5.9369V19.9512C26.2855 20.4474 25.9834 20.8936 25.5226 21.0779L13.7921 25.7701C13.5028 25.8858 13.1801 25.8858 12.8908 25.7701L1.16028 21.0779C0.699563 20.8936 0.397461 20.4474 0.397461 19.9512V5.9369C0.397461 5.4407 0.699563 4.99448 1.16028 4.8102L12.4401 0.298213C12.4451 0.296221 12.4501 0.294245 12.4551 0.292286L12.8908 0.117998C13.1801 0.00227327 13.5028 0.00227283 13.7921 0.117998L14.2279 0.292303C14.2329 0.294256 14.2379 0.296226 14.2428 0.298213L25.5226 4.8102ZM17.2306 3.23602L7.27396 7.21868L3.38482 5.66302L2.01546 6.21076V6.85792L12.5325 11.0647V23.8841L13.3415 24.2077L14.1505 23.8841V11.0647L24.6675 6.85792V6.21076L23.2981 5.66302L13.3415 9.64568L9.45226 8.09L19.4089 4.10734L17.2306 3.23602Z",fill:"#141414"}))},o=function(){return e.createElement("svg",{width:"22",height:"18",viewBox:"0 0 22 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M18.2019 0.949382C18.9692 0.182085 20.2132 0.182085 20.9805 0.949382C21.7384 1.70727 21.7477 2.93028 21.0084 3.69957L10.55 16.7726C10.5349 16.7915 10.5187 16.8095 10.5017 16.8266C9.73436 17.5939 8.49033 17.5939 7.72303 16.8266L0.790074 9.89367C0.0227749 9.12637 0.022775 7.88233 0.790074 7.11504C1.55737 6.34774 2.80141 6.34774 3.56871 7.11504L9.05315 12.5995L18.1498 1.00816C18.166 0.987539 18.1834 0.967913 18.2019 0.949382Z",fill:"#141414"}))},c=function(){return e.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.808942 1.61705C0.493007 1.30112 0.493007 0.788885 0.808942 0.472951C1.12488 0.157017 1.63711 0.157017 1.95304 0.472951L10.28 8.7999L18.6069 0.472951C18.9229 0.157017 19.4351 0.157017 19.751 0.472951C20.067 0.788885 20.067 1.30112 19.751 1.61705L11.4241 9.944L19.751 18.271C20.067 18.5869 20.067 19.0991 19.751 19.4151C19.4351 19.731 18.9229 19.731 18.6069 19.4151L10.28 11.0881L1.95304 19.4151C1.63711 19.731 1.12488 19.731 0.808943 19.4151C0.493008 19.0991 0.493008 18.5869 0.808943 18.271L9.13589 9.944L0.808942 1.61705Z",fill:"#141414"}))},C=function(){return e.createElement("svg",{width:"27",height:"20",viewBox:"0 0 27 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.701567 2.7527C1.02864 1.31171 2.31737 0.236 3.85734 0.236H23.2733C24.8133 0.236 26.102 1.31171 26.4291 2.7527L13.5653 10.6139L0.701567 2.7527ZM0.621338 4.59988V16.0934L10.0109 10.338L0.621338 4.59988ZM11.5613 11.2854L0.931785 17.8008C1.45073 18.8952 2.56565 19.652 3.85734 19.652H23.2733C24.565 19.652 25.6799 18.8952 26.1989 17.8008L15.5694 11.2854L13.5653 12.5101L11.5613 11.2854ZM17.1198 10.338L26.5093 16.0934V4.59988L17.1198 10.338Z",fill:"#141414"}))},s=function(){return e.createElement("svg",{width:"27",height:"28",viewBox:"0 0 27 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.8045 14.7234C0.357701 14.7234 -0.00450093 14.3612 -0.00450059 13.9144C-0.00450082 13.4676 0.357702 13.1054 0.8045 13.1054L12.5806 13.1054L12.5806 1.32934C12.5806 0.882544 12.9428 0.520341 13.3896 0.52034C13.8364 0.520341 14.1986 0.882543 14.1986 1.32934L14.1986 13.1054L25.9747 13.1054C26.4215 13.1054 26.7837 13.4676 26.7837 13.9144C26.7837 14.3612 26.4215 14.7234 25.9747 14.7234H14.1986L14.1986 26.4995C14.1986 26.9463 13.8364 27.3085 13.3896 27.3085C12.9428 27.3085 12.5806 26.9463 12.5806 26.4995L12.5806 14.7234L0.8045 14.7234Z",fill:"black"}))},u=function(){return e.createElement("svg",{width:"21",height:"26",viewBox:"0 0 21 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.5453 0H3.98136C2.19417 0 0.745361 1.44881 0.745361 3.236V22.652C0.745361 24.4392 2.19417 25.888 3.98136 25.888H16.9254C18.7126 25.888 20.1614 24.4392 20.1614 22.652V7.6161C20.1614 7.18698 19.9909 6.77544 19.6875 6.472L13.6894 0.473901C13.3859 0.170467 12.9744 0 12.5453 0ZM12.8804 5.663V2.427L17.7344 7.281H14.4984C13.6048 7.281 12.8804 6.5566 12.8804 5.663ZM2.36336 14.562H18.5434V16.18H7.21736V19.416H18.5434V21.034H7.21736V24.27H5.59936V21.034H2.36336V19.416H5.59936V16.18H2.36336V14.562Z",fill:"#141414"}))},m=function(){return e.createElement("svg",{width:"27",height:"26",viewBox:"0 0 27 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.78296 0.826921C4.9837 -0.37382 6.96512 -0.250462 8.00765 1.08994L10.9099 4.82136C11.4425 5.50612 11.6307 6.39771 11.4203 7.2393L10.5348 10.7812C10.4413 11.1551 10.5509 11.5507 10.8234 11.8232L14.7982 15.798C15.0707 16.0705 15.4663 16.1801 15.8402 16.0866L19.3821 15.2011C20.2237 14.9907 21.1153 15.1789 21.8 15.7115L25.5315 18.6138C26.8719 19.6563 26.9952 21.6377 25.7945 22.8384L24.1216 24.5113C22.9247 25.7082 21.1346 26.2337 19.4662 25.6472C15.3238 24.1908 11.4355 21.8064 8.12521 18.4962C4.81496 15.1859 2.4306 11.2976 0.974218 7.1552C0.38766 5.48684 0.913207 3.69668 2.11007 2.49981L3.78296 0.826921Z",fill:"#141414"}))},w=function(){return e.createElement("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.85896 7.85305C0.543026 7.53712 0.543026 7.02489 0.85896 6.70895L7.33096 0.236954C7.64689 -0.0789795 8.15912 -0.0789795 8.47506 0.236954C8.79099 0.552889 8.79099 1.06512 8.47506 1.38105L3.38411 6.472H19.229C21.463 6.472 23.274 8.28301 23.274 10.517V23.461C23.274 23.9078 22.9118 24.27 22.465 24.27C22.0182 24.27 21.656 23.9078 21.656 23.461V10.517C21.656 9.17661 20.5694 8.09 19.229 8.09H3.38411L8.47506 13.181C8.79099 13.4969 8.79099 14.0091 8.47506 14.3251C8.15912 14.641 7.64689 14.641 7.33096 14.3251L0.85896 7.85305Z",fill:"#141414"}))},h=function(){return e.createElement("svg",{width:"36",height:"28",viewBox:"0 0 36 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M31.7745 0.900854C32.7099 -0.0470194 34.2265 -0.0470194 35.1619 0.900854C36.0859 1.8371 36.0972 3.34793 35.1959 4.29828L16.0585 26.9205C16.0401 26.9438 16.0204 26.966 15.9996 26.9872C15.0641 27.935 13.5475 27.935 12.6121 26.9872L0.966345 15.1863C0.0309227 14.2385 0.0309227 12.7017 0.966344 11.7538C1.90177 10.8059 3.41838 10.8059 4.35381 11.7538L14.2337 21.7652L31.7109 0.97346C31.7307 0.947992 31.7519 0.923746 31.7745 0.900854Z",fill:"#F9F9F9"}))},f=function(){return e.createElement("svg",{width:"43",height:"27",viewBox:"0 0 43 27",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.804932 4.11207C0.804932 1.94314 2.56319 0.184875 4.73212 0.184875H38.7678C40.9367 0.184875 42.695 1.94314 42.695 4.11207V8.03925C42.695 8.76223 42.1089 9.34832 41.3859 9.34832C39.217 9.34832 37.4587 11.1066 37.4587 13.2755C37.4587 15.4444 39.217 17.2027 41.3859 17.2027C42.1089 17.2027 42.695 17.7888 42.695 18.5118V22.4389C42.695 24.6079 40.9367 26.3661 38.7678 26.3661H4.73212C2.56319 26.3661 0.804932 24.6079 0.804932 22.4389V18.5118C0.804932 17.7888 1.39102 17.2027 2.11399 17.2027C4.28292 17.2027 6.04118 15.4444 6.04118 13.2755C6.04118 11.1066 4.28292 9.34832 2.11399 9.34832C1.39102 9.34832 0.804932 8.76223 0.804932 8.03925V4.11207ZM11.2774 1.49394V4.11207H13.8956V1.49394H11.2774ZM13.8956 9.34832V6.73019H11.2774V9.34832H13.8956ZM32.2224 9.34832V6.73019H29.6043V9.34832H32.2224ZM29.6043 4.11207H32.2224V1.49394H29.6043V4.11207ZM13.8956 11.9664H11.2774V14.5846H13.8956V11.9664ZM32.2224 14.5846V11.9664H29.6043V14.5846H32.2224ZM13.8956 17.2027H11.2774V19.8208H13.8956V17.2027ZM32.2224 19.8208V17.2027H29.6043V19.8208H32.2224ZM11.2774 22.4389V25.0571H13.8956V22.4389H11.2774ZM29.6043 25.0571H32.2224V22.4389H29.6043V25.0571Z",fill:"white"}))},L=function(){return e.createElement("svg",{width:"11",height:"31",viewBox:"0 0 11 31",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.51383 9.94016C7.59773 9.94016 8.63967 11.1741 8.63967 13.6418C8.63967 14.7386 8.33806 16.6854 7.73482 19.4822C7.13159 22.279 6.82997 24.0065 6.82997 24.6645C6.82997 25.7613 7.26869 26.5839 8.14612 27.1323C7.76224 28.1743 7.18643 28.9694 6.41868 29.5178C5.67835 30.0388 4.85575 30.2993 3.9509 30.2993C1.62023 30.2993 0.454891 29.0517 0.454891 26.5565C0.454891 25.2678 0.756508 23.2387 1.35974 20.4693C1.99039 17.6999 2.30572 15.9725 2.30572 15.287C2.30572 14.108 1.88072 13.4636 1.0307 13.3539C1.1678 12.3942 1.64765 11.5853 2.47024 10.9273C3.32025 10.2692 4.33478 9.94016 5.51383 9.94016ZM6.08964 8.0482C5.04769 8.0482 4.25252 7.74659 3.70413 7.14335C3.18315 6.5127 2.92266 5.75866 2.92266 4.88123C2.92266 3.81186 3.27912 2.86588 3.99203 2.04329C4.73237 1.19328 5.71947 0.768273 6.95336 0.768273C7.96789 0.768273 8.74935 1.09731 9.29775 1.75538C9.84614 2.41345 10.1203 3.19492 10.1203 4.09977C10.1203 5.16914 9.76388 6.10141 9.05097 6.89658C8.36548 7.66433 7.37837 8.0482 6.08964 8.0482Z",fill:"#F9F9F9"}))},g=function(){return e.createElement("svg",{width:"16",height:"30",viewBox:"0 0 16 30",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M8.36496 18.7176C7.18591 19.2934 6.18509 19.5813 5.3625 19.5813C3.33344 19.5813 2.31891 18.8547 2.31891 17.4015C2.31891 16.5789 2.55198 15.7563 3.01812 14.9337C3.48425 14.0837 4.04635 13.3159 4.70443 12.6304C5.38992 11.9175 6.07541 11.2183 6.76091 10.5328C7.4464 9.81991 8.02221 9.05216 8.48835 8.22957C8.95448 7.40698 9.18755 6.58439 9.18755 5.7618C9.18755 4.58275 8.54319 3.99323 7.25446 3.99323C6.59639 3.99323 5.93831 4.28113 5.28024 4.85695C4.62217 5.40534 4.15603 6.14567 3.88184 7.07794C1.66084 6.80375 0.550342 6.00858 0.550342 4.69243C0.550342 3.4037 1.30438 2.37547 2.81247 1.60771C4.34797 0.812541 6.11654 0.414955 8.11818 0.414955C9.92788 0.414955 11.5594 0.812541 13.0126 1.60771C14.4658 2.37547 15.1925 3.60935 15.1925 5.30937C15.1925 6.48842 14.9457 7.5715 14.4521 8.55861C13.986 9.5183 13.4102 10.3409 12.7247 11.0264C12.0666 11.7119 11.3948 12.3699 10.7093 13.0006C10.0239 13.6313 9.43433 14.3442 8.94077 15.1393C8.47464 15.9071 8.24157 16.716 8.24157 17.566C8.24157 17.9224 8.2827 18.3063 8.36496 18.7176ZM4.00523 29.4113C3.12779 29.4113 2.40117 29.1234 1.82536 28.5476C1.24954 27.9718 0.961638 27.2314 0.961638 26.3266C0.961638 25.2572 1.35922 24.2838 2.15439 23.4064C2.94957 22.5289 3.90926 22.0902 5.03346 22.0902C5.88347 22.0902 6.59639 22.4056 7.1722 23.0362C7.77543 23.6394 8.07705 24.3935 8.07705 25.2983C8.07705 26.3403 7.66576 27.2863 6.84317 28.1363C6.02057 28.9863 5.07459 29.4113 4.00523 29.4113Z",fill:"#F9F9F9"}))},d=function(l){var d,v,p=l.pillData,V=r(t(!1),2),H=V[0],E=V[1],b=r(t(!0),2),M=b[0],x=b[1],Z=p.icon,y=p.message,k=p.cta,B=p.info,N=k||{},F=N.icon,A=N.label,I=N.link,R=B||{},S=R.title,P=R.content,T=R.closeLabel,j=r(t(!0),2),D=j[0],O=j[1];switch(Z){case"checkmark":d=h;break;case"coupon":d=f;break;case"info":d=L;break;case"questionmark":d=g;break;default:d=null}switch(D?F:"cross"){case"arrow":v=a;break;case"box":v=i;break;case"checkmark":v=o;break;case"cross":v=c;break;case"mail":v=C;break;case"plus":v=s;break;case"quotation":v=u;break;case"tel":v=m;break;case"undo":v=w;break;default:v=null}return n((function(){x(!1),setTimeout((function(){return E(!0)}),2500),setTimeout((function(){E(!1),x(!0)}),7500)}),[]),e.createElement("div",{className:M?"magicPill out":H?"magicPill active":"magicPill entry"},d&&e.createElement(d,{className:"icon"}),e.createElement("p",{className:"message"},y),I&&!B&&e.createElement("a",{className:"CTA",href:I},v&&e.createElement(v,{className:"label"}),e.createElement("span",null,A)),I&&B&&e.createElement("button",{className:"CTA",onClick:function(){O(!D)}},v&&e.createElement(v,{className:"label"}),e.createElement("span",null,D?A:T)),B&&e.createElement("div",{className:D?"info":"info active"},e.createElement("p",{className:"title"},S),e.createElement("div",{className:"content",dangerouslySetInnerHTML:{__html:P}})))};d.defaultProps={pillData:{icon:"info",message:"Hey ! I'm Magic Pill, your omnipotent toolbox !",cta:{icon:"arrow",label:"Discover what I can do",link:null},info:{title:"I'm Magic Pill, let me empower you !",content:"<p>I'll appear sometimes, depending on context, either to send you notifications regarding your experience on this website or to give you indications and hints at what you cn do !</p><p>See you around !</p>",closeLabel:"Close"}}};export{d as default};
|
|
1
|
+
import e,{useState as t,useEffect as n}from"react";function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=Array(t);n<t;n++)l[n]=e[n];return l}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var l,r,i,a,o=[],c=!0,C=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(l=i.call(n)).done)&&(o.push(l.value),o.length!==t);c=!0);}catch(e){C=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(C)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var i=function(){return e.createElement("svg",{width:"31",height:"20",viewBox:"0 0 31 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.813004 10.2755C0.813004 9.69059 1.28715 9.21645 1.87204 9.21645L26.8501 9.21645L20.1858 2.55207C19.7722 2.1385 19.7722 1.46795 20.1858 1.05438C20.5993 0.640799 21.2699 0.640799 21.6835 1.05438L30.1557 9.52663C30.5693 9.94021 30.5693 10.6107 30.1557 11.0243L21.6835 19.4966C21.2699 19.9102 20.5993 19.9102 20.1858 19.4966C19.7722 19.083 19.7722 18.4125 20.1858 17.9989L26.8501 11.3345L1.87204 11.3345C1.28715 11.3345 0.813004 10.8604 0.813004 10.2755Z",fill:"black"}))},a=function(){return e.createElement("svg",{width:"27",height:"26",viewBox:"0 0 27 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M25.5226 4.8102C25.9834 4.99448 26.2855 5.4407 26.2855 5.9369V19.9512C26.2855 20.4474 25.9834 20.8936 25.5226 21.0779L13.7921 25.7701C13.5028 25.8858 13.1801 25.8858 12.8908 25.7701L1.16028 21.0779C0.699563 20.8936 0.397461 20.4474 0.397461 19.9512V5.9369C0.397461 5.4407 0.699563 4.99448 1.16028 4.8102L12.4401 0.298213C12.4451 0.296221 12.4501 0.294245 12.4551 0.292286L12.8908 0.117998C13.1801 0.00227327 13.5028 0.00227283 13.7921 0.117998L14.2279 0.292303C14.2329 0.294256 14.2379 0.296226 14.2428 0.298213L25.5226 4.8102ZM17.2306 3.23602L7.27396 7.21868L3.38482 5.66302L2.01546 6.21076V6.85792L12.5325 11.0647V23.8841L13.3415 24.2077L14.1505 23.8841V11.0647L24.6675 6.85792V6.21076L23.2981 5.66302L13.3415 9.64568L9.45226 8.09L19.4089 4.10734L17.2306 3.23602Z",fill:"#141414"}))},o=function(){return e.createElement("svg",{width:"22",height:"18",viewBox:"0 0 22 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M18.2019 0.949382C18.9692 0.182085 20.2132 0.182085 20.9805 0.949382C21.7384 1.70727 21.7477 2.93028 21.0084 3.69957L10.55 16.7726C10.5349 16.7915 10.5187 16.8095 10.5017 16.8266C9.73436 17.5939 8.49033 17.5939 7.72303 16.8266L0.790074 9.89367C0.0227749 9.12637 0.022775 7.88233 0.790074 7.11504C1.55737 6.34774 2.80141 6.34774 3.56871 7.11504L9.05315 12.5995L18.1498 1.00816C18.166 0.987539 18.1834 0.967913 18.2019 0.949382Z",fill:"#141414"}))},c=function(){return e.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.808942 1.61705C0.493007 1.30112 0.493007 0.788885 0.808942 0.472951C1.12488 0.157017 1.63711 0.157017 1.95304 0.472951L10.28 8.7999L18.6069 0.472951C18.9229 0.157017 19.4351 0.157017 19.751 0.472951C20.067 0.788885 20.067 1.30112 19.751 1.61705L11.4241 9.944L19.751 18.271C20.067 18.5869 20.067 19.0991 19.751 19.4151C19.4351 19.731 18.9229 19.731 18.6069 19.4151L10.28 11.0881L1.95304 19.4151C1.63711 19.731 1.12488 19.731 0.808943 19.4151C0.493008 19.0991 0.493008 18.5869 0.808943 18.271L9.13589 9.944L0.808942 1.61705Z",fill:"#141414"}))},C=function(){return e.createElement("svg",{width:"27",height:"20",viewBox:"0 0 27 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.701567 2.7527C1.02864 1.31171 2.31737 0.236 3.85734 0.236H23.2733C24.8133 0.236 26.102 1.31171 26.4291 2.7527L13.5653 10.6139L0.701567 2.7527ZM0.621338 4.59988V16.0934L10.0109 10.338L0.621338 4.59988ZM11.5613 11.2854L0.931785 17.8008C1.45073 18.8952 2.56565 19.652 3.85734 19.652H23.2733C24.565 19.652 25.6799 18.8952 26.1989 17.8008L15.5694 11.2854L13.5653 12.5101L11.5613 11.2854ZM17.1198 10.338L26.5093 16.0934V4.59988L17.1198 10.338Z",fill:"#141414"}))},s=function(){return e.createElement("svg",{width:"27",height:"28",viewBox:"0 0 27 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.8045 14.7234C0.357701 14.7234 -0.00450093 14.3612 -0.00450059 13.9144C-0.00450082 13.4676 0.357702 13.1054 0.8045 13.1054L12.5806 13.1054L12.5806 1.32934C12.5806 0.882544 12.9428 0.520341 13.3896 0.52034C13.8364 0.520341 14.1986 0.882543 14.1986 1.32934L14.1986 13.1054L25.9747 13.1054C26.4215 13.1054 26.7837 13.4676 26.7837 13.9144C26.7837 14.3612 26.4215 14.7234 25.9747 14.7234H14.1986L14.1986 26.4995C14.1986 26.9463 13.8364 27.3085 13.3896 27.3085C12.9428 27.3085 12.5806 26.9463 12.5806 26.4995L12.5806 14.7234L0.8045 14.7234Z",fill:"black"}))},u=function(){return e.createElement("svg",{width:"21",height:"26",viewBox:"0 0 21 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.5453 0H3.98136C2.19417 0 0.745361 1.44881 0.745361 3.236V22.652C0.745361 24.4392 2.19417 25.888 3.98136 25.888H16.9254C18.7126 25.888 20.1614 24.4392 20.1614 22.652V7.6161C20.1614 7.18698 19.9909 6.77544 19.6875 6.472L13.6894 0.473901C13.3859 0.170467 12.9744 0 12.5453 0ZM12.8804 5.663V2.427L17.7344 7.281H14.4984C13.6048 7.281 12.8804 6.5566 12.8804 5.663ZM2.36336 14.562H18.5434V16.18H7.21736V19.416H18.5434V21.034H7.21736V24.27H5.59936V21.034H2.36336V19.416H5.59936V16.18H2.36336V14.562Z",fill:"#141414"}))},m=function(){return e.createElement("svg",{width:"27",height:"26",viewBox:"0 0 27 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.78296 0.826921C4.9837 -0.37382 6.96512 -0.250462 8.00765 1.08994L10.9099 4.82136C11.4425 5.50612 11.6307 6.39771 11.4203 7.2393L10.5348 10.7812C10.4413 11.1551 10.5509 11.5507 10.8234 11.8232L14.7982 15.798C15.0707 16.0705 15.4663 16.1801 15.8402 16.0866L19.3821 15.2011C20.2237 14.9907 21.1153 15.1789 21.8 15.7115L25.5315 18.6138C26.8719 19.6563 26.9952 21.6377 25.7945 22.8384L24.1216 24.5113C22.9247 25.7082 21.1346 26.2337 19.4662 25.6472C15.3238 24.1908 11.4355 21.8064 8.12521 18.4962C4.81496 15.1859 2.4306 11.2976 0.974218 7.1552C0.38766 5.48684 0.913207 3.69668 2.11007 2.49981L3.78296 0.826921Z",fill:"#141414"}))},w=function(){return e.createElement("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.85896 7.85305C0.543026 7.53712 0.543026 7.02489 0.85896 6.70895L7.33096 0.236954C7.64689 -0.0789795 8.15912 -0.0789795 8.47506 0.236954C8.79099 0.552889 8.79099 1.06512 8.47506 1.38105L3.38411 6.472H19.229C21.463 6.472 23.274 8.28301 23.274 10.517V23.461C23.274 23.9078 22.9118 24.27 22.465 24.27C22.0182 24.27 21.656 23.9078 21.656 23.461V10.517C21.656 9.17661 20.5694 8.09 19.229 8.09H3.38411L8.47506 13.181C8.79099 13.4969 8.79099 14.0091 8.47506 14.3251C8.15912 14.641 7.64689 14.641 7.33096 14.3251L0.85896 7.85305Z",fill:"#141414"}))},f=function(){return e.createElement("svg",{width:"36",height:"28",viewBox:"0 0 36 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M31.7745 0.900854C32.7099 -0.0470194 34.2265 -0.0470194 35.1619 0.900854C36.0859 1.8371 36.0972 3.34793 35.1959 4.29828L16.0585 26.9205C16.0401 26.9438 16.0204 26.966 15.9996 26.9872C15.0641 27.935 13.5475 27.935 12.6121 26.9872L0.966345 15.1863C0.0309227 14.2385 0.0309227 12.7017 0.966344 11.7538C1.90177 10.8059 3.41838 10.8059 4.35381 11.7538L14.2337 21.7652L31.7109 0.97346C31.7307 0.947992 31.7519 0.923746 31.7745 0.900854Z",fill:"#F9F9F9"}))},h=function(){return e.createElement("svg",{width:"43",height:"27",viewBox:"0 0 43 27",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.804932 4.11207C0.804932 1.94314 2.56319 0.184875 4.73212 0.184875H38.7678C40.9367 0.184875 42.695 1.94314 42.695 4.11207V8.03925C42.695 8.76223 42.1089 9.34832 41.3859 9.34832C39.217 9.34832 37.4587 11.1066 37.4587 13.2755C37.4587 15.4444 39.217 17.2027 41.3859 17.2027C42.1089 17.2027 42.695 17.7888 42.695 18.5118V22.4389C42.695 24.6079 40.9367 26.3661 38.7678 26.3661H4.73212C2.56319 26.3661 0.804932 24.6079 0.804932 22.4389V18.5118C0.804932 17.7888 1.39102 17.2027 2.11399 17.2027C4.28292 17.2027 6.04118 15.4444 6.04118 13.2755C6.04118 11.1066 4.28292 9.34832 2.11399 9.34832C1.39102 9.34832 0.804932 8.76223 0.804932 8.03925V4.11207ZM11.2774 1.49394V4.11207H13.8956V1.49394H11.2774ZM13.8956 9.34832V6.73019H11.2774V9.34832H13.8956ZM32.2224 9.34832V6.73019H29.6043V9.34832H32.2224ZM29.6043 4.11207H32.2224V1.49394H29.6043V4.11207ZM13.8956 11.9664H11.2774V14.5846H13.8956V11.9664ZM32.2224 14.5846V11.9664H29.6043V14.5846H32.2224ZM13.8956 17.2027H11.2774V19.8208H13.8956V17.2027ZM32.2224 19.8208V17.2027H29.6043V19.8208H32.2224ZM11.2774 22.4389V25.0571H13.8956V22.4389H11.2774ZM29.6043 25.0571H32.2224V22.4389H29.6043V25.0571Z",fill:"white"}))},L=function(){return e.createElement("svg",{width:"11",height:"31",viewBox:"0 0 11 31",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.51383 9.94016C7.59773 9.94016 8.63967 11.1741 8.63967 13.6418C8.63967 14.7386 8.33806 16.6854 7.73482 19.4822C7.13159 22.279 6.82997 24.0065 6.82997 24.6645C6.82997 25.7613 7.26869 26.5839 8.14612 27.1323C7.76224 28.1743 7.18643 28.9694 6.41868 29.5178C5.67835 30.0388 4.85575 30.2993 3.9509 30.2993C1.62023 30.2993 0.454891 29.0517 0.454891 26.5565C0.454891 25.2678 0.756508 23.2387 1.35974 20.4693C1.99039 17.6999 2.30572 15.9725 2.30572 15.287C2.30572 14.108 1.88072 13.4636 1.0307 13.3539C1.1678 12.3942 1.64765 11.5853 2.47024 10.9273C3.32025 10.2692 4.33478 9.94016 5.51383 9.94016ZM6.08964 8.0482C5.04769 8.0482 4.25252 7.74659 3.70413 7.14335C3.18315 6.5127 2.92266 5.75866 2.92266 4.88123C2.92266 3.81186 3.27912 2.86588 3.99203 2.04329C4.73237 1.19328 5.71947 0.768273 6.95336 0.768273C7.96789 0.768273 8.74935 1.09731 9.29775 1.75538C9.84614 2.41345 10.1203 3.19492 10.1203 4.09977C10.1203 5.16914 9.76388 6.10141 9.05097 6.89658C8.36548 7.66433 7.37837 8.0482 6.08964 8.0482Z",fill:"#F9F9F9"}))},g=function(){return e.createElement("svg",{width:"16",height:"30",viewBox:"0 0 16 30",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M8.36496 18.7176C7.18591 19.2934 6.18509 19.5813 5.3625 19.5813C3.33344 19.5813 2.31891 18.8547 2.31891 17.4015C2.31891 16.5789 2.55198 15.7563 3.01812 14.9337C3.48425 14.0837 4.04635 13.3159 4.70443 12.6304C5.38992 11.9175 6.07541 11.2183 6.76091 10.5328C7.4464 9.81991 8.02221 9.05216 8.48835 8.22957C8.95448 7.40698 9.18755 6.58439 9.18755 5.7618C9.18755 4.58275 8.54319 3.99323 7.25446 3.99323C6.59639 3.99323 5.93831 4.28113 5.28024 4.85695C4.62217 5.40534 4.15603 6.14567 3.88184 7.07794C1.66084 6.80375 0.550342 6.00858 0.550342 4.69243C0.550342 3.4037 1.30438 2.37547 2.81247 1.60771C4.34797 0.812541 6.11654 0.414955 8.11818 0.414955C9.92788 0.414955 11.5594 0.812541 13.0126 1.60771C14.4658 2.37547 15.1925 3.60935 15.1925 5.30937C15.1925 6.48842 14.9457 7.5715 14.4521 8.55861C13.986 9.5183 13.4102 10.3409 12.7247 11.0264C12.0666 11.7119 11.3948 12.3699 10.7093 13.0006C10.0239 13.6313 9.43433 14.3442 8.94077 15.1393C8.47464 15.9071 8.24157 16.716 8.24157 17.566C8.24157 17.9224 8.2827 18.3063 8.36496 18.7176ZM4.00523 29.4113C3.12779 29.4113 2.40117 29.1234 1.82536 28.5476C1.24954 27.9718 0.961638 27.2314 0.961638 26.3266C0.961638 25.2572 1.35922 24.2838 2.15439 23.4064C2.94957 22.5289 3.90926 22.0902 5.03346 22.0902C5.88347 22.0902 6.59639 22.4056 7.1722 23.0362C7.77543 23.6394 8.07705 24.3935 8.07705 25.2983C8.07705 26.3403 7.66576 27.2863 6.84317 28.1363C6.02057 28.9863 5.07459 29.4113 4.00523 29.4113Z",fill:"#F9F9F9"}))},d=function(l){var d,v,p=l.pillData,V=r(t(!1),2),E=V[0],H=V[1],M=r(t(!0),2),b=M[0],x=M[1],Z=r(t(!1),2),y=Z[0],k=Z[1],B=useRef(null),N=p.icon,F=p.message,R=p.cta,A=p.info,I=R||{},T=I.icon,S=I.label,P=I.link,j=A||{},D=j.title,O=j.content,q=j.closeLabel,_=r(t(!0),2),U=_[0],$=_[1];switch(N){case"checkmark":d=f;break;case"coupon":d=h;break;case"info":d=L;break;case"questionmark":d=g;break;default:d=null}switch(U?T:"cross"){case"arrow":v=i;break;case"box":v=a;break;case"checkmark":v=o;break;case"cross":v=c;break;case"mail":v=C;break;case"plus":v=s;break;case"quotation":v=u;break;case"tel":v=m;break;case"undo":v=w;break;default:v=null}var z=function(){B.current&&(clearTimeout(B.current),B.current=null)};return n((function(){return x(!1),setTimeout((function(){return H(!0)}),2500),function(){z()}}),[]),e.createElement("div",{className:b?"magicPill out":E?"magicPill active":"magicPill entry",onMouseEnter:function(){k(!0),z()},onMouseLeave:function(){k(!1),B.current=setTimeout((function(){y||(H(!1),setTimeout((function(){return x(!0)}),500))}),5e3)}},d&&e.createElement(d,{className:"icon"}),e.createElement("p",{className:"message"},F),P&&!A&&e.createElement("a",{className:"CTA",href:P},v&&e.createElement(v,{className:"label"}),e.createElement("span",null,S)),P&&A&&e.createElement("button",{className:"CTA",onClick:function(){$(!U)}},v&&e.createElement(v,{className:"label"}),e.createElement("span",null,U?S:q)),A&&e.createElement("div",{className:U?"info":"info active"},e.createElement("p",{className:"title"},D),e.createElement("div",{className:"content",dangerouslySetInnerHTML:{__html:O}})))};d.defaultProps={pillData:{icon:"info",message:"Hey ! I'm Magic Pill, your omnipotent toolbox !",cta:{icon:"arrow",label:"Discover what I can do",link:null},info:{title:"I'm Magic Pill, let me empower you !",content:"<p>I'll appear sometimes, depending on context, either to send you notifications regarding your experience on this website or to give you indications and hints at what you cn do !</p><p>See you around !</p>",closeLabel:"Close"}}};export{d as default};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/icons/arrow_label.js","../src/icons/box_label.js","../src/icons/checkmark_label.js","../src/icons/cross_label.js","../src/icons/mail_label.js","../src/icons/plus_label.js","../src/icons/quotation_label.js","../src/icons/tel_label.js","../src/icons/undo_label.js","../src/icons/checkmark.js","../src/icons/coupon.js","../src/icons/info.js","../src/icons/questionmark.js","../src/MagicPill.js"],"sourcesContent":["import React from 'react';\n\nconst ArrowLabel = () => (\n <svg width=\"31\" height=\"20\" viewBox=\"0 0 31 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M0.813004 10.2755C0.813004 9.69059 1.28715 9.21645 1.87204 9.21645L26.8501 9.21645L20.1858 2.55207C19.7722 2.1385 19.7722 1.46795 20.1858 1.05438C20.5993 0.640799 21.2699 0.640799 21.6835 1.05438L30.1557 9.52663C30.5693 9.94021 30.5693 10.6107 30.1557 11.0243L21.6835 19.4966C21.2699 19.9102 20.5993 19.9102 20.1858 19.4966C19.7722 19.083 19.7722 18.4125 20.1858 17.9989L26.8501 11.3345L1.87204 11.3345C1.28715 11.3345 0.813004 10.8604 0.813004 10.2755Z\" fill=\"black\"/>\n</svg>\n);\n\nexport default ArrowLabel;","import React from 'react';\n\nconst BoxLabel = () => (\n <svg width=\"27\" height=\"26\" viewBox=\"0 0 27 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M25.5226 4.8102C25.9834 4.99448 26.2855 5.4407 26.2855 5.9369V19.9512C26.2855 20.4474 25.9834 20.8936 25.5226 21.0779L13.7921 25.7701C13.5028 25.8858 13.1801 25.8858 12.8908 25.7701L1.16028 21.0779C0.699563 20.8936 0.397461 20.4474 0.397461 19.9512V5.9369C0.397461 5.4407 0.699563 4.99448 1.16028 4.8102L12.4401 0.298213C12.4451 0.296221 12.4501 0.294245 12.4551 0.292286L12.8908 0.117998C13.1801 0.00227327 13.5028 0.00227283 13.7921 0.117998L14.2279 0.292303C14.2329 0.294256 14.2379 0.296226 14.2428 0.298213L25.5226 4.8102ZM17.2306 3.23602L7.27396 7.21868L3.38482 5.66302L2.01546 6.21076V6.85792L12.5325 11.0647V23.8841L13.3415 24.2077L14.1505 23.8841V11.0647L24.6675 6.85792V6.21076L23.2981 5.66302L13.3415 9.64568L9.45226 8.09L19.4089 4.10734L17.2306 3.23602Z\" fill=\"#141414\"/>\n </svg>\n);\n\nexport default BoxLabel;","import React from 'react';\n\nconst CheckmarkLabel = () => (\n<svg width=\"22\" height=\"18\" viewBox=\"0 0 22 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M18.2019 0.949382C18.9692 0.182085 20.2132 0.182085 20.9805 0.949382C21.7384 1.70727 21.7477 2.93028 21.0084 3.69957L10.55 16.7726C10.5349 16.7915 10.5187 16.8095 10.5017 16.8266C9.73436 17.5939 8.49033 17.5939 7.72303 16.8266L0.790074 9.89367C0.0227749 9.12637 0.022775 7.88233 0.790074 7.11504C1.55737 6.34774 2.80141 6.34774 3.56871 7.11504L9.05315 12.5995L18.1498 1.00816C18.166 0.987539 18.1834 0.967913 18.2019 0.949382Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default CheckmarkLabel;","import React from 'react';\n\nconst CrossLabel = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.808942 1.61705C0.493007 1.30112 0.493007 0.788885 0.808942 0.472951C1.12488 0.157017 1.63711 0.157017 1.95304 0.472951L10.28 8.7999L18.6069 0.472951C18.9229 0.157017 19.4351 0.157017 19.751 0.472951C20.067 0.788885 20.067 1.30112 19.751 1.61705L11.4241 9.944L19.751 18.271C20.067 18.5869 20.067 19.0991 19.751 19.4151C19.4351 19.731 18.9229 19.731 18.6069 19.4151L10.28 11.0881L1.95304 19.4151C1.63711 19.731 1.12488 19.731 0.808943 19.4151C0.493008 19.0991 0.493008 18.5869 0.808943 18.271L9.13589 9.944L0.808942 1.61705Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default CrossLabel;\n","import React from 'react';\n\nconst MailLabel = () => (\n <svg width=\"27\" height=\"20\" viewBox=\"0 0 27 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.701567 2.7527C1.02864 1.31171 2.31737 0.236 3.85734 0.236H23.2733C24.8133 0.236 26.102 1.31171 26.4291 2.7527L13.5653 10.6139L0.701567 2.7527ZM0.621338 4.59988V16.0934L10.0109 10.338L0.621338 4.59988ZM11.5613 11.2854L0.931785 17.8008C1.45073 18.8952 2.56565 19.652 3.85734 19.652H23.2733C24.565 19.652 25.6799 18.8952 26.1989 17.8008L15.5694 11.2854L13.5653 12.5101L11.5613 11.2854ZM17.1198 10.338L26.5093 16.0934V4.59988L17.1198 10.338Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default MailLabel;\n","import React from 'react';\n\nconst PlusLabel = () => (\n <svg width=\"27\" height=\"28\" viewBox=\"0 0 27 28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.8045 14.7234C0.357701 14.7234 -0.00450093 14.3612 -0.00450059 13.9144C-0.00450082 13.4676 0.357702 13.1054 0.8045 13.1054L12.5806 13.1054L12.5806 1.32934C12.5806 0.882544 12.9428 0.520341 13.3896 0.52034C13.8364 0.520341 14.1986 0.882543 14.1986 1.32934L14.1986 13.1054L25.9747 13.1054C26.4215 13.1054 26.7837 13.4676 26.7837 13.9144C26.7837 14.3612 26.4215 14.7234 25.9747 14.7234H14.1986L14.1986 26.4995C14.1986 26.9463 13.8364 27.3085 13.3896 27.3085C12.9428 27.3085 12.5806 26.9463 12.5806 26.4995L12.5806 14.7234L0.8045 14.7234Z\" fill=\"black\"/>\n</svg>\n);\n\nexport default PlusLabel;\n","import React from 'react';\n\nconst QuotationLabel = () => (\n<svg width=\"21\" height=\"26\" viewBox=\"0 0 21 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12.5453 0H3.98136C2.19417 0 0.745361 1.44881 0.745361 3.236V22.652C0.745361 24.4392 2.19417 25.888 3.98136 25.888H16.9254C18.7126 25.888 20.1614 24.4392 20.1614 22.652V7.6161C20.1614 7.18698 19.9909 6.77544 19.6875 6.472L13.6894 0.473901C13.3859 0.170467 12.9744 0 12.5453 0ZM12.8804 5.663V2.427L17.7344 7.281H14.4984C13.6048 7.281 12.8804 6.5566 12.8804 5.663ZM2.36336 14.562H18.5434V16.18H7.21736V19.416H18.5434V21.034H7.21736V24.27H5.59936V21.034H2.36336V19.416H5.59936V16.18H2.36336V14.562Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default QuotationLabel;\n","import React from 'react';\n\nconst TelLabel = () => (\n<svg width=\"27\" height=\"26\" viewBox=\"0 0 27 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M3.78296 0.826921C4.9837 -0.37382 6.96512 -0.250462 8.00765 1.08994L10.9099 4.82136C11.4425 5.50612 11.6307 6.39771 11.4203 7.2393L10.5348 10.7812C10.4413 11.1551 10.5509 11.5507 10.8234 11.8232L14.7982 15.798C15.0707 16.0705 15.4663 16.1801 15.8402 16.0866L19.3821 15.2011C20.2237 14.9907 21.1153 15.1789 21.8 15.7115L25.5315 18.6138C26.8719 19.6563 26.9952 21.6377 25.7945 22.8384L24.1216 24.5113C22.9247 25.7082 21.1346 26.2337 19.4662 25.6472C15.3238 24.1908 11.4355 21.8064 8.12521 18.4962C4.81496 15.1859 2.4306 11.2976 0.974218 7.1552C0.38766 5.48684 0.913207 3.69668 2.11007 2.49981L3.78296 0.826921Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default TelLabel;\n","import React from 'react';\n\nconst UndoLabel = () => (\n<svg width=\"24\" height=\"25\" viewBox=\"0 0 24 25\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M0.85896 7.85305C0.543026 7.53712 0.543026 7.02489 0.85896 6.70895L7.33096 0.236954C7.64689 -0.0789795 8.15912 -0.0789795 8.47506 0.236954C8.79099 0.552889 8.79099 1.06512 8.47506 1.38105L3.38411 6.472H19.229C21.463 6.472 23.274 8.28301 23.274 10.517V23.461C23.274 23.9078 22.9118 24.27 22.465 24.27C22.0182 24.27 21.656 23.9078 21.656 23.461V10.517C21.656 9.17661 20.5694 8.09 19.229 8.09H3.38411L8.47506 13.181C8.79099 13.4969 8.79099 14.0091 8.47506 14.3251C8.15912 14.641 7.64689 14.641 7.33096 14.3251L0.85896 7.85305Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default UndoLabel;\n","import React from 'react';\n\nconst CheckmarkIcon = () => (\n <svg width=\"36\" height=\"28\" viewBox=\"0 0 36 28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M31.7745 0.900854C32.7099 -0.0470194 34.2265 -0.0470194 35.1619 0.900854C36.0859 1.8371 36.0972 3.34793 35.1959 4.29828L16.0585 26.9205C16.0401 26.9438 16.0204 26.966 15.9996 26.9872C15.0641 27.935 13.5475 27.935 12.6121 26.9872L0.966345 15.1863C0.0309227 14.2385 0.0309227 12.7017 0.966344 11.7538C1.90177 10.8059 3.41838 10.8059 4.35381 11.7538L14.2337 21.7652L31.7109 0.97346C31.7307 0.947992 31.7519 0.923746 31.7745 0.900854Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default CheckmarkIcon;","import React from 'react';\n\nconst CouponIcon = () => (\n <svg width=\"43\" height=\"27\" viewBox=\"0 0 43 27\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.804932 4.11207C0.804932 1.94314 2.56319 0.184875 4.73212 0.184875H38.7678C40.9367 0.184875 42.695 1.94314 42.695 4.11207V8.03925C42.695 8.76223 42.1089 9.34832 41.3859 9.34832C39.217 9.34832 37.4587 11.1066 37.4587 13.2755C37.4587 15.4444 39.217 17.2027 41.3859 17.2027C42.1089 17.2027 42.695 17.7888 42.695 18.5118V22.4389C42.695 24.6079 40.9367 26.3661 38.7678 26.3661H4.73212C2.56319 26.3661 0.804932 24.6079 0.804932 22.4389V18.5118C0.804932 17.7888 1.39102 17.2027 2.11399 17.2027C4.28292 17.2027 6.04118 15.4444 6.04118 13.2755C6.04118 11.1066 4.28292 9.34832 2.11399 9.34832C1.39102 9.34832 0.804932 8.76223 0.804932 8.03925V4.11207ZM11.2774 1.49394V4.11207H13.8956V1.49394H11.2774ZM13.8956 9.34832V6.73019H11.2774V9.34832H13.8956ZM32.2224 9.34832V6.73019H29.6043V9.34832H32.2224ZM29.6043 4.11207H32.2224V1.49394H29.6043V4.11207ZM13.8956 11.9664H11.2774V14.5846H13.8956V11.9664ZM32.2224 14.5846V11.9664H29.6043V14.5846H32.2224ZM13.8956 17.2027H11.2774V19.8208H13.8956V17.2027ZM32.2224 19.8208V17.2027H29.6043V19.8208H32.2224ZM11.2774 22.4389V25.0571H13.8956V22.4389H11.2774ZM29.6043 25.0571H32.2224V22.4389H29.6043V25.0571Z\" fill=\"white\"/>\n</svg>\n);\n\nexport default CouponIcon;\n","import React from 'react';\n\nconst InfoIcon = () => (\n <svg width=\"11\" height=\"31\" viewBox=\"0 0 11 31\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.51383 9.94016C7.59773 9.94016 8.63967 11.1741 8.63967 13.6418C8.63967 14.7386 8.33806 16.6854 7.73482 19.4822C7.13159 22.279 6.82997 24.0065 6.82997 24.6645C6.82997 25.7613 7.26869 26.5839 8.14612 27.1323C7.76224 28.1743 7.18643 28.9694 6.41868 29.5178C5.67835 30.0388 4.85575 30.2993 3.9509 30.2993C1.62023 30.2993 0.454891 29.0517 0.454891 26.5565C0.454891 25.2678 0.756508 23.2387 1.35974 20.4693C1.99039 17.6999 2.30572 15.9725 2.30572 15.287C2.30572 14.108 1.88072 13.4636 1.0307 13.3539C1.1678 12.3942 1.64765 11.5853 2.47024 10.9273C3.32025 10.2692 4.33478 9.94016 5.51383 9.94016ZM6.08964 8.0482C5.04769 8.0482 4.25252 7.74659 3.70413 7.14335C3.18315 6.5127 2.92266 5.75866 2.92266 4.88123C2.92266 3.81186 3.27912 2.86588 3.99203 2.04329C4.73237 1.19328 5.71947 0.768273 6.95336 0.768273C7.96789 0.768273 8.74935 1.09731 9.29775 1.75538C9.84614 2.41345 10.1203 3.19492 10.1203 4.09977C10.1203 5.16914 9.76388 6.10141 9.05097 6.89658C8.36548 7.66433 7.37837 8.0482 6.08964 8.0482Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default InfoIcon;\n","import React from 'react';\n\nconst QuestionmarkIcon = () => (\n <svg width=\"16\" height=\"30\" viewBox=\"0 0 16 30\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M8.36496 18.7176C7.18591 19.2934 6.18509 19.5813 5.3625 19.5813C3.33344 19.5813 2.31891 18.8547 2.31891 17.4015C2.31891 16.5789 2.55198 15.7563 3.01812 14.9337C3.48425 14.0837 4.04635 13.3159 4.70443 12.6304C5.38992 11.9175 6.07541 11.2183 6.76091 10.5328C7.4464 9.81991 8.02221 9.05216 8.48835 8.22957C8.95448 7.40698 9.18755 6.58439 9.18755 5.7618C9.18755 4.58275 8.54319 3.99323 7.25446 3.99323C6.59639 3.99323 5.93831 4.28113 5.28024 4.85695C4.62217 5.40534 4.15603 6.14567 3.88184 7.07794C1.66084 6.80375 0.550342 6.00858 0.550342 4.69243C0.550342 3.4037 1.30438 2.37547 2.81247 1.60771C4.34797 0.812541 6.11654 0.414955 8.11818 0.414955C9.92788 0.414955 11.5594 0.812541 13.0126 1.60771C14.4658 2.37547 15.1925 3.60935 15.1925 5.30937C15.1925 6.48842 14.9457 7.5715 14.4521 8.55861C13.986 9.5183 13.4102 10.3409 12.7247 11.0264C12.0666 11.7119 11.3948 12.3699 10.7093 13.0006C10.0239 13.6313 9.43433 14.3442 8.94077 15.1393C8.47464 15.9071 8.24157 16.716 8.24157 17.566C8.24157 17.9224 8.2827 18.3063 8.36496 18.7176ZM4.00523 29.4113C3.12779 29.4113 2.40117 29.1234 1.82536 28.5476C1.24954 27.9718 0.961638 27.2314 0.961638 26.3266C0.961638 25.2572 1.35922 24.2838 2.15439 23.4064C2.94957 22.5289 3.90926 22.0902 5.03346 22.0902C5.88347 22.0902 6.59639 22.4056 7.1722 23.0362C7.77543 23.6394 8.07705 24.3935 8.07705 25.2983C8.07705 26.3403 7.66576 27.2863 6.84317 28.1363C6.02057 28.9863 5.07459 29.4113 4.00523 29.4113Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default QuestionmarkIcon;\n","import React, { useEffect, useState } from 'react';\nimport './magicpill.css';\n\nimport ArrowLabel from './icons/arrow_label.js';\nimport BoxLabel from './icons/box_label.js';\nimport CheckmarkLabel from './icons/checkmark_label.js';\nimport CrossLabel from './icons/cross_label.js';\nimport MailLabel from './icons/mail_label.js';\nimport PlusLabel from './icons/plus_label.js';\nimport QuotationLabel from './icons/quotation_label.js';\nimport TelLabel from './icons/tel_label.js';\nimport UndoLabel from './icons/undo_label.js';\n\nimport CheckmarkIcon from './icons/checkmark.js';\nimport CouponIcon from './icons/coupon.js';\nimport InfoIcon from './icons/info.js';\nimport QuestionmarkIcon from './icons/questionmark.js';\n\nconst MagicPill = ({ pillData }) => {\n const [active, setActive] = useState(false)\n const [exit, setExit] = useState(true)\n const { icon, message, cta, info } = pillData;\n const { icon: ctaIcon, label: ctaLabel, link: ctaLink } = cta || {};\n const { title, content, closeLabel } = info || {};\n\n const [collapsed, setCollapsed] = useState(true);\n\n let IconComponent;\n let CTAIconComponent;\n\n switch (icon) {\n case 'checkmark':\n IconComponent = CheckmarkIcon;\n break;\n case 'coupon':\n IconComponent = CouponIcon;\n break;\n case 'info':\n IconComponent = InfoIcon;\n break;\n case 'questionmark':\n IconComponent = QuestionmarkIcon;\n break;\n default:\n IconComponent = null;\n }\n\n const currentCTAIcon = collapsed ? ctaIcon : 'cross';\n switch (currentCTAIcon) {\n case 'arrow':\n CTAIconComponent = ArrowLabel;\n break;\n case 'box':\n CTAIconComponent = BoxLabel;\n break;\n case 'checkmark':\n CTAIconComponent = CheckmarkLabel;\n break;\n case 'cross':\n CTAIconComponent = CrossLabel;\n break;\n case 'mail':\n CTAIconComponent = MailLabel;\n break;\n case 'plus':\n CTAIconComponent = PlusLabel;\n break;\n case 'quotation':\n CTAIconComponent = QuotationLabel;\n break;\n case 'tel':\n CTAIconComponent = TelLabel;\n break;\n case 'undo':\n CTAIconComponent = UndoLabel;\n break;\n default:\n CTAIconComponent = null;\n }\n\n const displayMagicPill = () => {\n setExit(false)\n setTimeout(() => setActive(true), 2500)\n setTimeout(() => {setActive(false); setExit(true)}, 7500)\n }\n\n useEffect(() => {\n displayMagicPill();\n }, []);\n\n return (\n <div className={exit ? 'magicPill out' : active ? 'magicPill active' : 'magicPill entry'}>\n {IconComponent && <IconComponent className=\"icon\"/>}\n <p className='message'>{message}</p>\n {ctaLink && !info && <a className='CTA' href={ctaLink}>{CTAIconComponent && <CTAIconComponent className=\"label\" />}<span>{ctaLabel}</span></a>}\n {ctaLink && info && \n <button \n className='CTA' \n onClick={() => {setCollapsed(!collapsed)}}>\n {CTAIconComponent && <CTAIconComponent className=\"label\" />}\n <span>{collapsed ? ctaLabel : closeLabel}</span>\n </button>\n}\n {info && <div className={!collapsed ? 'info active' : 'info'}><p className='title'>{title}</p><div className='content' dangerouslySetInnerHTML={ {__html: content} }></div></div>}\n </div>\n );\n};\n\nMagicPill.defaultProps = {\n pillData: {\n icon: 'info',\n message: 'Hey ! I\\'m Magic Pill, your omnipotent toolbox !',\n cta: {\n icon: 'arrow',\n label: 'Discover what I can do',\n link: null\n },\n info: {\n title: 'I\\'m Magic Pill, let me empower you !',\n content: '<p>I\\'ll appear sometimes, depending on context, either to send you notifications regarding your experience on this website or to give you indications and hints at what you cn do !</p><p>See you around !</p>',\n closeLabel: 'Close'\n }\n }\n};\n\nexport default MagicPill;"],"names":["ArrowLabel","React","createElement","width","height","viewBox","fill","xmlns","fillRule","clipRule","d","BoxLabel","CheckmarkLabel","CrossLabel","MailLabel","PlusLabel","QuotationLabel","TelLabel","UndoLabel","CheckmarkIcon","CouponIcon","InfoIcon","QuestionmarkIcon","MagicPill","_ref","IconComponent","CTAIconComponent","pillData","_useState2","_slicedToArray","useState","active","setActive","_useState4","exit","setExit","icon","message","cta","info","_ref2","ctaIcon","ctaLabel","label","ctaLink","link","_ref3","title","content","closeLabel","_useState6","collapsed","setCollapsed","useEffect","setTimeout","className","href","onClick","dangerouslySetInnerHTML","__html","defaultProps"],"mappings":"mjCAEA,IAAMA,EAAa,WAAH,OACdC,EAAAC,cAAA,MAAA,CAAKC,MAAM,KAAKC,OAAO,KAAKC,QAAQ,YAAYC,KAAK,OAAOC,MAAM,8BACpEN,EAAAC,cAAA,OAAA,CAAMM,SAAS,UAAUC,SAAS,UAAUC,EAAE,wcAAwcJ,KAAK,UACrf,ECHAK,EAAW,WAAH,OACbV,EAAAC,cAAA,MAAA,CAAKC,MAAM,KAAKC,OAAO,KAAKC,QAAQ,YAAYC,KAAK,OAAOC,MAAM,8BAClEN,EAAAC,cAAA,OAAA,CAAMM,SAAS,UAAUC,SAAS,UAAUC,EAAE,gwBAAgwBJ,KAAK,YAC7yB,ECHDM,EAAiB,WAAH,OACpBX,EAA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ACjDtD,EAAAC,cAAA,OAAA,KAAOiD,EAAYT,EAAWO,IAG3BV,GAAQtC,EAAAC,cAAA,MAAA,CAAKqD,UAAYJ,EAA4B,OAAhB,eAAwBlD,EAAAC,cAAA,IAAA,CAAGqD,UAAU,SAASR,GAAU9C,EAAAC,cAAA,MAAA,CAAKqD,UAAU,UAAUG,wBAA0B,CAACC,OAAQX,MAGhK,EAEAzB,EAAUqC,aAAe,CACvBjC,SAAU,CACRS,KAAM,OACNC,QAAS,kDACTC,IAAK,CACHF,KAAM,QACNO,MAAO,yBACPE,KAAM,MAERN,KAAM,CACJQ,MAAO,uCACPC,QAAS,iNACTC,WAAY"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/icons/arrow_label.js","../src/icons/box_label.js","../src/icons/checkmark_label.js","../src/icons/cross_label.js","../src/icons/mail_label.js","../src/icons/plus_label.js","../src/icons/quotation_label.js","../src/icons/tel_label.js","../src/icons/undo_label.js","../src/icons/checkmark.js","../src/icons/coupon.js","../src/icons/info.js","../src/icons/questionmark.js","../src/MagicPill.js"],"sourcesContent":["import React from 'react';\n\nconst ArrowLabel = () => (\n <svg width=\"31\" height=\"20\" viewBox=\"0 0 31 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M0.813004 10.2755C0.813004 9.69059 1.28715 9.21645 1.87204 9.21645L26.8501 9.21645L20.1858 2.55207C19.7722 2.1385 19.7722 1.46795 20.1858 1.05438C20.5993 0.640799 21.2699 0.640799 21.6835 1.05438L30.1557 9.52663C30.5693 9.94021 30.5693 10.6107 30.1557 11.0243L21.6835 19.4966C21.2699 19.9102 20.5993 19.9102 20.1858 19.4966C19.7722 19.083 19.7722 18.4125 20.1858 17.9989L26.8501 11.3345L1.87204 11.3345C1.28715 11.3345 0.813004 10.8604 0.813004 10.2755Z\" fill=\"black\"/>\n</svg>\n);\n\nexport default ArrowLabel;","import React from 'react';\n\nconst BoxLabel = () => (\n <svg width=\"27\" height=\"26\" viewBox=\"0 0 27 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M25.5226 4.8102C25.9834 4.99448 26.2855 5.4407 26.2855 5.9369V19.9512C26.2855 20.4474 25.9834 20.8936 25.5226 21.0779L13.7921 25.7701C13.5028 25.8858 13.1801 25.8858 12.8908 25.7701L1.16028 21.0779C0.699563 20.8936 0.397461 20.4474 0.397461 19.9512V5.9369C0.397461 5.4407 0.699563 4.99448 1.16028 4.8102L12.4401 0.298213C12.4451 0.296221 12.4501 0.294245 12.4551 0.292286L12.8908 0.117998C13.1801 0.00227327 13.5028 0.00227283 13.7921 0.117998L14.2279 0.292303C14.2329 0.294256 14.2379 0.296226 14.2428 0.298213L25.5226 4.8102ZM17.2306 3.23602L7.27396 7.21868L3.38482 5.66302L2.01546 6.21076V6.85792L12.5325 11.0647V23.8841L13.3415 24.2077L14.1505 23.8841V11.0647L24.6675 6.85792V6.21076L23.2981 5.66302L13.3415 9.64568L9.45226 8.09L19.4089 4.10734L17.2306 3.23602Z\" fill=\"#141414\"/>\n </svg>\n);\n\nexport default BoxLabel;","import React from 'react';\n\nconst CheckmarkLabel = () => (\n<svg width=\"22\" height=\"18\" viewBox=\"0 0 22 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M18.2019 0.949382C18.9692 0.182085 20.2132 0.182085 20.9805 0.949382C21.7384 1.70727 21.7477 2.93028 21.0084 3.69957L10.55 16.7726C10.5349 16.7915 10.5187 16.8095 10.5017 16.8266C9.73436 17.5939 8.49033 17.5939 7.72303 16.8266L0.790074 9.89367C0.0227749 9.12637 0.022775 7.88233 0.790074 7.11504C1.55737 6.34774 2.80141 6.34774 3.56871 7.11504L9.05315 12.5995L18.1498 1.00816C18.166 0.987539 18.1834 0.967913 18.2019 0.949382Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default CheckmarkLabel;","import React from 'react';\n\nconst CrossLabel = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.808942 1.61705C0.493007 1.30112 0.493007 0.788885 0.808942 0.472951C1.12488 0.157017 1.63711 0.157017 1.95304 0.472951L10.28 8.7999L18.6069 0.472951C18.9229 0.157017 19.4351 0.157017 19.751 0.472951C20.067 0.788885 20.067 1.30112 19.751 1.61705L11.4241 9.944L19.751 18.271C20.067 18.5869 20.067 19.0991 19.751 19.4151C19.4351 19.731 18.9229 19.731 18.6069 19.4151L10.28 11.0881L1.95304 19.4151C1.63711 19.731 1.12488 19.731 0.808943 19.4151C0.493008 19.0991 0.493008 18.5869 0.808943 18.271L9.13589 9.944L0.808942 1.61705Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default CrossLabel;\n","import React from 'react';\n\nconst MailLabel = () => (\n <svg width=\"27\" height=\"20\" viewBox=\"0 0 27 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.701567 2.7527C1.02864 1.31171 2.31737 0.236 3.85734 0.236H23.2733C24.8133 0.236 26.102 1.31171 26.4291 2.7527L13.5653 10.6139L0.701567 2.7527ZM0.621338 4.59988V16.0934L10.0109 10.338L0.621338 4.59988ZM11.5613 11.2854L0.931785 17.8008C1.45073 18.8952 2.56565 19.652 3.85734 19.652H23.2733C24.565 19.652 25.6799 18.8952 26.1989 17.8008L15.5694 11.2854L13.5653 12.5101L11.5613 11.2854ZM17.1198 10.338L26.5093 16.0934V4.59988L17.1198 10.338Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default MailLabel;\n","import React from 'react';\n\nconst PlusLabel = () => (\n <svg width=\"27\" height=\"28\" viewBox=\"0 0 27 28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.8045 14.7234C0.357701 14.7234 -0.00450093 14.3612 -0.00450059 13.9144C-0.00450082 13.4676 0.357702 13.1054 0.8045 13.1054L12.5806 13.1054L12.5806 1.32934C12.5806 0.882544 12.9428 0.520341 13.3896 0.52034C13.8364 0.520341 14.1986 0.882543 14.1986 1.32934L14.1986 13.1054L25.9747 13.1054C26.4215 13.1054 26.7837 13.4676 26.7837 13.9144C26.7837 14.3612 26.4215 14.7234 25.9747 14.7234H14.1986L14.1986 26.4995C14.1986 26.9463 13.8364 27.3085 13.3896 27.3085C12.9428 27.3085 12.5806 26.9463 12.5806 26.4995L12.5806 14.7234L0.8045 14.7234Z\" fill=\"black\"/>\n</svg>\n);\n\nexport default PlusLabel;\n","import React from 'react';\n\nconst QuotationLabel = () => (\n<svg width=\"21\" height=\"26\" viewBox=\"0 0 21 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12.5453 0H3.98136C2.19417 0 0.745361 1.44881 0.745361 3.236V22.652C0.745361 24.4392 2.19417 25.888 3.98136 25.888H16.9254C18.7126 25.888 20.1614 24.4392 20.1614 22.652V7.6161C20.1614 7.18698 19.9909 6.77544 19.6875 6.472L13.6894 0.473901C13.3859 0.170467 12.9744 0 12.5453 0ZM12.8804 5.663V2.427L17.7344 7.281H14.4984C13.6048 7.281 12.8804 6.5566 12.8804 5.663ZM2.36336 14.562H18.5434V16.18H7.21736V19.416H18.5434V21.034H7.21736V24.27H5.59936V21.034H2.36336V19.416H5.59936V16.18H2.36336V14.562Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default QuotationLabel;\n","import React from 'react';\n\nconst TelLabel = () => (\n<svg width=\"27\" height=\"26\" viewBox=\"0 0 27 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M3.78296 0.826921C4.9837 -0.37382 6.96512 -0.250462 8.00765 1.08994L10.9099 4.82136C11.4425 5.50612 11.6307 6.39771 11.4203 7.2393L10.5348 10.7812C10.4413 11.1551 10.5509 11.5507 10.8234 11.8232L14.7982 15.798C15.0707 16.0705 15.4663 16.1801 15.8402 16.0866L19.3821 15.2011C20.2237 14.9907 21.1153 15.1789 21.8 15.7115L25.5315 18.6138C26.8719 19.6563 26.9952 21.6377 25.7945 22.8384L24.1216 24.5113C22.9247 25.7082 21.1346 26.2337 19.4662 25.6472C15.3238 24.1908 11.4355 21.8064 8.12521 18.4962C4.81496 15.1859 2.4306 11.2976 0.974218 7.1552C0.38766 5.48684 0.913207 3.69668 2.11007 2.49981L3.78296 0.826921Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default TelLabel;\n","import React from 'react';\n\nconst UndoLabel = () => (\n<svg width=\"24\" height=\"25\" viewBox=\"0 0 24 25\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M0.85896 7.85305C0.543026 7.53712 0.543026 7.02489 0.85896 6.70895L7.33096 0.236954C7.64689 -0.0789795 8.15912 -0.0789795 8.47506 0.236954C8.79099 0.552889 8.79099 1.06512 8.47506 1.38105L3.38411 6.472H19.229C21.463 6.472 23.274 8.28301 23.274 10.517V23.461C23.274 23.9078 22.9118 24.27 22.465 24.27C22.0182 24.27 21.656 23.9078 21.656 23.461V10.517C21.656 9.17661 20.5694 8.09 19.229 8.09H3.38411L8.47506 13.181C8.79099 13.4969 8.79099 14.0091 8.47506 14.3251C8.15912 14.641 7.64689 14.641 7.33096 14.3251L0.85896 7.85305Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default UndoLabel;\n","import React from 'react';\n\nconst CheckmarkIcon = () => (\n <svg width=\"36\" height=\"28\" viewBox=\"0 0 36 28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M31.7745 0.900854C32.7099 -0.0470194 34.2265 -0.0470194 35.1619 0.900854C36.0859 1.8371 36.0972 3.34793 35.1959 4.29828L16.0585 26.9205C16.0401 26.9438 16.0204 26.966 15.9996 26.9872C15.0641 27.935 13.5475 27.935 12.6121 26.9872L0.966345 15.1863C0.0309227 14.2385 0.0309227 12.7017 0.966344 11.7538C1.90177 10.8059 3.41838 10.8059 4.35381 11.7538L14.2337 21.7652L31.7109 0.97346C31.7307 0.947992 31.7519 0.923746 31.7745 0.900854Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default CheckmarkIcon;","import React from 'react';\n\nconst CouponIcon = () => (\n <svg width=\"43\" height=\"27\" viewBox=\"0 0 43 27\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.804932 4.11207C0.804932 1.94314 2.56319 0.184875 4.73212 0.184875H38.7678C40.9367 0.184875 42.695 1.94314 42.695 4.11207V8.03925C42.695 8.76223 42.1089 9.34832 41.3859 9.34832C39.217 9.34832 37.4587 11.1066 37.4587 13.2755C37.4587 15.4444 39.217 17.2027 41.3859 17.2027C42.1089 17.2027 42.695 17.7888 42.695 18.5118V22.4389C42.695 24.6079 40.9367 26.3661 38.7678 26.3661H4.73212C2.56319 26.3661 0.804932 24.6079 0.804932 22.4389V18.5118C0.804932 17.7888 1.39102 17.2027 2.11399 17.2027C4.28292 17.2027 6.04118 15.4444 6.04118 13.2755C6.04118 11.1066 4.28292 9.34832 2.11399 9.34832C1.39102 9.34832 0.804932 8.76223 0.804932 8.03925V4.11207ZM11.2774 1.49394V4.11207H13.8956V1.49394H11.2774ZM13.8956 9.34832V6.73019H11.2774V9.34832H13.8956ZM32.2224 9.34832V6.73019H29.6043V9.34832H32.2224ZM29.6043 4.11207H32.2224V1.49394H29.6043V4.11207ZM13.8956 11.9664H11.2774V14.5846H13.8956V11.9664ZM32.2224 14.5846V11.9664H29.6043V14.5846H32.2224ZM13.8956 17.2027H11.2774V19.8208H13.8956V17.2027ZM32.2224 19.8208V17.2027H29.6043V19.8208H32.2224ZM11.2774 22.4389V25.0571H13.8956V22.4389H11.2774ZM29.6043 25.0571H32.2224V22.4389H29.6043V25.0571Z\" fill=\"white\"/>\n</svg>\n);\n\nexport default CouponIcon;\n","import React from 'react';\n\nconst InfoIcon = () => (\n <svg width=\"11\" height=\"31\" viewBox=\"0 0 11 31\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.51383 9.94016C7.59773 9.94016 8.63967 11.1741 8.63967 13.6418C8.63967 14.7386 8.33806 16.6854 7.73482 19.4822C7.13159 22.279 6.82997 24.0065 6.82997 24.6645C6.82997 25.7613 7.26869 26.5839 8.14612 27.1323C7.76224 28.1743 7.18643 28.9694 6.41868 29.5178C5.67835 30.0388 4.85575 30.2993 3.9509 30.2993C1.62023 30.2993 0.454891 29.0517 0.454891 26.5565C0.454891 25.2678 0.756508 23.2387 1.35974 20.4693C1.99039 17.6999 2.30572 15.9725 2.30572 15.287C2.30572 14.108 1.88072 13.4636 1.0307 13.3539C1.1678 12.3942 1.64765 11.5853 2.47024 10.9273C3.32025 10.2692 4.33478 9.94016 5.51383 9.94016ZM6.08964 8.0482C5.04769 8.0482 4.25252 7.74659 3.70413 7.14335C3.18315 6.5127 2.92266 5.75866 2.92266 4.88123C2.92266 3.81186 3.27912 2.86588 3.99203 2.04329C4.73237 1.19328 5.71947 0.768273 6.95336 0.768273C7.96789 0.768273 8.74935 1.09731 9.29775 1.75538C9.84614 2.41345 10.1203 3.19492 10.1203 4.09977C10.1203 5.16914 9.76388 6.10141 9.05097 6.89658C8.36548 7.66433 7.37837 8.0482 6.08964 8.0482Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default InfoIcon;\n","import React from 'react';\n\nconst QuestionmarkIcon = () => (\n <svg width=\"16\" height=\"30\" viewBox=\"0 0 16 30\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M8.36496 18.7176C7.18591 19.2934 6.18509 19.5813 5.3625 19.5813C3.33344 19.5813 2.31891 18.8547 2.31891 17.4015C2.31891 16.5789 2.55198 15.7563 3.01812 14.9337C3.48425 14.0837 4.04635 13.3159 4.70443 12.6304C5.38992 11.9175 6.07541 11.2183 6.76091 10.5328C7.4464 9.81991 8.02221 9.05216 8.48835 8.22957C8.95448 7.40698 9.18755 6.58439 9.18755 5.7618C9.18755 4.58275 8.54319 3.99323 7.25446 3.99323C6.59639 3.99323 5.93831 4.28113 5.28024 4.85695C4.62217 5.40534 4.15603 6.14567 3.88184 7.07794C1.66084 6.80375 0.550342 6.00858 0.550342 4.69243C0.550342 3.4037 1.30438 2.37547 2.81247 1.60771C4.34797 0.812541 6.11654 0.414955 8.11818 0.414955C9.92788 0.414955 11.5594 0.812541 13.0126 1.60771C14.4658 2.37547 15.1925 3.60935 15.1925 5.30937C15.1925 6.48842 14.9457 7.5715 14.4521 8.55861C13.986 9.5183 13.4102 10.3409 12.7247 11.0264C12.0666 11.7119 11.3948 12.3699 10.7093 13.0006C10.0239 13.6313 9.43433 14.3442 8.94077 15.1393C8.47464 15.9071 8.24157 16.716 8.24157 17.566C8.24157 17.9224 8.2827 18.3063 8.36496 18.7176ZM4.00523 29.4113C3.12779 29.4113 2.40117 29.1234 1.82536 28.5476C1.24954 27.9718 0.961638 27.2314 0.961638 26.3266C0.961638 25.2572 1.35922 24.2838 2.15439 23.4064C2.94957 22.5289 3.90926 22.0902 5.03346 22.0902C5.88347 22.0902 6.59639 22.4056 7.1722 23.0362C7.77543 23.6394 8.07705 24.3935 8.07705 25.2983C8.07705 26.3403 7.66576 27.2863 6.84317 28.1363C6.02057 28.9863 5.07459 29.4113 4.00523 29.4113Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default QuestionmarkIcon;\n","import React, { useEffect, useState } from 'react';\nimport './magicpill.css';\n\nimport ArrowLabel from './icons/arrow_label.js';\nimport BoxLabel from './icons/box_label.js';\nimport CheckmarkLabel from './icons/checkmark_label.js';\nimport CrossLabel from './icons/cross_label.js';\nimport MailLabel from './icons/mail_label.js';\nimport PlusLabel from './icons/plus_label.js';\nimport QuotationLabel from './icons/quotation_label.js';\nimport TelLabel from './icons/tel_label.js';\nimport UndoLabel from './icons/undo_label.js';\n\nimport CheckmarkIcon from './icons/checkmark.js';\nimport CouponIcon from './icons/coupon.js';\nimport InfoIcon from './icons/info.js';\nimport QuestionmarkIcon from './icons/questionmark.js';\n\nconst MagicPill = ({ pillData }) => {\n const [active, setActive] = useState(false);\n const [exit, setExit] = useState(true);\n const [hovering, setHovering] = useState(false);\n const timeoutRef = useRef(null);\n const { icon, message, cta, info } = pillData;\n const { icon: ctaIcon, label: ctaLabel, link: ctaLink } = cta || {};\n const { title, content, closeLabel } = info || {};\n\n const [collapsed, setCollapsed] = useState(true);\n\n let IconComponent;\n let CTAIconComponent;\n\n switch (icon) {\n case 'checkmark':\n IconComponent = CheckmarkIcon;\n break;\n case 'coupon':\n IconComponent = CouponIcon;\n break;\n case 'info':\n IconComponent = InfoIcon;\n break;\n case 'questionmark':\n IconComponent = QuestionmarkIcon;\n break;\n default:\n IconComponent = null;\n }\n\n const currentCTAIcon = collapsed ? ctaIcon : 'cross';\n switch (currentCTAIcon) {\n case 'arrow':\n CTAIconComponent = ArrowLabel;\n break;\n case 'box':\n CTAIconComponent = BoxLabel;\n break;\n case 'checkmark':\n CTAIconComponent = CheckmarkLabel;\n break;\n case 'cross':\n CTAIconComponent = CrossLabel;\n break;\n case 'mail':\n CTAIconComponent = MailLabel;\n break;\n case 'plus':\n CTAIconComponent = PlusLabel;\n break;\n case 'quotation':\n CTAIconComponent = QuotationLabel;\n break;\n case 'tel':\n CTAIconComponent = TelLabel;\n break;\n case 'undo':\n CTAIconComponent = UndoLabel;\n break;\n default:\n CTAIconComponent = null;\n }\n\n const displayMagicPill = () => {\n setExit(false);\n setTimeout(() => setActive(true), 2500);\n };\n\n const startExitAnimation = () => {\n timeoutRef.current = setTimeout(() => {\n if (!hovering) {\n setActive(false);\n setTimeout(() => setExit(true), 500);\n }\n }, 5000);\n };\n\n const clearExitAnimation = () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n\n const handleMouseEnter = () => {\n setHovering(true);\n clearExitAnimation();\n };\n\n const handleMouseLeave = () => {\n setHovering(false);\n startExitAnimation();\n };\n\n useEffect(() => {\n displayMagicPill();\n\n return () => {\n clearExitAnimation();\n };\n }, []);\n\n return (\n <div className={exit ? 'magicPill out' : active ? 'magicPill active' : 'magicPill entry'} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} >\n {IconComponent && <IconComponent className=\"icon\"/>}\n <p className='message'>{message}</p>\n {ctaLink && !info && <a className='CTA' href={ctaLink}>{CTAIconComponent && <CTAIconComponent className=\"label\" />}<span>{ctaLabel}</span></a>}\n {ctaLink && info && \n <button \n className='CTA' \n onClick={() => {setCollapsed(!collapsed)}}>\n {CTAIconComponent && <CTAIconComponent className=\"label\" />}\n <span>{collapsed ? ctaLabel : closeLabel}</span>\n </button>\n}\n {info && <div className={!collapsed ? 'info active' : 'info'}><p className='title'>{title}</p><div className='content' dangerouslySetInnerHTML={ {__html: content} }></div></div>}\n </div>\n );\n};\n\nMagicPill.defaultProps = {\n pillData: {\n icon: 'info',\n message: 'Hey ! I\\'m Magic Pill, your omnipotent toolbox !',\n cta: {\n icon: 'arrow',\n label: 'Discover what I can do',\n link: null\n },\n info: {\n title: 'I\\'m Magic Pill, let me empower you !',\n content: '<p>I\\'ll appear sometimes, depending on context, either to send you notifications regarding your experience on this website or to give you indications and hints at what you cn do !</p><p>See you around !</p>',\n closeLabel: 'Close'\n }\n }\n};\n\nexport default MagicPill;"],"names":["ArrowLabel","React","createElement","width","height","viewBox","fill","xmlns","fillRule","clipRule","d","BoxLabel","CheckmarkLabel","CrossLabel","MailLabel","PlusLabel","QuotationLabel","TelLabel","UndoLabel","CheckmarkIcon","CouponIcon","InfoIcon","QuestionmarkIcon","MagicPill","_ref","IconComponent","CTAIconComponent","pillData","_useState2","_slicedToArray","useState","active","setActive","_useState4","exit","setExit","_useState6","hovering","setHovering","timeoutRef","useRef","icon","message","cta","info","_ref2","ctaIcon","ctaLabel","label","ctaLink","link","_ref3","title","content","closeLabel","_useState8","collapsed","setCollapsed","clearExitAnimation","current","clearTimeout","useEffect","setTime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AAO,uCACPC,QAAS,iNACTC,WAAY"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=t(e);function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var n,a,r,i,o=[],c=!0,u=!1;try{if(r=(l=l.call(e)).next,0===t){if(Object(l)!==l)return;c=!1}else for(;!(c=(n=r.call(l)).done)&&(o.push(n.value),o.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=l.return&&(i=l.return(),Object(i)!==i))return}finally{if(u)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var l={}.toString.call(e).slice(8,-1);return"Object"===l&&e.constructor&&(l=e.constructor.name),"Map"===l||"Set"===l?Array.from(e):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?n(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var r=function(){return l.default.createElement("svg",{width:"31",height:"20",viewBox:"0 0 31 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.813004 10.2755C0.813004 9.69059 1.28715 9.21645 1.87204 9.21645L26.8501 9.21645L20.1858 2.55207C19.7722 2.1385 19.7722 1.46795 20.1858 1.05438C20.5993 0.640799 21.2699 0.640799 21.6835 1.05438L30.1557 9.52663C30.5693 9.94021 30.5693 10.6107 30.1557 11.0243L21.6835 19.4966C21.2699 19.9102 20.5993 19.9102 20.1858 19.4966C19.7722 19.083 19.7722 18.4125 20.1858 17.9989L26.8501 11.3345L1.87204 11.3345C1.28715 11.3345 0.813004 10.8604 0.813004 10.2755Z",fill:"black"}))},i=function(){return l.default.createElement("svg",{width:"27",height:"26",viewBox:"0 0 27 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M25.5226 4.8102C25.9834 4.99448 26.2855 5.4407 26.2855 5.9369V19.9512C26.2855 20.4474 25.9834 20.8936 25.5226 21.0779L13.7921 25.7701C13.5028 25.8858 13.1801 25.8858 12.8908 25.7701L1.16028 21.0779C0.699563 20.8936 0.397461 20.4474 0.397461 19.9512V5.9369C0.397461 5.4407 0.699563 4.99448 1.16028 4.8102L12.4401 0.298213C12.4451 0.296221 12.4501 0.294245 12.4551 0.292286L12.8908 0.117998C13.1801 0.00227327 13.5028 0.00227283 13.7921 0.117998L14.2279 0.292303C14.2329 0.294256 14.2379 0.296226 14.2428 0.298213L25.5226 4.8102ZM17.2306 3.23602L7.27396 7.21868L3.38482 5.66302L2.01546 6.21076V6.85792L12.5325 11.0647V23.8841L13.3415 24.2077L14.1505 23.8841V11.0647L24.6675 6.85792V6.21076L23.2981 5.66302L13.3415 9.64568L9.45226 8.09L19.4089 4.10734L17.2306 3.23602Z",fill:"#141414"}))},o=function(){return l.default.createElement("svg",{width:"22",height:"18",viewBox:"0 0 22 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M18.2019 0.949382C18.9692 0.182085 20.2132 0.182085 20.9805 0.949382C21.7384 1.70727 21.7477 2.93028 21.0084 3.69957L10.55 16.7726C10.5349 16.7915 10.5187 16.8095 10.5017 16.8266C9.73436 17.5939 8.49033 17.5939 7.72303 16.8266L0.790074 9.89367C0.0227749 9.12637 0.022775 7.88233 0.790074 7.11504C1.55737 6.34774 2.80141 6.34774 3.56871 7.11504L9.05315 12.5995L18.1498 1.00816C18.166 0.987539 18.1834 0.967913 18.2019 0.949382Z",fill:"#141414"}))},c=function(){return l.default.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M0.808942 1.61705C0.493007 1.30112 0.493007 0.788885 0.808942 0.472951C1.12488 0.157017 1.63711 0.157017 1.95304 0.472951L10.28 8.7999L18.6069 0.472951C18.9229 0.157017 19.4351 0.157017 19.751 0.472951C20.067 0.788885 20.067 1.30112 19.751 1.61705L11.4241 9.944L19.751 18.271C20.067 18.5869 20.067 19.0991 19.751 19.4151C19.4351 19.731 18.9229 19.731 18.6069 19.4151L10.28 11.0881L1.95304 19.4151C1.63711 19.731 1.12488 19.731 0.808943 19.4151C0.493008 19.0991 0.493008 18.5869 0.808943 18.271L9.13589 9.944L0.808942 1.61705Z",fill:"#141414"}))},u=function(){return l.default.createElement("svg",{width:"27",height:"20",viewBox:"0 0 27 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M0.701567 2.7527C1.02864 1.31171 2.31737 0.236 3.85734 0.236H23.2733C24.8133 0.236 26.102 1.31171 26.4291 2.7527L13.5653 10.6139L0.701567 2.7527ZM0.621338 4.59988V16.0934L10.0109 10.338L0.621338 4.59988ZM11.5613 11.2854L0.931785 17.8008C1.45073 18.8952 2.56565 19.652 3.85734 19.652H23.2733C24.565 19.652 25.6799 18.8952 26.1989 17.8008L15.5694 11.2854L13.5653 12.5101L11.5613 11.2854ZM17.1198 10.338L26.5093 16.0934V4.59988L17.1198 10.338Z",fill:"#141414"}))},C=function(){return l.default.createElement("svg",{width:"27",height:"28",viewBox:"0 0 27 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M0.8045 14.7234C0.357701 14.7234 -0.00450093 14.3612 -0.00450059 13.9144C-0.00450082 13.4676 0.357702 13.1054 0.8045 13.1054L12.5806 13.1054L12.5806 1.32934C12.5806 0.882544 12.9428 0.520341 13.3896 0.52034C13.8364 0.520341 14.1986 0.882543 14.1986 1.32934L14.1986 13.1054L25.9747 13.1054C26.4215 13.1054 26.7837 13.4676 26.7837 13.9144C26.7837 14.3612 26.4215 14.7234 25.9747 14.7234H14.1986L14.1986 26.4995C14.1986 26.9463 13.8364 27.3085 13.3896 27.3085C12.9428 27.3085 12.5806 26.9463 12.5806 26.4995L12.5806 14.7234L0.8045 14.7234Z",fill:"black"}))},f=function(){return l.default.createElement("svg",{width:"21",height:"26",viewBox:"0 0 21 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M12.5453 0H3.98136C2.19417 0 0.745361 1.44881 0.745361 3.236V22.652C0.745361 24.4392 2.19417 25.888 3.98136 25.888H16.9254C18.7126 25.888 20.1614 24.4392 20.1614 22.652V7.6161C20.1614 7.18698 19.9909 6.77544 19.6875 6.472L13.6894 0.473901C13.3859 0.170467 12.9744 0 12.5453 0ZM12.8804 5.663V2.427L17.7344 7.281H14.4984C13.6048 7.281 12.8804 6.5566 12.8804 5.663ZM2.36336 14.562H18.5434V16.18H7.21736V19.416H18.5434V21.034H7.21736V24.27H5.59936V21.034H2.36336V19.416H5.59936V16.18H2.36336V14.562Z",fill:"#141414"}))},s=function(){return l.default.createElement("svg",{width:"27",height:"26",viewBox:"0 0 27 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.78296 0.826921C4.9837 -0.37382 6.96512 -0.250462 8.00765 1.08994L10.9099 4.82136C11.4425 5.50612 11.6307 6.39771 11.4203 7.2393L10.5348 10.7812C10.4413 11.1551 10.5509 11.5507 10.8234 11.8232L14.7982 15.798C15.0707 16.0705 15.4663 16.1801 15.8402 16.0866L19.3821 15.2011C20.2237 14.9907 21.1153 15.1789 21.8 15.7115L25.5315 18.6138C26.8719 19.6563 26.9952 21.6377 25.7945 22.8384L24.1216 24.5113C22.9247 25.7082 21.1346 26.2337 19.4662 25.6472C15.3238 24.1908 11.4355 21.8064 8.12521 18.4962C4.81496 15.1859 2.4306 11.2976 0.974218 7.1552C0.38766 5.48684 0.913207 3.69668 2.11007 2.49981L3.78296 0.826921Z",fill:"#141414"}))},d=function(){return l.default.createElement("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.85896 7.85305C0.543026 7.53712 0.543026 7.02489 0.85896 6.70895L7.33096 0.236954C7.64689 -0.0789795 8.15912 -0.0789795 8.47506 0.236954C8.79099 0.552889 8.79099 1.06512 8.47506 1.38105L3.38411 6.472H19.229C21.463 6.472 23.274 8.28301 23.274 10.517V23.461C23.274 23.9078 22.9118 24.27 22.465 24.27C22.0182 24.27 21.656 23.9078 21.656 23.461V10.517C21.656 9.17661 20.5694 8.09 19.229 8.09H3.38411L8.47506 13.181C8.79099 13.4969 8.79099 14.0091 8.47506 14.3251C8.15912 14.641 7.64689 14.641 7.33096 14.3251L0.85896 7.85305Z",fill:"#141414"}))},m=function(){return l.default.createElement("svg",{width:"36",height:"28",viewBox:"0 0 36 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M31.7745 0.900854C32.7099 -0.0470194 34.2265 -0.0470194 35.1619 0.900854C36.0859 1.8371 36.0972 3.34793 35.1959 4.29828L16.0585 26.9205C16.0401 26.9438 16.0204 26.966 15.9996 26.9872C15.0641 27.935 13.5475 27.935 12.6121 26.9872L0.966345 15.1863C0.0309227 14.2385 0.0309227 12.7017 0.966344 11.7538C1.90177 10.8059 3.41838 10.8059 4.35381 11.7538L14.2337 21.7652L31.7109 0.97346C31.7307 0.947992 31.7519 0.923746 31.7745 0.900854Z",fill:"#F9F9F9"}))},w=function(){return l.default.createElement("svg",{width:"43",height:"27",viewBox:"0 0 43 27",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M0.804932 4.11207C0.804932 1.94314 2.56319 0.184875 4.73212 0.184875H38.7678C40.9367 0.184875 42.695 1.94314 42.695 4.11207V8.03925C42.695 8.76223 42.1089 9.34832 41.3859 9.34832C39.217 9.34832 37.4587 11.1066 37.4587 13.2755C37.4587 15.4444 39.217 17.2027 41.3859 17.2027C42.1089 17.2027 42.695 17.7888 42.695 18.5118V22.4389C42.695 24.6079 40.9367 26.3661 38.7678 26.3661H4.73212C2.56319 26.3661 0.804932 24.6079 0.804932 22.4389V18.5118C0.804932 17.7888 1.39102 17.2027 2.11399 17.2027C4.28292 17.2027 6.04118 15.4444 6.04118 13.2755C6.04118 11.1066 4.28292 9.34832 2.11399 9.34832C1.39102 9.34832 0.804932 8.76223 0.804932 8.03925V4.11207ZM11.2774 1.49394V4.11207H13.8956V1.49394H11.2774ZM13.8956 9.34832V6.73019H11.2774V9.34832H13.8956ZM32.2224 9.34832V6.73019H29.6043V9.34832H32.2224ZM29.6043 4.11207H32.2224V1.49394H29.6043V4.11207ZM13.8956 11.9664H11.2774V14.5846H13.8956V11.9664ZM32.2224 14.5846V11.9664H29.6043V14.5846H32.2224ZM13.8956 17.2027H11.2774V19.8208H13.8956V17.2027ZM32.2224 19.8208V17.2027H29.6043V19.8208H32.2224ZM11.2774 22.4389V25.0571H13.8956V22.4389H11.2774ZM29.6043 25.0571H32.2224V22.4389H29.6043V25.0571Z",fill:"white"}))},h=function(){return l.default.createElement("svg",{width:"11",height:"31",viewBox:"0 0 11 31",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M5.51383 9.94016C7.59773 9.94016 8.63967 11.1741 8.63967 13.6418C8.63967 14.7386 8.33806 16.6854 7.73482 19.4822C7.13159 22.279 6.82997 24.0065 6.82997 24.6645C6.82997 25.7613 7.26869 26.5839 8.14612 27.1323C7.76224 28.1743 7.18643 28.9694 6.41868 29.5178C5.67835 30.0388 4.85575 30.2993 3.9509 30.2993C1.62023 30.2993 0.454891 29.0517 0.454891 26.5565C0.454891 25.2678 0.756508 23.2387 1.35974 20.4693C1.99039 17.6999 2.30572 15.9725 2.30572 15.287C2.30572 14.108 1.88072 13.4636 1.0307 13.3539C1.1678 12.3942 1.64765 11.5853 2.47024 10.9273C3.32025 10.2692 4.33478 9.94016 5.51383 9.94016ZM6.08964 8.0482C5.04769 8.0482 4.25252 7.74659 3.70413 7.14335C3.18315 6.5127 2.92266 5.75866 2.92266 4.88123C2.92266 3.81186 3.27912 2.86588 3.99203 2.04329C4.73237 1.19328 5.71947 0.768273 6.95336 0.768273C7.96789 0.768273 8.74935 1.09731 9.29775 1.75538C9.84614 2.41345 10.1203 3.19492 10.1203 4.09977C10.1203 5.16914 9.76388 6.10141 9.05097 6.89658C8.36548 7.66433 7.37837 8.0482 6.08964 8.0482Z",fill:"#F9F9F9"}))},L=function(){return l.default.createElement("svg",{width:"16",height:"30",viewBox:"0 0 16 30",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M8.36496 18.7176C7.18591 19.2934 6.18509 19.5813 5.3625 19.5813C3.33344 19.5813 2.31891 18.8547 2.31891 17.4015C2.31891 16.5789 2.55198 15.7563 3.01812 14.9337C3.48425 14.0837 4.04635 13.3159 4.70443 12.6304C5.38992 11.9175 6.07541 11.2183 6.76091 10.5328C7.4464 9.81991 8.02221 9.05216 8.48835 8.22957C8.95448 7.40698 9.18755 6.58439 9.18755 5.7618C9.18755 4.58275 8.54319 3.99323 7.25446 3.99323C6.59639 3.99323 5.93831 4.28113 5.28024 4.85695C4.62217 5.40534 4.15603 6.14567 3.88184 7.07794C1.66084 6.80375 0.550342 6.00858 0.550342 4.69243C0.550342 3.4037 1.30438 2.37547 2.81247 1.60771C4.34797 0.812541 6.11654 0.414955 8.11818 0.414955C9.92788 0.414955 11.5594 0.812541 13.0126 1.60771C14.4658 2.37547 15.1925 3.60935 15.1925 5.30937C15.1925 6.48842 14.9457 7.5715 14.4521 8.55861C13.986 9.5183 13.4102 10.3409 12.7247 11.0264C12.0666 11.7119 11.3948 12.3699 10.7093 13.0006C10.0239 13.6313 9.43433 14.3442 8.94077 15.1393C8.47464 15.9071 8.24157 16.716 8.24157 17.566C8.24157 17.9224 8.2827 18.3063 8.36496 18.7176ZM4.00523 29.4113C3.12779 29.4113 2.40117 29.1234 1.82536 28.5476C1.24954 27.9718 0.961638 27.2314 0.961638 26.3266C0.961638 25.2572 1.35922 24.2838 2.15439 23.4064C2.94957 22.5289 3.90926 22.0902 5.03346 22.0902C5.88347 22.0902 6.59639 22.4056 7.1722 23.0362C7.77543 23.6394 8.07705 24.3935 8.07705 25.2983C8.07705 26.3403 7.66576 27.2863 6.84317 28.1363C6.02057 28.9863 5.07459 29.4113 4.00523 29.4113Z",fill:"#F9F9F9"}))},g=function(t){var n,g,v=t.pillData,p=a(e.useState(!1),2),V=p[0],E=p[1],H=a(e.useState(!0),2),b=H[0],M=H[1],x=v.icon,Z=v.message,y=v.cta,k=v.info,B=y||{},N=B.icon,S=B.label,F=B.link,A=k||{},I=A.title,R=A.content,P=A.closeLabel,T=a(e.useState(!0),2),j=T[0],q=T[1];switch(x){case"checkmark":n=m;break;case"coupon":n=w;break;case"info":n=h;break;case"questionmark":n=L;break;default:n=null}switch(j?N:"cross"){case"arrow":g=r;break;case"box":g=i;break;case"checkmark":g=o;break;case"cross":g=c;break;case"mail":g=u;break;case"plus":g=C;break;case"quotation":g=f;break;case"tel":g=s;break;case"undo":g=d;break;default:g=null}return e.useEffect((function(){M(!1),setTimeout((function(){return E(!0)}),2500),setTimeout((function(){E(!1),M(!0)}),7500)}),[]),l.default.createElement("div",{className:b?"magicPill out":V?"magicPill active":"magicPill entry"},n&&l.default.createElement(n,{className:"icon"}),l.default.createElement("p",{className:"message"},Z),F&&!k&&l.default.createElement("a",{className:"CTA",href:F},g&&l.default.createElement(g,{className:"label"}),l.default.createElement("span",null,S)),F&&k&&l.default.createElement("button",{className:"CTA",onClick:function(){q(!j)}},g&&l.default.createElement(g,{className:"label"}),l.default.createElement("span",null,j?S:P)),k&&l.default.createElement("div",{className:j?"info":"info active"},l.default.createElement("p",{className:"title"},I),l.default.createElement("div",{className:"content",dangerouslySetInnerHTML:{__html:R}})))};g.defaultProps={pillData:{icon:"info",message:"Hey ! I'm Magic Pill, your omnipotent toolbox !",cta:{icon:"arrow",label:"Discover what I can do",link:null},info:{title:"I'm Magic Pill, let me empower you !",content:"<p>I'll appear sometimes, depending on context, either to send you notifications regarding your experience on this website or to give you indications and hints at what you cn do !</p><p>See you around !</p>",closeLabel:"Close"}}},module.exports=g;
|
|
1
|
+
"use strict";var e=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=t(e);function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var n,a,r,i,o=[],u=!0,c=!1;try{if(r=(l=l.call(e)).next,0===t){if(Object(l)!==l)return;u=!1}else for(;!(u=(n=r.call(l)).done)&&(o.push(n.value),o.length!==t);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=l.return&&(i=l.return(),Object(i)!==i))return}finally{if(c)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var l={}.toString.call(e).slice(8,-1);return"Object"===l&&e.constructor&&(l=e.constructor.name),"Map"===l||"Set"===l?Array.from(e):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?n(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var r=function(){return l.default.createElement("svg",{width:"31",height:"20",viewBox:"0 0 31 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.813004 10.2755C0.813004 9.69059 1.28715 9.21645 1.87204 9.21645L26.8501 9.21645L20.1858 2.55207C19.7722 2.1385 19.7722 1.46795 20.1858 1.05438C20.5993 0.640799 21.2699 0.640799 21.6835 1.05438L30.1557 9.52663C30.5693 9.94021 30.5693 10.6107 30.1557 11.0243L21.6835 19.4966C21.2699 19.9102 20.5993 19.9102 20.1858 19.4966C19.7722 19.083 19.7722 18.4125 20.1858 17.9989L26.8501 11.3345L1.87204 11.3345C1.28715 11.3345 0.813004 10.8604 0.813004 10.2755Z",fill:"black"}))},i=function(){return l.default.createElement("svg",{width:"27",height:"26",viewBox:"0 0 27 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M25.5226 4.8102C25.9834 4.99448 26.2855 5.4407 26.2855 5.9369V19.9512C26.2855 20.4474 25.9834 20.8936 25.5226 21.0779L13.7921 25.7701C13.5028 25.8858 13.1801 25.8858 12.8908 25.7701L1.16028 21.0779C0.699563 20.8936 0.397461 20.4474 0.397461 19.9512V5.9369C0.397461 5.4407 0.699563 4.99448 1.16028 4.8102L12.4401 0.298213C12.4451 0.296221 12.4501 0.294245 12.4551 0.292286L12.8908 0.117998C13.1801 0.00227327 13.5028 0.00227283 13.7921 0.117998L14.2279 0.292303C14.2329 0.294256 14.2379 0.296226 14.2428 0.298213L25.5226 4.8102ZM17.2306 3.23602L7.27396 7.21868L3.38482 5.66302L2.01546 6.21076V6.85792L12.5325 11.0647V23.8841L13.3415 24.2077L14.1505 23.8841V11.0647L24.6675 6.85792V6.21076L23.2981 5.66302L13.3415 9.64568L9.45226 8.09L19.4089 4.10734L17.2306 3.23602Z",fill:"#141414"}))},o=function(){return l.default.createElement("svg",{width:"22",height:"18",viewBox:"0 0 22 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M18.2019 0.949382C18.9692 0.182085 20.2132 0.182085 20.9805 0.949382C21.7384 1.70727 21.7477 2.93028 21.0084 3.69957L10.55 16.7726C10.5349 16.7915 10.5187 16.8095 10.5017 16.8266C9.73436 17.5939 8.49033 17.5939 7.72303 16.8266L0.790074 9.89367C0.0227749 9.12637 0.022775 7.88233 0.790074 7.11504C1.55737 6.34774 2.80141 6.34774 3.56871 7.11504L9.05315 12.5995L18.1498 1.00816C18.166 0.987539 18.1834 0.967913 18.2019 0.949382Z",fill:"#141414"}))},u=function(){return l.default.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M0.808942 1.61705C0.493007 1.30112 0.493007 0.788885 0.808942 0.472951C1.12488 0.157017 1.63711 0.157017 1.95304 0.472951L10.28 8.7999L18.6069 0.472951C18.9229 0.157017 19.4351 0.157017 19.751 0.472951C20.067 0.788885 20.067 1.30112 19.751 1.61705L11.4241 9.944L19.751 18.271C20.067 18.5869 20.067 19.0991 19.751 19.4151C19.4351 19.731 18.9229 19.731 18.6069 19.4151L10.28 11.0881L1.95304 19.4151C1.63711 19.731 1.12488 19.731 0.808943 19.4151C0.493008 19.0991 0.493008 18.5869 0.808943 18.271L9.13589 9.944L0.808942 1.61705Z",fill:"#141414"}))},c=function(){return l.default.createElement("svg",{width:"27",height:"20",viewBox:"0 0 27 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M0.701567 2.7527C1.02864 1.31171 2.31737 0.236 3.85734 0.236H23.2733C24.8133 0.236 26.102 1.31171 26.4291 2.7527L13.5653 10.6139L0.701567 2.7527ZM0.621338 4.59988V16.0934L10.0109 10.338L0.621338 4.59988ZM11.5613 11.2854L0.931785 17.8008C1.45073 18.8952 2.56565 19.652 3.85734 19.652H23.2733C24.565 19.652 25.6799 18.8952 26.1989 17.8008L15.5694 11.2854L13.5653 12.5101L11.5613 11.2854ZM17.1198 10.338L26.5093 16.0934V4.59988L17.1198 10.338Z",fill:"#141414"}))},C=function(){return l.default.createElement("svg",{width:"27",height:"28",viewBox:"0 0 27 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M0.8045 14.7234C0.357701 14.7234 -0.00450093 14.3612 -0.00450059 13.9144C-0.00450082 13.4676 0.357702 13.1054 0.8045 13.1054L12.5806 13.1054L12.5806 1.32934C12.5806 0.882544 12.9428 0.520341 13.3896 0.52034C13.8364 0.520341 14.1986 0.882543 14.1986 1.32934L14.1986 13.1054L25.9747 13.1054C26.4215 13.1054 26.7837 13.4676 26.7837 13.9144C26.7837 14.3612 26.4215 14.7234 25.9747 14.7234H14.1986L14.1986 26.4995C14.1986 26.9463 13.8364 27.3085 13.3896 27.3085C12.9428 27.3085 12.5806 26.9463 12.5806 26.4995L12.5806 14.7234L0.8045 14.7234Z",fill:"black"}))},f=function(){return l.default.createElement("svg",{width:"21",height:"26",viewBox:"0 0 21 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M12.5453 0H3.98136C2.19417 0 0.745361 1.44881 0.745361 3.236V22.652C0.745361 24.4392 2.19417 25.888 3.98136 25.888H16.9254C18.7126 25.888 20.1614 24.4392 20.1614 22.652V7.6161C20.1614 7.18698 19.9909 6.77544 19.6875 6.472L13.6894 0.473901C13.3859 0.170467 12.9744 0 12.5453 0ZM12.8804 5.663V2.427L17.7344 7.281H14.4984C13.6048 7.281 12.8804 6.5566 12.8804 5.663ZM2.36336 14.562H18.5434V16.18H7.21736V19.416H18.5434V21.034H7.21736V24.27H5.59936V21.034H2.36336V19.416H5.59936V16.18H2.36336V14.562Z",fill:"#141414"}))},s=function(){return l.default.createElement("svg",{width:"27",height:"26",viewBox:"0 0 27 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.78296 0.826921C4.9837 -0.37382 6.96512 -0.250462 8.00765 1.08994L10.9099 4.82136C11.4425 5.50612 11.6307 6.39771 11.4203 7.2393L10.5348 10.7812C10.4413 11.1551 10.5509 11.5507 10.8234 11.8232L14.7982 15.798C15.0707 16.0705 15.4663 16.1801 15.8402 16.0866L19.3821 15.2011C20.2237 14.9907 21.1153 15.1789 21.8 15.7115L25.5315 18.6138C26.8719 19.6563 26.9952 21.6377 25.7945 22.8384L24.1216 24.5113C22.9247 25.7082 21.1346 26.2337 19.4662 25.6472C15.3238 24.1908 11.4355 21.8064 8.12521 18.4962C4.81496 15.1859 2.4306 11.2976 0.974218 7.1552C0.38766 5.48684 0.913207 3.69668 2.11007 2.49981L3.78296 0.826921Z",fill:"#141414"}))},d=function(){return l.default.createElement("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.85896 7.85305C0.543026 7.53712 0.543026 7.02489 0.85896 6.70895L7.33096 0.236954C7.64689 -0.0789795 8.15912 -0.0789795 8.47506 0.236954C8.79099 0.552889 8.79099 1.06512 8.47506 1.38105L3.38411 6.472H19.229C21.463 6.472 23.274 8.28301 23.274 10.517V23.461C23.274 23.9078 22.9118 24.27 22.465 24.27C22.0182 24.27 21.656 23.9078 21.656 23.461V10.517C21.656 9.17661 20.5694 8.09 19.229 8.09H3.38411L8.47506 13.181C8.79099 13.4969 8.79099 14.0091 8.47506 14.3251C8.15912 14.641 7.64689 14.641 7.33096 14.3251L0.85896 7.85305Z",fill:"#141414"}))},m=function(){return l.default.createElement("svg",{width:"36",height:"28",viewBox:"0 0 36 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M31.7745 0.900854C32.7099 -0.0470194 34.2265 -0.0470194 35.1619 0.900854C36.0859 1.8371 36.0972 3.34793 35.1959 4.29828L16.0585 26.9205C16.0401 26.9438 16.0204 26.966 15.9996 26.9872C15.0641 27.935 13.5475 27.935 12.6121 26.9872L0.966345 15.1863C0.0309227 14.2385 0.0309227 12.7017 0.966344 11.7538C1.90177 10.8059 3.41838 10.8059 4.35381 11.7538L14.2337 21.7652L31.7109 0.97346C31.7307 0.947992 31.7519 0.923746 31.7745 0.900854Z",fill:"#F9F9F9"}))},w=function(){return l.default.createElement("svg",{width:"43",height:"27",viewBox:"0 0 43 27",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M0.804932 4.11207C0.804932 1.94314 2.56319 0.184875 4.73212 0.184875H38.7678C40.9367 0.184875 42.695 1.94314 42.695 4.11207V8.03925C42.695 8.76223 42.1089 9.34832 41.3859 9.34832C39.217 9.34832 37.4587 11.1066 37.4587 13.2755C37.4587 15.4444 39.217 17.2027 41.3859 17.2027C42.1089 17.2027 42.695 17.7888 42.695 18.5118V22.4389C42.695 24.6079 40.9367 26.3661 38.7678 26.3661H4.73212C2.56319 26.3661 0.804932 24.6079 0.804932 22.4389V18.5118C0.804932 17.7888 1.39102 17.2027 2.11399 17.2027C4.28292 17.2027 6.04118 15.4444 6.04118 13.2755C6.04118 11.1066 4.28292 9.34832 2.11399 9.34832C1.39102 9.34832 0.804932 8.76223 0.804932 8.03925V4.11207ZM11.2774 1.49394V4.11207H13.8956V1.49394H11.2774ZM13.8956 9.34832V6.73019H11.2774V9.34832H13.8956ZM32.2224 9.34832V6.73019H29.6043V9.34832H32.2224ZM29.6043 4.11207H32.2224V1.49394H29.6043V4.11207ZM13.8956 11.9664H11.2774V14.5846H13.8956V11.9664ZM32.2224 14.5846V11.9664H29.6043V14.5846H32.2224ZM13.8956 17.2027H11.2774V19.8208H13.8956V17.2027ZM32.2224 19.8208V17.2027H29.6043V19.8208H32.2224ZM11.2774 22.4389V25.0571H13.8956V22.4389H11.2774ZM29.6043 25.0571H32.2224V22.4389H29.6043V25.0571Z",fill:"white"}))},h=function(){return l.default.createElement("svg",{width:"11",height:"31",viewBox:"0 0 11 31",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M5.51383 9.94016C7.59773 9.94016 8.63967 11.1741 8.63967 13.6418C8.63967 14.7386 8.33806 16.6854 7.73482 19.4822C7.13159 22.279 6.82997 24.0065 6.82997 24.6645C6.82997 25.7613 7.26869 26.5839 8.14612 27.1323C7.76224 28.1743 7.18643 28.9694 6.41868 29.5178C5.67835 30.0388 4.85575 30.2993 3.9509 30.2993C1.62023 30.2993 0.454891 29.0517 0.454891 26.5565C0.454891 25.2678 0.756508 23.2387 1.35974 20.4693C1.99039 17.6999 2.30572 15.9725 2.30572 15.287C2.30572 14.108 1.88072 13.4636 1.0307 13.3539C1.1678 12.3942 1.64765 11.5853 2.47024 10.9273C3.32025 10.2692 4.33478 9.94016 5.51383 9.94016ZM6.08964 8.0482C5.04769 8.0482 4.25252 7.74659 3.70413 7.14335C3.18315 6.5127 2.92266 5.75866 2.92266 4.88123C2.92266 3.81186 3.27912 2.86588 3.99203 2.04329C4.73237 1.19328 5.71947 0.768273 6.95336 0.768273C7.96789 0.768273 8.74935 1.09731 9.29775 1.75538C9.84614 2.41345 10.1203 3.19492 10.1203 4.09977C10.1203 5.16914 9.76388 6.10141 9.05097 6.89658C8.36548 7.66433 7.37837 8.0482 6.08964 8.0482Z",fill:"#F9F9F9"}))},L=function(){return l.default.createElement("svg",{width:"16",height:"30",viewBox:"0 0 16 30",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.default.createElement("path",{d:"M8.36496 18.7176C7.18591 19.2934 6.18509 19.5813 5.3625 19.5813C3.33344 19.5813 2.31891 18.8547 2.31891 17.4015C2.31891 16.5789 2.55198 15.7563 3.01812 14.9337C3.48425 14.0837 4.04635 13.3159 4.70443 12.6304C5.38992 11.9175 6.07541 11.2183 6.76091 10.5328C7.4464 9.81991 8.02221 9.05216 8.48835 8.22957C8.95448 7.40698 9.18755 6.58439 9.18755 5.7618C9.18755 4.58275 8.54319 3.99323 7.25446 3.99323C6.59639 3.99323 5.93831 4.28113 5.28024 4.85695C4.62217 5.40534 4.15603 6.14567 3.88184 7.07794C1.66084 6.80375 0.550342 6.00858 0.550342 4.69243C0.550342 3.4037 1.30438 2.37547 2.81247 1.60771C4.34797 0.812541 6.11654 0.414955 8.11818 0.414955C9.92788 0.414955 11.5594 0.812541 13.0126 1.60771C14.4658 2.37547 15.1925 3.60935 15.1925 5.30937C15.1925 6.48842 14.9457 7.5715 14.4521 8.55861C13.986 9.5183 13.4102 10.3409 12.7247 11.0264C12.0666 11.7119 11.3948 12.3699 10.7093 13.0006C10.0239 13.6313 9.43433 14.3442 8.94077 15.1393C8.47464 15.9071 8.24157 16.716 8.24157 17.566C8.24157 17.9224 8.2827 18.3063 8.36496 18.7176ZM4.00523 29.4113C3.12779 29.4113 2.40117 29.1234 1.82536 28.5476C1.24954 27.9718 0.961638 27.2314 0.961638 26.3266C0.961638 25.2572 1.35922 24.2838 2.15439 23.4064C2.94957 22.5289 3.90926 22.0902 5.03346 22.0902C5.88347 22.0902 6.59639 22.4056 7.1722 23.0362C7.77543 23.6394 8.07705 24.3935 8.07705 25.2983C8.07705 26.3403 7.66576 27.2863 6.84317 28.1363C6.02057 28.9863 5.07459 29.4113 4.00523 29.4113Z",fill:"#F9F9F9"}))},g=function(t){var n,g,v=t.pillData,p=a(e.useState(!1),2),V=p[0],E=p[1],H=a(e.useState(!0),2),M=H[0],b=H[1],x=a(e.useState(!1),2),Z=x[0],y=x[1],k=useRef(null),B=v.icon,S=v.message,N=v.cta,F=v.info,R=N||{},A=R.icon,I=R.label,T=R.link,P=F||{},j=P.title,q=P.content,D=P.closeLabel,O=a(e.useState(!0),2),_=O[0],U=O[1];switch(B){case"checkmark":n=m;break;case"coupon":n=w;break;case"info":n=h;break;case"questionmark":n=L;break;default:n=null}switch(_?A:"cross"){case"arrow":g=r;break;case"box":g=i;break;case"checkmark":g=o;break;case"cross":g=u;break;case"mail":g=c;break;case"plus":g=C;break;case"quotation":g=f;break;case"tel":g=s;break;case"undo":g=d;break;default:g=null}var $=function(){k.current&&(clearTimeout(k.current),k.current=null)};return e.useEffect((function(){return b(!1),setTimeout((function(){return E(!0)}),2500),function(){$()}}),[]),l.default.createElement("div",{className:M?"magicPill out":V?"magicPill active":"magicPill entry",onMouseEnter:function(){y(!0),$()},onMouseLeave:function(){y(!1),k.current=setTimeout((function(){Z||(E(!1),setTimeout((function(){return b(!0)}),500))}),5e3)}},n&&l.default.createElement(n,{className:"icon"}),l.default.createElement("p",{className:"message"},S),T&&!F&&l.default.createElement("a",{className:"CTA",href:T},g&&l.default.createElement(g,{className:"label"}),l.default.createElement("span",null,I)),T&&F&&l.default.createElement("button",{className:"CTA",onClick:function(){U(!_)}},g&&l.default.createElement(g,{className:"label"}),l.default.createElement("span",null,_?I:D)),F&&l.default.createElement("div",{className:_?"info":"info active"},l.default.createElement("p",{className:"title"},j),l.default.createElement("div",{className:"content",dangerouslySetInnerHTML:{__html:q}})))};g.defaultProps={pillData:{icon:"info",message:"Hey ! I'm Magic Pill, your omnipotent toolbox !",cta:{icon:"arrow",label:"Discover what I can do",link:null},info:{title:"I'm Magic Pill, let me empower you !",content:"<p>I'll appear sometimes, depending on context, either to send you notifications regarding your experience on this website or to give you indications and hints at what you cn do !</p><p>See you around !</p>",closeLabel:"Close"}}},module.exports=g;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/icons/arrow_label.js","../src/icons/box_label.js","../src/icons/checkmark_label.js","../src/icons/cross_label.js","../src/icons/mail_label.js","../src/icons/plus_label.js","../src/icons/quotation_label.js","../src/icons/tel_label.js","../src/icons/undo_label.js","../src/icons/checkmark.js","../src/icons/coupon.js","../src/icons/info.js","../src/icons/questionmark.js","../src/MagicPill.js"],"sourcesContent":["import React from 'react';\n\nconst ArrowLabel = () => (\n <svg width=\"31\" height=\"20\" viewBox=\"0 0 31 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M0.813004 10.2755C0.813004 9.69059 1.28715 9.21645 1.87204 9.21645L26.8501 9.21645L20.1858 2.55207C19.7722 2.1385 19.7722 1.46795 20.1858 1.05438C20.5993 0.640799 21.2699 0.640799 21.6835 1.05438L30.1557 9.52663C30.5693 9.94021 30.5693 10.6107 30.1557 11.0243L21.6835 19.4966C21.2699 19.9102 20.5993 19.9102 20.1858 19.4966C19.7722 19.083 19.7722 18.4125 20.1858 17.9989L26.8501 11.3345L1.87204 11.3345C1.28715 11.3345 0.813004 10.8604 0.813004 10.2755Z\" fill=\"black\"/>\n</svg>\n);\n\nexport default ArrowLabel;","import React from 'react';\n\nconst BoxLabel = () => (\n <svg width=\"27\" height=\"26\" viewBox=\"0 0 27 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M25.5226 4.8102C25.9834 4.99448 26.2855 5.4407 26.2855 5.9369V19.9512C26.2855 20.4474 25.9834 20.8936 25.5226 21.0779L13.7921 25.7701C13.5028 25.8858 13.1801 25.8858 12.8908 25.7701L1.16028 21.0779C0.699563 20.8936 0.397461 20.4474 0.397461 19.9512V5.9369C0.397461 5.4407 0.699563 4.99448 1.16028 4.8102L12.4401 0.298213C12.4451 0.296221 12.4501 0.294245 12.4551 0.292286L12.8908 0.117998C13.1801 0.00227327 13.5028 0.00227283 13.7921 0.117998L14.2279 0.292303C14.2329 0.294256 14.2379 0.296226 14.2428 0.298213L25.5226 4.8102ZM17.2306 3.23602L7.27396 7.21868L3.38482 5.66302L2.01546 6.21076V6.85792L12.5325 11.0647V23.8841L13.3415 24.2077L14.1505 23.8841V11.0647L24.6675 6.85792V6.21076L23.2981 5.66302L13.3415 9.64568L9.45226 8.09L19.4089 4.10734L17.2306 3.23602Z\" fill=\"#141414\"/>\n </svg>\n);\n\nexport default BoxLabel;","import React from 'react';\n\nconst CheckmarkLabel = () => (\n<svg width=\"22\" height=\"18\" viewBox=\"0 0 22 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M18.2019 0.949382C18.9692 0.182085 20.2132 0.182085 20.9805 0.949382C21.7384 1.70727 21.7477 2.93028 21.0084 3.69957L10.55 16.7726C10.5349 16.7915 10.5187 16.8095 10.5017 16.8266C9.73436 17.5939 8.49033 17.5939 7.72303 16.8266L0.790074 9.89367C0.0227749 9.12637 0.022775 7.88233 0.790074 7.11504C1.55737 6.34774 2.80141 6.34774 3.56871 7.11504L9.05315 12.5995L18.1498 1.00816C18.166 0.987539 18.1834 0.967913 18.2019 0.949382Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default CheckmarkLabel;","import React from 'react';\n\nconst CrossLabel = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.808942 1.61705C0.493007 1.30112 0.493007 0.788885 0.808942 0.472951C1.12488 0.157017 1.63711 0.157017 1.95304 0.472951L10.28 8.7999L18.6069 0.472951C18.9229 0.157017 19.4351 0.157017 19.751 0.472951C20.067 0.788885 20.067 1.30112 19.751 1.61705L11.4241 9.944L19.751 18.271C20.067 18.5869 20.067 19.0991 19.751 19.4151C19.4351 19.731 18.9229 19.731 18.6069 19.4151L10.28 11.0881L1.95304 19.4151C1.63711 19.731 1.12488 19.731 0.808943 19.4151C0.493008 19.0991 0.493008 18.5869 0.808943 18.271L9.13589 9.944L0.808942 1.61705Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default CrossLabel;\n","import React from 'react';\n\nconst MailLabel = () => (\n <svg width=\"27\" height=\"20\" viewBox=\"0 0 27 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.701567 2.7527C1.02864 1.31171 2.31737 0.236 3.85734 0.236H23.2733C24.8133 0.236 26.102 1.31171 26.4291 2.7527L13.5653 10.6139L0.701567 2.7527ZM0.621338 4.59988V16.0934L10.0109 10.338L0.621338 4.59988ZM11.5613 11.2854L0.931785 17.8008C1.45073 18.8952 2.56565 19.652 3.85734 19.652H23.2733C24.565 19.652 25.6799 18.8952 26.1989 17.8008L15.5694 11.2854L13.5653 12.5101L11.5613 11.2854ZM17.1198 10.338L26.5093 16.0934V4.59988L17.1198 10.338Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default MailLabel;\n","import React from 'react';\n\nconst PlusLabel = () => (\n <svg width=\"27\" height=\"28\" viewBox=\"0 0 27 28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.8045 14.7234C0.357701 14.7234 -0.00450093 14.3612 -0.00450059 13.9144C-0.00450082 13.4676 0.357702 13.1054 0.8045 13.1054L12.5806 13.1054L12.5806 1.32934C12.5806 0.882544 12.9428 0.520341 13.3896 0.52034C13.8364 0.520341 14.1986 0.882543 14.1986 1.32934L14.1986 13.1054L25.9747 13.1054C26.4215 13.1054 26.7837 13.4676 26.7837 13.9144C26.7837 14.3612 26.4215 14.7234 25.9747 14.7234H14.1986L14.1986 26.4995C14.1986 26.9463 13.8364 27.3085 13.3896 27.3085C12.9428 27.3085 12.5806 26.9463 12.5806 26.4995L12.5806 14.7234L0.8045 14.7234Z\" fill=\"black\"/>\n</svg>\n);\n\nexport default PlusLabel;\n","import React from 'react';\n\nconst QuotationLabel = () => (\n<svg width=\"21\" height=\"26\" viewBox=\"0 0 21 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12.5453 0H3.98136C2.19417 0 0.745361 1.44881 0.745361 3.236V22.652C0.745361 24.4392 2.19417 25.888 3.98136 25.888H16.9254C18.7126 25.888 20.1614 24.4392 20.1614 22.652V7.6161C20.1614 7.18698 19.9909 6.77544 19.6875 6.472L13.6894 0.473901C13.3859 0.170467 12.9744 0 12.5453 0ZM12.8804 5.663V2.427L17.7344 7.281H14.4984C13.6048 7.281 12.8804 6.5566 12.8804 5.663ZM2.36336 14.562H18.5434V16.18H7.21736V19.416H18.5434V21.034H7.21736V24.27H5.59936V21.034H2.36336V19.416H5.59936V16.18H2.36336V14.562Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default QuotationLabel;\n","import React from 'react';\n\nconst TelLabel = () => (\n<svg width=\"27\" height=\"26\" viewBox=\"0 0 27 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M3.78296 0.826921C4.9837 -0.37382 6.96512 -0.250462 8.00765 1.08994L10.9099 4.82136C11.4425 5.50612 11.6307 6.39771 11.4203 7.2393L10.5348 10.7812C10.4413 11.1551 10.5509 11.5507 10.8234 11.8232L14.7982 15.798C15.0707 16.0705 15.4663 16.1801 15.8402 16.0866L19.3821 15.2011C20.2237 14.9907 21.1153 15.1789 21.8 15.7115L25.5315 18.6138C26.8719 19.6563 26.9952 21.6377 25.7945 22.8384L24.1216 24.5113C22.9247 25.7082 21.1346 26.2337 19.4662 25.6472C15.3238 24.1908 11.4355 21.8064 8.12521 18.4962C4.81496 15.1859 2.4306 11.2976 0.974218 7.1552C0.38766 5.48684 0.913207 3.69668 2.11007 2.49981L3.78296 0.826921Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default TelLabel;\n","import React from 'react';\n\nconst UndoLabel = () => (\n<svg width=\"24\" height=\"25\" viewBox=\"0 0 24 25\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M0.85896 7.85305C0.543026 7.53712 0.543026 7.02489 0.85896 6.70895L7.33096 0.236954C7.64689 -0.0789795 8.15912 -0.0789795 8.47506 0.236954C8.79099 0.552889 8.79099 1.06512 8.47506 1.38105L3.38411 6.472H19.229C21.463 6.472 23.274 8.28301 23.274 10.517V23.461C23.274 23.9078 22.9118 24.27 22.465 24.27C22.0182 24.27 21.656 23.9078 21.656 23.461V10.517C21.656 9.17661 20.5694 8.09 19.229 8.09H3.38411L8.47506 13.181C8.79099 13.4969 8.79099 14.0091 8.47506 14.3251C8.15912 14.641 7.64689 14.641 7.33096 14.3251L0.85896 7.85305Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default UndoLabel;\n","import React from 'react';\n\nconst CheckmarkIcon = () => (\n <svg width=\"36\" height=\"28\" viewBox=\"0 0 36 28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M31.7745 0.900854C32.7099 -0.0470194 34.2265 -0.0470194 35.1619 0.900854C36.0859 1.8371 36.0972 3.34793 35.1959 4.29828L16.0585 26.9205C16.0401 26.9438 16.0204 26.966 15.9996 26.9872C15.0641 27.935 13.5475 27.935 12.6121 26.9872L0.966345 15.1863C0.0309227 14.2385 0.0309227 12.7017 0.966344 11.7538C1.90177 10.8059 3.41838 10.8059 4.35381 11.7538L14.2337 21.7652L31.7109 0.97346C31.7307 0.947992 31.7519 0.923746 31.7745 0.900854Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default CheckmarkIcon;","import React from 'react';\n\nconst CouponIcon = () => (\n <svg width=\"43\" height=\"27\" viewBox=\"0 0 43 27\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.804932 4.11207C0.804932 1.94314 2.56319 0.184875 4.73212 0.184875H38.7678C40.9367 0.184875 42.695 1.94314 42.695 4.11207V8.03925C42.695 8.76223 42.1089 9.34832 41.3859 9.34832C39.217 9.34832 37.4587 11.1066 37.4587 13.2755C37.4587 15.4444 39.217 17.2027 41.3859 17.2027C42.1089 17.2027 42.695 17.7888 42.695 18.5118V22.4389C42.695 24.6079 40.9367 26.3661 38.7678 26.3661H4.73212C2.56319 26.3661 0.804932 24.6079 0.804932 22.4389V18.5118C0.804932 17.7888 1.39102 17.2027 2.11399 17.2027C4.28292 17.2027 6.04118 15.4444 6.04118 13.2755C6.04118 11.1066 4.28292 9.34832 2.11399 9.34832C1.39102 9.34832 0.804932 8.76223 0.804932 8.03925V4.11207ZM11.2774 1.49394V4.11207H13.8956V1.49394H11.2774ZM13.8956 9.34832V6.73019H11.2774V9.34832H13.8956ZM32.2224 9.34832V6.73019H29.6043V9.34832H32.2224ZM29.6043 4.11207H32.2224V1.49394H29.6043V4.11207ZM13.8956 11.9664H11.2774V14.5846H13.8956V11.9664ZM32.2224 14.5846V11.9664H29.6043V14.5846H32.2224ZM13.8956 17.2027H11.2774V19.8208H13.8956V17.2027ZM32.2224 19.8208V17.2027H29.6043V19.8208H32.2224ZM11.2774 22.4389V25.0571H13.8956V22.4389H11.2774ZM29.6043 25.0571H32.2224V22.4389H29.6043V25.0571Z\" fill=\"white\"/>\n</svg>\n);\n\nexport default CouponIcon;\n","import React from 'react';\n\nconst InfoIcon = () => (\n <svg width=\"11\" height=\"31\" viewBox=\"0 0 11 31\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.51383 9.94016C7.59773 9.94016 8.63967 11.1741 8.63967 13.6418C8.63967 14.7386 8.33806 16.6854 7.73482 19.4822C7.13159 22.279 6.82997 24.0065 6.82997 24.6645C6.82997 25.7613 7.26869 26.5839 8.14612 27.1323C7.76224 28.1743 7.18643 28.9694 6.41868 29.5178C5.67835 30.0388 4.85575 30.2993 3.9509 30.2993C1.62023 30.2993 0.454891 29.0517 0.454891 26.5565C0.454891 25.2678 0.756508 23.2387 1.35974 20.4693C1.99039 17.6999 2.30572 15.9725 2.30572 15.287C2.30572 14.108 1.88072 13.4636 1.0307 13.3539C1.1678 12.3942 1.64765 11.5853 2.47024 10.9273C3.32025 10.2692 4.33478 9.94016 5.51383 9.94016ZM6.08964 8.0482C5.04769 8.0482 4.25252 7.74659 3.70413 7.14335C3.18315 6.5127 2.92266 5.75866 2.92266 4.88123C2.92266 3.81186 3.27912 2.86588 3.99203 2.04329C4.73237 1.19328 5.71947 0.768273 6.95336 0.768273C7.96789 0.768273 8.74935 1.09731 9.29775 1.75538C9.84614 2.41345 10.1203 3.19492 10.1203 4.09977C10.1203 5.16914 9.76388 6.10141 9.05097 6.89658C8.36548 7.66433 7.37837 8.0482 6.08964 8.0482Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default InfoIcon;\n","import React from 'react';\n\nconst QuestionmarkIcon = () => (\n <svg width=\"16\" height=\"30\" viewBox=\"0 0 16 30\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M8.36496 18.7176C7.18591 19.2934 6.18509 19.5813 5.3625 19.5813C3.33344 19.5813 2.31891 18.8547 2.31891 17.4015C2.31891 16.5789 2.55198 15.7563 3.01812 14.9337C3.48425 14.0837 4.04635 13.3159 4.70443 12.6304C5.38992 11.9175 6.07541 11.2183 6.76091 10.5328C7.4464 9.81991 8.02221 9.05216 8.48835 8.22957C8.95448 7.40698 9.18755 6.58439 9.18755 5.7618C9.18755 4.58275 8.54319 3.99323 7.25446 3.99323C6.59639 3.99323 5.93831 4.28113 5.28024 4.85695C4.62217 5.40534 4.15603 6.14567 3.88184 7.07794C1.66084 6.80375 0.550342 6.00858 0.550342 4.69243C0.550342 3.4037 1.30438 2.37547 2.81247 1.60771C4.34797 0.812541 6.11654 0.414955 8.11818 0.414955C9.92788 0.414955 11.5594 0.812541 13.0126 1.60771C14.4658 2.37547 15.1925 3.60935 15.1925 5.30937C15.1925 6.48842 14.9457 7.5715 14.4521 8.55861C13.986 9.5183 13.4102 10.3409 12.7247 11.0264C12.0666 11.7119 11.3948 12.3699 10.7093 13.0006C10.0239 13.6313 9.43433 14.3442 8.94077 15.1393C8.47464 15.9071 8.24157 16.716 8.24157 17.566C8.24157 17.9224 8.2827 18.3063 8.36496 18.7176ZM4.00523 29.4113C3.12779 29.4113 2.40117 29.1234 1.82536 28.5476C1.24954 27.9718 0.961638 27.2314 0.961638 26.3266C0.961638 25.2572 1.35922 24.2838 2.15439 23.4064C2.94957 22.5289 3.90926 22.0902 5.03346 22.0902C5.88347 22.0902 6.59639 22.4056 7.1722 23.0362C7.77543 23.6394 8.07705 24.3935 8.07705 25.2983C8.07705 26.3403 7.66576 27.2863 6.84317 28.1363C6.02057 28.9863 5.07459 29.4113 4.00523 29.4113Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default QuestionmarkIcon;\n","import React, { useEffect, useState } from 'react';\nimport './magicpill.css';\n\nimport ArrowLabel from './icons/arrow_label.js';\nimport BoxLabel from './icons/box_label.js';\nimport CheckmarkLabel from './icons/checkmark_label.js';\nimport CrossLabel from './icons/cross_label.js';\nimport MailLabel from './icons/mail_label.js';\nimport PlusLabel from './icons/plus_label.js';\nimport QuotationLabel from './icons/quotation_label.js';\nimport TelLabel from './icons/tel_label.js';\nimport UndoLabel from './icons/undo_label.js';\n\nimport CheckmarkIcon from './icons/checkmark.js';\nimport CouponIcon from './icons/coupon.js';\nimport InfoIcon from './icons/info.js';\nimport QuestionmarkIcon from './icons/questionmark.js';\n\nconst MagicPill = ({ pillData }) => {\n const [active, setActive] = useState(false)\n const [exit, setExit] = useState(true)\n const { icon, message, cta, info } = pillData;\n const { icon: ctaIcon, label: ctaLabel, link: ctaLink } = cta || {};\n const { title, content, closeLabel } = info || {};\n\n const [collapsed, setCollapsed] = useState(true);\n\n let IconComponent;\n let CTAIconComponent;\n\n switch (icon) {\n case 'checkmark':\n IconComponent = CheckmarkIcon;\n break;\n case 'coupon':\n IconComponent = CouponIcon;\n break;\n case 'info':\n IconComponent = InfoIcon;\n break;\n case 'questionmark':\n IconComponent = QuestionmarkIcon;\n break;\n default:\n IconComponent = null;\n }\n\n const currentCTAIcon = collapsed ? ctaIcon : 'cross';\n switch (currentCTAIcon) {\n case 'arrow':\n CTAIconComponent = ArrowLabel;\n break;\n case 'box':\n CTAIconComponent = BoxLabel;\n break;\n case 'checkmark':\n CTAIconComponent = CheckmarkLabel;\n break;\n case 'cross':\n CTAIconComponent = CrossLabel;\n break;\n case 'mail':\n CTAIconComponent = MailLabel;\n break;\n case 'plus':\n CTAIconComponent = PlusLabel;\n break;\n case 'quotation':\n CTAIconComponent = QuotationLabel;\n break;\n case 'tel':\n CTAIconComponent = TelLabel;\n break;\n case 'undo':\n CTAIconComponent = UndoLabel;\n break;\n default:\n CTAIconComponent = null;\n }\n\n const displayMagicPill = () => {\n setExit(false)\n setTimeout(() => setActive(true), 2500)\n setTimeout(() => {setActive(false); setExit(true)}, 7500)\n }\n\n useEffect(() => {\n displayMagicPill();\n }, []);\n\n return (\n <div className={exit ? 'magicPill out' : active ? 'magicPill active' : 'magicPill entry'}>\n {IconComponent && <IconComponent className=\"icon\"/>}\n <p className='message'>{message}</p>\n {ctaLink && !info && <a className='CTA' href={ctaLink}>{CTAIconComponent && <CTAIconComponent className=\"label\" />}<span>{ctaLabel}</span></a>}\n {ctaLink && info && \n <button \n className='CTA' \n onClick={() => {setCollapsed(!collapsed)}}>\n {CTAIconComponent && <CTAIconComponent className=\"label\" />}\n <span>{collapsed ? ctaLabel : closeLabel}</span>\n </button>\n}\n {info && <div className={!collapsed ? 'info active' : 'info'}><p className='title'>{title}</p><div className='content' dangerouslySetInnerHTML={ {__html: content} }></div></div>}\n </div>\n );\n};\n\nMagicPill.defaultProps = {\n pillData: {\n icon: 'info',\n message: 'Hey ! I\\'m Magic Pill, your omnipotent toolbox !',\n cta: {\n icon: 'arrow',\n label: 'Discover what I can do',\n link: null\n },\n info: {\n title: 'I\\'m Magic Pill, let me empower you !',\n content: '<p>I\\'ll appear sometimes, depending on context, either to send you notifications regarding your experience on this website or to give you indications and hints at what you cn do !</p><p>See you around !</p>',\n closeLabel: 'Close'\n }\n }\n};\n\nexport default MagicPill;"],"names":["ArrowLabel","React","createElement","width","height","viewBox","fill","xmlns","fillRule","clipRule","d","BoxLabel","CheckmarkLabel","CrossLabel","MailLabel","PlusLabel","QuotationLabel","TelLabel","UndoLabel","CheckmarkIcon","CouponIcon","InfoIcon","QuestionmarkIcon","MagicPill","_ref","IconComponent","CTAIconComponent","pillData","_useState2","_slicedToArray","useState","active","setActive","_useState4","exit","setExit","icon","message","cta","info","_ref2","ctaIcon","ctaLabel","label","ctaLink","link","_ref3","title","content","closeLabel","_useState6","collapsed","setCollapsed","useEffect","setTimeout","className","href","onClick","dangerouslySetInnerHTML","__html","defaultProps"],"mappings":"unCAEA,IAAMA,EAAa,WAAH,OACdC,EAAA,QAAAC,cAAA,MAAA,CAAKC,MAAM,KAAKC,OAAO,KAAKC,QAAQ,YAAYC,KAAK,OAAOC,MAAM,8BACpEN,EAAA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,GAAE,KAKrD,GAAE,IAGDlC,EAAA,QAAAC,cAAA,MAAA,CAAKqD,UAAWrB,EAAO,gBAAkBH,EAAS,mBAAqB,mBACpEN,GAAiBxB,EAAAA,QAAAC,cAACuB,EAAa,CAAC8B,UAAU,SAC3CtD,EAAAA,QAAAC,cAAA,IAAA,CAAGqD,UAAU,WAAWlB,GACvBO,IAAYL,GAAQtC,EAAA,QAAAC,cAAA,IAAA,CAAGqD,UAAU,MAAMC,KAAMZ,GAAUlB,GAAoBzB,EAAAA,QAAAC,cAACwB,EAAgB,CAAC6B,UAAU,UAAWtD,EAAA,QAAAC,0BAAOwC,IACzHE,GAAWL,GAChBtC,UAAAC,cAAA,SAAA,CACEqD,UAAU,MACVE,QAAS,WAAOL,GAAcD,EAAU,GACvCzB,GAAoBzB,EAAAA,QAAAC,cAACwB,EAAgB,CAAC6B,UAAU,UACjDtD,EAAAA,QAAAC,cAAA,OAAA,KAAOiD,EAAYT,EAAWO,IAG3BV,GAAQtC,EAAAA,QAAAC,cAAA,MAAA,CAAKqD,UAAYJ,EAA4B,OAAhB,eAAwBlD,EAAA,QAAAC,cAAA,IAAA,CAAGqD,UAAU,SAASR,GAAU9C,UAAAC,cAAA,MAAA,CAAKqD,UAAU,UAAUG,wBAA0B,CAACC,OAAQX,MAGhK,EAEAzB,EAAUqC,aAAe,CACvBjC,SAAU,CACRS,KAAM,OACNC,QAAS,kDACTC,IAAK,CACHF,KAAM,QACNO,MAAO,yBACPE,KAAM,MAERN,KAAM,CACJQ,MAAO,uCACPC,QAAS,iNACTC,WAAY"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/icons/arrow_label.js","../src/icons/box_label.js","../src/icons/checkmark_label.js","../src/icons/cross_label.js","../src/icons/mail_label.js","../src/icons/plus_label.js","../src/icons/quotation_label.js","../src/icons/tel_label.js","../src/icons/undo_label.js","../src/icons/checkmark.js","../src/icons/coupon.js","../src/icons/info.js","../src/icons/questionmark.js","../src/MagicPill.js"],"sourcesContent":["import React from 'react';\n\nconst ArrowLabel = () => (\n <svg width=\"31\" height=\"20\" viewBox=\"0 0 31 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M0.813004 10.2755C0.813004 9.69059 1.28715 9.21645 1.87204 9.21645L26.8501 9.21645L20.1858 2.55207C19.7722 2.1385 19.7722 1.46795 20.1858 1.05438C20.5993 0.640799 21.2699 0.640799 21.6835 1.05438L30.1557 9.52663C30.5693 9.94021 30.5693 10.6107 30.1557 11.0243L21.6835 19.4966C21.2699 19.9102 20.5993 19.9102 20.1858 19.4966C19.7722 19.083 19.7722 18.4125 20.1858 17.9989L26.8501 11.3345L1.87204 11.3345C1.28715 11.3345 0.813004 10.8604 0.813004 10.2755Z\" fill=\"black\"/>\n</svg>\n);\n\nexport default ArrowLabel;","import React from 'react';\n\nconst BoxLabel = () => (\n <svg width=\"27\" height=\"26\" viewBox=\"0 0 27 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M25.5226 4.8102C25.9834 4.99448 26.2855 5.4407 26.2855 5.9369V19.9512C26.2855 20.4474 25.9834 20.8936 25.5226 21.0779L13.7921 25.7701C13.5028 25.8858 13.1801 25.8858 12.8908 25.7701L1.16028 21.0779C0.699563 20.8936 0.397461 20.4474 0.397461 19.9512V5.9369C0.397461 5.4407 0.699563 4.99448 1.16028 4.8102L12.4401 0.298213C12.4451 0.296221 12.4501 0.294245 12.4551 0.292286L12.8908 0.117998C13.1801 0.00227327 13.5028 0.00227283 13.7921 0.117998L14.2279 0.292303C14.2329 0.294256 14.2379 0.296226 14.2428 0.298213L25.5226 4.8102ZM17.2306 3.23602L7.27396 7.21868L3.38482 5.66302L2.01546 6.21076V6.85792L12.5325 11.0647V23.8841L13.3415 24.2077L14.1505 23.8841V11.0647L24.6675 6.85792V6.21076L23.2981 5.66302L13.3415 9.64568L9.45226 8.09L19.4089 4.10734L17.2306 3.23602Z\" fill=\"#141414\"/>\n </svg>\n);\n\nexport default BoxLabel;","import React from 'react';\n\nconst CheckmarkLabel = () => (\n<svg width=\"22\" height=\"18\" viewBox=\"0 0 22 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M18.2019 0.949382C18.9692 0.182085 20.2132 0.182085 20.9805 0.949382C21.7384 1.70727 21.7477 2.93028 21.0084 3.69957L10.55 16.7726C10.5349 16.7915 10.5187 16.8095 10.5017 16.8266C9.73436 17.5939 8.49033 17.5939 7.72303 16.8266L0.790074 9.89367C0.0227749 9.12637 0.022775 7.88233 0.790074 7.11504C1.55737 6.34774 2.80141 6.34774 3.56871 7.11504L9.05315 12.5995L18.1498 1.00816C18.166 0.987539 18.1834 0.967913 18.2019 0.949382Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default CheckmarkLabel;","import React from 'react';\n\nconst CrossLabel = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.808942 1.61705C0.493007 1.30112 0.493007 0.788885 0.808942 0.472951C1.12488 0.157017 1.63711 0.157017 1.95304 0.472951L10.28 8.7999L18.6069 0.472951C18.9229 0.157017 19.4351 0.157017 19.751 0.472951C20.067 0.788885 20.067 1.30112 19.751 1.61705L11.4241 9.944L19.751 18.271C20.067 18.5869 20.067 19.0991 19.751 19.4151C19.4351 19.731 18.9229 19.731 18.6069 19.4151L10.28 11.0881L1.95304 19.4151C1.63711 19.731 1.12488 19.731 0.808943 19.4151C0.493008 19.0991 0.493008 18.5869 0.808943 18.271L9.13589 9.944L0.808942 1.61705Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default CrossLabel;\n","import React from 'react';\n\nconst MailLabel = () => (\n <svg width=\"27\" height=\"20\" viewBox=\"0 0 27 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.701567 2.7527C1.02864 1.31171 2.31737 0.236 3.85734 0.236H23.2733C24.8133 0.236 26.102 1.31171 26.4291 2.7527L13.5653 10.6139L0.701567 2.7527ZM0.621338 4.59988V16.0934L10.0109 10.338L0.621338 4.59988ZM11.5613 11.2854L0.931785 17.8008C1.45073 18.8952 2.56565 19.652 3.85734 19.652H23.2733C24.565 19.652 25.6799 18.8952 26.1989 17.8008L15.5694 11.2854L13.5653 12.5101L11.5613 11.2854ZM17.1198 10.338L26.5093 16.0934V4.59988L17.1198 10.338Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default MailLabel;\n","import React from 'react';\n\nconst PlusLabel = () => (\n <svg width=\"27\" height=\"28\" viewBox=\"0 0 27 28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.8045 14.7234C0.357701 14.7234 -0.00450093 14.3612 -0.00450059 13.9144C-0.00450082 13.4676 0.357702 13.1054 0.8045 13.1054L12.5806 13.1054L12.5806 1.32934C12.5806 0.882544 12.9428 0.520341 13.3896 0.52034C13.8364 0.520341 14.1986 0.882543 14.1986 1.32934L14.1986 13.1054L25.9747 13.1054C26.4215 13.1054 26.7837 13.4676 26.7837 13.9144C26.7837 14.3612 26.4215 14.7234 25.9747 14.7234H14.1986L14.1986 26.4995C14.1986 26.9463 13.8364 27.3085 13.3896 27.3085C12.9428 27.3085 12.5806 26.9463 12.5806 26.4995L12.5806 14.7234L0.8045 14.7234Z\" fill=\"black\"/>\n</svg>\n);\n\nexport default PlusLabel;\n","import React from 'react';\n\nconst QuotationLabel = () => (\n<svg width=\"21\" height=\"26\" viewBox=\"0 0 21 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12.5453 0H3.98136C2.19417 0 0.745361 1.44881 0.745361 3.236V22.652C0.745361 24.4392 2.19417 25.888 3.98136 25.888H16.9254C18.7126 25.888 20.1614 24.4392 20.1614 22.652V7.6161C20.1614 7.18698 19.9909 6.77544 19.6875 6.472L13.6894 0.473901C13.3859 0.170467 12.9744 0 12.5453 0ZM12.8804 5.663V2.427L17.7344 7.281H14.4984C13.6048 7.281 12.8804 6.5566 12.8804 5.663ZM2.36336 14.562H18.5434V16.18H7.21736V19.416H18.5434V21.034H7.21736V24.27H5.59936V21.034H2.36336V19.416H5.59936V16.18H2.36336V14.562Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default QuotationLabel;\n","import React from 'react';\n\nconst TelLabel = () => (\n<svg width=\"27\" height=\"26\" viewBox=\"0 0 27 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M3.78296 0.826921C4.9837 -0.37382 6.96512 -0.250462 8.00765 1.08994L10.9099 4.82136C11.4425 5.50612 11.6307 6.39771 11.4203 7.2393L10.5348 10.7812C10.4413 11.1551 10.5509 11.5507 10.8234 11.8232L14.7982 15.798C15.0707 16.0705 15.4663 16.1801 15.8402 16.0866L19.3821 15.2011C20.2237 14.9907 21.1153 15.1789 21.8 15.7115L25.5315 18.6138C26.8719 19.6563 26.9952 21.6377 25.7945 22.8384L24.1216 24.5113C22.9247 25.7082 21.1346 26.2337 19.4662 25.6472C15.3238 24.1908 11.4355 21.8064 8.12521 18.4962C4.81496 15.1859 2.4306 11.2976 0.974218 7.1552C0.38766 5.48684 0.913207 3.69668 2.11007 2.49981L3.78296 0.826921Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default TelLabel;\n","import React from 'react';\n\nconst UndoLabel = () => (\n<svg width=\"24\" height=\"25\" viewBox=\"0 0 24 25\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M0.85896 7.85305C0.543026 7.53712 0.543026 7.02489 0.85896 6.70895L7.33096 0.236954C7.64689 -0.0789795 8.15912 -0.0789795 8.47506 0.236954C8.79099 0.552889 8.79099 1.06512 8.47506 1.38105L3.38411 6.472H19.229C21.463 6.472 23.274 8.28301 23.274 10.517V23.461C23.274 23.9078 22.9118 24.27 22.465 24.27C22.0182 24.27 21.656 23.9078 21.656 23.461V10.517C21.656 9.17661 20.5694 8.09 19.229 8.09H3.38411L8.47506 13.181C8.79099 13.4969 8.79099 14.0091 8.47506 14.3251C8.15912 14.641 7.64689 14.641 7.33096 14.3251L0.85896 7.85305Z\" fill=\"#141414\"/>\n</svg>\n);\n\nexport default UndoLabel;\n","import React from 'react';\n\nconst CheckmarkIcon = () => (\n <svg width=\"36\" height=\"28\" viewBox=\"0 0 36 28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M31.7745 0.900854C32.7099 -0.0470194 34.2265 -0.0470194 35.1619 0.900854C36.0859 1.8371 36.0972 3.34793 35.1959 4.29828L16.0585 26.9205C16.0401 26.9438 16.0204 26.966 15.9996 26.9872C15.0641 27.935 13.5475 27.935 12.6121 26.9872L0.966345 15.1863C0.0309227 14.2385 0.0309227 12.7017 0.966344 11.7538C1.90177 10.8059 3.41838 10.8059 4.35381 11.7538L14.2337 21.7652L31.7109 0.97346C31.7307 0.947992 31.7519 0.923746 31.7745 0.900854Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default CheckmarkIcon;","import React from 'react';\n\nconst CouponIcon = () => (\n <svg width=\"43\" height=\"27\" viewBox=\"0 0 43 27\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.804932 4.11207C0.804932 1.94314 2.56319 0.184875 4.73212 0.184875H38.7678C40.9367 0.184875 42.695 1.94314 42.695 4.11207V8.03925C42.695 8.76223 42.1089 9.34832 41.3859 9.34832C39.217 9.34832 37.4587 11.1066 37.4587 13.2755C37.4587 15.4444 39.217 17.2027 41.3859 17.2027C42.1089 17.2027 42.695 17.7888 42.695 18.5118V22.4389C42.695 24.6079 40.9367 26.3661 38.7678 26.3661H4.73212C2.56319 26.3661 0.804932 24.6079 0.804932 22.4389V18.5118C0.804932 17.7888 1.39102 17.2027 2.11399 17.2027C4.28292 17.2027 6.04118 15.4444 6.04118 13.2755C6.04118 11.1066 4.28292 9.34832 2.11399 9.34832C1.39102 9.34832 0.804932 8.76223 0.804932 8.03925V4.11207ZM11.2774 1.49394V4.11207H13.8956V1.49394H11.2774ZM13.8956 9.34832V6.73019H11.2774V9.34832H13.8956ZM32.2224 9.34832V6.73019H29.6043V9.34832H32.2224ZM29.6043 4.11207H32.2224V1.49394H29.6043V4.11207ZM13.8956 11.9664H11.2774V14.5846H13.8956V11.9664ZM32.2224 14.5846V11.9664H29.6043V14.5846H32.2224ZM13.8956 17.2027H11.2774V19.8208H13.8956V17.2027ZM32.2224 19.8208V17.2027H29.6043V19.8208H32.2224ZM11.2774 22.4389V25.0571H13.8956V22.4389H11.2774ZM29.6043 25.0571H32.2224V22.4389H29.6043V25.0571Z\" fill=\"white\"/>\n</svg>\n);\n\nexport default CouponIcon;\n","import React from 'react';\n\nconst InfoIcon = () => (\n <svg width=\"11\" height=\"31\" viewBox=\"0 0 11 31\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.51383 9.94016C7.59773 9.94016 8.63967 11.1741 8.63967 13.6418C8.63967 14.7386 8.33806 16.6854 7.73482 19.4822C7.13159 22.279 6.82997 24.0065 6.82997 24.6645C6.82997 25.7613 7.26869 26.5839 8.14612 27.1323C7.76224 28.1743 7.18643 28.9694 6.41868 29.5178C5.67835 30.0388 4.85575 30.2993 3.9509 30.2993C1.62023 30.2993 0.454891 29.0517 0.454891 26.5565C0.454891 25.2678 0.756508 23.2387 1.35974 20.4693C1.99039 17.6999 2.30572 15.9725 2.30572 15.287C2.30572 14.108 1.88072 13.4636 1.0307 13.3539C1.1678 12.3942 1.64765 11.5853 2.47024 10.9273C3.32025 10.2692 4.33478 9.94016 5.51383 9.94016ZM6.08964 8.0482C5.04769 8.0482 4.25252 7.74659 3.70413 7.14335C3.18315 6.5127 2.92266 5.75866 2.92266 4.88123C2.92266 3.81186 3.27912 2.86588 3.99203 2.04329C4.73237 1.19328 5.71947 0.768273 6.95336 0.768273C7.96789 0.768273 8.74935 1.09731 9.29775 1.75538C9.84614 2.41345 10.1203 3.19492 10.1203 4.09977C10.1203 5.16914 9.76388 6.10141 9.05097 6.89658C8.36548 7.66433 7.37837 8.0482 6.08964 8.0482Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default InfoIcon;\n","import React from 'react';\n\nconst QuestionmarkIcon = () => (\n <svg width=\"16\" height=\"30\" viewBox=\"0 0 16 30\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M8.36496 18.7176C7.18591 19.2934 6.18509 19.5813 5.3625 19.5813C3.33344 19.5813 2.31891 18.8547 2.31891 17.4015C2.31891 16.5789 2.55198 15.7563 3.01812 14.9337C3.48425 14.0837 4.04635 13.3159 4.70443 12.6304C5.38992 11.9175 6.07541 11.2183 6.76091 10.5328C7.4464 9.81991 8.02221 9.05216 8.48835 8.22957C8.95448 7.40698 9.18755 6.58439 9.18755 5.7618C9.18755 4.58275 8.54319 3.99323 7.25446 3.99323C6.59639 3.99323 5.93831 4.28113 5.28024 4.85695C4.62217 5.40534 4.15603 6.14567 3.88184 7.07794C1.66084 6.80375 0.550342 6.00858 0.550342 4.69243C0.550342 3.4037 1.30438 2.37547 2.81247 1.60771C4.34797 0.812541 6.11654 0.414955 8.11818 0.414955C9.92788 0.414955 11.5594 0.812541 13.0126 1.60771C14.4658 2.37547 15.1925 3.60935 15.1925 5.30937C15.1925 6.48842 14.9457 7.5715 14.4521 8.55861C13.986 9.5183 13.4102 10.3409 12.7247 11.0264C12.0666 11.7119 11.3948 12.3699 10.7093 13.0006C10.0239 13.6313 9.43433 14.3442 8.94077 15.1393C8.47464 15.9071 8.24157 16.716 8.24157 17.566C8.24157 17.9224 8.2827 18.3063 8.36496 18.7176ZM4.00523 29.4113C3.12779 29.4113 2.40117 29.1234 1.82536 28.5476C1.24954 27.9718 0.961638 27.2314 0.961638 26.3266C0.961638 25.2572 1.35922 24.2838 2.15439 23.4064C2.94957 22.5289 3.90926 22.0902 5.03346 22.0902C5.88347 22.0902 6.59639 22.4056 7.1722 23.0362C7.77543 23.6394 8.07705 24.3935 8.07705 25.2983C8.07705 26.3403 7.66576 27.2863 6.84317 28.1363C6.02057 28.9863 5.07459 29.4113 4.00523 29.4113Z\" fill=\"#F9F9F9\"/>\n</svg>\n);\n\nexport default QuestionmarkIcon;\n","import React, { useEffect, useState } from 'react';\nimport './magicpill.css';\n\nimport ArrowLabel from './icons/arrow_label.js';\nimport BoxLabel from './icons/box_label.js';\nimport CheckmarkLabel from './icons/checkmark_label.js';\nimport CrossLabel from './icons/cross_label.js';\nimport MailLabel from './icons/mail_label.js';\nimport PlusLabel from './icons/plus_label.js';\nimport QuotationLabel from './icons/quotation_label.js';\nimport TelLabel from './icons/tel_label.js';\nimport UndoLabel from './icons/undo_label.js';\n\nimport CheckmarkIcon from './icons/checkmark.js';\nimport CouponIcon from './icons/coupon.js';\nimport InfoIcon from './icons/info.js';\nimport QuestionmarkIcon from './icons/questionmark.js';\n\nconst MagicPill = ({ pillData }) => {\n const [active, setActive] = useState(false);\n const [exit, setExit] = useState(true);\n const [hovering, setHovering] = useState(false);\n const timeoutRef = useRef(null);\n const { icon, message, cta, info } = pillData;\n const { icon: ctaIcon, label: ctaLabel, link: ctaLink } = cta || {};\n const { title, content, closeLabel } = info || {};\n\n const [collapsed, setCollapsed] = useState(true);\n\n let IconComponent;\n let CTAIconComponent;\n\n switch (icon) {\n case 'checkmark':\n IconComponent = CheckmarkIcon;\n break;\n case 'coupon':\n IconComponent = CouponIcon;\n break;\n case 'info':\n IconComponent = InfoIcon;\n break;\n case 'questionmark':\n IconComponent = QuestionmarkIcon;\n break;\n default:\n IconComponent = null;\n }\n\n const currentCTAIcon = collapsed ? ctaIcon : 'cross';\n switch (currentCTAIcon) {\n case 'arrow':\n CTAIconComponent = ArrowLabel;\n break;\n case 'box':\n CTAIconComponent = BoxLabel;\n break;\n case 'checkmark':\n CTAIconComponent = CheckmarkLabel;\n break;\n case 'cross':\n CTAIconComponent = CrossLabel;\n break;\n case 'mail':\n CTAIconComponent = MailLabel;\n break;\n case 'plus':\n CTAIconComponent = PlusLabel;\n break;\n case 'quotation':\n CTAIconComponent = QuotationLabel;\n break;\n case 'tel':\n CTAIconComponent = TelLabel;\n break;\n case 'undo':\n CTAIconComponent = UndoLabel;\n break;\n default:\n CTAIconComponent = null;\n }\n\n const displayMagicPill = () => {\n setExit(false);\n setTimeout(() => setActive(true), 2500);\n };\n\n const startExitAnimation = () => {\n timeoutRef.current = setTimeout(() => {\n if (!hovering) {\n setActive(false);\n setTimeout(() => setExit(true), 500);\n }\n }, 5000);\n };\n\n const clearExitAnimation = () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n\n const handleMouseEnter = () => {\n setHovering(true);\n clearExitAnimation();\n };\n\n const handleMouseLeave = () => {\n setHovering(false);\n startExitAnimation();\n };\n\n useEffect(() => {\n displayMagicPill();\n\n return () => {\n clearExitAnimation();\n };\n }, []);\n\n return (\n <div className={exit ? 'magicPill out' : active ? 'magicPill active' : 'magicPill entry'} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} >\n {IconComponent && <IconComponent className=\"icon\"/>}\n <p className='message'>{message}</p>\n {ctaLink && !info && <a className='CTA' href={ctaLink}>{CTAIconComponent && <CTAIconComponent className=\"label\" />}<span>{ctaLabel}</span></a>}\n {ctaLink && info && \n <button \n className='CTA' \n onClick={() => {setCollapsed(!collapsed)}}>\n {CTAIconComponent && <CTAIconComponent className=\"label\" />}\n <span>{collapsed ? ctaLabel : closeLabel}</span>\n </button>\n}\n {info && <div className={!collapsed ? 'info active' : 'info'}><p className='title'>{title}</p><div className='content' dangerouslySetInnerHTML={ {__html: content} }></div></div>}\n </div>\n );\n};\n\nMagicPill.defaultProps = {\n pillData: {\n icon: 'info',\n message: 'Hey ! I\\'m Magic Pill, your omnipotent toolbox !',\n cta: {\n icon: 'arrow',\n label: 'Discover what I can do',\n link: null\n },\n info: {\n title: 'I\\'m Magic Pill, let me empower you !',\n content: '<p>I\\'ll appear sometimes, depending on context, either to send you notifications regarding your experience on this website or to give you indications and hints at what you cn do !</p><p>See you around !</p>',\n closeLabel: 'Close'\n }\n }\n};\n\nexport default MagicPill;"],"names":["ArrowLabel","React","createElement","width","height","viewBox","fill","xmlns","fillRule","clipRule","d","BoxLabel","CheckmarkLabel","CrossLabel","MailLabel","PlusLabel","QuotationLabel","TelLabel","UndoLabel","CheckmarkIcon","CouponIcon","InfoIcon","QuestionmarkIcon","MagicPill","_ref","IconComponent","CTAIconComponent","pillData","_useState2","_slicedToArray","useState","active","setActive","_useState4","exit","setExit","_useState6","hovering","setHovering","timeoutRef","useRef","icon","message","cta","info","_ref2","ctaIcon","ctaLabel","label","ctaLink","link","_ref3","title","content","closeLabel","_useState8","collapsed","setCollapsed","clearExitAnimation","current","clearTimeout","useEffect","setTimeout","className","onMouseEnter","onMouseLeave","href","onClick","dangerouslySetInnerHTML","__html","defaultProps"],"mappings":"unCAEA,IAAMA,EAAa,WAAH,OACdC,EAAA,QAAAC,cAAA,MAAA,CAAKC,MAAM,KAAKC,OAAO,KAAKC,QAAQ,YAAYC,KAAK,OAAOC,MAAM,8BACpEN,EAAA,QAAAC,cAAA,OAAA,CAAMM,SAAS,UAAUC,SAAS,UAAUC,EAAE,wcAAwcJ,KAAK,UACrf,ECHAK,EAAW,WAAH,OACbV,EAAA,QAAAC,cAAA,MAAA,CAAKC,MAAM,KAAKC,OAAO,KAAKC,QAAQ,YAAYC,KAAK,OAAOC,MAAM,8BAClEN,EAAA,QAAAC,cAAA,OAAA,CAAMM,SAAS,UAAUC,SAAS,UAAUC,EAAE,gwBAAgwBJ,KAAK,YAC7yB,ECHDM,EAAiB,WAAH,OACpBX,EAAA,QAAAC,cAAA,MAAA,CAAKC,MAAM,KAAKC,OAAO,KAAKC,QAAQ,YAAYC,KAAK,OAAOC,MAAM,8BAClEN,EAAA,QAAAC,cAAA,OAAA,CAAMQ,EAA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AAAA,QAAAC,cAACuB,EAAa,CAACsC,UAAU,SAC3C9D,EAAAA,QAAAC,cAAA,IAAA,CAAG6D,UAAU,WAAWrB,GACvBO,IAAYL,GAAQ3C,EAAA,QAAAC,cAAA,IAAA,CAAG6D,UAAU,MAAMG,KAAMjB,GAAUvB,GAAoBzB,EAAAA,QAAAC,cAACwB,EAAgB,CAACqC,UAAU,UAAW9D,EAAA,QAAAC,0BAAO6C,IACzHE,GAAWL,GAChB3C,UAAAC,cAAA,SAAA,CACE6D,UAAU,MACVI,QAAS,WAAOV,GAAcD,EAAU,GACvC9B,GAAoBzB,EAAAA,QAAAC,cAACwB,EAAgB,CAACqC,UAAU,UACjD9D,EAAAA,QAAAC,cAAA,OAAA,KAAOsD,EAAYT,EAAWO,IAG3BV,GAAQ3C,EAAAA,QAAAC,cAAA,MAAA,CAAK6D,UAAYP,EAA4B,OAAhB,eAAwBvD,EAAA,QAAAC,cAAA,IAAA,CAAG6D,UAAU,SAASX,GAAUnD,UAAAC,cAAA,MAAA,CAAK6D,UAAU,UAAUK,wBAA0B,CAACC,OAAQhB,MAGhK,EAEA9B,EAAU+C,aAAe,CACvB3C,SAAU,CACRc,KAAM,OACNC,QAAS,kDACTC,IAAK,CACHF,KAAM,QACNO,MAAO,yBACPE,KAAM,MAERN,KAAM,CACJQ,MAAO,uCACPC,QAAS,iNACTC,WAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magic-pill",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.18",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
"files": [
|
|
38
38
|
"dist",
|
|
39
39
|
"index.d.ts",
|
|
40
|
-
"CHANGELOG.md"
|
|
40
|
+
"CHANGELOG.md",
|
|
41
|
+
"LICENSE.md",
|
|
42
|
+
"NOTICE.md"
|
|
41
43
|
]
|
|
42
44
|
}
|