Version Description
Download this release
Release Info
Developer | cgastrell |
Plugin | Crowdsignal Forms |
Version | 1.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.9.0 to 1.0.0
- README.TXT +17 -3
- build/editor.asset.php +1 -1
- build/editor.css +1 -1
- build/editor.js +13 -13
- build/poll.asset.php +1 -1
- build/poll.css +1 -1
- build/poll.js +12 -12
- build/rtl/editor-rtl.css +3 -0
- build/rtl/poll-rtl.css +3 -0
- changelog.txt +14 -0
- crowdsignal-forms.php +2 -3
- includes/admin/admin-styles.css +12 -36
- includes/admin/class-admin-hooks.php +1 -1
- includes/admin/class-crowdsignal-forms-settings.php +4 -4
- includes/admin/class-crowdsignal-forms-setup.php +3 -2
- includes/admin/rtl/admin-styles-rtl.css +286 -0
- includes/admin/views/html-admin-setup-header.php +1 -1
- includes/admin/views/html-admin-setup-step-1.php +0 -1
- includes/class-crowdsignal-forms.php +41 -4
- includes/frontend/blocks/class-crowdsignal-forms-poll-block.php +9 -3
- includes/gateways/class-api-gateway-interface.php +9 -0
- includes/gateways/class-api-gateway.php +26 -0
- includes/rest-api/controllers/class-account-controller.php +14 -4
- languages/crowdsignal-forms.pot +4 -4
README.TXT
CHANGED
@@ -4,7 +4,7 @@ Tags: polls, forms, surveys, gutenberg, block
|
|
4 |
Requires at least: 5.0
|
5 |
Requires PHP: 5.6.20
|
6 |
Tested up to: 5.4.2
|
7 |
-
Stable tag: 0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -21,7 +21,7 @@ With Crowdsignal’s results page you can view all responses as they come in. Se
|
|
21 |
|
22 |
Analyze your results and then export them in a number of different formats.
|
23 |
|
24 |
-
Set close dates for polls, create polls with single or multiple choice answers, choose whether to show your readers the poll results or keep them private.
|
25 |
|
26 |
You can create an unlimited number of polls with a free [Crowdsignal](https://crowdsignal.com/) account and your first 2,500 signals are free. A signal is a response you get to a poll. If you are on a free plan, you still have full access to the first 2,500 signals. Any further responses you collect will still be recorded but if you [upgrade](https://crowdsignal.com/pricing/) you will get access to our unlocked reports to see them. You’ll also get access to a [range of features](https://crowdsignal.com/features/) not available to free users.
|
27 |
|
@@ -67,6 +67,21 @@ Compare our [simple and affordable plans](https://crowdsignal.com/pricing/) or t
|
|
67 |
|
68 |
== Changelog ==
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
= 0.9 =
|
71 |
* Initial release
|
72 |
|
@@ -74,4 +89,3 @@ Compare our [simple and affordable plans](https://crowdsignal.com/pricing/) or t
|
|
74 |
|
75 |
= 0.9 =
|
76 |
Initial release
|
77 |
-
|
4 |
Requires at least: 5.0
|
5 |
Requires PHP: 5.6.20
|
6 |
Tested up to: 5.4.2
|
7 |
+
Stable tag: 1.0.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
21 |
|
22 |
Analyze your results and then export them in a number of different formats.
|
23 |
|
24 |
+
Set close dates for polls, create polls with single or multiple choice answers, choose whether to show your readers the poll results or keep them private.
|
25 |
|
26 |
You can create an unlimited number of polls with a free [Crowdsignal](https://crowdsignal.com/) account and your first 2,500 signals are free. A signal is a response you get to a poll. If you are on a free plan, you still have full access to the first 2,500 signals. Any further responses you collect will still be recorded but if you [upgrade](https://crowdsignal.com/pricing/) you will get access to our unlocked reports to see them. You’ll also get access to a [range of features](https://crowdsignal.com/features/) not available to free users.
|
27 |
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 1.0 =
|
71 |
+
* Update default sidebar status
|
72 |
+
* Increase Default Poll Margins
|
73 |
+
* Test suite for admin hooks
|
74 |
+
* Copy text reviews
|
75 |
+
* Added support for loading curated list of google fonts
|
76 |
+
* Normalize "thanks you" message
|
77 |
+
* Fix display of "thank you" message (custom and default) on dark backgrounds
|
78 |
+
* Add Separate Question and Body Font Family fallbacks
|
79 |
+
* Fix styles on wp-admin not honoring margins
|
80 |
+
* Fix submit button styling for themes with very specific selectors (ex TwentyNineteen theme)
|
81 |
+
* Add Unverified Account Check
|
82 |
+
* Code cleanup
|
83 |
+
* Update translations
|
84 |
+
|
85 |
= 0.9 =
|
86 |
* Initial release
|
87 |
|
89 |
|
90 |
= 0.9 =
|
91 |
Initial release
|
|
build/editor.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-polyfill'), 'version' => 'b947cd2ef42def8776ce352481a58913');
|
build/editor.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="full"] .wp-block-crowdsignal-forms-poll{border-left-width:0;border-right-width:0}@media screen and (min-width: 660px){#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="wide"] .wp-block-crowdsignal-forms-poll__content,#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="full"] .wp-block-crowdsignal-forms-poll__content{padding:80px}}#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer{cursor:text}#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer:hover,#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer.is-focused{color:inherit}#editor .editor-styles-wrapper .wp-block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{cursor:text}.wp-block-crowdsignal-forms__redirect-url input[type="text"]{width:100%}.wp-block-crowdsignal-forms__redirect-url__suggestions{width:260px}.wp-block-crowdsignal-forms__row{display:flex;flex-direction:row}.wp-block-crowdsignal-forms__row .wp-block-crowdsignal-forms__small-text-input input[type="text"]{width:40px}.wp-block-crowdsignal-forms__row .wp-block-crowdsignal-forms__small-text-input input[type="number"]{width:50px}.wp-block-crowdsignal-forms-poll__edit-bar{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-left:4px solid #d82e20;background:#f8dad8;display:flex;flex-direction:row;justify-content:space-between;align-items:center}.wp-block-crowdsignal-forms-poll__edit-bar .wp-block-crowdsignal-forms-poll__edit-bar-message{padding-inline-end:24px}.wp-block-crowdsignal-forms-poll__edit-bar button.wp-block-crowdsignal-forms-poll__edit-bar-button{border:2px solid #d82e20;border-radius:4px;color:#d82e20;background:transparent;padding:8px 16px;cursor:pointer}.wp-block-crowdsignal-forms__view-results.is-disabled{opacity:0.5;pointer-events:none}.wp-block-crowdsignal-forms__connect-to-crowdsignal{border:1px solid #000;font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;padding:24px;text-align:initial}.wp-block-crowdsignal-forms__connect-to-crowdsignal-header{display:flex;flex-direction:row;align-items:center}.wp-block-crowdsignal-forms__connect-to-crowdsignal-body{font-size:13px;margin-top:24px;margin-bottom:16px}.wp-block-crowdsignal-forms__connect-to-crowdsignal-title{font-size:24pt;margin-inline-start:16px}.wp-block-crowdsignal-forms-poll{border-color:var(--crowdsignal-forms-border-color);border-style:solid;border-width:var(--crowdsignal-forms-border-width);margin-top:1.25em;margin-bottom:1.25em;position:relative;text-align:left}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll{border-left-width:0;border-right-width:0}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question{margin:0 0 28px}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question:first-child{margin-top:0}.wp-block-crowdsignal-forms-poll p.wp-block-crowdsignal-forms-poll__note{font-style:italic;margin:0 0 32px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:40px 24px 16px 24px}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{margin:0 auto;max-width:var(--crowdsignal-forms-content-wide-width)}@media screen and (min-width: 660px){.alignwide.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content,.alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:80px}}.wp-block-crowdsignal-forms-poll.is-closed .wp-block-crowdsignal-forms-poll__form{opacity:0.5}.wp-block-crowdsignal-forms-poll.is-hidden{opacity:0.5}.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__answer-label-wrapper,.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__question,.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__note{font-family:var(--crowdsignal-forms-font-family)}.wp-block-crowdsignal-forms-poll.has-text-color{color:var(--crowdsignal-forms-text-color)}.wp-block-crowdsignal-forms-poll.has-bg-color{background-color:var(--crowdsignal-forms-bg-color)}.wp-block-crowdsignal-forms-poll.has-border-radius{border-radius:var(--crowdsignal-forms-border-radius);overflow:hidden}.wp-block-crowdsignal-forms-poll.has-box-shadow{box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23)}.wp-block-crowdsignal-forms-poll__submit-button:disabled{opacity:0.7}.wp-block-crowdsignal-forms-poll.has-submit-button-bg-color .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{background-color:var(--crowdsignal-forms-submit-button-bg-color)}.wp-block-crowdsignal-forms-poll.has-submit-button-text-color .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{color:var(--crowdsignal-forms-submit-button-text-color)}.wp-block-crowdsignal-forms-poll__answer{cursor:pointer;display:flex;font-size:inherit;font-weight:600;margin:0 0 16px;padding:0 2px;position:relative}.wp-block-crowdsignal-forms-poll__answer:hover,.wp-block-crowdsignal-forms-poll__answer.is-focused{color:var(--crowdsignal-forms-submit-button-bg-color)}.has-voted .wp-block-crowdsignal-forms-poll__answer{opacity:0.5}input[type="checkbox"].wp-block-crowdsignal-forms-poll__input,input[type="radio"].wp-block-crowdsignal-forms-poll__input{height:0;opacity:0;position:absolute;width:0}.wp-block-crowdsignal-forms-poll__check{display:inline-block;height:1em;margin:0 10px 0 0;position:relative;width:1em}.wp-block-crowdsignal-forms-poll__check::before{background-color:transparent;border:1.5px solid var(--crowdsignal-forms-text-color);border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;transition:background-color 0.3s, border-color 0.3s;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::before{border-radius:3px}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice.is-selected .wp-block-crowdsignal-forms-poll__check::before{border-color:var(--crowdsignal-forms-border-color);background-color:var(--crowdsignal-forms-border-color)}.wp-block-crowdsignal-forms-poll__answer.is-selected:not(.is-multiple-choice) .wp-block-crowdsignal-forms-poll__check::after{animation-duration:0.3s;animation-name:crowdsignal-forms-animation__pop;animation-iteration-count:1;background-clip:padding-box;background-color:var(--crowdsignal-forms-border-color);border:4.5px solid transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;position:absolute;left:0;top:0;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-selected.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::after{border-color:var(--crowdsignal-forms-submit-button-text-color);border-style:solid;border-width:0 0 2px 2px;box-sizing:border-box;content:"";display:block;height:25%;margin:-0.1em 0 0 -0.2em;position:absolute;left:50%;top:50%;transform:rotateZ(-45deg);width:50%}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper{flex:1;word-break:break-word}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label{line-height:1;vertical-align:top}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label span::after{vertical-align:top}.wp-block-crowdsignal-forms-poll__button{border:0;padding:0}.wp-block-crowdsignal-forms-poll__actions{display:flex;justify-content:flex-end}.wp-block-crowdsignal-forms-poll__actions .wp-block-button{margin:0}.editor-styles-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__actions .wp-block-button.wp-block-crowdsignal-forms-poll__block-button{margin:0}.wp-block-crowdsignal-forms-poll__closed-banner{background-color:var(--crowdsignal-forms-border-color);box-sizing:border-box;display:flex;color:var(--crowdsignal-forms-submit-button-text-color);font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;justify-content:center;padding:calc(var(--crowdsignal-forms-border-width) + 0.2em) 0 0.2em;width:100%}.is-hidden .wp-block-crowdsignal-forms-poll__closed-banner{font-style:italic}.wp-block-crowdsignal-forms-poll__error{color:red}.wp-block-crowdsignal-forms-poll__results-list{margin:0 0 1em;position:relative}.wp-block-crowdsignal-forms-poll__answer-results{display:flex;flex-direction:column;margin:0 0 16px;width:100%}.wp-block-crowdsignal-forms-poll__answer-results:last-child{margin:0}.wp-block-crowdsignal-forms-poll__answer-results-labels{align-items:flex-end;display:flex;margin:0 0 8px;width:100%;word-break:break-word}.wp-block-crowdsignal-forms-poll__answer-results-answer{flex:1;font-size:1em;font-weight:600}.wp-block-crowdsignal-forms-poll__answer-results-votes{font-size:0.75em;line-height:2}.wp-block-crowdsignal-forms-poll__answer-results-percent{font-weight:600;line-height:1.6}.wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results-percent{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;margin-left:20px;transition:opacity 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-percent{display:none}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse;background-color:var(--crowdsignal-forms-text-color);font-size:0.7em;height:1em;width:50px}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes:last-child,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent:last-child{width:40px}.wp-block-crowdsignal-forms-poll__answer-results-progress-track{border:1px solid;border-color:rgba(var(--crowdsignal-forms-text-color-properties), 0.3);box-sizing:border-box;height:1em;width:100%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-track{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse}.wp-block-crowdsignal-forms-poll__answer-results-progress-bar{animation-fill-mode:forwards;background-color:var(--crowdsignal-forms-submit-button-bg-color);height:100%;transition:background-color 0.3s, width 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:0}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{background-color:var(--crowdsignal-forms-text-color);width:25%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+1) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:40%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+2) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:75%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+3) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:50%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+4) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:60%}.wp-block-crowdsignal-forms-poll__results-footer{display:flex;flex-direction:column;justify-content:space-between;width:100%;font-size:0.9em}.wp-block-crowdsignal-forms-poll__results-total{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;position:relative;text-align:right;width:100%;margin-bottom:1em}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total{color:transparent}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total::before{animation-name:crowdsignal-forms-animation__pulse;animation-duration:1.5s;animation-iteration-count:infinite;background-color:var(--crowdsignal-forms-text-color);content:"";display:block;position:absolute;right:0;height:1em;width:150px}.wp-block-crowdsignal-forms-poll__footer-branding{display:flex;justify-content:space-between;align-items:center;width:100%}.wp-block-crowdsignal-forms-poll__footer-branding img.wp-block-crowdsignal-forms-poll__footer-branding-logo{width:50px;height:50px;margin-left:0;margin-right:0}.wp-block-crowdsignal-forms-poll__footer-cs-link{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:16px;text-decoration:none;text-transform:uppercase}.wp-block-crowdsignal-forms-poll__footer-cs-link:not(:hover){color:var(--crowdsignal-forms-text-color);opacity:0.4}.wp-block-crowdsignal-forms-poll__error-banner{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-left:4px solid #d82e20;background:#f8dad8}.wp-block-crowdsignal-forms-poll__submit-message-container{position:absolute;background-color:#fff;left:0;top:0;width:100%;height:100%;overflow:hidden}.wp-block-crowdsignal-forms-poll__submit-message{position:relative}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message{position:absolute;right:0;top:0;background-color:transparent;color:#000;text-decoration:none;border:none}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message:hover{background:inherit}.wp-block-crowdsignal-forms-poll__submit-message-footer{position:absolute;bottom:0;left:0;padding:16px 24px;width:100%;background-color:#fff}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker{right:25px;top:66px}.wp-block-crowdsignal-forms-poll__thank-you-sticker{right:132px;top:12px}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker,.wp-block-crowdsignal-forms-poll__thank-you-sticker{filter:drop-shadow(0 1px 2px rgba(0,0,0,0.2));width:100px;height:100px;position:absolute}.wp-block-crowdsignal-forms-poll__custom-message-check{color:var(--crowdsignal-forms-submit-button-bg-color);padding-left:24px;padding-top:24px}.wp-block-crowdsignal-forms-poll__custom-message{font-weight:600;padding:16px 24px}.wp_block-crowdsignal-forms-poll__vote-branding{margin-top:16px}.crowdsignal-forms__style-probe{display:none}
|
1 |
+
#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="full"] .wp-block-crowdsignal-forms-poll{border-left-width:0;border-right-width:0}@media screen and (min-width: 660px){#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="wide"] .wp-block-crowdsignal-forms-poll__content,#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="full"] .wp-block-crowdsignal-forms-poll__content{padding:80px}}#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer{cursor:text}#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer:hover,#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer.is-focused{color:inherit}#editor .editor-styles-wrapper .wp-block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{cursor:text}.wp-block-crowdsignal-forms__redirect-url input[type="text"]{width:100%}.wp-block-crowdsignal-forms__redirect-url__suggestions{width:260px}.wp-block-crowdsignal-forms__row{display:flex;flex-direction:row}.wp-block-crowdsignal-forms__row .wp-block-crowdsignal-forms__small-text-input input[type="text"]{width:40px}.wp-block-crowdsignal-forms__row .wp-block-crowdsignal-forms__small-text-input input[type="number"]{width:50px}.wp-block-crowdsignal-forms-poll__edit-bar{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-left:4px solid #d82e20;background:#f8dad8;display:flex;flex-direction:row;justify-content:space-between;align-items:center}.wp-block-crowdsignal-forms-poll__edit-bar .wp-block-crowdsignal-forms-poll__edit-bar-message{padding-inline-end:24px}.wp-block-crowdsignal-forms-poll__edit-bar button.wp-block-crowdsignal-forms-poll__edit-bar-button{border:2px solid #d82e20;border-radius:4px;color:#d82e20;background:transparent;padding:8px 16px;cursor:pointer}.wp-block-crowdsignal-forms__view-results.is-disabled{opacity:0.5;pointer-events:none}.wp-block-crowdsignal-forms__connect-to-crowdsignal{border:1px solid #000;font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;padding:24px;text-align:initial}.wp-block-crowdsignal-forms__connect-to-crowdsignal-header{display:flex;flex-direction:row;align-items:center}.wp-block-crowdsignal-forms__connect-to-crowdsignal-body{font-size:13px;margin-top:24px;margin-bottom:16px}.wp-block-crowdsignal-forms__connect-to-crowdsignal-title{font-size:24pt;margin-inline-start:16px}.crowdsignal-poll-wrapper:not(:first-child),[data-type="crowdsignal-forms/poll"]:not(:first-child){margin-top:3em}.crowdsignal-poll-wrapper:not(:last-child),[data-type="crowdsignal-forms/poll"]:not(:last-child){margin-bottom:3em}.wp-block-crowdsignal-forms-poll{border-color:var(--crowdsignal-forms-border-color);border-style:solid;border-width:var(--crowdsignal-forms-border-width);position:relative;text-align:left}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll{border-left-width:0;border-right-width:0}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question{margin:0 0 28px}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question:first-child{margin-top:0}.wp-block-crowdsignal-forms-poll p.wp-block-crowdsignal-forms-poll__note{font-style:italic;margin:0 0 32px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:40px 24px 16px 24px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__question{font-family:var(--crowdsignal-forms-question-font-family)}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__answer-label,.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__answer-results-answer,.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__note{font-family:var(--crowdsignal-forms-body-font-family)}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{margin:0 auto;max-width:var(--crowdsignal-forms-content-wide-width)}@media screen and (min-width: 660px){.alignwide.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content,.alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:80px}}.wp-block-crowdsignal-forms-poll.is-closed .wp-block-crowdsignal-forms-poll__form{opacity:0.5}.wp-block-crowdsignal-forms-poll.is-hidden{opacity:0.5}.wp-block-crowdsignal-forms-poll.has-text-color{color:var(--crowdsignal-forms-text-color)}.wp-block-crowdsignal-forms-poll.has-bg-color{background-color:var(--crowdsignal-forms-bg-color)}.wp-block-crowdsignal-forms-poll.has-border-radius{border-radius:var(--crowdsignal-forms-border-radius);overflow:hidden}.wp-block-crowdsignal-forms-poll.has-box-shadow{box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23)}.wp-block-crowdsignal-forms-poll .is-transparent{opacity:0;pointer-events:none}.wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button:disabled{opacity:0.7}.wp-block-crowdsignal-forms-poll.has-submit-button-bg-color .wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{background-color:var(--crowdsignal-forms-submit-button-bg-color)}.wp-block-crowdsignal-forms-poll.has-submit-button-text-color .wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{color:var(--crowdsignal-forms-submit-button-text-color)}.wp-block-crowdsignal-forms-poll__answer{cursor:pointer;display:flex;font-size:inherit;font-weight:600;margin:0 0 16px;padding:0 2px;position:relative}.wp-block-crowdsignal-forms-poll__answer:hover,.wp-block-crowdsignal-forms-poll__answer.is-focused{color:var(--crowdsignal-forms-submit-button-bg-color)}.has-voted .wp-block-crowdsignal-forms-poll__answer{opacity:0.5}input[type="checkbox"].wp-block-crowdsignal-forms-poll__input,input[type="radio"].wp-block-crowdsignal-forms-poll__input{height:0;opacity:0;position:absolute;width:0}.wp-block-crowdsignal-forms-poll__check{display:inline-block;height:1em;margin:0 10px 0 0;position:relative;width:1em}.wp-block-crowdsignal-forms-poll__check::before{background-color:transparent;border:1.5px solid var(--crowdsignal-forms-text-color);border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;transition:background-color 0.3s, border-color 0.3s;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::before{border-radius:3px}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice.is-selected .wp-block-crowdsignal-forms-poll__check::before{border-color:var(--crowdsignal-forms-border-color);background-color:var(--crowdsignal-forms-border-color)}.wp-block-crowdsignal-forms-poll__answer.is-selected:not(.is-multiple-choice) .wp-block-crowdsignal-forms-poll__check::after{animation-duration:0.3s;animation-name:crowdsignal-forms-animation__pop;animation-iteration-count:1;background-clip:padding-box;background-color:var(--crowdsignal-forms-border-color);border:4.5px solid transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;position:absolute;left:0;top:0;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-selected.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::after{border-color:var(--crowdsignal-forms-submit-button-text-color);border-style:solid;border-width:0 0 2px 2px;box-sizing:border-box;content:"";display:block;height:25%;margin:-0.1em 0 0 -0.2em;position:absolute;left:50%;top:50%;transform:rotateZ(-45deg);width:50%}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper{flex:1;word-break:break-word}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label{line-height:1;vertical-align:top}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label span::after{vertical-align:top}.wp-block-crowdsignal-forms-poll__button{border:0;padding:0}.wp-block-crowdsignal-forms-poll__actions{display:flex;justify-content:flex-end}.wp-block-crowdsignal-forms-poll__actions .wp-block-button{margin:0}.editor-styles-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__actions .wp-block-button.wp-block-crowdsignal-forms-poll__block-button{margin:0}.wp-block-crowdsignal-forms-poll__closed-banner{background-color:var(--crowdsignal-forms-border-color);box-sizing:border-box;display:flex;color:var(--crowdsignal-forms-submit-button-text-color);font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;justify-content:center;padding:calc(var(--crowdsignal-forms-border-width) + 0.2em) 0 0.2em;width:100%}.is-hidden .wp-block-crowdsignal-forms-poll__closed-banner{font-style:italic}.wp-block-crowdsignal-forms-poll__error{color:red}.wp-block-crowdsignal-forms-poll__results-list{margin:0 0 1em;position:relative}.wp-block-crowdsignal-forms-poll__answer-results{display:flex;flex-direction:column;margin:0 0 16px;width:100%}.wp-block-crowdsignal-forms-poll__answer-results:last-child{margin:0}.wp-block-crowdsignal-forms-poll__answer-results-labels{align-items:flex-end;display:flex;margin:0 0 8px;width:100%;word-break:break-word}.wp-block-crowdsignal-forms-poll__answer-results-answer{flex:1;font-size:1em;font-weight:600}.wp-block-crowdsignal-forms-poll__answer-results-votes{font-size:0.75em;line-height:2}.wp-block-crowdsignal-forms-poll__answer-results-percent{font-weight:600;line-height:1.6}.wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results-percent{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;margin-left:20px;transition:opacity 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-percent{display:none}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse;background-color:var(--crowdsignal-forms-text-color);font-size:0.7em;height:1em;width:50px}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes:last-child,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent:last-child{width:40px}.wp-block-crowdsignal-forms-poll__answer-results-progress-track{border:1px solid;border-color:rgba(var(--crowdsignal-forms-text-color-properties), 0.3);box-sizing:border-box;height:1em;width:100%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-track{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse}.wp-block-crowdsignal-forms-poll__answer-results-progress-bar{animation-fill-mode:forwards;background-color:var(--crowdsignal-forms-submit-button-bg-color);height:100%;transition:background-color 0.3s, width 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:0}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{background-color:var(--crowdsignal-forms-text-color);width:25%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+1) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:40%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+2) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:75%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+3) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:50%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+4) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:60%}.wp-block-crowdsignal-forms-poll__results-footer{display:flex;flex-direction:column;justify-content:space-between;width:100%;font-size:0.9em}.wp-block-crowdsignal-forms-poll__results-total{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;position:relative;text-align:right;width:100%;margin-bottom:1em}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total{color:transparent}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total::before{animation-name:crowdsignal-forms-animation__pulse;animation-duration:1.5s;animation-iteration-count:infinite;background-color:var(--crowdsignal-forms-text-color);content:"";display:block;position:absolute;right:0;height:1em;width:150px}.wp-block-crowdsignal-forms-poll__footer-branding{display:flex;justify-content:space-between;align-items:center;width:100%}.wp-block-crowdsignal-forms-poll__footer-branding img.wp-block-crowdsignal-forms-poll__footer-branding-logo{width:50px;height:50px;margin-left:0;margin-right:0}.wp-block-crowdsignal-forms-poll__footer-cs-link{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:16px;text-decoration:none;text-transform:uppercase}.wp-block-crowdsignal-forms-poll__footer-cs-link:not(:hover){color:var(--crowdsignal-forms-text-color);opacity:0.4}.has-default-thankyou .wp-block-crowdsignal-forms-poll__footer-cs-link{color:#333}.wp-block-crowdsignal-forms-poll__error-banner{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-left:4px solid #d82e20;background:#f8dad8}.wp-block-crowdsignal-forms-poll__submit-message-container{position:absolute;background-color:var(--crowdsignal-forms-bg-color);left:0;top:0;width:100%;height:100%;overflow:hidden}.has-default-thankyou .wp-block-crowdsignal-forms-poll__submit-message-container{background-color:#fff}.wp-block-crowdsignal-forms-poll__submit-message{position:relative}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message{position:absolute;right:0;top:0;background-color:transparent;color:#000;text-decoration:none;border:none}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message:hover{background:inherit}.wp-block-crowdsignal-forms-poll__submit-message-footer{position:absolute;bottom:0;left:0;padding:16px 24px;width:100%;background-color:inherit}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker{right:25px;top:66px}.wp-block-crowdsignal-forms-poll__thank-you-sticker{right:132px;top:12px}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker,.wp-block-crowdsignal-forms-poll__thank-you-sticker{filter:drop-shadow(0 1px 2px rgba(0,0,0,0.2));width:100px;height:100px;position:absolute}.wp-block-crowdsignal-forms-poll__custom-message-check{color:var(--crowdsignal-forms-text-color);padding-left:24px;padding-top:24px}.wp-block-crowdsignal-forms-poll__custom-message{font-family:var(--crowdsignal-forms-question-font-family);font-weight:600;padding:16px 24px}.wp_block-crowdsignal-forms-poll__vote-branding{margin-top:16px}.crowdsignal-forms__style-probe{display:none}
|
build/editor.js
CHANGED
@@ -106,7 +106,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _con
|
|
106 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
107 |
|
108 |
"use strict";
|
109 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var components_icon_poll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! components/icon/poll */ \"./client/components/icon/poll.js\");\n/* harmony import */ var data_hooks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! data/hooks */ \"./client/data/hooks/index.js\");\n\n\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\nvar ConnectToCrowdsignal = function ConnectToCrowdsignal(props) {\n var _useIsCsConnected = Object(data_hooks__WEBPACK_IMPORTED_MODULE_6__[\"useIsCsConnected\"])(),\n isConnected = _useIsCsConnected.isConnected,\n checkIsConnected = _useIsCsConnected.checkIsConnected;\n\n var handleConnectClick = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() {\n var isNowConnected;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next =
|
110 |
|
111 |
/***/ }),
|
112 |
|
@@ -114,11 +114,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
114 |
/*!*****************************************!*\
|
115 |
!*** ./client/blocks/poll/constants.js ***!
|
116 |
\*****************************************/
|
117 |
-
/*! exports provided: ConfirmMessageType, FontFamilyType, FontFamilyMap, PollStatus, ClosedPollState */
|
118 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
119 |
|
120 |
"use strict";
|
121 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConfirmMessageType\", function() { return ConfirmMessageType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyType\", function() { return FontFamilyType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyMap\", function() { return FontFamilyMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStatus\", function() { return PollStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClosedPollState\", function() { return ClosedPollState; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar _Object$freeze;\n\nvar ConfirmMessageType = Object.freeze({\n THANK_YOU: 'thank-you',\n CUSTOM_TEXT: 'custom-text',\n REDIRECT: 'redirect',\n RESULTS: 'results'\n});\nvar FontFamilyType = Object.freeze({\n THEME_DEFAULT: 'theme-default',\n GEORGIA: 'georgia',\n PALATINO: 'palatino',\n TIMES_NEW_ROMAN: 'times-new-roman',\n ARIAL: 'arial',\n IMPACT: 'impact',\n LUCIDA: 'lucida',\n TAHOMA: 'tahoma',\n TREBUCHET: 'trebuchet',\n VERDANA: 'verdana',\n COURIER: 'courier'\n});\nvar FontFamilyMap = Object.freeze((_Object$freeze = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.THEME_DEFAULT, null), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.GEORGIA, 'Georgia, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.PALATINO, '\"Palatino Linotype\", \"Book Antiqua\", Palatino, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TIMES_NEW_ROMAN, '\"Times New Roman\", Times, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.ARIAL, 'Arial, Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.IMPACT, 'Impact, Charcoal, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.LUCIDA, '\"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TAHOMA, 'Tahoma, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TREBUCHET, '\"Trebuchet MS\", Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.VERDANA, 'Verdana, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.COURIER, '\"Courier New\", Courier, monospace'), _Object$freeze));\nvar PollStatus = Object.freeze({\n OPEN: 'open',\n CLOSED: 'closed',\n CLOSED_AFTER: 'closed-after'\n});\nvar ClosedPollState = Object.freeze({\n SHOW_RESULTS: 'show-results',\n SHOW_CLOSED_BANNER: 'show-closed-banner',\n HIDDEN: 'hidden'\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/constants.js?");
|
122 |
|
123 |
/***/ }),
|
124 |
|
@@ -166,7 +166,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
166 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
167 |
|
168 |
"use strict";
|
169 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/block-editor */ \"@wordpress/block-editor\");\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/data */ \"@wordpress/data\");\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var components_poll_closed_banner__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! components/poll/closed-banner */ \"./client/components/poll/closed-banner.js\");\n/* harmony import */ var components_poll_styles__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! components/poll/styles */ \"./client/components/poll/styles.js\");\n/* harmony import */ var components_poll_results__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! components/poll/results */ \"./client/components/poll/results.js\");\n/* harmony import */ var components_poll_util__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! components/poll/util */ \"./client/components/poll/util.js\");\n/* harmony import */ var components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! components/with-fallback-styles */ \"./client/components/with-fallback-styles/index.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var _edit_answers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./edit-answers */ \"./client/blocks/poll/edit-answers.js\");\n/* harmony import */ var _sidebar__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./sidebar */ \"./client/blocks/poll/sidebar.js\");\n/* harmony import */ var _toolbar__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./toolbar */ \"./client/blocks/poll/toolbar.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./util */ \"./client/blocks/poll/util.js\");\n/* harmony import */ var components_poll_error_banner__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! components/poll/error-banner */ \"./client/components/poll/error-banner.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/index.js\");\n/* harmony import */ var _edit_bar__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./edit-bar */ \"./client/blocks/poll/edit-bar.js\");\n/* harmony import */ var _subscriptions__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./subscriptions */ \"./client/blocks/poll/subscriptions.js\");\n/* harmony import */ var _connect_to_crowdsignal__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./connect-to-crowdsignal */ \"./client/blocks/poll/connect-to-crowdsignal.js\");\n\n\n\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n\n/**\n * WordPress dependencies\n */\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nObject(_subscriptions__WEBPACK_IMPORTED_MODULE_23__[\"startSubscriptions\"])();\n\nvar withPollAndAnswerIds = function withPollAndAnswerIds(Element) {\n return function (props) {\n var attributes = props.attributes,\n setAttributes = props.setAttributes;\n Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useEffect\"])(function () {\n if (!attributes.pollId) {\n var thePollId = Object(uuid__WEBPACK_IMPORTED_MODULE_21__[\"v4\"])();\n setAttributes({\n pollId: thePollId\n });\n }\n\n if (Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"some\"])(attributes.answers, function (a) {\n return !a.answerId && a.text;\n })) {\n var answers = Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"map\"])(attributes.answers, function (answer) {\n if (answer.answerId || !answer.text) {\n return answer;\n }\n\n var answerId = Object(uuid__WEBPACK_IMPORTED_MODULE_21__[\"v4\"])();\n return _objectSpread({}, answer, {\n answerId: answerId\n });\n });\n setAttributes({\n answers: answers\n });\n }\n });\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(Element, props);\n };\n};\n\nvar PollBlock = function PollBlock(props) {\n var attributes = props.attributes,\n className = props.className,\n fallbackStyles = props.fallbackStyles,\n isSelected = props.isSelected,\n setAttributes = props.setAttributes,\n renderStyleProbe = props.renderStyleProbe,\n pollDataFromApi = props.pollDataFromApi;\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])(true),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),\n isPollEditable = _useState2[0],\n setIsPollEditable = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])(''),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),\n errorMessage = _useState4[0],\n setErrorMessage = _useState4[1];\n\n var viewResultsUrl = pollDataFromApi ? pollDataFromApi.viewResultsUrl : '';\n var pollIdFromApi = pollDataFromApi ? pollDataFromApi.id : null;\n var answerIdMap = {};\n\n if (pollDataFromApi) {\n Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"map\"])(pollDataFromApi.answers, function (answer) {\n answerIdMap[answer.client_id] = answer.id;\n });\n }\n\n var handleChangeQuestion = function handleChangeQuestion(question) {\n return setAttributes({\n question: question\n });\n };\n\n var handleChangeNote = function handleChangeNote(note) {\n return setAttributes({\n note: note\n });\n };\n\n var isClosed = Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"isPollClosed\"])(attributes.pollStatus, attributes.closedAfterDateTime);\n var showNote = attributes.note || isSelected && isPollEditable;\n var showResults = isClosed && _constants__WEBPACK_IMPORTED_MODULE_15__[\"ClosedPollState\"].SHOW_RESULTS === attributes.closedPollState;\n var isHidden = isClosed && _constants__WEBPACK_IMPORTED_MODULE_15__[\"ClosedPollState\"].HIDDEN === attributes.closedPollState;\n var hideBranding = true; // hide branding in editor for now\n\n var postDetails = wp.data.select('core/editor').getCurrentPost();\n var wasBlockAddedBeforeLastPublish = 'publish' === postDetails.status && Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"pollIdExistsInPageContent\"])(attributes.pollId, postDetails.content);\n Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useEffect\"])(function () {\n return setIsPollEditable(!wasBlockAddedBeforeLastPublish);\n }, [isSelected]);\n var showEditBar = isSelected && wasBlockAddedBeforeLastPublish && !isPollEditable;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_connect_to_crowdsignal__WEBPACK_IMPORTED_MODULE_24__[\"default\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_toolbar__WEBPACK_IMPORTED_MODULE_18__[\"default\"], props), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_sidebar__WEBPACK_IMPORTED_MODULE_17__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, props, {\n viewResultsUrl: viewResultsUrl\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"getBlockCssClasses\"])(attributes, className, {\n 'is-selected-in-editor': isSelected,\n 'is-closed': isClosed,\n 'is-hidden': isHidden\n }),\n style: Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"getStyleVars\"])(attributes, fallbackStyles)\n }, showEditBar && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_edit_bar__WEBPACK_IMPORTED_MODULE_22__[\"default\"], {\n onEditClick: function onEditClick() {\n setIsPollEditable(true);\n }\n }), errorMessage && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(components_poll_error_banner__WEBPACK_IMPORTED_MODULE_20__[\"default\"], null, errorMessage), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__content\"\n }, isPollEditable ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__[\"RichText\"], {\n tagName: \"h3\",\n className: \"wp-block-crowdsignal-forms-poll__question\",\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Enter your question'),\n onChange: handleChangeQuestion,\n value: attributes.question,\n allowedFormats: []\n }) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"h3\", {\n className: \"wp-block-crowdsignal-forms-poll__question\"\n }, attributes.question ? Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__[\"decodeEntities\"])(attributes.question) : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Enter your question')), showNote && (isPollEditable ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__[\"RichText\"], {\n tagName: \"p\",\n className: \"wp-block-crowdsignal-forms-poll__note\",\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Add a note (optional)'),\n onChange: handleChangeNote,\n value: attributes.note,\n allowedFormats: []\n }) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"p\", {\n className: \"wp-block-crowdsignal-forms-poll__note\"\n }, attributes.note ? Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__[\"decodeEntities\"])(attributes.note) : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Add a note (optional)'))), !showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_edit_answers__WEBPACK_IMPORTED_MODULE_16__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, props, {\n setAttributes: setAttributes,\n disabled: !isPollEditable\n })), showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(components_poll_results__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n answers: Object(components_poll_util__WEBPACK_IMPORTED_MODULE_12__[\"addApiAnswerIds\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"filter\"])(attributes.answers, function (answer) {\n return !Object(components_poll_util__WEBPACK_IMPORTED_MODULE_12__[\"isAnswerEmpty\"])(answer);\n }), answerIdMap),\n pollIdFromApi: pollIdFromApi,\n hideBranding: hideBranding,\n setErrorMessage: setErrorMessage\n })), isClosed && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(components_poll_closed_banner__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n isPollHidden: isHidden,\n isPollClosed: isClosed\n }), renderStyleProbe()));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_13__[\"withFallbackStyles\"])(components_poll_styles__WEBPACK_IMPORTED_MODULE_10__[\"PollStyles\"], components_poll_styles__WEBPACK_IMPORTED_MODULE_10__[\"getPollStyles\"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_7__[\"withSelect\"])(function (select, ownProps) {\n var attributes = ownProps.attributes;\n var pollDataFromApi = attributes.pollId ? select('crowdsignal-forms/polls').getPollDataByClientId(attributes.pollId) : null;\n return {\n pollDataFromApi: pollDataFromApi\n };\n})(withPollAndAnswerIds(PollBlock))));\n\n//# sourceURL=webpack:///./client/blocks/poll/edit.js?");
|
170 |
|
171 |
/***/ }),
|
172 |
|
@@ -178,7 +178,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
178 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
179 |
|
180 |
"use strict";
|
181 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var components_icon_poll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! components/icon/poll */ \"./client/components/icon/poll.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store */ \"./client/blocks/poll/store.js\");\n/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./edit */ \"./client/blocks/poll/edit.js\");\n/* harmony import */ var _attributes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./attributes */ \"./client/blocks/poll/attributes.js\");\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Poll'),\n description: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Create polls and get your audience’s opinion — powered by Crowdsignal.'),\n category: 'widgets',\n icon: Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_poll__WEBPACK_IMPORTED_MODULE_1__[\"default\"], null),\n edit: _edit__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n attributes: _attributes__WEBPACK_IMPORTED_MODULE_5__[\"default\"],\n supports: {\n align: ['center', 'wide', 'full']\n },\n getEditWrapperProps: function getEditWrapperProps(_ref) {\n var align = _ref.align;\n return {\n 'data-align': align\n };\n },\n example: {\n attributes: {\n question: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('How did you hear about us?'),\n answers: [{\n text: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Search')\n }, {\n text: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Friend')\n }, {\n text: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Email')\n }]\n }\n }\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/index.js?");
|
182 |
|
183 |
/***/ }),
|
184 |
|
@@ -190,7 +190,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
190 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
191 |
|
192 |
"use strict";
|
193 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ \"@wordpress/block-editor\");\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * WordPress dependencies\n */\n\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\nvar SideBar = function SideBar(_ref) {\n var _attributes$title;\n\n var attributes = _ref.attributes,\n setAttributes = _ref.setAttributes,\n fallbackBackgroundColor = _ref.fallbackBackgroundColor,\n fallbackTextColor = _ref.fallbackTextColor,\n fallbackSubmitButtonBackgroundColor = _ref.fallbackSubmitButtonBackgroundColor,\n fallbackSubmitButtonTextColor = _ref.fallbackSubmitButtonTextColor,\n viewResultsUrl = _ref.viewResultsUrl;\n\n var handleChangeTitle = function handleChangeTitle(title) {\n return setAttributes({\n title: title\n });\n };\n\n var handleChangeConfirmMessageType = function handleChangeConfirmMessageType(type) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"], type) && setAttributes({\n confirmMessageType: type\n });\n };\n\n var handleChangeCustomConfirmMessage = function handleChangeCustomConfirmMessage(customConfirmMessage) {\n return setAttributes({\n customConfirmMessage: customConfirmMessage\n });\n };\n\n var handleChangeRedirectAddress = function handleChangeRedirectAddress(redirectAddress) {\n return setAttributes({\n redirectAddress: redirectAddress\n });\n };\n\n var handleChangeTextColor = function handleChangeTextColor(textColor) {\n return setAttributes({\n textColor: textColor\n });\n };\n\n var handleChangeBackgroundColor = function handleChangeBackgroundColor(backgroundColor) {\n return setAttributes({\n backgroundColor: backgroundColor\n });\n };\n\n var handleChangeBorderColor = function handleChangeBorderColor(borderColor) {\n return setAttributes({\n borderColor: borderColor\n });\n };\n\n var handleChangeBorderRadius = function handleChangeBorderRadius(borderRadius) {\n setAttributes({\n borderRadius: parseInt(borderRadius, 10) || 0\n });\n };\n\n var handleChangeBorderWidth = function handleChangeBorderWidth(borderWidth) {\n setAttributes({\n borderWidth: parseInt(borderWidth, 10) || 0\n });\n };\n\n var handleChangeFontFamily = function handleChangeFontFamily(font) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"], font) && setAttributes({\n fontFamily: font\n });\n };\n\n var handleChangeHasOneResponsePerComputer = function handleChangeHasOneResponsePerComputer(hasOneResponsePerComputer) {\n return setAttributes({\n hasOneResponsePerComputer: hasOneResponsePerComputer\n });\n };\n\n var handleChangeRandomizeAnswers = function handleChangeRandomizeAnswers(randomizeAnswers) {\n return setAttributes({\n randomizeAnswers: randomizeAnswers\n });\n };\n\n var handleChangeSubmitButtonTextColor = function handleChangeSubmitButtonTextColor(submitButtonTextColor) {\n return setAttributes({\n submitButtonTextColor: submitButtonTextColor\n });\n };\n\n var handleChangeSubmitButtonBackgroundColor = function handleChangeSubmitButtonBackgroundColor(submitButtonBackgroundColor) {\n return setAttributes({\n submitButtonBackgroundColor: submitButtonBackgroundColor\n });\n };\n\n var handleChangePollStatus = function handleChangePollStatus(pollStatus) {\n if (!Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"], pollStatus)) {\n return;\n } // closedAfterDateTime MUST be set when pollStatus is set to CLOSED_AFTER\n\n\n setAttributes({\n closedAfterDateTime: pollStatus === _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED_AFTER ? new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString() : null,\n pollStatus: pollStatus\n });\n };\n\n var handleChangeClosedPollState = function handleChangeClosedPollState(closedPollState) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"], closedPollState) && setAttributes({\n closedPollState: closedPollState\n });\n };\n\n var handleChangeCloseAfterDateTime = function handleChangeCloseAfterDateTime(closedAfterDateTime) {\n var dateTime = new Date(closedAfterDateTime);\n setAttributes({\n closedAfterDateTime: dateTime.toISOString()\n });\n };\n\n var handleChangeHasBoxShadow = function handleChangeHasBoxShadow(hasBoxShadow) {\n setAttributes({\n hasBoxShadow: hasBoxShadow\n });\n };\n\n var resultsLinkEnabled = '' !== viewResultsUrl;\n var resultsLinkClasses = classnames__WEBPACK_IMPORTED_MODULE_2___default()('wp-block-crowdsignal-forms__view-results', {\n 'is-disabled': !resultsLinkEnabled\n });\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"InspectorControls\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Results'),\n initialOpen: true\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: resultsLinkClasses\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null, resultsLinkEnabled ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Manage results on: ') : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Save this poll to enable results.'), resultsLinkEnabled && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"ExternalLink\"], {\n href: viewResultsUrl\n }, \"crowdsignal.com\")), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"Button\"], {\n href: viewResultsUrl,\n isSecondary: true,\n target: \"_blank\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('View results')))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextControl\"], {\n value: Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__[\"decodeEntities\"])((_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : attributes.question),\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Title of the poll block'),\n onChange: handleChangeTitle\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Confirmation message'),\n initialOpen: false\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.confirmMessageType,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('On submission'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show results'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].RESULTS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show \"Thank You\" message'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].THANK_YOU\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show a custom text message'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].CUSTOM_TEXT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Redirect to another webpage'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].REDIRECT\n }],\n onChange: handleChangeConfirmMessageType\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].CUSTOM_TEXT === attributes.confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextareaControl\"], {\n value: attributes.customConfirmMessage,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Message text'),\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Thank you for your submission!'),\n onChange: handleChangeCustomConfirmMessage\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].REDIRECT === attributes.confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"URLInput\"], {\n className: \"wp-block-crowdsignal-forms__redirect-url\",\n value: attributes.redirectAddress,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Redirect address'),\n onChange: handleChangeRedirectAddress\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Poll status'),\n initialOpen: false\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.pollStatus,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Currently'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Open'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].OPEN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Closed after'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED_AFTER\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Closed'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED\n }],\n onChange: handleChangePollStatus\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED_AFTER === attributes.pollStatus && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TimePicker\"], {\n currentTime: attributes.closedAfterDateTime,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Close poll on'),\n onChange: handleChangeCloseAfterDateTime,\n is12Hour: true\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].OPEN !== attributes.pollStatus && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.closedPollState,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('When poll is closed'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show results'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"].SHOW_RESULTS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show poll with \"Closed\" banner'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"].SHOW_CLOSED_BANNER\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Hide poll'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"].HIDDEN\n }],\n onChange: handleChangeClosedPollState\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"PanelColorSettings\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Block styling'),\n initialOpen: true,\n colorSettings: [{\n value: attributes.textColor,\n onChange: handleChangeTextColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Text color')\n }, {\n value: attributes.backgroundColor,\n onChange: handleChangeBackgroundColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Background color')\n }, {\n value: attributes.borderColor,\n onChange: handleChangeBorderColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Border color')\n }]\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"ContrastChecker\"], {\n textColor: attributes.textColor,\n backgroundColor: attributes.backgroundColor,\n fallbackBackgroundColor: fallbackBackgroundColor,\n fallbackTextColor: fallbackTextColor\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.fontFamily,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Choose font'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Default theme font'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].THEME_DEFAULT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Georgia'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].GEORGIA,\n style: {\n color: 'red'\n }\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Palatino'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].PALATINO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Times New Roman'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].TIMES_NEW_ROMAN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Arial'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].ARIAL\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Impact'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].IMPACT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Lucida'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].LUCIDA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Tahoma'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].TAHOMA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Trebuchet'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].TREBUCHET\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Verdana'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].VERDANA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Courier'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].COURIER\n }],\n onChange: handleChangeFontFamily\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__row\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Border thickness'),\n value: attributes.borderWidth,\n onChange: handleChangeBorderWidth,\n type: \"number\",\n className: \"wp-block-crowdsignal-forms__small-text-input\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Corner radius'),\n value: attributes.borderRadius,\n onChange: handleChangeBorderRadius,\n type: \"number\",\n className: \"wp-block-crowdsignal-forms__small-text-input\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"ToggleControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Drop shadow'),\n checked: attributes.hasBoxShadow,\n onChange: handleChangeHasBoxShadow\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"PanelColorSettings\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Button styling'),\n initialOpen: false,\n colorSettings: [{\n value: attributes.submitButtonTextColor,\n onChange: handleChangeSubmitButtonTextColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Text color')\n }, {\n value: attributes.submitButtonBackgroundColor,\n onChange: handleChangeSubmitButtonBackgroundColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Background color')\n }]\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"ContrastChecker\"], {\n textColor: attributes.submitButtonTextColor,\n backgroundColor: attributes.submitButtonBackgroundColor,\n fallbackBackgroundColor: fallbackSubmitButtonBackgroundColor,\n fallbackTextColor: fallbackSubmitButtonTextColor\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Answer settings'),\n initialOpen: false\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"CheckboxControl\"], {\n checked: attributes.hasOneResponsePerComputer,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('One response per computer'),\n onChange: handleChangeHasOneResponsePerComputer\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"CheckboxControl\"], {\n checked: attributes.randomizeAnswers,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Randomize answer order'),\n onChange: handleChangeRandomizeAnswers\n })));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (SideBar);\n\n//# sourceURL=webpack:///./client/blocks/poll/sidebar.js?");
|
194 |
|
195 |
/***/ }),
|
196 |
|
@@ -238,7 +238,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
238 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
239 |
|
240 |
"use strict";
|
241 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addAnswer\", function() { return addAnswer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getFontFamilyFromType\", function() { return getFontFamilyFromType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getStyleVars\", function() { return getStyleVars; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractRGBColorProperties\", function() { return extractRGBColorProperties; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hexToRGB\", function() { return hexToRGB; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBlockCssClasses\", function() { return getBlockCssClasses; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isPollClosed\", function() { return isPollClosed; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pollIdExistsInPageContent\", function() { return pollIdExistsInPageContent; });\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ \"./node_modules/@babel/runtime/helpers/toConsumableArray.js\");\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Creates a new Answer object then returns a copy of the passed in `answers` array with the new answer appended to it.\n *\n * @param {Array} answers The existing array of answers.\n * @param {string} text\tThe text for the new answer to add.\n * @return {Array}\t\t\tThe newly created answers array.\n */\n\nvar addAnswer = function addAnswer(answers, text) {\n return [].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(answers), [{\n answerId: null,\n text: text\n }]);\n};\nvar getFontFamilyFromType = function getFontFamilyFromType(type) {\n if (!Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_3__[\"FontFamilyType\"], type)) {\n return null;\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_3__[\"FontFamilyMap\"][type];\n};\nvar getStyleVars = function getStyleVars(attributes,
|
242 |
|
243 |
/***/ }),
|
244 |
|
@@ -298,7 +298,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
298 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
299 |
|
300 |
"use strict";
|
301 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var
|
302 |
|
303 |
/***/ }),
|
304 |
|
@@ -346,7 +346,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
346 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
347 |
|
348 |
"use strict";
|
349 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getPollStyles\", function() { return getPollStyles; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStyles\", function() { return PollStyles; });\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! components/with-fallback-styles/util */ \"./client/components/with-fallback-styles/util.js\");\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\nvar getPollStyles = function getPollStyles(node) {\n if (null === node) {\n return {};\n }\n\n var buttonNode = node.querySelector('.wp-block-button__link');\n var textNode = node.querySelector('p');\n var wideContentNode = node.querySelector('.alignwide');\n return {\n accent: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(buttonNode),\n surface: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(textNode),\n text: window.getComputedStyle(textNode).color,\n textInverted: window.getComputedStyle(buttonNode).color,\n contentWideWidth: window.getComputedStyle(wideContentNode).maxWidth\n };\n};\nvar PollStyles = function PollStyles() {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button__link\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"entry-content\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"alignwide\"\n })));\n};\n\n//# sourceURL=webpack:///./client/components/poll/styles.js?");
|
350 |
|
351 |
/***/ }),
|
352 |
|
@@ -354,11 +354,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
354 |
/*!****************************************!*\
|
355 |
!*** ./client/components/poll/util.js ***!
|
356 |
\****************************************/
|
357 |
-
/*! exports provided: addApiAnswerIds, shuffleWithGenerator, isAnswerEmpty */
|
358 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
359 |
|
360 |
"use strict";
|
361 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addApiAnswerIds\", function() { return addApiAnswerIds; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shuffleWithGenerator\", function() { return shuffleWithGenerator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAnswerEmpty\", function() { return isAnswerEmpty; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n/**\n * Adds api answer ids to the answer objects (when they are available).\n *\n * @param {Array} answers Answers array\n * @param {Array} answerIdMap A json object with client answer ids as keys, and API answer ids as values.\n * @return {Array} Updated answers array\n */\n\nvar addApiAnswerIds = function addApiAnswerIds(answers, answerIdMap) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"map\"])(answers, function (answer) {\n if (typeof answer.answerIdFromApi !== 'undefined') {\n return answer;\n }\n\n return _objectSpread({}, answer, {\n answerIdFromApi: answerIdMap[answer.answerId]\n });\n });\n};\n/**\n * Fisher-Yates algorithm shuffle implementation.\n * Provides a predictable way of shuffling array items given a seed.\n *\n * @param {Array} toShuffle The array to shuffle.\n * @param {Function} randomNumberGenerator A function that generates a random number (like `seedrandom`).\n * @return {Array} The shuffled array.\n */\n\nvar shuffleWithGenerator = function shuffleWithGenerator(toShuffle, randomNumberGenerator) {\n var shuffled = toShuffle.slice();\n\n for (var i = shuffled.length - 1; i > 0; i--) {\n var j = Math.floor(randomNumberGenerator() * i);\n var tmp = shuffled[i];\n shuffled[i] = shuffled[j];\n shuffled[j] = tmp;\n }\n\n return shuffled;\n};\n/**\n * Determines if an answer is considered \"empty\", based on if text is set and blank or object has no values.\n *\n * @param {*} answer The answer object.\n */\n\nvar isAnswerEmpty = function isAnswerEmpty(answer) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(answer) || 'undefined' === typeof answer.text || null === answer.text || '' === answer.text;\n};\n\n//# sourceURL=webpack:///./client/components/poll/util.js?");
|
362 |
|
363 |
/***/ }),
|
364 |
|
@@ -394,7 +394,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
394 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
395 |
|
396 |
"use strict";
|
397 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollResults\", function() { return usePollResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollVote\", function() { return usePollVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useIsCsConnected\", function() { return useIsCsConnected; });\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! js-cookie */ \"./node_modules/js-cookie/src/js.cookie.js\");\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(js_cookie__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var data_poll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! data/poll */ \"./client/data/poll/index.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util */ \"./client/data/hooks/util.js\");\n\n\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar usePollResults = function usePollResults(pollId) {\n var _useFetch = Object(_util__WEBPACK_IMPORTED_MODULE_6__[\"useFetch\"])(function () {\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestResults\"])(pollId);\n }, [pollId]),\n data = _useFetch.data,\n error = _useFetch.error,\n loading = _useFetch.loading;\n\n return {\n error: error,\n loading: loading,\n results: data\n };\n};\n/**\n * React Hook that returns state variables for voting status and a function to perform a vote.\n *\n * @param {number} pollId ID of the poll being loaded.\n * @param {boolean} enableVoteRestriction sets whether or not the vote cookie is read and set\n */\n\nvar usePollVote = function usePollVote(pollId) {\n var enableVoteRestriction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var cookieName = \"cs-poll-\".concat(pollId);\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),\n isVoting = _useState2[0],\n setIsVoting = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2),\n hasVoted = _useState4[0],\n setHasVoted = _useState4[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useEffect\"])(function () {\n if (enableVoteRestriction && undefined !== js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.get(cookieName)) {\n setHasVoted(true);\n }\n }, []);\n\n var vote = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(selectedAnswerIds) {\n var nonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n setIsVoting(true);\n _context.next = 4;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVoteNonce\"])(pollId);\n\n case 4:\n nonce = _context.sent;\n _context.next = 7;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVote\"])(nonce, pollId, selectedAnswerIds);\n\n case 7:\n setHasVoted(true);\n\n if (enableVoteRestriction) {\n js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.set(cookieName, new Date().getTime(), {\n sameSite: 'Strict',\n expires: 365\n });\n }\n\n case 9:\n _context.prev = 9;\n setIsVoting(false);\n return _context.finish(9);\n\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[0,, 9, 12]]);\n }));\n\n return function vote(_x) {\n return _ref.apply(this, arguments);\n };\n }();\n\n return {\n hasVoted: hasVoted,\n isVoting: isVoting,\n vote: vote\n };\n};\nvar useIsCsConnected = function useIsCsConnected() {\n /* assume connection is enabled, so placeholder doesn't flash while we add a block and wait for the request */\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(true),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState5, 2),\n isConnected = _useState6[0],\n setIsConnected = _useState6[1];\n\n var checkIsConnected = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() {\n var
|
398 |
|
399 |
/***/ }),
|
400 |
|
@@ -418,7 +418,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
418 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
419 |
|
420 |
"use strict";
|
421 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestResults\", function() { return requestResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVoteNonce\", function() { return requestVoteNonce; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVote\", function() { return requestVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsError\", function() { return CrowdsignalFormsError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsServerError\", function() { return CrowdsignalFormsServerError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestIsCsConnected\", function() { return requestIsCsConnected; });\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\");\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/inherits.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ \"./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js\");\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ \"./node_modules/@babel/runtime/helpers/wrapNativeSuper.js\");\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/api-fetch */ \"@wordpress/api-fetch\");\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n\n\n\n\n\n\nfunction _createSuper(Derived) { return function () { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Fetch the poll results for the given pollId\n *\n * @param {number} pollId Poll ID.\n * @return {Promise} Promise that resolves to a key-value object with answer IDs and vote counts.\n */\n\nvar requestResults = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee(pollId) {\n var baseUrl;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n baseUrl = 'https://api.crowdsignal.com/v3/polls';\n return _context.abrupt(\"return\", window.fetch(\"\".concat(baseUrl, \"/\").concat(pollId, \"/results\"), {\n method: 'GET',\n headers: {\n 'content-type': 'application/json'\n }\n }).then(function (response) {\n if (response.status >= 200 && response.status < 300) {\n return response.json();\n }\n\n throw response;\n }).then(function (response) {\n if (404 === response.status) {\n // poll doesn't exist on the platform yet, return an empty result\n return {};\n } else if (response.error) {\n throw new Error(response.message);\n }\n\n return response.results.votes_by_answer;\n }));\n\n case 2:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function requestResults(_x) {\n return _ref.apply(this, arguments);\n };\n}();\nvar requestVoteNonce = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee2(pollId) {\n var hash, timestamp, respNonce, jsonNonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n hash = '5430eeac3911395001d731d9702fc38b'; // hash not used when format=json is passed\n\n timestamp = new Date().getTime();\n _context2.next = 4;\n return window.fetch(\"https://polldaddy.com/n/\".concat(hash, \"/\").concat(pollId, \"?\").concat(timestamp, \"&format=json\"));\n\n case 4:\n respNonce = _context2.sent;\n\n if (respNonce.ok) {\n _context2.next = 7;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 7:\n _context2.next = 9;\n return respNonce.json();\n\n case 9:\n jsonNonce = _context2.sent;\n\n if (jsonNonce.nonce) {\n _context2.next = 12;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 12:\n return _context2.abrupt(\"return\", jsonNonce.nonce);\n\n case 13:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function requestVoteNonce(_x2) {\n return _ref2.apply(this, arguments);\n };\n}();\nvar requestVote = /*#__PURE__*/function () {\n var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee3(nonce, pollId, selectedAnswerIds) {\n var answerString, respVote, jsonVote;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n answerString = selectedAnswerIds.join(',');\n _context3.next = 3;\n return window.fetch(\"https://polls.polldaddy.com/vote-js.php?format=json&p=\".concat(pollId, \"&b=1&a=\").concat(answerString, \"&o=&va=16&cookie=0&n=\").concat(nonce, \"&url=\").concat(encodeURIComponent(window.location)));\n\n case 3:\n respVote = _context3.sent;\n\n if (respVote.ok) {\n _context3.next = 6;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 6:\n _context3.next = 8;\n return respVote.json();\n\n case 8:\n jsonVote = _context3.sent;\n\n if (!('error' === jsonVote.status)) {\n _context3.next = 11;\n break;\n }\n\n throw new CrowdsignalFormsError(jsonVote.error);\n\n case 11:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n return function requestVote(_x3, _x4, _x5) {\n return _ref3.apply(this, arguments);\n };\n}();\nvar CrowdsignalFormsError = /*#__PURE__*/function (_Error) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsError, _Error);\n\n var _super = _createSuper(CrowdsignalFormsError);\n\n function CrowdsignalFormsError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsError);\n\n return _super.apply(this, arguments);\n }\n\n return CrowdsignalFormsError;\n}( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default()(Error));\nvar CrowdsignalFormsServerError = /*#__PURE__*/function (_CrowdsignalFormsErro) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsServerError, _CrowdsignalFormsErro);\n\n var _super2 = _createSuper(CrowdsignalFormsServerError);\n\n function CrowdsignalFormsServerError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsServerError);\n\n return _super2.call(this, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Server error. Please try again.'));\n }\n\n return CrowdsignalFormsServerError;\n}(CrowdsignalFormsError);\nvar requestIsCsConnected = /*#__PURE__*/function () {\n var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee4() {\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default()({\n path: \"/crowdsignal-forms/v1/account/connected\",\n method: 'GET'\n });\n\n case 2:\n return _context4.abrupt(\"return\", _context4.sent);\n\n case 3:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n\n return function requestIsCsConnected() {\n return _ref4.apply(this, arguments);\n };\n}();\n\n//# sourceURL=webpack:///./client/data/poll/index.js?");
|
422 |
|
423 |
/***/ }),
|
424 |
|
106 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
107 |
|
108 |
"use strict";
|
109 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var components_icon_poll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! components/icon/poll */ \"./client/components/icon/poll.js\");\n/* harmony import */ var data_hooks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! data/hooks */ \"./client/data/hooks/index.js\");\n\n\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\nvar ConnectToCrowdsignal = function ConnectToCrowdsignal(props) {\n var _useIsCsConnected = Object(data_hooks__WEBPACK_IMPORTED_MODULE_6__[\"useIsCsConnected\"])(),\n isConnected = _useIsCsConnected.isConnected,\n isAccountVerified = _useIsCsConnected.isAccountVerified,\n checkIsConnected = _useIsCsConnected.checkIsConnected;\n\n var handleConnectClick = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() {\n var initialConnectedState, _yield$checkIsConnect, isNowConnected, isNowVerified;\n\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n initialConnectedState = isConnected;\n _context.next = 3;\n return checkIsConnected();\n\n case 3:\n _yield$checkIsConnect = _context.sent;\n isNowConnected = _yield$checkIsConnect.isNowConnected;\n isNowVerified = _yield$checkIsConnect.isNowVerified;\n\n if (!isNowConnected) {\n window.open('/wp-admin/admin.php?page=crowdsignal-forms-setup');\n } // Don't pop open the email window if the connection state just changed.\n // Allow the new placeholder to be displayed first.\n\n\n if (initialConnectedState && !isNowVerified) {\n window.open('https://wordpress.com/me/account');\n }\n\n case 8:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function handleConnectClick() {\n return _ref.apply(this, arguments);\n };\n }();\n\n if (isConnected && isAccountVerified) {\n return props.children;\n }\n\n var showConnectionMessage = !isConnected;\n var showVerificationMessage = isConnected && !isAccountVerified;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__connect-to-crowdsignal\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__connect-to-crowdsignal-header\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(components_icon_poll__WEBPACK_IMPORTED_MODULE_5__[\"default\"], null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__connect-to-crowdsignal-title\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_4__[\"__\"])('Crowdsignal Poll'))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__connect-to-crowdsignal-body\"\n }, showConnectionMessage && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_4__[\"__\"])('You need to connect to a Crowdsignal account to collect and manage your results.'), showVerificationMessage && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_4__[\"__\"])('Please verify your WordPress.com email address in order to publish your poll.')), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"Button\"], {\n isPrimary: true,\n onClick: handleConnectClick\n }, showConnectionMessage && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_4__[\"__\"])('Connect to Crowdsignal'), showVerificationMessage && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_4__[\"__\"])('Verify or Change your Email Address')));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (ConnectToCrowdsignal);\n\n//# sourceURL=webpack:///./client/blocks/poll/connect-to-crowdsignal.js?");
|
110 |
|
111 |
/***/ }),
|
112 |
|
114 |
/*!*****************************************!*\
|
115 |
!*** ./client/blocks/poll/constants.js ***!
|
116 |
\*****************************************/
|
117 |
+
/*! exports provided: ConfirmMessageType, FontFamilyType, GoogleFonts, FontFamilyMap, PollStatus, ClosedPollState, ConnectedAccountState */
|
118 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
119 |
|
120 |
"use strict";
|
121 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConfirmMessageType\", function() { return ConfirmMessageType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyType\", function() { return FontFamilyType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GoogleFonts\", function() { return GoogleFonts; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyMap\", function() { return FontFamilyMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStatus\", function() { return PollStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClosedPollState\", function() { return ClosedPollState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConnectedAccountState\", function() { return ConnectedAccountState; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar _Object$freeze;\n\nvar ConfirmMessageType = Object.freeze({\n THANK_YOU: 'thank-you',\n CUSTOM_TEXT: 'custom-text',\n REDIRECT: 'redirect',\n RESULTS: 'results'\n});\nvar FontFamilyType = Object.freeze({\n THEME_DEFAULT: 'theme-default',\n GEORGIA: 'georgia',\n PALATINO: 'palatino',\n TIMES_NEW_ROMAN: 'times-new-roman',\n ARIAL: 'arial',\n IMPACT: 'impact',\n LUCIDA: 'lucida',\n TAHOMA: 'tahoma',\n TREBUCHET: 'trebuchet',\n VERDANA: 'verdana',\n COURIER: 'courier',\n // Google fonts: enum value = google font url slug\n CABIN: 'Cabin',\n CHIVO: 'Chivo',\n OPEN_SANS: 'Open+Sans',\n FIRA_SANS: 'Fira+Sans',\n ROBOTO: 'Roboto',\n NUNITO: 'Nunito',\n OVERPASS: 'Overpass',\n LATO: 'Lato',\n LIBRE_FRANKLIN: 'Libre+Franklin',\n MONTSERRAT: 'Montserrat',\n POPPINS: 'Poppins',\n RUBIK: 'Rubik',\n RALEWAY: 'Raleway',\n JOSEFIN_SANS: 'Josefin+Sans',\n ALEGREYA_SANS: 'Alegreya+Sans',\n OSWALD: 'Oswald'\n});\nvar GoogleFonts = Object.freeze([FontFamilyType.CABIN, FontFamilyType.CHIVO, FontFamilyType.OPEN_SANS, FontFamilyType.FIRA_SANS, FontFamilyType.ROBOTO, FontFamilyType.NUNITO, FontFamilyType.OVERPASS, FontFamilyType.LATO, FontFamilyType.LIBRE_FRANKLIN, FontFamilyType.MONTSERRAT, FontFamilyType.POPPINS, FontFamilyType.RUBIK, FontFamilyType.RALEWAY, FontFamilyType.JOSEFIN_SANS, FontFamilyType.ALEGREYA_SANS, FontFamilyType.OSWALD]);\nvar FontFamilyMap = Object.freeze((_Object$freeze = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.THEME_DEFAULT, null), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.GEORGIA, 'Georgia, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.PALATINO, '\"Palatino Linotype\", \"Book Antiqua\", Palatino, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TIMES_NEW_ROMAN, '\"Times New Roman\", Times, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.ARIAL, 'Arial, Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.IMPACT, 'Impact, Charcoal, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.LUCIDA, '\"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TAHOMA, 'Tahoma, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TREBUCHET, '\"Trebuchet MS\", Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.VERDANA, 'Verdana, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.COURIER, '\"Courier New\", Courier, monospace'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.CABIN, '\"Cabin\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.CHIVO, '\"Chivo\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.OPEN_SANS, '\"Open Sans\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.FIRA_SANS, '\"Fira Sans\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.ROBOTO, '\"Roboto\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.NUNITO, '\"Nunito\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.OVERPASS, '\"Overpass\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.LATO, '\"Lato\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.LIBRE_FRANKLIN, '\"Libre Franklin\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.MONTSERRAT, '\"Montserrat\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.POPPINS, '\"Poppins\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.RUBIK, '\"Rubik\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.RALEWAY, '\"Raleway\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.JOSEFIN_SANS, '\"Josefin Sans\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.ALEGREYA_SANS, '\"Alegreya Sans\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.OSWALD, '\"Oswald\", sans-serif'), _Object$freeze));\nvar PollStatus = Object.freeze({\n OPEN: 'open',\n CLOSED: 'closed',\n CLOSED_AFTER: 'closed-after'\n});\nvar ClosedPollState = Object.freeze({\n SHOW_RESULTS: 'show-results',\n SHOW_CLOSED_BANNER: 'show-closed-banner',\n HIDDEN: 'hidden'\n});\nvar ConnectedAccountState = Object.freeze({\n CONNECTED: 'connected',\n NOT_CONNECTED: 'not-connected',\n NOT_VERIFIED: 'not-verified'\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/constants.js?");
|
122 |
|
123 |
/***/ }),
|
124 |
|
166 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
167 |
|
168 |
"use strict";
|
169 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/block-editor */ \"@wordpress/block-editor\");\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/data */ \"@wordpress/data\");\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var components_poll_closed_banner__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! components/poll/closed-banner */ \"./client/components/poll/closed-banner.js\");\n/* harmony import */ var components_poll_styles__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! components/poll/styles */ \"./client/components/poll/styles.js\");\n/* harmony import */ var components_poll_results__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! components/poll/results */ \"./client/components/poll/results.js\");\n/* harmony import */ var components_poll_util__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! components/poll/util */ \"./client/components/poll/util.js\");\n/* harmony import */ var components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! components/with-fallback-styles */ \"./client/components/with-fallback-styles/index.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var _edit_answers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./edit-answers */ \"./client/blocks/poll/edit-answers.js\");\n/* harmony import */ var _sidebar__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./sidebar */ \"./client/blocks/poll/sidebar.js\");\n/* harmony import */ var _toolbar__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./toolbar */ \"./client/blocks/poll/toolbar.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./util */ \"./client/blocks/poll/util.js\");\n/* harmony import */ var components_poll_error_banner__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! components/poll/error-banner */ \"./client/components/poll/error-banner.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/index.js\");\n/* harmony import */ var _edit_bar__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./edit-bar */ \"./client/blocks/poll/edit-bar.js\");\n/* harmony import */ var _subscriptions__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./subscriptions */ \"./client/blocks/poll/subscriptions.js\");\n/* harmony import */ var _connect_to_crowdsignal__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./connect-to-crowdsignal */ \"./client/blocks/poll/connect-to-crowdsignal.js\");\n\n\n\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n\n/**\n * WordPress dependencies\n */\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nObject(_subscriptions__WEBPACK_IMPORTED_MODULE_23__[\"startSubscriptions\"])();\n\nvar withPollAndAnswerIds = function withPollAndAnswerIds(Element) {\n return function (props) {\n var attributes = props.attributes,\n setAttributes = props.setAttributes;\n Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useEffect\"])(function () {\n if (!attributes.pollId) {\n var thePollId = Object(uuid__WEBPACK_IMPORTED_MODULE_21__[\"v4\"])();\n setAttributes({\n pollId: thePollId\n });\n }\n\n if (Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"some\"])(attributes.answers, function (a) {\n return !a.answerId && a.text;\n })) {\n var answers = Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"map\"])(attributes.answers, function (answer) {\n if (answer.answerId || !answer.text) {\n return answer;\n }\n\n var answerId = Object(uuid__WEBPACK_IMPORTED_MODULE_21__[\"v4\"])();\n return _objectSpread({}, answer, {\n answerId: answerId\n });\n });\n setAttributes({\n answers: answers\n });\n }\n });\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(Element, props);\n };\n};\n\nvar PollBlock = function PollBlock(props) {\n var attributes = props.attributes,\n className = props.className,\n fallbackStyles = props.fallbackStyles,\n isSelected = props.isSelected,\n setAttributes = props.setAttributes,\n renderStyleProbe = props.renderStyleProbe,\n pollDataFromApi = props.pollDataFromApi;\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])(true),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),\n isPollEditable = _useState2[0],\n setIsPollEditable = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])(''),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),\n errorMessage = _useState4[0],\n setErrorMessage = _useState4[1];\n\n var viewResultsUrl = pollDataFromApi ? pollDataFromApi.viewResultsUrl : '';\n var pollIdFromApi = pollDataFromApi ? pollDataFromApi.id : null;\n var answerIdMap = {};\n\n if (pollDataFromApi) {\n Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"map\"])(pollDataFromApi.answers, function (answer) {\n answerIdMap[answer.client_id] = answer.id;\n });\n }\n\n var handleChangeQuestion = function handleChangeQuestion(question) {\n return setAttributes({\n question: question\n });\n };\n\n var handleChangeNote = function handleChangeNote(note) {\n return setAttributes({\n note: note\n });\n };\n\n var isClosed = Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"isPollClosed\"])(attributes.pollStatus, attributes.closedAfterDateTime);\n var showNote = attributes.note || isSelected && isPollEditable;\n var showResults = isClosed && _constants__WEBPACK_IMPORTED_MODULE_15__[\"ClosedPollState\"].SHOW_RESULTS === attributes.closedPollState;\n var isHidden = isClosed && _constants__WEBPACK_IMPORTED_MODULE_15__[\"ClosedPollState\"].HIDDEN === attributes.closedPollState;\n var hideBranding = true; // hide branding in editor for now\n\n var postDetails = wp.data.select('core/editor').getCurrentPost();\n var wasBlockAddedBeforeLastPublish = 'publish' === postDetails.status && Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"pollIdExistsInPageContent\"])(attributes.pollId, postDetails.content);\n Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useEffect\"])(function () {\n return setIsPollEditable(!wasBlockAddedBeforeLastPublish);\n }, [isSelected]);\n var showEditBar = isSelected && wasBlockAddedBeforeLastPublish && !isPollEditable;\n\n if (attributes.fontFamily) {\n Object(components_poll_util__WEBPACK_IMPORTED_MODULE_12__[\"loadCustomFont\"])(attributes.fontFamily);\n }\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_connect_to_crowdsignal__WEBPACK_IMPORTED_MODULE_24__[\"default\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_toolbar__WEBPACK_IMPORTED_MODULE_18__[\"default\"], props), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_sidebar__WEBPACK_IMPORTED_MODULE_17__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, props, {\n viewResultsUrl: viewResultsUrl\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"getBlockCssClasses\"])(attributes, className, {\n 'is-selected-in-editor': isSelected,\n 'is-closed': isClosed,\n 'is-hidden': isHidden\n }),\n style: Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"getStyleVars\"])(attributes, fallbackStyles)\n }, showEditBar && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_edit_bar__WEBPACK_IMPORTED_MODULE_22__[\"default\"], {\n onEditClick: function onEditClick() {\n setIsPollEditable(true);\n }\n }), errorMessage && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(components_poll_error_banner__WEBPACK_IMPORTED_MODULE_20__[\"default\"], null, errorMessage), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__content\"\n }, isPollEditable ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__[\"RichText\"], {\n tagName: \"h3\",\n className: \"wp-block-crowdsignal-forms-poll__question\",\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Enter your question'),\n onChange: handleChangeQuestion,\n value: attributes.question,\n allowedFormats: []\n }) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"h3\", {\n className: \"wp-block-crowdsignal-forms-poll__question\"\n }, attributes.question ? Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__[\"decodeEntities\"])(attributes.question) : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Enter your question')), showNote && (isPollEditable ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__[\"RichText\"], {\n tagName: \"p\",\n className: \"wp-block-crowdsignal-forms-poll__note\",\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Add a note (optional)'),\n onChange: handleChangeNote,\n value: attributes.note,\n allowedFormats: []\n }) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"p\", {\n className: \"wp-block-crowdsignal-forms-poll__note\"\n }, attributes.note ? Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__[\"decodeEntities\"])(attributes.note) : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Add a note (optional)'))), !showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_edit_answers__WEBPACK_IMPORTED_MODULE_16__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, props, {\n setAttributes: setAttributes,\n disabled: !isPollEditable\n })), showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(components_poll_results__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n answers: Object(components_poll_util__WEBPACK_IMPORTED_MODULE_12__[\"addApiAnswerIds\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"filter\"])(attributes.answers, function (answer) {\n return !Object(components_poll_util__WEBPACK_IMPORTED_MODULE_12__[\"isAnswerEmpty\"])(answer);\n }), answerIdMap),\n pollIdFromApi: pollIdFromApi,\n hideBranding: hideBranding,\n setErrorMessage: setErrorMessage\n })), isClosed && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(components_poll_closed_banner__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n isPollHidden: isHidden,\n isPollClosed: isClosed\n }), renderStyleProbe()));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_13__[\"withFallbackStyles\"])(components_poll_styles__WEBPACK_IMPORTED_MODULE_10__[\"PollStyles\"], components_poll_styles__WEBPACK_IMPORTED_MODULE_10__[\"getPollStyles\"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_7__[\"withSelect\"])(function (select, ownProps) {\n var attributes = ownProps.attributes;\n var pollDataFromApi = attributes.pollId ? select('crowdsignal-forms/polls').getPollDataByClientId(attributes.pollId) : null;\n return {\n pollDataFromApi: pollDataFromApi\n };\n})(withPollAndAnswerIds(PollBlock))));\n\n//# sourceURL=webpack:///./client/blocks/poll/edit.js?");
|
170 |
|
171 |
/***/ }),
|
172 |
|
178 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
179 |
|
180 |
"use strict";
|
181 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var components_icon_poll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! components/icon/poll */ \"./client/components/icon/poll.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store */ \"./client/blocks/poll/store.js\");\n/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./edit */ \"./client/blocks/poll/edit.js\");\n/* harmony import */ var _attributes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./attributes */ \"./client/blocks/poll/attributes.js\");\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Poll'),\n description: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Create polls and get your audience’s opinion — powered by Crowdsignal.'),\n category: 'widgets',\n keywords: [Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('ask'), 'crowdsignal', Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('feedback'), Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('poll'), Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('pop'), Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('question'), Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('quiz'), Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('research'), Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('survey'), Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('vote')],\n icon: Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_poll__WEBPACK_IMPORTED_MODULE_1__[\"default\"], null),\n edit: _edit__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n attributes: _attributes__WEBPACK_IMPORTED_MODULE_5__[\"default\"],\n supports: {\n align: ['center', 'wide', 'full']\n },\n getEditWrapperProps: function getEditWrapperProps(_ref) {\n var align = _ref.align;\n return {\n 'data-align': align\n };\n },\n example: {\n attributes: {\n question: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('How did you hear about us?'),\n answers: [{\n text: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Search')\n }, {\n text: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Friend')\n }, {\n text: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Email')\n }]\n }\n }\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/index.js?");
|
182 |
|
183 |
/***/ }),
|
184 |
|
190 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
191 |
|
192 |
"use strict";
|
193 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ \"@wordpress/block-editor\");\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * WordPress dependencies\n */\n\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\nvar SideBar = function SideBar(_ref) {\n var _attributes$title;\n\n var attributes = _ref.attributes,\n setAttributes = _ref.setAttributes,\n fallbackBackgroundColor = _ref.fallbackBackgroundColor,\n fallbackTextColor = _ref.fallbackTextColor,\n fallbackSubmitButtonBackgroundColor = _ref.fallbackSubmitButtonBackgroundColor,\n fallbackSubmitButtonTextColor = _ref.fallbackSubmitButtonTextColor,\n viewResultsUrl = _ref.viewResultsUrl;\n\n var handleChangeTitle = function handleChangeTitle(title) {\n return setAttributes({\n title: title\n });\n };\n\n var handleChangeConfirmMessageType = function handleChangeConfirmMessageType(type) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"], type) && setAttributes({\n confirmMessageType: type\n });\n };\n\n var handleChangeCustomConfirmMessage = function handleChangeCustomConfirmMessage(customConfirmMessage) {\n return setAttributes({\n customConfirmMessage: customConfirmMessage\n });\n };\n\n var handleChangeRedirectAddress = function handleChangeRedirectAddress(redirectAddress) {\n return setAttributes({\n redirectAddress: redirectAddress\n });\n };\n\n var handleChangeTextColor = function handleChangeTextColor(textColor) {\n return setAttributes({\n textColor: textColor\n });\n };\n\n var handleChangeBackgroundColor = function handleChangeBackgroundColor(backgroundColor) {\n return setAttributes({\n backgroundColor: backgroundColor\n });\n };\n\n var handleChangeBorderColor = function handleChangeBorderColor(borderColor) {\n return setAttributes({\n borderColor: borderColor\n });\n };\n\n var handleChangeBorderRadius = function handleChangeBorderRadius(borderRadius) {\n setAttributes({\n borderRadius: parseInt(borderRadius, 10) || 0\n });\n };\n\n var handleChangeBorderWidth = function handleChangeBorderWidth(borderWidth) {\n setAttributes({\n borderWidth: parseInt(borderWidth, 10) || 0\n });\n };\n\n var handleChangeFontFamily = function handleChangeFontFamily(font) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"], font) && setAttributes({\n fontFamily: font\n });\n };\n\n var handleChangeHasOneResponsePerComputer = function handleChangeHasOneResponsePerComputer(hasOneResponsePerComputer) {\n return setAttributes({\n hasOneResponsePerComputer: hasOneResponsePerComputer\n });\n };\n\n var handleChangeRandomizeAnswers = function handleChangeRandomizeAnswers(randomizeAnswers) {\n return setAttributes({\n randomizeAnswers: randomizeAnswers\n });\n };\n\n var handleChangeSubmitButtonTextColor = function handleChangeSubmitButtonTextColor(submitButtonTextColor) {\n return setAttributes({\n submitButtonTextColor: submitButtonTextColor\n });\n };\n\n var handleChangeSubmitButtonBackgroundColor = function handleChangeSubmitButtonBackgroundColor(submitButtonBackgroundColor) {\n return setAttributes({\n submitButtonBackgroundColor: submitButtonBackgroundColor\n });\n };\n\n var handleChangePollStatus = function handleChangePollStatus(pollStatus) {\n if (!Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"], pollStatus)) {\n return;\n } // closedAfterDateTime MUST be set when pollStatus is set to CLOSED_AFTER\n\n\n setAttributes({\n closedAfterDateTime: pollStatus === _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED_AFTER ? new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString() : null,\n pollStatus: pollStatus\n });\n };\n\n var handleChangeClosedPollState = function handleChangeClosedPollState(closedPollState) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"], closedPollState) && setAttributes({\n closedPollState: closedPollState\n });\n };\n\n var handleChangeCloseAfterDateTime = function handleChangeCloseAfterDateTime(closedAfterDateTime) {\n var dateTime = new Date(closedAfterDateTime);\n setAttributes({\n closedAfterDateTime: dateTime.toISOString()\n });\n };\n\n var handleChangeHasBoxShadow = function handleChangeHasBoxShadow(hasBoxShadow) {\n setAttributes({\n hasBoxShadow: hasBoxShadow\n });\n };\n\n var resultsLinkEnabled = '' !== viewResultsUrl;\n var resultsLinkClasses = classnames__WEBPACK_IMPORTED_MODULE_2___default()('wp-block-crowdsignal-forms__view-results', {\n 'is-disabled': !resultsLinkEnabled\n });\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"InspectorControls\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Results'),\n initialOpen: true\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: resultsLinkClasses\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null, resultsLinkEnabled ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Manage results on: ') : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Save this poll to enable results.'), resultsLinkEnabled && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"ExternalLink\"], {\n href: viewResultsUrl\n }, \"crowdsignal.com\")), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"Button\"], {\n href: viewResultsUrl,\n isSecondary: true,\n target: \"_blank\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('View results')))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextControl\"], {\n value: Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__[\"decodeEntities\"])((_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : attributes.question),\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Title of the poll block'),\n onChange: handleChangeTitle\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Confirmation message'),\n initialOpen: false\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.confirmMessageType,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('On submission'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show results'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].RESULTS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show \"Thank You\" message'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].THANK_YOU\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show a custom text message'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].CUSTOM_TEXT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Redirect to another webpage'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].REDIRECT\n }],\n onChange: handleChangeConfirmMessageType\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].CUSTOM_TEXT === attributes.confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextareaControl\"], {\n value: attributes.customConfirmMessage,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Message text'),\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Thanks for voting!'),\n onChange: handleChangeCustomConfirmMessage\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].REDIRECT === attributes.confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"URLInput\"], {\n className: \"wp-block-crowdsignal-forms__redirect-url\",\n value: attributes.redirectAddress,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Redirect address'),\n onChange: handleChangeRedirectAddress\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Poll status'),\n initialOpen: false\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.pollStatus,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Currently'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Open'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].OPEN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Closed after'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED_AFTER\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Closed'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED\n }],\n onChange: handleChangePollStatus\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED_AFTER === attributes.pollStatus && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TimePicker\"], {\n currentTime: attributes.closedAfterDateTime,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Close poll on'),\n onChange: handleChangeCloseAfterDateTime,\n is12Hour: true\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].OPEN !== attributes.pollStatus && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.closedPollState,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('When poll is closed'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show results'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"].SHOW_RESULTS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show poll with \"Closed\" banner'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"].SHOW_CLOSED_BANNER\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Hide poll'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"].HIDDEN\n }],\n onChange: handleChangeClosedPollState\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"PanelColorSettings\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Block styling'),\n initialOpen: false,\n colorSettings: [{\n value: attributes.textColor,\n onChange: handleChangeTextColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Text color')\n }, {\n value: attributes.backgroundColor,\n onChange: handleChangeBackgroundColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Background color')\n }, {\n value: attributes.borderColor,\n onChange: handleChangeBorderColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Border color')\n }]\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"ContrastChecker\"], {\n textColor: attributes.textColor,\n backgroundColor: attributes.backgroundColor,\n fallbackBackgroundColor: fallbackBackgroundColor,\n fallbackTextColor: fallbackTextColor\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.fontFamily,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Choose font'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Default theme font'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].THEME_DEFAULT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Alegreya Sans'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].ALEGREYA_SANS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Arial'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].ARIAL\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Cabin'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].CABIN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Chivo'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].CHIVO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Courier'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].COURIER\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Fira Sans'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].FIRA_SANS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Georgia'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].GEORGIA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Impact'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].IMPACT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Josefin Sans'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].JOSEFIN_SANS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Lato'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].LATO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Libre Franklin'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].LIBRE_FRANKLIN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Lucida'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].LUCIDA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Montserrat'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].MONTSERRAT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Nunito'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].NUNITO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Open Sans'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].OPEN_SANS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Oswald'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].OSWALD\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Overpass'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].OVERPASS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Palatino'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].PALATINO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Poppins'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].POPPINS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Raleway'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].RALEWAY\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Roboto'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].ROBOTO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Rubik'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].RUBIK\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Tahoma'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].TAHOMA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Times New Roman'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].TIMES_NEW_ROMAN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Trebuchet'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].TREBUCHET\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Verdana'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].VERDANA\n }],\n onChange: handleChangeFontFamily\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__row\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Border thickness'),\n value: attributes.borderWidth,\n onChange: handleChangeBorderWidth,\n type: \"number\",\n className: \"wp-block-crowdsignal-forms__small-text-input\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Corner radius'),\n value: attributes.borderRadius,\n onChange: handleChangeBorderRadius,\n type: \"number\",\n className: \"wp-block-crowdsignal-forms__small-text-input\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"ToggleControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Drop shadow'),\n checked: attributes.hasBoxShadow,\n onChange: handleChangeHasBoxShadow\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"PanelColorSettings\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Button styling'),\n initialOpen: false,\n colorSettings: [{\n value: attributes.submitButtonTextColor,\n onChange: handleChangeSubmitButtonTextColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Text color')\n }, {\n value: attributes.submitButtonBackgroundColor,\n onChange: handleChangeSubmitButtonBackgroundColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Background color')\n }]\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"ContrastChecker\"], {\n textColor: attributes.submitButtonTextColor,\n backgroundColor: attributes.submitButtonBackgroundColor,\n fallbackBackgroundColor: fallbackSubmitButtonBackgroundColor,\n fallbackTextColor: fallbackSubmitButtonTextColor\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Answer settings'),\n initialOpen: true\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"CheckboxControl\"], {\n checked: attributes.hasOneResponsePerComputer,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('One response per computer'),\n onChange: handleChangeHasOneResponsePerComputer\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"CheckboxControl\"], {\n checked: attributes.randomizeAnswers,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Randomize answer order'),\n onChange: handleChangeRandomizeAnswers\n })));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (SideBar);\n\n//# sourceURL=webpack:///./client/blocks/poll/sidebar.js?");
|
194 |
|
195 |
/***/ }),
|
196 |
|
238 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
239 |
|
240 |
"use strict";
|
241 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addAnswer\", function() { return addAnswer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getFontFamilyFromType\", function() { return getFontFamilyFromType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getStyleVars\", function() { return getStyleVars; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractRGBColorProperties\", function() { return extractRGBColorProperties; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hexToRGB\", function() { return hexToRGB; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBlockCssClasses\", function() { return getBlockCssClasses; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isPollClosed\", function() { return isPollClosed; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pollIdExistsInPageContent\", function() { return pollIdExistsInPageContent; });\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ \"./node_modules/@babel/runtime/helpers/toConsumableArray.js\");\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Creates a new Answer object then returns a copy of the passed in `answers` array with the new answer appended to it.\n *\n * @param {Array} answers The existing array of answers.\n * @param {string} text\tThe text for the new answer to add.\n * @return {Array}\t\t\tThe newly created answers array.\n */\n\nvar addAnswer = function addAnswer(answers, text) {\n return [].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(answers), [{\n answerId: null,\n text: text\n }]);\n};\nvar getFontFamilyFromType = function getFontFamilyFromType(type) {\n if (!Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_3__[\"FontFamilyType\"], type)) {\n return null;\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_3__[\"FontFamilyMap\"][type];\n};\nvar getStyleVars = function getStyleVars(attributes, fallbackStyles) {\n var _attributes$borderCol, _getFontFamilyFromTyp, _getFontFamilyFromTyp2, _extractRGBColorPrope;\n\n var textColor = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isEmpty\"])(attributes.textColor) ? fallbackStyles.text : attributes.textColor;\n return Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"mapKeys\"])({\n borderColor: (_attributes$borderCol = attributes.borderColor) !== null && _attributes$borderCol !== void 0 ? _attributes$borderCol : fallbackStyles.accent,\n borderRadius: \"\".concat(attributes.borderRadius, \"px\"),\n borderWidth: \"\".concat(attributes.borderWidth, \"px\"),\n bgColor: attributes.backgroundColor,\n bodyFontFamily: (_getFontFamilyFromTyp = getFontFamilyFromType(attributes.fontFamily)) !== null && _getFontFamilyFromTyp !== void 0 ? _getFontFamilyFromTyp : fallbackStyles.bodyFontFamily,\n questionFontFamily: (_getFontFamilyFromTyp2 = getFontFamilyFromType(attributes.fontFamily)) !== null && _getFontFamilyFromTyp2 !== void 0 ? _getFontFamilyFromTyp2 : fallbackStyles.questionFontFamily,\n submitButtonBgColor: attributes.submitButtonBackgroundColor || fallbackStyles.accent,\n submitButtonTextColor: attributes.submitButtonTextColor || fallbackStyles.textInverted,\n textColor: textColor,\n textColorProperties: (_extractRGBColorPrope = extractRGBColorProperties(textColor)) !== null && _extractRGBColorPrope !== void 0 ? _extractRGBColorPrope : '0, 0, 0',\n contentWideWidth: fallbackStyles.contentWideWidth\n }, function (_, key) {\n return \"--crowdsignal-forms-\".concat(Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"kebabCase\"])(key));\n });\n};\n/**\n * Extracts the comma separated color properties from an rgb string.\n * rgba strings are not supported for now because it introduces too many complications.\n *\n * @param {string} color The color string.\n * @return {string} The 3 comma separated rgb color properties.\n */\n\nvar extractRGBColorProperties = function extractRGBColorProperties(color) {\n if (!color || 'string' !== typeof color || -1 === color.indexOf('rgb') && 0 !== color.indexOf('#') || -1 < color.indexOf('rgba')) {\n return null;\n }\n\n if (0 === color.indexOf('#')) {\n color = hexToRGB(color);\n }\n\n return color.match(/\\((.*?)\\)/)[1];\n};\n/**\n * converts css color hex to rgb\n *\n * @param {string} h The hex color string.\n * @return {string} The rgb value.\n */\n\nvar hexToRGB = function hexToRGB(h) {\n var r = 0,\n g = 0,\n b = 0;\n var hexCode = 4 === h.length ? \"#\".concat(h[1] + h[1] + h[2] + h[2] + h[3] + h[3]) : h;\n\n if (7 === hexCode.length) {\n r = parseInt(hexCode.substr(1, 2), 16) || 0;\n g = parseInt(hexCode.substr(3, 2), 16) || 0;\n b = parseInt(hexCode.substr(5, 2), 16) || 0;\n }\n\n return \"rgb(\".concat(r, \", \").concat(g, \", \").concat(b, \")\");\n};\n/**\n * Returns a css 'class' string of overridden styles given a collection of attributes.\n *\n * @param {*} attributes The block's attributes\n * @param {...any} extraClasses A list of additional classes to add to the class string\n */\n\nvar getBlockCssClasses = function getBlockCssClasses(attributes) {\n var _attributes$borderRad;\n\n for (var _len = arguments.length, extraClasses = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n extraClasses[_key - 1] = arguments[_key];\n }\n\n return classnames__WEBPACK_IMPORTED_MODULE_1___default()({\n 'has-bg-color': attributes.backgroundColor,\n 'has-text-color': attributes.textColor,\n 'has-submit-button-bg-color': attributes.submitButtonBackgroundColor,\n 'has-submit-button-text-color': attributes.submitButtonTextColor,\n 'has-border-radius': (_attributes$borderRad = attributes.borderRadius) !== null && _attributes$borderRad !== void 0 ? _attributes$borderRad : false,\n 'has-box-shadow': attributes.hasBoxShadow\n }, extraClasses);\n};\n/**\n * Determines if the poll is closed based on its editor settings.\n *\n * @param {string} pollStatus The poll's status, as set in the editor.\n * @param {string} closedAfterDateTimeUTC The UTC date time string to close the poll after if pollStatus is PollStatus.CLOSED_AFTER.\n * @param {Date} currentDateTime Optionally set the current date that will be used for current time comparisons.\n */\n\nvar isPollClosed = function isPollClosed(pollStatus, closedAfterDateTimeUTC) {\n var currentDateTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Date();\n\n if (_constants__WEBPACK_IMPORTED_MODULE_3__[\"PollStatus\"].CLOSED === pollStatus) {\n return true;\n }\n\n if (_constants__WEBPACK_IMPORTED_MODULE_3__[\"PollStatus\"].CLOSED_AFTER === pollStatus) {\n var closedAfterDateTime = new Date(closedAfterDateTimeUTC);\n return closedAfterDateTime < currentDateTime;\n }\n\n return false;\n};\n/**\n * Parses the published post content to find the given pollId to determine if it is a published or unpublished poll.\n *\n * @param {*} pollId Id of the poll to search for.\n * @param {*} postContent Content of the published post.\n */\n\nvar pollIdExistsInPageContent = function pollIdExistsInPageContent(pollId, postContent) {\n if (!pollId) {\n return false;\n }\n\n var pollBlockInstanceStrings = postContent.split('<!-- '); // remove the 1st one since it will either be a blank string, or it will be other post content that is NOT a poll\n\n pollBlockInstanceStrings.splice(0, 1);\n return Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"some\"])(pollBlockInstanceStrings, function (blockInstanceString) {\n if (0 !== blockInstanceString.indexOf('wp:crowdsignal-forms/poll')) {\n return false;\n }\n\n var start = 'wp:crowdsignal-forms/poll'.length;\n var pollJsonString = blockInstanceString.substr(start, blockInstanceString.lastIndexOf('/-->') - start);\n var poll = JSON.parse(pollJsonString);\n return poll.pollId && poll.pollId === pollId;\n });\n};\n\n//# sourceURL=webpack:///./client/blocks/poll/util.js?");
|
242 |
|
243 |
/***/ }),
|
244 |
|
298 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
299 |
|
300 |
"use strict";
|
301 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar ClosedBanner = function ClosedBanner(_ref) {\n var hasVoted = _ref.hasVoted,\n isPollClosed = _ref.isPollClosed,\n isPollHidden = _ref.isPollHidden,\n showSubmitMessage = _ref.showSubmitMessage;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()({\n 'is-transparent': showSubmitMessage\n }, 'wp-block-crowdsignal-forms-poll__closed-banner');\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: classes\n }, isPollHidden && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_3__[\"__\"])('This Poll is Hidden'), isPollClosed && !isPollHidden && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_3__[\"__\"])('This Poll is Closed'), hasVoted && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_3__[\"__\"])('Thanks For Voting!'));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (ClosedBanner);\n\n//# sourceURL=webpack:///./client/components/poll/closed-banner.js?");
|
302 |
|
303 |
/***/ }),
|
304 |
|
346 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
347 |
|
348 |
"use strict";
|
349 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getPollStyles\", function() { return getPollStyles; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStyles\", function() { return PollStyles; });\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! components/with-fallback-styles/util */ \"./client/components/with-fallback-styles/util.js\");\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\nvar getPollStyles = function getPollStyles(node) {\n if (null === node) {\n return {};\n }\n\n var buttonNode = node.querySelector('.wp-block-button__link');\n var textNode = node.querySelector('p');\n var h3Node = node.querySelector('h3');\n var wideContentNode = node.querySelector('.alignwide');\n return {\n accent: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(buttonNode),\n surface: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(textNode),\n text: window.getComputedStyle(textNode).color,\n bodyFontFamily: window.getComputedStyle(textNode).fontFamily,\n questionFontFamily: window.getComputedStyle(h3Node).fontFamily,\n textInverted: window.getComputedStyle(buttonNode).color,\n contentWideWidth: window.getComputedStyle(wideContentNode).maxWidth\n };\n};\nvar PollStyles = function PollStyles() {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"h3\", null, \"Question\"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button__link\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"entry-content\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"alignwide\"\n })));\n};\n\n//# sourceURL=webpack:///./client/components/poll/styles.js?");
|
350 |
|
351 |
/***/ }),
|
352 |
|
354 |
/*!****************************************!*\
|
355 |
!*** ./client/components/poll/util.js ***!
|
356 |
\****************************************/
|
357 |
+
/*! exports provided: addApiAnswerIds, shuffleWithGenerator, isAnswerEmpty, loadCustomFont */
|
358 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
359 |
|
360 |
"use strict";
|
361 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addApiAnswerIds\", function() { return addApiAnswerIds; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shuffleWithGenerator\", function() { return shuffleWithGenerator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAnswerEmpty\", function() { return isAnswerEmpty; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"loadCustomFont\", function() { return loadCustomFont; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Adds api answer ids to the answer objects (when they are available).\n *\n * @param {Array} answers Answers array\n * @param {Array} answerIdMap A json object with client answer ids as keys, and API answer ids as values.\n * @return {Array} Updated answers array\n */\n\nvar addApiAnswerIds = function addApiAnswerIds(answers, answerIdMap) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"map\"])(answers, function (answer) {\n if (typeof answer.answerIdFromApi !== 'undefined') {\n return answer;\n }\n\n return _objectSpread({}, answer, {\n answerIdFromApi: answerIdMap[answer.answerId]\n });\n });\n};\n/**\n * Fisher-Yates algorithm shuffle implementation.\n * Provides a predictable way of shuffling array items given a seed.\n *\n * @param {Array} toShuffle The array to shuffle.\n * @param {Function} randomNumberGenerator A function that generates a random number (like `seedrandom`).\n * @return {Array} The shuffled array.\n */\n\nvar shuffleWithGenerator = function shuffleWithGenerator(toShuffle, randomNumberGenerator) {\n var shuffled = toShuffle.slice();\n\n for (var i = shuffled.length - 1; i > 0; i--) {\n var j = Math.floor(randomNumberGenerator() * i);\n var tmp = shuffled[i];\n shuffled[i] = shuffled[j];\n shuffled[j] = tmp;\n }\n\n return shuffled;\n};\n/**\n * Determines if an answer is considered \"empty\", based on if text is set and blank or object has no values.\n *\n * @param {*} answer The answer object.\n */\n\nvar isAnswerEmpty = function isAnswerEmpty(answer) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(answer) || 'undefined' === typeof answer.text || null === answer.text || '' === answer.text;\n};\n/**\n * Loads a custom google font, by name, only once per page if called more than once for the same font.\n *\n * @param {*} font The name of the Google font\n */\n\nvar loadCustomFont = function loadCustomFont(font) {\n if (Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(font) || blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"FontFamilyType\"].THEME_DEFAULT === font || -1 === blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"GoogleFonts\"].indexOf(font)) {\n return;\n }\n\n var googleFontsLink = \"https://fonts.googleapis.com/css2?family=\".concat(font, \":wght@400;600;700&display=swap\");\n var crowdsignalFonts = Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"filter\"])(Array.from(document.head.childNodes), function (node) {\n return node.nodeName.toLowerCase() === 'link' && node.href === googleFontsLink;\n });\n\n if (crowdsignalFonts.length === 0) {\n document.head.appendChild(Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"tap\"])(document.createElement('link'), function (link) {\n link.type = 'text/css';\n link.rel = 'stylesheet';\n link.href = googleFontsLink;\n }));\n }\n};\n\n//# sourceURL=webpack:///./client/components/poll/util.js?");
|
362 |
|
363 |
/***/ }),
|
364 |
|
394 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
395 |
|
396 |
"use strict";
|
397 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollResults\", function() { return usePollResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollVote\", function() { return usePollVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useIsCsConnected\", function() { return useIsCsConnected; });\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! js-cookie */ \"./node_modules/js-cookie/src/js.cookie.js\");\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(js_cookie__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var data_poll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! data/poll */ \"./client/data/poll/index.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util */ \"./client/data/hooks/util.js\");\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n\n\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\nvar usePollResults = function usePollResults(pollId) {\n var _useFetch = Object(_util__WEBPACK_IMPORTED_MODULE_6__[\"useFetch\"])(function () {\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestResults\"])(pollId);\n }, [pollId]),\n data = _useFetch.data,\n error = _useFetch.error,\n loading = _useFetch.loading;\n\n return {\n error: error,\n loading: loading,\n results: data\n };\n};\n/**\n * React Hook that returns state variables for voting status and a function to perform a vote.\n *\n * @param {number} pollId ID of the poll being loaded.\n * @param {boolean} enableVoteRestriction sets whether or not the vote cookie is read and set\n */\n\nvar usePollVote = function usePollVote(pollId) {\n var enableVoteRestriction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var cookieName = \"cs-poll-\".concat(pollId);\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),\n isVoting = _useState2[0],\n setIsVoting = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2),\n hasVoted = _useState4[0],\n setHasVoted = _useState4[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useEffect\"])(function () {\n if (enableVoteRestriction && undefined !== js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.get(cookieName)) {\n setHasVoted(true);\n }\n }, []);\n\n var vote = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(selectedAnswerIds) {\n var nonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n setIsVoting(true);\n _context.next = 4;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVoteNonce\"])(pollId);\n\n case 4:\n nonce = _context.sent;\n _context.next = 7;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVote\"])(nonce, pollId, selectedAnswerIds);\n\n case 7:\n setHasVoted(true);\n\n if (enableVoteRestriction) {\n js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.set(cookieName, new Date().getTime(), {\n sameSite: 'Strict',\n expires: 365\n });\n }\n\n case 9:\n _context.prev = 9;\n setIsVoting(false);\n return _context.finish(9);\n\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[0,, 9, 12]]);\n }));\n\n return function vote(_x) {\n return _ref.apply(this, arguments);\n };\n }();\n\n return {\n hasVoted: hasVoted,\n isVoting: isVoting,\n vote: vote\n };\n};\nvar useIsCsConnected = function useIsCsConnected() {\n /* assume connection is enabled, so placeholder doesn't flash while we add a block and wait for the request */\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(true),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState5, 2),\n isConnected = _useState6[0],\n setIsConnected = _useState6[1];\n\n var _useState7 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(true),\n _useState8 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState7, 2),\n isAccountVerified = _useState8[0],\n setIsAccountVerified = _useState8[1];\n\n var checkIsConnected = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() {\n var connectedState, isNowConnected, isNowVerified;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestIsCsConnected\"])();\n\n case 2:\n connectedState = _context2.sent;\n isNowConnected = blocks_poll_constants__WEBPACK_IMPORTED_MODULE_7__[\"ConnectedAccountState\"].CONNECTED === connectedState || blocks_poll_constants__WEBPACK_IMPORTED_MODULE_7__[\"ConnectedAccountState\"].NOT_VERIFIED === connectedState;\n isNowVerified = blocks_poll_constants__WEBPACK_IMPORTED_MODULE_7__[\"ConnectedAccountState\"].CONNECTED === connectedState;\n setIsConnected(isNowConnected);\n setIsAccountVerified(isNowVerified);\n return _context2.abrupt(\"return\", {\n isNowConnected: isNowConnected,\n isNowVerified: isNowVerified\n });\n\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function checkIsConnected() {\n return _ref2.apply(this, arguments);\n };\n }();\n\n Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useEffect\"])(function () {\n checkIsConnected();\n }, []);\n return {\n isConnected: isConnected,\n isAccountVerified: isAccountVerified,\n checkIsConnected: checkIsConnected\n };\n};\n\n//# sourceURL=webpack:///./client/data/hooks/index.js?");
|
398 |
|
399 |
/***/ }),
|
400 |
|
418 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
419 |
|
420 |
"use strict";
|
421 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestResults\", function() { return requestResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVoteNonce\", function() { return requestVoteNonce; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVote\", function() { return requestVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsError\", function() { return CrowdsignalFormsError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsServerError\", function() { return CrowdsignalFormsServerError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestIsCsConnected\", function() { return requestIsCsConnected; });\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\");\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/inherits.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ \"./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js\");\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ \"./node_modules/@babel/runtime/helpers/wrapNativeSuper.js\");\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/api-fetch */ \"@wordpress/api-fetch\");\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n\n\n\n\n\n\nfunction _createSuper(Derived) { return function () { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Fetch the poll results for the given pollId\n *\n * @param {number} pollId Poll ID.\n * @return {Promise} Promise that resolves to a key-value object with answer IDs and vote counts.\n */\n\nvar requestResults = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee(pollId) {\n var baseUrl;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n baseUrl = 'https://api.crowdsignal.com/v3/polls';\n return _context.abrupt(\"return\", window.fetch(\"\".concat(baseUrl, \"/\").concat(pollId, \"/results\"), {\n method: 'GET',\n headers: {\n 'content-type': 'application/json'\n }\n }).then(function (response) {\n if (response.status >= 200 && response.status < 300) {\n return response.json();\n }\n\n throw response;\n }).then(function (response) {\n if (404 === response.status) {\n // poll doesn't exist on the platform yet, return an empty result\n return {};\n } else if (response.error) {\n throw new Error(response.message);\n }\n\n return response.results.votes_by_answer;\n }));\n\n case 2:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function requestResults(_x) {\n return _ref.apply(this, arguments);\n };\n}();\nvar requestVoteNonce = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee2(pollId) {\n var hash, timestamp, respNonce, jsonNonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n hash = '5430eeac3911395001d731d9702fc38b'; // hash not used when format=json is passed\n\n timestamp = new Date().getTime();\n _context2.next = 4;\n return window.fetch(\"https://polldaddy.com/n/\".concat(hash, \"/\").concat(pollId, \"?\").concat(timestamp, \"&format=json\"));\n\n case 4:\n respNonce = _context2.sent;\n\n if (respNonce.ok) {\n _context2.next = 7;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 7:\n _context2.next = 9;\n return respNonce.json();\n\n case 9:\n jsonNonce = _context2.sent;\n\n if (jsonNonce.nonce) {\n _context2.next = 12;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 12:\n return _context2.abrupt(\"return\", jsonNonce.nonce);\n\n case 13:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function requestVoteNonce(_x2) {\n return _ref2.apply(this, arguments);\n };\n}();\nvar requestVote = /*#__PURE__*/function () {\n var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee3(nonce, pollId, selectedAnswerIds) {\n var answerString, respVote, jsonVote;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n answerString = selectedAnswerIds.join(',');\n _context3.next = 3;\n return window.fetch(\"https://polls.polldaddy.com/vote-js.php?format=json&p=\".concat(pollId, \"&b=1&a=\").concat(answerString, \"&o=&va=16&cookie=0&n=\").concat(nonce, \"&url=\").concat(encodeURIComponent(window.location)));\n\n case 3:\n respVote = _context3.sent;\n\n if (respVote.ok) {\n _context3.next = 6;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 6:\n _context3.next = 8;\n return respVote.json();\n\n case 8:\n jsonVote = _context3.sent;\n\n if (!('error' === jsonVote.status)) {\n _context3.next = 11;\n break;\n }\n\n throw new CrowdsignalFormsError(jsonVote.error);\n\n case 11:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n return function requestVote(_x3, _x4, _x5) {\n return _ref3.apply(this, arguments);\n };\n}();\nvar CrowdsignalFormsError = /*#__PURE__*/function (_Error) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsError, _Error);\n\n var _super = _createSuper(CrowdsignalFormsError);\n\n function CrowdsignalFormsError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsError);\n\n return _super.apply(this, arguments);\n }\n\n return CrowdsignalFormsError;\n}( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default()(Error));\nvar CrowdsignalFormsServerError = /*#__PURE__*/function (_CrowdsignalFormsErro) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsServerError, _CrowdsignalFormsErro);\n\n var _super2 = _createSuper(CrowdsignalFormsServerError);\n\n function CrowdsignalFormsServerError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsServerError);\n\n return _super2.call(this, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Server error. Please try again.'));\n }\n\n return CrowdsignalFormsServerError;\n}(CrowdsignalFormsError);\n/**\n * Returns the connected state of the current user's account.\n *\n * @return {string} Enum value of the account's state.\n */\n\nvar requestIsCsConnected = /*#__PURE__*/function () {\n var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee4() {\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default()({\n path: \"/crowdsignal-forms/v1/account/connected\",\n method: 'GET'\n });\n\n case 2:\n return _context4.abrupt(\"return\", _context4.sent);\n\n case 3:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n\n return function requestIsCsConnected() {\n return _ref4.apply(this, arguments);\n };\n}();\n\n//# sourceURL=webpack:///./client/data/poll/index.js?");
|
422 |
|
423 |
/***/ }),
|
424 |
|
build/poll.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-polyfill'), 'version' => '3db1a0b24ea0a744e38a4b9828ff1f1c');
|
build/poll.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@keyframes crowdsignal-forms-animation__pop{0%{transform:scale(0)}50%{transform:scale(1.2)}100%{transform:scale(1)}}@keyframes crowdsignal-forms-animation__pulse{0%{opacity:0.4}50%{opacity:0.7}100%{opacity:0.4}}.wp-block-crowdsignal-forms-poll{border-color:var(--crowdsignal-forms-border-color);border-style:solid;border-width:var(--crowdsignal-forms-border-width);margin-top:1.25em;margin-bottom:1.25em;position:relative;text-align:left}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll{border-left-width:0;border-right-width:0}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question{margin:0 0 28px}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question:first-child{margin-top:0}.wp-block-crowdsignal-forms-poll p.wp-block-crowdsignal-forms-poll__note{font-style:italic;margin:0 0 32px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:40px 24px 16px 24px}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{margin:0 auto;max-width:var(--crowdsignal-forms-content-wide-width)}@media screen and (min-width: 660px){.alignwide.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content,.alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:80px}}.wp-block-crowdsignal-forms-poll.is-closed .wp-block-crowdsignal-forms-poll__form{opacity:0.5}.wp-block-crowdsignal-forms-poll.is-hidden{opacity:0.5}.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__answer-label-wrapper,.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__question,.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__note{font-family:var(--crowdsignal-forms-font-family)}.wp-block-crowdsignal-forms-poll.has-text-color{color:var(--crowdsignal-forms-text-color)}.wp-block-crowdsignal-forms-poll.has-bg-color{background-color:var(--crowdsignal-forms-bg-color)}.wp-block-crowdsignal-forms-poll.has-border-radius{border-radius:var(--crowdsignal-forms-border-radius);overflow:hidden}.wp-block-crowdsignal-forms-poll.has-box-shadow{box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23)}.wp-block-crowdsignal-forms-poll__submit-button:disabled{opacity:0.7}.wp-block-crowdsignal-forms-poll.has-submit-button-bg-color .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{background-color:var(--crowdsignal-forms-submit-button-bg-color)}.wp-block-crowdsignal-forms-poll.has-submit-button-text-color .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{color:var(--crowdsignal-forms-submit-button-text-color)}.wp-block-crowdsignal-forms-poll__answer{cursor:pointer;display:flex;font-size:inherit;font-weight:600;margin:0 0 16px;padding:0 2px;position:relative}.wp-block-crowdsignal-forms-poll__answer:hover,.wp-block-crowdsignal-forms-poll__answer.is-focused{color:var(--crowdsignal-forms-submit-button-bg-color)}.has-voted .wp-block-crowdsignal-forms-poll__answer{opacity:0.5}input[type="checkbox"].wp-block-crowdsignal-forms-poll__input,input[type="radio"].wp-block-crowdsignal-forms-poll__input{height:0;opacity:0;position:absolute;width:0}.wp-block-crowdsignal-forms-poll__check{display:inline-block;height:1em;margin:0 10px 0 0;position:relative;width:1em}.wp-block-crowdsignal-forms-poll__check::before{background-color:transparent;border:1.5px solid var(--crowdsignal-forms-text-color);border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;transition:background-color 0.3s, border-color 0.3s;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::before{border-radius:3px}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice.is-selected .wp-block-crowdsignal-forms-poll__check::before{border-color:var(--crowdsignal-forms-border-color);background-color:var(--crowdsignal-forms-border-color)}.wp-block-crowdsignal-forms-poll__answer.is-selected:not(.is-multiple-choice) .wp-block-crowdsignal-forms-poll__check::after{animation-duration:0.3s;animation-name:crowdsignal-forms-animation__pop;animation-iteration-count:1;background-clip:padding-box;background-color:var(--crowdsignal-forms-border-color);border:4.5px solid transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;position:absolute;left:0;top:0;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-selected.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::after{border-color:var(--crowdsignal-forms-submit-button-text-color);border-style:solid;border-width:0 0 2px 2px;box-sizing:border-box;content:"";display:block;height:25%;margin:-0.1em 0 0 -0.2em;position:absolute;left:50%;top:50%;transform:rotateZ(-45deg);width:50%}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper{flex:1;word-break:break-word}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label{line-height:1;vertical-align:top}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label span::after{vertical-align:top}.wp-block-crowdsignal-forms-poll__button{border:0;padding:0}.wp-block-crowdsignal-forms-poll__actions{display:flex;justify-content:flex-end}.wp-block-crowdsignal-forms-poll__actions .wp-block-button{margin:0}.editor-styles-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__actions .wp-block-button.wp-block-crowdsignal-forms-poll__block-button{margin:0}.wp-block-crowdsignal-forms-poll__closed-banner{background-color:var(--crowdsignal-forms-border-color);box-sizing:border-box;display:flex;color:var(--crowdsignal-forms-submit-button-text-color);font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;justify-content:center;padding:calc(var(--crowdsignal-forms-border-width) + 0.2em) 0 0.2em;width:100%}.is-hidden .wp-block-crowdsignal-forms-poll__closed-banner{font-style:italic}.wp-block-crowdsignal-forms-poll__error{color:red}.wp-block-crowdsignal-forms-poll__results-list{margin:0 0 1em;position:relative}.wp-block-crowdsignal-forms-poll__answer-results{display:flex;flex-direction:column;margin:0 0 16px;width:100%}.wp-block-crowdsignal-forms-poll__answer-results:last-child{margin:0}.wp-block-crowdsignal-forms-poll__answer-results-labels{align-items:flex-end;display:flex;margin:0 0 8px;width:100%;word-break:break-word}.wp-block-crowdsignal-forms-poll__answer-results-answer{flex:1;font-size:1em;font-weight:600}.wp-block-crowdsignal-forms-poll__answer-results-votes{font-size:0.75em;line-height:2}.wp-block-crowdsignal-forms-poll__answer-results-percent{font-weight:600;line-height:1.6}.wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results-percent{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;margin-left:20px;transition:opacity 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-percent{display:none}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse;background-color:var(--crowdsignal-forms-text-color);font-size:0.7em;height:1em;width:50px}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes:last-child,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent:last-child{width:40px}.wp-block-crowdsignal-forms-poll__answer-results-progress-track{border:1px solid;border-color:rgba(var(--crowdsignal-forms-text-color-properties), 0.3);box-sizing:border-box;height:1em;width:100%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-track{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse}.wp-block-crowdsignal-forms-poll__answer-results-progress-bar{animation-fill-mode:forwards;background-color:var(--crowdsignal-forms-submit-button-bg-color);height:100%;transition:background-color 0.3s, width 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:0}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{background-color:var(--crowdsignal-forms-text-color);width:25%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+1) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:40%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+2) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:75%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+3) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:50%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+4) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:60%}.wp-block-crowdsignal-forms-poll__results-footer{display:flex;flex-direction:column;justify-content:space-between;width:100%;font-size:0.9em}.wp-block-crowdsignal-forms-poll__results-total{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;position:relative;text-align:right;width:100%;margin-bottom:1em}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total{color:transparent}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total::before{animation-name:crowdsignal-forms-animation__pulse;animation-duration:1.5s;animation-iteration-count:infinite;background-color:var(--crowdsignal-forms-text-color);content:"";display:block;position:absolute;right:0;height:1em;width:150px}.wp-block-crowdsignal-forms-poll__footer-branding{display:flex;justify-content:space-between;align-items:center;width:100%}.wp-block-crowdsignal-forms-poll__footer-branding img.wp-block-crowdsignal-forms-poll__footer-branding-logo{width:50px;height:50px;margin-left:0;margin-right:0}.wp-block-crowdsignal-forms-poll__footer-cs-link{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:16px;text-decoration:none;text-transform:uppercase}.wp-block-crowdsignal-forms-poll__footer-cs-link:not(:hover){color:var(--crowdsignal-forms-text-color);opacity:0.4}.wp-block-crowdsignal-forms-poll__error-banner{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-left:4px solid #d82e20;background:#f8dad8}.wp-block-crowdsignal-forms-poll__submit-message-container{position:absolute;background-color:#fff;left:0;top:0;width:100%;height:100%;overflow:hidden}.wp-block-crowdsignal-forms-poll__submit-message{position:relative}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message{position:absolute;right:0;top:0;background-color:transparent;color:#000;text-decoration:none;border:none}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message:hover{background:inherit}.wp-block-crowdsignal-forms-poll__submit-message-footer{position:absolute;bottom:0;left:0;padding:16px 24px;width:100%;background-color:#fff}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker{right:25px;top:66px}.wp-block-crowdsignal-forms-poll__thank-you-sticker{right:132px;top:12px}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker,.wp-block-crowdsignal-forms-poll__thank-you-sticker{filter:drop-shadow(0 1px 2px rgba(0,0,0,0.2));width:100px;height:100px;position:absolute}.wp-block-crowdsignal-forms-poll__custom-message-check{color:var(--crowdsignal-forms-submit-button-bg-color);padding-left:24px;padding-top:24px}.wp-block-crowdsignal-forms-poll__custom-message{font-weight:600;padding:16px 24px}.wp_block-crowdsignal-forms-poll__vote-branding{margin-top:16px}.crowdsignal-forms__style-probe{display:none}
|
1 |
+
@keyframes crowdsignal-forms-animation__pop{0%{transform:scale(0)}50%{transform:scale(1.2)}100%{transform:scale(1)}}@keyframes crowdsignal-forms-animation__pulse{0%{opacity:0.4}50%{opacity:0.7}100%{opacity:0.4}}.crowdsignal-poll-wrapper:not(:first-child),[data-type="crowdsignal-forms/poll"]:not(:first-child){margin-top:3em}.crowdsignal-poll-wrapper:not(:last-child),[data-type="crowdsignal-forms/poll"]:not(:last-child){margin-bottom:3em}.wp-block-crowdsignal-forms-poll{border-color:var(--crowdsignal-forms-border-color);border-style:solid;border-width:var(--crowdsignal-forms-border-width);position:relative;text-align:left}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll{border-left-width:0;border-right-width:0}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question{margin:0 0 28px}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question:first-child{margin-top:0}.wp-block-crowdsignal-forms-poll p.wp-block-crowdsignal-forms-poll__note{font-style:italic;margin:0 0 32px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:40px 24px 16px 24px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__question{font-family:var(--crowdsignal-forms-question-font-family)}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__answer-label,.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__answer-results-answer,.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__note{font-family:var(--crowdsignal-forms-body-font-family)}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{margin:0 auto;max-width:var(--crowdsignal-forms-content-wide-width)}@media screen and (min-width: 660px){.alignwide.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content,.alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:80px}}.wp-block-crowdsignal-forms-poll.is-closed .wp-block-crowdsignal-forms-poll__form{opacity:0.5}.wp-block-crowdsignal-forms-poll.is-hidden{opacity:0.5}.wp-block-crowdsignal-forms-poll.has-text-color{color:var(--crowdsignal-forms-text-color)}.wp-block-crowdsignal-forms-poll.has-bg-color{background-color:var(--crowdsignal-forms-bg-color)}.wp-block-crowdsignal-forms-poll.has-border-radius{border-radius:var(--crowdsignal-forms-border-radius);overflow:hidden}.wp-block-crowdsignal-forms-poll.has-box-shadow{box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23)}.wp-block-crowdsignal-forms-poll .is-transparent{opacity:0;pointer-events:none}.wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button:disabled{opacity:0.7}.wp-block-crowdsignal-forms-poll.has-submit-button-bg-color .wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{background-color:var(--crowdsignal-forms-submit-button-bg-color)}.wp-block-crowdsignal-forms-poll.has-submit-button-text-color .wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{color:var(--crowdsignal-forms-submit-button-text-color)}.wp-block-crowdsignal-forms-poll__answer{cursor:pointer;display:flex;font-size:inherit;font-weight:600;margin:0 0 16px;padding:0 2px;position:relative}.wp-block-crowdsignal-forms-poll__answer:hover,.wp-block-crowdsignal-forms-poll__answer.is-focused{color:var(--crowdsignal-forms-submit-button-bg-color)}.has-voted .wp-block-crowdsignal-forms-poll__answer{opacity:0.5}input[type="checkbox"].wp-block-crowdsignal-forms-poll__input,input[type="radio"].wp-block-crowdsignal-forms-poll__input{height:0;opacity:0;position:absolute;width:0}.wp-block-crowdsignal-forms-poll__check{display:inline-block;height:1em;margin:0 10px 0 0;position:relative;width:1em}.wp-block-crowdsignal-forms-poll__check::before{background-color:transparent;border:1.5px solid var(--crowdsignal-forms-text-color);border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;transition:background-color 0.3s, border-color 0.3s;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::before{border-radius:3px}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice.is-selected .wp-block-crowdsignal-forms-poll__check::before{border-color:var(--crowdsignal-forms-border-color);background-color:var(--crowdsignal-forms-border-color)}.wp-block-crowdsignal-forms-poll__answer.is-selected:not(.is-multiple-choice) .wp-block-crowdsignal-forms-poll__check::after{animation-duration:0.3s;animation-name:crowdsignal-forms-animation__pop;animation-iteration-count:1;background-clip:padding-box;background-color:var(--crowdsignal-forms-border-color);border:4.5px solid transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;position:absolute;left:0;top:0;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-selected.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::after{border-color:var(--crowdsignal-forms-submit-button-text-color);border-style:solid;border-width:0 0 2px 2px;box-sizing:border-box;content:"";display:block;height:25%;margin:-0.1em 0 0 -0.2em;position:absolute;left:50%;top:50%;transform:rotateZ(-45deg);width:50%}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper{flex:1;word-break:break-word}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label{line-height:1;vertical-align:top}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label span::after{vertical-align:top}.wp-block-crowdsignal-forms-poll__button{border:0;padding:0}.wp-block-crowdsignal-forms-poll__actions{display:flex;justify-content:flex-end}.wp-block-crowdsignal-forms-poll__actions .wp-block-button{margin:0}.editor-styles-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__actions .wp-block-button.wp-block-crowdsignal-forms-poll__block-button{margin:0}.wp-block-crowdsignal-forms-poll__closed-banner{background-color:var(--crowdsignal-forms-border-color);box-sizing:border-box;display:flex;color:var(--crowdsignal-forms-submit-button-text-color);font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;justify-content:center;padding:calc(var(--crowdsignal-forms-border-width) + 0.2em) 0 0.2em;width:100%}.is-hidden .wp-block-crowdsignal-forms-poll__closed-banner{font-style:italic}.wp-block-crowdsignal-forms-poll__error{color:red}.wp-block-crowdsignal-forms-poll__results-list{margin:0 0 1em;position:relative}.wp-block-crowdsignal-forms-poll__answer-results{display:flex;flex-direction:column;margin:0 0 16px;width:100%}.wp-block-crowdsignal-forms-poll__answer-results:last-child{margin:0}.wp-block-crowdsignal-forms-poll__answer-results-labels{align-items:flex-end;display:flex;margin:0 0 8px;width:100%;word-break:break-word}.wp-block-crowdsignal-forms-poll__answer-results-answer{flex:1;font-size:1em;font-weight:600}.wp-block-crowdsignal-forms-poll__answer-results-votes{font-size:0.75em;line-height:2}.wp-block-crowdsignal-forms-poll__answer-results-percent{font-weight:600;line-height:1.6}.wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results-percent{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;margin-left:20px;transition:opacity 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-percent{display:none}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse;background-color:var(--crowdsignal-forms-text-color);font-size:0.7em;height:1em;width:50px}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes:last-child,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent:last-child{width:40px}.wp-block-crowdsignal-forms-poll__answer-results-progress-track{border:1px solid;border-color:rgba(var(--crowdsignal-forms-text-color-properties), 0.3);box-sizing:border-box;height:1em;width:100%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-track{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse}.wp-block-crowdsignal-forms-poll__answer-results-progress-bar{animation-fill-mode:forwards;background-color:var(--crowdsignal-forms-submit-button-bg-color);height:100%;transition:background-color 0.3s, width 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:0}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{background-color:var(--crowdsignal-forms-text-color);width:25%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+1) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:40%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+2) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:75%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+3) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:50%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+4) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:60%}.wp-block-crowdsignal-forms-poll__results-footer{display:flex;flex-direction:column;justify-content:space-between;width:100%;font-size:0.9em}.wp-block-crowdsignal-forms-poll__results-total{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;position:relative;text-align:right;width:100%;margin-bottom:1em}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total{color:transparent}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total::before{animation-name:crowdsignal-forms-animation__pulse;animation-duration:1.5s;animation-iteration-count:infinite;background-color:var(--crowdsignal-forms-text-color);content:"";display:block;position:absolute;right:0;height:1em;width:150px}.wp-block-crowdsignal-forms-poll__footer-branding{display:flex;justify-content:space-between;align-items:center;width:100%}.wp-block-crowdsignal-forms-poll__footer-branding img.wp-block-crowdsignal-forms-poll__footer-branding-logo{width:50px;height:50px;margin-left:0;margin-right:0}.wp-block-crowdsignal-forms-poll__footer-cs-link{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:16px;text-decoration:none;text-transform:uppercase}.wp-block-crowdsignal-forms-poll__footer-cs-link:not(:hover){color:var(--crowdsignal-forms-text-color);opacity:0.4}.has-default-thankyou .wp-block-crowdsignal-forms-poll__footer-cs-link{color:#333}.wp-block-crowdsignal-forms-poll__error-banner{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-left:4px solid #d82e20;background:#f8dad8}.wp-block-crowdsignal-forms-poll__submit-message-container{position:absolute;background-color:var(--crowdsignal-forms-bg-color);left:0;top:0;width:100%;height:100%;overflow:hidden}.has-default-thankyou .wp-block-crowdsignal-forms-poll__submit-message-container{background-color:#fff}.wp-block-crowdsignal-forms-poll__submit-message{position:relative}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message{position:absolute;right:0;top:0;background-color:transparent;color:#000;text-decoration:none;border:none}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message:hover{background:inherit}.wp-block-crowdsignal-forms-poll__submit-message-footer{position:absolute;bottom:0;left:0;padding:16px 24px;width:100%;background-color:inherit}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker{right:25px;top:66px}.wp-block-crowdsignal-forms-poll__thank-you-sticker{right:132px;top:12px}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker,.wp-block-crowdsignal-forms-poll__thank-you-sticker{filter:drop-shadow(0 1px 2px rgba(0,0,0,0.2));width:100px;height:100px;position:absolute}.wp-block-crowdsignal-forms-poll__custom-message-check{color:var(--crowdsignal-forms-text-color);padding-left:24px;padding-top:24px}.wp-block-crowdsignal-forms-poll__custom-message{font-family:var(--crowdsignal-forms-question-font-family);font-weight:600;padding:16px 24px}.wp_block-crowdsignal-forms-poll__vote-branding{margin-top:16px}.crowdsignal-forms__style-probe{display:none}
|
build/poll.js
CHANGED
@@ -90,11 +90,11 @@
|
|
90 |
/*!*****************************************!*\
|
91 |
!*** ./client/blocks/poll/constants.js ***!
|
92 |
\*****************************************/
|
93 |
-
/*! exports provided: ConfirmMessageType, FontFamilyType, FontFamilyMap, PollStatus, ClosedPollState */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
96 |
"use strict";
|
97 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConfirmMessageType\", function() { return ConfirmMessageType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyType\", function() { return FontFamilyType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyMap\", function() { return FontFamilyMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStatus\", function() { return PollStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClosedPollState\", function() { return ClosedPollState; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar _Object$freeze;\n\nvar ConfirmMessageType = Object.freeze({\n THANK_YOU: 'thank-you',\n CUSTOM_TEXT: 'custom-text',\n REDIRECT: 'redirect',\n RESULTS: 'results'\n});\nvar FontFamilyType = Object.freeze({\n THEME_DEFAULT: 'theme-default',\n GEORGIA: 'georgia',\n PALATINO: 'palatino',\n TIMES_NEW_ROMAN: 'times-new-roman',\n ARIAL: 'arial',\n IMPACT: 'impact',\n LUCIDA: 'lucida',\n TAHOMA: 'tahoma',\n TREBUCHET: 'trebuchet',\n VERDANA: 'verdana',\n COURIER: 'courier'\n});\nvar FontFamilyMap = Object.freeze((_Object$freeze = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.THEME_DEFAULT, null), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.GEORGIA, 'Georgia, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.PALATINO, '\"Palatino Linotype\", \"Book Antiqua\", Palatino, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TIMES_NEW_ROMAN, '\"Times New Roman\", Times, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.ARIAL, 'Arial, Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.IMPACT, 'Impact, Charcoal, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.LUCIDA, '\"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TAHOMA, 'Tahoma, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TREBUCHET, '\"Trebuchet MS\", Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.VERDANA, 'Verdana, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.COURIER, '\"Courier New\", Courier, monospace'), _Object$freeze));\nvar PollStatus = Object.freeze({\n OPEN: 'open',\n CLOSED: 'closed',\n CLOSED_AFTER: 'closed-after'\n});\nvar ClosedPollState = Object.freeze({\n SHOW_RESULTS: 'show-results',\n SHOW_CLOSED_BANNER: 'show-closed-banner',\n HIDDEN: 'hidden'\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/constants.js?");
|
98 |
|
99 |
/***/ }),
|
100 |
|
@@ -106,7 +106,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
106 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
107 |
|
108 |
"use strict";
|
109 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addAnswer\", function() { return addAnswer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getFontFamilyFromType\", function() { return getFontFamilyFromType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getStyleVars\", function() { return getStyleVars; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractRGBColorProperties\", function() { return extractRGBColorProperties; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hexToRGB\", function() { return hexToRGB; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBlockCssClasses\", function() { return getBlockCssClasses; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isPollClosed\", function() { return isPollClosed; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pollIdExistsInPageContent\", function() { return pollIdExistsInPageContent; });\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ \"./node_modules/@babel/runtime/helpers/toConsumableArray.js\");\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Creates a new Answer object then returns a copy of the passed in `answers` array with the new answer appended to it.\n *\n * @param {Array} answers The existing array of answers.\n * @param {string} text\tThe text for the new answer to add.\n * @return {Array}\t\t\tThe newly created answers array.\n */\n\nvar addAnswer = function addAnswer(answers, text) {\n return [].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(answers), [{\n answerId: null,\n text: text\n }]);\n};\nvar getFontFamilyFromType = function getFontFamilyFromType(type) {\n if (!Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_3__[\"FontFamilyType\"], type)) {\n return null;\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_3__[\"FontFamilyMap\"][type];\n};\nvar getStyleVars = function getStyleVars(attributes,
|
110 |
|
111 |
/***/ }),
|
112 |
|
@@ -178,7 +178,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
178 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
179 |
|
180 |
"use strict";
|
181 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var
|
182 |
|
183 |
/***/ }),
|
184 |
|
@@ -214,7 +214,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
214 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
215 |
|
216 |
"use strict";
|
217 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! seedrandom */ \"./node_modules/seedrandom/index.js\");\n/* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(seedrandom__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var blocks_poll_util__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! blocks/poll/util */ \"./client/blocks/poll/util.js\");\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! components/with-fallback-styles */ \"./client/components/with-fallback-styles/index.js\");\n/* harmony import */ var _closed_banner__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./closed-banner */ \"./client/components/poll/closed-banner.js\");\n/* harmony import */ var _results__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./results */ \"./client/components/poll/results.js\");\n/* harmony import */ var _vote__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./vote */ \"./client/components/poll/vote.js\");\n/* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./styles */ \"./client/components/poll/styles.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./util */ \"./client/components/poll/util.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var data_hooks__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! data/hooks */ \"./client/data/hooks/index.js\");\n/* harmony import */ var data_poll__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! data/poll */ \"./client/data/poll/index.js\");\n/* harmony import */ var _error_banner__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./error-banner */ \"./client/components/poll/error-banner.js\");\n/* harmony import */ var _submit_message__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./submit-message */ \"./client/components/poll/submit-message.js\");\n\n\n\n\n\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * WordPress dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar Poll = function Poll(_ref) {\n var attributes = _ref.attributes,\n fallbackStyles = _ref.fallbackStyles,\n renderStyleProbe = _ref.renderStyleProbe;\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_6__[\"useState\"])(Math.random()),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default()(_useState, 1),\n randomAnswerSeed = _useState2[0];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_6__[\"useState\"])(''),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default()(_useState3, 2),\n errorMessage = _useState4[0],\n setErrorMessage = _useState4[1];\n\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_6__[\"useState\"])(false),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default()(_useState5, 2),\n dismissSubmitMessage = _useState6[0],\n setDismissSubmitMessage = _useState6[1];\n\n var apiPollData = attributes.apiPollData;\n var pollIdFromApi = apiPollData.id;\n\n var _usePollVote = Object(data_hooks__WEBPACK_IMPORTED_MODULE_19__[\"usePollVote\"])(pollIdFromApi, attributes.hasOneResponsePerComputer),\n hasVoted = _usePollVote.hasVoted,\n isVoting = _usePollVote.isVoting,\n vote = _usePollVote.vote;\n\n var handleSubmit = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee(selectedAnswerIds) {\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n setErrorMessage('');\n setDismissSubmitMessage(false);\n _context.next = 5;\n return vote(selectedAnswerIds);\n\n case 5:\n if (blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__[\"ConfirmMessageType\"].REDIRECT === attributes.confirmMessageType) {\n window.open(attributes.redirectAddress);\n }\n\n _context.next = 11;\n break;\n\n case 8:\n _context.prev = 8;\n _context.t0 = _context[\"catch\"](0);\n\n if (_context.t0 instanceof data_poll__WEBPACK_IMPORTED_MODULE_20__[\"CrowdsignalFormsError\"]) {\n setErrorMessage(_context.t0.message);\n } else {\n setErrorMessage(Object(lib_i18n__WEBPACK_IMPORTED_MODULE_18__[\"__\"])('Server error. Please try again.'));\n }\n\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[0, 8]]);\n }));\n\n return function handleSubmit(_x) {\n return _ref2.apply(this, arguments);\n };\n }();\n\n var isClosed = Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_10__[\"isPollClosed\"])(attributes.pollStatus, attributes.closedAfterDateTime);\n\n if (isClosed && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__[\"ClosedPollState\"].HIDDEN === attributes.closedPollState) {\n return null;\n }\n\n var showResults = isClosed && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__[\"ClosedPollState\"].SHOW_RESULTS === attributes.closedPollState || hasVoted && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__[\"ConfirmMessageType\"].RESULTS === attributes.confirmMessageType;\n var showSubmitMessage = hasVoted && !showResults && !dismissSubmitMessage && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__[\"ConfirmMessageType\"].REDIRECT !== attributes.confirmMessageType;\n var classes = Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_10__[\"getBlockCssClasses\"])(attributes, attributes.className, 'wp-block-crowdsignal-forms-poll', {\n 'has-voted': hasVoted,\n 'is-closed': isClosed,\n 'is-voting': isVoting\n });\n var answerClientIdMap = Object(lodash__WEBPACK_IMPORTED_MODULE_8__[\"reduce\"])(apiPollData.answers, function (accum, answer) {\n accum[answer.client_id] = answer.id;\n return accum;\n }, {});\n var answersWithIds = Object(lodash__WEBPACK_IMPORTED_MODULE_8__[\"map\"])(attributes.answers, function (answerWithoutIdFromApi) {\n var answerIdFromApi = answerClientIdMap[answerWithoutIdFromApi.answerId];\n return _objectSpread({}, answerWithoutIdFromApi, {\n answerIdFromApi: answerIdFromApi\n });\n });\n var answers = Object(_util__WEBPACK_IMPORTED_MODULE_17__[\"shuffleWithGenerator\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_8__[\"filter\"])(answersWithIds, function (answer) {\n return !!answer.text;\n }), attributes.randomizeAnswers ? new seedrandom__WEBPACK_IMPORTED_MODULE_7___default.a(randomAnswerSeed) : function () {\n return 1;\n });\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"div\", {\n className: classes,\n style: Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_10__[\"getStyleVars\"])(attributes, fallbackStyles)\n }, errorMessage && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_error_banner__WEBPACK_IMPORTED_MODULE_21__[\"default\"], null, errorMessage), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__content\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"h3\", {\n className: \"wp-block-crowdsignal-forms-poll__question\"\n }, Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9__[\"decodeEntities\"])(attributes.question)), attributes.note && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"p\", {\n className: \"wp-block-crowdsignal-forms-poll__note\"\n }, Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9__[\"decodeEntities\"])(attributes.note)), !showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_vote__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n answers: answers,\n isMultipleChoice: attributes.isMultipleChoice,\n onSubmit: handleSubmit,\n submitButtonLabel: attributes.submitButtonLabel,\n hasVoted: hasVoted,\n isVoting: isVoting,\n hideBranding: attributes.hideBranding\n }), showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_results__WEBPACK_IMPORTED_MODULE_14__[\"default\"], {\n pollIdFromApi: pollIdFromApi,\n answers: answers,\n setErrorMessage: setErrorMessage,\n hideBranding: attributes.hideBranding\n })), showSubmitMessage && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_submit_message__WEBPACK_IMPORTED_MODULE_22__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, attributes, {\n setDismissSubmitMessage: setDismissSubmitMessage\n })), (isClosed || hasVoted) && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_closed_banner__WEBPACK_IMPORTED_MODULE_13__[\"default\"], {\n isPollClosed: isClosed,\n hasVoted: hasVoted\n }), renderStyleProbe());\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_12__[\"withFallbackStyles\"])(_styles__WEBPACK_IMPORTED_MODULE_16__[\"PollStyles\"], _styles__WEBPACK_IMPORTED_MODULE_16__[\"getPollStyles\"])(Poll));\n\n//# sourceURL=webpack:///./client/components/poll/index.js?");
|
218 |
|
219 |
/***/ }),
|
220 |
|
@@ -238,7 +238,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
238 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
239 |
|
240 |
"use strict";
|
241 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getPollStyles\", function() { return getPollStyles; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStyles\", function() { return PollStyles; });\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! components/with-fallback-styles/util */ \"./client/components/with-fallback-styles/util.js\");\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\nvar getPollStyles = function getPollStyles(node) {\n if (null === node) {\n return {};\n }\n\n var buttonNode = node.querySelector('.wp-block-button__link');\n var textNode = node.querySelector('p');\n var wideContentNode = node.querySelector('.alignwide');\n return {\n accent: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(buttonNode),\n surface: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(textNode),\n text: window.getComputedStyle(textNode).color,\n textInverted: window.getComputedStyle(buttonNode).color,\n contentWideWidth: window.getComputedStyle(wideContentNode).maxWidth\n };\n};\nvar PollStyles = function PollStyles() {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button__link\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"entry-content\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"alignwide\"\n })));\n};\n\n//# sourceURL=webpack:///./client/components/poll/styles.js?");
|
242 |
|
243 |
/***/ }),
|
244 |
|
@@ -250,7 +250,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
250 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
251 |
|
252 |
"use strict";
|
253 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var components_icon_close__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! components/icon/close */ \"./client/components/icon/close.js\");\n/* harmony import */ var components_icon_check_circle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! components/icon/check-circle */ \"./client/components/icon/check-circle.js\");\n/* harmony import */ var components_icon_thank_you__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! components/icon/thank-you */ \"./client/components/icon/thank-you.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./footer-branding */ \"./client/components/poll/footer-branding.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\n\nvar toggleAnimationPlayPause = function toggleAnimationPlayPause(event) {\n var player = event.target;\n\n if (!player) {\n return;\n }\n\n if (player.paused) {\n player.play();\n } else {\n player.pause();\n }\n};\n\nvar SubmitMessage = function SubmitMessage(_ref) {\n var confirmMessageType = _ref.confirmMessageType,\n customConfirmMessage = _ref.customConfirmMessage,\n setDismissSubmitMessage = _ref.setDismissSubmitMessage,\n hideBranding = _ref.hideBranding;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__submit-message-container\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__submit-message\"\n }, blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"ConfirmMessageType\"].THANK_YOU === confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"video\", {\n muted: true,\n autoPlay: true,\n loop: true,\n playsInline: true,\n poster: \"https://crowdsignal.files.wordpress.com/2020/02/thumbs-up-video-placeholder.jpg\",\n width: \"100%\",\n onClick: toggleAnimationPlayPause\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"source\", {\n src: \"https://crowdsignal.files.wordpress.com/2019/08/thumbs-up-cs.mp4\",\n type: \"video/mp4\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_thank_you__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n className: \"wp-block-crowdsignal-forms-poll__thank-you-sticker\"\n }), !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"img\", {\n className: \"wp-block-crowdsignal-forms-poll__thank-you-cs-sticker\",\n src: \"https://app.crowdsignal.com/images/svg/cs-logo-dots.svg\",\n alt: \"Crowdsignal sticker\"\n })), blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"ConfirmMessageType\"].CUSTOM_TEXT === confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__custom-message-check\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_check_circle__WEBPACK_IMPORTED_MODULE_4__[\"default\"], null)), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__custom-message\"\n }, Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(customConfirmMessage) ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('
|
254 |
|
255 |
/***/ }),
|
256 |
|
@@ -258,11 +258,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
258 |
/*!****************************************!*\
|
259 |
!*** ./client/components/poll/util.js ***!
|
260 |
\****************************************/
|
261 |
-
/*! exports provided: addApiAnswerIds, shuffleWithGenerator, isAnswerEmpty */
|
262 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
263 |
|
264 |
"use strict";
|
265 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addApiAnswerIds\", function() { return addApiAnswerIds; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shuffleWithGenerator\", function() { return shuffleWithGenerator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAnswerEmpty\", function() { return isAnswerEmpty; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n/**\n * Adds api answer ids to the answer objects (when they are available).\n *\n * @param {Array} answers Answers array\n * @param {Array} answerIdMap A json object with client answer ids as keys, and API answer ids as values.\n * @return {Array} Updated answers array\n */\n\nvar addApiAnswerIds = function addApiAnswerIds(answers, answerIdMap) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"map\"])(answers, function (answer) {\n if (typeof answer.answerIdFromApi !== 'undefined') {\n return answer;\n }\n\n return _objectSpread({}, answer, {\n answerIdFromApi: answerIdMap[answer.answerId]\n });\n });\n};\n/**\n * Fisher-Yates algorithm shuffle implementation.\n * Provides a predictable way of shuffling array items given a seed.\n *\n * @param {Array} toShuffle The array to shuffle.\n * @param {Function} randomNumberGenerator A function that generates a random number (like `seedrandom`).\n * @return {Array} The shuffled array.\n */\n\nvar shuffleWithGenerator = function shuffleWithGenerator(toShuffle, randomNumberGenerator) {\n var shuffled = toShuffle.slice();\n\n for (var i = shuffled.length - 1; i > 0; i--) {\n var j = Math.floor(randomNumberGenerator() * i);\n var tmp = shuffled[i];\n shuffled[i] = shuffled[j];\n shuffled[j] = tmp;\n }\n\n return shuffled;\n};\n/**\n * Determines if an answer is considered \"empty\", based on if text is set and blank or object has no values.\n *\n * @param {*} answer The answer object.\n */\n\nvar isAnswerEmpty = function isAnswerEmpty(answer) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(answer) || 'undefined' === typeof answer.text || null === answer.text || '' === answer.text;\n};\n\n//# sourceURL=webpack:///./client/components/poll/util.js?");
|
266 |
|
267 |
/***/ }),
|
268 |
|
@@ -274,7 +274,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
274 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
275 |
|
276 |
"use strict";
|
277 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ \"./node_modules/@babel/runtime/helpers/toConsumableArray.js\");\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _answer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./answer */ \"./client/components/poll/answer.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./footer-branding */ \"./client/components/poll/footer-branding.js\");\n\n\n\n\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\nvar PollVote = function PollVote(_ref) {\n var answers = _ref.answers,\n hasVoted = _ref.hasVoted,\n isMultipleChoice = _ref.isMultipleChoice,\n isVoting = _ref.isVoting,\n onSubmit = _ref.onSubmit,\n submitButtonLabel = _ref.submitButtonLabel,\n hideBranding = _ref.hideBranding;\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])([]),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),\n selected = _useState2[0],\n setSelected = _useState2[1];\n\n var handleSelect = function handleSelect(answerId) {\n if (!isMultipleChoice) {\n return setSelected([answerId]);\n }\n\n if (Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"includes\"])(selected, answerId)) {\n return setSelected(Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"without\"])(selected, answerId));\n }\n\n setSelected([].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1___default()(selected), [answerId]));\n };\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])([]),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2),\n focused = _useState4[0],\n setFocused = _useState4[1];\n\n var handleFocus = function handleFocus(answerId) {\n return setFocused([answerId]);\n };\n\n var handleSubmit = function handleSubmit(event) {\n event.preventDefault();\n onSubmit(selected);\n };\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"form\", {\n className: \"wp-block-crowdsignal-forms-poll__form\",\n onSubmit: handleSubmit\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__options\"\n }, Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"map\"])(answers, function (answer, index) {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_answer__WEBPACK_IMPORTED_MODULE_7__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({\n key: \"poll-answer-\".concat(index),\n isMultipleChoice: isMultipleChoice,\n isSelected: Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"includes\"])(selected, answer.answerIdFromApi),\n isFocused: Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"includes\"])(focused, answer.answerIdFromApi),\n onSelect: handleSelect,\n onFocus: handleFocus,\n hasVoted: hasVoted,\n isVoting: isVoting\n }, answer));\n })), !hasVoted && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__actions\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"input\", {\n type: \"submit\",\n className: \"wp-block-button__link wp-block-crowdsignal-forms-poll__submit-button\",\n disabled: isVoting || !selected.length,\n value: submitButtonLabel\n }))), !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp_block-crowdsignal-forms-poll__vote-branding\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_footer_branding__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n showLogo: false\n })));\n};\n\nPollVote.propTypes = {\n answers: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.array.isRequired,\n isMultipleChoice: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.bool,\n onSubmit: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.func.isRequired,\n submitButtonLabel: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.string.isRequired\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (PollVote);\n\n//# sourceURL=webpack:///./client/components/poll/vote.js?");
|
278 |
|
279 |
/***/ }),
|
280 |
|
@@ -310,7 +310,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
310 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
311 |
|
312 |
"use strict";
|
313 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollResults\", function() { return usePollResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollVote\", function() { return usePollVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useIsCsConnected\", function() { return useIsCsConnected; });\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! js-cookie */ \"./node_modules/js-cookie/src/js.cookie.js\");\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(js_cookie__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var data_poll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! data/poll */ \"./client/data/poll/index.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util */ \"./client/data/hooks/util.js\");\n\n\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar usePollResults = function usePollResults(pollId) {\n var _useFetch = Object(_util__WEBPACK_IMPORTED_MODULE_6__[\"useFetch\"])(function () {\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestResults\"])(pollId);\n }, [pollId]),\n data = _useFetch.data,\n error = _useFetch.error,\n loading = _useFetch.loading;\n\n return {\n error: error,\n loading: loading,\n results: data\n };\n};\n/**\n * React Hook that returns state variables for voting status and a function to perform a vote.\n *\n * @param {number} pollId ID of the poll being loaded.\n * @param {boolean} enableVoteRestriction sets whether or not the vote cookie is read and set\n */\n\nvar usePollVote = function usePollVote(pollId) {\n var enableVoteRestriction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var cookieName = \"cs-poll-\".concat(pollId);\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),\n isVoting = _useState2[0],\n setIsVoting = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2),\n hasVoted = _useState4[0],\n setHasVoted = _useState4[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useEffect\"])(function () {\n if (enableVoteRestriction && undefined !== js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.get(cookieName)) {\n setHasVoted(true);\n }\n }, []);\n\n var vote = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(selectedAnswerIds) {\n var nonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n setIsVoting(true);\n _context.next = 4;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVoteNonce\"])(pollId);\n\n case 4:\n nonce = _context.sent;\n _context.next = 7;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVote\"])(nonce, pollId, selectedAnswerIds);\n\n case 7:\n setHasVoted(true);\n\n if (enableVoteRestriction) {\n js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.set(cookieName, new Date().getTime(), {\n sameSite: 'Strict',\n expires: 365\n });\n }\n\n case 9:\n _context.prev = 9;\n setIsVoting(false);\n return _context.finish(9);\n\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[0,, 9, 12]]);\n }));\n\n return function vote(_x) {\n return _ref.apply(this, arguments);\n };\n }();\n\n return {\n hasVoted: hasVoted,\n isVoting: isVoting,\n vote: vote\n };\n};\nvar useIsCsConnected = function useIsCsConnected() {\n /* assume connection is enabled, so placeholder doesn't flash while we add a block and wait for the request */\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(true),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState5, 2),\n isConnected = _useState6[0],\n setIsConnected = _useState6[1];\n\n var checkIsConnected = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() {\n var
|
314 |
|
315 |
/***/ }),
|
316 |
|
@@ -334,7 +334,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
334 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
335 |
|
336 |
"use strict";
|
337 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestResults\", function() { return requestResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVoteNonce\", function() { return requestVoteNonce; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVote\", function() { return requestVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsError\", function() { return CrowdsignalFormsError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsServerError\", function() { return CrowdsignalFormsServerError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestIsCsConnected\", function() { return requestIsCsConnected; });\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\");\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/inherits.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ \"./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js\");\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ \"./node_modules/@babel/runtime/helpers/wrapNativeSuper.js\");\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/api-fetch */ \"@wordpress/api-fetch\");\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n\n\n\n\n\n\nfunction _createSuper(Derived) { return function () { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Fetch the poll results for the given pollId\n *\n * @param {number} pollId Poll ID.\n * @return {Promise} Promise that resolves to a key-value object with answer IDs and vote counts.\n */\n\nvar requestResults = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee(pollId) {\n var baseUrl;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n baseUrl = 'https://api.crowdsignal.com/v3/polls';\n return _context.abrupt(\"return\", window.fetch(\"\".concat(baseUrl, \"/\").concat(pollId, \"/results\"), {\n method: 'GET',\n headers: {\n 'content-type': 'application/json'\n }\n }).then(function (response) {\n if (response.status >= 200 && response.status < 300) {\n return response.json();\n }\n\n throw response;\n }).then(function (response) {\n if (404 === response.status) {\n // poll doesn't exist on the platform yet, return an empty result\n return {};\n } else if (response.error) {\n throw new Error(response.message);\n }\n\n return response.results.votes_by_answer;\n }));\n\n case 2:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function requestResults(_x) {\n return _ref.apply(this, arguments);\n };\n}();\nvar requestVoteNonce = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee2(pollId) {\n var hash, timestamp, respNonce, jsonNonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n hash = '5430eeac3911395001d731d9702fc38b'; // hash not used when format=json is passed\n\n timestamp = new Date().getTime();\n _context2.next = 4;\n return window.fetch(\"https://polldaddy.com/n/\".concat(hash, \"/\").concat(pollId, \"?\").concat(timestamp, \"&format=json\"));\n\n case 4:\n respNonce = _context2.sent;\n\n if (respNonce.ok) {\n _context2.next = 7;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 7:\n _context2.next = 9;\n return respNonce.json();\n\n case 9:\n jsonNonce = _context2.sent;\n\n if (jsonNonce.nonce) {\n _context2.next = 12;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 12:\n return _context2.abrupt(\"return\", jsonNonce.nonce);\n\n case 13:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function requestVoteNonce(_x2) {\n return _ref2.apply(this, arguments);\n };\n}();\nvar requestVote = /*#__PURE__*/function () {\n var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee3(nonce, pollId, selectedAnswerIds) {\n var answerString, respVote, jsonVote;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n answerString = selectedAnswerIds.join(',');\n _context3.next = 3;\n return window.fetch(\"https://polls.polldaddy.com/vote-js.php?format=json&p=\".concat(pollId, \"&b=1&a=\").concat(answerString, \"&o=&va=16&cookie=0&n=\").concat(nonce, \"&url=\").concat(encodeURIComponent(window.location)));\n\n case 3:\n respVote = _context3.sent;\n\n if (respVote.ok) {\n _context3.next = 6;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 6:\n _context3.next = 8;\n return respVote.json();\n\n case 8:\n jsonVote = _context3.sent;\n\n if (!('error' === jsonVote.status)) {\n _context3.next = 11;\n break;\n }\n\n throw new CrowdsignalFormsError(jsonVote.error);\n\n case 11:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n return function requestVote(_x3, _x4, _x5) {\n return _ref3.apply(this, arguments);\n };\n}();\nvar CrowdsignalFormsError = /*#__PURE__*/function (_Error) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsError, _Error);\n\n var _super = _createSuper(CrowdsignalFormsError);\n\n function CrowdsignalFormsError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsError);\n\n return _super.apply(this, arguments);\n }\n\n return CrowdsignalFormsError;\n}( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default()(Error));\nvar CrowdsignalFormsServerError = /*#__PURE__*/function (_CrowdsignalFormsErro) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsServerError, _CrowdsignalFormsErro);\n\n var _super2 = _createSuper(CrowdsignalFormsServerError);\n\n function CrowdsignalFormsServerError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsServerError);\n\n return _super2.call(this, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Server error. Please try again.'));\n }\n\n return CrowdsignalFormsServerError;\n}(CrowdsignalFormsError);\nvar requestIsCsConnected = /*#__PURE__*/function () {\n var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee4() {\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default()({\n path: \"/crowdsignal-forms/v1/account/connected\",\n method: 'GET'\n });\n\n case 2:\n return _context4.abrupt(\"return\", _context4.sent);\n\n case 3:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n\n return function requestIsCsConnected() {\n return _ref4.apply(this, arguments);\n };\n}();\n\n//# sourceURL=webpack:///./client/data/poll/index.js?");
|
338 |
|
339 |
/***/ }),
|
340 |
|
90 |
/*!*****************************************!*\
|
91 |
!*** ./client/blocks/poll/constants.js ***!
|
92 |
\*****************************************/
|
93 |
+
/*! exports provided: ConfirmMessageType, FontFamilyType, GoogleFonts, FontFamilyMap, PollStatus, ClosedPollState, ConnectedAccountState */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
96 |
"use strict";
|
97 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConfirmMessageType\", function() { return ConfirmMessageType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyType\", function() { return FontFamilyType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GoogleFonts\", function() { return GoogleFonts; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyMap\", function() { return FontFamilyMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStatus\", function() { return PollStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClosedPollState\", function() { return ClosedPollState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConnectedAccountState\", function() { return ConnectedAccountState; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar _Object$freeze;\n\nvar ConfirmMessageType = Object.freeze({\n THANK_YOU: 'thank-you',\n CUSTOM_TEXT: 'custom-text',\n REDIRECT: 'redirect',\n RESULTS: 'results'\n});\nvar FontFamilyType = Object.freeze({\n THEME_DEFAULT: 'theme-default',\n GEORGIA: 'georgia',\n PALATINO: 'palatino',\n TIMES_NEW_ROMAN: 'times-new-roman',\n ARIAL: 'arial',\n IMPACT: 'impact',\n LUCIDA: 'lucida',\n TAHOMA: 'tahoma',\n TREBUCHET: 'trebuchet',\n VERDANA: 'verdana',\n COURIER: 'courier',\n // Google fonts: enum value = google font url slug\n CABIN: 'Cabin',\n CHIVO: 'Chivo',\n OPEN_SANS: 'Open+Sans',\n FIRA_SANS: 'Fira+Sans',\n ROBOTO: 'Roboto',\n NUNITO: 'Nunito',\n OVERPASS: 'Overpass',\n LATO: 'Lato',\n LIBRE_FRANKLIN: 'Libre+Franklin',\n MONTSERRAT: 'Montserrat',\n POPPINS: 'Poppins',\n RUBIK: 'Rubik',\n RALEWAY: 'Raleway',\n JOSEFIN_SANS: 'Josefin+Sans',\n ALEGREYA_SANS: 'Alegreya+Sans',\n OSWALD: 'Oswald'\n});\nvar GoogleFonts = Object.freeze([FontFamilyType.CABIN, FontFamilyType.CHIVO, FontFamilyType.OPEN_SANS, FontFamilyType.FIRA_SANS, FontFamilyType.ROBOTO, FontFamilyType.NUNITO, FontFamilyType.OVERPASS, FontFamilyType.LATO, FontFamilyType.LIBRE_FRANKLIN, FontFamilyType.MONTSERRAT, FontFamilyType.POPPINS, FontFamilyType.RUBIK, FontFamilyType.RALEWAY, FontFamilyType.JOSEFIN_SANS, FontFamilyType.ALEGREYA_SANS, FontFamilyType.OSWALD]);\nvar FontFamilyMap = Object.freeze((_Object$freeze = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.THEME_DEFAULT, null), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.GEORGIA, 'Georgia, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.PALATINO, '\"Palatino Linotype\", \"Book Antiqua\", Palatino, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TIMES_NEW_ROMAN, '\"Times New Roman\", Times, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.ARIAL, 'Arial, Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.IMPACT, 'Impact, Charcoal, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.LUCIDA, '\"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TAHOMA, 'Tahoma, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TREBUCHET, '\"Trebuchet MS\", Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.VERDANA, 'Verdana, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.COURIER, '\"Courier New\", Courier, monospace'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.CABIN, '\"Cabin\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.CHIVO, '\"Chivo\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.OPEN_SANS, '\"Open Sans\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.FIRA_SANS, '\"Fira Sans\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.ROBOTO, '\"Roboto\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.NUNITO, '\"Nunito\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.OVERPASS, '\"Overpass\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.LATO, '\"Lato\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.LIBRE_FRANKLIN, '\"Libre Franklin\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.MONTSERRAT, '\"Montserrat\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.POPPINS, '\"Poppins\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.RUBIK, '\"Rubik\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.RALEWAY, '\"Raleway\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.JOSEFIN_SANS, '\"Josefin Sans\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.ALEGREYA_SANS, '\"Alegreya Sans\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.OSWALD, '\"Oswald\", sans-serif'), _Object$freeze));\nvar PollStatus = Object.freeze({\n OPEN: 'open',\n CLOSED: 'closed',\n CLOSED_AFTER: 'closed-after'\n});\nvar ClosedPollState = Object.freeze({\n SHOW_RESULTS: 'show-results',\n SHOW_CLOSED_BANNER: 'show-closed-banner',\n HIDDEN: 'hidden'\n});\nvar ConnectedAccountState = Object.freeze({\n CONNECTED: 'connected',\n NOT_CONNECTED: 'not-connected',\n NOT_VERIFIED: 'not-verified'\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/constants.js?");
|
98 |
|
99 |
/***/ }),
|
100 |
|
106 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
107 |
|
108 |
"use strict";
|
109 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addAnswer\", function() { return addAnswer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getFontFamilyFromType\", function() { return getFontFamilyFromType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getStyleVars\", function() { return getStyleVars; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractRGBColorProperties\", function() { return extractRGBColorProperties; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hexToRGB\", function() { return hexToRGB; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBlockCssClasses\", function() { return getBlockCssClasses; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isPollClosed\", function() { return isPollClosed; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pollIdExistsInPageContent\", function() { return pollIdExistsInPageContent; });\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ \"./node_modules/@babel/runtime/helpers/toConsumableArray.js\");\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Creates a new Answer object then returns a copy of the passed in `answers` array with the new answer appended to it.\n *\n * @param {Array} answers The existing array of answers.\n * @param {string} text\tThe text for the new answer to add.\n * @return {Array}\t\t\tThe newly created answers array.\n */\n\nvar addAnswer = function addAnswer(answers, text) {\n return [].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(answers), [{\n answerId: null,\n text: text\n }]);\n};\nvar getFontFamilyFromType = function getFontFamilyFromType(type) {\n if (!Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_3__[\"FontFamilyType\"], type)) {\n return null;\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_3__[\"FontFamilyMap\"][type];\n};\nvar getStyleVars = function getStyleVars(attributes, fallbackStyles) {\n var _attributes$borderCol, _getFontFamilyFromTyp, _getFontFamilyFromTyp2, _extractRGBColorPrope;\n\n var textColor = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isEmpty\"])(attributes.textColor) ? fallbackStyles.text : attributes.textColor;\n return Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"mapKeys\"])({\n borderColor: (_attributes$borderCol = attributes.borderColor) !== null && _attributes$borderCol !== void 0 ? _attributes$borderCol : fallbackStyles.accent,\n borderRadius: \"\".concat(attributes.borderRadius, \"px\"),\n borderWidth: \"\".concat(attributes.borderWidth, \"px\"),\n bgColor: attributes.backgroundColor,\n bodyFontFamily: (_getFontFamilyFromTyp = getFontFamilyFromType(attributes.fontFamily)) !== null && _getFontFamilyFromTyp !== void 0 ? _getFontFamilyFromTyp : fallbackStyles.bodyFontFamily,\n questionFontFamily: (_getFontFamilyFromTyp2 = getFontFamilyFromType(attributes.fontFamily)) !== null && _getFontFamilyFromTyp2 !== void 0 ? _getFontFamilyFromTyp2 : fallbackStyles.questionFontFamily,\n submitButtonBgColor: attributes.submitButtonBackgroundColor || fallbackStyles.accent,\n submitButtonTextColor: attributes.submitButtonTextColor || fallbackStyles.textInverted,\n textColor: textColor,\n textColorProperties: (_extractRGBColorPrope = extractRGBColorProperties(textColor)) !== null && _extractRGBColorPrope !== void 0 ? _extractRGBColorPrope : '0, 0, 0',\n contentWideWidth: fallbackStyles.contentWideWidth\n }, function (_, key) {\n return \"--crowdsignal-forms-\".concat(Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"kebabCase\"])(key));\n });\n};\n/**\n * Extracts the comma separated color properties from an rgb string.\n * rgba strings are not supported for now because it introduces too many complications.\n *\n * @param {string} color The color string.\n * @return {string} The 3 comma separated rgb color properties.\n */\n\nvar extractRGBColorProperties = function extractRGBColorProperties(color) {\n if (!color || 'string' !== typeof color || -1 === color.indexOf('rgb') && 0 !== color.indexOf('#') || -1 < color.indexOf('rgba')) {\n return null;\n }\n\n if (0 === color.indexOf('#')) {\n color = hexToRGB(color);\n }\n\n return color.match(/\\((.*?)\\)/)[1];\n};\n/**\n * converts css color hex to rgb\n *\n * @param {string} h The hex color string.\n * @return {string} The rgb value.\n */\n\nvar hexToRGB = function hexToRGB(h) {\n var r = 0,\n g = 0,\n b = 0;\n var hexCode = 4 === h.length ? \"#\".concat(h[1] + h[1] + h[2] + h[2] + h[3] + h[3]) : h;\n\n if (7 === hexCode.length) {\n r = parseInt(hexCode.substr(1, 2), 16) || 0;\n g = parseInt(hexCode.substr(3, 2), 16) || 0;\n b = parseInt(hexCode.substr(5, 2), 16) || 0;\n }\n\n return \"rgb(\".concat(r, \", \").concat(g, \", \").concat(b, \")\");\n};\n/**\n * Returns a css 'class' string of overridden styles given a collection of attributes.\n *\n * @param {*} attributes The block's attributes\n * @param {...any} extraClasses A list of additional classes to add to the class string\n */\n\nvar getBlockCssClasses = function getBlockCssClasses(attributes) {\n var _attributes$borderRad;\n\n for (var _len = arguments.length, extraClasses = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n extraClasses[_key - 1] = arguments[_key];\n }\n\n return classnames__WEBPACK_IMPORTED_MODULE_1___default()({\n 'has-bg-color': attributes.backgroundColor,\n 'has-text-color': attributes.textColor,\n 'has-submit-button-bg-color': attributes.submitButtonBackgroundColor,\n 'has-submit-button-text-color': attributes.submitButtonTextColor,\n 'has-border-radius': (_attributes$borderRad = attributes.borderRadius) !== null && _attributes$borderRad !== void 0 ? _attributes$borderRad : false,\n 'has-box-shadow': attributes.hasBoxShadow\n }, extraClasses);\n};\n/**\n * Determines if the poll is closed based on its editor settings.\n *\n * @param {string} pollStatus The poll's status, as set in the editor.\n * @param {string} closedAfterDateTimeUTC The UTC date time string to close the poll after if pollStatus is PollStatus.CLOSED_AFTER.\n * @param {Date} currentDateTime Optionally set the current date that will be used for current time comparisons.\n */\n\nvar isPollClosed = function isPollClosed(pollStatus, closedAfterDateTimeUTC) {\n var currentDateTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Date();\n\n if (_constants__WEBPACK_IMPORTED_MODULE_3__[\"PollStatus\"].CLOSED === pollStatus) {\n return true;\n }\n\n if (_constants__WEBPACK_IMPORTED_MODULE_3__[\"PollStatus\"].CLOSED_AFTER === pollStatus) {\n var closedAfterDateTime = new Date(closedAfterDateTimeUTC);\n return closedAfterDateTime < currentDateTime;\n }\n\n return false;\n};\n/**\n * Parses the published post content to find the given pollId to determine if it is a published or unpublished poll.\n *\n * @param {*} pollId Id of the poll to search for.\n * @param {*} postContent Content of the published post.\n */\n\nvar pollIdExistsInPageContent = function pollIdExistsInPageContent(pollId, postContent) {\n if (!pollId) {\n return false;\n }\n\n var pollBlockInstanceStrings = postContent.split('<!-- '); // remove the 1st one since it will either be a blank string, or it will be other post content that is NOT a poll\n\n pollBlockInstanceStrings.splice(0, 1);\n return Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"some\"])(pollBlockInstanceStrings, function (blockInstanceString) {\n if (0 !== blockInstanceString.indexOf('wp:crowdsignal-forms/poll')) {\n return false;\n }\n\n var start = 'wp:crowdsignal-forms/poll'.length;\n var pollJsonString = blockInstanceString.substr(start, blockInstanceString.lastIndexOf('/-->') - start);\n var poll = JSON.parse(pollJsonString);\n return poll.pollId && poll.pollId === pollId;\n });\n};\n\n//# sourceURL=webpack:///./client/blocks/poll/util.js?");
|
110 |
|
111 |
/***/ }),
|
112 |
|
178 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
179 |
|
180 |
"use strict";
|
181 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar ClosedBanner = function ClosedBanner(_ref) {\n var hasVoted = _ref.hasVoted,\n isPollClosed = _ref.isPollClosed,\n isPollHidden = _ref.isPollHidden,\n showSubmitMessage = _ref.showSubmitMessage;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()({\n 'is-transparent': showSubmitMessage\n }, 'wp-block-crowdsignal-forms-poll__closed-banner');\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: classes\n }, isPollHidden && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_3__[\"__\"])('This Poll is Hidden'), isPollClosed && !isPollHidden && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_3__[\"__\"])('This Poll is Closed'), hasVoted && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_3__[\"__\"])('Thanks For Voting!'));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (ClosedBanner);\n\n//# sourceURL=webpack:///./client/components/poll/closed-banner.js?");
|
182 |
|
183 |
/***/ }),
|
184 |
|
214 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
215 |
|
216 |
"use strict";
|
217 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! seedrandom */ \"./node_modules/seedrandom/index.js\");\n/* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(seedrandom__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var blocks_poll_util__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! blocks/poll/util */ \"./client/blocks/poll/util.js\");\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! components/with-fallback-styles */ \"./client/components/with-fallback-styles/index.js\");\n/* harmony import */ var _closed_banner__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./closed-banner */ \"./client/components/poll/closed-banner.js\");\n/* harmony import */ var _results__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./results */ \"./client/components/poll/results.js\");\n/* harmony import */ var _vote__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./vote */ \"./client/components/poll/vote.js\");\n/* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./styles */ \"./client/components/poll/styles.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./util */ \"./client/components/poll/util.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var data_hooks__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! data/hooks */ \"./client/data/hooks/index.js\");\n/* harmony import */ var data_poll__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! data/poll */ \"./client/data/poll/index.js\");\n/* harmony import */ var _error_banner__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./error-banner */ \"./client/components/poll/error-banner.js\");\n/* harmony import */ var _submit_message__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./submit-message */ \"./client/components/poll/submit-message.js\");\n\n\n\n\n\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n\n\n\n/**\n * WordPress dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar Poll = function Poll(_ref) {\n var attributes = _ref.attributes,\n fallbackStyles = _ref.fallbackStyles,\n renderStyleProbe = _ref.renderStyleProbe;\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_6__[\"useState\"])(Math.random()),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default()(_useState, 1),\n randomAnswerSeed = _useState2[0];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_6__[\"useState\"])(''),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default()(_useState3, 2),\n errorMessage = _useState4[0],\n setErrorMessage = _useState4[1];\n\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_6__[\"useState\"])(false),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default()(_useState5, 2),\n dismissSubmitMessage = _useState6[0],\n setDismissSubmitMessage = _useState6[1];\n\n var apiPollData = attributes.apiPollData;\n var pollIdFromApi = apiPollData.id;\n\n var _usePollVote = Object(data_hooks__WEBPACK_IMPORTED_MODULE_20__[\"usePollVote\"])(pollIdFromApi, attributes.hasOneResponsePerComputer),\n hasVoted = _usePollVote.hasVoted,\n isVoting = _usePollVote.isVoting,\n vote = _usePollVote.vote;\n\n var handleSubmit = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee(selectedAnswerIds) {\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n setErrorMessage('');\n setDismissSubmitMessage(false);\n _context.next = 5;\n return vote(selectedAnswerIds);\n\n case 5:\n if (blocks_poll_constants__WEBPACK_IMPORTED_MODULE_12__[\"ConfirmMessageType\"].REDIRECT === attributes.confirmMessageType) {\n window.open(attributes.redirectAddress);\n }\n\n _context.next = 11;\n break;\n\n case 8:\n _context.prev = 8;\n _context.t0 = _context[\"catch\"](0);\n\n if (_context.t0 instanceof data_poll__WEBPACK_IMPORTED_MODULE_21__[\"CrowdsignalFormsError\"]) {\n setErrorMessage(_context.t0.message);\n } else {\n setErrorMessage(Object(lib_i18n__WEBPACK_IMPORTED_MODULE_19__[\"__\"])('Server error. Please try again.'));\n }\n\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[0, 8]]);\n }));\n\n return function handleSubmit(_x) {\n return _ref2.apply(this, arguments);\n };\n }();\n\n var isClosed = Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_11__[\"isPollClosed\"])(attributes.pollStatus, attributes.closedAfterDateTime);\n\n if (isClosed && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_12__[\"ClosedPollState\"].HIDDEN === attributes.closedPollState) {\n return null;\n }\n\n var showResults = isClosed && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_12__[\"ClosedPollState\"].SHOW_RESULTS === attributes.closedPollState || hasVoted && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_12__[\"ConfirmMessageType\"].RESULTS === attributes.confirmMessageType;\n var showSubmitMessage = hasVoted && !showResults && !dismissSubmitMessage && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_12__[\"ConfirmMessageType\"].REDIRECT !== attributes.confirmMessageType;\n var hasDefaultThankyou = blocks_poll_constants__WEBPACK_IMPORTED_MODULE_12__[\"ConfirmMessageType\"].THANK_YOU === attributes.confirmMessageType;\n var classes = Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_11__[\"getBlockCssClasses\"])(attributes, attributes.className, 'wp-block-crowdsignal-forms-poll', {\n 'has-voted': hasVoted,\n 'is-closed': isClosed,\n 'is-voting': isVoting,\n 'has-default-thankyou': hasDefaultThankyou\n });\n var answerClientIdMap = Object(lodash__WEBPACK_IMPORTED_MODULE_8__[\"reduce\"])(apiPollData.answers, function (accum, answer) {\n accum[answer.client_id] = answer.id;\n return accum;\n }, {});\n var answersWithIds = Object(lodash__WEBPACK_IMPORTED_MODULE_8__[\"map\"])(attributes.answers, function (answerWithoutIdFromApi) {\n var answerIdFromApi = answerClientIdMap[answerWithoutIdFromApi.answerId];\n return _objectSpread({}, answerWithoutIdFromApi, {\n answerIdFromApi: answerIdFromApi\n });\n });\n var answers = Object(_util__WEBPACK_IMPORTED_MODULE_18__[\"shuffleWithGenerator\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_8__[\"filter\"])(answersWithIds, function (answer) {\n return !!answer.text;\n }), attributes.randomizeAnswers ? new seedrandom__WEBPACK_IMPORTED_MODULE_7___default.a(randomAnswerSeed) : function () {\n return 1;\n });\n var contentClasses = classnames__WEBPACK_IMPORTED_MODULE_9___default()({\n 'is-transparent': showSubmitMessage\n }, 'wp-block-crowdsignal-forms-poll__content');\n\n if (attributes.fontFamily) {\n Object(_util__WEBPACK_IMPORTED_MODULE_18__[\"loadCustomFont\"])(attributes.fontFamily);\n }\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"div\", {\n className: classes,\n style: Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_11__[\"getStyleVars\"])(attributes, fallbackStyles)\n }, errorMessage && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_error_banner__WEBPACK_IMPORTED_MODULE_22__[\"default\"], null, errorMessage), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"div\", {\n className: contentClasses\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"h3\", {\n className: \"wp-block-crowdsignal-forms-poll__question\"\n }, Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_10__[\"decodeEntities\"])(attributes.question)), attributes.note && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"p\", {\n className: \"wp-block-crowdsignal-forms-poll__note\"\n }, Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_10__[\"decodeEntities\"])(attributes.note)), !showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_vote__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n answers: answers,\n isMultipleChoice: attributes.isMultipleChoice,\n onSubmit: handleSubmit,\n submitButtonLabel: attributes.submitButtonLabel,\n hasVoted: hasVoted,\n isVoting: isVoting,\n hideBranding: attributes.hideBranding\n }), showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_results__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n pollIdFromApi: pollIdFromApi,\n answers: answers,\n setErrorMessage: setErrorMessage,\n hideBranding: attributes.hideBranding\n })), showSubmitMessage && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_submit_message__WEBPACK_IMPORTED_MODULE_23__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, attributes, {\n setDismissSubmitMessage: setDismissSubmitMessage\n })), (isClosed || hasVoted) && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_closed_banner__WEBPACK_IMPORTED_MODULE_14__[\"default\"], {\n showSubmitMessage: showSubmitMessage,\n isPollClosed: isClosed,\n hasVoted: hasVoted\n }), renderStyleProbe());\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_13__[\"withFallbackStyles\"])(_styles__WEBPACK_IMPORTED_MODULE_17__[\"PollStyles\"], _styles__WEBPACK_IMPORTED_MODULE_17__[\"getPollStyles\"])(Poll));\n\n//# sourceURL=webpack:///./client/components/poll/index.js?");
|
218 |
|
219 |
/***/ }),
|
220 |
|
238 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
239 |
|
240 |
"use strict";
|
241 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getPollStyles\", function() { return getPollStyles; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStyles\", function() { return PollStyles; });\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! components/with-fallback-styles/util */ \"./client/components/with-fallback-styles/util.js\");\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\nvar getPollStyles = function getPollStyles(node) {\n if (null === node) {\n return {};\n }\n\n var buttonNode = node.querySelector('.wp-block-button__link');\n var textNode = node.querySelector('p');\n var h3Node = node.querySelector('h3');\n var wideContentNode = node.querySelector('.alignwide');\n return {\n accent: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(buttonNode),\n surface: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(textNode),\n text: window.getComputedStyle(textNode).color,\n bodyFontFamily: window.getComputedStyle(textNode).fontFamily,\n questionFontFamily: window.getComputedStyle(h3Node).fontFamily,\n textInverted: window.getComputedStyle(buttonNode).color,\n contentWideWidth: window.getComputedStyle(wideContentNode).maxWidth\n };\n};\nvar PollStyles = function PollStyles() {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"h3\", null, \"Question\"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button__link\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"entry-content\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"alignwide\"\n })));\n};\n\n//# sourceURL=webpack:///./client/components/poll/styles.js?");
|
242 |
|
243 |
/***/ }),
|
244 |
|
250 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
251 |
|
252 |
"use strict";
|
253 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var components_icon_close__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! components/icon/close */ \"./client/components/icon/close.js\");\n/* harmony import */ var components_icon_check_circle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! components/icon/check-circle */ \"./client/components/icon/check-circle.js\");\n/* harmony import */ var components_icon_thank_you__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! components/icon/thank-you */ \"./client/components/icon/thank-you.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./footer-branding */ \"./client/components/poll/footer-branding.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\n\nvar toggleAnimationPlayPause = function toggleAnimationPlayPause(event) {\n var player = event.target;\n\n if (!player) {\n return;\n }\n\n if (player.paused) {\n player.play();\n } else {\n player.pause();\n }\n};\n\nvar SubmitMessage = function SubmitMessage(_ref) {\n var confirmMessageType = _ref.confirmMessageType,\n customConfirmMessage = _ref.customConfirmMessage,\n setDismissSubmitMessage = _ref.setDismissSubmitMessage,\n hideBranding = _ref.hideBranding;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__submit-message-container\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__submit-message\"\n }, blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"ConfirmMessageType\"].THANK_YOU === confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"video\", {\n muted: true,\n autoPlay: true,\n loop: true,\n playsInline: true,\n poster: \"https://crowdsignal.files.wordpress.com/2020/02/thumbs-up-video-placeholder.jpg\",\n width: \"100%\",\n onClick: toggleAnimationPlayPause\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"source\", {\n src: \"https://crowdsignal.files.wordpress.com/2019/08/thumbs-up-cs.mp4\",\n type: \"video/mp4\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_thank_you__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n className: \"wp-block-crowdsignal-forms-poll__thank-you-sticker\"\n }), !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"img\", {\n className: \"wp-block-crowdsignal-forms-poll__thank-you-cs-sticker\",\n src: \"https://app.crowdsignal.com/images/svg/cs-logo-dots.svg\",\n alt: \"Crowdsignal sticker\"\n })), blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"ConfirmMessageType\"].CUSTOM_TEXT === confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__custom-message-check\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_check_circle__WEBPACK_IMPORTED_MODULE_4__[\"default\"], null)), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__custom-message\"\n }, Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(customConfirmMessage) ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Thanks for voting!') : customConfirmMessage)), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"button\", {\n className: \"wp-block-crowdsignal-forms-poll__dismiss-submit-message\",\n onClick: function onClick() {\n return setDismissSubmitMessage(true);\n }\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_close__WEBPACK_IMPORTED_MODULE_3__[\"default\"], null))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__submit-message-footer\"\n }, !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_footer_branding__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n showLogo: blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"ConfirmMessageType\"].THANK_YOU !== confirmMessageType\n })));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (SubmitMessage);\n\n//# sourceURL=webpack:///./client/components/poll/submit-message.js?");
|
254 |
|
255 |
/***/ }),
|
256 |
|
258 |
/*!****************************************!*\
|
259 |
!*** ./client/components/poll/util.js ***!
|
260 |
\****************************************/
|
261 |
+
/*! exports provided: addApiAnswerIds, shuffleWithGenerator, isAnswerEmpty, loadCustomFont */
|
262 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
263 |
|
264 |
"use strict";
|
265 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addApiAnswerIds\", function() { return addApiAnswerIds; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shuffleWithGenerator\", function() { return shuffleWithGenerator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAnswerEmpty\", function() { return isAnswerEmpty; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"loadCustomFont\", function() { return loadCustomFont; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Adds api answer ids to the answer objects (when they are available).\n *\n * @param {Array} answers Answers array\n * @param {Array} answerIdMap A json object with client answer ids as keys, and API answer ids as values.\n * @return {Array} Updated answers array\n */\n\nvar addApiAnswerIds = function addApiAnswerIds(answers, answerIdMap) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"map\"])(answers, function (answer) {\n if (typeof answer.answerIdFromApi !== 'undefined') {\n return answer;\n }\n\n return _objectSpread({}, answer, {\n answerIdFromApi: answerIdMap[answer.answerId]\n });\n });\n};\n/**\n * Fisher-Yates algorithm shuffle implementation.\n * Provides a predictable way of shuffling array items given a seed.\n *\n * @param {Array} toShuffle The array to shuffle.\n * @param {Function} randomNumberGenerator A function that generates a random number (like `seedrandom`).\n * @return {Array} The shuffled array.\n */\n\nvar shuffleWithGenerator = function shuffleWithGenerator(toShuffle, randomNumberGenerator) {\n var shuffled = toShuffle.slice();\n\n for (var i = shuffled.length - 1; i > 0; i--) {\n var j = Math.floor(randomNumberGenerator() * i);\n var tmp = shuffled[i];\n shuffled[i] = shuffled[j];\n shuffled[j] = tmp;\n }\n\n return shuffled;\n};\n/**\n * Determines if an answer is considered \"empty\", based on if text is set and blank or object has no values.\n *\n * @param {*} answer The answer object.\n */\n\nvar isAnswerEmpty = function isAnswerEmpty(answer) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(answer) || 'undefined' === typeof answer.text || null === answer.text || '' === answer.text;\n};\n/**\n * Loads a custom google font, by name, only once per page if called more than once for the same font.\n *\n * @param {*} font The name of the Google font\n */\n\nvar loadCustomFont = function loadCustomFont(font) {\n if (Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(font) || blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"FontFamilyType\"].THEME_DEFAULT === font || -1 === blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"GoogleFonts\"].indexOf(font)) {\n return;\n }\n\n var googleFontsLink = \"https://fonts.googleapis.com/css2?family=\".concat(font, \":wght@400;600;700&display=swap\");\n var crowdsignalFonts = Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"filter\"])(Array.from(document.head.childNodes), function (node) {\n return node.nodeName.toLowerCase() === 'link' && node.href === googleFontsLink;\n });\n\n if (crowdsignalFonts.length === 0) {\n document.head.appendChild(Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"tap\"])(document.createElement('link'), function (link) {\n link.type = 'text/css';\n link.rel = 'stylesheet';\n link.href = googleFontsLink;\n }));\n }\n};\n\n//# sourceURL=webpack:///./client/components/poll/util.js?");
|
266 |
|
267 |
/***/ }),
|
268 |
|
274 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
275 |
|
276 |
"use strict";
|
277 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ \"./node_modules/@babel/runtime/helpers/toConsumableArray.js\");\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _answer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./answer */ \"./client/components/poll/answer.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./footer-branding */ \"./client/components/poll/footer-branding.js\");\n\n\n\n\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\nvar PollVote = function PollVote(_ref) {\n var answers = _ref.answers,\n hasVoted = _ref.hasVoted,\n isMultipleChoice = _ref.isMultipleChoice,\n isVoting = _ref.isVoting,\n onSubmit = _ref.onSubmit,\n submitButtonLabel = _ref.submitButtonLabel,\n hideBranding = _ref.hideBranding;\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])([]),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),\n selected = _useState2[0],\n setSelected = _useState2[1];\n\n var handleSelect = function handleSelect(answerId) {\n if (!isMultipleChoice) {\n return setSelected([answerId]);\n }\n\n if (Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"includes\"])(selected, answerId)) {\n return setSelected(Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"without\"])(selected, answerId));\n }\n\n setSelected([].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1___default()(selected), [answerId]));\n };\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])([]),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2),\n focused = _useState4[0],\n setFocused = _useState4[1];\n\n var handleFocus = function handleFocus(answerId) {\n return setFocused([answerId]);\n };\n\n var handleSubmit = function handleSubmit(event) {\n event.preventDefault();\n onSubmit(selected);\n };\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"form\", {\n className: \"wp-block-crowdsignal-forms-poll__form\",\n onSubmit: handleSubmit\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__options\"\n }, Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"map\"])(answers, function (answer, index) {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_answer__WEBPACK_IMPORTED_MODULE_7__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({\n key: \"poll-answer-\".concat(index),\n isMultipleChoice: isMultipleChoice,\n isSelected: Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"includes\"])(selected, answer.answerIdFromApi),\n isFocused: Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"includes\"])(focused, answer.answerIdFromApi),\n onSelect: handleSelect,\n onFocus: handleFocus,\n hasVoted: hasVoted,\n isVoting: isVoting\n }, answer));\n })), !hasVoted && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__actions\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-button wp-block-crowdsignal-forms-poll__block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"input\", {\n type: \"submit\",\n className: \"wp-block-button__link wp-block-crowdsignal-forms-poll__submit-button\",\n disabled: isVoting || !selected.length,\n value: submitButtonLabel\n }))), !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp_block-crowdsignal-forms-poll__vote-branding\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_footer_branding__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n showLogo: false\n })));\n};\n\nPollVote.propTypes = {\n answers: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.array.isRequired,\n isMultipleChoice: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.bool,\n onSubmit: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.func.isRequired,\n submitButtonLabel: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.string.isRequired\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (PollVote);\n\n//# sourceURL=webpack:///./client/components/poll/vote.js?");
|
278 |
|
279 |
/***/ }),
|
280 |
|
310 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
311 |
|
312 |
"use strict";
|
313 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollResults\", function() { return usePollResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollVote\", function() { return usePollVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useIsCsConnected\", function() { return useIsCsConnected; });\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! js-cookie */ \"./node_modules/js-cookie/src/js.cookie.js\");\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(js_cookie__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var data_poll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! data/poll */ \"./client/data/poll/index.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util */ \"./client/data/hooks/util.js\");\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n\n\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\nvar usePollResults = function usePollResults(pollId) {\n var _useFetch = Object(_util__WEBPACK_IMPORTED_MODULE_6__[\"useFetch\"])(function () {\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestResults\"])(pollId);\n }, [pollId]),\n data = _useFetch.data,\n error = _useFetch.error,\n loading = _useFetch.loading;\n\n return {\n error: error,\n loading: loading,\n results: data\n };\n};\n/**\n * React Hook that returns state variables for voting status and a function to perform a vote.\n *\n * @param {number} pollId ID of the poll being loaded.\n * @param {boolean} enableVoteRestriction sets whether or not the vote cookie is read and set\n */\n\nvar usePollVote = function usePollVote(pollId) {\n var enableVoteRestriction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var cookieName = \"cs-poll-\".concat(pollId);\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),\n isVoting = _useState2[0],\n setIsVoting = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2),\n hasVoted = _useState4[0],\n setHasVoted = _useState4[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useEffect\"])(function () {\n if (enableVoteRestriction && undefined !== js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.get(cookieName)) {\n setHasVoted(true);\n }\n }, []);\n\n var vote = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(selectedAnswerIds) {\n var nonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n setIsVoting(true);\n _context.next = 4;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVoteNonce\"])(pollId);\n\n case 4:\n nonce = _context.sent;\n _context.next = 7;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVote\"])(nonce, pollId, selectedAnswerIds);\n\n case 7:\n setHasVoted(true);\n\n if (enableVoteRestriction) {\n js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.set(cookieName, new Date().getTime(), {\n sameSite: 'Strict',\n expires: 365\n });\n }\n\n case 9:\n _context.prev = 9;\n setIsVoting(false);\n return _context.finish(9);\n\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[0,, 9, 12]]);\n }));\n\n return function vote(_x) {\n return _ref.apply(this, arguments);\n };\n }();\n\n return {\n hasVoted: hasVoted,\n isVoting: isVoting,\n vote: vote\n };\n};\nvar useIsCsConnected = function useIsCsConnected() {\n /* assume connection is enabled, so placeholder doesn't flash while we add a block and wait for the request */\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(true),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState5, 2),\n isConnected = _useState6[0],\n setIsConnected = _useState6[1];\n\n var _useState7 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(true),\n _useState8 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState7, 2),\n isAccountVerified = _useState8[0],\n setIsAccountVerified = _useState8[1];\n\n var checkIsConnected = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() {\n var connectedState, isNowConnected, isNowVerified;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestIsCsConnected\"])();\n\n case 2:\n connectedState = _context2.sent;\n isNowConnected = blocks_poll_constants__WEBPACK_IMPORTED_MODULE_7__[\"ConnectedAccountState\"].CONNECTED === connectedState || blocks_poll_constants__WEBPACK_IMPORTED_MODULE_7__[\"ConnectedAccountState\"].NOT_VERIFIED === connectedState;\n isNowVerified = blocks_poll_constants__WEBPACK_IMPORTED_MODULE_7__[\"ConnectedAccountState\"].CONNECTED === connectedState;\n setIsConnected(isNowConnected);\n setIsAccountVerified(isNowVerified);\n return _context2.abrupt(\"return\", {\n isNowConnected: isNowConnected,\n isNowVerified: isNowVerified\n });\n\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function checkIsConnected() {\n return _ref2.apply(this, arguments);\n };\n }();\n\n Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useEffect\"])(function () {\n checkIsConnected();\n }, []);\n return {\n isConnected: isConnected,\n isAccountVerified: isAccountVerified,\n checkIsConnected: checkIsConnected\n };\n};\n\n//# sourceURL=webpack:///./client/data/hooks/index.js?");
|
314 |
|
315 |
/***/ }),
|
316 |
|
334 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
335 |
|
336 |
"use strict";
|
337 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestResults\", function() { return requestResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVoteNonce\", function() { return requestVoteNonce; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVote\", function() { return requestVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsError\", function() { return CrowdsignalFormsError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsServerError\", function() { return CrowdsignalFormsServerError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestIsCsConnected\", function() { return requestIsCsConnected; });\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\");\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/inherits.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ \"./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js\");\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ \"./node_modules/@babel/runtime/helpers/wrapNativeSuper.js\");\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/api-fetch */ \"@wordpress/api-fetch\");\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n\n\n\n\n\n\nfunction _createSuper(Derived) { return function () { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Fetch the poll results for the given pollId\n *\n * @param {number} pollId Poll ID.\n * @return {Promise} Promise that resolves to a key-value object with answer IDs and vote counts.\n */\n\nvar requestResults = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee(pollId) {\n var baseUrl;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n baseUrl = 'https://api.crowdsignal.com/v3/polls';\n return _context.abrupt(\"return\", window.fetch(\"\".concat(baseUrl, \"/\").concat(pollId, \"/results\"), {\n method: 'GET',\n headers: {\n 'content-type': 'application/json'\n }\n }).then(function (response) {\n if (response.status >= 200 && response.status < 300) {\n return response.json();\n }\n\n throw response;\n }).then(function (response) {\n if (404 === response.status) {\n // poll doesn't exist on the platform yet, return an empty result\n return {};\n } else if (response.error) {\n throw new Error(response.message);\n }\n\n return response.results.votes_by_answer;\n }));\n\n case 2:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function requestResults(_x) {\n return _ref.apply(this, arguments);\n };\n}();\nvar requestVoteNonce = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee2(pollId) {\n var hash, timestamp, respNonce, jsonNonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n hash = '5430eeac3911395001d731d9702fc38b'; // hash not used when format=json is passed\n\n timestamp = new Date().getTime();\n _context2.next = 4;\n return window.fetch(\"https://polldaddy.com/n/\".concat(hash, \"/\").concat(pollId, \"?\").concat(timestamp, \"&format=json\"));\n\n case 4:\n respNonce = _context2.sent;\n\n if (respNonce.ok) {\n _context2.next = 7;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 7:\n _context2.next = 9;\n return respNonce.json();\n\n case 9:\n jsonNonce = _context2.sent;\n\n if (jsonNonce.nonce) {\n _context2.next = 12;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 12:\n return _context2.abrupt(\"return\", jsonNonce.nonce);\n\n case 13:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function requestVoteNonce(_x2) {\n return _ref2.apply(this, arguments);\n };\n}();\nvar requestVote = /*#__PURE__*/function () {\n var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee3(nonce, pollId, selectedAnswerIds) {\n var answerString, respVote, jsonVote;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n answerString = selectedAnswerIds.join(',');\n _context3.next = 3;\n return window.fetch(\"https://polls.polldaddy.com/vote-js.php?format=json&p=\".concat(pollId, \"&b=1&a=\").concat(answerString, \"&o=&va=16&cookie=0&n=\").concat(nonce, \"&url=\").concat(encodeURIComponent(window.location)));\n\n case 3:\n respVote = _context3.sent;\n\n if (respVote.ok) {\n _context3.next = 6;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 6:\n _context3.next = 8;\n return respVote.json();\n\n case 8:\n jsonVote = _context3.sent;\n\n if (!('error' === jsonVote.status)) {\n _context3.next = 11;\n break;\n }\n\n throw new CrowdsignalFormsError(jsonVote.error);\n\n case 11:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n return function requestVote(_x3, _x4, _x5) {\n return _ref3.apply(this, arguments);\n };\n}();\nvar CrowdsignalFormsError = /*#__PURE__*/function (_Error) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsError, _Error);\n\n var _super = _createSuper(CrowdsignalFormsError);\n\n function CrowdsignalFormsError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsError);\n\n return _super.apply(this, arguments);\n }\n\n return CrowdsignalFormsError;\n}( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default()(Error));\nvar CrowdsignalFormsServerError = /*#__PURE__*/function (_CrowdsignalFormsErro) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsServerError, _CrowdsignalFormsErro);\n\n var _super2 = _createSuper(CrowdsignalFormsServerError);\n\n function CrowdsignalFormsServerError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsServerError);\n\n return _super2.call(this, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Server error. Please try again.'));\n }\n\n return CrowdsignalFormsServerError;\n}(CrowdsignalFormsError);\n/**\n * Returns the connected state of the current user's account.\n *\n * @return {string} Enum value of the account's state.\n */\n\nvar requestIsCsConnected = /*#__PURE__*/function () {\n var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee4() {\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default()({\n path: \"/crowdsignal-forms/v1/account/connected\",\n method: 'GET'\n });\n\n case 2:\n return _context4.abrupt(\"return\", _context4.sent);\n\n case 3:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n\n return function requestIsCsConnected() {\n return _ref4.apply(this, arguments);\n };\n}();\n\n//# sourceURL=webpack:///./client/data/poll/index.js?");
|
338 |
|
339 |
/***/ }),
|
340 |
|
build/rtl/editor-rtl.css
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
/* This file was automatically generated on Aug 10 2020 20:56:11 */
|
2 |
+
|
3 |
+
#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="full"] .wp-block-crowdsignal-forms-poll{border-right-width:0;border-left-width:0}@media screen and (min-width: 660px){#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="wide"] .wp-block-crowdsignal-forms-poll__content,#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="full"] .wp-block-crowdsignal-forms-poll__content{padding:80px}}#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer{cursor:text}#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer:hover,#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer.is-focused{color:inherit}#editor .editor-styles-wrapper .wp-block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{cursor:text}.wp-block-crowdsignal-forms__redirect-url input[type="text"]{width:100%}.wp-block-crowdsignal-forms__redirect-url__suggestions{width:260px}.wp-block-crowdsignal-forms__row{display:flex;flex-direction:row}.wp-block-crowdsignal-forms__row .wp-block-crowdsignal-forms__small-text-input input[type="text"]{width:40px}.wp-block-crowdsignal-forms__row .wp-block-crowdsignal-forms__small-text-input input[type="number"]{width:50px}.wp-block-crowdsignal-forms-poll__edit-bar{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-right:4px solid #d82e20;background:#f8dad8;display:flex;flex-direction:row;justify-content:space-between;align-items:center}.wp-block-crowdsignal-forms-poll__edit-bar .wp-block-crowdsignal-forms-poll__edit-bar-message{padding-inline-end:24px}.wp-block-crowdsignal-forms-poll__edit-bar button.wp-block-crowdsignal-forms-poll__edit-bar-button{border:2px solid #d82e20;border-radius:4px;color:#d82e20;background:transparent;padding:8px 16px;cursor:pointer}.wp-block-crowdsignal-forms__view-results.is-disabled{opacity:0.5;pointer-events:none}.wp-block-crowdsignal-forms__connect-to-crowdsignal{border:1px solid #000;font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;padding:24px;text-align:initial}.wp-block-crowdsignal-forms__connect-to-crowdsignal-header{display:flex;flex-direction:row;align-items:center}.wp-block-crowdsignal-forms__connect-to-crowdsignal-body{font-size:13px;margin-top:24px;margin-bottom:16px}.wp-block-crowdsignal-forms__connect-to-crowdsignal-title{font-size:24pt;margin-inline-start:16px}.crowdsignal-poll-wrapper:not(:first-child),[data-type="crowdsignal-forms/poll"]:not(:first-child){margin-top:3em}.crowdsignal-poll-wrapper:not(:last-child),[data-type="crowdsignal-forms/poll"]:not(:last-child){margin-bottom:3em}.wp-block-crowdsignal-forms-poll{border-color:var(--crowdsignal-forms-border-color);border-style:solid;border-width:var(--crowdsignal-forms-border-width);position:relative;text-align:right}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll{border-right-width:0;border-left-width:0}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question{margin:0 0 28px}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question:first-child{margin-top:0}.wp-block-crowdsignal-forms-poll p.wp-block-crowdsignal-forms-poll__note{font-style:italic;margin:0 0 32px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:40px 24px 16px 24px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__question{font-family:var(--crowdsignal-forms-question-font-family)}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__answer-label,.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__answer-results-answer,.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__note{font-family:var(--crowdsignal-forms-body-font-family)}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{margin:0 auto;max-width:var(--crowdsignal-forms-content-wide-width)}@media screen and (min-width: 660px){.alignwide.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content,.alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:80px}}.wp-block-crowdsignal-forms-poll.is-closed .wp-block-crowdsignal-forms-poll__form{opacity:0.5}.wp-block-crowdsignal-forms-poll.is-hidden{opacity:0.5}.wp-block-crowdsignal-forms-poll.has-text-color{color:var(--crowdsignal-forms-text-color)}.wp-block-crowdsignal-forms-poll.has-bg-color{background-color:var(--crowdsignal-forms-bg-color)}.wp-block-crowdsignal-forms-poll.has-border-radius{border-radius:var(--crowdsignal-forms-border-radius);overflow:hidden}.wp-block-crowdsignal-forms-poll.has-box-shadow{box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23)}.wp-block-crowdsignal-forms-poll .is-transparent{opacity:0;pointer-events:none}.wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button:disabled{opacity:0.7}.wp-block-crowdsignal-forms-poll.has-submit-button-bg-color .wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{background-color:var(--crowdsignal-forms-submit-button-bg-color)}.wp-block-crowdsignal-forms-poll.has-submit-button-text-color .wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{color:var(--crowdsignal-forms-submit-button-text-color)}.wp-block-crowdsignal-forms-poll__answer{cursor:pointer;display:flex;font-size:inherit;font-weight:600;margin:0 0 16px;padding:0 2px;position:relative}.wp-block-crowdsignal-forms-poll__answer:hover,.wp-block-crowdsignal-forms-poll__answer.is-focused{color:var(--crowdsignal-forms-submit-button-bg-color)}.has-voted .wp-block-crowdsignal-forms-poll__answer{opacity:0.5}input[type="checkbox"].wp-block-crowdsignal-forms-poll__input,input[type="radio"].wp-block-crowdsignal-forms-poll__input{height:0;opacity:0;position:absolute;width:0}.wp-block-crowdsignal-forms-poll__check{display:inline-block;height:1em;margin:0 0 0 10px;position:relative;width:1em}.wp-block-crowdsignal-forms-poll__check::before{background-color:transparent;border:1.5px solid var(--crowdsignal-forms-text-color);border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;transition:background-color 0.3s, border-color 0.3s;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::before{border-radius:3px}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice.is-selected .wp-block-crowdsignal-forms-poll__check::before{border-color:var(--crowdsignal-forms-border-color);background-color:var(--crowdsignal-forms-border-color)}.wp-block-crowdsignal-forms-poll__answer.is-selected:not(.is-multiple-choice) .wp-block-crowdsignal-forms-poll__check::after{animation-duration:0.3s;animation-name:crowdsignal-forms-animation__pop;animation-iteration-count:1;background-clip:padding-box;background-color:var(--crowdsignal-forms-border-color);border:4.5px solid transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;position:absolute;right:0;top:0;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-selected.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::after{border-color:var(--crowdsignal-forms-submit-button-text-color);border-style:solid;border-width:0 2px 2px 0;box-sizing:border-box;content:"";display:block;height:25%;margin:-0.1em -0.2em 0 0;position:absolute;right:50%;top:50%;transform:rotateZ(45deg);width:50%}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper{flex:1;word-break:break-word}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label{line-height:1;vertical-align:top}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label span::after{vertical-align:top}.wp-block-crowdsignal-forms-poll__button{border:0;padding:0}.wp-block-crowdsignal-forms-poll__actions{display:flex;justify-content:flex-end}.wp-block-crowdsignal-forms-poll__actions .wp-block-button{margin:0}.editor-styles-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__actions .wp-block-button.wp-block-crowdsignal-forms-poll__block-button{margin:0}.wp-block-crowdsignal-forms-poll__closed-banner{background-color:var(--crowdsignal-forms-border-color);box-sizing:border-box;display:flex;color:var(--crowdsignal-forms-submit-button-text-color);font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;justify-content:center;padding:calc(var(--crowdsignal-forms-border-width) + 0.2em) 0 0.2em;width:100%}.is-hidden .wp-block-crowdsignal-forms-poll__closed-banner{font-style:italic}.wp-block-crowdsignal-forms-poll__error{color:red}.wp-block-crowdsignal-forms-poll__results-list{margin:0 0 1em;position:relative}.wp-block-crowdsignal-forms-poll__answer-results{display:flex;flex-direction:column;margin:0 0 16px;width:100%}.wp-block-crowdsignal-forms-poll__answer-results:last-child{margin:0}.wp-block-crowdsignal-forms-poll__answer-results-labels{align-items:flex-end;display:flex;margin:0 0 8px;width:100%;word-break:break-word}.wp-block-crowdsignal-forms-poll__answer-results-answer{flex:1;font-size:1em;font-weight:600}.wp-block-crowdsignal-forms-poll__answer-results-votes{font-size:0.75em;line-height:2}.wp-block-crowdsignal-forms-poll__answer-results-percent{font-weight:600;line-height:1.6}.wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results-percent{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;margin-right:20px;transition:opacity 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-percent{display:none}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse;background-color:var(--crowdsignal-forms-text-color);font-size:0.7em;height:1em;width:50px}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes:last-child,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent:last-child{width:40px}.wp-block-crowdsignal-forms-poll__answer-results-progress-track{border:1px solid;border-color:rgba(var(--crowdsignal-forms-text-color-properties), 0.3);box-sizing:border-box;height:1em;width:100%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-track{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse}.wp-block-crowdsignal-forms-poll__answer-results-progress-bar{animation-fill-mode:forwards;background-color:var(--crowdsignal-forms-submit-button-bg-color);height:100%;transition:background-color 0.3s, width 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:0}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{background-color:var(--crowdsignal-forms-text-color);width:25%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+1) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:40%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+2) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:75%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+3) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:50%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+4) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:60%}.wp-block-crowdsignal-forms-poll__results-footer{display:flex;flex-direction:column;justify-content:space-between;width:100%;font-size:0.9em}.wp-block-crowdsignal-forms-poll__results-total{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;position:relative;text-align:left;width:100%;margin-bottom:1em}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total{color:transparent}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total::before{animation-name:crowdsignal-forms-animation__pulse;animation-duration:1.5s;animation-iteration-count:infinite;background-color:var(--crowdsignal-forms-text-color);content:"";display:block;position:absolute;left:0;height:1em;width:150px}.wp-block-crowdsignal-forms-poll__footer-branding{display:flex;justify-content:space-between;align-items:center;width:100%}.wp-block-crowdsignal-forms-poll__footer-branding img.wp-block-crowdsignal-forms-poll__footer-branding-logo{width:50px;height:50px;margin-right:0;margin-left:0}.wp-block-crowdsignal-forms-poll__footer-cs-link{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:16px;text-decoration:none;text-transform:uppercase}.wp-block-crowdsignal-forms-poll__footer-cs-link:not(:hover){color:var(--crowdsignal-forms-text-color);opacity:0.4}.has-default-thankyou .wp-block-crowdsignal-forms-poll__footer-cs-link{color:#333}.wp-block-crowdsignal-forms-poll__error-banner{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-right:4px solid #d82e20;background:#f8dad8}.wp-block-crowdsignal-forms-poll__submit-message-container{position:absolute;background-color:var(--crowdsignal-forms-bg-color);right:0;top:0;width:100%;height:100%;overflow:hidden}.has-default-thankyou .wp-block-crowdsignal-forms-poll__submit-message-container{background-color:#fff}.wp-block-crowdsignal-forms-poll__submit-message{position:relative}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message{position:absolute;left:0;top:0;background-color:transparent;color:#000;text-decoration:none;border:none}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message:hover{background:inherit}.wp-block-crowdsignal-forms-poll__submit-message-footer{position:absolute;bottom:0;right:0;padding:16px 24px;width:100%;background-color:inherit}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker{left:25px;top:66px}.wp-block-crowdsignal-forms-poll__thank-you-sticker{left:132px;top:12px}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker,.wp-block-crowdsignal-forms-poll__thank-you-sticker{filter:drop-shadow(0 1px 2px rgba(0,0,0,0.2));width:100px;height:100px;position:absolute}.wp-block-crowdsignal-forms-poll__custom-message-check{color:var(--crowdsignal-forms-text-color);padding-right:24px;padding-top:24px}.wp-block-crowdsignal-forms-poll__custom-message{font-family:var(--crowdsignal-forms-question-font-family);font-weight:600;padding:16px 24px}.wp_block-crowdsignal-forms-poll__vote-branding{margin-top:16px}.crowdsignal-forms__style-probe{display:none}
|
build/rtl/poll-rtl.css
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
/* This file was automatically generated on Aug 10 2020 20:56:21 */
|
2 |
+
|
3 |
+
@keyframes crowdsignal-forms-animation__pop{0%{transform:scale(0)}50%{transform:scale(1.2)}100%{transform:scale(1)}}@keyframes crowdsignal-forms-animation__pulse{0%{opacity:0.4}50%{opacity:0.7}100%{opacity:0.4}}.crowdsignal-poll-wrapper:not(:first-child),[data-type="crowdsignal-forms/poll"]:not(:first-child){margin-top:3em}.crowdsignal-poll-wrapper:not(:last-child),[data-type="crowdsignal-forms/poll"]:not(:last-child){margin-bottom:3em}.wp-block-crowdsignal-forms-poll{border-color:var(--crowdsignal-forms-border-color);border-style:solid;border-width:var(--crowdsignal-forms-border-width);position:relative;text-align:right}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll{border-right-width:0;border-left-width:0}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question{margin:0 0 28px}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question:first-child{margin-top:0}.wp-block-crowdsignal-forms-poll p.wp-block-crowdsignal-forms-poll__note{font-style:italic;margin:0 0 32px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:40px 24px 16px 24px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__question{font-family:var(--crowdsignal-forms-question-font-family)}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__answer-label,.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__answer-results-answer,.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content .wp-block-crowdsignal-forms-poll__note{font-family:var(--crowdsignal-forms-body-font-family)}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{margin:0 auto;max-width:var(--crowdsignal-forms-content-wide-width)}@media screen and (min-width: 660px){.alignwide.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content,.alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:80px}}.wp-block-crowdsignal-forms-poll.is-closed .wp-block-crowdsignal-forms-poll__form{opacity:0.5}.wp-block-crowdsignal-forms-poll.is-hidden{opacity:0.5}.wp-block-crowdsignal-forms-poll.has-text-color{color:var(--crowdsignal-forms-text-color)}.wp-block-crowdsignal-forms-poll.has-bg-color{background-color:var(--crowdsignal-forms-bg-color)}.wp-block-crowdsignal-forms-poll.has-border-radius{border-radius:var(--crowdsignal-forms-border-radius);overflow:hidden}.wp-block-crowdsignal-forms-poll.has-box-shadow{box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23)}.wp-block-crowdsignal-forms-poll .is-transparent{opacity:0;pointer-events:none}.wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button:disabled{opacity:0.7}.wp-block-crowdsignal-forms-poll.has-submit-button-bg-color .wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{background-color:var(--crowdsignal-forms-submit-button-bg-color)}.wp-block-crowdsignal-forms-poll.has-submit-button-text-color .wp-block-crowdsignal-forms-poll__block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{color:var(--crowdsignal-forms-submit-button-text-color)}.wp-block-crowdsignal-forms-poll__answer{cursor:pointer;display:flex;font-size:inherit;font-weight:600;margin:0 0 16px;padding:0 2px;position:relative}.wp-block-crowdsignal-forms-poll__answer:hover,.wp-block-crowdsignal-forms-poll__answer.is-focused{color:var(--crowdsignal-forms-submit-button-bg-color)}.has-voted .wp-block-crowdsignal-forms-poll__answer{opacity:0.5}input[type="checkbox"].wp-block-crowdsignal-forms-poll__input,input[type="radio"].wp-block-crowdsignal-forms-poll__input{height:0;opacity:0;position:absolute;width:0}.wp-block-crowdsignal-forms-poll__check{display:inline-block;height:1em;margin:0 0 0 10px;position:relative;width:1em}.wp-block-crowdsignal-forms-poll__check::before{background-color:transparent;border:1.5px solid var(--crowdsignal-forms-text-color);border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;transition:background-color 0.3s, border-color 0.3s;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::before{border-radius:3px}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice.is-selected .wp-block-crowdsignal-forms-poll__check::before{border-color:var(--crowdsignal-forms-border-color);background-color:var(--crowdsignal-forms-border-color)}.wp-block-crowdsignal-forms-poll__answer.is-selected:not(.is-multiple-choice) .wp-block-crowdsignal-forms-poll__check::after{animation-duration:0.3s;animation-name:crowdsignal-forms-animation__pop;animation-iteration-count:1;background-clip:padding-box;background-color:var(--crowdsignal-forms-border-color);border:4.5px solid transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;position:absolute;right:0;top:0;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-selected.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::after{border-color:var(--crowdsignal-forms-submit-button-text-color);border-style:solid;border-width:0 2px 2px 0;box-sizing:border-box;content:"";display:block;height:25%;margin:-0.1em -0.2em 0 0;position:absolute;right:50%;top:50%;transform:rotateZ(45deg);width:50%}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper{flex:1;word-break:break-word}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label{line-height:1;vertical-align:top}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label span::after{vertical-align:top}.wp-block-crowdsignal-forms-poll__button{border:0;padding:0}.wp-block-crowdsignal-forms-poll__actions{display:flex;justify-content:flex-end}.wp-block-crowdsignal-forms-poll__actions .wp-block-button{margin:0}.editor-styles-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__actions .wp-block-button.wp-block-crowdsignal-forms-poll__block-button{margin:0}.wp-block-crowdsignal-forms-poll__closed-banner{background-color:var(--crowdsignal-forms-border-color);box-sizing:border-box;display:flex;color:var(--crowdsignal-forms-submit-button-text-color);font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;justify-content:center;padding:calc(var(--crowdsignal-forms-border-width) + 0.2em) 0 0.2em;width:100%}.is-hidden .wp-block-crowdsignal-forms-poll__closed-banner{font-style:italic}.wp-block-crowdsignal-forms-poll__error{color:red}.wp-block-crowdsignal-forms-poll__results-list{margin:0 0 1em;position:relative}.wp-block-crowdsignal-forms-poll__answer-results{display:flex;flex-direction:column;margin:0 0 16px;width:100%}.wp-block-crowdsignal-forms-poll__answer-results:last-child{margin:0}.wp-block-crowdsignal-forms-poll__answer-results-labels{align-items:flex-end;display:flex;margin:0 0 8px;width:100%;word-break:break-word}.wp-block-crowdsignal-forms-poll__answer-results-answer{flex:1;font-size:1em;font-weight:600}.wp-block-crowdsignal-forms-poll__answer-results-votes{font-size:0.75em;line-height:2}.wp-block-crowdsignal-forms-poll__answer-results-percent{font-weight:600;line-height:1.6}.wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results-percent{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;margin-right:20px;transition:opacity 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-percent{display:none}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse;background-color:var(--crowdsignal-forms-text-color);font-size:0.7em;height:1em;width:50px}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes:last-child,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent:last-child{width:40px}.wp-block-crowdsignal-forms-poll__answer-results-progress-track{border:1px solid;border-color:rgba(var(--crowdsignal-forms-text-color-properties), 0.3);box-sizing:border-box;height:1em;width:100%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-track{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse}.wp-block-crowdsignal-forms-poll__answer-results-progress-bar{animation-fill-mode:forwards;background-color:var(--crowdsignal-forms-submit-button-bg-color);height:100%;transition:background-color 0.3s, width 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:0}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{background-color:var(--crowdsignal-forms-text-color);width:25%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+1) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:40%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+2) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:75%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+3) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:50%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+4) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:60%}.wp-block-crowdsignal-forms-poll__results-footer{display:flex;flex-direction:column;justify-content:space-between;width:100%;font-size:0.9em}.wp-block-crowdsignal-forms-poll__results-total{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;position:relative;text-align:left;width:100%;margin-bottom:1em}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total{color:transparent}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total::before{animation-name:crowdsignal-forms-animation__pulse;animation-duration:1.5s;animation-iteration-count:infinite;background-color:var(--crowdsignal-forms-text-color);content:"";display:block;position:absolute;left:0;height:1em;width:150px}.wp-block-crowdsignal-forms-poll__footer-branding{display:flex;justify-content:space-between;align-items:center;width:100%}.wp-block-crowdsignal-forms-poll__footer-branding img.wp-block-crowdsignal-forms-poll__footer-branding-logo{width:50px;height:50px;margin-right:0;margin-left:0}.wp-block-crowdsignal-forms-poll__footer-cs-link{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:16px;text-decoration:none;text-transform:uppercase}.wp-block-crowdsignal-forms-poll__footer-cs-link:not(:hover){color:var(--crowdsignal-forms-text-color);opacity:0.4}.has-default-thankyou .wp-block-crowdsignal-forms-poll__footer-cs-link{color:#333}.wp-block-crowdsignal-forms-poll__error-banner{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-right:4px solid #d82e20;background:#f8dad8}.wp-block-crowdsignal-forms-poll__submit-message-container{position:absolute;background-color:var(--crowdsignal-forms-bg-color);right:0;top:0;width:100%;height:100%;overflow:hidden}.has-default-thankyou .wp-block-crowdsignal-forms-poll__submit-message-container{background-color:#fff}.wp-block-crowdsignal-forms-poll__submit-message{position:relative}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message{position:absolute;left:0;top:0;background-color:transparent;color:#000;text-decoration:none;border:none}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message:hover{background:inherit}.wp-block-crowdsignal-forms-poll__submit-message-footer{position:absolute;bottom:0;right:0;padding:16px 24px;width:100%;background-color:inherit}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker{left:25px;top:66px}.wp-block-crowdsignal-forms-poll__thank-you-sticker{left:132px;top:12px}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker,.wp-block-crowdsignal-forms-poll__thank-you-sticker{filter:drop-shadow(0 1px 2px rgba(0,0,0,0.2));width:100px;height:100px;position:absolute}.wp-block-crowdsignal-forms-poll__custom-message-check{color:var(--crowdsignal-forms-text-color);padding-right:24px;padding-top:24px}.wp-block-crowdsignal-forms-poll__custom-message{font-family:var(--crowdsignal-forms-question-font-family);font-weight:600;padding:16px 24px}.wp_block-crowdsignal-forms-poll__vote-branding{margin-top:16px}.crowdsignal-forms__style-probe{display:none}
|
changelog.txt
CHANGED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
= 1.0 =
|
2 |
+
* Update default sidebar status
|
3 |
+
* Increase Default Poll Margins
|
4 |
+
* Test suite for admin hooks
|
5 |
+
* Copy text reviews
|
6 |
+
* Added support for loading curated list of google fonts
|
7 |
+
* Normalize "thanks you" message
|
8 |
+
* Fix display of "thank you" message (custom and default) on dark backgrounds
|
9 |
+
* Add Separate Question and Body Font Family fallbacks
|
10 |
+
* Fix styles on wp-admin not honoring margins
|
11 |
+
* Fix submit button styling for themes with very specific selectors (ex TwentyNineteen theme)
|
12 |
+
* Add Unverified Account Check
|
13 |
+
* Code cleanup
|
14 |
+
* Update translations
|
crowdsignal-forms.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* Plugin Name: Crowdsignal Forms
|
16 |
* Plugin URI: https://crowdsignal.com/crowdsignal-forms/
|
17 |
* Description: Crowdsignal Form Blocks
|
18 |
-
* Version: 0.
|
19 |
* Author: Automattic
|
20 |
* Author URI: https://automattic.com/
|
21 |
* License: GPL-2.0+
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
die;
|
29 |
}
|
30 |
|
31 |
-
define( 'CROWDSIGNAL_FORMS_VERSION', '0
|
32 |
define( 'CROWDSIGNAL_FORMS_PLUGIN_FILE', __FILE__ );
|
33 |
define( 'CROWDSIGNAL_FORMS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
34 |
|
@@ -41,4 +41,3 @@ Crowdsignal_Forms\Autoloader::get_instance()
|
|
41 |
->register();
|
42 |
|
43 |
Crowdsignal_Forms\Crowdsignal_Forms::init();
|
44 |
-
|
15 |
* Plugin Name: Crowdsignal Forms
|
16 |
* Plugin URI: https://crowdsignal.com/crowdsignal-forms/
|
17 |
* Description: Crowdsignal Form Blocks
|
18 |
+
* Version: 1.0.0
|
19 |
* Author: Automattic
|
20 |
* Author URI: https://automattic.com/
|
21 |
* License: GPL-2.0+
|
28 |
die;
|
29 |
}
|
30 |
|
31 |
+
define( 'CROWDSIGNAL_FORMS_VERSION', '1.0' );
|
32 |
define( 'CROWDSIGNAL_FORMS_PLUGIN_FILE', __FILE__ );
|
33 |
define( 'CROWDSIGNAL_FORMS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
34 |
|
41 |
->register();
|
42 |
|
43 |
Crowdsignal_Forms\Crowdsignal_Forms::init();
|
|
includes/admin/admin-styles.css
CHANGED
@@ -15,22 +15,18 @@
|
|
15 |
font-weight: 700;
|
16 |
}
|
17 |
|
18 |
-
.wrap {
|
19 |
-
margin: 0;
|
20 |
-
}
|
21 |
-
|
22 |
.crowdsignal-setup__header {
|
23 |
background-color: #fff;
|
24 |
text-align: center;
|
25 |
box-shadow: 0 1px 0 #ccd0d4,0 1px 1px 1px rgba(0,0,0,0.04);
|
26 |
margin-left: -20px;
|
|
|
|
|
27 |
}
|
28 |
|
29 |
.crowdsignal-setup__header-container {
|
30 |
display: flex;
|
31 |
flex-wrap: wrap;
|
32 |
-
margin: 0 auto;
|
33 |
-
max-width: 65rem;
|
34 |
padding-bottom: .375rem;
|
35 |
padding-left: 16px;
|
36 |
}
|
@@ -49,7 +45,7 @@
|
|
49 |
|
50 |
.crowdsignal-setup__footer {
|
51 |
text-align: center;
|
52 |
-
margin: 100px
|
53 |
}
|
54 |
|
55 |
.crowdsignal-setup__footer-container {
|
@@ -84,7 +80,6 @@
|
|
84 |
display: flex;
|
85 |
flex-direction: column;
|
86 |
align-content: center;
|
87 |
-
max-width: 65rem;
|
88 |
margin: 24px auto 0;
|
89 |
border: 1px solid rgba(213, 213, 213, 0.5);
|
90 |
}
|
@@ -200,20 +195,10 @@
|
|
200 |
|
201 |
|
202 |
.wrap .error.crowdsignal-message, .wrap .updated.crowdsignal-message {
|
203 |
-
|
204 |
-
margin-left: -20px;
|
205 |
-
margin-right: -20px;
|
206 |
-
margin-bottom: 5px;
|
207 |
-
box-sizing: border-box;
|
208 |
-
border-right: none;
|
209 |
}
|
210 |
|
211 |
.crowdsignal-settings__main-content {
|
212 |
-
max-width: 65rem;
|
213 |
-
margin-top: 24px;
|
214 |
-
margin-bottom: 48px;
|
215 |
-
margin-right: auto;
|
216 |
-
margin-left: auto;
|
217 |
}
|
218 |
|
219 |
.dops-card {
|
@@ -266,7 +251,7 @@
|
|
266 |
margin-top: 40px;
|
267 |
line-height: 150%;
|
268 |
font-size: 14px;
|
269 |
-
line-height:
|
270 |
color: #444444;
|
271 |
}
|
272 |
|
@@ -274,11 +259,6 @@
|
|
274 |
margin-top: 80px;
|
275 |
}
|
276 |
|
277 |
-
.button.crowdsignal-settings__cta {
|
278 |
-
margin-top: -5px;
|
279 |
-
margin-left: 8px;
|
280 |
-
}
|
281 |
-
|
282 |
.crowdsignal-settings__submit {
|
283 |
margin-top: 10px;
|
284 |
}
|
@@ -291,18 +271,14 @@
|
|
291 |
}
|
292 |
}
|
293 |
|
294 |
-
@media screen and (max-width:
|
295 |
-
.
|
296 |
-
margin-
|
297 |
-
margin-
|
298 |
}
|
299 |
-
}
|
300 |
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
margin-left: 0px;
|
305 |
-
margin-right: 0px;
|
306 |
-
margin-bottom: 5px;
|
307 |
}
|
308 |
}
|
15 |
font-weight: 700;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
18 |
.crowdsignal-setup__header {
|
19 |
background-color: #fff;
|
20 |
text-align: center;
|
21 |
box-shadow: 0 1px 0 #ccd0d4,0 1px 1px 1px rgba(0,0,0,0.04);
|
22 |
margin-left: -20px;
|
23 |
+
margin-right: -20px;
|
24 |
+
margin-bottom: 8px;
|
25 |
}
|
26 |
|
27 |
.crowdsignal-setup__header-container {
|
28 |
display: flex;
|
29 |
flex-wrap: wrap;
|
|
|
|
|
30 |
padding-bottom: .375rem;
|
31 |
padding-left: 16px;
|
32 |
}
|
45 |
|
46 |
.crowdsignal-setup__footer {
|
47 |
text-align: center;
|
48 |
+
margin: 100px -20px 2rem;
|
49 |
}
|
50 |
|
51 |
.crowdsignal-setup__footer-container {
|
80 |
display: flex;
|
81 |
flex-direction: column;
|
82 |
align-content: center;
|
|
|
83 |
margin: 24px auto 0;
|
84 |
border: 1px solid rgba(213, 213, 213, 0.5);
|
85 |
}
|
195 |
|
196 |
|
197 |
.wrap .error.crowdsignal-message, .wrap .updated.crowdsignal-message {
|
198 |
+
margin-bottom: 8px;
|
|
|
|
|
|
|
|
|
|
|
199 |
}
|
200 |
|
201 |
.crowdsignal-settings__main-content {
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
|
204 |
.dops-card {
|
251 |
margin-top: 40px;
|
252 |
line-height: 150%;
|
253 |
font-size: 14px;
|
254 |
+
line-height: 30px;
|
255 |
color: #444444;
|
256 |
}
|
257 |
|
259 |
margin-top: 80px;
|
260 |
}
|
261 |
|
|
|
|
|
|
|
|
|
|
|
262 |
.crowdsignal-settings__submit {
|
263 |
margin-top: 10px;
|
264 |
}
|
271 |
}
|
272 |
}
|
273 |
|
274 |
+
@media screen and (max-width: 782px) {
|
275 |
+
.crowdsignal-setup__header {
|
276 |
+
margin-left: -12px;
|
277 |
+
margin-right: -12px;
|
278 |
}
|
|
|
279 |
|
280 |
+
.crowdsignal-setup__footer {
|
281 |
+
margin-left: -12px;
|
282 |
+
margin-right: -12px;
|
|
|
|
|
|
|
283 |
}
|
284 |
}
|
includes/admin/class-admin-hooks.php
CHANGED
@@ -117,7 +117,7 @@ class Admin_Hooks {
|
|
117 |
return;
|
118 |
}
|
119 |
|
120 |
-
$authenticator =
|
121 |
if ( ! $authenticator->get_user_code() ) {
|
122 |
// Plugin hasn't been authenticated yet, don't try to sync the block.
|
123 |
return;
|
117 |
return;
|
118 |
}
|
119 |
|
120 |
+
$authenticator = Crowdsignal_Forms::instance()->get_api_authenticator();
|
121 |
if ( ! $authenticator->get_user_code() ) {
|
122 |
// Plugin hasn't been authenticated yet, don't try to sync the block.
|
123 |
return;
|
includes/admin/class-crowdsignal-forms-settings.php
CHANGED
@@ -42,7 +42,7 @@ class Crowdsignal_Forms_Settings {
|
|
42 |
* Enqueues scripts for setup page.
|
43 |
*/
|
44 |
public function admin_enqueue_scripts() {
|
45 |
-
wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '/admin-styles.css', array(), '0
|
46 |
}
|
47 |
|
48 |
/**
|
@@ -143,7 +143,7 @@ class Crowdsignal_Forms_Settings {
|
|
143 |
$this->init_settings();
|
144 |
include dirname( __FILE__ ) . '/views/html-admin-setup-header.php';
|
145 |
?>
|
146 |
-
<div class="
|
147 |
|
148 |
<div class="crowdsignal-settings__main-content">
|
149 |
<div class="dops-card dops-section-header is-compact">
|
@@ -218,8 +218,8 @@ class Crowdsignal_Forms_Settings {
|
|
218 |
<div class="crowdsignal-settings__text">
|
219 |
<?php
|
220 |
if ( ! get_option( Crowdsignal_Forms_Api_Authenticator::API_KEY_NAME ) ) {
|
221 |
-
esc_html_e( "If you don't have an API key we can help you here:", 'crowdsignal-forms' );
|
222 |
-
echo '<a class="button
|
223 |
}
|
224 |
?>
|
225 |
|
42 |
* Enqueues scripts for setup page.
|
43 |
*/
|
44 |
public function admin_enqueue_scripts() {
|
45 |
+
wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '/admin-styles.css', array(), '1.0' );
|
46 |
}
|
47 |
|
48 |
/**
|
143 |
$this->init_settings();
|
144 |
include dirname( __FILE__ ) . '/views/html-admin-setup-header.php';
|
145 |
?>
|
146 |
+
<div class="crowdsignal-settings-wrap">
|
147 |
|
148 |
<div class="crowdsignal-settings__main-content">
|
149 |
<div class="dops-card dops-section-header is-compact">
|
218 |
<div class="crowdsignal-settings__text">
|
219 |
<?php
|
220 |
if ( ! get_option( Crowdsignal_Forms_Api_Authenticator::API_KEY_NAME ) ) {
|
221 |
+
esc_html_e( "If you don't have an API key we can help you here: ", 'crowdsignal-forms' );
|
222 |
+
echo '<a class="button" rel="noopener noreferrer" href="/wp-admin/admin.php?page=crowdsignal-forms-setup">Get an API Key</a>';
|
223 |
}
|
224 |
?>
|
225 |
|
includes/admin/class-crowdsignal-forms-setup.php
CHANGED
@@ -9,6 +9,7 @@ namespace Crowdsignal_Forms\Admin;
|
|
9 |
|
10 |
use Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices;
|
11 |
use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
|
|
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
exit;
|
@@ -41,7 +42,7 @@ class Crowdsignal_Forms_Setup {
|
|
41 |
* @param bool $show to show the notice or not.
|
42 |
*/
|
43 |
public function show_setup_notice( $show ) {
|
44 |
-
$api_auth_provider =
|
45 |
if ( $api_auth_provider->get_user_code() ) {
|
46 |
return false;
|
47 |
} else {
|
@@ -72,7 +73,7 @@ class Crowdsignal_Forms_Setup {
|
|
72 |
*/
|
73 |
public function setup_page() {
|
74 |
|
75 |
-
$api_auth_provider =
|
76 |
|
77 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- got_api_key check later
|
78 |
$step = ! empty( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
|
9 |
|
10 |
use Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices;
|
11 |
use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
|
12 |
+
use Crowdsignal_Forms\Crowdsignal_Forms;
|
13 |
|
14 |
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
exit;
|
42 |
* @param bool $show to show the notice or not.
|
43 |
*/
|
44 |
public function show_setup_notice( $show ) {
|
45 |
+
$api_auth_provider = Crowdsignal_Forms::instance()->get_api_authenticator();
|
46 |
if ( $api_auth_provider->get_user_code() ) {
|
47 |
return false;
|
48 |
} else {
|
73 |
*/
|
74 |
public function setup_page() {
|
75 |
|
76 |
+
$api_auth_provider = Crowdsignal_Forms::instance()->get_api_authenticator();
|
77 |
|
78 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- got_api_key check later
|
79 |
$step = ! empty( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
|
includes/admin/rtl/admin-styles-rtl.css
ADDED
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* This file was automatically generated on Aug 10 2020 20:55:36 */
|
2 |
+
|
3 |
+
@font-face {
|
4 |
+
font-family: Recoleta;
|
5 |
+
src: url( "https://s1.wp.com/i/fonts/recoleta/400.woff2" );
|
6 |
+
}
|
7 |
+
|
8 |
+
@font-face {
|
9 |
+
font-family: Recoleta;
|
10 |
+
src: url( "https://s1.wp.com/i/fonts/recoleta/500.woff2" );
|
11 |
+
font-weight: 500;
|
12 |
+
}
|
13 |
+
|
14 |
+
@font-face {
|
15 |
+
font-family: Recoleta;
|
16 |
+
src: url( "https://s1.wp.com/i/fonts/recoleta/700.woff2" );
|
17 |
+
font-weight: 700;
|
18 |
+
}
|
19 |
+
|
20 |
+
.crowdsignal-setup__header {
|
21 |
+
background-color: #fff;
|
22 |
+
text-align: center;
|
23 |
+
box-shadow: 0 1px 0 #ccd0d4,0 1px 1px 1px rgba(0,0,0,0.04);
|
24 |
+
margin-right: -20px;
|
25 |
+
margin-left: -20px;
|
26 |
+
margin-bottom: 8px;
|
27 |
+
}
|
28 |
+
|
29 |
+
.crowdsignal-setup__header-container {
|
30 |
+
display: flex;
|
31 |
+
flex-wrap: wrap;
|
32 |
+
padding-bottom: .375rem;
|
33 |
+
padding-right: 16px;
|
34 |
+
}
|
35 |
+
|
36 |
+
.crowdsignal-setup__logo-container {
|
37 |
+
flex-grow: 0;
|
38 |
+
flex-shrink: 0;
|
39 |
+
padding: .6875rem 0 0;
|
40 |
+
display: inline-block;
|
41 |
+
}
|
42 |
+
|
43 |
+
.crowdsignal-setup__email-activation {
|
44 |
+
font-size: 16px !important;
|
45 |
+
font-style: italic;
|
46 |
+
}
|
47 |
+
|
48 |
+
.crowdsignal-setup__footer {
|
49 |
+
text-align: center;
|
50 |
+
margin: 100px -20px 2rem;
|
51 |
+
}
|
52 |
+
|
53 |
+
.crowdsignal-setup__footer-container {
|
54 |
+
margin-bottom: .5rem;
|
55 |
+
}
|
56 |
+
|
57 |
+
.crowdsignal-setup__footer-attr {
|
58 |
+
width: 11.25rem;
|
59 |
+
}
|
60 |
+
|
61 |
+
.crowdsignal-setup__footer-links {
|
62 |
+
border-top: 1px #e1e1e1 solid;
|
63 |
+
border-bottom: 1px #e1e1e1 solid;
|
64 |
+
margin-top: 0;
|
65 |
+
margin-bottom: 1rem;
|
66 |
+
}
|
67 |
+
|
68 |
+
.crowdsignal-setup__footer-item {
|
69 |
+
display: inline-block;
|
70 |
+
margin-bottom: 0;
|
71 |
+
}
|
72 |
+
|
73 |
+
.crowdsignal-setup__footer-link {
|
74 |
+
padding: 1rem .5rem;
|
75 |
+
color: #888;
|
76 |
+
display: inline-block;
|
77 |
+
cursor: pointer;
|
78 |
+
}
|
79 |
+
|
80 |
+
.crowdsignal-setup__main {
|
81 |
+
background-color: #fff;
|
82 |
+
display: flex;
|
83 |
+
flex-direction: column;
|
84 |
+
align-content: center;
|
85 |
+
margin: 24px auto 0;
|
86 |
+
border: 1px solid rgba(213, 213, 213, 0.5);
|
87 |
+
}
|
88 |
+
|
89 |
+
.crowdsignal-setup__main img {
|
90 |
+
width: 100%;
|
91 |
+
height: auto;
|
92 |
+
max-height: 150px;
|
93 |
+
}
|
94 |
+
|
95 |
+
.crowdsignal-setup__content {
|
96 |
+
padding: 0 20px 20px;
|
97 |
+
text-align: center;
|
98 |
+
display: flex;
|
99 |
+
flex-direction: column;
|
100 |
+
justify-content: space-around;
|
101 |
+
min-height: 400px;
|
102 |
+
margin: 40px 0;
|
103 |
+
}
|
104 |
+
|
105 |
+
.crowdsignal-setup__content p {
|
106 |
+
font-size: 18px;
|
107 |
+
max-width: 800px;
|
108 |
+
margin: 0 auto;
|
109 |
+
}
|
110 |
+
|
111 |
+
.crowdsignal-setup__content h3,
|
112 |
+
.crowdsignal-setup__content h4 {
|
113 |
+
font-family: Recoleta, sans-serif;
|
114 |
+
font-weight: 700;
|
115 |
+
font-size: 40px;
|
116 |
+
line-height: 150%;
|
117 |
+
margin: 0;
|
118 |
+
}
|
119 |
+
|
120 |
+
.crowdsignal-setup__content h4 {
|
121 |
+
font-size: 34px;
|
122 |
+
line-height: 140%;
|
123 |
+
}
|
124 |
+
|
125 |
+
.crowdsignal-setup__button {
|
126 |
+
margin: 0 auto;
|
127 |
+
background-color: #c9356e;
|
128 |
+
border-color: #8c1749;
|
129 |
+
color: #ffffff;
|
130 |
+
font-weight: 500;
|
131 |
+
align-items: center;
|
132 |
+
border-radius: 5px;
|
133 |
+
border-style: solid;
|
134 |
+
border-width: 1px 1px 2px;
|
135 |
+
box-sizing: border-box;
|
136 |
+
cursor: pointer;
|
137 |
+
display: inline-flex;
|
138 |
+
font-size: 14px;
|
139 |
+
height: 32px;
|
140 |
+
justify-content: center;
|
141 |
+
line-height: 24px;
|
142 |
+
outline: 0;
|
143 |
+
padding: 3px 15px 2px;
|
144 |
+
text-align: center;
|
145 |
+
transition: background-color .1s ease-out, border-color .1s ease-out;
|
146 |
+
white-space: nowrap;
|
147 |
+
width: fit-content;
|
148 |
+
min-width: 200px;
|
149 |
+
}
|
150 |
+
|
151 |
+
.crowdsignal-setup__button:hover {
|
152 |
+
background-color: #eb6594;
|
153 |
+
}
|
154 |
+
|
155 |
+
.crowdsignal-setup__support {
|
156 |
+
font-size: 14px;
|
157 |
+
}
|
158 |
+
|
159 |
+
.crowdsignal-setup__top {
|
160 |
+
margin-top: 32px;
|
161 |
+
}
|
162 |
+
|
163 |
+
.crowdsignal-setup__middle {
|
164 |
+
min-height: 100px;
|
165 |
+
margin-left: auto;
|
166 |
+
margin-right: auto;
|
167 |
+
padding-right: 0px;
|
168 |
+
border: 1px none #000;
|
169 |
+
border-radius: 0px;
|
170 |
+
margin-top: 40px;
|
171 |
+
}
|
172 |
+
|
173 |
+
.crowdsignal-setup__middle a {
|
174 |
+
text-decoration: none;
|
175 |
+
}
|
176 |
+
|
177 |
+
.crowdsignal-setup__video-container {
|
178 |
+
display: block;
|
179 |
+
overflow: hidden;
|
180 |
+
position: relative;
|
181 |
+
margin-top: 64px;
|
182 |
+
margin-bottom: 120px;
|
183 |
+
padding-top: 56.25%;
|
184 |
+
width: 100%;
|
185 |
+
}
|
186 |
+
|
187 |
+
.crowdsignal-setup__video {
|
188 |
+
position: absolute;
|
189 |
+
top: 0;
|
190 |
+
right: 0;
|
191 |
+
bottom: 0;
|
192 |
+
left: 0;
|
193 |
+
width: 100%;
|
194 |
+
height: 100%;
|
195 |
+
background-color: #e2e2e2;
|
196 |
+
}
|
197 |
+
|
198 |
+
|
199 |
+
.wrap .error.crowdsignal-message, .wrap .updated.crowdsignal-message {
|
200 |
+
margin-bottom: 8px;
|
201 |
+
}
|
202 |
+
|
203 |
+
.crowdsignal-settings__main-content {
|
204 |
+
}
|
205 |
+
|
206 |
+
.dops-card {
|
207 |
+
display: block;
|
208 |
+
position: relative;
|
209 |
+
margin: 0 auto 10px;
|
210 |
+
padding: 16px;
|
211 |
+
box-sizing: border-box;
|
212 |
+
background: #fff;
|
213 |
+
box-shadow: 0 0 0 1px #ccd0d4,0 1px 1px 1px rgba(0,0,0,.04);
|
214 |
+
}
|
215 |
+
|
216 |
+
.dops-card.is-compact {
|
217 |
+
margin-bottom: 1px;
|
218 |
+
padding: 16px 24px;
|
219 |
+
}
|
220 |
+
|
221 |
+
.dops-section-header.dops-card {
|
222 |
+
display: flex;
|
223 |
+
flex-wrap: wrap;
|
224 |
+
padding-top: .6875rem;
|
225 |
+
padding-bottom: .6875rem;
|
226 |
+
position: relative;
|
227 |
+
}
|
228 |
+
|
229 |
+
.dops-section-header__label {
|
230 |
+
line-height: 1.75rem;
|
231 |
+
color: #414141;
|
232 |
+
font-size: .875rem;
|
233 |
+
}
|
234 |
+
|
235 |
+
.dops-section-header__label-text {
|
236 |
+
position: relative;
|
237 |
+
margin-left: .5rem;
|
238 |
+
white-space: nowrap;
|
239 |
+
overflow: hidden;
|
240 |
+
width: 100%;
|
241 |
+
padding-left: .5rem;
|
242 |
+
min-width: 0;
|
243 |
+
}
|
244 |
+
|
245 |
+
.crowdsignal-settings__middle {
|
246 |
+
min-height: 100px;
|
247 |
+
padding-right: 0px;
|
248 |
+
border: 1px none #000;
|
249 |
+
border-radius: 0px;
|
250 |
+
}
|
251 |
+
|
252 |
+
.crowdsignal-settings__text {
|
253 |
+
margin-top: 40px;
|
254 |
+
line-height: 150%;
|
255 |
+
font-size: 14px;
|
256 |
+
line-height: 30px;
|
257 |
+
color: #444444;
|
258 |
+
}
|
259 |
+
|
260 |
+
.crowdsignal-settings__bottom {
|
261 |
+
margin-top: 80px;
|
262 |
+
}
|
263 |
+
|
264 |
+
.crowdsignal-settings__submit {
|
265 |
+
margin-top: 10px;
|
266 |
+
}
|
267 |
+
|
268 |
+
@media screen and (min-width: 782px) {
|
269 |
+
.crowdsignal-settings__submit {
|
270 |
+
margin-top: -45px;
|
271 |
+
display: block;
|
272 |
+
margin-right: 585px;
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
@media screen and (max-width: 782px) {
|
277 |
+
.crowdsignal-setup__header {
|
278 |
+
margin-right: -12px;
|
279 |
+
margin-left: -12px;
|
280 |
+
}
|
281 |
+
|
282 |
+
.crowdsignal-setup__footer {
|
283 |
+
margin-right: -12px;
|
284 |
+
margin-left: -12px;
|
285 |
+
}
|
286 |
+
}
|
includes/admin/views/html-admin-setup-header.php
CHANGED
@@ -45,7 +45,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
45 |
case 'disconnected':
|
46 |
echo '<div class="updated fade crowdsignal-message"><p>' . esc_html__( 'Successfully disconnected from Crowdsignal.', 'crowdsignal-forms' ) . '</p></div>';
|
47 |
break;
|
48 |
-
case '
|
49 |
echo '<div class="updated crowdsignal-message"><p>' . esc_html__( 'Success! Your Crowdsignal account is successfully connected! You are ready!', 'crowdsignal-forms' ) . '</p></div>';
|
50 |
break;
|
51 |
case 'api-key-added':
|
45 |
case 'disconnected':
|
46 |
echo '<div class="updated fade crowdsignal-message"><p>' . esc_html__( 'Successfully disconnected from Crowdsignal.', 'crowdsignal-forms' ) . '</p></div>';
|
47 |
break;
|
48 |
+
case 'connected':
|
49 |
echo '<div class="updated crowdsignal-message"><p>' . esc_html__( 'Success! Your Crowdsignal account is successfully connected! You are ready!', 'crowdsignal-forms' ) . '</p></div>';
|
50 |
break;
|
51 |
case 'api-key-added':
|
includes/admin/views/html-admin-setup-step-1.php
CHANGED
@@ -77,4 +77,3 @@ const showConnect = ( title ) => {
|
|
77 |
}
|
78 |
} )( document.getElementById( 'cs-connect-form' ) );
|
79 |
</script>
|
80 |
-
</div>
|
77 |
}
|
78 |
} )( document.getElementById( 'cs-connect-form' ) );
|
79 |
</script>
|
|
includes/class-crowdsignal-forms.php
CHANGED
@@ -119,6 +119,14 @@ final class Crowdsignal_Forms {
|
|
119 |
*/
|
120 |
private $blocks_assets;
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
/**
|
123 |
* Initialize the singleton instance.
|
124 |
*
|
@@ -300,9 +308,8 @@ final class Crowdsignal_Forms {
|
|
300 |
* @return $headers array the modified array.
|
301 |
*/
|
302 |
public function add_auth_request_headers( $headers ) {
|
303 |
-
$cs_authenticator =
|
304 |
-
|
305 |
-
$user_code = $cs_authenticator->get_user_code();
|
306 |
|
307 |
if ( ! empty( $user_code ) ) {
|
308 |
$headers['x-api-partner-guid'] = $cs_authenticator->get_api_key();
|
@@ -326,7 +333,9 @@ final class Crowdsignal_Forms {
|
|
326 |
}
|
327 |
|
328 |
/**
|
329 |
-
* Set the
|
|
|
|
|
330 |
*
|
331 |
* @param Post_Poll_Meta_Gateway $gateway The gateway.
|
332 |
*
|
@@ -359,4 +368,32 @@ final class Crowdsignal_Forms {
|
|
359 |
$language_path = basename( $this->plugin_dir ) . '/languages';
|
360 |
load_plugin_textdomain( $this->plugin_textdomain, false, $language_path );
|
361 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
}
|
119 |
*/
|
120 |
private $blocks_assets;
|
121 |
|
122 |
+
/**
|
123 |
+
* The instance of the api authenticator.
|
124 |
+
*
|
125 |
+
* @since 1.0.0
|
126 |
+
* @var Crowdsignal_Forms_Api_Authenticator|null
|
127 |
+
*/
|
128 |
+
private $api_authenticator;
|
129 |
+
|
130 |
/**
|
131 |
* Initialize the singleton instance.
|
132 |
*
|
308 |
* @return $headers array the modified array.
|
309 |
*/
|
310 |
public function add_auth_request_headers( $headers ) {
|
311 |
+
$cs_authenticator = $this->get_api_authenticator();
|
312 |
+
$user_code = $cs_authenticator->get_user_code();
|
|
|
313 |
|
314 |
if ( ! empty( $user_code ) ) {
|
315 |
$headers['x-api-partner-guid'] = $cs_authenticator->get_api_key();
|
333 |
}
|
334 |
|
335 |
/**
|
336 |
+
* Set the meta gateway.
|
337 |
+
*
|
338 |
+
* @since 1.0.0
|
339 |
*
|
340 |
* @param Post_Poll_Meta_Gateway $gateway The gateway.
|
341 |
*
|
368 |
$language_path = basename( $this->plugin_dir ) . '/languages';
|
369 |
load_plugin_textdomain( $this->plugin_textdomain, false, $language_path );
|
370 |
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Get the authenticator
|
374 |
+
*
|
375 |
+
* @since 1.0.0
|
376 |
+
*
|
377 |
+
* @return Crowdsignal_Forms_Api_Authenticator|null
|
378 |
+
*/
|
379 |
+
public function get_api_authenticator() {
|
380 |
+
if ( null === $this->api_authenticator ) {
|
381 |
+
$this->api_authenticator = new Crowdsignal_Forms_Api_Authenticator();
|
382 |
+
}
|
383 |
+
return $this->api_authenticator;
|
384 |
+
}
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Set the authenticator
|
388 |
+
*
|
389 |
+
* @param Crowdsignal_Forms_Api_Authenticator $api_authenticator The authenticator to use.
|
390 |
+
*
|
391 |
+
* @since 1.0.0
|
392 |
+
*
|
393 |
+
* @return $this
|
394 |
+
*/
|
395 |
+
public function set_api_authenticator( $api_authenticator ) {
|
396 |
+
$this->api_authenticator = $api_authenticator;
|
397 |
+
return $this;
|
398 |
+
}
|
399 |
}
|
includes/frontend/blocks/class-crowdsignal-forms-poll-block.php
CHANGED
@@ -57,7 +57,7 @@ class Crowdsignal_Forms_Poll_Block implements Crowdsignal_Forms_Block {
|
|
57 |
* @return string
|
58 |
*/
|
59 |
public function render( $attributes ) {
|
60 |
-
if ( $this->should_hide_poll() ) {
|
61 |
return '';
|
62 |
}
|
63 |
|
@@ -113,15 +113,21 @@ class Crowdsignal_Forms_Poll_Block implements Crowdsignal_Forms_Block {
|
|
113 |
/**
|
114 |
* Determines if the poll should be rendered or not.
|
115 |
*
|
|
|
116 |
* @return bool
|
117 |
*/
|
118 |
-
private function should_hide_poll() {
|
|
|
|
|
|
|
|
|
119 |
if ( null !== self::$is_cs_connected ) {
|
120 |
return ! self::$is_cs_connected;
|
121 |
}
|
122 |
|
123 |
-
$api_auth_provider =
|
124 |
self::$is_cs_connected = $api_auth_provider->get_user_code();
|
|
|
125 |
|
126 |
return ! self::$is_cs_connected;
|
127 |
}
|
57 |
* @return string
|
58 |
*/
|
59 |
public function render( $attributes ) {
|
60 |
+
if ( $this->should_hide_poll( $attributes ) ) {
|
61 |
return '';
|
62 |
}
|
63 |
|
113 |
/**
|
114 |
* Determines if the poll should be rendered or not.
|
115 |
*
|
116 |
+
* @param array $attributes The poll's saved attributes.
|
117 |
* @return bool
|
118 |
*/
|
119 |
+
private function should_hide_poll( $attributes ) {
|
120 |
+
if ( empty( $attributes['question'] ) ) {
|
121 |
+
return true;
|
122 |
+
}
|
123 |
+
|
124 |
if ( null !== self::$is_cs_connected ) {
|
125 |
return ! self::$is_cs_connected;
|
126 |
}
|
127 |
|
128 |
+
$api_auth_provider = Crowdsignal_Forms::instance()->get_api_authenticator();
|
129 |
self::$is_cs_connected = $api_auth_provider->get_user_code();
|
130 |
+
// purposely not doing the account is_verified check to avoid making a slow query on every page load.
|
131 |
|
132 |
return ! self::$is_cs_connected;
|
133 |
}
|
includes/gateways/class-api-gateway-interface.php
CHANGED
@@ -70,4 +70,13 @@ interface Api_Gateway_Interface {
|
|
70 |
* @return array|\WP_Error
|
71 |
*/
|
72 |
public function get_capabilities();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
70 |
* @return array|\WP_Error
|
71 |
*/
|
72 |
public function get_capabilities();
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get the account's verified status.
|
76 |
+
*
|
77 |
+
* @since 0.9.1 ??
|
78 |
+
*
|
79 |
+
* @return bool|\WP_Error
|
80 |
+
*/
|
81 |
+
public function get_is_user_verified();
|
82 |
}
|
includes/gateways/class-api-gateway.php
CHANGED
@@ -342,4 +342,30 @@ class Api_Gateway implements Api_Gateway_Interface {
|
|
342 |
private function is_poll_response_valid( $response ) {
|
343 |
return null !== $response && isset( $response['poll'] );
|
344 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
}
|
342 |
private function is_poll_response_valid( $response ) {
|
343 |
return null !== $response && isset( $response['poll'] );
|
344 |
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Get the account's verified status.
|
348 |
+
*
|
349 |
+
* @since 0.9.1 ??
|
350 |
+
*
|
351 |
+
* @return bool|\WP_Error
|
352 |
+
*/
|
353 |
+
public function get_is_user_verified() {
|
354 |
+
$response = $this->perform_request( 'GET', '/account/verified' );
|
355 |
+
if ( is_wp_error( $response ) ) {
|
356 |
+
return $response;
|
357 |
+
}
|
358 |
+
|
359 |
+
$body = wp_remote_retrieve_body( $response );
|
360 |
+
$response_data = json_decode( $body, true );
|
361 |
+
|
362 |
+
if ( null === $response_data || ! is_array( $response_data ) ) {
|
363 |
+
if ( isset( $response_data['error'] ) ) {
|
364 |
+
return new \WP_Error( $response_data['error'], $response_data );
|
365 |
+
}
|
366 |
+
return new \WP_Error( 'decode-failed' );
|
367 |
+
}
|
368 |
+
|
369 |
+
return $response_data['is_verified'];
|
370 |
+
}
|
371 |
}
|
includes/rest-api/controllers/class-account-controller.php
CHANGED
@@ -107,18 +107,28 @@ class Account_Controller {
|
|
107 |
}
|
108 |
|
109 |
/**
|
110 |
-
* Gets the
|
111 |
*
|
112 |
* @return \WP_REST_Response|\WP_Error
|
113 |
*/
|
114 |
public function is_cs_connected() {
|
115 |
if ( defined( 'IS_WPCOM' ) && true === constant( 'IS_WPCOM' ) ) {
|
116 |
-
return
|
117 |
}
|
118 |
|
119 |
-
$api_auth_provider =
|
120 |
$user_code = $api_auth_provider->get_user_code();
|
121 |
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
}
|
124 |
}
|
107 |
}
|
108 |
|
109 |
/**
|
110 |
+
* Gets the state of the Crowdsignal connection.
|
111 |
*
|
112 |
* @return \WP_REST_Response|\WP_Error
|
113 |
*/
|
114 |
public function is_cs_connected() {
|
115 |
if ( defined( 'IS_WPCOM' ) && true === constant( 'IS_WPCOM' ) ) {
|
116 |
+
return rest_ensure_response( 'connected' );
|
117 |
}
|
118 |
|
119 |
+
$api_auth_provider = Crowdsignal_Forms::instance()->get_api_authenticator();
|
120 |
$user_code = $api_auth_provider->get_user_code();
|
121 |
|
122 |
+
if ( empty( $user_code ) ) {
|
123 |
+
return rest_ensure_response( 'not-connected' );
|
124 |
+
}
|
125 |
+
|
126 |
+
$is_verified = Crowdsignal_Forms::instance()->get_api_gateway()->get_is_user_verified();
|
127 |
+
if ( is_wp_error( $is_verified ) ) {
|
128 |
+
return rest_ensure_response( $is_verified );
|
129 |
+
}
|
130 |
+
|
131 |
+
$res = $is_verified ? 'connected' : 'not-verified';
|
132 |
+
return rest_ensure_response( $res );
|
133 |
}
|
134 |
}
|
languages/crowdsignal-forms.pot
CHANGED
@@ -9,7 +9,7 @@ msgstr ""
|
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2020-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.5.0-alpha-c4c9f7e\n"
|
15 |
"X-Domain: crowdsignal-forms\n"
|
@@ -87,7 +87,7 @@ msgid "Connect"
|
|
87 |
msgstr ""
|
88 |
|
89 |
#: includes/admin/class-crowdsignal-forms-settings.php:221
|
90 |
-
msgid "If you don't have an API key we can help you here:"
|
91 |
msgstr ""
|
92 |
|
93 |
#: includes/admin/views/html-admin-notice-core-setup.php:17
|
@@ -180,11 +180,11 @@ msgstr ""
|
|
180 |
msgid "<a href=\"%1s\" target=\"_blank\">Read more about us here.</a>"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: includes/frontend/blocks/class-crowdsignal-forms-poll-block.php:
|
184 |
msgid "Untitled Poll"
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: includes/frontend/blocks/class-crowdsignal-forms-poll-block.php:
|
188 |
msgid "Submit"
|
189 |
msgstr ""
|
190 |
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2020-08-10T19:52:35+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.5.0-alpha-c4c9f7e\n"
|
15 |
"X-Domain: crowdsignal-forms\n"
|
87 |
msgstr ""
|
88 |
|
89 |
#: includes/admin/class-crowdsignal-forms-settings.php:221
|
90 |
+
msgid "If you don't have an API key we can help you here: "
|
91 |
msgstr ""
|
92 |
|
93 |
#: includes/admin/views/html-admin-notice-core-setup.php:17
|
180 |
msgid "<a href=\"%1s\" target=\"_blank\">Read more about us here.</a>"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: includes/frontend/blocks/class-crowdsignal-forms-poll-block.php:155
|
184 |
msgid "Untitled Poll"
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: includes/frontend/blocks/class-crowdsignal-forms-poll-block.php:184
|
188 |
msgid "Submit"
|
189 |
msgstr ""
|
190 |
|